Esempio n. 1
0
 public function onConnectSetConfig($data)
 {
     global $_G;
     $settingFields = array('connectappid', 'connectappkey');
     if (!$data) {
         return false;
     }
     $setting = C::t('common_setting')->fetch_all(array('connect'));
     $connectData = (array) dunserialize($setting['connect']);
     if (!is_array($connectData)) {
         $connectData = array();
     }
     $settings = array();
     foreach ($data as $k => $v) {
         if (in_array($k, $settingFields)) {
             $settings[$k] = $v;
         } else {
             $connectData[$k] = $v;
         }
     }
     if ($connectData) {
         $settings['connect'] = $connectData;
     }
     if ($settings) {
         C::t('common_setting')->update_batch($settings);
         return true;
     }
     return false;
 }
 public function check()
 {
     require_once libfile('function/admincp');
     require_once libfile('function/plugin');
     require_once libfile('function/cloudaddons');
     $pluginarray = C::t('common_plugin')->fetch_all_data();
     $addonids = array();
     foreach ($pluginarray as $row) {
         if (ispluginkey($row['identifier'])) {
             $addonids[] = $row['identifier'] . '.plugin';
         }
     }
     $checkresult = dunserialize(cloudaddons_upgradecheck($addonids));
     savecache('addoncheck_plugin', $checkresult);
     $newversion = 0;
     foreach ($checkresult as $value) {
         list(, $newver) = explode(':', $value);
         if ($newver) {
             $newversion++;
         }
     }
     if ($newversion) {
         $return = array('status' => 1, 'type' => 'header', 'lang' => lang('optimizer', 'optimizer_plugin_new_plugin', array('newversion' => $newversion)));
     } else {
         $return = array('status' => 0, 'type' => 'none', 'lang' => lang('optimizer', 'optimizer_plugin_no_upgrade'));
     }
     return $return;
 }
Esempio n. 3
0
 function post()
 {
     global $_G;
     if ($_GET['onsubmit'] && check()) {
         $arr = array();
         $arr['title'] = trim_html($_GET['title'], 1);
         $arr['fid'] = intval($_GET['fid']);
         $value = $_GET['postdb'];
         $arr['value'] = serialize($value);
         $url = '';
         if ($_GET['id']) {
             $id = intval($_GET['id']);
             DB::update(__CLASS__, $arr, "id=" . $id);
             $url = '&id=' . $id;
             $msg = '修改';
         } else {
             $msg = '添加';
             $arr['dateline'] = TIMESTAMP;
             $arr['count'] = 0;
             $arr['updatetime'] = 0;
             $arr['count'] = 0;
             DB::insert(__CLASS__, $arr, true);
         }
         cpmsg($msg . '成功', 'success', 'm=' . __CLASS__ . '&a=' . __FUNCTION__ . $url);
     } elseif ($_GET['id']) {
         $id = intval($_GET['id']);
         $rs = DB::fetch_first("SELECT * FROM " . DB::table('fetch') . " WHERE id = " . $id);
         $fetch = dunserialize($rs['value']);
         $fetch = array_merge($fetch, $rs);
         //dump($fetch);
     }
     $cates = (include libfile('config/taobao_cate'));
     $this->add(array('cates' => $cates, 'fetch' => $fetch));
     $this->show();
 }
Esempio n. 4
0
 public function fetch($bid)
 {
     if ($block = parent::fetch(dintval($bid))) {
         $block['param'] = $block['param'] ? dunserialize($block['param']) : array();
     }
     return $block;
 }
 private function mobile_upload()
 {
     if ($_GET['mobile'] == 'yes' && !empty($_FILES['Filedata'])) {
         $forumattachextensions = '';
         if ($_G['forum']) {
             $forum = $_G['forum'];
             if ($forum['status'] == 3 && $forum['level']) {
                 $levelinfo = C::t('forum_grouplevel')->fetch($forum['level']);
                 if ($postpolicy = $levelinfo['postpolicy']) {
                     $postpolicy = dunserialize($postpolicy);
                     $forumattachextensions = $postpolicy['attachextensions'];
                 }
             } else {
                 $forumattachextensions = $forum['attachextensions'];
             }
             if ($forumattachextensions) {
                 $_G['group']['attachextensions'] = $forumattachextensions;
             }
         }
         $upload = new forum_upload(1);
         if ($upload) {
             $_GET['attachnew'][$upload->getaid] = array('description' => '');
         }
     }
 }
Esempio n. 6
0
 function plugin_myrepeats()
 {
     global $_G;
     if (!$_G['uid']) {
         return;
     }
     /* 读取可以使用马甲的用户组 usergroups 变量值。需要注意参数的读取方式,详情见插件手册-参数读取		。 */
     $myrepeatsusergroups = (array) dunserialize($_G['cache']['plugin']['myrepeats']['use		rgroups']);
     if (in_array('', $myrepeatsusergroups)) {
         $myrepeatsusergroups = array();
     }
     $userlist = array();
     /* 对当前登录用户进行马甲验证, 即当前用户组不再权限许可范围内, 但其他帐号所在用户组有权限, 则当		前用户也有使用权限。*/
     if (!in_array($_G['groupid'], $myrepeatsusergroups)) {
         if (!isset($_G['cookie']['myrepeat_rr'])) {
             /* 这里需要注意一下你所建的数据表对象的构建, 即 source/plugin/myrepeats/t				able/下的 table_新建表名.php */
             $users = count(C::t('#myrepeats#myrepeats')->fetch_all_by_username($_G['username']));
             dsetcookie('myrepeat_rr', 'R' . $users, 86400);
         } else {
             $users = substr($_G['cookie']['myrepeat_rr'], 1);
         }
         if (!$users) {
             return '';
         }
     }
     /* 前台显示代码 */
     $this->value['global_usernav_extra1'] = '<script>' . 'function showmyrepeats() {if(!$(\'myrepeats_menu\')) {' . 'menu=document.createElement(\'div\');menu.id=\'myrepeats_menu\';menu.style			.display=\'none\';menu.className=\'p_pop\';' . '$(\'append_parent\').appendChild(menu);' . 'ajaxget(\'plugin.php?id=myrepeats:switch&list=yes\',\'myrepeats_menu\',\'a			jaxwaitid\');}' . 'showMenu({\'ctrlid\':\'myrepeats\',\'duration\':2});}' . '</script>' . '<span class="pipe">|</span><a id="myrepeats" href="home.php?mod=spacecp&ac=plugin&		id=myrepeats:memcp" class="showmenu cur1" onmouseover="delayShow(this, showmyrepeat		s)">' . lang('plugin/myrepeats', 'switch') . '</a>' . "\n";
 }
Esempio n. 7
0
 function check_cpaccess()
 {
     global $_G;
     $session = array();
     if (!$this->adminuser['uid']) {
         $this->cpaccess = 0;
     } else {
         if (!$this->isfounder) {
             $session = C::t('user')->fetch($this->adminuser['uid']);
             if ($session && ($session['groupid'] == 1 || $session['groupid'] == 2)) {
                 $session = array_merge($session, (array) C::t('admincp_session')->fetch($this->adminuser['uid'], $session['groupid']));
             } else {
                 $session = array();
             }
         } else {
             $session = C::t('admincp_session')->fetch($this->adminuser['uid'], $this->panel);
         }
         if (empty($session)) {
             $this->cpaccess = $this->isfounder ? 1 : -2;
         } elseif (isset($_G['setting']['adminipaccess']) && $_G['setting']['adminipaccess'] && !ipaccess($_G['clientip'], $_G['setting']['adminipaccess'])) {
             $this->do_user_login();
         } elseif ($session && empty($session['uid'])) {
             $this->cpaccess = 1;
         } elseif ($session['dateline'] < $this->sessionlimit) {
             $this->cpaccess = 1;
         } elseif ($this->cpsetting['checkip'] && $session['ip'] != $this->core->var['clientip']) {
             $this->cpaccess = 1;
         } elseif ($session['errorcount'] >= 0 && $session['errorcount'] <= 3) {
             $this->cpaccess = 2;
         } elseif ($session['errorcount'] == -1) {
             $this->cpaccess = 3;
         } else {
             $this->cpaccess = -1;
         }
     }
     if ($this->cpaccess == 2 || $this->cpaccess == 3) {
         if (!empty($session['customperm'])) {
             $session['customperm'] = dunserialize($session['customperm']);
         }
     }
     $this->adminsession = $session;
     if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['admin_password'])) {
         if ($this->cpaccess == 2) {
             $this->check_admin_login();
         } elseif ($this->cpaccess == 0) {
             $this->check_user_login();
         }
     }
     if ($this->cpaccess == 1) {
         C::t('admincp_session')->delete($this->adminuser['uid'], $this->adminuser['groupid'], $this->sessionlife);
         C::t('admincp_session')->insert(array('uid' => $this->adminuser['uid'], 'adminid' => $this->adminuser['adminid'], 'panel' => $this->adminuser['groupid'], 'ip' => $this->core->var['clientip'], 'dateline' => TIMESTAMP, 'errorcount' => 0));
     } elseif ($this->cpaccess == 3) {
         //$this->load_admin_perms();
         C::t('admincp_session')->update($this->adminuser['uid'], $this->adminuser['groupid'], array('dateline' => TIMESTAMP, 'ip' => $this->core->var['clientip'], 'errorcount' => -1));
     }
     if ($this->cpaccess != 3) {
         $this->do_user_login();
     }
 }
Esempio n. 8
0
 function _loadstorage()
 {
     $ret = $this->table->fetch($this->uid, $this->panel);
     $storage = $ret['storage'];
     if (!empty($storage)) {
         $this->storage = dunserialize(base64_decode($storage));
     } else {
         $this->storage = array();
     }
 }
Esempio n. 9
0
function mkfeed($feed, $actors=array()) {
	global $_G;
	$feed['title_data'] = empty($feed['title_data'])?array():(is_array($feed['title_data'])?$feed['title_data']:@dunserialize($feed['title_data']));
	if(!is_array($feed['title_data'])) $feed['title_data'] = array();

	$feed['body_data'] = empty($feed['body_data'])?array():(is_array($feed['body_data'])?$feed['body_data']:@dunserialize($feed['body_data']));
	if(!is_array($feed['body_data'])) $feed['body_data'] = array();
	$searchs = $replaces = array();
	if($feed['title_data']) {
		foreach (array_keys($feed['title_data']) as $key) {
			$searchs[] = '{'.$key.'}';
			$replaces[] = $feed['title_data'][$key];
		}
	}

	$searchs[] = '{actor}';
	$replaces[] = empty($actors)?"<a href=\"home.php?mod=space&uid=$feed[uid]\" target=\"_blank\">$feed[username]</a>":implode(lang('core', 'dot'), $actors);
/*vot*/	$feed['title_template'] = lang('feed',$feed['title_template']);
	$feed['title_template'] = str_replace($searchs, $replaces, $feed['title_template']);
	$feed['title_template'] = feed_mktarget($feed['title_template']);

	$searchs = $replaces = array();
	$searchs[] = '{actor}';
	$replaces[] = empty($actors)?"<a href=\"home.php?mod=space&uid=$feed[uid]\" target=\"_blank\">$feed[username]</a>":implode(lang('core', 'dot'), $actors);
	if($feed['body_data'] && is_array($feed['body_data'])) {
		foreach (array_keys($feed['body_data']) as $key) {
			$searchs[] = '{'.$key.'}';
			$replaces[] = $feed['body_data'][$key];
		}
	}

	$feed['magic_class'] = '';
	if(!empty($feed['body_data']['magic_thunder'])) {
		$feed['magic_class'] = 'magicthunder';
	}

/*vot*/	$feed['body_template'] = lang('feed',$feed['body_template']);
	$feed['body_template'] = str_replace($searchs, $replaces, $feed['body_template']);
	$feed['body_template'] = feed_mktarget($feed['body_template']);

	$feed['body_general'] = feed_mktarget($feed['body_general']);

	if(is_numeric($feed['icon'])) {
		$feed['icon_image'] = "http://appicon.manyou.com/icons/{$feed['icon']}";
	} else {
		$feed['icon_image'] = STATICURL."image/feed/{$feed['icon']}.gif";
	}

	$feed['new'] = 0;
	if($_G['cookie']['home_readfeed'] && $feed['dateline']+300 > $_G['cookie']['home_readfeed']) {
		$feed['new'] = 1;
	}

	return $feed;
}
Esempio n. 10
0
 public function check()
 {
     global $_G;
     $dateline = C::t('common_cache')->fetch('db_export');
     $dateline = dunserialize($dateline['cachevalue']);
     $dateline = $dateline['dateline'];
     if ($_G['timestamp'] - $dateline > 86400 * 90) {
         $return = array('status' => 1, 'type' => 'header', 'lang' => lang('optimizer', 'optimizer_dbbackup_advice'));
     } else {
         $return = array('status' => 0, 'type' => 'header', 'lang' => lang('optimizer', 'optimizer_dbbackup_lastback') . dgmdate($dateline));
     }
     return $return;
 }
Esempio n. 11
0
 private function _switchVest($res, $username)
 {
     global $_G;
     $username = WebUtils::t(rawurldecode($username));
     $_GET['username'] = $username;
     $myrepeatsusergroups = (array) dunserialize($_G['cache']['plugin']['myrepeats']['usergroups']);
     if (!in_array($_G['groupid'], $myrepeatsusergroups)) {
         $users = C::t('#myrepeats#myrepeats')->fetch_all_by_username($_G['username']);
         if (!$users) {
             return $this->makeErrorInfo($res, lang('plugin/myrepeats', 'usergroup_disabled'));
         } else {
             $permusers = array();
             foreach ($users as $user) {
                 $permusers[] = $user['uid'];
             }
             $member = C::t('common_member')->fetch_by_username($_GET['username']);
             if (!$member || !in_array($member['uid'], $permusers)) {
                 return $this->makeErrorInfo($res, lang('plugin/myrepeats', 'usergroup_disabled'));
             }
         }
     }
     $user = C::t('#myrepeats#myrepeats')->fetch_all_by_uid_username($_G['uid'], $_GET['username']);
     $user = current($user);
     $olddiscuz_uid = $_G['uid'];
     $olddiscuz_user = $_G['username'];
     $olddiscuz_userss = $_G['member']['username'];
     if (!$user) {
         $newuid = C::t('common_member')->fetch_uid_by_username($_GET['username']);
         if (C::t('#myrepeats#myrepeats')->count_by_uid_username($newuid, $olddiscuz_userss)) {
             // 第一次登录,需要输入密码
         }
         //return $this->makeErrorInfo($res, lang('plugin/myrepeats', 'user_nonexistence'));
     } elseif ($user['locked']) {
         return $this->makeErrorInfo($res, lang('plugin/myrepeats', 'user_locked', array('user' => $_GET['username'])));
     }
     list($password, $questionid, $answer) = explode("\t", authcode($user['logindata'], 'DECODE', $_G['config']['security']['authkey']));
     $logInfo = UserUtils::login($username, $password);
     if ($logInfo['errcode']) {
         return $this->makeErrorInfo($res, $logInfo['message']);
     }
     $userInfo = AppbymeUserAccess::loginProcess($_G['uid'], $password);
     $userAvatar = UserUtils::getUserAvatar($_G['uid']);
     $res['token'] = (string) $userInfo['token'];
     $res['secret'] = (string) $userInfo['secret'];
     $res['uid'] = (int) $_G['uid'];
     $res['avatar'] = (string) $userAvatar;
     $res['userName'] = (string) $_G['username'];
     return $res;
 }
Esempio n. 12
0
	function image() {
		global $_G;
		$this->param = array(
			'imagelib'		=> $_G['setting']['imagelib'],
			'imageimpath'		=> $_G['setting']['imageimpath'],
			'thumbquality'		=> $_G['setting']['thumbquality'],
			'watermarkstatus'	=> dunserialize($_G['setting']['watermarkstatus']),
			'watermarkminwidth'	=> dunserialize($_G['setting']['watermarkminwidth']),
			'watermarkminheight'	=> dunserialize($_G['setting']['watermarkminheight']),
			'watermarktype'		=> $_G['setting']['watermarktype'],
			'watermarktext'		=> $_G['setting']['watermarktext'],
			'watermarktrans'	=> dunserialize($_G['setting']['watermarktrans']),
			'watermarkquality'	=> dunserialize($_G['setting']['watermarkquality']),
		);
	}
Esempio n. 13
0
 function block_xml($xmlid = null)
 {
     if (!empty($xmlid)) {
         if (!($blockxml = C::t('common_block_xml')->fetch($xmlid))) {
             return;
         }
         $this->blockdata = $blockxml;
         $this->blockdata['data'] = (array) dunserialize($blockxml['data']);
     } else {
         foreach (C::t('common_block_xml')->range() as $value) {
             $one = $value;
             $one['data'] = (array) dunserialize($value['data']);
             $this->blockdata[] = $one;
         }
     }
 }
Esempio n. 14
0
 public function getCloudApps($cache = true)
 {
     $apps = array();
     if ($cache) {
         global $_G;
         $apps = $_G['setting']['cloud_apps'];
     } else {
         $apps = C::t('common_setting')->fetch('cloud_apps', true);
     }
     if (!$apps) {
         $apps = array();
     }
     if (!is_array($apps)) {
         $apps = dunserialize($apps);
     }
     unset($apps[0]);
     return $apps;
 }
Esempio n. 15
0
 public static function manage_addnotify($type, $from_num = 0, $langvar = array())
 {
     global $_G;
     $notifyusers = dunserialize($_G['setting']['notifyusers']);
     $notifytypes = explode(',', $_G['setting']['adminnotifytypes']);
     $notifytypes = array_flip($notifytypes);
     $notearr = array('from_id' => 1, 'from_idtype' => $type, 'from_num' => $from_num);
     if ($langvar) {
         $langkey = $langvar['langkey'];
         $notearr = array_merge($notearr, $langvar);
     } else {
         $langkey = 'manage_' . $type;
     }
     foreach ($notifyusers as $uid => $user) {
         if ($user['types'][$notifytypes[$type]]) {
             helper_notification::notification_add($uid, $type, $langkey, $notearr, 1);
         }
     }
 }
Esempio n. 16
0
function seo_set()
{
    global $head_url;
    if (!submitcheck('submit')) {
        $info = pick_common_get();
        $info['open_seo_mod'] = dunserialize($info['open_seo_mod']);
        $info['open_seo_mod_show'][0] = in_array(1, $info['open_seo_mod']) ? 1 : 0;
        //门户
        $info['open_seo_mod_show'][1] = in_array(2, $info['open_seo_mod']) ? 1 : 0;
        //论坛
        $info['open_seo_mod_show'][2] = in_array(3, $info['open_seo_mod']) ? 1 : 0;
        //博客
        $info = dhtmlspecialchars($info);
        return $info;
    } else {
        $set = $_GET['set'];
        $set['open_seo_mod'] = serialize($set['open_seo_mod']);
        pick_common_set($set);
        cpmsg(milu_lang('op_success'), PICK_GO . "seo", 'succeed');
    }
}
Esempio n. 17
0
 public function get($key)
 {
     if (!$this->enable) {
         return false;
     }
     $fd = 'dateline,cname,data';
     if (is_array($key)) {
         $lostcaches = array();
         $arr = DB::fetch_all("SELECT {$fd} FROM " . DB::table('cache') . " WHERE " . DB::field('cname', $key), "cname");
         foreach ($arr as $k => $v) {
             if ($v['dateline'] > 0 && TIMESTAMP > $v['dateline']) {
                 $lostcaches[$v['cname']] = false;
             } else {
                 $lostcaches[$v['cname']] = $v['data'] ? unserialize($v['data']) : NULL;
             }
         }
         return $lostcaches;
     }
     $rs = DB::fetch_first("SELECT {$fd} FROM " . DB::table('cache') . " WHERE cname= '{$key}'");
     $data = $rs['data'] ? dunserialize($rs['data']) : NULL;
     return $data;
 }
function updateusercredit($uid, $type, $level)
{
    $uid = intval($uid);
    if (!$uid || !in_array($type, array('buyercredit', 'sellercredit')) || !in_array($level, array('good', 'soso', 'bad'))) {
        return;
    }
    if ($cache = C::t('forum_spacecache')->fetch($uid, $type)) {
        $expiration = $cache['expiration'];
        $cache = dunserialize($cache['value']);
    } else {
        $init = array('good' => 0, 'soso' => 0, 'bad' => 0, 'total' => 0);
        $cache = array('all' => $init, 'before' => $init, 'halfyear' => $init, 'thismonth' => $init, 'thisweek' => $init);
        $expiration = getexpiration();
    }
    foreach (array('all', 'before', 'halfyear', 'thismonth', 'thisweek') as $key) {
        $cache[$key][$level]++;
        $cache[$key]['total']++;
    }
    C::t('forum_spacecache')->insert(array('uid' => $uid, 'variable' => $type, 'value' => serialize($cache), 'expiration' => $expiration), false, true);
    $score = $level == 'good' ? 1 : ($level == 'soso' ? 0 : -1);
    C::t('common_member_status')->increase($uid, array($type => $score));
}
Esempio n. 19
0
	function global_footer(){		
		global $_G;
		extract($_G['cache']['plugin']['pao_reply_robot']);
		if($switch && date('H')>=$jointime && date('H')<=$overtime && CURSCRIPT=='forum'){
			$forums = dunserialize($forums);
			$groups = dunserialize($groups);
			$limits = $limits ? (intval($limits)<1 ? 1 : intval($limits)) : 10;
			$percent = array('trigger'=>$limits / 100,'standby'=>(100-$limits)/100);			
			if(count($forums)>0 && count($groups)>0 && $this->percent($percent)=='trigger'){				
				$timestamp = TIMESTAMP;				
				$postes = preg_split("/[\r\n]/", $posts, -1, PREG_SPLIT_NO_EMPTY);
				$groups = implode(',', $groups);
				$forums = implode(',', $forums);
				$indays = $indays ? strtotime("-{$indays} day") : '';
				$indays = $indays ? " AND dateline>". $indays : '';
				$maxpost = $maxpost ? " AND replies<".$maxpost : '';
				$attach = $attach ? " AND attachment>0" : '';	
				$thread = DB::fetch_all("SELECT tid,fid,subject FROM ".DB::table('forum_thread')." WHERE closed=0 AND displayorder>=0 AND fid IN ($forums) {$attach} {$indays} {$maxpost} ORDER BY RAND() LIMIT {$limits}"); 
				foreach ($thread as $td) {
					$member = $this->member($groups);
					$fid = $td['fid'];
					$tid = $td['tid'];
					$uid = $member['uid'];
					$username = $member['username'];
					$message = $postes[array_rand($postes)];
					$lastpost = "{$td['tid']}\t".addslashes($td['subject'])."\t{$timestamp}\t{$username}";
					//updatemembercount($uid, array($extctype => $extcnum));╗§ио
					$pid = insertpost(array('fid' => $fid,'tid' => $tid,'first' => '0','author' => $username,'authorid' => $uid,'dateline' => $timestamp,'message' => $message,'useip' => '','invisible' => '0','anonymous' => '0','usesig' => 1,'htmlon' => '0','bbcodeoff' => 0,'smileyoff' => '0','parseurloff' => '0','attachment' => '0'));
					DB::query("UPDATE ".DB::table('forum_forum')." SET lastpost='$lastpost',posts=posts+1,todayposts=todayposts+1 WHERE fid='$fid'", 'UNBUFFERED');
					DB::query("UPDATE ".DB::table('forum_thread')." SET lastpost='$timestamp',replies=replies+1,views=views+'$views',lastposter='$username' WHERE tid='$tid'", 'UNBUFFERED');
					DB::query("UPDATE ".DB::table('common_member_status')." SET lastpost='$timestamp',lastactivity='$timestamp',lastvisit='$timestamp' WHERE uid='$uid'", 'UNBUFFERED');
					DB::query("UPDATE ".DB::table('common_member_count')." SET posts=posts+1 WHERE uid='$uid'", 'UNBUFFERED');					
				}
							
			}
			return;
		}

	}
Esempio n. 20
0
 function plugin_myrepeats()
 {
     global $_G;
     if (!$_G['uid']) {
         return;
     }
     $myrepeatsusergroups = (array) dunserialize($_G['cache']['plugin']['myrepeats']['usergroups']);
     if (in_array('', $myrepeatsusergroups)) {
         $myrepeatsusergroups = array();
     }
     $userlist = array();
     if (!in_array($_G['groupid'], $myrepeatsusergroups)) {
         if (!isset($_G['cookie']['myrepeat_rr'])) {
             $users = count(C::t('#myrepeats#myrepeats')->fetch_all_by_username($_G['username']));
             dsetcookie('myrepeat_rr', 'R' . $users, 86400);
         } else {
             $users = substr($_G['cookie']['myrepeat_rr'], 1);
         }
         if (!$users) {
             return '';
         }
     }
     $this->value['global_usernav_extra1'] = '<script>' . 'function showmyrepeats() {if(!$(\'myrepeats_menu\')) {' . 'menu=document.createElement(\'div\');menu.id=\'myrepeats_menu\';menu.style.display=\'none\';menu.className=\'p_pop\';' . '$(\'append_parent\').appendChild(menu);' . 'ajaxget(\'plugin.php?id=myrepeats:switch&list=yes\',\'myrepeats_menu\',\'ajaxwaitid\');}' . 'showMenu({\'ctrlid\':\'myrepeats\',\'duration\':2});}' . '</script>' . '<span class="pipe">|</span><a id="myrepeats" href="home.php?mod=spacecp&ac=plugin&id=myrepeats:memcp" class="showmenu cur1" onmouseover="delayShow(this, showmyrepeats)">' . lang('plugin/myrepeats', 'switch') . '</a>' . "\n";
 }
Esempio n. 21
0
 public function update($cachename)
 {
     global $_G;
     $sys = true;
     //$syn = false,代表不写入缓存,每次都读取
     if (strpos($cachename, '_cate') !== false) {
         $tmp = explode('_', $cachename);
         $cate = new cate($tmp[0], $tmp[0]);
         $cache_data = $cate->get_cate();
         $this->set($cachename, $cache_data, true, 1);
         return $cache_data;
     }
     switch ($cachename) {
         case 'all_channel':
             $all_channel = DB::fetch_all("SELECT * FROM " . DB::table('channel') . " ORDER BY `sort` DESC,fid ASC ", 'fid');
             $tmp = array();
             foreach ($all_channel as $k => $v) {
                 $v[org_url] = $v[url];
                 $v[url] = '/index.php?fid=' . $v[fid];
                 $tmp['k' . $k] = $v;
             }
             $cache_data = $tmp;
             break;
         case 'channels':
             $all_channel = DB::fetch_all("SELECT * FROM " . DB::table('channel') . " ORDER BY `sort` DESC,fid ASC ", 'fid');
             $channel = array();
             //一级
             foreach ($all_channel as $k => $v) {
                 if ($v[fup] == 0) {
                     //$v[count] = getcount('goods'," AND fid = ".$v[fid]);
                     $v[org_url] = $v[url];
                     $v[url] = '/index.php?fid=' . $v[fid];
                     $channel[$k] = $v;
                 }
             }
             //二级
             $tmps = $all_channel;
             foreach ($channel as $k => $v) {
                 $sub = array();
                 $fid_in = array();
                 unset($tmps[$v[fid]]);
                 foreach ($all_channel as $kk => $vv) {
                     if ($vv['fup'] == $k) {
                         //$vv[count] = getcount('goods'," AND fid = ".$vv[fid]);
                         $vv[org_url] = $vv[url];
                         $vv[url] = '/index.php?fid=' . $vv[fid];
                         $sub[$kk] = $vv;
                         //二级栏目
                         $fid_in2 = array();
                         unset($tmps[$vv[fid]]);
                         foreach ($all_channel as $k3 => $v3) {
                             if ($v3['fup'] == $kk) {
                                 $v3[org_url] = $v3[url];
                                 $v3[url] = '/index.php?fid=' . $v3[fid];
                                 //$v3[count] = getcount('goods'," AND fid = ".$v3[fid]);
                                 unset($tmps[$v3[fid]]);
                                 $sub[$kk]['sub'][$k3] = $v3;
                                 //三级栏目
                                 $fid_in2[] = $v3['fid'];
                                 $fid_in[] = $v3['fid'];
                                 $sub[$kk]['sub'][$k3]['fid_in'] = $v3['fid'];
                             }
                         }
                         $fid_in[] = $vv['fid'];
                         $fid_in2[] = $vv['fid'];
                         $sub[$kk]['fid_in'] = implode(',', $fid_in2);
                     }
                 }
                 $fid_in[] = $v['fid'];
                 $channel[$k]['fid_in'] = implode(',', $fid_in);
                 if ($sub) {
                     $channel[$k]['sub'] = $sub;
                 }
             }
             if (count($tmps) > 0) {
                 foreach ($tmps as $k => $v) {
                     if (!array_key_exists($k)) {
                         $v[fid_in] = $v[fid];
                         $channel[$k] = $v;
                     }
                 }
             }
             $cache_data = $channel;
             break;
         case 'setting':
             set_setting('time', TIMESTAMP);
             $st = DB::fetch_all("SELECT * FROM " . DB::table('setting'));
             foreach ($st as $k => $v) {
                 $setting[$v['name']] = $v['value'];
             }
             if ($setting['qq']) {
                 $setting['qq'] = explode(',', $setting['qq']);
             }
             if ($setting['flag']) {
                 $setting['flag'] = explode(',', $setting['flag']);
                 $setting['flag'] = array_filter($setting['flag']);
             }
             if ($setting['shop_tag']) {
                 $setting['shop_tag'] = explode(',', $setting['shop_tag']);
                 $setting['shop_tag'] = array_filter($setting['shop_tag']);
             }
             if ($setting['goods_tag']) {
                 $setting['goods_tag'] = explode(',', $setting['goods_tag']);
                 $setting['goods_tag'] = array_filter($setting['goods_tag']);
             }
             if ($setting['article_tag']) {
                 $setting['article_tag'] = explode(',', $setting['article_tag']);
                 $setting['article_tag'] = array_filter($setting['article_tag']);
             }
             if ($setting['filter_field']) {
                 $setting['filter_field'] = explode(',', $setting['filter_field']);
             }
             if ($setting['shiyong_status']) {
                 $setting['shiyong_status'] = explode(',', $setting['shiyong_status']);
             }
             if ($setting['duihuan_status']) {
                 $setting['duihuan_status'] = explode(',', $setting['duihuan_status']);
             }
             if ($setting['shiyong_tags']) {
                 $setting['shiyong_tags'] = explode(',', $setting['shiyong_tags']);
             }
             if ($setting['activity_tags']) {
                 $setting['activity_tags'] = explode(',', $setting['activity_tags']);
             }
             if ($setting['style_tags']) {
                 $setting['style_tags'] = explode(',', $setting['style_tags']);
             }
             if ($setting['movie_tags']) {
                 $setting['movie_tags'] = explode(',', $setting['movie_tags']);
             }
             if ($setting['zj_tags']) {
                 $setting['zj_tags'] = explode(',', $setting['zj_tags']);
             }
             if ($setting['shishang_flag']) {
                 $setting['shishang_flag'] = explode(',', $setting['shishang_flag']);
             }
             if ($setting['tags']) {
                 $setting['tags'] = explode(',', $setting['tags']);
                 $tags = array();
                 foreach ($setting['tags'] as $k => $v) {
                     $uname = urlencode_utf8($v);
                     $tags[$uname] = $v;
                 }
                 $setting['tags'] = $tags;
             }
             if ($setting['sign_jf']) {
                 $setting['sign_jf'] = (array) dunserialize($setting['sign_jf']);
             }
             if ($setting['sign_tb']) {
                 $setting['sign_tb'] = (array) dunserialize($setting['sign_tb']);
             }
             if ($setting['syn_table']) {
                 $setting['syn_table'] = explode(',', $setting['syn_table']);
             }
             if ($setting['syn_domain']) {
                 $setting['syn_domain'] = explode("\r\n", $setting['syn_domain']);
             }
             if ($setting['uz_tag']) {
                 $setting['uz_tag'] = explode(',', $setting['uz_tag']);
             }
             if ($setting['uz_type']) {
                 $setting['uz_type'] = explode(',', $setting['uz_type']);
             }
             $setting['time'] = TIMESTAMP;
             if ($setting['email']) {
                 $setting['email'] = (array) dunserialize($setting['email']);
             }
             $cache_data = $setting;
             break;
         case 'friend_link':
             //友情链接
             $friend_link = DB::fetch_all("SELECT * FROM " . DB::table('friend_link') . " ORDER BY sort DESC,id DESC", 'id');
             foreach ($friend_link as $k => $v) {
                 $friend_link[$k]['dateline'] = dgmdate($v['dateline'], 'u');
             }
             $cache_data = $friend_link;
             break;
         case 'pics_type':
             $cache_data = DB::fetch_all("SELECT * FROM " . DB::table('pics_type') . " ORDER BY id DESC", 'id');
             break;
         case 'pics':
             $pics_type = DB::fetch_all("SELECT * FROM " . DB::table('pics_type') . " ORDER BY id DESC", 'id');
             $pics_tmp = DB::fetch_all("SELECT * FROM " . DB::table('pics') . " ORDER BY sort ASC,id DESC ", 'id');
             $pics = array();
             foreach ($pics_type as $k => $v) {
                 $pics[$k] = array();
                 foreach ($pics_tmp as $k1 => $v1) {
                     $v1['org_dateline'] = $v1['dateline'];
                     $v1['dateline'] = dgmdate($v1['dateline'], 'u');
                     if ($v1['fup'] == $k) {
                         $pics[$k][$k1] = $v1;
                     }
                 }
             }
             $cache_data = set_key($pics);
             break;
         case 'ad':
             $ad = DB::fetch_all("SELECT * FROM " . DB::table('ad') . " ORDER BY id DESC ", 'id');
             foreach ($ad as $k => $v) {
                 $ad[$k]['org_dateline'] = $v[dateline];
                 $ad[$k]['dateline'] = dgmdate($v[dateline], 'u');
                 $ad[$k]['start_time'] = dgmdate($v[start_time], 'dt');
                 $ad[$k]['end_time'] = dgmdate($v[end_time], 'dt');
                 $ad[$k]['show'] = false;
                 $ad[$k]['show_html'] = '';
                 //先判断是否在显示时间内
                 $show = 0;
                 if ($v['start_time'] < TIMESTAMP && ($v['end_time'] == 0 || $v['end_time'] > TIMESTAMP)) {
                     $show = 1;
                 }
                 if ($show == true && $v['hide'] == 0) {
                     $html = '';
                     if ($v['type'] == 1) {
                         $html = $v['content'];
                     } elseif ($v['type'] == 2) {
                         $width = $v['width'] > 0 ? "width='" . $v['width'] . "'" : '';
                         $height = $v['height'] > 0 ? "height='" . $v['height'] . "'" : '';
                         $img = "<img class='ads_" . $k . "' src='" . $v['picurl'] . "' " . $width . "" . $height . " />";
                         if ($v['url']) {
                             $target = $v['target'] == 1 ? "target='_blank'" : '';
                             $html = "<a href='" . $v['url'] . "' " . $target . " >" . $img . "</a>";
                         } else {
                             $html = $img;
                         }
                     } else {
                         $html = $v['html'];
                     }
                     if (!empty($html)) {
                         $ad[$k]['show'] = true;
                         $ad[$k]['show_html'] = $html;
                     } else {
                         $ad[$k]['show_html'] = '';
                     }
                 }
             }
             $cache_data = set_key($ad);
             break;
         case 'goods_cate':
             $cate = new cate('goods', 'goods');
             $cache_data = $cate->get_cate();
             break;
         case 'shop':
             $shop = DB::fetch_all("SELECT * FROM " . DB::table('shop') . " ORDER BY sort DESC,id DESC", 'id');
             foreach ($shop as $k => $v) {
                 $shop[$k] = parse('shop', $v);
             }
             $cache_data = $shop;
             break;
         case 'shop_cate':
             $cate = new cate('shop', 'shop');
             $cache_data = $cate->get_cate();
             break;
         case 'prize':
             $rs = DB::fetch_all("SELECT * FROM " . DB::table('prize') . " ORDER BY sort DESC ,id DESC ", 'id');
             foreach ($rs as $k => $v) {
                 //统计每个分类,还未中奖的中奖码..
                 $rs[$k][num] = $rs[$k][count] = getcount('ticket', "prizeid = " . $v[id] . " AND is_use=0");
                 $rs[$k][total] = getcount('ticket', "prizeid = " . $v[id]);
             }
             $cache_data = $rs;
             break;
         case 'table':
             $cache_data = update_table();
             break;
         case 'group':
             $rs = DB::fetch_all("SELECT * FROM " . DB::table('group') . " ORDER BY id ASC", 'id');
             foreach ($rs as $k => $v) {
                 $rs[$k][power] = dunserialize($v['power']);
             }
             $cache_data = $rs;
             break;
         case 'rank':
             $rs = DB::fetch_all("SELECT * FROM " . DB::table('rank') . " ORDER BY id ASC", 'id');
             $cache_data = $rs;
             break;
         default:
             $sys = false;
             $cache_data = '';
             break;
     }
     if ($sys == true) {
         $this->set($cachename, $cache_data, true, 1);
     }
     return $cache_data;
 }
Esempio n. 22
0
 public function newthread($parameters)
 {
     require_once libfile('function/post');
     $this->tid = $this->pid = 0;
     $this->_init_parameters($parameters);
     if (trim($this->param['subject']) == '') {
         return $this->showmessage('post_sm_isnull');
     }
     if (!$this->param['sortid'] && !$this->param['special'] && trim($this->param['message']) == '') {
         return $this->showmessage('post_sm_isnull');
     }
     list($this->param['modnewthreads'], $this->param['modnewreplies']) = threadmodstatus($this->param['subject'] . "\t" . $this->param['message'] . $this->param['extramessage']);
     if ($post_invalid = checkpost($this->param['subject'], $this->param['message'], $this->param['special'] || $this->param['sortid'])) {
         return $this->showmessage($post_invalid, '', array('minpostsize' => $this->setting['minpostsize'], 'maxpostsize' => $this->setting['maxpostsize']));
     }
     if (checkflood()) {
         return $this->showmessage('post_flood_ctrl', '', array('floodctrl' => $this->setting['floodctrl']));
     } elseif (checkmaxperhour('tid')) {
         return $this->showmessage('thread_flood_ctrl_threads_per_hour', '', array('threads_per_hour' => $this->group['maxthreadsperhour']));
     }
     $this->param['save'] = $this->member['uid'] ? $this->param['save'] : 0;
     $this->param['typeid'] = isset($this->param['typeid']) && isset($this->forum['threadtypes']['types'][$this->param['typeid']]) && (!$this->forum['threadtypes']['moderators'][$this->param['typeid']] || $this->forum['ismoderator']) ? $this->param['typeid'] : 0;
     $this->param['displayorder'] = $this->param['modnewthreads'] ? -2 : ($this->forum['ismoderator'] && $this->group['allowstickthread'] && !empty($this->param['sticktopic']) ? 1 : (empty($this->param['save']) ? 0 : -4));
     if ($this->param['displayorder'] == -2) {
         C::t('forum_forum')->update($this->forum['fid'], array('modworks' => '1'));
     }
     $this->param['digest'] = $this->forum['ismoderator'] && $this->group['allowdigestthread'] && !empty($this->param['digest']) ? 1 : 0;
     $this->param['readperm'] = $this->group['allowsetreadperm'] ? $this->param['readperm'] : 0;
     $this->param['isanonymous'] = $this->group['allowanonymous'] && $this->param['isanonymous'] ? 1 : 0;
     $this->param['price'] = intval($this->param['price']);
     if (!$this->param['special']) {
         $this->param['price'] = $this->group['maxprice'] ? $this->param['price'] <= $this->group['maxprice'] ? $this->param['price'] : $this->group['maxprice'] : 0;
     }
     if (!$this->param['typeid'] && $this->forum['threadtypes']['required'] && !$this->param['special']) {
         return $this->showmessage('post_type_isnull');
     }
     if (!$this->param['sortid'] && $this->forum['threadsorts']['required'] && !$this->param['special']) {
         return $this->showmessage('post_sort_isnull');
     }
     if (!$this->param['special'] && $this->param['price'] > 0 && floor($this->param['price'] * (1 - $this->setting['creditstax'])) == 0) {
         return $this->showmessage('post_net_price_iszero');
     }
     $this->param['sortid'] = $this->param['special'] && $this->forum['threadsorts']['types'][$this->param['sortid']] ? 0 : $this->param['sortid'];
     $this->param['typeexpiration'] = intval($this->param['typeexpiration']);
     if ($this->forum['threadsorts']['expiration'][$this->param['typeid']] && !$this->param['typeexpiration']) {
         return $this->showmessage('threadtype_expiration_invalid');
     }
     $author = !$this->param['isanonymous'] ? $this->member['username'] : '';
     $this->param['moderated'] = $this->param['digest'] || $this->param['displayorder'] > 0 ? 1 : 0;
     $this->param['ordertype'] && ($this->param['tstatus'] = setstatus(4, 1, $this->param['tstatus']));
     $this->param['imgcontent'] && ($this->param['tstatus'] = setstatus(15, $this->param['imgcontent'], $this->param['tstatus']));
     $this->param['hiddenreplies'] && ($this->param['tstatus'] = setstatus(2, 1, $this->param['tstatus']));
     $this->param['allownoticeauthor'] && ($this->param['tstatus'] = setstatus(6, 1, $this->param['tstatus']));
     $this->param['isgroup'] = $this->forum['status'] == 3 ? 1 : 0;
     $this->param['publishdate'] = !$this->param['modnewthreads'] ? $this->param['publishdate'] : TIMESTAMP;
     $newthread = array('fid' => $this->forum['fid'], 'posttableid' => 0, 'readperm' => $this->param['readperm'], 'price' => $this->param['price'], 'typeid' => $this->param['typeid'], 'sortid' => $this->param['sortid'], 'author' => $author, 'authorid' => $this->member['uid'], 'subject' => $this->param['subject'], 'dateline' => $this->param['publishdate'], 'lastpost' => $this->param['publishdate'], 'lastposter' => $author, 'displayorder' => $this->param['displayorder'], 'digest' => $this->param['digest'], 'special' => $this->param['special'], 'attachment' => 0, 'moderated' => $this->param['moderated'], 'status' => $this->param['tstatus'], 'isgroup' => $this->param['isgroup'], 'replycredit' => $this->param['replycredit'], 'closed' => $this->param['closed'] ? 1 : 0);
     $this->tid = C::t('forum_thread')->insert($newthread, true);
     C::t('forum_newthread')->insert(array('tid' => $this->tid, 'fid' => $this->forum['fid'], 'dateline' => $this->param['publishdate']));
     useractionlog($this->member['uid'], 'tid');
     if (!getuserprofile('threads') && $this->setting['newbie']) {
         C::t('forum_thread')->update($this->tid, array('icon' => $this->setting['newbie']));
     }
     if ($this->param['publishdate'] != TIMESTAMP) {
         $cron_publish_ids = dunserialize($this->cache('cronpublish'));
         $cron_publish_ids[$this->tid] = $this->tid;
         $cron_publish_ids = serialize($cron_publish_ids);
         savecache('cronpublish', $cron_publish_ids);
     }
     if (!$this->param['isanonymous']) {
         C::t('common_member_field_home')->update($this->member['uid'], array('recentnote' => $this->param['subject']));
     }
     if ($this->param['moderated']) {
         updatemodlog($this->tid, $this->param['displayorder'] > 0 ? 'STK' : 'DIG');
         updatemodworks($this->param['displayorder'] > 0 ? 'STK' : 'DIG', 1);
     }
     $this->param['bbcodeoff'] = checkbbcodes($this->param['message'], !empty($this->param['bbcodeoff']));
     $this->param['smileyoff'] = checksmilies($this->param['message'], !empty($this->param['smileyoff']));
     $this->param['parseurloff'] = !empty($this->param['parseurloff']);
     $this->param['htmlon'] = $this->group['allowhtml'] && !empty($this->param['htmlon']) ? 1 : 0;
     $this->param['usesig'] = !empty($this->param['usesig']) && $this->group['maxsigsize'] ? 1 : 0;
     $class_tag = new tag();
     $this->param['tagstr'] = $class_tag->add_tag($this->param['tags'], $this->tid, 'tid');
     $this->param['pinvisible'] = $this->param['modnewthreads'] ? -2 : (empty($this->param['save']) ? 0 : -3);
     $this->param['message'] = preg_replace('/\\[attachimg\\](\\d+)\\[\\/attachimg\\]/is', '[attach]\\1[/attach]', $this->param['message']);
     $this->param['pstatus'] = intval($this->param['pstatus']);
     defined('IN_MOBILE') && ($this->param['pstatus'] = setstatus(4, 1, $this->param['pstatus']));
     if ($this->param['imgcontent']) {
         stringtopic($this->param['message'], $this->tid, true, $this->param['imgcontentwidth']);
     }
     $this->pid = insertpost(array('fid' => $this->forum['fid'], 'tid' => $this->tid, 'first' => '1', 'author' => $this->member['username'], 'authorid' => $this->member['uid'], 'subject' => $this->param['subject'], 'dateline' => $this->param['publishdate'], 'message' => $this->param['message'], 'useip' => $this->param['clientip'] ? $this->param['clientip'] : getglobal('clientip'), 'port' => $this->param['remoteport'] ? $this->param['remoteport'] : getglobal('remoteport'), 'invisible' => $this->param['pinvisible'], 'anonymous' => $this->param['isanonymous'], 'usesig' => $this->param['usesig'], 'htmlon' => $this->param['htmlon'], 'bbcodeoff' => $this->param['bbcodeoff'], 'smileyoff' => $this->param['smileyoff'], 'parseurloff' => $this->param['parseurloff'], 'attachment' => '0', 'tags' => $this->param['tagstr'], 'replycredit' => 0, 'status' => $this->param['pstatus']));
     $statarr = array(0 => 'thread', 1 => 'poll', 2 => 'trade', 3 => 'reward', 4 => 'activity', 5 => 'debate', 127 => 'thread');
     include_once libfile('function/stat');
     updatestat($this->param['isgroup'] ? 'groupthread' : $statarr[$this->param['special']]);
     if ($this->param['geoloc'] && IN_MOBILE == 2) {
         list($mapx, $mapy, $location) = explode('|', $this->param['geoloc']);
         if ($mapx && $mapy && $location) {
             C::t('forum_post_location')->insert(array('pid' => $this->pid, 'tid' => $this->tid, 'uid' => $this->member['uid'], 'mapx' => $mapx, 'mapy' => $mapy, 'location' => $location));
         }
     }
     if ($this->param['modnewthreads']) {
         updatemoderate('tid', $this->tid);
         C::t('forum_forum')->update_forum_counter($this->forum['fid'], 0, 0, 1);
         manage_addnotify('verifythread');
         return 'post_newthread_mod_succeed';
     } else {
         if ($this->param['displayorder'] != -4) {
             if ($this->param['digest']) {
                 updatepostcredits('+', $this->member['uid'], 'digest', $this->forum['fid']);
             }
             updatepostcredits('+', $this->member['uid'], 'post', $this->forum['fid']);
             if ($this->param['isgroup']) {
                 C::t('forum_groupuser')->update_counter_for_user($this->member['uid'], $this->forum['fid'], 1);
             }
             $subject = str_replace("\t", ' ', $this->param['subject']);
             $lastpost = "{$this->tid}\t" . $subject . "\t" . TIMESTAMP . "\t{$author}";
             C::t('forum_forum')->update($this->forum['fid'], array('lastpost' => $lastpost));
             C::t('forum_forum')->update_forum_counter($this->forum['fid'], 1, 1, 1);
             if ($this->forum['type'] == 'sub') {
                 C::t('forum_forum')->update($this->forum['fup'], array('lastpost' => $lastpost));
             }
         }
         if ($this->param['isgroup']) {
             C::t('forum_forumfield')->update($this->forum['fid'], array('lastupdate' => TIMESTAMP));
             require_once libfile('function/grouplog');
             updategroupcreditlog($this->forum['fid'], $this->member['uid']);
         }
         C::t('forum_sofa')->insert(array('tid' => $this->tid, 'fid' => $this->forum['fid']));
         return 'post_newthread_succeed';
     }
 }
Esempio n. 23
0
function getuserdiydata($space)
{
    global $_G;
    if (empty($_G['blockposition'])) {
        $userdiy = getuserdefaultdiy();
        if (!empty($space['blockposition'])) {
            $blockdata = dunserialize($space['blockposition']);
            foreach ((array) $blockdata as $key => $value) {
                if ($key == 'parameters') {
                    foreach ((array) $value as $k => $v) {
                        if (!empty($v)) {
                            $userdiy[$key][$k] = $v;
                        }
                    }
                } else {
                    if (!empty($value)) {
                        $userdiy[$key] = $value;
                    }
                }
            }
        }
        $_G['blockposition'] = $userdiy;
    }
    return $_G['blockposition'];
}
Esempio n. 24
0
                 $feed_hash_data = 'albumid' . $share['itemid'];
                 $share['title_template'] = lang('spacecp', 'share_album');
                 break;
             case 'pic':
                 $feed_hash_data = 'picid' . $share['itemid'];
                 $share['title_template'] = lang('spacecp', 'share_image');
                 break;
             case 'article':
                 $feed_hash_data = 'articleid' . $share['itemid'];
                 $share['title_template'] = lang('spacecp', 'share_article');
                 break;
             case 'link':
                 $feed_hash_data = '';
                 break;
         }
         feed_add('share', '{actor} ' . $share['title_template'], array('hash_data' => $feed_hash_data), $share['body_template'], dunserialize($share['body_data']), $share['body_general'], array($share['image']), array($share['image_link']), '', '', '', 0, 0, '', $share['uid'], $share['username']);
     }
     updatemoderate('sid', $moderation['validate'], 2);
 }
 if (!empty($moderation['delete'])) {
     require libfile('function/delete');
     $shares = deleteshares($moderation['delete']);
     $deletes = count($shares);
     updatemoderate('sid', $moderation['delete'], 2);
 }
 if ($ignore_sids = dimplode($moderation['ignore'])) {
     $ignores = C::t('home_share')->update($moderation['ignore'], array('status' => 2));
     updatemoderate('sid', $moderation['ignore'], 1);
 }
 if ($_GET['fast']) {
     echo callback_js($_GET['sid']);
Esempio n. 25
0
    $recommendv = $_G['group']['allowrecommend'] > 0 ? '+' . $_G['group']['allowrecommend'] : $_G['group']['allowrecommend'];
    if ($_G['setting']['recommendthread']['daycount']) {
        $daycount = $_G['setting']['recommendthread']['daycount'] - $recommendcount;
        showmessage('recommend_daycount_succed', '', array('recommendv' => $recommendv, 'recommendc' => $thread['recommends'], 'daycount' => $daycount), array('msgtype' => 3));
    } else {
        showmessage('recommend_succed', '', array('recommendv' => $recommendv, 'recommendc' => $thread['recommends']), array('msgtype' => 3));
    }
} elseif ($_GET['action'] == 'protectsort') {
    $tid = $_GET['tid'];
    $optionid = $_GET['optionid'];
    include template('common/header_ajax');
    $typeoptionvarvalue = C::t('forum_typeoptionvar')->fetch_all_by_tid_optionid($tid, $optionid);
    $typeoptionvarvalue[0]['expiration'] = $typeoptionvarvalue[0]['expiration'] && $typeoptionvarvalue[0]['expiration'] <= TIMESTAMP ? 1 : 0;
    $option = C::t('forum_typeoption')->fetch($optionid);
    if ($option['expiration'] && !$typeoptionvarvalue[0]['expiration'] || empty($option['expiration'])) {
        $protect = dunserialize($option['protect']);
        include_once libfile('function/threadsort');
        if (protectguard($protect)) {
            if (empty($option['permprompt'])) {
                echo lang('forum/misc', 'view_noperm');
            } else {
                echo $option['permprompt'];
            }
        } else {
            echo nl2br($typeoptionvarvalue[0]['value']);
        }
    } else {
        echo lang('forum/misc', 'has_expired');
    }
    include template('common/footer_ajax');
} elseif ($_GET['action'] == 'usertag') {
Esempio n. 26
0
     $_GET['url'] = '';
 }
 if (substr($_GET['fromurl'], 0, 7) !== 'http://') {
     $_GET['fromurl'] = '';
 }
 if (censormod($_POST['title']) || $_G['group']['allowpostarticlemod']) {
     $article_status = 1;
 } else {
     $article_status = 0;
 }
 $setarr = array('title' => $_POST['title'], 'author' => $_GET['author'], 'from' => $_GET['from'], 'fromurl' => $_GET['fromurl'], 'dateline' => intval($_GET['dateline']), 'url' => $_GET['url'], 'allowcomment' => !empty($_POST['forbidcomment']) ? '0' : '1', 'summary' => $summary, 'catid' => intval($_POST['catid']), 'tag' => article_make_tag($_POST['tag']), 'status' => $article_status, 'highlight' => $style, 'showinnernav' => empty($_POST['showinnernav']) ? '0' : '1');
 if (empty($setarr['catid'])) {
     showmessage('article_choose_system_category');
 }
 if ($_GET['conver']) {
     $converfiles = dunserialize($_GET['conver']);
     $setarr['pic'] = $converfiles['pic'];
     $setarr['thumb'] = intval($converfiles['thumb']);
     $setarr['remote'] = intval($converfiles['remote']);
 }
 $id = 0;
 $idtype = '';
 if (empty($article)) {
     $setarr['uid'] = $_G['uid'];
     $setarr['username'] = $_G['username'];
     $setarr['id'] = intval($_POST['id']);
     $setarr['htmlname'] = $htmlname;
     $table = '';
     if ($setarr['id']) {
         if ($_POST['idtype'] == 'blogid') {
             $table = 'home_blogfield';
Esempio n. 27
0
if (helper_access::check_module('album') && $_G['group']['allowupload'] && $_G['uid']) {
    $query = C::t('home_album')->fetch_all_by_uid($_G['uid'], 'updatetime');
    foreach ($query as $value) {
        if ($value['picnum']) {
            $albumlist[] = $value;
        }
    }
}
$posturl = "action={$_GET['action']}&fid={$_G['fid']}" . (!empty($_G['tid']) ? "&tid={$_G['tid']}" : '') . (!empty($pid) ? "&pid={$pid}" : '') . (!empty($special) ? "&special={$special}" : '') . (!empty($sortid) ? "&sortid={$sortid}" : '') . (!empty($typeid) ? "&typeid={$typeid}" : '') . (!empty($_GET['firstpid']) ? "&firstpid={$firstpid}" : '') . (!empty($_GET['addtrade']) ? "&addtrade={$addtrade}" : '');
if ($_GET['action'] == 'reply') {
    check_allow_action('allowreply');
} else {
    check_allow_action('allowpost');
}
if ($special == 4) {
    $_G['setting']['activityfield'] = $_G['setting']['activityfield'] ? dunserialize($_G['setting']['activityfield']) : array();
}
if (helper_access::check_module('album') && $_G['group']['allowupload'] && $_G['setting']['albumcategorystat'] && !empty($_G['cache']['albumcategory'])) {
    require_once libfile('function/portalcp');
}
$navtitle = lang('core', 'title_' . $_GET['action'] . '_post');
if ($_GET['action'] == 'newthread' || $_GET['action'] == 'newtrade') {
    loadcache('groupreadaccess');
    $navtitle .= ' - ' . $_G['forum']['name'];
    require_once libfile('post/newthread', 'include');
} elseif ($_GET['action'] == 'reply') {
    $navtitle .= ' - ' . $thread['subject'] . ' - ' . $_G['forum']['name'];
    require_once libfile('post/newreply', 'include');
} elseif ($_GET['action'] == 'edit') {
    loadcache('groupreadaccess');
    $navtitle .= ' - ' . $thread['subject'] . ' - ' . $_G['forum']['name'];
Esempio n. 28
0
 $timesql = '';
 if ($starttime) {
     $timesql .= " AND lastpost > {$starttime}";
     $nextlink .= '&starttime=' . $_GET['starttime'];
 }
 if ($endtime) {
     $timesql .= " AND lastpost < {$endtime}";
     $nextlink .= '&endtime=' . $_GET['endtime'];
 }
 $processed = 0;
 $foruminfo = C::t('forum_forum')->fetch_info_by_fid($fid);
 if (empty($foruminfo['picstyle'])) {
     cpmsg('counter_thread_cover_fidnopicstyle', 'action=counter', 'error');
 }
 if ($_G['setting']['forumpicstyle']) {
     $_G['setting']['forumpicstyle'] = dunserialize($_G['setting']['forumpicstyle']);
     empty($_G['setting']['forumpicstyle']['thumbwidth']) && ($_G['setting']['forumpicstyle']['thumbwidth'] = 214);
     empty($_G['setting']['forumpicstyle']['thumbheight']) && ($_G['setting']['forumpicstyle']['thumbheight'] = 160);
 } else {
     $_G['setting']['forumpicstyle'] = array('thumbwidth' => 214, 'thumbheight' => 160);
 }
 require_once libfile('function/post');
 $coversql = empty($allthread) ? 'AND cover=\'0\'' : '';
 $cover = empty($allthread) ? 0 : null;
 $_G['forum']['ismoderator'] = 1;
 foreach (C::t('forum_thread')->fetch_all_by_fid_cover_lastpost($fid, $cover, $starttime, $endtime, $current, $pertask) as $thread) {
     $processed = 1;
     $pid = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid'], 0);
     $pid = $pid['pid'];
     setthreadcover($pid);
 }
Esempio n. 29
0
function evo_rules_get_article($str, $rules_info)
{
    $rules_info['theme_get_type'] = $rules_info['theme_get_type'] ? $rules_info['theme_get_type'] : 1;
    $get = 0;
    if ($rules_info['theme_get_type'] == 1 && $rules_info['content_get_type'] == 1) {
        $re = dom_single_article($str, array('title' => $rules_info['theme_rules'], 'content' => $rules_info['content_rules']));
        $data['title'] = $re['title'];
        $data['content'] = $re['content'];
        $get = 1;
    }
    if ($get != 1) {
        if ($rules_info['theme_get_type'] == 1) {
            $re = dom_single_article($str, array('content' => $rules_info['content_rules']));
            $data['title'] = $re['title'];
        } else {
            if ($rules_info['theme_get_type'] == 2) {
                $re = pregmessage($str, $rules_info['theme_rules'], 'title', -1);
                $data['title'] = $re[0];
            }
        }
        if ($rules_info['content_get_type'] == 1) {
            $re = dom_single_article($str, array('content' => $rules_info['content_rules']));
            $data['content'] = $re['content'];
        } else {
            if ($rules_info['content_get_type'] == 2) {
                $data['content'] = str_get_str($str, $rules_info['content_rules'], 'body', -1);
            }
        }
    }
    //过滤
    if ($rules_info['is_fiter_title'] == 1 && $data['title']) {
        $format_args = array('is_fiter' => $rules_info['is_fiter_title'], 'show_type' => 'title', 'result_data' => $data['title'], 'replace_rules' => $rules_info['title_replace_rules'], 'filter_data' => dunserialize($rules_info['title_filter_rules']), 'test' => 2, 'filter_html' => '');
        $data['title'] = filter_article($format_args);
    }
    if ($rules_info['is_fiter_content'] == 1 && $data['content']) {
        $format_args = array('is_fiter' => $rules_info['is_fiter_content'], 'show_type' => 'body', 'result_data' => $data['content'], 'replace_rules' => $rules_info['content_replace_rules'], 'filter_data' => dunserialize($rules_info['content_filter_rules']), 'test' => 2, 'filter_html' => dunserialize($rules_info['content_filter_html']));
        $data['content'] = filter_article($format_args);
    }
    return $data;
}
function threadsort_optiondata($pid, $sortid, $sortoptionarray, $templatearray)
{
    global $_G;
    $_G['forum_optiondata'] = $_G['forum_typetemplate'] = $_G['forum_option'] = $_G['forum_memberinfo'] = $searchcontent = array();
    $id = $_G['tid'];
    if ($id) {
        foreach (C::t('forum_typeoptionvar')->fetch_all_by_tid_optionid($id) as $option) {
            $_G['forum_optiondata'][$option['optionid']] = $option['value'];
            $_G['forum_optiondata']['expiration'] = $option['expiration'];
        }
    }
    $_G['forum_optiondata']['expiration'] = $_G['forum_optiondata']['expiration'] ? dgmdate($_G['forum_optiondata']['expiration'], 'd') : '';
    foreach ($sortoptionarray as $optionid => $option) {
        if ($id) {
            $_G['forum_optionlist'][$optionid]['unchangeable'] = $sortoptionarray[$optionid]['unchangeable'] ? 'disabled' : '';
            if ($sortoptionarray[$optionid]['type'] == 'radio') {
                $_G['forum_optionlist'][$optionid]['value'] = array($_G['forum_optiondata'][$optionid] => 'checked="checked"');
            } elseif ($sortoptionarray[$optionid]['type'] == 'select') {
                $_G['forum_optionlist'][$optionid]['value'] = $_G['forum_optiondata'][$optionid] ? array($_G['forum_optiondata'][$optionid] => 'selected="selected"') : '';
            } elseif ($sortoptionarray[$optionid]['type'] == 'checkbox') {
                foreach (explode("\t", $_G['forum_optiondata'][$optionid]) as $value) {
                    $_G['forum_optionlist'][$optionid]['value'][$value] = array($value => 'checked="checked"');
                }
            } elseif ($sortoptionarray[$optionid]['type'] == 'image') {
                $_G['forum_optionlist'][$optionid]['value'] = dunserialize($_G['forum_optiondata'][$optionid]);
            } elseif ($sortoptionarray[$optionid]['type'] == 'face') {
                $_G['forum_optionlist'][$optionid]['value'] = dunserialize($_G['forum_optiondata'][$optionid]);
            } else {
                $_G['forum_optionlist'][$optionid]['value'] = $_G['forum_optiondata'][$optionid];
            }
            if (!isset($_G['forum_optiondata'][$optionid])) {
                C::t('forum_typeoptionvar')->insert(array('sortid' => $sortid, 'tid' => $id, 'fid' => $_G['fid'], 'optionid' => $optionid));
            }
        }
        if ($templatearray['post']) {
            $_G['forum_option'][$option['identifier']]['title'] = $option['title'];
            $_G['forum_option'][$option['identifier']]['unit'] = $option['unit'];
            $_G['forum_option'][$option['identifier']]['description'] = $option['description'];
            $_G['forum_option'][$option['identifier']]['required'] = $option['required'] ? '*' : '';
            $_G['forum_option'][$option['identifier']]['tips'] = '<span id="check' . $option['identifier'] . '"></span>';
            $showoption = gettypetemplate($option, $_G['forum_optionlist'][$optionid], $optionid);
            $_G['forum_option'][$option['identifier']]['value'] = $showoption[$option['identifier']]['value'];
            $searchcontent['title'][] = '/{(' . $option['identifier'] . ')}/e';
            $searchcontent['value'][] = '/\\[(' . $option['identifier'] . ')value\\]/e';
            $searchcontent['value'][] = '/{(' . $option['identifier'] . ')_value}/e';
            $searchcontent['unit'][] = '/\\[(' . $option['identifier'] . ')unit\\]/e';
            $searchcontent['unit'][] = '/{(' . $option['identifier'] . ')_unit}/e';
            $searchcontent['description'][] = '/\\[(' . $option['identifier'] . ')description\\]/e';
            $searchcontent['description'][] = '/{(' . $option['identifier'] . ')_description}/e';
            $searchcontent['required'][] = '/\\[(' . $option['identifier'] . ')required\\]/e';
            $searchcontent['required'][] = '/{(' . $option['identifier'] . ')_required}/e';
            $searchcontent['tips'][] = '/\\[(' . $option['identifier'] . ')tips\\]/e';
            $searchcontent['tips'][] = '/{(' . $option['identifier'] . ')_tips}/e';
        }
    }
    if ($templatearray['post']) {
        $typetemplate = $templatearray['post'];
        foreach ($searchcontent as $key => $content) {
            $typetemplate = preg_replace($searchcontent[$key], "showoption('\\1', '{$key}')", stripslashes($typetemplate));
        }
        $_G['forum_typetemplate'] = $typetemplate;
    }
}