Changeset 2643
- Timestamp:
- Oct 3, 2008, 11:55:14 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/functions.php
r2634 r2643 134 134 return; 135 135 } 136 trigger_action('begin_delete_elements', $ids); 136 137 137 138 // destruction of the comments on the image -
trunk/include/template.class.php
r2636 r2643 44 44 var $files = array(); 45 45 46 // Template extents filenames for each template handle. 47 var $extents = array(); 48 46 49 // used by html_head smarty block to add content before </head> 47 50 var $html_head_elements = array(); … … 79 82 80 83 $this->set_template_dir($root); 84 85 if (isset($conf['extents_for_templates'])) 86 { 87 $tpl_extents = unserialize($conf['extents_for_templates']); 88 $this->set_extents($tpl_extents, './template-extension/', true); 89 } 81 90 } 82 91 … … 133 142 function set_filenames($filename_array) 134 143 { 135 global $conf;136 144 if (!is_array($filename_array)) 137 145 { … … 139 147 } 140 148 reset($filename_array); 141 $tpl_extension = isset($conf['extents_for_templates']) ?142 unserialize($conf['extents_for_templates']) : array();143 149 while(list($handle, $filename) = each($filename_array)) 144 150 { 145 151 if (is_null($filename)) 146 unset( $this->files[$handle] ); 152 { 153 unset($this->files[$handle]); 154 } 155 elseif (isset($this->extents[$handle])) 156 { 157 $this->files[$handle] = $this->extents[$handle]; 158 } 147 159 else 148 160 { 149 161 $this->files[$handle] = $filename; 150 foreach ($tpl_extension as $file => $conditions) 151 { 152 $localtpl = './template-extension/' . $file; 153 if ($handle == $conditions[0] and 154 (stripos(implode('/',array_flip($_GET)),$conditions[1])>0 155 or $conditions[1] == 'N/A') 156 and file_exists($localtpl)) 157 { /* examples: Are best_rated, created-monthly-calendar, list, ... set? */ 158 $this->files[$handle] = '../.' . $localtpl; 159 /* assign their tpl-extension */ 160 } 161 } 162 } 163 } 164 return true; 165 } 166 167 /** 168 * Sets template extention filename for handles. 169 */ 170 function set_extent($filename, $param, $dir='', $overwrite=true) 171 { 172 return $this->set_extents(array($filename => $param), $dir, $overwrite); 173 } 174 175 /** 176 * Sets template extentions filenames for handles. 177 * $filename_array should be an hash of filename => array( handle, param) or filename => handle 178 */ 179 function set_extents($filename_array, $dir='', $overwrite=true) 180 { 181 if (!is_array($filename_array)) 182 { 183 return false; 184 } 185 foreach ($filename_array as $filename => $value) 186 { 187 if (is_array($value)) 188 { 189 $handle = $value[0]; 190 $param = $value[1]; 191 } 192 elseif (is_string($value)) 193 { 194 $handle = $value; 195 $param = 'N/A'; 196 } 197 else 198 { 199 return false; 200 } 201 202 if ((stripos(implode('/',array_flip($_GET)), $param) > 0 or $param == 'N/A') 203 and (!isset($this->extents[$handle]) or $overwrite) 204 and file_exists($dir . $filename)) 205 { 206 $this->extents[$handle] = realpath($dir . $filename); 162 207 } 163 208 }
Note: See TracChangeset
for help on using the changeset viewer.