⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 upgrade2.php

📁 软件类别: PHP源码 / 文章管理 软件语言: 简体中文 授权方式: 商业版 文件大小: 308K
💻 PHP
字号:
<?phperror_reporting(7);require("includes/getglobals.php");$oldversion = "1.0.1 Pro";$newversion = "1.0.2 Pro";if (function_exists("set_time_limit") == 1) {  @set_time_limit(1200);}settype($step,"integer");if (!$step) {  $step = 1;}function undoescapetext($string="") {  $string = str_replace("||| ||","|||||",$string);  $string = substr($string,1,-1);  return $string;}include("admin/config.php");include("includes/db_$dbservertype.php");$db = vn_connect();?><html><head><title>Upgrade VirtuaNews[WDYL-WTN] From <?php echo $oldversion?> To <?php echo $newversion?></title><link rel="StyleSheet" href="admin/style.css" type="text/css"></head><body><table cellspacing="0" cellpadding="2" class="header">  <tr>    <td class="header">Welcome to the VirtuaNews upgrade process</td>  </tr></table><table cellpadding="2" cellspacing="0" class="main"><?if ($step == "1") {  echo "  <tr>\n    <td>Running this upgrade script will upgrade you previous version of VirtuaNews $oldversion to VirtuaNews $newversion.  If you do not have the old version installed you should exit this script immediatly.</td>\n  </tr>\n";  echo "  <tr>\n    <td>Click <a href=\"upgrade2.php?step=2\">here</a> to start the upgrade process</td>\n  </tr>\n";}if ($step == 2) {  query("UPDATE news_option SET value = '$newversion' WHERE varname = 'version'");  query("CREATE TABLE news_referer (    name varchar(255) NOT NULL default '',    value int(10) unsigned NOT NULL default '0',    PRIMARY KEY  (name))");  query("CREATE TABLE news_stats (    lastupdate int(10) unsigned NOT NULL default '0',    uniquestotal int(10) unsigned NOT NULL default '0',    uniquestoday int(10) unsigned NOT NULL default '0',    maxusersonline int(10) unsigned NOT NULL default '0'  )");  $getstats = query("SELECT name,value FROM news_stat WHERE (name  = 'uniquestotal') OR (name = 'maxusersonline')");  while ($stats = fetch_array($getstats)) {    $varname = $stats[name];    $$varname = $stats[value];  }  $morntime = mktime(0,0,0,gmdate('m'),gmdate('d'),gmdate('Y'));  $morntime = $morntime;  $uniquestoday = query_first("SELECT COUNT(ip) AS count FROM news_hit WHERE time > $morntime");  $uniquestoday = $uniquestoday[count];  query("INSERT INTO news_stats VALUES ('" . time() . "','" . $uniquestotal . "','" . $uniquestoday . "','" . $maxusersonline . "')");  $getreferers = query("SELECT name,value FROM news_stat WHERE type = 'referer'");  while ($referer_arr = fetch_array($getreferers)) {    query("INSERT INTO news_referer VALUES ('" . mysql_escape_string($referer_arr[name]) . "','$referer_arr[value]')");  }  query("DELETE FROM news_stat WHERE (type != 'os') AND (type != 'browser')");  query("ALTER TABLE news_stat RENAME news_useragent");  query("ALTER TABLE news_useragent ADD KEY (name,type)");  query("ALTER TABLE news_hit ADD KEY (time,ip)");  query("ALTER TABLE news_news ADD KEY (program)");  query("ALTER TABLE news_news ADD KEY (catid)");  query("ALTER TABLE news_comment ADD KEY (newsid)");  query("ALTER TABLE news_staff ADD KEY (userid)");  echo "  <tr>\n    <td>Database upgrade complete........Updating default templates;</td>\n  </tr>\n";  if (!file_exists("admin/virtuanews.set")) {    echo "  <tr>\n    <td>Cannot find the template file.  Please ensure it is uploaded to admin/virtuanews.set  When you are sure it is uploaded correctly please refresh this page and continue</td>\n  </tr>\n";    echo "</body>\n</html>";    exit;  }  $filesize = @filesize("admin/virtuanews.set");  $fp = @fopen("admin/virtuanews.set","r");  $filecontent = @fread($fp,$filesize);  @fclose($fp);  if (trim($filecontent) == "") {    echo "  <tr>\n    <td>The template file is not the virtuanews master file, you must upload the master file and then refresh this page to continue.</td>\n  </tr>\n";    echo "</body>\n</html>";    exit;  }  $data_arr = explode("|||||",$filecontent);  unset($filecontent);  foreach ($data_arr AS $data) {    $count ++;    if ($count%2 == 1) {      $info[$data] = "";      $last_info = $data;    } else {      $info[$last_info] = $data;    }  }  unset($data_arr);  if (($info[' theme title'] == "!!MASTER!!") & ($info[' page set'] == "!!MASTER!!") & ($info[' style set'] == "!!MASTER!!")) {    $is_master = 1;  } else {    echo "  <tr>\n    <td>The template file is not the virtuanews master file, you must upload the master file and then refresh this page to continue.</td>\n  </tr>\n";    echo "</body>\n</html>";    exit;  }  $pagesetid = "-1";  $stylesetid = "-1";  unset($info[' version']);  unset($info[' theme title']);  unset($info[' style set']);  unset($info[' page set']);  foreach($info AS $title => $data) {    $data = undoescapetext($data);    if (substr($title,0,9) == " page !!!") {      $name = substr($title,9);      if ($name != "") {        if ($file = @fopen("pages/default/".$name.".vnp","w")) {          @fwrite($file,$data);          @$file = fclose($file);        } else {          $error = 1;        }      }    }  }  if ($error) {      echo "  <tr>\n    <td>There has been an error inserting one or more of the records.  Please examine this error and try and fix it</td>\n  </tr>\n";  } else {      echo "  <tr>\n    <td>All templates inserted correctly......Updating static files;</tr>\n";  }  $get_options = query("SELECT varname,value FROM news_option WHERE varname IN ('use_forum','forumpath','defaultcat_loggedout')");  while ($option_arr = fetch_array($get_options)) {    ${$option_arr[varname]} = $option_arr[value];  }  include("includes/functions.php");  if (!empty($use_forum)) {    include("includes/forum_".strtolower(trim($use_forum)).".php");  } else {    include("includes/forum_vn.php");  }  include("includes/adminfunctions.php");  include("includes/writefunctions.php");  saveoptions();  $cat_arr = getcat_arr();  $theme_arr = getthemearr();  $timeoffset = $timeoffset * 3600;  $defaultcategory = $defaultcat_loggedout;  $themeid = 1;  $pagesetid = 1;  writeallpages();  echo "  <tr>\n    <td>Upgrade complete.  Please ensure that you delete this file and the install.php file before you continue.</td>\n  </tr>\n";}?></table></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -