Changeset 13074
- Timestamp:
- Feb 9, 2012, 10:11:34 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/maintenance.php
r13001 r13074 143 143 case 'derivatives': 144 144 { 145 clear_derivative_cache( );145 clear_derivative_cache($_GET['type']); 146 146 break; 147 147 } … … 159 159 160 160 $url_format = get_root_url().'admin.php?page=maintenance&action=%s&pwg_token='.get_pwg_token(); 161 162 $purge_urls[l10n('all')] = sprintf($url_format, 'derivatives').'&type=all'; 163 foreach(ImageStdParams::get_defined_type_map() as $params) 164 { 165 $purge_urls[ l10n($params->type) ] = sprintf($url_format, 'derivatives').'&type='.$params->type; 166 } 161 167 162 168 $template->assign( … … 174 180 'U_MAINT_COMPILED_TEMPLATES' => sprintf($url_format, 'compiled-templates'), 175 181 'U_MAINT_DERIVATIVES' => sprintf($url_format, 'derivatives'), 182 'purge_derivatives' => $purge_urls, 176 183 'U_HELP' => get_root_url().'admin/popuphelp.php?page=maintenance', 177 184 ) 178 185 ); 186 179 187 180 188 if ($conf['gallery_locked']) -
trunk/admin/themes/default/template/maintenance.tpl
r13001 r13074 35 35 <li><a href="{$U_MAINT_SEARCH}"onclick="return confirm('{'Purge search history'|@translate|@escape:'javascript'}');">{'Purge search history'|@translate}</a></li> 36 36 <li><a href="{$U_MAINT_COMPILED_TEMPLATES}">{'Purge compiled templates'|@translate}</a></li> 37 <li><a href="{$U_MAINT_DERIVATIVES}">{'Purge derivative image cache'|@translate}</a></li> 37 <li>{'Purge derivative image cache'|@translate}: 38 {foreach from=$purge_derivatives key=name item=url name=loop}{if !$smarty.foreach.loop.first}, {/if}<a href="{$url}">{$name}</a>{/foreach} 39 </li> 38 40 </ul> -
trunk/include/functions_category.inc.php
r12954 r13074 486 486 } 487 487 488 /** 489 * create a tree from a flat list of categories, no recursivity for high speed 490 */ 491 function categories_flatlist_to_tree($categories) 492 { 493 $tree = array(); 494 $key_of_cat = array(); 495 496 foreach ($categories as $key => &$node) 497 { 498 $key_of_cat[$node['id']] = $key; 499 500 if (!isset($node['id_uppercat'])) 501 { 502 $tree[$key] = &$node; 503 } 504 else 505 { 506 if (!isset($categories[ $key_of_cat[ $node['id_uppercat'] ] ]['sub_categories'])) 507 { 508 $categories[ $key_of_cat[ $node['id_uppercat'] ] ]['sub_categories'] = array(); 509 } 510 511 $categories[ $key_of_cat[ $node['id_uppercat'] ] ]['sub_categories'][$key] = &$node; 512 } 513 } 514 515 return $tree; 516 } 488 517 489 ?> -
trunk/include/functions_user.inc.php
r12922 r13074 74 74 { 75 75 global $conf; 76 76 77 77 if (defined("PHPWG_INSTALLED")) 78 78 { … … 106 106 107 107 $SCU_users = array(); 108 108 109 109 $q = pwg_query(" 110 110 SELECT ".$conf['user_fields']['username']." AS username … … 115 115 // $SCU_users is now an associative table where the key is the account as 116 116 // registered in the DB, and the value is this same account, in lower case 117 117 118 118 $users_found = array_keys($SCU_users, $username_lo); 119 119 // $users_found is now a table of which the values are all the accounts … … 131 131 if ($login == '') 132 132 { 133 array_push($errors, l10n('Please, enter a login'));133 $errors[] = l10n('Please, enter a login'); 134 134 } 135 135 if (preg_match('/^.* $/', $login)) 136 136 { 137 array_push($errors, l10n('login mustn\'t end with a space character'));137 $errors[] = l10n('login mustn\'t end with a space character'); 138 138 } 139 139 if (preg_match('/^ .*$/', $login)) 140 140 { 141 array_push($errors, l10n('login mustn\'t start with a space character'));141 $errors[] = l10n('login mustn\'t start with a space character'); 142 142 } 143 143 if (get_userid($login)) 144 144 { 145 array_push($errors, l10n('this login is already used'));145 $errors[] = l10n('this login is already used'); 146 146 } 147 147 if ($login != strip_tags($login)) 148 148 { 149 array_push($errors, l10n('html tags are not allowed in login'));149 $errors[] = l10n('html tags are not allowed in login'); 150 150 } 151 151 $mail_error = validate_mail_address(null, $mail_address); 152 152 if ('' != $mail_error) 153 153 { 154 array_push($errors, $mail_error);154 $errors[] = $mail_error; 155 155 } 156 156 … … 160 160 if ($login_error != '') 161 161 { 162 array_push($errors, $login_error);162 $errors[] = $login_error; 163 163 } 164 164 } … … 206 206 while ($row = pwg_db_fetch_assoc($result)) 207 207 { 208 array_push 209 ( 210 $inserts, 211 array 212 ( 208 $inserts[] = array( 213 209 'user_id' => $next_id, 214 210 'group_id' => $row['id'] 215 ) 216 ); 211 ); 217 212 } 218 213 } … … 401 396 if ( empty($forbidden_ids) ) 402 397 { 403 array_push( $forbidden_ids, 0 );398 $forbidden_ids[] = 0; 404 399 } 405 400 $userdata['image_access_type'] = 'NOT IN'; //TODO maybe later … … 424 419 if ($cat['count_images']==0) 425 420 { 426 array_push($forbidden_ids, $cat['cat_id']);421 $forbidden_ids[] = $cat['cat_id']; 427 422 unset( $user_cache_cats[$cat['cat_id']] ); 428 423 } … … 519 514 ).' 520 515 ;'; 521 $result = pwg_query($query); 522 $authorizeds = array(); 523 while ($row = pwg_db_fetch_assoc($result)) 524 { 525 array_push($authorizeds, $row['image_id']); 526 } 516 $authorizeds = array_from_query($query, 'image_id'); 527 517 528 518 $query = ' … … 531 521 WHERE user_id = '.$user['id'].' 532 522 ;'; 533 $result = pwg_query($query); 534 $favorites = array(); 535 while ($row = pwg_db_fetch_assoc($result)) 536 { 537 array_push($favorites, $row['image_id']); 538 } 523 $favorites = array_from_query($query, 'image_id'); 539 524 540 525 $to_deletes = array_diff($favorites, $authorizeds); 541 542 526 if (count($to_deletes) > 0) 543 527 { … … 565 549 function calculate_permissions($user_id, $user_status) 566 550 { 567 $private_array = array();568 $authorized_array = array();569 570 551 $query = ' 571 552 SELECT id … … 573 554 WHERE status = \'private\' 574 555 ;'; 575 $result = pwg_query($query); 576 while ($row = pwg_db_fetch_assoc($result)) 577 { 578 array_push($private_array, $row['id']); 579 } 556 $private_array = array_from_query($query, 'id'); 580 557 581 558 // retrieve category ids directly authorized to the user … … 618 595 while ($row = pwg_db_fetch_assoc($result)) 619 596 { 620 array_push($forbidden_array, $row['id']);597 $forbidden_array[] = $row['id']; 621 598 } 622 599 $forbidden_array = array_unique($forbidden_array); … … 627 604 // where clauses such as "WHERE category_id NOT IN(0)" will always be 628 605 // true. 629 array_push($forbidden_array, 0);606 $forbidden_array[] = 0; 630 607 } 631 608 … … 810 787 811 788 $email = pwg_db_real_escape_string($email); 812 789 813 790 $query = ' 814 791 SELECT … … 932 909 return $theme; 933 910 } 934 911 935 912 // let's find the first available theme 936 913 $active_themes = get_pwg_themes(); … … 1159 1136 // we force the session table to be clean 1160 1137 pwg_session_gc(); 1161 1138 1162 1139 global $conf; 1163 1140 // retrieving the encrypted password of the login submitted … … 1352 1329 { 1353 1330 global $user, $conf; 1354 1331 1355 1332 if (is_a_guest()) 1356 1333 { 1357 1334 return false; 1358 1335 } 1359 1336 1360 1337 if (!in_array($action, array('delete','edit', 'validate'))) 1361 1338 { -
trunk/include/page_header.php
r12922 r13074 67 67 68 68 // No referencing is required 69 if ( !$conf['meta_ref'] ) 69 if ( !$conf['meta_ref'] ) 70 70 { 71 71 $page['meta_robots']['noindex'] = 1; … … 82 82 } 83 83 if ( !isset($page['meta_robots']['noindex']) ) 84 { 85 $template->assign('meta_ref',1); 84 { 85 $template->assign('meta_ref',1); 86 86 } 87 87 … … 98 98 )); 99 99 } 100 else 101 {// messages only if no redirection 102 foreach (array('errors','infos') as $mode) 103 { 104 if (isset($_SESSION['page_'.$mode])) 105 { 106 $page[$mode] = array_merge($page[$mode], $_SESSION['page_'.$mode]); 107 unset($_SESSION['page_'.$mode]); 108 } 100 109 101 102 // messages 103 foreach (array('errors','infos') as $mode) 104 { 105 if (isset($_SESSION['page_'.$mode])) 106 { 107 $page[$mode] = array_merge($page[$mode], $_SESSION['page_'.$mode]); 108 unset($_SESSION['page_'.$mode]); 109 } 110 111 if (count($page[$mode]) != 0) 112 { 113 $template->assign($mode, $page[$mode]); 110 if (count($page[$mode]) != 0) 111 { 112 $template->assign($mode, $page[$mode]); 113 } 114 114 } 115 115 } 116 117 116 trigger_action('loc_end_page_header'); 118 117 -
trunk/include/ws_functions.inc.php
r13003 r13074 521 521 } 522 522 523 524 /** 525 * create a tree from a flat list of categories, no recursivity for high speed 526 */ 527 function categories_flatlist_to_tree($categories) 528 { 529 $tree = array(); 530 $key_of_cat = array(); 531 532 foreach ($categories as $key => &$node) 533 { 534 $key_of_cat[$node['id']] = $key; 535 536 if (!isset($node['id_uppercat'])) 537 { 538 $tree[$key] = &$node; 539 } 540 else 541 { 542 if (!isset($categories[ $key_of_cat[ $node['id_uppercat'] ] ]['sub_categories'])) 543 { 544 $categories[ $key_of_cat[ $node['id_uppercat'] ] ]['sub_categories'] = array(); 545 } 546 547 $categories[ $key_of_cat[ $node['id_uppercat'] ] ]['sub_categories'][$key] = &$node; 548 } 549 } 550 551 return $tree; 552 } 523 553 524 554 /** … … 1670 1700 { 1671 1701 $do_update = false; 1672 1702 1673 1703 $infos = pwg_image_infos($file_path); 1674 1704 1675 1705 foreach (array('width', 'height', 'filesize') as $image_info) 1676 1706 { … … 1745 1775 // else we use "file". 1746 1776 remove_chunks($params['original_sum'], 'thumb'); 1747 1777 1748 1778 if (isset($params['high_sum'])) 1749 1779 { -
trunk/picture.php
r13048 r13074 171 171 foreach($element_info['derivatives'] as $type => $derivative) 172 172 { 173 if ($type==IMG_SQUARE || $type==IMG_THUMB) 174 continue; 173 175 $url = $derivative->get_url(); 174 176 if (isset($added[$url])) … … 806 808 if (!empty($picture['current']['author'])) 807 809 { 808 $infos['INFO_AUTHOR'] = 809 // FIXME because of search engine partial rewrite, giving the author 810 // name threw GET is not supported anymore. This feature should come 811 // back later, with a better design 812 // '<a href="'. 813 // PHPWG_ROOT_PATH.'category.php?cat=search'. 814 // '&search=author:'.$picture['current']['author'] 815 // .'">'.$picture['current']['author'].'</a>'; 816 $picture['current']['author']; 810 $infos['INFO_AUTHOR'] = $picture['current']['author']; 817 811 } 818 812 -
trunk/themes/default/template/index.tpl
r13068 r13074 132 132 </div>{* <!-- titrePage --> *} 133 133 134 {if isset($errors) or not empty($infos)} 134 135 {include file='infos_errors.tpl'} 135 136 {/if} 136 137 {if !empty($PLUGIN_INDEX_CONTENT_BEGIN)}{$PLUGIN_INDEX_CONTENT_BEGIN}{/if} 137 138 -
trunk/themes/default/template/password.tpl
r12764 r13074 1 1 {if isset($MENUBAR)}{$MENUBAR}{/if} 2 <div id="content" class="content ">2 <div id="content" class="content{if isset($MENUBAR)} contentWithMenu{/if}"> 3 3 <div class="titrePage"> 4 4 <ul class="categoryActions"> -
trunk/themes/default/template/picture.tpl
r13021 r13074 2 2 {include file='include/autosize.inc.tpl'} 3 3 *} 4 5 4 {if isset($MENUBAR)} 6 5 {$MENUBAR} 7 6 <div id="content" class="contentWithMenu"> 8 7 {/if} 9 8 {if isset($errors) or not empty($infos)} 10 9 {include file='infos_errors.tpl'} 11 10 {/if} 12 11 {if !empty($PLUGIN_PICTURE_BEFORE)}{$PLUGIN_PICTURE_BEFORE}{/if} 13 12 … … 275 274 276 275 {if isset($COMMENT_COUNT)} 277 <a name="comments"></a>278 276 <div id="comments"> 279 277 {if $COMMENT_COUNT > 0} -
trunk/themes/default/template/register.tpl
r12886 r13074 2 2 <div id="registerPage"> 3 3 4 <div id="content" class="content ">4 <div id="content" class="content{if isset($MENUBAR)} contentWithMenu{/if}"> 5 5 6 6 <div class="titrePage">
Note: See TracChangeset
for help on using the changeset viewer.