Changeset 13240 for trunk/include
- Timestamp:
- Feb 18, 2012, 9:46:46 PM (13 years ago)
- Location:
- trunk/include
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions.inc.php
r13234 r13240 817 817 818 818 819 /* Returns the PATH to the thumbnail to be displayed. If the element does not820 * have a thumbnail, the default mime image path is returned. The PATH can be821 * used in the php script, but not sent to the browser.822 * @param array element_info assoc array containing element info from db823 * at least 'path', 'tn_ext' and 'id' should be present824 */825 function get_thumbnail_path($element_info)826 {827 $path = get_thumbnail_location($element_info);828 if ( !url_is_remote($path) )829 {830 $path = PHPWG_ROOT_PATH.$path;831 }832 return $path;833 }834 835 819 /* Returns the URL of the thumbnail to be displayed. If the element does not 836 820 * have a thumbnail, the default mime image url is returned. The URL can be … … 842 826 { 843 827 return DerivativeImage::thumb_url($element_info); 844 }845 846 /* returns the relative path of the thumnail with regards to to the root847 of piwigo (not the current page!).This function is not intended to be848 called directly from code.*/849 function get_thumbnail_location($element_info)850 {851 global $conf;852 if ( !empty( $element_info['tn_ext'] ) )853 {854 $path = substr_replace(855 get_filename_wo_extension($element_info['path']),856 '/'.$conf['dir_thumbnail'].'/'.$conf['prefix_thumbnail'],857 strrpos($element_info['path'],'/'),858 1859 );860 $path.= '.'.$element_info['tn_ext'];861 }862 else863 {864 $path = get_themeconf('mime_icon_dir')865 .strtolower(get_extension($element_info['path'])).'.png';866 // plugins want another location ?867 $path = trigger_event( 'get_thumbnail_location', $path, $element_info);868 }869 return $path;870 828 } 871 829 … … 921 879 * @return string 922 880 */ 923 function l10n($key , $textdomain='messages')881 function l10n($key) 924 882 { 925 883 global $lang, $conf; 926 884 927 if ($conf['debug_l10n'] and !isset($lang[$key]) and !empty($key)) 928 { 929 trigger_error('[l10n] language key "'.$key.'" is not defined', E_USER_WARNING); 930 } 931 932 return isset($lang[$key]) ? $lang[$key] : $key; 885 if ( ($val=@$lang[$key]) == null) 886 { 887 if ($conf['debug_l10n'] and !isset($lang[$key]) and !empty($key)) 888 { 889 trigger_error('[l10n] language key "'.$key.'" is not defined', E_USER_WARNING); 890 } 891 $val = $key; 892 } 893 return $val; 933 894 } 934 895 -
trunk/include/functions_category.inc.php
r13074 r13240 389 389 function rank_compare($a, $b) 390 390 { 391 if ($a['rank'] == $b['rank']) 392 { 393 return 0; 394 } 395 396 return ($a['rank'] < $b['rank']) ? -1 : 1; 391 return $a['rank'] - $b['rank']; 397 392 } 398 393 -
trunk/include/functions_html.inc.php
r12920 r13240 295 295 function tag_alpha_compare($a, $b) 296 296 { 297 global $ page;297 global $cache; 298 298 299 299 foreach (array($a, $b) as $tag) 300 300 { 301 if (!isset($ page[__FUNCTION__.'_cache'][ $tag['name'] ]))302 { 303 $ page[__FUNCTION__.'_cache'][ $tag['name'] ] = strtolower(str2url($tag['name']));304 } 305 } 306 307 return strcmp($ page[__FUNCTION__.'_cache'][ $a['name'] ], $page[__FUNCTION__.'_cache'][ $b['name'] ]);301 if (!isset($cache[__FUNCTION__][ $tag['name'] ])) 302 { 303 $cache[__FUNCTION__][ $tag['name'] ] = strtolower(str2url($tag['name'])); 304 } 305 } 306 307 return strcmp($cache[__FUNCTION__][ $a['name'] ], $cache[__FUNCTION__][ $b['name'] ]); 308 308 } 309 309 -
trunk/include/functions_url.inc.php
r12922 r13240 31 31 { 32 32 global $page; 33 if ( isset($page['root_path']) ) 34 { 35 $root_url = $page['root_path']; 36 } 37 else 33 if ( ($root_url = @$page['root_path']) == null ) 38 34 {// TODO - add HERE the possibility to call PWG functions from external scripts 39 35 $root_url = PHPWG_ROOT_PATH; 40 } 41 if ( strncmp($root_url, './', 2) != 0 ) 42 { 43 return $root_url; 44 } 45 else 46 { 47 return (string)substr($root_url, 2); 48 } 36 if ( strncmp($root_url, './', 2) == 0 ) 37 { 38 return substr($root_url, 2); 39 } 40 } 41 return $root_url; 49 42 } 50 43 … … 308 301 global $conf; 309 302 $section_string = ''; 310 311 $section_of = array( 312 'category' => 'categories', 313 'tags' => 'tags', 314 'list' => 'list', 315 'search' => 'search', 316 ); 317 318 foreach ($section_of as $param => $section) 319 { 320 if (isset($params[$param])) 321 { 322 $params['section'] = $section; 323 } 324 } 325 326 if (!isset($params['section'])) 327 { 328 $params['section'] = 'none'; 329 } 330 331 switch($params['section']) 303 $section = @$params['section']; 304 if (!isset($section)) 305 { 306 $section_of = array( 307 'category' => 'categories', 308 'tags' => 'tags', 309 'list' => 'list', 310 'search' => 'search', 311 ); 312 313 foreach ($section_of as $param => $s) 314 { 315 if (isset($params[$param])) 316 { 317 $section = $s; 318 } 319 } 320 321 if (!isset($section)) 322 { 323 $section = 'none'; 324 } 325 } 326 327 switch($section) 332 328 { 333 329 case 'categories' : … … 421 417 default : 422 418 { 423 $section_string.= '/'.$ params['section'];419 $section_string.= '/'.$section; 424 420 } 425 421 } -
trunk/include/functions_user.inc.php
r13074 r13240 804 804 list($user_id) = pwg_db_fetch_row($result); 805 805 return $user_id; 806 }807 }808 809 /**810 * search an available feed_id811 *812 * @return string feed identifier813 */814 function find_available_feed_id()815 {816 while (true)817 {818 $key = generate_key(50);819 $query = '820 SELECT COUNT(*)821 FROM '.USER_FEED_TABLE.'822 WHERE id = \''.$key.'\'823 ;';824 list($count) = pwg_db_fetch_row(pwg_query($query));825 if (0 == $count)826 {827 return $key;828 }829 806 } 830 807 } -
trunk/include/section_init.inc.php
r12922 r13240 65 65 // the $_GET keys are not protected in include/common.inc.php, only the values 66 66 $rewritten = pwg_db_real_escape_string($rewritten); 67 68 67 $page['root_path'] = PHPWG_ROOT_PATH; 68 } 69 70 if ( strncmp($page['root_path'], './', 2) == 0 ) 71 { 72 $page['root_path'] = substr($page['root_path'], 2); 69 73 } 70 74 -
trunk/include/template.class.php
r13170 r13240 684 684 else 685 685 { 686 $ret = embellish_url(get_root_url().$script->path);686 $ret = get_root_url().$script->path; 687 687 if ($script->version!==false) 688 688 { … … 692 692 // trigger the event for eventual use of a cdn 693 693 $ret = trigger_event('combined_script', $ret, $script); 694 return $ret;694 return embellish_url($ret); 695 695 } 696 696
Note: See TracChangeset
for help on using the changeset viewer.