Changeset 3136 for trunk/include
- Timestamp:
- Feb 13, 2009, 2:01:03 PM (15 years ago)
- Location:
- trunk/include
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/category_default.inc.php
r3128 r3136 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 -
trunk/include/common.inc.php
r3126 r3136 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, ' -
trunk/include/config_default.inc.php
r3133 r3136 689 689 'password' => array('cancel' => true), 690 690 'register' => array('cancel' => true), 691 'upgrade_feed' => array('cancel' => true),692 691 ); 693 692 -
trunk/include/functions.inc.php
r3122 r3136 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 } -
trunk/include/functions_plugins.inc.php
r3049 r3136 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
Note: See TracChangeset
for help on using the changeset viewer.