Changeset 1084
- Timestamp:
- Mar 16, 2006, 11:34:45 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/element_set_global.php
r1072 r1084 458 458 count($page['cat_elements_id']), 459 459 $page['start'], 460 $page['nb_images'] ,461 '');460 $page['nb_images'] 461 ); 462 462 $template->assign_vars(array('NAV_BAR' => $nav_bar)); 463 463 -
trunk/admin/element_set_unit.php
r1072 r1084 189 189 count($page['cat_elements_id']), 190 190 $page['start'], 191 $page['nb_images'] ,192 '');191 $page['nb_images'] 192 ); 193 193 $template->assign_vars(array('NAV_BAR' => $nav_bar)); 194 194 -
trunk/admin/rating.php
r1072 r1084 133 133 $template->set_filenames(array('rating'=>'admin/rating.tpl')); 134 134 135 $navbar = create_navigation_bar( 136 PHPWG_ROOT_PATH.'admin.php'.get_query_string_diff(array('start','del')), 137 $nb_images, 138 $start, 139 $elements_per_page, 140 ''); 141 $template->assign_vars(array('NAVBAR' => $navbar)); 135 $template->assign_vars( 136 array( 137 'NAVBAR' => create_navigation_bar( 138 PHPWG_ROOT_PATH.'admin.php'.get_query_string_diff(array('start','del')), 139 $nb_images, 140 $start, 141 $elements_per_page, 142 ) 143 ) 144 ); 142 145 143 146 -
trunk/admin/stats.php
r1072 r1084 303 303 $page['nb_logs'], 304 304 $page['start'], 305 $conf['nb_logs_page'], 306 'admin' 305 $conf['nb_logs_page'] 307 306 ); 308 307 -
trunk/admin/user_list.php
r1079 r1084 748 748 count($page['filtered_users']), 749 749 $start, 750 $conf['users_page'], 751 '' 750 $conf['users_page'] 752 751 ); 753 752 -
trunk/category.php
r1083 r1084 29 29 define('PHPWG_ROOT_PATH','./'); 30 30 include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); 31 include(PHPWG_ROOT_PATH.'include/section_init.inc.php'); 31 32 32 33 // +-----------------------------------------------------------------------+ … … 48 49 redirect( $url ); 49 50 } 51 50 52 //---------------------------------------------- change of image display order 51 53 if (isset($_GET['image_order'])) … … 58 60 59 61 redirect( 60 make_index_URL(61 array(), 62 array(' image_order')62 duplicate_index_URL( 63 array(), // nothing to redefine 64 array('start') // changing display order goes back to section first page 63 65 ) 64 66 ); 65 67 } 66 68 //-------------------------------------------------------------- initialization 67 include(PHPWG_ROOT_PATH.'include/section_init.inc.php');68 69 // detection of the start picture to display 69 70 if (!isset($page['start'])) … … 86 87 $page['start'], 87 88 $user['nb_image_page'], 88 'back'89 true 89 90 ); 90 91 } -
trunk/include/config_default.inc.php
r1078 r1084 210 210 $conf['check_upgrade_feed'] = true; 211 211 212 // rate_items: available rates for a picture 213 $conf['rate_items'] = array(0,1,2,3,4,5); 214 212 215 // +-----------------------------------------------------------------------+ 213 216 // | metadata | -
trunk/include/functions.inc.php
r1082 r1084 1138 1138 if (!isset($params['section'])) 1139 1139 { 1140 if (isset($params[' section']))1140 if (isset($params['category'])) 1141 1141 { 1142 1142 $params['section'] = 'categories'; -
trunk/include/functions_category.inc.php
r1082 r1084 76 76 $query.= ' 77 77 AND (id_uppercat is NULL'; 78 if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ))78 if (isset($page['category'])) 79 79 { 80 80 $query.= ' OR id_uppercat IN ('.$page['uppercats'].')'; -
trunk/include/functions_html.inc.php
r1082 r1084 76 76 } 77 77 78 function create_navigation_bar($url, $nb_element, $start, 79 $nb_element_page, $link_class) 78 function create_navigation_bar( 79 $url, $nb_element, $start, $nb_element_page, $clean_url = false 80 ) 80 81 { 81 82 global $lang, $conf; 82 83 83 84 $pages_around = $conf['paginate_pages_around']; 85 $start_str = $clean_url ? '/start-' : '&start='; 84 86 85 87 $navbar = ''; … … 103 105 if ($cur_page != 1) 104 106 { 105 $navbar.= '<a href="';106 $navbar.= $url;107 $navbar.= '" class="'.$link_class.'" rel="start">'.$lang['first_page'];108 $navbar.='</a>';107 $navbar.= 108 '<a href="'.$url.'" rel="start">' 109 .$lang['first_page'] 110 .'</a>'; 109 111 } 110 112 else … … 114 116 $navbar.= ' | '; 115 117 // link on previous page ? 116 if ( $start != 0)118 if ($start != 0) 117 119 { 118 120 $previous = $start - $nb_element_page; 119 $navbar.= '<a href="'; 120 $navbar.= $url; 121 if ($previous>0) 122 { 123 $navbar.= '&start='.$previous; 124 } 125 $navbar.= '" class="'.$link_class.'" rel="prev">'.$lang['previous_page']; 126 $navbar.= '</a>'; 121 122 $navbar.= 123 '<a href="' 124 .$url.($previous > 0 ? $start_str.$previous : '') 125 .'" rel="prev">' 126 .$lang['previous_page'] 127 .'</a>'; 127 128 } 128 129 else … … 134 135 if ($cur_page > $pages_around + 1) 135 136 { 136 $navbar.= ' <a href="'; 137 $navbar.= $url; 138 $navbar.= '" class="'.$link_class.'">1</a>'; 137 $navbar.= ' <a href="'.$url.'">1</a>'; 138 139 139 if ($cur_page > $pages_around + 2) 140 140 { … … 155 155 { 156 156 $temp_start = ($i - 1) * $nb_element_page; 157 $navbar.= ' <a href="';158 $navbar.= $url;159 if ($temp_start>0)160 {161 $navbar.= '&start='.$temp_start;162 }163 $navbar.= '" class="'.$link_class.'"';164 $navbar.='>'.$i.'</a>';157 158 $navbar.= 159 ' ' 160 .'<a href="'.$url 161 .($temp_start > 0 ? $start_str.$temp_start : '') 162 .'">' 163 .$i 164 .'</a>'; 165 165 } 166 166 else 167 167 { 168 $navbar.= ' <span class="pageNumberSelected">'; 169 $navbar.= $i.'</span>'; 168 $navbar.= 169 ' ' 170 .'<span class="pageNumberSelected">' 171 .$i 172 .'</span>'; 170 173 } 171 174 } … … 174 177 { 175 178 $temp_start = ($maximum - 1) * $nb_element_page; 179 176 180 if ($cur_page < ($maximum - $pages_around - 1)) 177 181 { 178 182 $navbar.= ' ...'; 179 183 } 180 $navbar.= ' <a href="'; 181 $navbar.= $url.'&start='.$temp_start; 182 $navbar.= '" class="'.$link_class.'">'.$maximum.'</a>'; 184 185 $navbar.= ' <a href="'.$url.$start_str.$temp_start.'">'.$maximum.'</a>'; 183 186 } 184 187 185 188 $navbar.= ' | '; 186 189 // link on next page ? 187 if ( 188 && $start + $nb_element_page < $nb_element)190 if ($nb_element > $nb_element_page 191 and $start + $nb_element_page < $nb_element) 189 192 { 190 193 $next = $start + $nb_element_page; 191 $navbar.= '<a href="'; 192 $navbar.= $url.'&start='.$next; 193 $navbar.= '" class="'.$link_class.'" rel="next">'.$lang['next_page'].'</a>'; 194 195 $navbar.= 196 '<a href="'.$url.$start_str.$next.'" rel="next">' 197 .$lang['next_page'] 198 .'</a>'; 194 199 } 195 200 else … … 203 208 { 204 209 $temp_start = ($maximum - 1) * $nb_element_page; 205 $navbar.= '<a href="'; 206 $navbar.= $url.'&start='.$temp_start; 207 $navbar.= '" class="'.$link_class.'" rel="last">'.$lang['last_page']; 208 $navbar.= '</a>'; 210 211 $navbar.= 212 '<a href="'.$url.$start_str.$temp_start.'" rel="last">' 213 .$lang['last_page'] 214 .'</a>'; 209 215 } 210 216 else -
trunk/include/picture_comment.inc.php
r1082 r1084 130 130 131 131 // navigation bar creation 132 $url = PHPWG_ROOT_PATH.'picture.php'; 133 $url.= get_query_string_diff(array('add_fav','start')); 134 135 // $url = duplicate_picture_URL( 136 // array(), 137 // array('start') 138 // ); 139 140 if (!isset($_GET['start']) 141 or !is_numeric($_GET['start']) 142 or (is_numeric($_GET['start']) and $_GET['start'] < 0)) 132 if (!isset($page['start'])) 143 133 { 144 134 $page['start'] = 0; 145 135 } 146 else 147 { 148 $page['start'] = $_GET['start']; 149 } 136 150 137 $page['navigation_bar'] = create_navigation_bar( 151 $url,138 duplicate_picture_URL(array(), array('start')), 152 139 $row['nb_comments'], 153 140 $page['start'], 154 141 $conf['nb_comment_page'], 155 ''142 true // We want a clean URL 156 143 ); 157 144 … … 199 186 'comments.comment.delete', 200 187 array( 201 'U_COMMENT_DELETE' => $url.'&del='.$row['id'] 188 'U_COMMENT_DELETE' => 189 $url_self 190 .'&action=delete_comment' 191 .'&comment_to_delete='.$row['id'] 202 192 ) 203 193 ); -
trunk/include/picture_rate.inc.php
r1082 r1084 30 30 * 31 31 */ 32 33 $rate_items = array(0,1,2,3,4,5);34 32 35 33 if ($conf['rate']) … … 110 108 ); 111 109 112 foreach ($ rate_itemsas $num => $mark)110 foreach ($conf['rate_items'] as $num => $mark) 113 111 { 114 112 $template->assign_block_vars( -
trunk/picture.php
r1082 r1084 28 28 define('PHPWG_ROOT_PATH','./'); 29 29 include_once(PHPWG_ROOT_PATH.'include/common.inc.php'); 30 include_once(PHPWG_ROOT_PATH.'include/functions_rate.inc.php'); 30 31 include(PHPWG_ROOT_PATH.'include/section_init.inc.php'); 31 32 … … 195 196 case 'rate' : 196 197 { 197 if (isset($_GET['rate']) 198 and $conf['rate'] 199 and (!$user['is_the_guest'] or $conf['rate_anonymous']) 200 and in_array($_GET['rate'], $rate_items)) 201 { 202 if ($user['is_the_guest']) 203 { 204 $ip_components = explode('.', $_SERVER["REMOTE_ADDR"]); 205 if (count($ip_components) > 3) 206 { 207 array_pop($ip_components); 208 } 209 $anonymous_id = implode ('.', $ip_components); 210 211 if (isset($_COOKIE['pwg_anonymous_rater'])) 212 { 213 if ($anonymous_id != $_COOKIE['pwg_anonymous_rater']) 214 { // client has changed his IP adress or he's trying to fool us 215 $query = ' 216 SELECT element_id FROM '. RATE_TABLE . ' 217 WHERE user_id=' . $user['id'] . ' 218 AND anonymous_id=\'' . $anonymous_id . '\''; 219 $result = pwg_query($query); 220 $already_there = array(); 221 while ($row = mysql_fetch_array($result)) 222 { 223 array_push($already_there, $row['element_id']); 224 } 225 226 if (count($already_there) > 0) 227 { 228 $query = ' 229 DELETE 230 FROM '.RATE_TABLE.' 231 WHERE user_id = '.$user['id'].' 232 AND anonymous_id = \''.$_COOKIE['pwg_anonymous_rater'].'\' 233 AND element_id NOT IN ('.implode(',', $already_there).') 234 ;'; 235 pwg_query($query); 236 } 237 238 $query = ' 239 UPDATE 240 '.RATE_TABLE.' 241 SET anonymous_id = \'' .$anonymous_id.'\' 242 WHERE user_id = '.$user['id'].' 243 AND anonymous_id = \'' . $_COOKIE['pwg_anonymous_rater'].'\' 244 ;'; 245 pwg_query($query); 246 247 setcookie( 248 'pwg_anonymous_rater', 249 $anonymous_id, 250 strtotime('+10 years'), 251 cookie_path() 252 ); 253 } 254 } 255 else 256 { 257 setcookie( 258 'pwg_anonymous_rater', 259 $anonymous_id, 260 strtotime('+10 years'), 261 cookie_path() 262 ); 263 } 264 } 265 266 $query = ' 267 DELETE 268 FROM '.RATE_TABLE.' 269 WHERE element_id = '.$page['image_id'] . ' 270 AND user_id = '.$user['id'].' 271 '; 272 if (isset($anonymous_id)) 273 { 274 $query.= ' AND anonymous_id = \''.$anonymous_id.'\''; 275 } 276 pwg_query($query); 277 $query = ' 278 INSERT 279 INTO '.RATE_TABLE.' 280 (user_id,anonymous_id,element_id,rate,date) 281 VALUES 282 (' 283 .$user['id'].',' 284 .(isset($anonymous_id) ? '\''.$anonymous_id.'\'' : "''").',' 285 .$page['image_id'].',' 286 .$_GET['rate'] 287 .',NOW()) 288 ;'; 289 pwg_query($query); 290 291 // update of images.average_rate field 292 $query = ' 293 SELECT ROUND(AVG(rate),2) AS average_rate 294 FROM '.RATE_TABLE.' 295 WHERE element_id = '.$page['image_id'].' 296 ;'; 297 $row = mysql_fetch_array(pwg_query($query)); 298 $query = ' 299 UPDATE '.IMAGES_TABLE.' 300 SET average_rate = '.$row['average_rate'].' 301 WHERE id = '.$page['image_id'].' 302 ;'; 303 pwg_query($query); 304 } 305 198 rate_picture($user['id'], $page['image_id'], $_GET['rate']); 306 199 redirect($url_self); 307 200 }
Note: See TracChangeset
for help on using the changeset viewer.