$directories = array();
$directories[] = isset($serendipity['template']) ? $serendipity['template'] . '/' : '';
- if ( isset($serendipity['template_engine']) ) {
+ if (isset($serendipity['template_engine']) && $serendipity['template_engine'] != 'default') {
$directories[] = $serendipity['template_engine'] . '/';
}
$directories[] = $serendipity['defaultTemplate'] .'/';
* @param string The type of an artifact (category|entry)
* @param string The type of access to grant (read|write)
* @param array The ID of the group to grant access to
- * @param string A variable option for an artifact
* @return boolean True if ACL was applied, false if not.
*/
-function serendipity_ACLGrant($artifact_id, $artifact_type, $artifact_mode, $groups, $artifact_index = '') {
+function serendipity_ACLGrant($artifact_id, $artifact_type, $artifact_mode, $groups) {
global $serendipity;
if (empty($groups) || !is_array($groups)) {
// Delete all old existing relations.
serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}access
- WHERE artifact_id = " . (int)$artifact_id . "
- AND artifact_type = '" . serendipity_db_escape_string($artifact_type) . "'
- AND artifact_mode = '" . serendipity_db_escape_string($artifact_mode) . "'
- AND artifact_index = '" . serendipity_db_escape_string($artifact_index) . "'");
+ WHERE artifact_id = " . (int)$artifact_id . "
+ AND artifact_type = '" . serendipity_db_escape_string($artifact_type) . "'
+ AND artifact_mode = '" . serendipity_db_escape_string($artifact_mode) . "'");
$data = array(
'artifact_id' => (int)$artifact_id,
'artifact_type' => $artifact_type,
'artifact_mode' => $artifact_mode,
- 'artifact_index' => $artifact_index
+ 'artifact_index' => ''
);
if (count($data) < 1) {
* @param int The ID of the artifact to set the access
* @param string The type of an artifact (category|entry)
* @param string The type of access to check for (read|write)
- * @param string A variable option for an artifact
* @return array Returns an array of all groups that are allowed for this kind of access. You can then check if you are the member of any of the groups returned here.
*/
-function serendipity_ACLGet($artifact_id, $artifact_type, $artifact_mode, $artifact_index) {
+function serendipity_ACLGet($artifact_id, $artifact_type, $artifact_mode) {
global $serendipity;
$sql = "SELECT groupid, artifact_index FROM {$serendipity['dbPrefix']}access
- WHERE artifact_type = '" . serendipity_db_escape_string($artifact_type) . "'
- AND artifact_id = '" . (int)$artifact_id . "'
- AND artifact_mode = '" . serendipity_db_escape_string($artifact_mode) . "'
- AND artifact_index = '" . serendipity_db_escape_string($artifact_index) . "'";
+ WHERE artifact_type = '" . serendipity_db_escape_string($artifact_type) . "'
+ AND artifact_id = '" . (int)$artifact_id . "'
+ AND artifact_mode = '" . serendipity_db_escape_string($artifact_mode) . "'";
$rows = serendipity_db_query($sql, false, 'assoc');
if (!is_array($rows)) {
* @access private
* @param array Associative array that holds the SQL part array to be used in other functions like serendipity_fetchEntries()
* @param boolean Some queries do not need to joins categories. When ACLs need to be applied, this column is required, so if $append_category is set to true it will perform this missing JOIN.
- * @param string The ACL type ('category', 'directory')
* @return true True if ACLs were applied, false if not.
*/
-function serendipity_ACL_SQL(&$cond, $append_category = false, $type = 'category') {
+function serendipity_ACL_SQL(&$cond, $append_category = false) {
global $serendipity;
// A global configuration item controls whether the blog should apply ACLs or not!
$cond['joins'] .= " LEFT JOIN {$serendipity['dbPrefix']}category c
ON ec.categoryid = c.categoryid";
}
-
- switch($type) {
- case 'directory':
- $sql_artifact_column = 'i.path IS NULL OR
- acl_acc.groupid IS NULL';
- $sql_artifact = 'AND acl_acc.artifact_index = i.path';
- break;
-
- case 'category':
- $sql_artifact_column = 'c.categoryid IS NULL';
- $sql_artifact = 'AND acl_acc.artifact_id = c.categoryid';
- break;
- }
$cond['joins'] .= " LEFT JOIN {$serendipity['dbPrefix']}authorgroups AS acl_a
ON acl_a.authorid = " . $read_id . "
LEFT JOIN {$serendipity['dbPrefix']}access AS acl_acc
ON ( acl_acc.artifact_mode = 'read'
- AND acl_acc.artifact_type = '" . $type . "'
- " . $sql_artifact . "
+ AND acl_acc.artifact_type = 'category'
+ AND acl_acc.artifact_id = c.categoryid
)";
if (empty($cond['and'])) {
// When in Admin-Mode, apply readership permissions.
$cond['and'] .= " (
- " . $sql_artifact_column . "
+ c.categoryid IS NULL
OR ( acl_acc.groupid = " . $read_id_sql . ")
OR ( acl_acc.artifact_id IS NULL
" . (isset($serendipity['GET']['adminModule']) &&