]> git.mjollnir.org Git - s9y.git/commitdiff
properly use new theme
authorgarvinhicking <garvinhicking>
Fri, 2 Jun 2006 09:27:10 +0000 (09:27 +0000)
committergarvinhicking <garvinhicking>
Fri, 2 Jun 2006 09:27:10 +0000 (09:27 +0000)
include/functions_config.inc.php

index ea01de6978c931411a316ab2bdba2977949637a7..60ed69cbb8ed61430bb3bb1a545d48046728df9e 100644 (file)
@@ -249,7 +249,7 @@ function serendipity_getTemplateFile($file, $key = 'serendipityHTTPPath') {
     $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'] .'/';
@@ -1351,10 +1351,9 @@ function serendipity_addDefaultGroup($name, $level) {
  * @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)) {
@@ -1363,16 +1362,15 @@ function serendipity_ACLGrant($artifact_id, $artifact_type, $artifact_mode, $gro
 
     // 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) {
@@ -1400,17 +1398,15 @@ function serendipity_ACLGrant($artifact_id, $artifact_type, $artifact_mode, $gro
  * @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)) {
@@ -1495,10 +1491,9 @@ function serendipity_ACLCheck($authorid, $artifact_id, $artifact_type, $artifact
  * @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!
@@ -1523,26 +1518,13 @@ function serendipity_ACL_SQL(&$cond, $append_category = false, $type = 'category
             $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'])) {
@@ -1553,7 +1535,7 @@ function serendipity_ACL_SQL(&$cond, $append_category = false, $type = 'category
 
         // 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']) &&