Changeset 1750
- Timestamp:
- Jan 24, 2007, 6:07:08 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/feed.php
r1639 r1750 89 89 // +-----------------------------------------------------------------------+ 90 90 91 // clean $user array (include/user.inc.php has been executed) 92 $ user = array();91 $feed_id= isset($_GET['feed']) ? $_GET['feed'] : ''; 92 $image_only=isset($_GET['image_only']); 93 93 94 94 // echo '<pre>'.generate_key(50).'</pre>'; 95 if (isset($_GET['feed']) 96 and preg_match('/^[A-Za-z0-9]{50}$/', $_GET['feed'])) 95 if ( !empty($feed_id) ) 97 96 { 98 97 $query = ' 99 SELECT uf.user_id AS id, 100 ui.status, 101 uf.last_check, 102 u.'.$conf['user_fields']['username'].' AS username 103 FROM '.USER_FEED_TABLE.' AS uf 104 INNER JOIN '.USER_INFOS_TABLE.' AS ui 105 ON ui.user_id = uf.user_id 106 INNER JOIN '.USERS_TABLE.' AS u 107 ON u.'.$conf['user_fields']['id'].' = uf.user_id 108 WHERE uf.id = \''.$_GET['feed'].'\' 98 SELECT user_id, 99 last_check 100 FROM '.USER_FEED_TABLE.' 101 WHERE id = \''.$feed_id.'\' 109 102 ;'; 110 $user = mysql_fetch_array(pwg_query($query)); 111 } 112 113 if ( empty($user) ) 114 { 115 page_not_found('Unknown/missing feed identifier'); 116 } 117 118 $user['forbidden_categories'] = calculate_permissions($user['id'], 119 $user['status']); 120 if ('' == $user['forbidden_categories']) 121 { 122 $user['forbidden_categories'] = '0'; 103 $feed_row = mysql_fetch_assoc(pwg_query($query)); 104 if ( empty($feed_row) ) 105 { 106 page_not_found('Unknown/missing feed identifier'); 107 } 108 if ($feed_row['user_id']!=$user['id']) 109 { // new user 110 $user = array(); 111 $user = build_user( $feed_row['user_id'], true ); 112 } 113 } 114 else 115 { 116 $image_only = true; 117 if (!$user['is_the_guest']) 118 {// auto session was created - so switch to guest 119 $user = array(); 120 $user = build_user( $conf['guest_id'], true ); 121 } 123 122 } 124 123 … … 127 126 include_once(PHPWG_ROOT_PATH.'include/feedcreator.class.php'); 128 127 129 $base_url = get_host_url().cookie_path(); 130 if ( strrpos($base_url, '/') !== strlen($base_url)-1 ) 131 { 132 $base_url .= '/'; 133 } 134 $page['root_path']=$base_url; 128 set_make_full_url(); 135 129 136 130 $rss = new UniversalFeedCreator(); … … 145 139 // +-----------------------------------------------------------------------+ 146 140 147 if ( !isset($_GET['image_only']))148 { 149 $news = news($ user['last_check'], $dbnow, true, true);141 if (!$image_only) 142 { 143 $news = news($feed_row['last_check'], $dbnow, true, true); 150 144 151 145 if (count($news) > 0) … … 174 168 UPDATE '.USER_FEED_TABLE.' 175 169 SET last_check = \''.$dbnow.'\' 176 WHERE id = \''.$ _GET['feed'].'\'170 WHERE id = \''.$feed_id.'\' 177 171 ;'; 178 172 pwg_query($query); … … 180 174 } 181 175 else 182 { // update the last check to avoid deletion by maintenance task 183 $query = ' 184 UPDATE '.USER_FEED_TABLE.' 185 SET last_check = \''.$dbnow.'\' 186 WHERE id = \''.$_GET['feed'].'\' 187 ;'; 188 pwg_query($query); 176 { 177 if ( !empty($feed_id) ) 178 {// update the last check to avoid deletion by maintenance task 179 $query = ' 180 UPDATE '.USER_FEED_TABLE.' 181 SET last_check = \''.$dbnow.'\' 182 WHERE id = \''.$feed_id.'\' 183 ;'; 184 pwg_query($query); 185 } 189 186 } 190 187 … … 196 193 $exploded_date = explode_mysqldt($date); 197 194 $item = new FeedItem(); 198 $item->title = l10n_dec('%d element added', '%d elements added', $date_detail['nb_elements']);195 $item->title = l10n_dec('%d new element', '%d new elements', $date_detail['nb_elements']); 199 196 $item->title .= ' ('.$lang['month'][(int)$exploded_date['month']].' '.$exploded_date['day'].')'; 200 197 $item->link = make_index_url( … … 212 209 $item->description .= 213 210 '<li>' 214 .l10n_dec('%d element added', '%d elements added', $date_detail['nb_elements'])211 .l10n_dec('%d new element', '%d new elements', $date_detail['nb_elements']) 215 212 .' (' 216 213 .'<a href="'.make_index_url(array('section'=>'recent_pics')).'">' … … 239 236 .get_cat_display_name_cache($cat['uppercats']) 240 237 .' ('. 241 l10n_dec('%d element added',242 '%d elements added', $cat['img_count']).')'238 l10n_dec('%d new element', 239 '%d new elements', $cat['img_count']).')' 243 240 .'</li>'; 244 241 } -
trunk/include/common.inc.php
r1744 r1750 180 180 if ( script_basename() != 'identification' and !is_admin() ) 181 181 { 182 //next line required if PATH_INFO (no ? in url) but won't work for scripts outside PWG183 $page['root_path'] = cookie_path();184 182 echo $lang['gallery_locked_message'] 185 .'<a href="'.get_ root_url().'identification.php">.</a>';183 .'<a href="'.get_absolute_root_url(false).'identification.php">.</a>'; 186 184 exit(); 187 185 } … … 198 196 ) 199 197 { 200 //next line required if PATH_INFO (no ? in url) but won't work for scripts outside PWG 201 $page['root_path'] = cookie_path(); 202 redirect (get_root_url().'identification.php'); 198 redirect (get_absolute_root_url(false).'identification.php'); 203 199 } 204 200 … … 221 217 if (count(array_diff($existing, $applied)) > 0) 222 218 { 223 //next line required if PATH_INFO (no ? in url) but won't work for scripts outside PWG224 $page['root_path'] = cookie_path();225 219 $header_msgs[] = 'Some database upgrades are missing, ' 226 .'<a href="'.get_ root_url().'upgrade_feed.php">upgrade now</a>';220 .'<a href="'.get_absolute_root_url(false).'upgrade_feed.php">upgrade now</a>'; 227 221 } 228 222 } -
trunk/include/functions_session.inc.php
r1623 r1750 112 112 } 113 113 $scr = substr($scr,0,strrpos( $scr,'/')); 114 114 115 // add a trailing '/' if needed 115 return ($scr{strlen($scr)-1} == '/') ? $scr : $scr . '/'; 116 $scr .= ($scr{strlen($scr)-1} == '/') ? '' : '/'; 117 118 if ( substr(PHPWG_ROOT_PATH,0,3)=='../') 119 { // this is maybe a plugin inside pwg directory 120 // TODO - what if it is an external script outside PWG ? 121 $scr = $scr.PHPWG_ROOT_PATH; 122 while (1) 123 { 124 $new = preg_replace('#[^/]+/\.\.(/|$)#', '', $scr); 125 if ($new==$scr) 126 { 127 break; 128 } 129 $scr=$new; 130 } 131 } 132 return $scr; 116 133 } 117 134 -
trunk/include/functions_url.inc.php
r1722 r1750 39 39 } 40 40 else 41 { 41 {// TODO - add HERE the possibility to call PWG functions from external scripts 42 42 $root_url = PHPWG_ROOT_PATH; 43 43 } … … 53 53 54 54 /** 55 * returns the url of the current host (e.g. http://www.toto.com ) 56 * TODO: if required by someone, treat https case 57 */ 58 function get_host_url() 59 { 60 $url = "http://"; 61 $url .= $_SERVER['HTTP_HOST']; 62 if ($_SERVER['SERVER_PORT']!=80) 63 { 64 $url .= ':'.$_SERVER['SERVER_PORT']; 65 } 55 * returns the absolute url to the root of PWG 56 * @param boolean with_scheme if false - does not add http://toto.com 57 */ 58 function get_absolute_root_url($with_scheme=true) 59 { 60 // TODO - add HERE the possibility to call PWG functions from external scripts 61 $url = ''; 62 if ($with_scheme) 63 { 64 $url .= 'http://'.$_SERVER['HTTP_HOST']; 65 if ($_SERVER['SERVER_PORT']!=80) 66 { 67 $url .= ':'.$_SERVER['SERVER_PORT']; 68 } 69 } 70 $url .= cookie_path(); 66 71 return $url; 67 72 } … … 420 425 } 421 426 $page['save_root_path']['count'] = 1; 422 $page['root_path'] = get_ host_url().cookie_path();427 $page['root_path'] = get_absolute_root_url(); 423 428 } 424 429 else -
trunk/include/picture_comment.inc.php
r1744 r1750 210 210 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 211 211 212 $del_url = get_host_url().cookie_path() 213 .'comments.php?delete='.$comm['id']; 212 $del_url = get_absolute_root_url().'comments.php?delete='.$comm['id']; 214 213 215 214 $content = … … 222 221 { 223 222 $content .= 224 'Validate: '.get_ host_url().cookie_path()223 'Validate: '.get_absolute_root_url() 225 224 .'comments.php?validate='.$comm['id']; 226 225 } -
trunk/language/en_UK.iso-8859-1/common.lang.php
r1732 r1750 302 302 $lang['%d new element'] = '%d new element'; 303 303 $lang['%d new elements'] = '%d new elements'; 304 $lang['%d element added'] = '%d element added';305 $lang['%d elements added'] = '%d elements added';306 304 $lang['%d new user'] = '%d new user'; 307 305 $lang['%d new users'] = '%d new users'; 308 306 $lang['%d pictures are also linked to current tags'] = '%d pictures are also linked to current tags'; 309 $lang['%d pictures'] = '%d pictures';310 307 $lang['%d waiting element'] = '%d waiting element'; 311 308 $lang['%d waiting elements'] = '%d waiting elements'; -
trunk/language/fr_FR.iso-8859-1/common.lang.php
r1732 r1750 302 302 $lang['%d new element'] = '%d nouvel élément'; 303 303 $lang['%d new elements'] = '%d nouveaux éléments'; 304 $lang['%d element added'] = '%d élément ajouté';305 $lang['%d elements added'] = '%d éléments ajoutés';306 304 $lang['%d new user'] = '%d nouvel utilisateur'; 307 305 $lang['%d new users'] = '%d nouveaux utilisateurs'; 308 306 $lang['%d pictures are also linked to current tags'] = '%d images sont également liées aux tags courants'; 309 $lang['%d pictures'] = '%d images';310 307 $lang['%d waiting element'] = '%d élément en attente'; 311 308 $lang['%d waiting elements'] = '%d éléments en attente'; -
trunk/notification.php
r1703 r1750 52 52 pwg_query($query); 53 53 54 $feed_url=PHPWG_ROOT_PATH.'feed.php?feed='.$page['feed']; 55 $feed_image_only_url=$feed_url.'&image_only'; 54 55 $feed_url=PHPWG_ROOT_PATH.'feed.php'; 56 if ($user['is_the_guest']) 57 { 58 $feed_image_only_url=$feed_url; 59 $feed_url .= '?feed='.$page['feed']; 60 } 61 else 62 { 63 $feed_url .= '?feed='.$page['feed']; 64 $feed_image_only_url=$feed_url.'&image_only'; 65 } 56 66 57 67 // +-----------------------------------------------------------------------+ -
trunk/register.php
r1652 r1750 61 61 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 62 62 $username = $_POST['login']; 63 $admin_url = get_ host_url().cookie_path()63 $admin_url = get_absolute_root_url(). 64 64 .'admin.php?page=user_list&username='.$username; 65 65 -
trunk/ws.php
-
Property
svn:keywords
set to
Author Date Id Revision
r1698 r1750 5 5 // +-----------------------------------------------------------------------+ 6 6 // | branch : BSF (Best So Far) 7 // | file : $ URL: svn+ssh://rvelices@svn.gna.org/svn/phpwebgallery/trunk/action.php$8 // | last update : $Date : 2006-12-21 18:49:12 -0500 (Thu, 21 Dec 2006)$9 // | last modifier : $Author : rvelices$10 // | revision : $Rev : 1678$7 // | file : $Id$ 8 // | last update : $Date$ 9 // | last modifier : $Author$ 10 // | revision : $Rev$ 11 11 // +-----------------------------------------------------------------------+ 12 12 // | This program is free software; you can redistribute it and/or modify | … … 178 178 } 179 179 180 $page['root_path']=get_host_url().cookie_path();180 set_make_full_url(); 181 181 $service->run(); 182 182 -
Property
svn:keywords
set to
Note: See TracChangeset
for help on using the changeset viewer.