KEY slug (slug),
  KEY displayorder (displayorder)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS {$db_prefix}relationships;
CREATE TABLE {$db_prefix}relationships (
  cid mediumint(8) unsigned NOT NULL DEFAULT '0',
  mid mediumint(8) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (cid,mid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

EOT;
    //添加新表
    runquery($add);
    $query = $DB->query("SELECT cid, name, displayorder FROM {$db_prefix}categories");
    while ($cate = $DB->fetch_array($query)) {
        $DB->query("INSERT INTO {$db_prefix}metas (name, type, displayorder) VALUES ('" . addslashes($cate['name']) . "', 'category', '" . addslashes($cate['displayorder']) . "')");
        $mid = $DB->insert_id();
        $articles = $DB->query("SELECT articleid, visible FROM {$db_prefix}articles WHERE cid='" . $cate['cid'] . "'");
        while ($article = $DB->fetch_array($articles)) {
            $r = $DB->fetch_one_array("SELECT cid FROM {$db_prefix}relationships WHERE mid='{$mid}' LIMIT 1");
            if (!$r) {
                $DB->query("INSERT INTO {$db_prefix}relationships (cid,mid) VALUES ('" . $article['articleid'] . "', '{$mid}')");
            } else {
                if ($article['articleid'] != $r['cid']) {
                    $DB->query("INSERT INTO {$db_prefix}relationships (cid,mid) VALUES ('" . $article['articleid'] . "', '{$mid}')");
                }
            }
            if ($article['visible']) {
                $DB->unbuffered_query("UPDATE {$db_prefix}metas SET count=count+1 WHERE mid='{$mid}' AND type='category'");
            }
示例#2
0
// Connect to Database
define('TABLE_PREFIX', $config['database']['table_prefix']);
$db->connect($config['database']);
$db->set_table_prefix(TABLE_PREFIX);
$db->type = $config['database']['type'];
// Load Settings
if (file_exists(MYBB_ROOT . "inc/settings.php")) {
    require_once MYBB_ROOT . "inc/settings.php";
}
if (!file_exists(MYBB_ROOT . "inc/settings.php") || !$settings) {
    if (function_exists('rebuild_settings')) {
        rebuild_settings();
    } else {
        $options = array("order_by" => "title", "order_dir" => "ASC");
        $query = $db->simple_select("settings", "value, name", "", $options);
        while ($setting = $db->fetch_array($query)) {
            $setting['value'] = str_replace("\"", "\\\"", $setting['value']);
            $settings[$setting['name']] = $setting['value'];
        }
    }
}
$settings['wolcutoff'] = $settings['wolcutoffmins'] * 60;
$settings['bbname_orig'] = $settings['bbname'];
$settings['bbname'] = strip_tags($settings['bbname']);
// Fix for people who for some specify a trailing slash on the board URL
if (substr($settings['bburl'], -1) == "/") {
    $settings['bburl'] = my_substr($settings['bburl'], 0, -1);
}
$mybb->settings =& $settings;
$mybb->parse_cookies();
require_once MYBB_ROOT . "inc/class_datacache.php";
示例#3
0
 }
 echo '<description>' . stripslashes($ForumArr['synopsis']) . '</description>';
 echo '<copyright>Copyright(C) PhpSay</copyright>';
 echo '<generator>AlanZhu</generator>';
 echo '<lastBuildDate>' . date('r') . '</lastBuildDate>';
 echo '<ttl>120</ttl>';
 echo '<image>';
 echo '<url>http://' . $site_domain . $site_catalog . 'images/slogo.gif</url>';
 echo '<title>' . $site_name . '</title>';
 echo '<link>http://' . $site_domain . $site_catalog . '</link>';
 echo '</image>';
 $TSQL = "SELECT I.`tid`,I.`author`,I.`subject`,I.`dateline`,T.`message` FROM `" . $table_post . "` I ";
 $TSQL .= "LEFT JOIN `" . $table_post2 . "` T ON I.`pid`=T.`pid` ";
 $TSQL .= "WHERE I.`fid`=" . $ForumArr['fid'] . " AND I.`replyfloor`=0 ORDER BY I.`pid` DESC LIMIT 50";
 $Result = $DB->query($TSQL);
 while ($Re = $DB->fetch_array($Result)) {
     echo '<item>';
     echo '<title>' . filterHTML($Re['subject']) . '</title>';
     if ($site_rewrite) {
         echo '<link>http://' . $site_domain . $site_catalog . 'topic-' . $Re['tid'] . '-1.html</link>';
     } else {
         echo '<link>http://' . $site_domain . $site_catalog . 'topic.php?tid=' . $Re['tid'] . '</link>';
     }
     echo '<description><![CDATA[' . showStr($Re['message']) . ']]></description>';
     echo '<category>' . stripslashes($ForumArr['name']) . '</category>';
     echo '<author>' . stripslashes($Re['author']) . '</author>';
     echo '<pubDate>' . date('r', $Re['dateline']) . '</pubDate>';
     echo '</item>';
 }
 echo '</channel>';
 echo '</rss>';
         $fp = fopen($dbsql, "rb");
         $installdata = fread($fp, filesize($dbsql));
         $installdata = str_replace("\r", "\n", str_replace(' sablog_', ' ' . $db_prefix, $installdata));
         fclose($fp);
     }
     preg_match("/CREATE TABLE " . $db_prefix . $value . "\\s+\\(.+?;/is", $installdata, $a);
     $DB->query(createtable($a[0]));
 }
 foreach ($repair as $table => $valuedata) {
     foreach ($valuedata as $value) {
         echo print_r($value);
         echo '<br>';
         if (!in_array($r_table, $repairtable)) {
             list($r_table, $r_field, $option) = explode('|', $value);
             if (!isset($repairrtable[$r_table]) && ($fieldsquery = $DB->query("SHOW FIELDS FROM {$db_prefix}{$r_table}", 'SILENT'))) {
                 while ($fields = $DB->fetch_array($fieldsquery)) {
                     $fielddefault[$r_table][$fields['Field']] = $fields['Default'];
                 }
             }
             $field = $saxdb[$r_table][$r_field];
             $altersql = '`' . $field['Field'] . '` ' . $field['Type'];
             $altersql .= $field['Null'] == 'NO' ? ' NOT NULL' : '';
             $altersql .= in_array($fielddefault[$r_table][$field['Field']], array('', '0')) && in_array($field['Default'], array('', '0')) || $field['Null'] == 'NO' && $field['Default'] == '' || preg_match('/text/i', $field['Type']) || preg_match('/auto_increment/i', $field['Extra']) ? '' : ' default \'' . $field['Default'] . '\'';
             $altersql .= $field['Extra'] != '' ? ' ' . $field['Extra'] : '';
             $altersql = $option == 'modify' ? "MODIFY COLUMN " . $altersql : "ADD COLUMN " . $altersql;
             $alter[$r_table][] = $altersql;
         }
     }
 }
 foreach ($alter as $r_table => $sqls) {
     $DB->query("ALTER TABLE `{$db_prefix}{$r_table}` " . implode(',', $sqls), 'SILENT');
    $_COOKIE = sax_stripslashes($_COOKIE);
}
if ($_POST['sax_cookie_auth']) {
    list($sax_uid, $sax_pw, $sax_logincount) = explode("\t", authcode($_POST['sax_cookie_auth'], 'DECODE'));
} else {
    list($sax_uid, $sax_pw, $sax_logincount) = $_COOKIE['sax_auth'] ? explode("\t", authcode($_COOKIE['sax_auth'], 'DECODE')) : array('', '', 0);
}
$sax_uid = (int) $sax_uid;
$sax_pw = sax_addslashes($sax_pw);
$sax_logincount = (int) $sax_logincount;
$sax_group = 4;
$_EVO = array();
$seccode = 0;
if ($sax_uid) {
    $query = $DB->query("SELECT userid AS sax_uid, username AS sax_user, password AS sax_pw, groupid AS sax_group, logincount AS sax_logincount, email as sax_email, url as sax_url, lastpost, lastip, lastvisit, lastactivity\r\n\t\tFROM {$db_prefix}users\r\n\t\tWHERE userid='{$sax_uid}' AND password='******' AND logincount='{$sax_logincount}'");
    $_EVO = $DB->fetch_array($query);
    if (!$_EVO) {
        dcookies();
    }
}
@extract($_EVO);
$lastvisit = !$lastvisit ? $timestamp : $lastvisit;
if (!$sax_uid || !$sax_user) {
    $sax_uid = $sax_logincount = 0;
    $sax_user = '';
    $sax_group = 6;
}
if ($sax_group == 1) {
    error_reporting(7);
}
$formhash = formhash();