本文整理汇总了PHP中dunserialize函数的典型用法代码示例。如果您正苦于以下问题:PHP dunserialize函数的具体用法?PHP dunserialize怎么用?PHP dunserialize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dunserialize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onConnectSetConfig
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;
}
示例2: check
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;
}
示例3: post
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();
}
示例4: fetch
public function fetch($bid)
{
if ($block = parent::fetch(dintval($bid))) {
$block['param'] = $block['param'] ? dunserialize($block['param']) : array();
}
return $block;
}
示例5: mobile_upload
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' => '');
}
}
}
示例6: plugin_myrepeats
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";
}
示例7: check_cpaccess
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();
}
}
示例8: _loadstorage
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();
}
}
示例9: mkfeed
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;
}
示例10: check
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;
}
示例11: _switchVest
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;
}
示例12: image
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']),
);
}
示例13: block_xml
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;
}
}
}
示例14: getCloudApps
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;
}
示例15: manage_addnotify
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);
}
}
}