Пример #1
0
 public function create()
 {
     global $_G;
     //////////////////////////
     $fields = "\n\t\t\t`skey` varchar(255) NOT NULL default '',\n\t\t\t`svalue` text NOT NULL,\n\t\t\tPRIMARY KEY  (`skey`)\n\t\t";
     //////////////////////
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     //$type = 'debug';
     if ($type) {
         if (DB::num_rows($query)) {
             DB::query('DROP TABLE ' . DB::table($this->_table));
         }
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     } else {
         if (DB::num_rows($query) != 1) {
             $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
             $db = DB::object();
             $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
             DB::query($create_table_sql);
         }
     }
 }
Пример #2
0
 function db_error($message, $sql)
 {
     global $_G;
     list($showtrace, $logtrace) = discuz_error::debug_backtrace();
     $title = lang('error', 'db_' . $message);
     $title_msg = lang('error', 'db_error_message');
     $title_sql = lang('error', 'db_query_sql');
     $title_backtrace = lang('error', 'backtrace');
     $title_help = lang('error', 'db_help_link');
     $db =& DB::object();
     $dberrno = $db->errno();
     $dberror = str_replace($db->tablepre, '', $db->error());
     $sql = htmlspecialchars(str_replace($db->tablepre, '', $sql));
     $msg = '<li>[Type] ' . $title . '</li>';
     $msg .= $dberrno ? '<li>[' . $dberrno . '] ' . $dberror . '</li>' : '';
     $msg .= $sql ? '<li>[Query] ' . $sql . '</li>' : '';
     discuz_error::show_error('db', $msg, $showtrace, false);
     unset($msg, $phperror);
     $errormsg = '<b>' . $title . '</b>';
     $errormsg .= "[{$dberrno}]<br /><b>ERR:</b> {$dberror}<br />";
     if ($sql) {
         $errormsg .= '<b>SQL:</b> ' . $sql;
     }
     $errormsg .= "<br />";
     $errormsg .= '<b>PHP:</b> ' . $logtrace;
     discuz_error::write_error_log($errormsg);
     exit;
 }
Пример #3
0
 public function getAttachment()
 {
     global $_G;
     try {
         $taskData = $this->checkTask();
     } catch (Exception $e) {
         throw new Cloud_Exception($e);
     }
     $task = $taskData['task'];
     $attach = $taskData['attach'];
     $taskId = $task['taskid'];
     C::t('#qqconnect#connect_disktask')->update($taskId, array('status' => 1, 'downloadtime' => $_G['timestamp']));
     $db = DB::object();
     $db->close();
     ob_end_clean();
     $attach['filename'] = '"' . (strtolower(CHARSET) == 'utf-8' && strexists($_SERVER['HTTP_USER_AGENT'], 'MSIE') ? urlencode($attach['filename']) : $attach['filename']) . '"';
     dheader('Content-Type: application/octet-stream');
     dheader('Content-Length: ' . $attach['filesize']);
     dheader('Content-Disposition: attachment; filename=' . $attach['filename']);
     self::_checkXSendFile($attach['attachment']);
     if ($attach['remote']) {
         self::_getRemoteFile($attach['attachment']);
     } else {
         self::_getLocalFile($attach['attachment']);
     }
     exit;
 }
Пример #4
0
function siteinformation()
{
    global $_G, $siteuniqueid, $save_mastermobile;
    $db = DB::object();
    $update = array('uniqueid' => $siteuniqueid, 'bbname' => $_G['setting']['bbname'], 'version' => XPLUS_VERSION, 'release' => XPLUS_RELEASE, 'php' => PHP_VERSION, 'mysql' => $db->version(), 'charset' => CHARSET, 'software' => $_SERVER['SERVER_SOFTWARE'], 'mastermobile' => $save_mastermobile, 'email' => $_G['member']['email']);
    $updatetime = @filemtime(DISCUZ_ROOT . './data/updatetime.lock');
    if (empty($updatetime) || TIMESTAMP - $updatetime > 3600 * 4) {
        @touch(DISCUZ_ROOT . './data/updatetime.lock');
        $table = array('common_attachment' => 'attachments', 'common_member' => 'members');
        $modulespecialqueries = $modulearr = array();
        $query = DB::query("SELECT identifier FROM " . DB::table('common_module'));
        while ($row = DB::fetch($query)) {
            $modulearr[] = $module = $row['identifier'];
            $moduleinformation = null;
            @(include libfile('module/' . $module));
            if ($module && $moduleinformation) {
                foreach ($moduleinformation as $value) {
                    if ($value['table'] && $value['returnkey']) {
                        $moduletable = $module . '_' . $value['table'];
                        $returnkey = $module . '_' . $value['returnkey'];
                        $conditions = $value['conditions'];
                        if (!empty($conditions) && $value['col']) {
                            $modulespecialqueries[$returnkey] = "SELECT {$value['col']} FROM " . DB::table($moduletable) . " WHERE {$conditions} LIMIT 0, 1";
                        } else {
                            $table[$moduletable] = $returnkey;
                        }
                    }
                }
            }
        }
        $update['module'] = implode(',', $modulearr);
        if ($modulespecialqueries) {
            foreach ($modulespecialqueries as $key => $value) {
                $update[$key] = DB::result_first($value);
            }
        }
        $tableprelen = strlen($db->tablepre);
        $query = DB::query("SHOW TABLE STATUS");
        while ($row = DB::fetch($query)) {
            $tablename = substr($row['Name'], $tableprelen);
            if (!isset($table[$tablename])) {
                continue;
            }
            $update[$table[$tablename]] = $row['Rows'];
        }
    }
    if (!empty($update['poll_items'])) {
        $update['poll_nitems'] = $update['poll_items'] - $update['poll_pitems'];
        unset($update['poll_items']);
    }
    $data = '';
    foreach ($update as $key => $value) {
        $data .= $key . '=' . rawurlencode($value) . '&';
    }
    return 'os=xplus&update=' . rawurlencode(base64_encode($data)) . '&md5hash=' . substr(md5($_SERVER['HTTP_USER_AGENT'] . implode('', $update) . TIMESTAMP), 8, 8) . '&timestamp=' . TIMESTAMP;
}
Пример #5
0
 function _fetch_data($block_id)
 {
     global $_G, $postlist, $config, $authorid, $new_window, $tid, $hott;
     $db = DB::object();
     $tablepre = $db->tablepre;
     $limit = $config['show_limit'] > 0 ? $config['show_limit'] : '6';
     $only_lz = $hott[$block_id]['only_lz'] ? ' AND uid=' . $authorid : '';
     $date_limit = $config['date_limit'] == 0 ? '' : ' AND dateline>' . ($_G['timestamp'] - $config['date_limit'] * 86400);
     $query = DB::query("SELECT blogid,subject FROM {$tablepre}home_blog WHERE blogid>0 {$only_lz}{$date_limit} ORDER BY dateline DESC LIMIT 0,{$limit}");
     while ($thread = DB::fetch($query)) {
         $hott_block[] = array('link' => "home.php?mod=space&do=blog&id={$thread[blogid]}", 'link_info' => $new_window, 'subject' => cutstr($thread['subject'], $config['max_text']));
     }
     return (array) $hott_block;
 }
Пример #6
0
 public static function showtablecloumn($tablename)
 {
     $data = array();
     $db =& DB::object();
     if ($db->version() > '4.1') {
         $query = $db->query("SHOW FULL COLUMNS FROM " . DB::table($tablename), 'SILENT');
     } else {
         $query = $db->query("SHOW COLUMNS FROM " . DB::table($tablename), 'SILENT');
     }
     while ($field = @DB::fetch($query)) {
         $data[$field['Field']] = $field;
     }
     return $data;
 }
Пример #7
0
 function _fetch_data($block_id)
 {
     global $_G, $postlist, $config, $authorid, $new_window, $tid, $hott;
     $db = DB::object();
     $tablepre = $db->tablepre;
     $limitforum = $config['disallow_fid'] ? ' AND fid NOT IN (' . dimplode(unserialize($config['disallow_fid'])) . ')' : '';
     $limit = $config['show_limit'] > 0 ? $config['show_limit'] : '6';
     $show_group = $config['show_group'] ? '' : ' AND isgroup=0';
     $date_limit = $config['date_limit'] == 0 ? '' : ' AND dateline>' . ($_G['timestamp'] - $config['date_limit'] * 86400);
     $query = DB::query("SELECT tid,highlight,subject FROM {$tablepre}forum_thread WHERE displayorder>-1 {$limitforum}{$date_limit}{$show_group} ORDER BY lastpost DESC LIMIT 0,{$limit}");
     while ($thread = DB::fetch($query)) {
         $hott_block[] = array('tid' => $thread['tid'], 'link' => "forum.php?mod=redirect&tid={$thread[tid]}&goto=lastpost#lastpost", 'link_info' => $new_window . $this->_sethighlight($thread['highlight']), 'subject' => cutstr($thread['subject'], $config['max_text']));
     }
     return (array) $hott_block;
 }
Пример #8
0
 public function create()
 {
     global $_G;
     //////////////////////////
     $fields = "\n\t\t\t`cardnoid` mediumint(8) unsigned NOT NULL auto_increment,\n\t\t\t`cardcatid` smallint(3) NOT NULL,\n\t\t\t`cardpici` smallint(3) NOT NULL,\n\t\t\t`cardno` char(20) character set gbk NOT NULL,\n\t\t\t`cardpass` char(32) character set gbk NOT NULL,\n\t\t\t`cardtype` tinyint(1) NOT NULL,\n\t\t\t`uid` mediumint(8) NOT NULL,\n\t\t\t`status` tinyint(1) NOT NULL,\n\t\t\t`maketime` int(10) unsigned NOT NULL,\n\t\t\t`bindtime` int(10) unsigned NOT NULL,\n\t\t\t`fafanguid` mediumint(8) default NULL,\n\t\t\tPRIMARY KEY  (`cardnoid`)\n\t\t";
     //////////////////////
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     if (DB::num_rows($query) == 1) {
         //DB::query('DROP TABLE '.DB::table($this->_table));
     }
     if (DB::num_rows($query) != 1) {
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     }
 }
Пример #9
0
 public function create()
 {
     global $_G;
     //////////////////////////
     $fields = "\n\t\t\t`yktbindid` smallint(6) NOT NULL,\n\t\t\tPRIMARY KEY  (`yktbindid`)\n\t\t";
     //////////////////////
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     if (DB::num_rows($query) == 1) {
         //DB::query('DROP TABLE '.DB::table($this->_table));
     }
     if (DB::num_rows($query) != 1) {
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     }
 }
Пример #10
0
 public function create()
 {
     global $_G;
     //////////////////////////
     $fields = "\n\t\t\t`cardcatid` smallint(6) unsigned NOT NULL auto_increment,\n\t\t\t`cardcatname` char(50) character set gbk NOT NULL,\n\t\t\t`cardcatdescription` text character set gbk NOT NULL,\n\t\t\t`cardjine` int(10) unsigned NOT NULL,\n\t\t\t`cardpice` int(10) unsigned NOT NULL,\n\t\t\t`cardyouxiaoqi` int(10) unsigned NOT NULL,\n\t\t\t`carddzyouxiaoqi` char(10) character set gbk NOT NULL,\n\t\t\t`status` tinyint(1) NOT NULL,\n\t\t\t`cardcatico` varchar(255) character set gbk NOT NULL,\n\t\t\t`cardkaishi` int(10) unsigned NOT NULL,\n\t\t\t`cardtype` char(20) character set gbk NOT NULL,\n\t\t\t`cardjifen` int(10) NOT NULL,\n\t\t\t`cardqingling` varchar(255) character set gbk NOT NULL,\n\t\t\t`shopid` mediumint(8) NOT NULL,\n\t\t\tPRIMARY KEY  (`cardcatid`)\n\t\t";
     //////////////////////
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     if (DB::num_rows($query) == 1) {
         //DB::query('DROP TABLE '.DB::table($this->_table));
     }
     if (DB::num_rows($query) != 1) {
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     }
 }
Пример #11
0
 function _loadsession($uid, $ip, $checkip = 1)
 {
     global $_G;
     $session = array();
     $query = DB::query("SELECT uid, adminid, panel, ip, dateline, errorcount, storage FROM " . DB::table('common_adminsession') . "\n\t\t\tWHERE uid='{$uid}' " . ($checkip ? "AND ip='{$ip}'" : '') . " AND panel='{$this->panel}' AND dateline>'{$this->timelimit}'", 'SILENT');
     $db = DB::object();
     if (!$db->error()) {
         $session = DB::fetch($query);
         if (isset($session['storage'])) {
             $session['storage'] = $session['storage'] ? unserialize(base64_decode($session['storage'])) : array();
         }
     } else {
         DB::query("DROP TABLE IF EXISTS " . DB::table('common_adminsession') . "");
         DB::query("CREATE TABLE " . DB::table('common_adminsession') . " (\n\t\t\t\tuid mediumint(8) UNSIGNED NOT NULL default '0',\n\t\t\t\tadminid smallint(6) unsigned NOT NULL DEFAULT '0',\n\t\t\t\tpanel tinyint(1) NOT NULL DEFAULT '0',\n\t\t\t\tip varchar(15) NOT NULL default '',\n\t\t\t\tdateline int(10) unsigned NOT NULL default '0',\n\t\t\t\terrorcount tinyint(1) NOT NULL default '0',\n\t\t\t\t`storage` mediumtext NOT NULL,\n\t\t\t\tPRIMARY KEY (`uid`, `panel`))" . (mysql_get_server_info() > '4.1' ? " ENGINE=MYISAM DEFAULT CHARSET=" . $_G['config']['db'][1]['dbcharset'] : " TYPE=MYISAM"));
     }
     return $session;
 }
Пример #12
0
 public function showcolumns($sortid)
 {
     if (!$sortid) {
         return;
     }
     $sortid = intval($sortid);
     $this->_table = 'forum_optionvalue' . $sortid;
     $db = DB::object();
     if ($db->version() > '4.1') {
         $query = DB::query("SHOW FULL COLUMNS FROM %t", array($this->_table), true);
     } else {
         $query = DB::query("SHOW COLUMNS FROM %t", array($this->_table), true);
     }
     $tables = array();
     while ($field = @DB::fetch($query)) {
         $tables[$field['Field']] = 1;
     }
     return $tables;
 }
Пример #13
0
 public function create()
 {
     global $_G;
     $fields = "\n\t\t\t`siteid` smallint(6) NOT NULL auto_increment,\n\t\t\t`siteurl` varchar(255) NOT NULL,\n\t\t\t`salt` char(6) NOT NULL,\n\t\t\t`charset` char(20) NOT NULL,\n\t\t\t`clientip` char(15) NOT NULL,\n\t\t\t`version` char(50) NOT NULL,\n\t\t\t`sitekey` char(32) NOT NULL,\n\t\t\t`sitegroup` text(0) NOT NULL,\n\t\t\t`mokuais` text(0) NOT NULL,\n\t\t\t`installtime` int(10) unsigned NOT NULL,\n\t\t\t`updatetime` int(10) unsigned NOT NULL,\n\t\t\tPRIMARY KEY  (`siteid`)\n\t\t";
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     $type = 'debug';
     if ($type) {
         DB::query('DROP TABLE ' . DB::table($this->_table));
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     } else {
         if (DB::num_rows($query) != 1) {
             $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
             $db = DB::object();
             $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
             DB::query($create_table_sql);
         }
     }
 }
Пример #14
0
 public function create()
 {
     global $_G;
     $fields = "\n\t\t`mokuaiclassid` mediumint(8) NOT NULL auto_increment,\n\t\t`mokuaiclassname` char(20) NOT NULL,\n\t\t`mokuaiclasstitle` char(40) NOT NULL,\n\t\tPRIMARY KEY  (`mokuaiclassid`)\n\t\t";
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     //$type = 'debug';
     if ($type) {
         DB::query('DROP TABLE ' . DB::table($this->_table));
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     } else {
         if (DB::num_rows($query) != 1) {
             $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
             $db = DB::object();
             $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
             DB::query($create_table_sql);
         }
     }
 }
Пример #15
0
 public function create()
 {
     global $_G;
     $fields = "\n\t\t\t`mokuaiid` smallint(6) NOT NULL auto_increment,\n\t\t\t`available` tinyint(1) NOT NULL default '0',\n\t\t\t`name` varchar(40) NOT NULL default '',\n\t\t\t`biaoshi` varchar(40) NOT NULL default '',\n\t\t\t`version` varchar(20) NOT NULL default '',\n\t\t\t`displayorder` smallint(6) NOT NULL,\n\t\t\t`price` int(10) NOT NULL,\n\t\t\t`description` varchar(255) NOT NULL,\n\t\t\t`updatetime` int(10) unsigned NOT NULL,\n\t\t\t`createtime` int(10) unsigned NOT NULL,\n\t\t\tPRIMARY KEY  (`mokuaiid`)\n\t\t";
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     //$type = 'debug';
     if ($type) {
         DB::query('DROP TABLE ' . DB::table($this->_table));
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     } else {
         if (DB::num_rows($query) != 1) {
             $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
             $db = DB::object();
             $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
             DB::query($create_table_sql);
         }
     }
 }
Пример #16
0
 public function create()
 {
     global $_G;
     $fields = "\n\t\t  `siteid` smallint(6) NOT NULL,\n\t\t  `updatetime` int(10) unsigned NOT NULL,\n\t\t  PRIMARY KEY  (`siteid`)\n\t\t";
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     //$type = 'debug';
     if ($type) {
         DB::query('DROP TABLE ' . DB::table($this->_table));
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     } else {
         if (DB::num_rows($query) != 1) {
             $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
             $db = DB::object();
             $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
             DB::query($create_table_sql);
         }
     }
 }
Пример #17
0
function siteinformation()
{
    global $_G, $siteuniqueid, $save_mastermobile, $save_masterqq, $save_masteremail;
    $db = DB::object();
    $update = array('uniqueid' => $siteuniqueid, 'version' => DISCUZ_VERSION, 'release' => DISCUZ_RELEASE, 'php' => PHP_VERSION, 'mysql' => $db->version(), 'charset' => CHARSET, 'bbname' => $_G['setting']['bbname'], 'mastermobile' => $save_mastermobile, 'masterqq' => $save_masterqq, 'masteremail' => $save_masteremail, 'software' => $_SERVER['SERVER_SOFTWARE'], 'my_siteid' => $_G['setting']['my_siteid'], 'my_sitekey' => $_G['setting']['my_sitekey']);
    $updatetime = @filemtime(DISCUZ_ROOT . './data/updatetime.lock');
    if (empty($updatetime) || TIMESTAMP - $updatetime > 3600 * 4) {
        @touch(DISCUZ_ROOT . './data/updatetime.lock');
        $tableprelen = strlen($db->tablepre);
        $table = array('forum_thread' => 'threads', 'forum_post' => 'posts', 'forum_attachment' => 'fattachments', 'common_member' => 'members', 'home_album' => 'albums', 'home_blog' => 'blogs', 'home_doing' => 'doings', 'home_poke' => 'pokes', 'home_share' => 'shares', 'portal_topic' => 'topics', 'portal_article_title' => 'articles', 'portal_attachment' => 'pattachments');
        foreach (C::t('common_setting')->fetch_all_table_status() as $row) {
            $tablename = substr($row['Name'], $tableprelen);
            if (!isset($table[$tablename])) {
                continue;
            }
            $update[$table[$tablename]] = $row['Rows'];
        }
        foreach (C::t('forum_thread')->count_special_group_by_special() as $thread) {
            $thread['special'] = intval($thread['special']);
            $update['spt_' . $thread['special']] = $thread['spcount'];
        }
        $update['groups'] = C::t('forum_forum')->fetch_forum_num('group');
        $update['forums'] = C::t('forum_forum')->fetch_forum_num();
        $update['adminemail'] = $_G['setting']['adminemail'];
        if ($_G['setting']['msn']['on'] && $_G['setting']['msn']['domain']) {
            $update['msn_domain'] = $_G['setting']['msn']['domain'];
        }
        $comma = '';
        foreach (C::t('common_patch')->fetch_patch_by_status(array(1, 2)) as $patch) {
            $update['patch'] .= $comma . $patch['serial'];
            $comma = ',';
        }
    }
    $data = '';
    foreach ($update as $key => $value) {
        $data .= $key . '=' . rawurlencode($value) . '&';
    }
    return 'os=dx&update=' . rawurlencode(base64_encode($data)) . '&md5hash=' . substr(md5($_SERVER['HTTP_USER_AGENT'] . implode('', $update) . TIMESTAMP), 8, 8) . '&timestamp=' . TIMESTAMP;
}
Пример #18
0
 public function create()
 {
     global $_G;
     //////////////////////////
     $fields = "\n\t\t\t`shopid` mediumint(8) unsigned NOT NULL auto_increment,\n\t\t\t`shopname` char(50) character set gbk NOT NULL,\n\t\t\t`shopalias` char(40) character set gbk NOT NULL,\n\t\t\t`shopvideo` varchar(255) character set gbk NOT NULL,\n\t\t\t`shoplocation` char(40) character set gbk NOT NULL,\n\t\t\t`dist` char(50) character set gbk NOT NULL,\n\t\t\t`comy` char(50) character set gbk NOT NULL,\n\t\t\t`shopintroduction` varchar(255) character set gbk NOT NULL,\n\t\t\t`shopinformation` text character set gbk NOT NULL,\n\t\t\t`shoprecommend` smallint(3) NOT NULL,\n\t\t\t`shoplevel` smallint(3) NOT NULL,\n\t\t\t`uid` mediumint(8) NOT NULL,\n\t\t\t`shopdianyuan` text character set gbk NOT NULL,\n\t\t\t`createtime` int(10) unsigned NOT NULL,\n\t\t\t`renlingtime` int(10) NOT NULL,\n\t\t\t`status` tinyint(1) NOT NULL,\n\t\t\t`shopsort` smallint(3) NOT NULL,\n\t\t\t`shoplogo` varchar(100) character set gbk NOT NULL,\n\t\t\t`address` varchar(100) character set gbk NOT NULL,\n\t\t\t`phone` varchar(20) character set gbk NOT NULL,\n\t\t\t`lianxiren` varchar(20) character set gbk NOT NULL,\n\t\t\t`qq` varchar(20) character set gbk NOT NULL,\n\t\t\t`upmokuai` varchar(255) NOT NULL,\n\t\t\t`businessid` mediumint(8) unsigned NOT NULL,\n\t\t\t`upshopid` mediumint(8) unsigned NOT NULL,\n\t\t\tPRIMARY KEY  (`shopid`)\n\t\t";
     //////////////////////
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     //$type = 'debug';
     if ($type) {
         DB::query('DROP TABLE ' . DB::table($this->_table));
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     } else {
         if (DB::num_rows($query) != 1) {
             $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
             $db = DB::object();
             $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
             DB::query($create_table_sql);
         }
     }
 }
Пример #19
0
 public function create()
 {
     global $_G;
     //////////////////////////
     $fields = "\n\t\t\t`jiashizhengid` smallint(6) NOT NULL auto_increment,\n\t\t\t`jiashizhengname` varchar(40) NOT NULL default '',\n\t\t\t`jiashizhengtitle` varchar(40) NOT NULL default '',\n\t\t\t`jiashizhengsort` varchar(40) NOT NULL default '',\n\t\t\t`jiashizhengimages` varchar(40) NOT NULL default '',\n\t\t\t`description` text NOT NULL,\n\t\t\t`status` tinyint(1) NOT NULL default '0',\n\t\t\t`createtime` int(10) unsigned NOT NULL,\n\t\t\t`updatetime` int(10) unsigned NOT NULL,\n\t\t\tPRIMARY KEY  (`jiashizhengid`)\n\t\t";
     //////////////////////
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     //$type = 'debug';
     if ($type) {
         DB::query('DROP TABLE ' . DB::table($this->_table));
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     } else {
         if (DB::num_rows($query) != 1) {
             $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
             $db = DB::object();
             $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
             DB::query($create_table_sql);
         }
     }
 }
Пример #20
0
 public function create()
 {
     global $_G;
     //////////////////////////
     $fields = "\n\t\t\t`shopgroupid` smallint(6) unsigned NOT NULL auto_increment,\n\t\t\t`shopgroupname` char(50) character set gbk NOT NULL,\n\t\t\t`inshoufei` int(10) unsigned NOT NULL,\n\t\t\t`inshoufeiqixian` int(10) unsigned NOT NULL,\n\t\t\t`shopgroupdescription` varchar(255) character set gbk NOT NULL,\n\t\t\t`cardfeiyong` int(10) NOT NULL,\n\t\t\t`cardpice` int(10) unsigned NOT NULL,\n\t\t\t`status` tinyint(1) NOT NULL,\n\t\t\t`shopgroupico` varchar(255) character set gbk NOT NULL,\n\t\t\t`xiaofei` varchar(255) character set gbk NOT NULL,\n\t\t\t`zhanghaoyue` int(10) NOT NULL,\n\t\t\t`zhanghaojifen` int(10) NOT NULL,\n\t\t\t`xiaofeitypeshenhe` tinyint(1) NOT NULL,\n\t\t\t`dianyuanshenhe` tinyint(1) NOT NULL,\n\t\t\t`dianzhang` varchar(255) character set gbk NOT NULL,\n\t\t\t`caiwu` varchar(255) character set gbk NOT NULL,\n\t\t\t`shouyin` varchar(255) character set gbk NOT NULL,\n\t\t\t`enfendian` tinyint(1) NOT NULL,\n\t\t\t`enshopnum` int(10) NOT NULL,\n\t\t\t`contractsample` char(100) character set gbk NOT NULL,\n\t\t\t`isshop` varchar(255) NOT NULL,\n\t\t\tPRIMARY KEY  (`shopgroupid`)\n\t\t";
     //////////////////////
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     //$type = 'debug';
     if ($type) {
         DB::query('DROP TABLE ' . DB::table($this->_table));
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     } else {
         if (DB::num_rows($query) != 1) {
             $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
             $db = DB::object();
             $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
             DB::query($create_table_sql);
         }
     }
 }
Пример #21
0
 public function create()
 {
     global $_G;
     //////////////////////////
     $fields = "\n\t\t\t`fieldid` smallint(6) NOT NULL auto_increment,\n\t\t\t`name` char(40) NOT NULL,\n\t\t\t`title` char(40) NOT NULL,\n\t\t\t`type` char(20) NOT NULL,\n\t\t\t`unit` char(10) NOT NULL,\n\t\t\t`infotype` char(20) NOT NULL,\n\t\t\t`available` tinyint(1) NOT NULL,\n\t\t\t`required` tinyint(1) NOT NULL,\n\t\t\t`unchangeable` tinyint(1) NOT NULL,\n\t\t\t`listdisplay` tinyint(1) NOT NULL,\n\t\t\t`search` tinyint(1) NOT NULL,\n\t\t\t`description` char(255) NOT NULL,\n\t\t\t`expiration` text NOT NULL,\n\t\t\t`protect` text NOT NULL,\n\t\t\t`rules` text NOT NULL,\n\t\t\t`permprompt` text NOT NULL,\n\t\t\t`displayorder` smallint(6) NOT NULL,\n\t\t\tPRIMARY KEY  (`fieldid`)listdisplay\n\t\t";
     //////////////////////
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     //$type = 'debug';
     if ($type) {
         DB::query('DROP TABLE ' . DB::table($this->_table));
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     } else {
         if (DB::num_rows($query) != 1) {
             $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
             $db = DB::object();
             $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
             DB::query($create_table_sql);
         }
     }
 }
Пример #22
0
 public function create()
 {
     global $_G;
     //////////////////////////
     $fields = "\n\t\t\t`goodssortid` smallint(6) unsigned NOT NULL auto_increment,\n\t\t\t`upmokuai` smallint(6) NOT NULL,\n\t\t\t`sortname` char(20) character set gbk NOT NULL,\n\t\t\t`sorttitle` char(20) character set gbk NOT NULL,\n\t\t\t`sortlevel` smallint(6) NOT NULL,\n\t\t\t`sortupid` smallint(6) NOT NULL,\n\t\t\t`displayorder` smallint(6) NOT NULL,\n\t\t\t`upids` text character set gbk NOT NULL,\n\t\t\tPRIMARY KEY  (`goodssortid`)\n\t\t";
     //////////////////////
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     //$type = 'debug';
     if ($type) {
         DB::query('DROP TABLE ' . DB::table($this->_table));
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     } else {
         if (DB::num_rows($query) != 1) {
             $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
             $db = DB::object();
             $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
             DB::query($create_table_sql);
         }
     }
 }
Пример #23
0
 public function create()
 {
     global $_G;
     //////////////////////////
     $fields = "\n\t\t\t`menuid` smallint(6) NOT NULL auto_increment,\n\t\t\t`type` enum('yiqixueba','member','admincp') NOT NULL,\n\t\t\t`upid` smallint(6) NOT NULL,\n\t\t\t`name` char(10) NOT NULL,\n\t\t\t`title` char(20) NOT NULL,\n\t\t\t`link` char(20) NOT NULL,\n\t\t\t`level` tinyint(1) NOT NULL,\n\t\t\t`modfile` varchar(255) NOT NULL,\n\t\t\t`status` tinyint(1) NOT NULL,\n\t\t\t`displayorder` smallint(3) NOT NULL,\n\t\t\tPRIMARY KEY  (`menuid`)\n\t\t";
     //////////////////////
     $query = DB::query("SHOW TABLES LIKE '%t'", array($this->_table));
     //$type = 'debug';
     if ($type) {
         DB::query('DROP TABLE ' . DB::table($this->_table));
         $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
         $db = DB::object();
         $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
         DB::query($create_table_sql);
     } else {
         if (DB::num_rows($query) != 1) {
             $create_table_sql = "CREATE TABLE " . DB::table($this->_table) . " ({$fields}) TYPE=MyISAM;";
             $db = DB::object();
             $create_table_sql = $this->syntablestruct($create_table_sql, $db->version() > '4.1', $_G['config']['db']['1']['dbcharset']);
             DB::query($create_table_sql);
         }
     }
 }
Пример #24
0
function siteinformation()
{
    global $_G, $siteuniqueid, $save_mastermobile;
    $db = DB::object();
    $update = array('uniqueid' => $siteuniqueid, 'version' => DISCUZ_VERSION, 'release' => DISCUZ_RELEASE, 'php' => PHP_VERSION, 'mysql' => $db->version(), 'charset' => CHARSET, 'bbname' => $_G['setting']['bbname'], 'mastermobile' => $save_mastermobile);
    $updatetime = @filemtime(DISCUZ_ROOT . './data/updatetime.lock');
    if (empty($updatetime) || TIMESTAMP - $updatetime > 3600 * 4) {
        @touch(DISCUZ_ROOT . './data/updatetime.lock');
        $tableprelen = strlen($db->tablepre);
        $table = array('forum_thread' => 'threads', 'forum_post' => 'posts', 'forum_attachment' => 'fattachments', 'common_member' => 'members', 'home_album' => 'albums', 'home_blog' => 'blogs', 'home_doing' => 'doings', 'home_poke' => 'pokes', 'home_share' => 'shares', 'portal_topic' => 'topics', 'portal_article_title' => 'articles', 'portal_attachment' => 'pattachments');
        $query = DB::query("SHOW TABLE STATUS");
        while ($row = DB::fetch($query)) {
            $tablename = substr($row['Name'], $tableprelen);
            if (!isset($table[$tablename])) {
                continue;
            }
            $update[$table[$tablename]] = $row['Rows'];
        }
        $query = DB::query("SELECT special, count(*) AS spcount FROM " . DB::table('forum_thread') . " GROUP BY special");
        while ($thread = DB::fetch($query)) {
            $thread['special'] = intval($thread['special']);
            $update['spt_' . $thread['special']] = $thread['spcount'];
        }
        $update['groups'] = DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_forum') . " WHERE `type`='sub' AND `status`='3'");
        $update['forums'] = DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_forum') . " WHERE `status`<>3");
        $update['adminemail'] = $_G['setting']['adminemail'];
        if ($_G['setting']['msn']['on'] && $_G['setting']['msn']['domain']) {
            $update['msn_domain'] = $_G['setting']['msn']['domain'];
        }
    }
    $data = '';
    foreach ($update as $key => $value) {
        $data .= $key . '=' . rawurlencode($value) . '&';
    }
    return 'os=dx&update=' . rawurlencode(base64_encode($data)) . '&md5hash=' . substr(md5($_SERVER['HTTP_USER_AGENT'] . implode('', $update) . TIMESTAMP), 8, 8) . '&timestamp=' . TIMESTAMP;
}
Пример #25
0
 public static function db_error($message)
 {
     global $_G;
     $db = DB::object();
     if (method_exists($db, 'errorInfo')) {
         $dberrno = $db->errorInfo();
         $sql = $db->currentSql;
         $dberror = str_replace(DB::table(), '', $db->errorInfo());
     } else {
         $dberror = $message;
     }
     if (stristr($dberror, '** BEGIN NESTED EXCEPTION **')) {
         $dberror = '<br/>' . $dberror;
         $dberror = nl2br($dberror);
     }
     $sql = dhtmlspecialchars(str_replace(DB::table(), '', $sql));
     $msg = '';
     $msg .= '<li>[Message] 数据库执行错误,请检查错误日志</li>';
     $msg .= $dberrno ? '<li>[info] ' . $dberror . '</li>' : '';
     //if($_GET[debug]==$_G[setting][debug_str]){
     $msg .= $sql ? '<li>[Query] ' . $sql . '</li>' : '';
     $msg .= $message ? "<li>[msg] " . $message . "</li>" : '';
     //}
     $msg .= "\r\n";
     $write_msg = '错误信息:' . $msg . "\r\n\r\n,--错误sql:" . $sql . ",\r\n--错误提示:" . $message . "\r\n\r\n";
     L($write_msg, 1);
     if ($_G[mobile] && $_G[inajax] || (defined('FETCH') || defined('API'))) {
         if ($_GET[debug] == $_G[setting][debug_str]) {
             msg('数据库执行错误:' . $write_msg, 'error');
         } else {
             msg('数据库执行错误:' . $dberror, 'error');
         }
     }
     $_G['error_msg'] = $sql;
     error::show_error('db', $msg);
 }
Пример #26
0
function gettablefields($table)
{
    static $tables = array();
    if (!isset($tables[$table])) {
        $tables[$table] = array();
        $db = DB::object();
        if ($db->version() > '4.1') {
            $query = $db->query("SHOW FULL COLUMNS FROM " . DB::table($table), 'SILENT');
        } else {
            $query = $db->query("SHOW COLUMNS FROM " . DB::table($table), 'SILENT');
        }
        while ($field = @DB::fetch($query)) {
            $tables[$table][$field['Field']] = $field;
        }
    }
    return $tables[$table];
}
Пример #27
0
 public static function sql_clear($message)
 {
     $message = self::clear($message);
     $message = str_replace(DB::object()->tablepre, '', $message);
     $message = dhtmlspecialchars($message);
     return $message;
 }
Пример #28
0
 public function create_table($maxtableid)
 {
     if ($maxtableid) {
         DB::query('SET SQL_QUOTE_SHOW_CREATE=0', 'SILENT');
         $db =& DB::object();
         $query = DB::query("SHOW CREATE TABLE %t", array($this->get_table_name()));
         $create = $db->fetch_row($query);
         $createsql = $create[1];
         $createsql = str_replace(DB::table($this->get_table_name()), DB::table($this->get_table_name($maxtableid)), $createsql);
         DB::query($createsql);
         return true;
     } else {
         return false;
     }
 }
Пример #29
0
function get_special_tables_array($tablename)
{
    $tablename = DB::table($tablename);
    $tablename = str_replace('_', '\\_', $tablename);
    $query = DB::query("SHOW TABLES LIKE '{$tablename}\\_%'");
    $dbo = DB::object();
    $tables_array = array();
    while ($row = $dbo->fetch_array($query, MYSQL_NUM)) {
        if (preg_match("/^{$tablename}_(\\d+)\$/i", $row[0])) {
            $prefix_len = strlen($dbo->tablepre);
            $row[0] = substr($row[0], $prefix_len);
            $tables_array[] = $row[0];
        }
    }
    return $tables_array;
}
Пример #30
0
            if (substr(TIMESTAMP, -1) == '0') {
                require_once libfile('function/misc');
                updateviews('forum_attachment', 'aid', 'downloads', $_G['forum_logfile']);
            }
            if (@($fp = fopen(DISCUZ_ROOT . $_G['forum_logfile'], 'a'))) {
                fwrite($fp, "{$aid}\n");
                fclose($fp);
            } elseif ($_G['adminid'] == 1) {
                showmessage('view_log_invalid', '', array('logfile' => $_G['forum_logfile']));
            }
        } else {
            DB::query("UPDATE " . DB::table('forum_attachment') . " SET downloads=downloads+'1' WHERE aid='{$aid}'", 'UNBUFFERED');
        }
    }
}
$db = DB::object();
$db->close();
!$_G['config']['output']['gzip'] && ob_end_clean();
$range = 0;
if ($readmod == 4 && !empty($_SERVER['HTTP_RANGE'])) {
    list($range) = explode('-', str_replace('bytes=', '', $_SERVER['HTTP_RANGE']));
}
if ($attach['remote'] && !$_G['setting']['ftp']['hideurl'] && $isimage) {
    dheader('location:' . $_G['setting']['ftp']['attachurl'] . 'forum/' . $attach['attachment']);
}
$filesize = !$attach['remote'] ? filesize($filename) : $attach['filesize'];
$attach['filename'] = '"' . (strtolower(CHARSET) == 'utf-8' && strexists($_SERVER['HTTP_USER_AGENT'], 'MSIE') ? urlencode($attach['filename']) : $attach['filename']) . '"';
dheader('Date: ' . gmdate('D, d M Y H:i:s', $attach['dateline']) . ' GMT');
dheader('Last-Modified: ' . gmdate('D, d M Y H:i:s', $attach['dateline']) . ' GMT');
dheader('Content-Encoding: none');
if ($isimage && !empty($_G['gp_noupdate']) || !empty($_G['gp_request'])) {