Changeset 3147
- Timestamp:
- Feb 14, 2009, 3:28:21 AM (15 years ago)
- Location:
- branches/2.0
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/admin/include/functions.php
r3073 r3147 144 144 { 145 145 include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php'); 146 146 147 147 // we can currently delete physically only photo with no 148 148 // storage_category_id (added via pLoader) … … 1865 1865 $extents = array_merge($extents, get_extents($path)); 1866 1866 } 1867 elseif ( !is_link($path) and file_exists($path) 1867 elseif ( !is_link($path) and file_exists($path) 1868 1868 and get_extension($path) == 'tpl' ) 1869 1869 { … … 2010 2010 $path = isset($src['path']) ? $src['path'] : '/'; 2011 2011 $path .= isset($src['query']) ? '?'.$src['query'] : ''; 2012 2012 2013 2013 if (($s = @fsockopen($host,80,$errno,$errstr,5)) === false) 2014 2014 { … … 2067 2067 } 2068 2068 2069 2070 /** 2071 * returns the groupname corresponding to the given group identifier if 2072 * exists 2073 * 2074 * @param int group_id 2075 * @return mixed 2076 */ 2077 function get_groupname($group_id) 2078 { 2079 $query = ' 2080 SELECT name 2081 FROM '.GROUPS_TABLE.' 2082 WHERE id = '.intval($group_id).' 2083 ;'; 2084 $result = pwg_query($query); 2085 if (mysql_num_rows($result) > 0) 2086 { 2087 list($groupname) = mysql_fetch_row($result); 2088 } 2089 else 2090 { 2091 return false; 2092 } 2093 2094 return $groupname; 2095 } 2096 2097 /** 2098 * returns the username corresponding to the given user identifier if exists 2099 * 2100 * @param int user_id 2101 * @return mixed 2102 */ 2103 function get_username($user_id) 2104 { 2105 global $conf; 2106 2107 $query = ' 2108 SELECT '.$conf['user_fields']['username'].' 2109 FROM '.USERS_TABLE.' 2110 WHERE '.$conf['user_fields']['id'].' = '.intval($user_id).' 2111 ;'; 2112 $result = pwg_query($query); 2113 if (mysql_num_rows($result) > 0) 2114 { 2115 list($username) = mysql_fetch_row($result); 2116 } 2117 else 2118 { 2119 return false; 2120 } 2121 2122 return $username; 2123 } 2069 2124 ?> -
branches/2.0/include/functions.inc.php
r3137 r3147 494 494 closedir($dir); 495 495 @asort($languages); 496 @reset($languages);497 496 498 497 return $languages; … … 1373 1372 $source_file = $f; 1374 1373 break; 1375 }1376 1377 if ($target_charset=='utf-8')1378 { // we accept conversion from ISO-8859-1 to UTF-81379 $f = $dir.'.iso-8859-1/'.$filename;1380 if (file_exists($f))1381 {1382 $source_charset = 'iso-8859-1';1383 $source_file = $f;1384 break;1385 }1386 1374 } 1387 1375 } … … 1484 1472 } 1485 1473 } 1474 1475 /** 1476 * returns a "secret key" that is to be sent back when a user enters a comment 1477 * 1478 * @param int image_id 1479 */ 1480 function get_comment_post_key($image_id) 1481 { 1482 global $conf; 1483 1484 $time = time(); 1485 1486 return sprintf( 1487 '%s:%s', 1488 $time, 1489 hash_hmac( 1490 'md5', 1491 $time.':'.$image_id, 1492 $conf['secret_key'] 1493 ) 1494 ); 1495 } 1486 1496 ?> -
branches/2.0/include/functions_comment.inc.php
r3046 r3147 22 22 // +-----------------------------------------------------------------------+ 23 23 24 /**25 * returns a "secret key" that is to be sent back when a user enters a comment26 */27 function get_comment_post_key($image_id)28 {29 global $conf;30 31 $time = time();32 33 return sprintf(34 '%s:%s',35 $time,36 hash_hmac(37 'md5',38 $time.':'.$image_id,39 $conf['secret_key']40 )41 );42 }43 44 24 //returns string action to perform on a new comment: validate, moderate, reject 45 25 function user_comment_check($action, $comment) … … 190 170 ( 191 171 ($comment_action=='validate' and $conf['email_admin_on_comment']) 192 or 172 or 193 173 ($comment_action!='validate' and $conf['email_admin_on_comment_validation']) 194 174 ) -
branches/2.0/include/functions_user.inc.php
r3127 r3147 674 674 675 675 /** 676 * returns the username corresponding to the given user identifier if exists677 *678 * @param int user_id679 * @return mixed680 */681 function get_username($user_id)682 {683 global $conf;684 685 $query = '686 SELECT '.$conf['user_fields']['username'].'687 FROM '.USERS_TABLE.'688 WHERE '.$conf['user_fields']['id'].' = '.intval($user_id).'689 ;';690 $result = pwg_query($query);691 if (mysql_num_rows($result) > 0)692 {693 list($username) = mysql_fetch_row($result);694 }695 else696 {697 return false;698 }699 700 return $username;701 }702 703 /**704 676 * returns user identifier thanks to his name, false if not found 705 677 * … … 933 905 } 934 906 } 935 936 /**937 * returns the groupname corresponding to the given group identifier if938 * exists939 *940 * @param int group_id941 * @return mixed942 */943 function get_groupname($group_id)944 {945 $query = '946 SELECT name947 FROM '.GROUPS_TABLE.'948 WHERE id = '.intval($group_id).'949 ;';950 $result = pwg_query($query);951 if (mysql_num_rows($result) > 0)952 {953 list($groupname) = mysql_fetch_row($result);954 }955 else956 {957 return false;958 }959 960 return $groupname;961 }962 963 907 964 908 /** -
branches/2.0/include/picture_comment.inc.php
r3123 r3147 89 89 if ($page['show_comments']) 90 90 { 91 // number of comment for this picture92 $query = ' SELECT COUNT(*) AS nb_comments';93 $query.= ' FROM '.COMMENTS_TABLE.' WHERE image_id = '.$page['image_id']; 94 $query.= " AND validated = 'true'";95 $query.= ';';91 // number of comments for this picture 92 $query = ' 93 SELECT COUNT(*) AS nb_comments 94 FROM '.COMMENTS_TABLE.' 95 WHERE image_id='.$page['image_id']." AND validated = 'true'"; 96 96 $row = mysql_fetch_array( pwg_query( $query ) ); 97 97 … … 161 161 or (is_a_guest() and $conf['comments_forall'])) 162 162 { 163 include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');164 163 $key = get_comment_post_key($page['image_id']); 165 164 $content = ''; -
branches/2.0/include/ws_functions.inc.php
r3064 r3147 523 523 } 524 524 525 include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');526 527 525 $comm = array( 528 526 'author' => trim( stripslashes($params['author']) ), … … 703 701 ) 704 702 { 705 include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');706 703 $comment_post_data['author'] = $user['username']; 707 704 $comment_post_data['key'] = get_comment_post_key($params['image_id']); … … 1042 1039 // last chance to make the directory writable 1043 1040 @chmod($high_dir, 0777); 1044 1041 1045 1042 if (!is_writable($high_dir)) 1046 1043 { … … 1048 1045 } 1049 1046 } 1050 1047 1051 1048 secure_directory($high_dir); 1052 1049 1053 1050 // high resolution path, same name as web size file 1054 1051 $high_path = sprintf( … … 1618 1615 $current_rank_of[$cat_id] = 0; 1619 1616 } 1620 1617 1621 1618 if ('auto' == $rank_on_category[$cat_id]) 1622 1619 { -
branches/2.0/index.php
r3118 r3147 229 229 $order_idx = pwg_get_session_var( 'image_order', 0 ); 230 230 231 $orders = get_category_preferred_image_orders(); 232 foreach ($orders as $order_id => $order) 231 $url = add_url_params( 232 duplicate_index_url(), 233 array('image_order' => '') 234 ); 235 foreach (get_category_preferred_image_orders() as $order_id => $order) 233 236 { 234 237 if ($order[2]) … … 238 241 array( 239 242 'DISPLAY' => $order[0], 240 'URL' => add_url_params( 241 duplicate_index_url(), 242 array('image_order' => $order_id) 243 ), 243 'URL' => $url.$order_id, 244 244 'SELECTED' => ($order_idx == $order_id ? true:false), 245 245 ) -
branches/2.0/tags.php
r3046 r3147 150 150 if (count($letter['tags']) > 0) 151 151 { 152 $letter['CHANGE_COLUMN'] = false;152 unset($letter['CHANGE_COLUMN']); 153 153 $letter['TITLE'] = $current_letter; 154 154 $template->append( -
branches/2.0/template/yoga/index.tpl
r2769 r3147 25 25 26 26 {if isset($U_SEARCH_RULES) } 27 <li><a href="{$U_SEARCH_RULES}" style="border:none;" onclick="popuphelp(this.href); return false;" title="{'Search rules'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/search_rules.png" class="button" alt="(?)"></a></li>27 <li><a href="{$U_SEARCH_RULES}" onclick="popuphelp(this.href); return false;" title="{'Search rules'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/search_rules.png" class="button" alt="(?)" /></a></li> 28 28 {/if} 29 29 -
branches/2.0/template/yoga/tags.tpl
r2648 r3147 42 42 </table> 43 43 </fieldset> 44 {if $letter.CHANGE_COLUMN|@default:false}44 {if isset($letter.CHANGE_COLUMN) } 45 45 </td> 46 46 <td valign="top">
Note: See TracChangeset
for help on using the changeset viewer.