[ Index ] |
PHP Cross Reference of MyBB |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * MyBB 1.6 4 * Copyright 2010 MyBB Group, All Rights Reserved 5 * 6 * Website: http://mybb.com 7 * License: http://mybb.com/about/license 8 * 9 * $Id$ 10 */ 11 12 // Disallow direct access to this file for security reasons 13 if(!defined("IN_MYBB")) 14 { 15 die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined."); 16 } 17 18 $page->add_breadcrumb_item($lang->system_health, "index.php?module=tools-system_health"); 19 20 $sub_tabs['system_health'] = array( 21 'title' => $lang->system_health, 22 'link' => "index.php?module=tools-system_health", 23 'description' => $lang->system_health_desc 24 ); 25 26 $sub_tabs['utf8_conversion'] = array( 27 'title' => $lang->utf8_conversion, 28 'link' => "index.php?module=tools-system_health&action=utf8_conversion", 29 'description' => $lang->utf8_conversion_desc2 30 ); 31 32 $sub_tabs['template_check'] = array( 33 'title' => $lang->check_templates, 34 'link' => "index.php?module=tools-system_health&action=check_templates", 35 'description' => $lang->check_templates_desc 36 ); 37 38 $plugins->run_hooks("admin_tools_system_health_begin"); 39 40 if($mybb->input['action'] == "do_check_templates" && $mybb->request_method == "post") 41 { 42 $plugins->run_hooks("admin_tools_system_health_template_do_check_start"); 43 44 $query = $db->simple_select("templates", "*", "", array("order_by" => "sid, title", "order_dir" => "ASC")); 45 46 if(!$db->num_rows($query)) 47 { 48 flash_message($lang->error_invalid_input, 'error'); 49 admin_redirect("index.php?module=tools-system_health"); 50 } 51 52 $t_cache = array(); 53 while($template = $db->fetch_array($query)) 54 { 55 if(check_template($template['template']) == true) 56 { 57 $t_cache[$template['sid']][] = $template; 58 } 59 } 60 61 if(empty($t_cache)) 62 { 63 flash_message($lang->success_templates_checked, 'success'); 64 admin_redirect("index.php?module=tools-system_health"); 65 } 66 67 $plugins->run_hooks("admin_tools_system_health_template_do_check"); 68 69 $page->add_breadcrumb_item($lang->check_templates); 70 $page->output_header($lang->check_templates); 71 72 $page->output_nav_tabs($sub_tabs, 'template_check'); 73 $page->output_inline_error(array($lang->check_templates_info_desc)); 74 75 $templatesets = array( 76 -2 => array( 77 "title" => "MyBB Master Templates" 78 ) 79 ); 80 $query = $db->simple_select("templatesets", "*"); 81 while($set = $db->fetch_array($query)) 82 { 83 $templatesets[$set['sid']] = $set; 84 } 85 86 $count = 0; 87 foreach($t_cache as $sid => $templates) 88 { 89 if(!$done_set[$sid]) 90 { 91 $table = new Table(); 92 $table->construct_header($templatesets[$sid]['title'], array("colspan" => 2)); 93 94 $done_set[$sid] = 1; 95 ++$count; 96 } 97 98 if($sid == -2) 99 { 100 // Some cheeky clown has altered the master templates! 101 $table->construct_cell($lang->error_master_templates_altered, array("colspan" => 2)); 102 $table->construct_row(); 103 } 104 105 foreach($templates as $template) 106 { 107 if($sid == -2) 108 { 109 $table->construct_cell($template['title'], array('colspan' => 2)); 110 } 111 else 112 { 113 $popup = new PopupMenu("template_{$template['tid']}", $lang->options); 114 $popup->add_item($lang->full_edit, "index.php?module=style-templates&action=edit_template&title=".urlencode($template['title'])."&sid={$sid}"); 115 116 $table->construct_cell("<a href=\"index.php?module=style-templates&action=edit_template&title=".urlencode($template['title'])."&sid={$sid}&from=diff_report\">{$template['title']}</a>", array('width' => '80%')); 117 $table->construct_cell($popup->fetch(), array("class" => "align_center")); 118 } 119 120 $table->construct_row(); 121 } 122 123 if($done_set[$sid] && !$done_output[$sid]) 124 { 125 $done_output[$sid] = 1; 126 if($count == 1) 127 { 128 $table->output($lang->check_templates); 129 } 130 else 131 { 132 $table->output(); 133 } 134 } 135 } 136 137 $page->output_footer(); 138 } 139 140 if($mybb->input['action'] == "check_templates") 141 { 142 $plugins->run_hooks("admin_tools_system_health_template_check"); 143 144 $page->add_breadcrumb_item($lang->check_templates); 145 $page->output_header($lang->check_templates); 146 147 $page->output_nav_tabs($sub_tabs, 'template_check'); 148 149 if($errors) 150 { 151 $page->output_inline_error($errors); 152 } 153 154 $form = new Form("index.php?module=tools-system_health", "post", "check_set"); 155 echo $form->generate_hidden_field("action", "do_check_templates"); 156 157 $form_container = new FormContainer($lang->check_templates); 158 $form_container->output_row($lang->check_templates_title, "", $lang->check_templates_info); 159 $form_container->end(); 160 161 $buttons = array(); 162 $buttons[] = $form->generate_submit_button($lang->proceed); 163 164 $form->output_submit_wrapper($buttons); 165 166 $form->end(); 167 168 $page->output_footer(); 169 } 170 171 if($mybb->input['action'] == "utf8_conversion") 172 { 173 $plugins->run_hooks("admin_tools_system_health_utf8_conversion"); 174 175 if($db->type == "sqlite" || $db->type == "pgsql") 176 { 177 flash_message($lang->error_not_supported, 'error'); 178 admin_redirect("index.php?module=tools-system_health"); 179 } 180 181 if($mybb->request_method == "post" || ($mybb->input['do'] == "all" && !empty($mybb->input['table']))) 182 { 183 @set_time_limit(0); 184 185 $old_table_prefix = $db->table_prefix; 186 $db->set_table_prefix(''); 187 188 if(!$db->table_exists($db->escape_string($mybb->input['table']))) 189 { 190 flash_message($lang->error_invalid_table, 'error'); 191 admin_redirect("index.php?module=tools-system_health&action=utf8_conversion"); 192 } 193 194 $db->set_table_prefix($old_table_prefix); 195 196 $page->add_breadcrumb_item($lang->utf8_conversion, "index.php?module=tools-system_health&action=utf8_conversion"); 197 198 $page->output_header($lang->system_health." - ".$lang->utf8_conversion); 199 200 $sub_tabs['system_health'] = array( 201 'title' => $lang->system_health, 202 'link' => "index.php?module=tools-system_health", 203 'description' => $lang->system_health_desc 204 ); 205 206 $sub_tabs['utf8_conversion'] = array( 207 'title' => $lang->utf8_conversion, 208 'link' => "index.php?module=tools-system_health&action=utf8_conversion", 209 'description' => $lang->utf8_conversion_desc2 210 ); 211 212 $page->output_nav_tabs($sub_tabs, 'utf8_conversion'); 213 214 $old_table_prefix = $db->table_prefix; 215 $db->set_table_prefix(''); 216 217 $table = new Table; 218 219 $table1 = $db->show_create_table($db->escape_string($mybb->input['table'])); 220 preg_match("#CHARSET=([a-zA-Z0-9_]+)\s?#i", $table1, $matches); 221 $charset = $matches[1]; 222 223 $table->construct_cell("<strong>".$lang->sprintf($lang->converting_to_utf8, $mybb->input['table'], $charset)."</strong>"); 224 $table->construct_row(); 225 226 $table->construct_cell($lang->please_wait); 227 $table->construct_row(); 228 229 $table->output($converting_table." {$mybb->input['table']}"); 230 231 $db->set_table_prefix($old_table_prefix); 232 233 $page->output_footer(false); 234 235 $old_table_prefix = $db->table_prefix; 236 $db->set_table_prefix(''); 237 238 flush(); 239 240 $types = array( 241 'text' => 'blob', 242 'mediumtext' => 'mediumblob', 243 'longtext' => 'longblob', 244 'char' => 'varbinary', 245 'varchar' => 'varbinary', 246 'tinytext' => 'tinyblob' 247 ); 248 249 $blob_types = array( 'blob', 'tinyblob', 'mediumblog', 'longblob', 'text', 'tinytext', 'mediumtext', 'longtext' ); 250 251 // Get next table in list 252 $convert_to_binary = ''; 253 $convert_to_utf8 = ''; 254 $comma = ''; 255 256 // Set table default charset 257 $db->write_query("ALTER TABLE {$mybb->input['table']} DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci"); 258 259 // Fetch any fulltext keys 260 if($db->supports_fulltext($mybb->input['table'])) 261 { 262 $table_structure = $db->show_create_table($mybb->input['table']); 263 switch($db->type) 264 { 265 case "mysql": 266 case "mysqli": 267 preg_match_all("#FULLTEXT KEY `?([a-zA-Z0-9_]+)`? \(([a-zA-Z0-9_`,']+)\)#i", $table_structure, $matches); 268 if(is_array($matches)) 269 { 270 foreach($matches[0] as $key => $matched) 271 { 272 $db->write_query("ALTER TABLE {$mybb->input['table']} DROP INDEX {$matches[1][$key]}"); 273 $fulltext_to_create[$matches[1][$key]] = $matches[2][$key]; 274 } 275 } 276 } 277 } 278 279 // Find out which columns need converting and build SQL statements 280 $query = $db->query("SHOW FULL COLUMNS FROM {$mybb->input['table']}"); 281 while($column = $db->fetch_array($query)) 282 { 283 list($type) = explode('(', $column['Type']); 284 if(array_key_exists($type, $types)) 285 { 286 // Build the actual strings for converting the columns 287 $names = "CHANGE `{$column['Field']}` `{$column['Field']}` "; 288 289 if(($db->type == 'mysql' || $db->type == 'mysqli') && in_array($type, $blob_types)) 290 { 291 if($column['Null'] == 'YES') 292 { 293 $attributes = 'NULL'; 294 } 295 else 296 { 297 $attributes = 'NOT NULL'; 298 } 299 } 300 else 301 { 302 $attributes = " DEFAULT "; 303 if($column['Default'] == 'NULL') 304 { 305 $attributes .= "NULL "; 306 } 307 else 308 { 309 $attributes .= "'".$db->escape_string($column['Default'])."' "; 310 311 if($column['Null'] == 'YES') 312 { 313 $attributes .= 'NULL'; 314 } 315 else 316 { 317 $attributes .= 'NOT NULL'; 318 } 319 } 320 } 321 322 $convert_to_binary .= $comma.$names.preg_replace('/'.$type.'/i', $types[$type], $column['Type']).' '.$attributes; 323 $convert_to_utf8 .= "{$comma}{$names}{$column['Type']} CHARACTER SET utf8 COLLATE utf8_general_ci {$attributes}"; 324 325 $comma = $lang->comma; 326 } 327 } 328 329 if(!empty($convert_to_binary)) 330 { 331 // This converts the columns to UTF-8 while also doing the same for data 332 $db->write_query("ALTER TABLE {$mybb->input['table']} {$convert_to_binary}"); 333 $db->write_query("ALTER TABLE {$mybb->input['table']} {$convert_to_utf8}"); 334 } 335 336 // Any fulltext indexes to recreate? 337 if(is_array($fulltext_to_create)) 338 { 339 foreach($fulltext_to_create as $name => $fields) 340 { 341 $db->create_fulltext_index($mybb->input['table'], $fields, $name); 342 } 343 } 344 345 $db->set_table_prefix($old_table_prefix); 346 347 $plugins->run_hooks("admin_tools_system_health_utf8_conversion_commit"); 348 349 // Log admin action 350 log_admin_action($mybb->input['table']); 351 352 flash_message($lang->sprintf($lang->success_table_converted, $mybb->input['table']), 'success'); 353 354 if($mybb->input['do'] == "all") 355 { 356 $old_table_prefix = $db->table_prefix; 357 $db->set_table_prefix(''); 358 359 $tables = $db->list_tables($mybb->config['database']['database']); 360 foreach($tables as $key => $tablename) 361 { 362 if(substr($tablename, 0, strlen(TABLE_PREFIX)) == TABLE_PREFIX) 363 { 364 $table = $db->show_create_table($tablename); 365 preg_match("#CHARSET=([a-zA-Z0-9_]+)\s?#i", $table, $matches); 366 if(fetch_iconv_encoding($matches[1]) == 'utf-8' && $mybb->input['table'] != $tablename) 367 { 368 continue; 369 } 370 371 $mybb_tables[$key] = $tablename; 372 } 373 } 374 375 asort($mybb_tables); 376 reset($mybb_tables); 377 378 $is_next = false; 379 $nexttable = ""; 380 381 foreach($mybb_tables as $key => $tablename) 382 { 383 if($is_next == true) 384 { 385 $nexttable = $tablename; 386 break; 387 } 388 else if($mybb->input['table'] == $tablename) 389 { 390 $is_next = true; 391 } 392 } 393 394 $db->set_table_prefix($old_table_prefix); 395 396 if($nexttable) 397 { 398 $nexttable = $db->escape_string($nexttable); 399 admin_redirect("index.php?module=tools-system_health&action=utf8_conversion&do=all&table={$nexttable}"); 400 exit; 401 } 402 } 403 404 admin_redirect("index.php?module=tools-system_health&action=utf8_conversion"); 405 406 exit; 407 } 408 409 if($mybb->input['table'] || $mybb->input['do'] == "all") 410 { 411 $old_table_prefix = $db->table_prefix; 412 $db->set_table_prefix(''); 413 414 if($mybb->input['do'] != "all" && !$db->table_exists($db->escape_string($mybb->input['table']))) 415 { 416 $db->set_table_prefix($old_table_prefix); 417 flash_message($lang->error_invalid_table, 'error'); 418 admin_redirect("index.php?module=tools-system_health&action=utf8_conversion"); 419 } 420 421 if($mybb->input['do'] == "all") 422 { 423 $tables = $db->list_tables($mybb->config['database']['database']); 424 foreach($tables as $key => $tablename) 425 { 426 if(substr($tablename, 0, strlen(TABLE_PREFIX)) == TABLE_PREFIX) 427 { 428 $table = $db->show_create_table($tablename); 429 preg_match("#CHARSET=([a-zA-Z0-9_]+)\s?#i", $table, $matches); 430 if(fetch_iconv_encoding($matches[1]) == 'utf-8') 431 { 432 continue; 433 } 434 $mybb_tables[$key] = $tablename; 435 } 436 } 437 438 if(is_array($mybb_tables)) 439 { 440 asort($mybb_tables); 441 reset($mybb_tables); 442 $nexttable = current($mybb_tables); 443 $table = $db->show_create_table($db->escape_string($nexttable)); 444 $mybb->input['table'] = $nexttable; 445 } 446 else 447 { 448 flash_message($lang->success_all_tables_already_converted, 'success'); 449 admin_redirect("index.php?module=tools-system_health"); 450 } 451 } 452 else 453 { 454 $table = $db->show_create_table($db->escape_string($mybb->input['table'])); 455 } 456 457 $page->add_breadcrumb_item($lang->utf8_conversion, "index.php?module=tools-system_health&action=utf8_conversion"); 458 459 $db->set_table_prefix($old_table_prefix); 460 461 $page->output_header($lang->system_health." - ".$lang->utf8_conversion); 462 463 $sub_tabs['system_health'] = array( 464 'title' => $lang->system_health, 465 'link' => "index.php?module=tools-system_health", 466 'description' => $lang->system_health_desc 467 ); 468 469 $sub_tabs['utf8_conversion'] = array( 470 'title' => $lang->utf8_conversion, 471 'link' => "index.php?module=tools-system_health&action=utf8_conversion", 472 'description' => $lang->utf8_conversion_desc2 473 ); 474 475 $page->output_nav_tabs($sub_tabs, 'utf8_conversion'); 476 477 $old_table_prefix = $db->table_prefix; 478 $db->set_table_prefix(''); 479 480 preg_match("#CHARSET=([a-zA-Z0-9_]+)\s?#i", $table, $matches); 481 $charset = $matches[1]; 482 483 $form = new Form("index.php?module=tools-system_health&action=utf8_conversion", "post", "utf8_conversion"); 484 echo $form->generate_hidden_field("table", $mybb->input['table']); 485 486 if($mybb->input['do'] == "all") 487 { 488 echo $form->generate_hidden_field("do", "all"); 489 } 490 491 $table = new Table; 492 493 if($mybb->input['do'] == "all") 494 { 495 $table->construct_cell("<strong>".$lang->sprintf($lang->convert_all_to_utf, $charset)."</strong>"); 496 } 497 else 498 { 499 $table->construct_cell("<strong>".$lang->sprintf($lang->convert_to_utf8, $mybb->input['table'], $charset)."</strong>"); 500 } 501 502 $table->construct_row(); 503 504 $table->construct_cell($lang->notice_process_long_time); 505 $table->construct_row(); 506 507 if($mybb->input['do'] == "all") 508 { 509 $table->output($lang->convert_tables); 510 $buttons[] = $form->generate_submit_button($lang->convert_database_tables); 511 } 512 else 513 { 514 $table->output($lang->convert_table.": {$mybb->input['table']}"); 515 $buttons[] = $form->generate_submit_button($lang->convert_database_table); 516 } 517 518 $form->output_submit_wrapper($buttons); 519 520 $form->end(); 521 522 $db->set_table_prefix($old_table_prefix); 523 524 $page->output_footer(); 525 526 exit; 527 } 528 529 $tables = $db->list_tables($mybb->config['database']['database']); 530 531 $old_table_prefix = $db->table_prefix; 532 $db->set_table_prefix(''); 533 534 $not_okey_count = 0; 535 $not_okey = array(); 536 $okey_count = 0; 537 538 foreach($tables as $key => $tablename) 539 { 540 if(substr($tablename, 0, strlen($old_table_prefix)) == $old_table_prefix) 541 { 542 $table = $db->show_create_table($tablename); 543 preg_match("#CHARSET=([a-zA-Z0-9_]+)\s?#i", $table, $matches); 544 if(fetch_iconv_encoding($matches[1]) != 'utf-8') 545 { 546 $not_okey[$key] = $tablename; 547 ++$not_okey_count; 548 } 549 else 550 { 551 ++$okay_count; 552 } 553 554 $mybb_tables[$key] = $tablename; 555 } 556 } 557 558 $db->set_table_prefix($old_table_prefix); 559 560 if($okay_count == count($mybb_tables)) 561 { 562 flash_message($lang->success_all_tables_already_converted, 'success'); 563 admin_redirect("index.php?module=tools-system_health"); 564 } 565 566 if(!$mybb->config['database']['encoding']) 567 { 568 flash_message($lang->error_db_encoding_not_set, 'error'); 569 admin_redirect("index.php?module=tools-system_health"); 570 } 571 572 $page->add_breadcrumb_item($lang->utf8_conversion, "index.php?module=tools-system_health&action=utf8_conversion"); 573 574 $page->output_header($lang->system_health." - ".$lang->utf8_conversion); 575 576 $page->output_nav_tabs($sub_tabs, 'utf8_conversion'); 577 578 asort($mybb_tables); 579 580 $table = new Table; 581 $table->construct_header($lang->table); 582 $table->construct_header($lang->status, array("class" => "align_center")); 583 584 foreach($mybb_tables as $key => $tablename) 585 { 586 if(array_key_exists($key, $not_okey)) 587 { 588 $status = "<a href=\"index.php?module=tools-system_health&action=utf8_conversion&table={$tablename}\" style=\"background: url(styles/{$page->style}/images/icons/cross.gif) no-repeat; padding-left: 20px;\">{$lang->convert_now}</a>"; 589 } 590 else 591 { 592 $status = "<img src=\"styles/{$page->style}/images/icons/tick.gif\" alt=\"{$lang->ok}\" />"; 593 } 594 $table->construct_cell("<strong>{$tablename}</strong>"); 595 $table->construct_cell($status, array("class" => "align_center", 'width' => '15%')); 596 $table->construct_row(); 597 } 598 599 $table->output("<div style=\"float: right; text-decoration: underline\"><small><a href=\"index.php?module=tools-system_health&action=utf8_conversion&do=all\">({$lang->convert_all})</a></small></div><div>{$lang->utf8_conversion}</div>"); 600 601 $page->output_footer(); 602 } 603 604 if(!$mybb->input['action']) 605 { 606 $plugins->run_hooks("admin_tools_system_health_start"); 607 608 $page->output_header($lang->system_health); 609 610 $page->output_nav_tabs($sub_tabs, 'system_health'); 611 612 $table = new Table; 613 $table->construct_header($lang->totals, array("colspan" => 2)); 614 $table->construct_header($lang->attachments, array("colspan" => 2)); 615 616 $query = $db->simple_select("attachments", "COUNT(*) AS numattachs, SUM(filesize) as spaceused, SUM(downloads*filesize) as bandwidthused", "visible='1' AND pid > '0'"); 617 $attachs = $db->fetch_array($query); 618 619 $table->construct_cell("<strong>{$lang->total_database_size}</strong>", array('width' => '25%')); 620 $table->construct_cell(get_friendly_size($db->fetch_size()), array('width' => '25%')); 621 $table->construct_cell("<strong>{$lang->attachment_space_used}</strong>", array('width' => '200')); 622 $table->construct_cell(get_friendly_size(intval($attachs['spaceused'])), array('width' => '200')); 623 $table->construct_row(); 624 625 if($attachs['spaceused'] > 0) 626 { 627 $attach_average_size = round($attachs['spaceused']/$attachs['numattachs']); 628 $bandwidth_average_usage = round($attachs['bandwidthused']); 629 } 630 else 631 { 632 $attach_average_size = 0; 633 $bandwidth_average_usage = 0; 634 } 635 636 $table->construct_cell("<strong>{$lang->total_cache_size}</strong>", array('width' => '25%')); 637 $table->construct_cell(get_friendly_size($cache->size_of()), array('width' => '25%')); 638 $table->construct_cell("<strong>{$lang->estimated_attachment_bandwidth_usage}</strong>", array('width' => '25%')); 639 $table->construct_cell(get_friendly_size($bandwidth_average_usage), array('width' => '25%')); 640 $table->construct_row(); 641 642 643 $table->construct_cell("<strong>{$lang->max_upload_post_size}</strong>", array('width' => '200')); 644 $table->construct_cell(@ini_get('upload_max_filesize').' / '.@ini_get('post_max_size'), array('width' => '200')); 645 $table->construct_cell("<strong>{$lang->average_attachment_size}</strong>", array('width' => '25%')); 646 $table->construct_cell(get_friendly_size($attach_average_size), array('width' => '25%')); 647 $table->construct_row(); 648 649 $table->output($lang->stats); 650 651 $table->construct_header($lang->task); 652 $table->construct_header($lang->run_time, array("width" => 200, "class" => "align_center")); 653 654 $task_cache = $cache->read("tasks"); 655 $nextrun = $task_cache['nextrun']; 656 657 $query = $db->simple_select("tasks", "*", "nextrun >= '{$nextrun}' AND enabled='1'", array("order_by" => "nextrun", "order_dir" => "asc", 'limit' => 3)); 658 while($task = $db->fetch_array($query)) 659 { 660 $task['title'] = htmlspecialchars_uni($task['title']); 661 $next_run = date($mybb->settings['dateformat'], $task['nextrun']).", ".date($mybb->settings['timeformat'], $task['nextrun']); 662 $table->construct_cell("<strong>{$task['title']}</strong>"); 663 $table->construct_cell($next_run, array("class" => "align_center")); 664 665 $table->construct_row(); 666 } 667 668 $table->output($lang->next_3_tasks); 669 670 if(isset($mybb->admin['permissions']['tools']['backupdb']) && $mybb->admin['permissions']['tools']['backupdb'] == 1) 671 { 672 $backups = array(); 673 $dir = MYBB_ADMIN_DIR.'backups/'; 674 $handle = opendir($dir); 675 while(($file = readdir($handle)) !== false) 676 { 677 if(filetype(MYBB_ADMIN_DIR.'backups/'.$file) == 'file') 678 { 679 $ext = get_extension($file); 680 if($ext == 'gz' || $ext == 'sql') 681 { 682 $backups[@filemtime(MYBB_ADMIN_DIR.'backups/'.$file)] = array( 683 "file" => $file, 684 "time" => @filemtime(MYBB_ADMIN_DIR.'backups/'.$file), 685 "type" => $ext 686 ); 687 } 688 } 689 } 690 691 $count = count($backups); 692 krsort($backups); 693 694 $table = new Table; 695 $table->construct_header($lang->name); 696 $table->construct_header($lang->backup_time, array("width" => 200, "class" => "align_center")); 697 698 $backupscnt = 0; 699 foreach($backups as $backup) 700 { 701 ++$backupscnt; 702 703 if($backupscnt == 4) 704 { 705 break; 706 } 707 708 if($backup['time']) 709 { 710 $time = my_date($mybb->settings['dateformat'].", ".$mybb->settings['timeformat'], $backup['time']); 711 } 712 else 713 { 714 $time = "-"; 715 } 716 717 $table->construct_cell("<a href=\"index.php?module=tools-backupdb&action=dlbackup&file={$backup['file']}\">{$backup['file']}</a>"); 718 $table->construct_cell($time, array("class" => "align_center")); 719 $table->construct_row(); 720 } 721 722 if($count == 0) 723 { 724 $table->construct_cell($lang->no_backups, array('colspan' => 2)); 725 $table->construct_row(); 726 } 727 728 729 $table->output($lang->existing_db_backups); 730 } 731 732 if(is_writable(MYBB_ROOT.'inc/settings.php')) 733 { 734 $message_settings = "<span style=\"color: green;\">{$lang->writable}</span>"; 735 } 736 else 737 { 738 $message_settings = "<strong><span style=\"color: #C00\">{$lang->not_writable}</span></strong><br />{$lang->please_chmod_777}"; 739 ++$errors; 740 } 741 742 if(is_writable(MYBB_ROOT.'inc/config.php')) 743 { 744 $message_config = "<span style=\"color: green;\">{$lang->writable}</span>"; 745 } 746 else 747 { 748 $message_config = "<strong><span style=\"color: #C00\">{$lang->not_writable}</span></strong><br />{$lang->please_chmod_777}"; 749 ++$errors; 750 } 751 752 if(is_writable('.'.$mybb->settings['uploadspath'])) 753 { 754 $message_upload = "<span style=\"color: green;\">{$lang->writable}</span>"; 755 } 756 else 757 { 758 $message_upload = "<strong><span style=\"color: #C00\">{$lang->not_writable}</span></strong><br />{$lang->please_chmod_777}"; 759 ++$errors; 760 } 761 762 if(is_writable('../'.$mybb->settings['avataruploadpath'])) 763 { 764 $message_avatar = "<span style=\"color: green;\">{$lang->writable}</span>"; 765 } 766 else 767 { 768 $message_avatar = "<strong><span style=\"color: #C00\">{$lang->not_writable}</span></strong><br />{$lang->please_chmod_777}"; 769 ++$errors; 770 } 771 772 if(is_writable(MYBB_ROOT.'inc/languages/')) 773 { 774 $message_language = "<span style=\"color: green;\">{$lang->writable}</span>"; 775 } 776 else 777 { 778 $message_language = "<strong><span style=\"color: #C00\">{$lang->not_writable}</span></strong><br />{$lang->please_chmod_777}"; 779 ++$errors; 780 } 781 782 if(is_writable(MYBB_ROOT.$config['admin_dir'].'/backups/')) 783 { 784 $message_backup = "<span style=\"color: green;\">{$lang->writable}</span>"; 785 } 786 else 787 { 788 $message_backup = "<strong><span style=\"color: #C00\">{$lang->not_writable}</span></strong><br />{$lang->please_chmod_777}"; 789 ++$errors; 790 } 791 792 if(is_writable(MYBB_ROOT.'/cache/')) 793 { 794 $message_cache = "<span style=\"color: green;\">{$lang->writable}</span>"; 795 } 796 else 797 { 798 $message_cache = "<strong><span style=\"color: #C00\">{$lang->not_writable}</span></strong><br />{$lang->please_chmod_777}"; 799 ++$errors; 800 } 801 802 if(is_writable(MYBB_ROOT.'/cache/themes/')) 803 { 804 $message_themes = "<span style=\"color: green;\">{$lang->writable}</span>"; 805 } 806 else 807 { 808 $message_themes = "<strong><span style=\"color: #C00\">{$lang->not_writable}</span></strong><br />{$lang->please_chmod_777}"; 809 ++$errors; 810 } 811 812 813 if($errors) 814 { 815 $page->output_error("<p><em>{$errors} {$lang->error_chmod}</span></strong> {$lang->chmod_info} <a href=\"http://docs.mybb.com/HowTo_Chmod.html\" target=\"_blank\">MyBB Docs</a>.</em></p>"); 816 } 817 else 818 { 819 $page->output_success("<p><em>{$lang->success_chmod}</em></p>"); 820 } 821 822 $table = new Table; 823 $table->construct_header($lang->file); 824 $table->construct_header($lang->location, array("colspan" => 2, 'width' => 250)); 825 826 $table->construct_cell("<strong>{$lang->config_file}</strong>"); 827 $table->construct_cell("./inc/config.php"); 828 $table->construct_cell($message_config); 829 $table->construct_row(); 830 831 $table->construct_cell("<strong>{$lang->settings_file}</strong>"); 832 $table->construct_cell("./inc/settings.php"); 833 $table->construct_cell($message_settings); 834 $table->construct_row(); 835 836 $table->construct_cell("<strong>{$lang->file_upload_dir}</strong>"); 837 $table->construct_cell($mybb->settings['uploadspath']); 838 $table->construct_cell($message_upload); 839 $table->construct_row(); 840 841 $table->construct_cell("<strong>{$lang->avatar_upload_dir}</strong>"); 842 $table->construct_cell($mybb->settings['avataruploadpath']); 843 $table->construct_cell($message_avatar); 844 $table->construct_row(); 845 846 $table->construct_cell("<strong>{$lang->language_files}</strong>"); 847 $table->construct_cell("./inc/languages"); 848 $table->construct_cell($message_language); 849 $table->construct_row(); 850 851 $table->construct_cell("<strong>{$lang->backup_dir}</strong>"); 852 $table->construct_cell('./'.$config['admin_dir'].'/backups'); 853 $table->construct_cell($message_backup); 854 $table->construct_row(); 855 856 $table->construct_cell("<strong>{$lang->cache_dir}</strong>"); 857 $table->construct_cell('./cache'); 858 $table->construct_cell($message_cache); 859 $table->construct_row(); 860 861 $table->construct_cell("<strong>{$lang->themes_dir}</strong>"); 862 $table->construct_cell('./cache/themes'); 863 $table->construct_cell($message_themes); 864 $table->construct_row(); 865 866 $table->output($lang->chmod_files_and_dirs); 867 868 $page->output_footer(); 869 } 870 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Oct 8 19:19:50 2013 | Cross-referenced by PHPXref 0.7.1 |