Пример #1
0
 public function registerCloud($cloudApiIp = '')
 {
     try {
         $returnData = $this->register();
     } catch (Cloud_Service_Client_RestfulException $e) {
         if ($e->getCode() == 1 && $cloudApiIp) {
             $this->setCloudApiIp($cloudApiIp);
             try {
                 $returnData = $this->register();
                 C::t('common_setting')->update('cloud_api_ip', $cloudApiIp);
             } catch (Cloud_Service_Client_RestfulException $e) {
                 throw new Cloud_Service_Client_RestfulException($e);
             }
         } else {
             throw new Cloud_Service_Client_RestfulException($e);
         }
     }
     $sId = intval($returnData['sId']);
     $sKey = trim($returnData['sKey']);
     if ($sId && $sKey) {
         C::t('common_setting')->update_batch(array('my_siteid' => $sId, 'my_sitekey' => $sKey, 'cloud_status' => '2'));
         updatecache('setting');
     } else {
         throw new Cloud_Service_Client_RestfulException('Error Response.', 2);
     }
     return true;
 }
Пример #2
0
 public function onUserApplicationRemove($uId, $appIds)
 {
     $result = C::t('home_userapp')->delete_by_uid_appid($uId, $appIds);
     C::t('home_userappfield')->delete_by_uid_appid($uId, $appIds);
     updatecreditbyaction('installapp', $uId, array(), $appId, -1);
     require_once libfile('function/cache');
     updatecache('userapp');
     return $result;
 }
Пример #3
0
function saveconfig($cftype)
{
    global $mconfigs, $mconfigsnew, $db, $tblprefix;
    foreach ($mconfigsnew as $k => $v) {
        if (!isset($mconfigs[$k]) || $mconfigs[$k] != $v) {
            $db->query("REPLACE INTO {$tblprefix}mconfigs (varname,value,cftype) VALUES ('{$k}','{$v}','{$cftype}')");
        }
    }
    updatecache('mconfigs');
}
Пример #4
0
function saveLoginConfigure(array &$params)
{
    $pstr = BIGAPPJSON::encode($params);
    //$svalue = str_replace("\\u", "#u", $pstr);
    $sql = "INSERT INTO " . DB::table('common_setting') . " values ('bigapp_longin_register_setting','{$pstr}') " . "ON DUPLICATE KEY UPDATE svalue=values(svalue)";
    DB::query($sql);
    require_once libfile('function/core');
    require_once libfile('function/cache');
    updatecache('setting');
}
Пример #5
0
 protected function _openCloud()
 {
     require_once libfile('function/cache');
     $result = C::t('common_setting')->update('cloud_status', 1);
     try {
         C::t('common_setting')->delete(array('connectsiteid', 'connectsitekey', 'my_siteid_old', 'my_sitekey_sign_old'));
     } catch (Exception $e) {
     }
     updatecache('setting');
     return true;
 }
Пример #6
0
 public function generateUniqueId()
 {
     $siteuniqueid = C::t('common_setting')->fetch('siteuniqueid');
     if (empty($siteuniqueid) || strlen($siteuniqueid) < 16) {
         $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
         $siteuniqueid = 'DX' . $chars[date('y') % 60] . $chars[date('n')] . $chars[date('j')] . $chars[date('G')] . $chars[date('i')] . $chars[date('s')] . substr(md5($_G['clientip'] . $_G['username'] . TIMESTAMP), 0, 4) . random(4);
         C::t('common_setting')->update('siteuniqueid', $siteuniqueid);
         require_once libfile('function/cache');
         updatecache('setting');
     }
 }
Пример #7
0
 function cumonthadd_reset()
 {
     global $cu_nowmonth, $db, $tblprefix;
     if ($cu_nowmonth == date('n')) {
         return;
     }
     @set_time_limit(1000);
     @ignore_user_abort(TRUE);
     include_once M_ROOT . "./include/cache.fun.php";
     $db->query("UPDATE {$tblprefix}members SET cuaddmonth = '0'", 'SILENT');
     $db->query("REPLACE INTO {$tblprefix}mconfigs (varname,value,cftype) VALUES ('cu_nowmonth','" . date('n') . "','basic')", 'SILENT');
     updatecache('mconfigs');
 }
 public function delete_by_uid_orgid($uids, $orgid, $wxupdate = 1)
 {
     $uids = (array) $uids;
     if ($return = DB::delete($this->_table, "uid IN (" . dimplode($uids) . ") and orgid='{$orgid}'")) {
         include_once libfile('function/cache');
         updatecache('organization');
         if ($wxupdate) {
             wx_updateUser($uids);
         }
         return $return;
     } else {
         return false;
     }
 }
Пример #9
0
 public function option_optimizer($options)
 {
     $update = array();
     foreach ($options as $option) {
         if (isset($this->setting[$option])) {
             $update[$option] = $this->setting[$option]['optimizedvalue'];
         }
     }
     if ($update) {
         C::t('common_setting')->update_batch($update);
         updatecache('setting');
     }
     return true;
 }
Пример #10
0
function cloudaddons_getuniqueid() {
	global $_G;
	if (CLOUDADDONS_WEBSITE_URL == 'http://addon.discuz.com') {
		return $_G['setting']['siteuniqueid'] ? $_G['setting']['siteuniqueid'] : C::t('common_setting')->fetch('siteuniqueid');
	} else {
		if (!$_G['setting']['addon_uniqueid']) {
			$chars         = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
			$addonuniqueid = $chars[date('y') % 60] . $chars[date('n')] . $chars[date('j')] . $chars[date('G')] . $chars[date('i')] . $chars[date('s')] . substr(md5($_G['clientip'] . TIMESTAMP), 0, 4) . random(6);
			C::t('common_setting')->update('addon_uniqueid', $addonuniqueid);
			require_once libfile('function/cache');
			updatecache('setting');
		}
		return $_G['setting']['addon_uniqueid'];
	}
}
Пример #11
0
function getPushStat()
{
    global $_G;
    updatecache('setting');
    if (isset($_G['setting']['bigapp_push_config'])) {
        $_G['setting']['bigapp_push_config'] = unserialize($_G['setting']['bigapp_push_config']);
    }
    if (!isset($_G['setting']['bigapp_push_config']['push_enabled'])) {
        $_G['setting']['bigapp_push_config']['push_enabled'] = 0;
    }
    if ($_G['setting']['bigapp_push_config']['push_enabled'] != 0) {
        $_G['setting']['bigapp_push_config']['push_enabled'] = 1;
    }
    return $_G['setting']['bigapp_push_config']['push_enabled'];
}
Пример #12
0
 public function onCommonSetConfig($data)
 {
     $settings = array();
     if (is_array($data) && $data) {
         foreach ($data as $key => $val) {
             if (substr($key, 0, 3) != 'my_') {
                 continue;
             }
             $settings[$key] = $val;
         }
         if ($settings) {
             C::t('common_setting')->update_batch($settings);
             require_once DISCUZ_ROOT . './source/function/function_cache.php';
             updatecache('setting');
             return true;
         }
     }
     return false;
 }
Пример #13
0
 public static function readLocalAkSk2()
 {
     global $_G;
     require_once libfile('function/core');
     require_once libfile('function/cache');
     updatecache('setting');
     //$bigapp_aksk = 'bigapp_aksk_' . md5($_G['siteurl']);
     $bigapp_aksk = 'bigapp_aksk';
     //!< 不要把siteurl带上,api接口和管理页接口的siteurl是不同的!!!
     if (isset($_G['setting'][$bigapp_aksk]) && !is_array($_G['setting'][$bigapp_aksk])) {
         $_G['setting'][$bigapp_aksk] = unserialize($_G['setting'][$bigapp_aksk]);
     }
     if (isset($_G['setting'][$bigapp_aksk]['app_key']) && isset($_G['setting'][$bigapp_aksk]['app_secret'])) {
         runlog('bigapp', 'read local ak sk succ [ ak: ' . $_G['setting'][$bigapp_aksk]['app_key'] . ', sk: ' . $_G['setting'][$bigapp_aksk]['app_secret'] . ' ]');
         return $_G['setting'][$bigapp_aksk];
     }
     runlog('bigapp', 'read local ak sk failed');
     return false;
 }
 private function inittable()
 {
     if (!DB::fetch_first("SHOW TABLES LIKE '" . DB::table('common_remote_port') . "'")) {
         $orig_tablepre = 'pre_';
         $tablepre = getglobal('config/db/1/tablepre');
         $dbcharset = getglobal('config/db/1/dbcharset');
         $porttable = "CREATE TABLE pre_common_remote_port (id mediumint(8) unsigned NOT NULL default '0' COMMENT '',idtype char(15) NOT NULL default '' COMMENT '',useip char(15) NOT NULL default '' COMMENT '',port smallint(6) unsigned NOT NULL default '0' COMMENT '',PRIMARY KEY (id, idtype)) ENGINE=MyISAM COMMENT=''";
         $porttable = str_replace("\r", "\n", str_replace(' ' . $orig_tablepre, ' ' . $tablepre, $porttable));
         $porttable = str_replace("\r", "\n", str_replace(' `' . $orig_tablepre, ' `' . $tablepre, $porttable));
         $type = strtoupper(preg_replace("/^\\s*CREATE TABLE\\s+.+\\s+\\(.+?\\).*(ENGINE|TYPE)\\s*=\\s*([a-z]+?).*\$/isU", "\\2", $porttable));
         $type = in_array($type, array('MYISAM', 'HEAP', 'MEMORY')) ? $type : 'MYISAM';
         $dbver = DB::$db->version();
         $porttable = preg_replace("/^\\s*(CREATE TABLE\\s+.+\\s+\\(.+?\\)).*\$/isU", "\\1", $porttable) . ($dbver > '4.1' ? " ENGINE={$type} DEFAULT CHARSET=" . $dbcharset : " TYPE={$type}");
         DB::query($porttable);
         C::t('common_setting')->update('porttable', 1);
         require_once libfile('function/cache');
         updatecache('setting');
         return true;
     }
 }
Пример #15
0
 public function onUnionAddAdvs($advs)
 {
     $result = array();
     if (is_array($advs)) {
         foreach ($advs as $advid => $adv) {
             $data = $this->_addAdv($adv);
             if ($data === true) {
                 $result['succeed'][$advid] = $advid;
             } else {
                 $result['failed'][$advid] = $data;
             }
         }
         require_once libfile('function/cache');
         updatecache('advs');
         updatecache('setting');
     } else {
         $result['error'] = 'no adv';
     }
     return $result;
 }
Пример #16
0
 function pay_vip($in_uid, $day, $in_oldgroup)
 {
     global $_G;
     $uid = $in_uid ? $in_uid : $_G['uid'];
     $oldgroup = $in_oldgroup ? $in_oldgroup : $_G['groupid'];
     $year_pay = $day >= 360 ? 1 : 0;
     $time = $day * 86400;
     if (!$this->is_vip($uid)) {
         DB::insert('dsu_vip', array('uid' => $uid, 'exptime' => $_G['timestamp'] + $time, 'jointime' => $_G['timestamp'], 'year_pay' => $year_pay, 'level' => 1, 'oldgroup' => $oldgroup), false, true);
         $this->query("UPDATE pre_common_member SET groupid='{$this->vars[vip_1_group]}' WHERE uid='{$uid}' AND adminid=0");
         $this->vip_cache[] = $uid;
         require_once libfile('function/cache');
         updatecache('dsu_kkvip');
     } else {
         if ($year_pay) {
             $this->query("UPDATE pre_dsu_vip SET exptime=exptime+'{$time}' , year_pay='1' WHERE uid='{$uid}'");
         } else {
             $this->query("UPDATE pre_dsu_vip SET exptime=exptime+'{$time}' WHERE uid='{$uid}'");
         }
     }
 }
Пример #17
0
 public function onApplicationSetFlag($applications, $flag)
 {
     $flag = $flag == 'disabled' ? -1 : ($flag == 'default' ? 1 : 0);
     $appIds = array();
     if ($applications && is_array($applications)) {
         foreach ($applications as $application) {
             $this->refreshApplication($application['appId'], $application['appName'], null, null, null, null, null, null, null, $flag, null, null);
             $appIds[] = $application['appId'];
         }
     }
     if ($flag == -1) {
         C::t('home_feed')->delete_by_icon($appIds);
         C::t('home_userapp')->delete_by_uid_appid(0, $appIds);
         C::t('home_userappfield')->delete_by_uid_appid(0, $appIds);
         C::t('common_myinvite')->delete_by_appid($appIds);
         C::t('home_notification')->delete_by_type($appIds);
     }
     require_once libfile('function/cache');
     updatecache('userapp');
     $result = true;
     return $result;
 }
Пример #18
0
 private function step_appOpenWithRegister()
 {
     global $_G;
     $return = $this->appOpenWithRegister($this->appIdentifier, $_GET['extra']);
     if ($return['errCode']) {
         if ($return['errCode'] == '1000') {
             $this->step_bindQQ();
         } else {
             $this->_msg($return['errMessage']);
         }
     }
     if ($return['result']) {
         if ($return['result']['sId'] && $return['result']['sKey']) {
             C::t('common_setting')->update_batch(array('my_siteid' => $return['result']['sId'], 'my_sitekey' => $return['result']['sKey']));
             updatecache('setting');
         }
         if ($return['result']['needBindQQ']) {
             $this->step_bindQQ();
         }
     }
     $this->step_over();
 }
Пример #19
0
             $sub_button = array('displayorder' => $_GET['newsub_button'][$k]['displayorder'][$sk], 'name' => $name, 'keyurl' => $_GET['newsub_button'][$k]['keyurl'][$sk]);
             $setting['button'][$k]['sub_button'][] = $sub_button;
         }
     }
     if (count($setting['button'][$k]['sub_button']) > 7) {
         cpmsg(lang('plugin/wechat', 'wsq_menu_sub_button_max'), '', 'error');
     }
     usort($setting['button'][$k]['sub_button'], 'buttoncmp');
 }
 if (count($setting['button']) > 3) {
     cpmsg(lang('plugin/wechat', 'wsq_menu_button_max'), '', 'error');
 }
 usort($setting['button'], 'buttoncmp');
 $settings = array('wechatmenu' => serialize($setting));
 C::t('common_setting')->update_batch($settings);
 updatecache('setting');
 if (submitcheck('pubsubmit')) {
     if (!$setting['button']) {
         cpmsg(lang('plugin/wechat', 'wsq_menu_button_pub_error'), '', 'error');
     }
     $pubmenu = array('button' => array());
     foreach ($setting['button'] as $button) {
         if (!$button['sub_button']) {
             if (!$button['name']) {
                 cpmsg(lang('plugin/wechat', 'wsq_menu_name_empty'), '', 'error');
             }
             if (!$button['keyurl']) {
                 cpmsg(lang('plugin/wechat', 'wsq_menu_keyurl_empty'), '', 'error');
             }
             $parse = parse_url($button['keyurl']);
             $item = array('type' => $parse['host'] ? 'view' : 'click', 'name' => convertname($button['name']), $parse['host'] ? 'url' : 'key' => $button['keyurl']);
Пример #20
0
    if (!empty($tid)) {
        $thread = C::t('forum_thread')->fetch_by_tid_displayorder($tid, 0);
        if ($thread['authorid'] == $_G['uid']) {
            $thread['status'] = setstatus(6, $status, $thread['status']);
            C::t('forum_thread')->update($tid, array('status' => $thread['status']), true);
            showmessage('replynotice_success_' . $status);
        }
    }
    showmessage('replynotice_error', 'forum.php?mod=viewthread&tid=' . $tid);
} elseif ($_GET['action'] == 'removeindexheats') {
    if ($_G['adminid'] != 1) {
        showmessage('no_privilege_indexheats');
    }
    C::t('forum_thread')->update($_G['tid'], array('heats' => 0));
    require_once libfile('function/cache');
    updatecache('heats');
    dheader('Location: ' . dreferer());
} else {
    if (empty($_G['forum']['allowview'])) {
        if (!$_G['forum']['viewperm'] && !$_G['group']['readaccess']) {
            showmessage('group_nopermission', NULL, array('grouptitle' => $_G['group']['grouptitle']), array('login' => 1));
        } elseif ($_G['forum']['viewperm'] && !forumperm($_G['forum']['viewperm'])) {
            showmessage('forum_nopermission', NULL, array($_G['group']['grouptitle']), array('login' => 1));
        }
    }
    $thread = C::t('forum_thread')->fetch($_G['tid']);
    if (!($thread['displayorder'] >= 0 || $thread['displayorder'] == -4 && $thread['authorid'] == $_G['uid'])) {
        $thread = array();
    }
    if ($thread['readperm'] && $thread['readperm'] > $_G['group']['readaccess'] && !$_G['forum']['ismoderator'] && $thread['authorid'] != $_G['uid']) {
        showmessage('thread_nopermission', NULL, array('readperm' => $thread['readperm']), array('login' => 1));
 public static function delAPIHook($getplugin)
 {
     if (!$getplugin) {
         return;
     }
     $getplugins = (array) $getplugin;
     $apihook = self::getAPIHook();
     foreach ($apihook as $key => $hooknames) {
         foreach ($hooknames as $hookname => $plugins) {
             foreach ($plugins as $plugin => $value) {
                 if (in_array($plugin, $getplugins)) {
                     unset($apihook[$key][$hookname][$plugin]);
                 }
             }
         }
     }
     $settings = array('mobileapihook' => serialize($apihook));
     C::t('common_setting')->update_batch($settings);
     updatecache('setting');
     return $apihook;
 }
Пример #22
0
 function onCommonSetConfig($data)
 {
     $settings = array();
     if (is_array($data) && $data) {
         foreach ($data as $key => $val) {
             if (substr($key, 0, 3) != 'my_') {
                 continue;
             }
             $settings[] = "('{$key}', '{$val}')";
         }
         if ($settings) {
             DB::query("REPLACE INTO " . DB::table('common_setting') . " (`skey`, `svalue`) VALUES " . implode(',', $settings));
             require_once DISCUZ_ROOT . './source/function/function_cache.php';
             updatecache('setting');
             return true;
         }
     }
     return false;
 }
Пример #23
0
function import_styles($ignoreversion = 1, $dir = '', $restoreid = 0, $updatecache = 1)
{
    global $_G, $importtxt, $stylearray;
    if (!isset($dir)) {
        $stylearrays = array(getimportdata('Discuz! Style'));
    } else {
        if (!$restoreid) {
            $dir = str_replace(array('/', '\\'), '', $dir);
            $templatedir = DISCUZ_ROOT . './template/' . $dir;
        } else {
            $templatedir = DISCUZ_ROOT . $dir;
        }
        $searchdir = dir($templatedir);
        $stylearrays = array();
        while ($searchentry = $searchdir->read()) {
            if (substr($searchentry, 0, 13) == 'discuz_style_' && fileext($searchentry) == 'xml') {
                $importfile = $templatedir . '/' . $searchentry;
                $importtxt = implode('', file($importfile));
                $stylearrays[] = getimportdata('Discuz! Style');
            }
        }
    }
    foreach ($stylearrays as $stylearray) {
        if (empty($ignoreversion) && strip_tags($stylearray['version']) != strip_tags($_G['setting']['version'])) {
            cpmsg('styles_import_version_invalid', '', 'error', array('cur_version' => $stylearray['version'], 'set_version' => $_G['setting']['version']));
        }
        if (!$restoreid) {
            $renamed = 0;
            if ($stylearray['templateid'] != 1) {
                $templatedir = DISCUZ_ROOT . './' . $stylearray['directory'];
                if (!is_dir($templatedir)) {
                    if (!@mkdir($templatedir, 0777)) {
                        $basedir = dirname($stylearray['directory']);
                        cpmsg('styles_import_directory_invalid', '', 'error', array('basedir' => $basedir, 'directory' => $stylearray['directory']));
                    }
                }
                if (!($templateid = DB::result_first("SELECT templateid FROM " . DB::table('common_template') . " WHERE name='{$stylearray['tplname']}'"))) {
                    DB::query("INSERT INTO " . DB::table('common_template') . " (name, directory, copyright)\n\t\t\t\t\t\tVALUES ('{$stylearray['tplname']}', '{$stylearray['directory']}', '{$stylearray['copyright']}')");
                    $templateid = DB::insert_id();
                }
            } else {
                $templateid = 1;
            }
            if (DB::result_first("SELECT COUNT(*) FROM " . DB::table('common_style') . " WHERE name='{$stylearray['name']}'")) {
                $stylearray['name'] .= '_' . random(4);
                $renamed = 1;
            }
            DB::query("INSERT INTO " . DB::table('common_style') . " (name, templateid)\n\t\t\t\tVALUES ('{$stylearray['name']}', '{$templateid}')");
            $styleidnew = DB::insert_id();
        } else {
            $styleidnew = $restoreid;
            DB::query("DELETE FROM " . DB::table('common_stylevar') . " WHERE styleid='{$styleidnew}'");
        }
        foreach ($stylearray['style'] as $variable => $substitute) {
            $substitute = @htmlspecialchars($substitute);
            DB::query("INSERT INTO " . DB::table('common_stylevar') . " (styleid, variable, substitute)\n\t\t\t\tVALUES ('{$styleidnew}', '{$variable}', '{$substitute}')");
        }
    }
    if ($updatecache) {
        updatecache('styles');
        updatecache('setting');
    }
    return $renamed;
}
Пример #24
0
function runquery($queries){//执行sql语句
	global $tablepre,$whereis;
	$sqlquery = splitsql(str_replace(array(' cdb_', ' {tablepre}', ' `cdb_'), array(' '.$tablepre, ' '.$tablepre, ' `'.$tablepre), $queries));
	$affected_rows = 0;
	foreach($sqlquery as $sql) {
	$sql = syntablestruct(trim($sql), $my_version > '4.1', $dbcharset);
	if(trim($sql) != '') {
		mysql_query(stripslashes($sql));
		if($sqlerror = mysql_error()) {
			break;
			} else {
			$affected_rows += intval(mysql_affected_rows());
			}
		}
	}
	if(strpos($queries,'seccodestatus') && $whereis == 'is_dz') {
		dz_updatecache();	
	}
	if(strpos($queries,'bbclosed') && $whereis == 'is_dz') {
		dz_updatecache();	
	}
	if(strpos($queries,'template') && $whereis == 'is_uch') {
		uch_updatecache();	
	}
	if(strpos($queries,'seccode_login') && $whereis == 'is_uch') {
		uch_updatecache();	
	}
	if(strpos($queries,'close') && $whereis == 'is_uch') {
		uch_updatecache();	
	}
	errorpage($sqlerror? $sqlerror : "数据库升级成功,影响行数: &nbsp;$affected_rows",'数据库升级');

	if(strpos($queries,'settings') && $whereis == 'is_dz') {
		require_once './include/cache.func.php';
		updatecache('settings');		
	}
}
function insenz_runcron()
{
    global $timestamp, $db, $tablepre, $_DCACHE;
    $lockfile = DISCUZ_ROOT . './forumdata/insenzcron_' . gmdate('ymdH', $timestamp + 8 * 3600) . '.lock';
    if (is_writable($lockfile) && filemtime($lockfile) > $timestamp - 180) {
        return NULL;
    } else {
        @touch($lockfile);
    }
    @set_time_limit(1000);
    @ignore_user_abort(TRUE);
    $globalstick = $floatthreads = 0;
    $query = $db->query("SELECT c.id, c.type, c.fid AS virtualfid, c.tid, c.status, c.begintime, c.starttime, c.endtime, t.fid, t.authorid, t.author, t.subject, t.lastpost, t.displayorder FROM {$tablepre}campaigns c LEFT JOIN {$tablepre}threads t ON t.tid=c.tid WHERE c.nextrun<='{$timestamp}'");
    while ($c = $db->fetch_array($query)) {
        $moderated = in_array($c['displayorder'], array(-11, -12, 1, 2)) ? 1 : 0;
        $moderatedadd = $moderated ? ", moderated=1" : '';
        if ($c['status'] == 1) {
            if ($c['type'] != 4) {
                $db->query("UPDATE {$tablepre}threads SET displayorder=-displayorder-10 {$moderatedadd} WHERE tid='{$c['tid']}'", 'UNBUFFERED');
                $db->query("UPDATE {$tablepre}campaigns SET status=2, starttime='{$timestamp}', nextrun=endtime+starttime-begintime WHERE id='{$c['id']}' AND type='{$c['type']}'", 'UNBUFFERED');
                $lastpost = "{$c['tid']}\t{$c['subject']}\t{$c['lastpost']}\t{$c['author']}";
                $db->query("UPDATE {$tablepre}forums SET lastpost='{$lastpost}', threads=threads+1, posts=posts+1, todayposts=todayposts+1 WHERE fid='{$c['fid']}'", 'UNBUFFERED');
                if ($moderated) {
                    $expiration = $c['endtime'] + $c['starttime'] - $c['begintime'];
                    $db->query("INSERT INTO {$tablepre}threadsmod (tid, uid, username, dateline, action, expiration, status) VALUES ('{$c['tid']}', '" . $_DCACHE[settings][insenz][uid] . "', '" . $_DCACHE[settings][insenz][username] . "', '{$timestamp}', 'EST', '{$expiration}', '0')", 'UNBUFFERED');
                }
                if ($c['displayorder'] < -13) {
                    $floatthreads = 1;
                } elseif ($c['displayorder'] < -11) {
                    $globalstick = 1;
                }
                require_once DISCUZ_ROOT . './include/post.func.php';
                updatepostcredits('+', $c['authorid'], $_DCACHE['settings']['creditspolicy']['post']);
            } else {
                $db->query("UPDATE {$tablepre}campaigns SET status=2, starttime='{$timestamp}', nextrun=endtime+starttime-begintime WHERE id='{$c['id']}' AND type=4", 'UNBUFFERED');
                $db->query("UPDATE {$tablepre}forums SET status='1' WHERE fid='{$c['virtualfid']}'");
            }
        } elseif ($c['status'] == 2) {
            if ($c['type'] != 4) {
                if ($c['displayorder'] > 0) {
                    $db->query("UPDATE {$tablepre}threads SET displayorder=0 {$moderatedadd} WHERE tid='{$c['tid']}'", 'UNBUFFERED');
                    if ($moderated) {
                        $db->query("INSERT INTO {$tablepre}threadsmod (tid, uid, username, dateline, action, expiration, status) VALUES ('{$c['tid']}', '" . $_DCACHE[settings][insenz][uid] . "', '" . $_DCACHE[settings][insenz][username] . "', '{$timestamp}', 'UES', '0', '0')", 'UNBUFFERED');
                    }
                    if ($c['displayorder'] > 3) {
                        $floatthreads = 1;
                    } elseif ($c['displayorder'] > 1) {
                        $globalstick = 1;
                    }
                }
            } else {
                $db->query("UPDATE {$tablepre}forums SET status='0' WHERE fid='{$c['virtualfid']}'");
            }
            $db->query("UPDATE {$tablepre}campaigns SET status=3, nextrun=expiration WHERE id='{$c['id']}' AND type='{$c['type']}'", 'UNBUFFERED');
        } elseif ($c['status'] == 3) {
            if ($c['type'] != 4) {
                $db->query("UPDATE {$tablepre}threads SET digest=0 WHERE tid='{$c['tid']}'", 'UNBUFFERED');
            }
            $db->query("DELETE FROM {$tablepre}campaigns WHERE id='{$c['id']}' AND type='{$c['type']}'", 'UNBUFFERED');
        }
    }
    require_once DISCUZ_ROOT . './include/cache.func.php';
    $query = $db->query("SELECT nextrun FROM {$tablepre}campaigns WHERE nextrun>'{$timestamp}' ORDER BY nextrun LIMIT 1");
    $_DCACHE['settings']['insenz']['cronnextrun'] = $db->result($query, 0);
    updatesettings();
    $globalstick && updatecache('globalstick');
    $floatthreads && updatecache('floatthreads');
    @unlink($lockfile);
}
Пример #26
0
}
if (isset($action) && $action == 'updatecache') {
    include_once TDISCUZ_ROOT . './source/class/class_core.php';
    include_once TDISCUZ_ROOT . './source/function/function_core.php';
    $cachelist = array();
    $discuz =& discuz_core::instance();
    $discuz->cachelist = $cachelist;
    $discuz->init_cron = false;
    $discuz->init_setting = false;
    $discuz->init_user = false;
    $discuz->init_session = false;
    $discuz->init_misc = false;
    $discuz->init();
    $_G['siteurl'] = str_replace('source/plugin/tools/', '', $_G['siteurl']);
    require_once libfile('function/cache');
    updatecache();
    include_once libfile('function/block');
    blockclass_cache();
    //note 清除群组缓存
    require_once libfile('function/group');
    $groupindex['randgroupdata'] = $randgroupdata = grouplist('lastupdate', array('ff.membernum', 'ff.icon'), 80);
    $groupindex['topgrouplist'] = $topgrouplist = grouplist('activity', array('f.commoncredits', 'ff.membernum', 'ff.icon'), 10);
    $groupindex['updateline'] = TIMESTAMP;
    $groupdata = DB::fetch_first("SELECT SUM(todayposts) AS todayposts, COUNT(fid) AS groupnum FROM " . DB::table('forum_forum') . " WHERE status='3' AND type='sub'");
    $groupindex['todayposts'] = $groupdata['todayposts'];
    $groupindex['groupnum'] = $groupdata['groupnum'];
    save_syscache('groupindex', $groupindex);
    DB::query("TRUNCATE " . DB::table('forum_groupfield'));
    $tpl = dir(DISCUZ_ROOT . './data/template');
    while ($entry = $tpl->read()) {
        if (preg_match("/\\.tpl\\.php\$/", $entry)) {
Пример #27
0
    } else {
        cpmsg('counter_groupmember_post_succeed', 'action=counter', 'succeed');
    }
} elseif (submitcheck('groupnum', 1)) {
    $nextlink = "action=counter&current={$next}&pertask={$pertask}&groupnum=yes";
    $processed = 0;
    $queryf = C::t('forum_forum')->fetch_all_fid_for_group($current, $pertask);
    foreach ($queryf as $group) {
        $processed = 1;
        $groupnum = C::t('forum_forum')->fetch_groupnum_by_fup($group['fid']);
        C::t('forum_forumfield')->update($group['fid'], array('groupnum' => intval($groupnum)));
    }
    if ($processed) {
        cpmsg("{$lang['counter_groupnum']}: " . cplang('counter_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
    } else {
        updatecache('grouptype');
        cpmsg('counter_groupnum_succeed', 'action=counter', 'succeed');
    }
} elseif (submitcheck('blogreplynum', 1)) {
    $nextlink = "action=counter&current={$next}&pertask={$pertask}&blogreplynum=yes";
    if (blog_replynum_stat($current, $pertask)) {
        cpmsg("{$lang['counter_blog_replynum']}: " . cplang('counter_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
    } else {
        cpmsg('counter_blog_replynum_succeed', 'action=counter', 'succeed');
    }
} elseif (submitcheck('friendnum', 1)) {
    $nextlink = "action=counter&current={$next}&pertask={$pertask}&friendnum=yes";
    if (space_friendnum_stat($current, $pertask)) {
        cpmsg("{$lang['counter_friendnum']}: " . cplang('counter_processing', array('current' => $current, 'next' => $next)), $nextlink, 'loading');
    } else {
        cpmsg('counter_friendnum_succeed', 'action=counter', 'succeed');
Пример #28
0
            amessage('enameillegal', '?entry=alangs&action=alangsedit');
        }
        $alangnew['ename'] = strtolower(trim(strip_tags($alangnew['ename'])));
        if (in_array($alangnew['ename'], array_keys($alangs))) {
            amessage('enamerepeat', '?entry=alangs&action=alangsedit');
        }
        $alangnew['content'] = trim($alangnew['content']);
        $db->query("INSERT INTO {$tblprefix}alangs SET \n\t\t\t\t\tename='{$alangnew['ename']}', \n\t\t\t\t\tcontent='{$alangnew['content']}',\n\t\t\t\t\tcreatedate='{$timestamp}'\n\t\t\t\t\t");
        adminlog(lang('add_alang'));
        updatecache('alangs');
        amessage('alangaddfin', "?entry=alangs&action=alangsedit");
    }
} elseif ($action == 'alangdetail' && $ename) {
    if (!($alang = $db->fetch_one("SELECT * FROM {$tblprefix}alangs WHERE ename='{$ename}'"))) {
        amessage('chooseclang');
    }
    if (!submitcheck('balangdetail')) {
        tabheader(lang('edit_alang'), 'alangdetail', "?entry=alangs&action=alangdetail&ename={$ename}");
        trbasic(lang('alang_ename'), '', $alang['ename'], '');
        trbasic(lang('alang_content'), 'alangnew[content]', $alang['content'], 'textarea');
        tabfooter('balangdetail');
        a_guide('alangdetail');
    } else {
        $alangnew['content'] = trim($alangnew['content']);
        $sql = $alangnew['content'] != $alang['content'] ? ",createdate='{$timestamp}'" : '';
        $db->query("UPDATE {$tblprefix}alangs SET \n\t\t\t\t\tcontent='{$alangnew['content']}'\n\t\t\t\t\t{$sql}\n\t\t\t\t\tWHERE ename='{$ename}'");
        adminlog(lang('edit_alang_detail'));
        updatecache('alangs');
        amessage('alangmodfin', "?entry=alangs&action=alangsedit");
    }
}
Пример #29
0
}
$operation = in_array($_GET['op'], array('base', 'contact', 'edu', 'work', 'info', 'password', 'verify')) ? trim($_GET['op']) : $defaultop;
$space = getspace($_G['uid']);
space_merge($space, 'field_home');
space_merge($space, 'profile');
$seccodecheck = $_G['setting']['seccodestatus'] & 8;
$secqaacheck = $_G['setting']['secqaa']['status'] & 4;
$_G['group']['seccode'] = 1;
@(include_once DISCUZ_ROOT . './data/cache/cache_domain.php');
$spacedomain = isset($rootdomain['home']) && $rootdomain['home'] ? $rootdomain['home'] : array();
if ($operation != 'password') {
    include_once libfile('function/profile');
    loadcache('profilesetting');
    if (empty($_G['cache']['profilesetting'])) {
        require_once libfile('function/cache');
        updatecache('profilesetting');
        loadcache('profilesetting');
    }
}
$allowcstatus = !empty($_G['group']['allowcstatus']) ? true : false;
$verify = DB::fetch_first("SELECT * FROM " . DB::table("common_member_verify") . " WHERE uid='{$_G['uid']}'");
$validate = array();
if ($_G['setting']['regverify'] == 2 && $_G['groupid'] == 8) {
    $validate = DB::fetch_first("SELECT * FROM " . DB::table('common_member_validate') . " WHERE uid='{$_G['uid']}' AND status='1'");
}
$conisregister = $operation == 'password' && $_G['setting']['connect']['allow'] && DB::result_first("SELECT conisregister FROM " . DB::table('common_member_connect') . " WHERE uid='{$_G['uid']}'");
if (submitcheck('profilesubmit')) {
    require_once libfile('function/discuzcode');
    $forum = $setarr = $verifyarr = $errorarr = array();
    $forumfield = array('customstatus', 'sightml');
    if (!class_exists('discuz_censor')) {
Пример #30
0
                $directory = $_G['gp_newdirectory'];
                cpmsg('tpl_directory_invalid', '', 'error', array('directory' => $directory));
            }
            DB::insert('common_template', array('name' => $_G['gp_newname'], 'directory' => $_G['gp_newdirectory'], 'copyright' => $_G['gp_newcopyright']));
        }
        foreach ($_G['gp_directorynew'] as $id => $directory) {
            if (!$_G['gp_delete'] || $_G['gp_delete'] && !in_array($id, $_G['gp_delete'])) {
                if (!istpldir($directory)) {
                    cpmsg('tpl_directory_invalid', '', 'error', array('directory' => $directory));
                } elseif ($id == 1 && $directory != './template/default') {
                    cpmsg('tpl_default_directory_invalid', '', 'error');
                }
                DB::query("UPDATE " . DB::table('common_template') . " SET name='{$_G['gp_namenew'][$id]}', directory='{$_G['gp_directorynew'][$id]}' WHERE templateid='{$id}'", 'UNBUFFERED');
                if (!empty($_G['gp_copyrightnew'][$id])) {
                    DB::query("UPDATE " . DB::table('common_template') . " SET copyright='{$_G['gp_copyrightnew'][$id]}' WHERE templateid='{$id}' AND copyright=''", 'UNBUFFERED');
                }
            }
        }
        if (is_array($_G['gp_delete'])) {
            if (in_array('1', $_G['gp_delete'])) {
                cpmsg('tpl_delete_invalid', '', 'error');
            }
            if ($ids = dimplode($_G['gp_delete'])) {
                DB::query("DELETE FROM " . DB::table('common_template') . " WHERE templateid IN ({$ids}) AND templateid<>'1'", 'UNBUFFERED');
                DB::query("UPDATE " . DB::table('common_style') . " SET templateid='1' WHERE templateid IN ({$ids})", 'UNBUFFERED');
            }
        }
        updatecache('styles');
        cpmsg('tpl_update_succeed', 'action=templates', 'succeed');
    }
}