本文整理汇总了PHP中C::app方法的典型用法代码示例。如果您正苦于以下问题:PHP C::app方法的具体用法?PHP C::app怎么用?PHP C::app使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C
的用法示例。
在下文中一共展示了C::app方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setloginstatus
function setloginstatus($member, $cookietime)
{
global $_G;
$_G['uid'] = intval($member['uid']);
$_G['username'] = $member['username'];
$_G['adminid'] = $member['adminid'];
$_G['groupid'] = $member['groupid'];
$_G['formhash'] = formhash();
$_G['session']['invisible'] = getuserprofile('invisible');
$_G['member'] = $member;
loadcache('usergroup_' . $_G['groupid']);
C::app()->session->isnew = true;
C::app()->session->updatesession();
dsetcookie('auth', authcode("{$member['password']}\t{$member['uid']}", 'ENCODE'), $cookietime, 1, true);
dsetcookie('loginuser');
dsetcookie('activationauth');
dsetcookie('pmnum');
include_once libfile('function/stat');
updatestat('login', 1);
if (defined('IN_MOBILE')) {
updatestat('mobilelogin', 1);
}
if ($_G['setting']['connect']['allow'] && $_G['member']['conisbind']) {
updatestat('connectlogin', 1);
}
$rule = updatecreditbyaction('daylogin', $_G['uid']);
if (!$rule['updatecredit']) {
checkusergroup($_G['uid']);
}
}
示例2: usesubmit
function usesubmit()
{
global $_G;
if (empty($_GET['username'])) {
showmessage(lang('magic/checkonline', 'checkonline_info_nonexistence'));
}
$member = getuserinfo($_GET['username']);
$this->_check($member['groupid']);
$online = C::app()->session->fetch_by_uid($member['uid']);
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'uid', $member['uid']);
if ($member['uid'] != $_G['uid']) {
notification_add($member['uid'], 'magic', lang('magic/checkonline', 'checkonline_notification'), array('magicname' => $this->magic['name']), 1);
}
if ($online) {
$time = dgmdate($online['lastactivity'], 'u');
if ($online['invisible']) {
showmessage(lang('magic/checkonline', 'checkonline_hidden_message'), '', array('username' => $_GET['username'], 'time' => $time), array('alert' => 'info', 'showdialog' => 1));
} else {
showmessage(lang('magic/checkonline', 'checkonline_online_message'), '', array('username' => $_GET['username'], 'time' => $time), array('alert' => 'info', 'showdialog' => 1));
}
} else {
showmessage(lang('magic/checkonline', 'checkonline_offline_message'), '', array('username' => $_GET['username']), array('alert' => 'info', 'showdialog' => 1));
}
}
示例3: __construct
public function __construct()
{
$this->app = C::app();
$this->setting =& $this->app->var['setting'];
$this->group =& $this->app->var['group'];
$this->member =& $this->app->var['member'];
parent::__construct();
}
示例4: loadcore
function loadcore()
{
global $_G;
require_once './source/class/class_core.php';
$discuz = C::app();
$discuz->init_cron = false;
$discuz->init_session = false;
$discuz->init();
}
示例5: __construct
function __construct()
{
parent::__construct();
define('UC_CLIENT_VERSION', '1.6.0');
define('UC_CLIENT_RELEASE', '20110501');
define('API_DELETEUSER', 1);
define('API_RENAMEUSER', 1);
define('API_GETTAG', 1);
define('API_SYNLOGIN', 1);
define('API_SYNLOGOUT', 1);
define('API_UPDATEPW', 1);
define('API_UPDATEBADWORDS', 1);
define('API_UPDATEHOSTS', 1);
define('API_UPDATEAPPS', 1);
define('API_UPDATECLIENT', 1);
define('API_UPDATECREDIT', 1);
define('API_GETCREDIT', 1);
define('API_GETCREDITSETTINGS', 1);
define('API_UPDATECREDITSETTINGS', 1);
define('API_ADDFEED', 1);
define('API_RETURN_SUCCEED', '1');
define('API_RETURN_FAILED', '-1');
define('API_RETURN_FORBIDDEN', '1');
define('IN_API', true);
define('CURSCRIPT', 'api');
if (!defined('IN_UC')) {
// require_once '../source/class/class_core.php';
Vendor("source.class.class_core");
$discuz = C::app();
$discuz->init();
require DISCUZ_ROOT . './config/config_ucenter.php';
$get = $post = array();
$code = @$_GET['code'];
parse_str(authcode($code, 'DECODE', UC_KEY), $get);
if (time() - $get['time'] > 3600) {
exit('Authracation has expiried');
}
if (empty($get)) {
exit('Invalid Request');
}
include_once DISCUZ_ROOT . './uc_client/lib/xml.class.php';
$post = xml_unserialize(file_get_contents('php://input'));
if (in_array($get['action'], array('test', 'deleteuser', 'renameuser', 'gettag', 'synlogin', 'synlogout', 'updatepw', 'updatebadwords', 'updatehosts', 'updateapps', 'updateclient', 'updatecredit', 'getcredit', 'getcreditsettings', 'updatecreditsettings', 'addfeed'))) {
$uc_note = new uc_note();
echo $uc_note->{$get}['action']($get, $post);
exit;
} else {
exit(API_RETURN_FAILED);
}
} else {
exit;
}
}
示例6: checkBbsAdmin
/**
* checkBbsAdmin()
* 验证是否已经登录BBS,并且是允许的用户
* */
function checkBbsAdmin()
{
require '../source/class/class_core.php';
require '../source/function/function_forum.php';
C::app()->init();
$user = $GLOBALS['_G']['username'];
$allow = C('ALLOW_USER');
if (!in_array($user, $allow)) {
echo 'Permission Denied!';
exit;
}
}
示例7: run
function run()
{
if (!$this->config['cron']) {
$this->error(100, 'cron service is off. Please check "config.global.php" on your webserver folder.');
}
$discuz = C::app();
$discuz->initated = false;
$discuz->init_db = false;
$discuz->init_setting = true;
$discuz->init_user = false;
$discuz->init_session = false;
$discuz->init_misc = false;
$discuz->init_mobile = false;
$discuz->init_cron = true;
$discuz->init();
$this->success('Cron work is done');
}
示例8: getDiscuzApplication
/**
* @return \discuz_application
*/
public static function getDiscuzApplication()
{
/**
* @var $discuz \discuz_application
*/
static $discuz;
if (null === $discuz) {
if (!self::isBooted()) {
throw new \Exception();
}
if (self::$_in_symfony_firewall) {
include __DIR__ . '/../www/source/class/class_core.php';
}
$discuz = \C::app();
$discuz->init();
}
return $discuz;
}
示例9: init
function init()
{
require_once '../../source/class/class_core.php';
$cachelist = array();
$this->core = C::app();
$this->core->cachelist = $cachelist;
$this->core->init_setting = true;
$this->core->init_cron = false;
$this->core->init_user = false;
$this->core->init_session = false;
$this->core->init_misc = false;
$this->core->init_mobile = false;
$this->core->init();
define('SERVICE_DIR', getglobal('config/remote/dir') ? getglobal('config/remote/dir') : 'remote');
$this->core->reject_robot();
if (empty($_GET['mod']) || preg_match('/[^0-9a-z]/i', $_GET['mod'])) {
$this->mod = 'index';
} else {
$this->mod = $_GET['mod'];
}
}
示例10: explode
if (!trim($banipaddr)) {
continue;
}
$ipnew = explode('.', $banipaddr);
for ($i = 0; $i < 4; $i++) {
if (strpos($ipnew[$i], '*') !== false) {
$ipnew[$i] = -1;
} else {
$ipnew[$i] = intval($ipnew[$i]);
}
}
$checkexists = C::t('common_banned')->fetch_by_ip($ipnew[0], $ipnew[1], $ipnew[2], $ipnew[3]);
if ($checkexists) {
continue;
}
C::app()->session->update_by_ipban($ipnew[0], $ipnew[1], $ipnew[2], $ipnew[3]);
$data = array('ip1' => $ipnew[0], 'ip2' => $ipnew[1], 'ip3' => $ipnew[2], 'ip4' => $ipnew[3], 'admin' => $_G['username'], 'dateline' => $_G['timestamp'], 'expiration' => $expiration);
C::t('common_banned')->insert($data, false, true);
}
updatecache('ipbanned');
cpmsg('members_ipban_succeed', 'action=members&operation=ipban&ipact=input', 'succeed');
}
} elseif ($_GET['ipact'] == 'output') {
ob_end_clean();
dheader('Cache-control: max-age=0');
dheader('Expires: ' . gmdate('D, d M Y H:i:s', TIMESTAMP - 31536000) . ' GMT');
dheader('Content-Encoding: none');
dheader('Content-Disposition: attachment; filename=IPBan.csv');
dheader('Content-Type: text/plain');
foreach (C::t('common_banned')->fetch_all_order_dateline() as $banned) {
for ($i = 1; $i <= 4; $i++) {
示例11: foreach
$visitorlist[$value['vuid']] = $value;
$oluids[] = $value['vuid'];
}
if ($oluids) {
foreach (C::app()->session->fetch_all_by_uid($oluids) as $value) {
if (!$value['invisible']) {
$ols[$value['uid']] = 1;
} elseif ($visitorlist[$value['uid']]) {
unset($visitorlist[$value['uid']]);
}
}
}
$oluids = array();
$olfcount = 0;
if ($space['feedfriend']) {
foreach (C::app()->session->fetch_all_by_uid(explode(',', $space['feedfriend']), 15) as $value) {
if ($olfcount < 15 && !$value['invisible']) {
$olfriendlist[$value['uid']] = $value;
$ols[$value['uid']] = 1;
$oluids[$value['uid']] = $value['uid'];
$olfcount++;
}
}
}
if ($olfcount < 15) {
$query = C::t('home_friend')->fetch_all_by_uid($space['uid'], 0, 32, true);
foreach ($query as $value) {
$value['uid'] = $value['fuid'];
$value['username'] = $value['fusername'];
if (empty($oluids[$value['uid']])) {
$olfriendlist[$value['uid']] = $value;
示例12: define
<?php
/*
* @copyright Leyun internet Technology(Shanghai)Co.,Ltd
* @license http://www.dzzoffice.com/licenses/license.txt
* @package DzzOffice
* @link http://www.dzzoffice.com
* @author zyx(zyx@dzz.cc)
*/
define('APPTYPEID', 0);
define('CURSCRIPT', 'user');
require './core/class/class_core.php';
require libfile('class/user');
require libfile('function/user');
require libfile('function/mail');
require libfile('function/profile');
$dzz = C::app();
$modarray = array('activate', 'clearcookies', 'getpasswd', 'logging', 'lostpasswd', 'seccode', 'secqaa', 'register', 'ajax', 'regverify', 'switchstatus', 'profile', 'password', 'avatar');
$mod = !in_array($dzz->var['mod'], $modarray) && (!preg_match('/^\\w+$/', $dzz->var['mod']) || !file_exists(DZZ_ROOT . './member/member_' . $dzz->var['mod'] . '.php')) ? 'space' : $dzz->var['mod'];
define('CURMODULE', $mod);
$cachelist = array('usergroup', 'fields_register');
$dzz->cachelist = $cachelist;
$dzz->init();
include_once libfile('function/cache');
updatecache('fields_register');
if (@(!file_exists(DZZ_ROOT . './user/user_' . $mod . '.php'))) {
system_error(lang('message', 'undefined_action'));
}
require DZZ_ROOT . './user/user_' . $mod . '.php';
示例13: foreach
}
foreach (C::t('common_banned')->fetch_all_order_dateline() as $banned) {
$exists = 0;
for ($i = 1; $i <= 4; $i++) {
if ($banned["ip{$i}"] == -1) {
$exists++;
} elseif ($banned["ip{$i}"] == ${"ip" . $i . "new"}) {
$exists++;
}
}
if ($exists == 4) {
cpmsg('members_ipban_invalid', '', 'error');
}
}
$expiration = TIMESTAMP + $_GET['validitynew'] * 86400;
C::app()->session->update_by_ipban($_GET['ip1new'], $_GET['ip2new'], $_GET['ip3new'], $_GET['ip4new']);
$data = array('ip1' => $_GET['ip1new'], 'ip2' => $_GET['ip2new'], 'ip3' => $_GET['ip3new'], 'ip4' => $_GET['ip4new'], 'admin' => $_G['username'], 'dateline' => $_G['timestamp'], 'expiration' => $expiration);
C::t('common_banned')->insert($data);
}
if (is_array($_GET['expirationnew'])) {
foreach ($_GET['expirationnew'] as $id => $expiration) {
C::t('common_banned')->update_expiration_by_id($id, strtotime($expiration), $_G['adminid'], $_G['username']);
}
}
updatecache('ipbanned');
cpmsg('members_ipban_succeed', 'action=members&operation=ipban', 'succeed');
}
} elseif ($operation == 'profile') {
$fieldid = $_GET['fieldid'] ? $_GET['fieldid'] : '';
shownav('user', 'nav_members_profile');
if ($fieldid) {
示例14: multi
$diymode = 0;
}
if ($diymode) {
$theurl .= "&from=space";
}
$multi = multi($count, $perpage, $page, $theurl);
if ($space['self']) {
$groupselect = array($group => ' class="a"');
$maxfriendnum = checkperm('maxfriendnum');
if ($maxfriendnum) {
$maxfriendnum = checkperm('maxfriendnum') + $space['addfriend'];
}
}
}
if ($fuids) {
foreach (C::app()->session->fetch_all_by_uid($fuids) as $value) {
if (!$value['invisible']) {
$ols[$value['uid']] = $value['lastactivity'];
} elseif ($list[$value['uid']] && !in_array($_GET['view'], array('me', 'trace', 'blacklist'))) {
unset($list[$value['uid']]);
$count = $count - 1;
}
}
if ($_GET['view'] != 'me') {
require_once libfile('function/friend');
friend_check($fuids);
}
if ($list) {
$fieldhome = C::t('common_member_field_home')->fetch_all($fuids);
foreach (C::t('common_member')->fetch_all($fuids) as $uid => $value) {
$value = array_merge($value, $fieldhome[$uid]);
示例15: foreach
}
if (isset($_G['cache']['onlinelist'][7]) && $_G['setting']['maxonlinelist'] > $membercount) {
foreach (C::app()->session->fetch_member(2, 0, $_G['setting']['maxonlinelist'] - $membercount) as $online) {
$online['icon'] = $_G['cache']['onlinelist'][7];
$online['username'] = $_G['cache']['onlinelist']['guest'];
$online['lastactivity'] = dgmdate($online['lastactivity'], 't');
$whosonline[] = $online;
}
}
unset($actioncode, $online);
if ($onlinenum > $_G['setting']['maxonlinelist']) {
$membercount = C::app()->session->count(1);
$invisiblecount = C::app()->session->count_invisible();
}
if ($onlinenum < $membercount) {
$onlinenum = C::app()->session->count();
dsetcookie('onlineusernum', intval($onlinenum), 300);
}
$invisiblecount = intval($invisiblecount);
$guestcount = $onlinenum - $membercount;
unset($online);
}
} else {
$_G['setting']['whosonlinestatus'] = 0;
}
if (defined('FORUM_INDEX_PAGE_MEMORY') && !FORUM_INDEX_PAGE_MEMORY) {
$key = !IS_ROBOT ? $_G['member']['groupid'] : 'for_robot';
memory('set', 'forum_index_page_' . $key, array('catlist' => $catlist, 'forumlist' => $forumlist, 'sublist' => $sublist, 'whosonline' => $whosonline, 'onlinenum' => $onlinenum, 'membercount' => $membercount, 'guestcount' => $guestcount, 'grids' => $grids, 'announcements' => $announcements, 'threads' => $threads, 'posts' => $posts, 'todayposts' => $todayposts, 'onlineinfo' => $onlineinfo, 'announcepm' => $announcepm), getglobal('setting/memory/forumindex'));
}
} else {
require_once DISCUZ_ROOT . './source/include/misc/misc_category.php';