Changeset 154
- Timestamp:
- 11/20/08 11:36:21 (3 years ago)
- Files:
-
- admin/admin_db_utilities.php (modified) (3 diffs)
- include/functions_torrenttable.php (modified) (2 diffs)
- include/global.php (modified) (6 diffs)
- include/overall_header.php (modified) (6 diffs)
- include/sessions.php (modified) (1 diff)
- offers.php (modified) (4 diffs)
- requests.php (modified) (3 diffs)
- upload.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
admin/admin_db_utilities.php
r4 r154 543 543 { 544 544 $handler("\n#\n# Table Data for $table\n#\n"); 545 $field_names = array(); 546 547 // Grab the list of field names. 548 $num_fields = mysql_num_fields($result); 549 $table_list = '('; 550 for ($j = 0; $j < $num_fields; $j++) 551 { 552 $field_names[$j] = mysql_fetch_field($j); 553 $table_list .= (($j > 0) ? ', ' : '') . $field_names[$j]; 554 555 } 556 $table_list .= ')'; 557 558 do 559 { 560 // Start building the SQL statement. 561 $schema_insert = "INSERT INTO $table $table_list VALUES("; 562 563 // Loop through the rows and fill in data for each column 564 for ($j = 0; $j < $num_fields; $j++) 565 { 566 $schema_insert .= ($j > 0) ? ', ' : ''; 567 568 if(!isset($row[$field_names[$j]])) 569 { 570 // 571 // If there is no data for the column set it to null. 572 // There was a problem here with an extra space causing the 573 // sql file not to reimport if the last column was null in 574 // any table. Should be fixed now :) JLH 575 // 576 $schema_insert .= 'NULL'; 577 } 578 elseif ($row[$field_names[$j]] != '') 579 { 580 $schema_insert .= '\'' . addslashes($row[$field_names[$j]]) . '\''; 581 } 582 else 583 { 584 $schema_insert .= '\'\''; 585 } 586 } 587 588 $schema_insert .= ');'; 589 590 // Go ahead and send the insert statement to the handler function. 591 $handler(trim($schema_insert)); 592 593 } 594 while ($row = $db->sql_fetchrow($result)); 545 $fields = array(); 546 547 do { 548 $fields[] = $row; 549 } 550 while ( $row = $db->sql_fetchrow($result) ); 551 552 $schema_insert = 'INSERT INTO ' . $table . ' ' . $db->sql_build_array('MULTI_INSERT', $fields); 553 554 $handler(trim($schema_insert)); 595 555 } 596 556 … … 611 571 // ------------- 612 572 573 $perform = request_var('perform', ''); 574 613 575 614 576 // 615 577 // Begin program proper 616 578 // 617 if( isset($_GET['perform']) || isset($_POST['perform']))579 if( $perform ) 618 580 { 619 $perform = (isset($_POST['perform'])) ? $_POST['perform'] : $_GET['perform'];620 581 621 582 switch($perform) … … 662 623 663 624 664 $additional_tables = (isset($_POST['additional_tables'])) ? $_POST['additional_tables'] : ( (isset($_GET['additional_tables'])) ? $_GET['additional_tables'] : "");665 666 $backup_type = (isset($_POST['backup_type'])) ? $_POST['backup_type'] : ( (isset($_GET['backup_type'])) ? $_GET['backup_type'] : "");667 668 $gzipcompress = (!empty($_POST['gzipcompress'])) ? $_POST['gzipcompress'] : ( (!empty($_GET['gzipcompress'])) ? $_GET['gzipcompress'] : 0);669 670 $drop = (!empty($_POST['drop'])) ? intval($_POST['drop']) : ( (!empty($_GET['drop'])) ? intval($_GET['drop']) : 0);625 $additional_tables = request_var('additional_tables', ''); 626 627 $backup_type = request_var('backup_type', ''); 628 629 $gzipcompress = request_var('gzipcompress', 0); 630 631 $drop = request_var('drop', 0); 671 632 672 633 if(!empty($additional_tables)) include/functions_torrenttable.php
r148 r154 1 1 <?php 2 function get_slr_color($ratio) { 3 if ( $ratio == 'Inf.' || $ratio == '---' ) { 4 return ''; 5 } 6 $n = 0.375; 7 $color = 16; 8 for ($i=0.025; $i<=$n; $i+=0.025) { 9 $color-=1; 10 $s = dechex($color); 11 if ($ratio < $i) { 12 return '#' . $s . $s . '0000'; 13 } 14 15 } 16 return ''; 17 } 18 2 19 function torrenttable($ary, $bookmarks = false) { 3 20 global $userdata, $lang, $config, $template, $images, $cats, $theme; … … 131 148 } 132 149 else { 133 $seeders = '<span style="color:' . linkcolor($ary[$i]['seeders']) . ';">' . $ary[$i]['seeders'] . '</span>';150 $seeders = '<span style="color:' . ( !$ary[$i]['seeders'] ? 'red' : 'green' ) . ';">' . $ary[$i]['seeders'] . '</span>'; 134 151 } 135 152 $leechers = ( $ary[$i]['leechers'] ? '<a href="' . append_sid('details.php?id=' . $id . '&view=peerlist') . '#leechers"><b>' . number_format($ary[$i]['leechers']) . '</b></a>' : 0); include/global.php
r150 r154 421 421 } 422 422 423 function get_slr_color($ratio) {424 if ( $ratio == 'Inf.' || $ratio == '---' ) {425 return '';426 }427 $n = 0.375;428 $color = 16;429 for ($i=0.025; $i<=$n; $i+=0.025) {430 $color-=1;431 $s = dechex($color);432 if ($ratio < $i) {433 return '#' . $s . $s . '0000';434 }435 436 }437 return '';438 }439 440 423 function set_config($config_name, $config_value, $is_dynamic = false) 441 424 { … … 498 481 } 499 482 500 //501 // Create date/time from format and timezone502 //503 function create_date($format, $gmepoch, $tz)504 {505 global $config, $lang, $userdata;506 static $translate;507 // [start] DST508 if ( ($userdata['uid'] != ANONYMOUS && $userdata['user_dst']) || ($userdata['uid'] == ANONYMOUS && $config['board_dst']) )509 {510 $tz = $tz + date('I', $gmepoch);511 }512 // [end] DST513 514 if ( empty($translate) && $config['default_lang'] != 'english' )515 {516 @reset($lang['datetime']);517 while ( list($match, $replace) = @each($lang['datetime']) )518 {519 $translate[$match] = $replace;520 }521 }522 523 return ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz)), $translate) : @gmdate($format, $gmepoch + (3600 * $tz));524 }525 526 483 function mksize($bytes) { 527 484 global $lang; … … 728 685 } 729 686 730 function linkcolor($num) {731 if (!$num) {732 return 'red';733 }734 return 'green';735 }736 737 687 function ratingpic($num) { 738 688 global $lang, $images; … … 743 693 return; 744 694 } 745 return '<img src="' . $images['rating_' . $r] . '" alt="' . $lang['rating'] . ': ' . $num . ' / 5" title="' . $lang['rating'] . ': ' . $num . ' / 5" />';695 return '<img src="' . $images['rating_' . $r] . '" alt="' . $lang['rating'] . ': ' . $num . ' / 5" title="' . $lang['rating'] . ': ' . $num . ' / 5" />'; 746 696 } 747 697 … … 798 748 global $userdata; 799 749 800 list($year, $month, $day) = split('-', $birthday);750 list($year, $month, $day) = explode('-', $birthday); 801 751 $current = gmdate('Y-m-d', time() + $userdata['tzoffset'] * 60); 802 list($year2, $month2, $day2) = split('-', $current);752 list($year2, $month2, $day2) = explode('-', $current); 803 753 if($month2 < $month) { 804 754 $age = $year2 - $year - 1; … … 1244 1194 } 1245 1195 1246 /**1247 * Re-Apply session id after page reloads1248 */1249 function reapply_sid($url)1250 {1251 global $tracker_root_path;1252 1253 if ($url === "index.php")1254 {1255 return append_sid("index.php");1256 }1257 else if ($url === "{$tracker_root_path}index.php")1258 {1259 return append_sid("{$tracker_root_path}index.php");1260 }1261 1262 // Remove previously added sid1263 if (strpos($url, '?sid=') !== false)1264 {1265 $url = preg_replace('/(\?)sid=[a-z0-9]+(&|&)?/', '\1', $url);1266 }1267 else if (strpos($url, '&sid=') !== false)1268 {1269 $url = preg_replace('/&sid=[a-z0-9]+(&)?/', '\1', $url);1270 }1271 else if (strpos($url, '&sid=') !== false)1272 {1273 $url = preg_replace('/&sid=[a-z0-9]+(&)?/', '\1', $url);1274 }1275 1276 return append_sid($url);1277 }1278 1279 /**1280 * Returns url from the session/current page with an re-appended SID with optionally stripping vars from the url1281 */1282 function build_url($strip_vars = false)1283 {1284 global $tracker_root_path;1285 1286 // Append SID1287 $current_page = extract_current_page();1288 $redirect = append_sid($current_page['page'], false, false);1289 1290 // Add delimiter if not there...1291 if (strpos($redirect, '?') === false)1292 {1293 $redirect .= '?';1294 }1295 1296 // Strip vars...1297 if ($strip_vars !== false && strpos($redirect, '?') !== false)1298 {1299 if (!is_array($strip_vars))1300 {1301 $strip_vars = array($strip_vars);1302 }1303 1304 $query = $_query = array();1305 1306 $args = substr($redirect, strpos($redirect, '?') + 1);1307 $args = ($args) ? explode('&', $args) : array();1308 $redirect = substr($redirect, 0, strpos($redirect, '?'));1309 1310 foreach ($args as $argument)1311 {1312 $arguments = explode('=', $argument);1313 $key = $arguments[0];1314 unset($arguments[0]);1315 1316 $query[$key] = implode('=', $arguments);1317 }1318 1319 // Strip the vars off1320 foreach ($strip_vars as $strip)1321 {1322 if (isset($query[$strip]))1323 {1324 unset($query[$strip]);1325 }1326 }1327 1328 // Glue the remaining parts together... already urlencoded1329 foreach ($query as $key => $value)1330 {1331 $_query[] = $key . '=' . $value;1332 }1333 $query = implode('&', $_query);1334 1335 $redirect .= ($query) ? '?' . $query : '';1336 }1337 1338 return $tracker_root_path . str_replace('&', '&', $redirect);1339 }1340 1341 1196 function show_login_box ( ) { 1342 1197 global $lang, $template; include/overall_header.php
r148 r154 6 6 7 7 $theme['is_use_right_menu'] = ( $theme['is_use_right_menu'] ? $right_menu : 0 ); 8 8 9 $title = strip_tags($title); 9 10 $keywords = $title; … … 15 16 $keywords = $config['site_keywords'] . ', ' . implode(', ', $keywords); 16 17 17 require_once($tracker_root_path . 'include/functions_check.php');18 19 18 //start active users 20 19 if ( $config['show_online_users'] ) { 21 20 $user_forum_sql = ''; 21 22 22 if ( defined('IN_PHPBB') ) { 23 if (!empty($_REQUEST['f'])) { 24 $f = ( isset($_GET['f']) ? intval($_GET['f']) : ( isset($_POST['f']) ? intval($_POST['f']) : 0 ) ); 23 $f = request('f', 0); 24 25 if ( $f ) { 25 26 $user_forum_sql = " AND s.session_page LIKE '%phpbb2.php%f={$f}%'"; 26 27 } … … 31 32 32 33 $sql = "SELECT u.name, u.uid, u.class, u.parked, u.warneduntil, u.enabled, u.donor, s.session_logged_in, s.session_ip 33 FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s34 WHERE u.uid = s.session_user_id35 AND s.session_time >= ". ( time() - $config['online_time'] ) . "36 $user_forum_sql37 ORDER BY s.session_ip ASC";34 FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s 35 WHERE u.uid = s.session_user_id 36 AND s.session_time >= ". ( time() - $config['online_time'] ) . " 37 $user_forum_sql 38 ORDER BY s.session_ip ASC"; 38 39 $result = $db->sql_query($sql); 40 39 41 $userlist_ary = array(); 40 42 $userlist_visible = array(); … … 122 124 $lang['language_charset'] = ( isset($config['default_language_charset']) && !empty($config['default_language_charset']) ? $config['default_language_charset'] : $lang['language_charset']); 123 125 124 $template->assign_vars(array(126 $template->assign_vars(array( 125 127 'PAGE_TITLE' => $title, 126 128 'KEYWORDS' => $keywords, … … 167 169 'U_RELEASES_ADD' => append_sid('releases.php?action=add'), 168 170 'U_CHEATERS' => append_sid('cheaters.php') 171 )); 172 173 if ( $userdata['session_logged_in'] ) { 174 $sql = 'SELECT * FROM news WHERE ( added + news_announce_time * 24 * 60 * 60 ) > UNIX_TIMESTAMP(NOW()) ORDER BY added DESC'; 175 $result = $db->sql_query($sql, 24 * 60 * 60); 176 177 if( $row = $db->sql_fetchrow($result) ) { 178 $show_news = false; 179 $news_ary = array(); 180 181 do { 182 $n_a_u_c = explode(',', $row['news_announce_user_classes']); 183 if ( $n_a_u_c[0] == '' || in_array(strval($userdata['class']), $n_a_u_c, true) || $userdata['class'] >= UC_MODERATOR ) { 184 $show_news = true; 185 $news_ary[] = array( 186 'id' => $row['id'], 187 'added' => $row['added'], 188 'title' => $row['title'], 189 'body' => $row['body'] 190 ); 191 } 192 } 193 while ( $row = $db->sql_fetchrow($result) ); 194 195 if ( $show_news ) { 196 require_once($tracker_root_path . 'include/functions_post.php'); 197 198 $template->assign_block_vars('news_annoucment', array()); 199 200 foreach ( $news_ary AS $key => $ary ) { 201 $template->assign_block_vars('news_annoucment.news_annoucment_row', array( 202 'NEWS_ID' => $ary['id'], 203 'NEWS_ADDED' => create_date('M d', $ary['added'], $userdata['tzoffset']), 204 'NEWS_TITLE' => $ary['title'], 205 'NEWS_BODY' => format_comment($ary['body']) ) 206 ); 207 } 208 } 209 } 210 211 $template->assign_vars(array( 212 'RSS_FEED' => '<link rel="alternate" type="application/rss+xml" title="' . $config['sitename'] . '" href="' . generate_tracker_url() . '/rss.php?passkey=' . $userdata['torrent_pass'] . '" />' . "\n", 213 'S_YOU_HAVE_INVITES' => sprintf($lang['you_have_invites'], $userdata['invites']), 214 'U_LOGOUT' => append_sid('login.php?action=logout'), 215 'U_MESSAGES_INBOX' => append_sid('message.php'), 216 'U_MESSAGES_SENTBOX' => append_sid('message.php?action=viewmailbox&box=' . PM_SENTBOX), 217 'U_MY_FRIENDS' => append_sid('my.php?type=friends'), 218 'U_USERDETAILS_LINK' => append_sid('userdetails.php?id=' . $userdata['uid']) 169 219 )); 170 220 171 if ( $userdata['session_logged_in'] ) { 172 $sql = 'SELECT * FROM news WHERE ( added + news_announce_time * 24 * 60 * 60 ) > UNIX_TIMESTAMP(NOW()) ORDER BY added DESC'; 173 $result = $db->sql_query($sql, 24 * 60 * 60); 174 if( $row = $db->sql_fetchrow($result) ) { 175 $show_news = false; 176 $news_ary = array(); 177 do { 178 $n_a_u_c = explode(',', $row['news_announce_user_classes']); 179 if ( $n_a_u_c[0] == '' || in_array(strval($userdata['class']), $n_a_u_c, true) || $userdata['class'] >= UC_MODERATOR ) { 180 $show_news = true; 181 $news_ary[] = array( 182 'id' => $row['id'], 183 'added' => $row['added'], 184 'title' => $row['title'], 185 'body' => $row['body'] 186 ); 187 } 188 } 189 while ( $row = $db->sql_fetchrow($result) ); 190 191 if ( $show_news ) { 192 require_once($tracker_root_path . 'include/functions_post.php'); 193 $template->assign_block_vars('news_annoucment', array()); 194 foreach ( $news_ary AS $key => $ary ) { 195 $template->assign_block_vars('news_annoucment.news_annoucment_row', array( 196 'NEWS_ID' => $ary['id'], 197 'NEWS_ADDED' => create_date('M d', $ary['added'], $userdata['tzoffset']), 198 'NEWS_TITLE' => $ary['title'], 199 'NEWS_BODY' => format_comment($ary['body']) ) 200 ); 201 } 202 } 203 } 204 205 $template->assign_vars(array( 206 'RSS_FEED' => '<link rel="alternate" type="application/rss+xml" title="' . $config['sitename'] . '" href="' . generate_tracker_url() . '/rss.php?passkey=' . $userdata['torrent_pass'] . '" />' . "\n", 207 'S_YOU_HAVE_INVITES' => sprintf($lang['you_have_invites'], $userdata['invites']), 208 'U_LOGOUT' => append_sid('login.php?action=logout'), 209 'U_MESSAGES_INBOX' => append_sid('message.php'), 210 'U_MESSAGES_SENTBOX' => append_sid('message.php?action=viewmailbox&box=' . PM_SENTBOX), 211 'U_MY_FRIENDS' => append_sid('my.php?type=friends'), 212 'U_USERDETAILS_LINK' => append_sid('userdetails.php?id=' . $userdata['uid']) ) 213 ); 214 215 $uped = mksize($userdata['uploaded']); 216 $downed = mksize($userdata['downloaded']); 217 $ratio = get_ratio ($userdata['uploaded'], $userdata['downloaded']); 218 $color = get_ratio_color($ratio); 219 $ratio = '<span style="color:' . $color . ';">' . $ratio . '</span>'; 220 221 $template->assign_block_vars('user_panel', array( 222 'PM_TITLE' =>( $userdata['user_unread_pms'] ? $lang['new_inbox_pms'] : $lang['no_new_inbox_pms'] ), 223 'INBOX_PM_PIC' => ( $userdata['user_unread_pms'] ? $images['inboxnew'] : $images['inbox'] ), 224 'SENTBOX_PIC' => $images['sentbox'], 225 'BUDDYLIST_PIC' => $images['buddylist'], 226 'RATIO' => $ratio, 227 'UPED' => $uped, 228 'DOWNED' => $downed, 229 'WARN_PANEL' => ($userdata['class'] < UC_MODERATOR? $lang['warns'] . ': ' . warn_panel($userdata['warn']) : ''), 230 'CURUSER_NAME' => get_user_class_color($userdata['class'], $userdata['name']), 231 'CURUSER_ICONS' => get_user_icons($userdata), 232 'S_CURRENT_TIME' => sprintf($lang['current_time'], '<span id="clock"> </span>') ) 233 ); 234 $min_class_allow_upload = ( $config['min_class_allow_upload'] == '-1' ? UC_PEASANT : ( check_user_class($config['min_class_allow_upload']) ? $config['min_class_allow_upload'] : UC_UPLOADER ) ); 235 if ( $userdata['class'] >= $min_class_allow_upload ) { 236 $template->assign_block_vars('switch_uploader_view', array()); 237 } 238 else { 239 $template->assign_block_vars('switch_non_uploader_view', array()); 240 } 241 242 if ( $userdata['class'] >= UC_MODERATOR ) { 243 $template->assign_block_vars('switch_moderator_view', array()); 244 245 //start uploaders requset 246 $sql = 'SELECT votes FROM ' . UPLOADAPP_TABLE . ' WHERE active = 1'; 247 $result = $db->sql_query($sql); 248 $voted = $vcount = 0; 249 if( $row = $db->sql_fetchrow($result) ) { 250 do { 251 $vcount++; 252 if(!empty($row['votes'])) { 253 $votes = explode(' ',$row['votes']); 254 for($i = 0; $i < sizeof($votes); $i++) { 255 $votei = explode(":" , $votes[$i]); 256 if($userdata['uid'] == $votei[0]) { 257 $voted++; 258 } 259 } 260 } 261 } 262 while($row = $db->sql_fetchrow($result)); 263 } 264 $db->sql_freeresult($result); 265 $vtc = $vcount-$voted; 266 //end uploaders requset 267 268 //start reports 269 $sql = 'SELECT COUNT(*) AS numreports FROM ' . REPORTS_TABLE . ' WHERE dealtwith = 0'; 270 $result = $db->sql_query($sql); 271 $numreports = ( $row = $db->sql_fetchrow($result) ) ? intval($row['numreports']) : 0; 272 $db->sql_freeresult($result); 273 //end reports 274 275 //start helpdesk 276 $sql = 'SELECT COUNT(*) AS num_help FROM ' . HELPDESK_TABLE . ' WHERE solved = 0'; 277 $result = $db->sql_query($sql); 278 $help_num = ( $row = $db->sql_fetchrow($result) ) ? intval($row['num_help']) : 0; 279 $db->sql_freeresult($result); 280 //end helpdesk 281 282 $template->assign_vars(array( 283 'HELPDESC_NUM' => $help_num, 284 'CANDIDATES_NUM' => $vtc, 285 'REPORTS_NUM' => $numreports 286 ) 287 ); 288 } 289 if ( $userdata['class'] >= UC_ADMINISTRATOR ) { 290 $template->assign_block_vars('switch_admin_view', array()); 291 } 292 if ( $userdata['class'] == UC_SYSOP ) { 293 $template->assign_block_vars('switch_sysop_view', array()); 294 } 295 if ( $userdata['user_unread_pms'] ) { 296 $template->assign_block_vars('new_messages', array( 297 'UNREAD_MESSAGES' => sprintf($lang['unread_messages'], $userdata['user_unread_pms']))); 298 } 299 $template->assign_block_vars('switch_curuser_view', array()); 300 } 301 else { 302 $template->assign_block_vars('switch_non_curuser_view', array()); 303 } 304 305 if ( defined('IN_PHPBB') ) { 221 $uped = mksize($userdata['uploaded']); 222 $downed = mksize($userdata['downloaded']); 223 $ratio = get_ratio ($userdata['uploaded'], $userdata['downloaded']); 224 $color = get_ratio_color($ratio); 225 $ratio = '<span style="color:' . $color . ';">' . $ratio . '</span>'; 226 227 $template->assign_block_vars('user_panel', array( 228 'PM_TITLE' =>( $userdata['user_unread_pms'] ? $lang['new_inbox_pms'] : $lang['no_new_inbox_pms'] ), 229 'INBOX_PM_PIC' => ( $userdata['user_unread_pms'] ? $images['inboxnew'] : $images['inbox'] ), 230 'SENTBOX_PIC' => $images['sentbox'], 231 'BUDDYLIST_PIC' => $images['buddylist'], 232 'RATIO' => $ratio, 233 'UPED' => $uped, 234 'DOWNED' => $downed, 235 'WARN_PANEL' => ($userdata['class'] < UC_MODERATOR? $lang['warns'] . ': ' . warn_panel($userdata['warn']) : ''), 236 'CURUSER_NAME' => get_user_class_color($userdata['class'], $userdata['name']), 237 'CURUSER_ICONS' => get_user_icons($userdata), 238 'S_CURRENT_TIME' => sprintf($lang['current_time'], '<span id="clock"> </span>') 239 )); 240 241 if ( $userdata['class'] >= $config['min_class_allow_upload'] ) { 242 $template->assign_block_vars('switch_uploader_view', array()); 243 } 244 else { 245 $template->assign_block_vars('switch_non_uploader_view', array()); 246 } 247 248 if ( $userdata['class'] >= UC_MODERATOR ) { 249 $template->assign_block_vars('switch_moderator_view', array()); 250 251 //start uploaders requset 252 $sql = 'SELECT votes FROM ' . UPLOADAPP_TABLE . ' WHERE active = 1'; 253 $result = $db->sql_query($sql); 254 $voted = $vcount = 0; 255 if( $row = $db->sql_fetchrow($result) ) { 256 do { 257 $vcount++; 258 if(!empty($row['votes'])) { 259 $votes = explode(' ',$row['votes']); 260 for($i = 0; $i < sizeof($votes); $i++) { 261 $votei = explode(":" , $votes[$i]); 262 if($userdata['uid'] == $votei[0]) { 263 $voted++; 264 } 265 } 266 } 267 } 268 while($row = $db->sql_fetchrow($result)); 269 } 270 $db->sql_freeresult($result); 271 $vtc = $vcount-$voted; 272 //end uploaders requset 273 274 //start reports 275 $sql = 'SELECT COUNT(*) AS numreports FROM ' . REPORTS_TABLE . ' WHERE dealtwith = 0'; 276 $result = $db->sql_query($sql); 277 $numreports = ( $row = $db->sql_fetchrow($result) ) ? intval($row['numreports']) : 0; 278 $db->sql_freeresult($result); 279 //end reports 280 281 //start helpdesk 282 $sql = 'SELECT COUNT(*) AS num_help FROM ' . HELPDESK_TABLE . ' WHERE solved = 0'; 283 $result = $db->sql_query($sql); 284 $help_num = ( $row = $db->sql_fetchrow($result) ) ? intval($row['num_help']) : 0; 285 $db->sql_freeresult($result); 286 //end helpdesk 287 288 $template->assign_vars(array( 289 'HELPDESC_NUM' => $help_num, 290 'CANDIDATES_NUM' => $vtc, 291 'REPORTS_NUM' => $numreports 292 )); 293 } 294 if ( $userdata['class'] >= UC_ADMINISTRATOR ) { 295 $template->assign_block_vars('switch_admin_view', array()); 296 } 297 if ( $userdata['class'] == UC_SYSOP ) { 298 $template->assign_block_vars('switch_sysop_view', array()); 299 } 300 if ( $userdata['user_unread_pms'] ) { 301 $template->assign_block_vars('new_messages', array( 302 'UNREAD_MESSAGES' => sprintf($lang['unread_messages'], $userdata['user_unread_pms']) 303 )); 304 } 305 $template->assign_block_vars('switch_curuser_view', array()); 306 } 307 else { 308 $template->assign_block_vars('switch_non_curuser_view', array()); 309 } 310 311 if ( defined('IN_PHPBB') ) { 306 312 define('HEADER_INC', TRUE); 307 313 … … 321 327 // 322 328 $template->assign_vars(array( 323 'S_INDEX_SEARCH' => sprintf($lang['forum_index_search'], $config['sitename']),324 325 'L_INDEX_SEARCH' => sprintf($lang['forum_index_search'], $config['sitename']),326 'L_SEARCH_SELF' => $lang['search_your_posts'],327 328 'U_SEARCH_UNANSWERED' => append_sid('phpbb2.php?page=search&search_id=unanswered'),329 'U_SEARCH_SELF' => append_sid('phpbb2.php?page=search&search_id=egosearch'),330 'U_SEARCH_NEW' => append_sid('phpbb2.php?page=search&search_id=newposts'),331 'U_SEARCH' => append_sid('phpbb2.php?page=search'),332 'U_MODCP' => append_sid('phpbb2.php?page=modcp'),333 'U_GROUP_CP' => append_sid('phpbb2.php?page=groupcp'),334 // [start] DST329 'S_INDEX_SEARCH' => sprintf($lang['forum_index_search'], $config['sitename']), 330 331 'L_INDEX_SEARCH' => sprintf($lang['forum_index_search'], $config['sitename']), 332 'L_SEARCH_SELF' => $lang['search_your_posts'], 333 334 'U_SEARCH_UNANSWERED' => append_sid('phpbb2.php?page=search&search_id=unanswered'), 335 'U_SEARCH_SELF' => append_sid('phpbb2.php?page=search&search_id=egosearch'), 336 'U_SEARCH_NEW' => append_sid('phpbb2.php?page=search&search_id=newposts'), 337 'U_SEARCH' => append_sid('phpbb2.php?page=search'), 338 'U_MODCP' => append_sid('phpbb2.php?page=modcp'), 339 'U_GROUP_CP' => append_sid('phpbb2.php?page=groupcp'), 340 // [start] DST 335 341 'S_TIMEZONE' => sprintf($lang['all_times'], $l_timezone) . ( (($userdata['uid'] != ANONYMOUS && $userdata['user_dst']) || ($userdata['uid'] == ANONYMOUS && $config['board_dst']) ) ? ' ' . $lang['dst'] : '' ), 336 342 // [end] DST 337 ) 338 ); 339 } 340 341 $GLOBALS['do_gzip_compress'] = FALSE; 342 if ( $config['gzip_compress'] ) { 343 $phpver = phpversion(); 344 345 $useragent = (isset($_SERVER['HTTP_USER_AGENT'])) ? $_SERVER['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT'); 346 347 if ( $phpver >= '4.0.4pl1' && ( strstr($useragent,'compatible') || strstr($useragent,'Gecko') ) ) { 348 if ( @extension_loaded('zlib') && !headers_sent() ) { 349 ob_start('ob_gzhandler'); 350 } 351 } 352 else if ( $phpver > '4.0' ) { 353 if ( strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') ) { 354 if ( @extension_loaded('zlib') && !headers_sent() ) { 355 $GLOBALS['do_gzip_compress'] = TRUE; 356 ob_start(); 357 ob_implicit_flush(0); 358 header('Content-Encoding: gzip'); 359 } 360 } 361 } 362 } 363 364 return; 343 )); 344 } 345 346 $GLOBALS['do_gzip_compress'] = false; 347 if ( $config['gzip_compress'] ) { 348 $phpver = phpversion(); 349 350 $useragent = (isset($_SERVER['HTTP_USER_AGENT'])) ? $_SERVER['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT'); 351 352 if ( $phpver >= '4.0.4pl1' && ( strstr($useragent,'compatible') || strstr($useragent,'Gecko') ) ) { 353 if ( @extension_loaded('zlib') && !headers_sent() ) { 354 ob_start('ob_gzhandler'); 355 } 356 } 357 else if ( $phpver > '4.0' ) { 358 if ( strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') ) { 359 if ( @extension_loaded('zlib') && !headers_sent() ) { 360 $GLOBALS['do_gzip_compress'] = true; 361 ob_start(); 362 ob_implicit_flush(0); 363 header('Content-Encoding: gzip'); 364 } 365 } 366 } 367 } 368 369 return; 365 370 } 366 371 include/sessions.php
r151 r154 1046 1046 } 1047 1047 1048 /** 1049 * Re-Apply session id after page reloads 1050 */ 1051 function reapply_sid($url) 1052 { 1053 global $tracker_root_path; 1054 1055 if ($url === "index.php") 1056 { 1057 return append_sid("index.php"); 1058 } 1059 else if ($url === "{$tracker_root_path}index.php") 1060 { 1061 return append_sid("{$tracker_root_path}index.php"); 1062 } 1063 1064 // Remove previously added sid 1065 if (strpos($url, '?sid=') !== false) 1066 { 1067 $url = preg_replace('/(\?)sid=[a-z0-9]+(&|&)?/', '\1', $url); 1068 } 1069 else if (strpos($url, '&sid=') !== false) 1070 { 1071 $url = preg_replace('/&sid=[a-z0-9]+(&)?/', '\1', $url); 1072 } 1073 else if (strpos($url, '&sid=') !== false) 1074 { 1075 $url = preg_replace('/&sid=[a-z0-9]+(&)?/', '\1', $url); 1076 } 1077 1078 return append_sid($url); 1079 } 1080 1081 /** 1082 * Returns url from the session/current page with an re-appended SID with optionally stripping vars from the url 1083 */ 1084 function build_url($strip_vars = false) 1085 { 1086 global $tracker_root_path; 1087 1088 // Append SID 1089 $current_page = extract_current_page(); 1090 $redirect = append_sid($current_page['page'], false, false); 1091 1092 // Add delimiter if not there... 1093 if (strpos($redirect, '?') === false) 1094 { 1095 $redirect .= '?'; 1096 } 1097 1098 // Strip vars... 1099 if ($strip_vars !== false && strpos($redirect, '?') !== false) 1100 { 1101 if (!is_array($strip_vars)) 1102 { 1103 $strip_vars = array($strip_vars); 1104 } 1105 1106 $query = $_query = array(); 1107 1108 $args = substr($redirect, strpos($redirect, '?') + 1); 1109 $args = ($args) ? explode('&', $args) : array(); 1110 $redirect = substr($redirect, 0, strpos($redirect, '?')); 1111 1112 foreach ($args as $argument) 1113 { 1114 $arguments = explode('=', $argument); 1115 $key = $arguments[0]; 1116 unset($arguments[0]); 1117 1118 $query[$key] = implode('=', $arguments); 1119 } 1120 1121 // Strip the vars off 1122 foreach ($strip_vars as $strip) 1123 { 1124 if (isset($query[$strip])) 1125 { 1126 unset($query[$strip]); 1127 } 1128 } 1129 1130 // Glue the remaining parts together... already urlencoded 1131 foreach ($query as $key => $value) 1132 { 1133 $_query[] = $key . '=' . $value; 1134 } 1135 $query = implode('&', $_query); 1136 1137 $redirect .= ($query) ? '?' . $query : ''; 1138 } 1139 1140 return $tracker_root_path . str_replace('&', '&', $redirect); 1141 } 1142 1143 // 1144 // Create date/time from format and timezone 1145 // 1146 function create_date($format, $gmepoch, $tz) 1147 { 1148 global $config, $lang, $userdata; 1149 static $translate; 1150 // [start] DST 1151 if ( ($userdata['uid'] != ANONYMOUS && $userdata['user_dst']) || ($userdata['uid'] == ANONYMOUS && $config['board_dst']) ) { 1152 $tz = $tz + date('I', $gmepoch); 1153 } 1154 // [end] DST 1155 1156 if ( empty($translate) && $config['default_lang'] != 'english' ) { 1157 @reset($lang['datetime']); 1158 foreach ( $lang['datetime'] AS $match => $replace ) { 1159 $translate[$match] = $replace; 1160 } 1161 } 1162 1163 return ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz)), $translate) : @gmdate($format, $gmepoch + (3600 * $tz)); 1164 } 1165 1048 1166 ?> offers.php
r152 r154 13 13 14 14 $action = request_var('action', ''); 15 $min_class_allow_upload = ( check_user_class($config['min_class_allow_upload']) ? $config['min_class_allow_upload'] : UC_UPLOADER );16 15 17 16 if ( isset($_GET['id']) && !$action ) { … … 131 130 132 131 case 'filled': 133 if ( $userdata['class'] < $ min_class_allow_upload) {132 if ( $userdata['class'] < $config['min_class_allow_upload'] ) { 134 133 trigger_error($lang['access_denied']); 135 134 } … … 288 287 } 289 288 290 if ( !$row['filled'] && ($userdata['class'] >= $ min_class_allow_upload)) {289 if ( !$row['filled'] && ($userdata['class'] >= $config['min_class_allow_upload'] )) { 291 290 $template->assign_block_vars('switch_fill_offer', array()); 292 291 } … … 476 475 $template->assign_vars(array( 477 476 'S_FORM_ACTION' => append_sid('offers.php'), 478 'U_DO_OFFER' => ( $userdata['class'] > $ min_class_allow_upload? append_sid('upload.php?type=offer') : '' ),477 'U_DO_OFFER' => ( $userdata['class'] > $config['min_class_allow_upload'] ? append_sid('upload.php?type=offer') : '' ), 479 478 'U_MY_OFFERS' => append_sid('offers.php?oid=' . $userdata['uid']), 480 479 'USER_ID' => $userdata['uid'], requests.php
r152 r154 13 13 14 14 $action = request_var('action', ''); 15 $min_class_allow_upload = ( check_user_class($config['min_class_allow_upload']) ? $config['min_class_allow_upload'] : UC_UPLOADER );16 15 17 16 if ( isset($_GET['id']) && !$action ) { … … 142 141 143 142 case 'filled': 144 if ( $userdata['class'] < $ min_class_allow_upload) {143 if ( $userdata['class'] < $config['min_class_allow_upload'] ) { 145 144 trigger_error($lang['access_denied']); 146 145 } … … 301 300 $template->assign_block_vars('switch_vote_section', array()); 302 301 } 303 if ( !$row['filled'] && ($userdata['class'] >= $ min_class_allow_upload)) {302 if ( !$row['filled'] && ($userdata['class'] >= $config['min_class_allow_upload'] )) { 304 303 $template->assign_block_vars('switch_fill_request', array()); 305 304 } upload.php
r148 r154 18 18 $cats = genrelist(); 19 19 20 $min_class_allow_upload = ( check_user_class($config['min_class_allow_upload']) ? $config['min_class_allow_upload'] : UC_UPLOADER ); 20 if ( !check_user_class($config['min_class_allow_upload']) ) { 21 set_config('min_class_allow_upload', UC_UPLOADER); 22 $min_class_allow_upload = UC_UPLOADER; 23 } 24 else { 25 $min_class_allow_upload = $config['min_class_allow_upload']; 26 } 21 27 22 28 switch ( $type ) {
