- Timestamp:
- Feb 13, 2009, 2:02:20 PM (15 years ago)
- Location:
- branches/2.0
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/admin/include/functions_upgrade.php
r3046 r3137 186 186 } 187 187 } 188 189 /** 190 * which upgrades are available ? 191 * 192 * @return array 193 */ 194 function get_available_upgrade_ids() 195 { 196 $upgrades_path = PHPWG_ROOT_PATH.'install/db'; 197 198 $available_upgrade_ids = array(); 199 200 if ($contents = opendir($upgrades_path)) 201 { 202 while (($node = readdir($contents)) !== false) 203 { 204 if (is_file($upgrades_path.'/'.$node) 205 and preg_match('/^(.*?)-database\.php$/', $node, $match)) 206 { 207 array_push($available_upgrade_ids, $match[1]); 208 } 209 } 210 } 211 natcasesort($available_upgrade_ids); 212 213 return $available_upgrade_ids; 214 } 215 216 217 /** 218 * returns true if there are available upgrade files 219 */ 220 function check_upgrade_feed() 221 { 222 // retrieve already applied upgrades 223 $query = ' 224 SELECT id 225 FROM '.UPGRADE_TABLE.' 226 ;'; 227 $applied = array_from_query($query, 'id'); 228 229 // retrieve existing upgrades 230 $existing = get_available_upgrade_ids(); 231 232 // which upgrades need to be applied? 233 return (count(array_diff($existing, $applied)) > 0); 234 } 235 188 236 ?> -
branches/2.0/admin/template/goto/permalinks.tpl
r2945 r3137 29 29 <h3>{'Permalinks'|@translate}</h3> 30 30 <table class="table2"> 31 32 <td style="width:20%;">Id {$SORT_ID}</td>33 <td style="width:20%;">{'Category'|@translate} {$SORT_NAME}</td>34 <td style="width:20%;">{'Permalink'|@translate} {$SORT_PERMALINK}</td>35 31 <tr class="throw"> 32 <td>Id {$SORT_ID}</td> 33 <td>{'Category'|@translate} {$SORT_NAME}</td> 34 <td>{'Permalink'|@translate} {$SORT_PERMALINK}</td> 35 </tr> 36 36 {foreach from=$permalinks item=permalink name="permalink_loop"} 37 <tr class="{if $smarty.foreach.permalink_loop.index is odd}row1{else}row2{/if}" style="line-height: 2.2em;">38 39 40 41 37 <tr class="{if $smarty.foreach.permalink_loop.index is odd}row1{else}row2{/if}" style="line-height:1.5em;"> 38 <td style="text-align:center;">{$permalink.id}</td> 39 <td>{$permalink.name}</td> 40 <td>{$permalink.permalink}</td> 41 </tr> 42 42 {/foreach} 43 43 </table> … … 45 45 <h3>{'Permalink history'|@translate} <a name="old_permalinks"></a></h3> 46 46 <table class="table2"> 47 48 <td style="width:40px;">Id {$SORT_OLD_CAT_ID}</td>49 <td style="width:25%;">{'Category'|@translate}</td>50 <td style="width:25%;">{'Permalink'|@translate} {$SORT_OLD_PERMALINK}</td>51 <td style="width:15%;">Deleted on {$SORT_OLD_DATE_DELETED}</td>52 <td style="width:15%;">Last hit {$SORT_OLD_LAST_HIT}</td>53 54 55 47 <tr class="throw"> 48 <td>Id {$SORT_OLD_CAT_ID}</td> 49 <td>{'Category'|@translate}</td> 50 <td>{'Permalink'|@translate} {$SORT_OLD_PERMALINK}</td> 51 <td>Deleted on {$SORT_OLD_DATE_DELETED}</td> 52 <td>Last hit {$SORT_OLD_LAST_HIT}</td> 53 <td style="width:20px;">Hit {$SORT_OLD_HIT}</td> 54 <td style="width:5px;"></td> 55 </tr> 56 56 {foreach from=$deleted_permalinks item=permalink} 57 <tr style="line-height: 2.2em;">58 59 60 61 62 63 64 65 57 <tr style="line-height:1.5em;"> 58 <td style="text-align:center;">{$permalink.cat_id}</td> 59 <td>{$permalink.name}</td> 60 <td>{$permalink.permalink}</td> 61 <td>{$permalink.date_deleted}</td> 62 <td>{$permalink.last_hit}</td> 63 <td>{$permalink.hit}</td> 64 <td><a href="{$permalink.U_DELETE}" {$TAG_INPUT_ENABLED}><img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/delete.png" alt="[{'delete'|@translate}]" class="button"></a></td> 65 </tr> 66 66 {/foreach} 67 67 </table> -
branches/2.0/include/category_default.inc.php
r3129 r3137 135 135 136 136 if ($conf['show_thumbnail_caption']) 137 { 138 // name of the picture 137 {// name of the picture 139 138 if (isset($row['name']) and $row['name'] != '') 140 139 { … … 167 166 if ( isset($nb_comments_of) ) 168 167 { 169 $row['nb_comments'] = isset($nb_comments_of[$row['id']]) 170 ? (int)$nb_comments_of[$row['id']] : 0; 171 $tpl_var['NB_COMMENTS'] = $row['nb_comments']; 168 $tpl_var['NB_COMMENTS'] = (int)@$nb_comments_of[$row['id']]; 172 169 } 173 170 -
branches/2.0/include/common.inc.php
r3127 r3137 116 116 } 117 117 } 118 else 119 { 120 if ( strtolower(PWG_CHARSET)!='iso-8859-1' ) 121 { 122 fatal_error('PWG supports only iso-8859-1 charset on MySql version '.mysql_get_server_info()); 123 } 124 } 125 126 // 127 // Setup gallery wide options, if this fails then we output a CRITICAL_ERROR 128 // since basic gallery information is not available 129 // 118 elseif ( strtolower(PWG_CHARSET)!='iso-8859-1' ) 119 { 120 fatal_error('PWG supports only iso-8859-1 charset on MySql version '.mysql_get_server_info()); 121 } 122 130 123 load_conf_from_db(); 131 124 load_plugins(); … … 188 181 if ($conf['check_upgrade_feed']) 189 182 { 190 191 // retrieve already applied upgrades 192 $query = ' 193 SELECT id 194 FROM '.UPGRADE_TABLE.' 195 ;'; 196 $applied = array_from_query($query, 'id'); 197 198 // retrieve existing upgrades 199 $existing = get_available_upgrade_ids(); 200 201 // which upgrades need to be applied? 202 if (count(array_diff($existing, $applied)) > 0) 183 include_once(PHPWG_ROOT_PATH.'admin/include/functions_upgrade.php'); 184 if (check_upgrade_feed()) 203 185 { 204 186 $header_msgs[] = 'Some database upgrades are missing, ' -
branches/2.0/include/config_default.inc.php
r3132 r3137 689 689 'password' => array('cancel' => true), 690 690 'register' => array('cancel' => true), 691 'upgrade_feed' => array('cancel' => true),692 691 ); 693 692 -
branches/2.0/include/functions.inc.php
r3123 r3137 134 134 // $start represents the position of the next '<' character 135 135 // $end represents the position of the next '>' character 136 $start = 0; 137 $end = 0; 138 $start = strpos ( $remaining, '<' ); // -> 0 136 ; // -> 0 139 137 $end = strpos ( $remaining, '>' ); // -> 16 140 138 // as long as a '<' and his friend '>' are found, we loop 141 while ( is_numeric( $start ) and is_numeric( $end ) ) 139 while ( ($start=strpos( $remaining, '<' )) !==false 140 and ($end=strpos( $remaining, '>' )) !== false ) 142 141 { 143 142 // $treatment is the part of the string to treat … … 154 153 // loop 155 154 $remaining = substr ( $remaining, $end + 1, strlen( $remaining ) ); 156 $start = strpos ( $remaining, '<' );157 $end = strpos ( $remaining, '>' );158 155 } 159 156 $treatment = str_replace( ' ', ' ', $remaining ); … … 243 240 if ( !is_writable($dir) ) 244 241 { 245 if ( !is_writable($dir) ) 246 { 247 !($flags&MKGETDIR_DIE_ON_ERROR) or fatal_error( "$dir ".l10n('no_write_access')); 248 return false; 249 } 242 !($flags&MKGETDIR_DIE_ON_ERROR) or fatal_error( "$dir ".l10n('no_write_access')); 243 return false; 250 244 } 251 245 return true; … … 465 459 { 466 460 $path = PHPWG_ROOT_PATH.'language/'.$file; 467 if ( is_dir($path) and!is_link($path) and file_exists($path.'/iso.txt'))461 if (!is_link($path) and file_exists($path.'/iso.txt')) 468 462 { 469 463 list($language_name) = @file($path.'/iso.txt'); … … 527 521 528 522 $tags_string = null; 529 if (isset($page['section']) and $page['section'] == 'tags') 530 { 531 $tag_ids = array(); 532 foreach ($page['tags'] as $tag) 533 { 534 array_push($tag_ids, $tag['id']); 535 } 536 537 $tags_string = implode(',', $tag_ids); 523 if ('tags'==@$page['section']) 524 { 525 $tags_string = implode(',', $page['tag_ids']); 538 526 } 539 527 … … 912 900 if (!empty($element_info['filesize'])) 913 901 { 914 $thumbnail_title .= ' : '. l10n_dec('%d Kb', '%d Kb', $element_info['filesize']);902 $thumbnail_title .= ' : '.sprintf(l10n('%d Kb'), $element_info['filesize']); 915 903 } 916 904 … … 1140 1128 1141 1129 /** 1142 * which upgrades are available ?1143 *1144 * @return array1145 */1146 function get_available_upgrade_ids()1147 {1148 $upgrades_path = PHPWG_ROOT_PATH.'install/db';1149 1150 $available_upgrade_ids = array();1151 1152 if ($contents = opendir($upgrades_path))1153 {1154 while (($node = readdir($contents)) !== false)1155 {1156 if (is_file($upgrades_path.'/'.$node)1157 and preg_match('/^(.*?)-database\.php$/', $node, $match))1158 {1159 array_push($available_upgrade_ids, $match[1]);1160 }1161 }1162 }1163 natcasesort($available_upgrade_ids);1164 1165 return $available_upgrade_ids;1166 }1167 1168 /**1169 1130 * Add configuration parameters from database to global $conf array 1170 1131 * … … 1275 1236 foreach (array('SCRIPT_NAME', 'SCRIPT_FILENAME', 'PHP_SELF') as $value) 1276 1237 { 1277 $continue = !empty($_SERVER[$value]); 1278 if ($continue) 1238 if (!empty($_SERVER[$value])) 1279 1239 { 1280 1240 $filename = strtolower($_SERVER[$value]); 1281 1282 if ($conf['php_extension_in_urls']) 1283 { 1284 $continue = get_extension($filename) === 'php'; 1285 } 1286 1287 if ($continue) 1288 { 1289 $basename = basename($filename, '.php'); 1290 $continue = !empty($basename); 1291 } 1292 1293 if ($continue) 1241 if ($conf['php_extension_in_urls'] and get_extension($filename)!=='php') 1242 continue; 1243 $basename = basename($filename, '.php'); 1244 if (!empty($basename)) 1294 1245 { 1295 1246 return $basename; … … 1297 1248 } 1298 1249 } 1299 1300 1250 return ''; 1301 1251 } -
branches/2.0/include/functions_plugins.inc.php
r3046 r3137 110 110 global $pwg_event_handlers; 111 111 112 // just for debugging 113 trigger_action('pre_trigger_event', 114 array('event'=>$event, 'data'=>$data) ); 112 if ( isset($pwg_event_handlers['trigger']) ) 113 {// just for debugging 114 trigger_action('trigger', 115 array('type'=>'event', 'event'=>$event, 'data'=>$data) ); 116 } 115 117 116 118 if ( !isset($pwg_event_handlers[$event]) ) 117 119 { 118 trigger_action('post_trigger_event',119 array('event'=>$event, 'data'=>$data) );120 120 return $data; 121 121 } … … 124 124 foreach ($pwg_event_handlers[$event] as $priority => $handlers) 125 125 { 126 if ( !is_null($handlers) ) 127 { 128 foreach($handlers as $handler) 129 { 130 $all_args = array_merge( array($data), $args); 131 $function_name = $handler['function']; 132 $accepted_args = $handler['accepted_args']; 133 134 if ( $accepted_args == 1 ) 135 $the_args = array($data); 136 elseif ( $accepted_args > 1 ) 137 $the_args = array_slice($all_args, 0, $accepted_args); 138 elseif ( $accepted_args == 0 ) 139 $the_args = NULL; 140 else 141 $the_args = $all_args; 142 143 $data = call_user_func_array($function_name, $the_args); 144 } 145 } 146 } 147 trigger_action('post_trigger_event', 148 array('event'=>$event, 'data'=>$data) ); 126 foreach($handlers as $handler) 127 { 128 $all_args = array_merge( array($data), $args); 129 $function_name = $handler['function']; 130 $accepted_args = $handler['accepted_args']; 131 132 if ( $accepted_args == 1 ) 133 $the_args = array($data); 134 elseif ( $accepted_args > 1 ) 135 $the_args = array_slice($all_args, 0, $accepted_args); 136 elseif ( $accepted_args == 0 ) 137 $the_args = NULL; 138 else 139 $the_args = $all_args; 140 141 $data = call_user_func_array($function_name, $the_args); 142 } 143 } 144 trigger_action('trigger', 145 array('type'=>'post_event', 'event'=>$event, 'data'=>$data) ); 149 146 return $data; 150 147 } … … 153 150 { 154 151 global $pwg_event_handlers; 155 if ($event!='pre_trigger_event' 156 and $event!='post_trigger_event' 157 and $event!='trigger_action') 152 if ( isset($pwg_event_handlers['trigger']) and $event!='trigger' ) 158 153 {// special case for debugging - avoid recursive calls 159 trigger_action('trigger _action',160 array(' event'=>$event, 'data'=>$data) );154 trigger_action('trigger', 155 array('type'=>'action', 'event'=>$event, 'data'=>$data) ); 161 156 } 162 157 … … 169 164 foreach ($pwg_event_handlers[$event] as $priority => $handlers) 170 165 { 171 if ( !is_null($handlers) ) 172 { 173 foreach($handlers as $handler) 174 { 175 $all_args = array_merge( array($data), $args); 176 $function_name = $handler['function']; 177 $accepted_args = $handler['accepted_args']; 178 179 if ( $accepted_args == 1 ) 180 $the_args = array($data); 181 elseif ( $accepted_args > 1 ) 182 $the_args = array_slice($all_args, 0, $accepted_args); 183 elseif ( $accepted_args == 0 ) 184 $the_args = NULL; 185 else 186 $the_args = $all_args; 187 188 call_user_func_array($function_name, $the_args); 189 } 166 foreach($handlers as $handler) 167 { 168 $all_args = array_merge( array($data), $args); 169 $function_name = $handler['function']; 170 $accepted_args = $handler['accepted_args']; 171 172 if ( $accepted_args == 1 ) 173 $the_args = array($data); 174 elseif ( $accepted_args > 1 ) 175 $the_args = array_slice($all_args, 0, $accepted_args); 176 elseif ( $accepted_args == 0 ) 177 $the_args = NULL; 178 else 179 $the_args = $all_args; 180 181 call_user_func_array($function_name, $the_args); 190 182 } 191 183 } … … 230 222 $query = ' 231 223 SELECT * FROM '.PLUGINS_TABLE; 232 if (!empty($state) or !empty($id) ) 233 { 234 $query .= ' 235 WHERE 1=1'; 236 if (!empty($state)) 237 { 224 $clauses = array(); 225 if (!empty($state)) 226 { 227 $clauses[] = 'state="'.$state.'"'; 228 } 229 if (!empty($id)) 230 { 231 $clauses[] = 'id="'.$id.'"'; 232 } 233 if (count($clauses)) 234 { 238 235 $query .= ' 239 AND state="'.$state.'"'; 240 } 241 if (!empty($id)) 242 { 243 $query .= ' 244 AND id="'.$id.'"'; 245 } 236 WHERE '. implode(' AND ', $clauses); 246 237 } 247 238 -
branches/2.0/plugins/event_tracer/main.inc.php
r3046 r3137 81 81 } 82 82 83 function on_pre_trigger_event($event_info)84 {85 @$this->trigger_counts[$event_info['event']]++;86 $this->dump('pre_trigger_event', $event_info);87 }88 function on_post_trigger_event($event_info)89 {90 $this->dump('post_trigger_event', $event_info);91 }92 93 function on_trigger_action($event_info)94 {95 @$this->trigger_counts[$event_info['event']]++;96 $this->dump('trigger_action', $event_info);97 }98 99 83 function on_page_tail() 100 84 { … … 130 114 } 131 115 132 function dump($event,$event_info)116 function on_trigger($event_info) 133 117 { 118 if ($event_info['type']!='post_event') 119 @$this->trigger_counts[$event_info['event']]++; 120 134 121 foreach( $this->my_config['filters'] as $filter) 135 122 { … … 144 131 else 145 132 $s = ''; 146 pwg_debug($event .' "'.$event_info['event'].'" '.($this->trigger_counts[$event_info['event']]).' calls '.($s) );133 pwg_debug($event_info['type'].' "'.$event_info['event'].'" '.($this->trigger_counts[$event_info['event']]).' calls '.($s) ); 147 134 break; 148 135 } … … 166 153 167 154 add_event_handler('get_admin_plugin_menu_links', array(&$obj, 'plugin_admin_menu') ); 168 add_event_handler('pre_trigger_event', array(&$obj, 'on_pre_trigger_event') );169 add_event_handler('post_trigger_event', array(&$obj, 'on_post_trigger_event') );170 155 add_event_handler('loc_begin_page_tail', array(&$obj, 'on_page_tail') ); 171 add_event_handler('trigger _action', array(&$obj, 'on_trigger_action') );156 add_event_handler('trigger', array(&$obj, 'on_trigger') ); 172 157 set_plugin_data($plugin['id'], $obj); 173 158 ?> -
branches/2.0/template/yoga/menubar.tpl
r2831 r3137 2 2 <div id="menubar"> 3 3 {foreach from=$blocks key=id item=block} 4 {if ( not empty($block->template) or not empty($block->raw_content) )}5 4 <dl id="{$id}"> 6 5 {if not empty($block->template)} … … 10 9 {/if} 11 10 </dl> 12 {/if}13 11 {/foreach} 14 12 </div>
Note: See TracChangeset
for help on using the changeset viewer.