本文整理汇总了PHP中getglobal函数的典型用法代码示例。如果您正苦于以下问题:PHP getglobal函数的具体用法?PHP getglobal怎么用?PHP getglobal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getglobal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getmyappiconpath
public static function getmyappiconpath($appid, $iconstatus = 0)
{
if ($iconstatus > 0) {
return getglobal('setting/attachurl') . './' . 'myapp/icon/' . $appid . '.jpg';
}
return 'http://appicon.manyou.com/icons/' . $appid;
}
示例2: wx_sendMsg
public function wx_sendMsg($data)
{
if (!getglobal('setting/CorpID') || !getglobal('setting/CorpSecret')) {
return false;
}
$user = C::t('user')->fetch($data['uid']);
if (!$user['wechat_userid'] || $user['wechat_status'] != 1) {
C::t('notification')->update($data['id'], array('wx_new' => $data['wx_new'] + 1));
return false;
}
$agentid = 0;
if ($data['from_idtype'] == 'app' && $data['from_id'] && ($wxapp = C::t('wx_app')->fetch($data['from_id']))) {
if ($wxapp['agentid'] && $wxapp['status'] < 1) {
$agentid = $wxapp['agentid'];
}
}
$wx = new qyWechat(array('appid' => getglobal('setting/CorpID'), 'appsecret' => getglobal('setting/CorpSecret')));
$msg = array("touser" => "dzz-" . $data['uid'], "safe" => 0, "agentid" => $agentid, "msgtype" => "news", "news" => array("articles" => array(array("title" => $data['title'], "description" => getstr($data['wx_note'], 0, 0, 0, 0, -1), "url" => $wx->getOauthRedirect(getglobal('siteurl') . 'index.php?mod=system&op=wxredirect&url=' . dzzencode($data['redirecturl']))))));
if ($ret = $wx->sendMessage($msg)) {
C::t('notification')->update($data['id'], array('wx_new' => 0));
return true;
} else {
C::t('notification')->update($data['id'], array('wx_new' => $data['wx_new'] + 1));
$message = 'wx_notification:errCode:' . $wx->errCode . ';errMsg:' . $wx->errMsg;
runlog('wxlog', $message);
return false;
}
}
示例3: outputvariables
function outputvariables()
{
global $_G;
$variables = array();
foreach ($this->params as $param) {
if (substr($param, 0, 1) == '$') {
if ($param == '$_G') {
continue;
}
$var = substr($param, 1);
if (preg_match("/^[a-zA-Z_][a-zA-Z0-9_]*\$/", $var)) {
$variables[$param] = $GLOBALS[$var];
}
} else {
if (preg_replace($this->safevariables, '', $param) !== $param) {
continue;
}
$variables[$param] = getglobal($param);
}
}
$xml = array('Version' => $this->version, 'Charset' => strtoupper($_G['charset']), 'Variables' => $variables);
if (!empty($_G['messageparam'])) {
$xml['Message'] = $_G['messageparam'];
}
require_once libfile('class/xml');
echo array2xml($xml);
exit;
}
示例4: getdata
function getdata($style, $parameter)
{
$advid = 0;
if (!empty($parameter['title'])) {
$parameter['title'] = addslashes($parameter['title']);
$adv = DB::fetch_first('SELECT * FROM ' . DB::table('common_advertisement_custom') . " WHERE name='{$parameter['title']}'");
if (empty($adv)) {
$advid = DB::insert('common_advertisement_custom', array('name' => $parameter['title']), 1);
} else {
$advid = $adv['id'];
}
} elseif (!empty($parameter['adv'])) {
$parameter['adv'] = addslashes($parameter['adv']);
$adv = DB::fetch_first('SELECT * FROM ' . DB::table('common_advertisement_custom') . " WHERE name='{$parameter['adv']}'");
$advid = intval($adv['id']);
} else {
$return = 'Empty Ads';
}
if ($advid) {
$flag = false;
if (getglobal('inajax')) {
$flag = true;
setglobal('inajax', 0);
}
$return = adshow('custom_' . $advid);
if ($flag) {
setglobal('inajax', 1);
}
}
return array('html' => $return, 'data' => null);
}
示例5: setUnrun_by_aid
public function setUnrun_by_aid($aid, $r)
{
//设置允许运行,如果文件在本地同时修改实际文件名,增加无法运行的后缀;
$data = parent::fetch($aid);
if ($data['remote'] == 0 || $data['remote'] == 1) {
//文件在本地,修改文件名
if ($r > 0) {
$earr = explode('.', $data['attachment']);
foreach ($earr as $key => $ext) {
if (in_array(strtolower($ext), array($data['filetype'], 'dzz'))) {
unset($earr[$key]);
}
}
$tattachment = implode('.', $earr) . '.dzz';
if ($is_file(getglobal('setting/attachdir') . './' . $data['attachment']) && @rename(getglobal('setting/attachdir') . './' . $data['attachment'], getglobal('setting/attachdir') . './' . $tattachment)) {
return parent::update($aid, array('unrun' => $r, 'attachment' => $tattachment));
}
} else {
$earr = explode('.', $data['attachment']);
foreach ($earr as $key => $ext) {
if (in_array(strtolower($ext), array($data['filetype'], 'dzz'))) {
unset($earr[$key]);
}
}
$tattachment = implode('.', $earr) . '.' . $data['filetype'];
if ($is_file(getglobal('setting/attachdir') . './' . $data['attachment']) && @rename(getglobal('setting/attachdir') . './' . $data['attachment'], getglobal('setting/attachdir') . './' . $tattachment)) {
return parent::update($aid, array('unrun' => $r, 'attachment' => $tattachment));
}
}
}
return false;
}
示例6: fetch_all_by_bid
public function fetch_all_by_bid($bid, $isverified = 1, $start = 0, $limit = 0, $bannedids = array(), $format = true)
{
$data = array();
if ($bid = dintval($bid, true)) {
$addsql = $bannedids = dintval($bannedids, true) ? ' AND id NOT IN (' . dimplode($bannedids) . ')' : '';
$query = DB::query('SELECT * FROM %t WHERE ' . DB::field('bid', $bid) . ' AND isverified=%d' . $addsql . ' ORDER BY stickgrade DESC, displayorder DESC, verifiedtime DESC, dataid DESC ' . DB::limit($start, $limit), array($this->_table, $isverified));
while ($value = DB::fetch($query)) {
if ($format) {
$value['fields'] = unserialize($value['fields']);
$value['fields']['timestamp'] = $value['fields']['dateline'];
$value['fields']['dateline'] = dgmdate($value['fields']['dateline']);
$value['pic'] = $value['pic'] !== STATICURL . 'image/common/nophoto.gif' ? $value['pic'] : '';
if ($value['pic'] && $value['picflag'] == '1') {
$value['pic'] = getglobal('setting/attachurl') . $value['pic'];
} elseif ($value['picflag'] == '2') {
$value['pic'] = getglobal('setting/ftp/attachurl') . $value['pic'];
}
$value['dateline'] = dgmdate($value['dateline'], 'u');
$value['verifiedtime'] = dgmdate($value['verifiedtime'], 'u');
}
$data[$value['id']] = $value;
}
}
return $data;
}
示例7: update_by_cid
public function update_by_cid($cid, $message, $rcid, $attach)
{
$ret = 0;
$ret += parent::update($cid, array('message' => $message, 'rcid' => $rcid, 'edituid' => getglobal('uid'), 'edittime' => TIMESTAMP));
$ret += C::t('comment_attach')->update_by_cid($cid, $attach);
return $ret;
}
示例8: getdata
function getdata($style, $parameter)
{
$advid = 0;
if (!empty($parameter['title'])) {
$adv = C::t('common_advertisement_custom')->fetch_by_name($parameter['title']);
if (empty($adv)) {
$advid = C::t('common_advertisement_custom')->insert(array('name' => $parameter['title']), true);
} else {
$advid = $adv['id'];
}
} elseif (!empty($parameter['adv'])) {
$adv = C::t('common_advertisement_custom')->fetch_by_name($parameter['adv']);
$advid = intval($adv['id']);
} else {
$return = 'Empty Ads';
}
if ($advid) {
$flag = false;
if (getglobal('inajax')) {
$flag = true;
setglobal('inajax', 0);
}
$return = adshow('custom_' . $advid);
if ($flag) {
setglobal('inajax', 1);
}
}
return array('html' => $return, 'data' => null);
}
示例9: upload
function upload($source, $target)
{
if ($this->error()) {
return 0;
}
$old_dir = $this->ftp_pwd();
$dirname = dirname($target);
$filename = basename($target);
if (!$this->ftp_chdir($dirname)) {
if ($this->ftp_mkdir($dirname)) {
$this->ftp_chmod($dirname);
if (!$this->ftp_chdir($dirname)) {
$this->set_error(FTP_ERR_CHDIR);
}
$this->ftp_put('index.htm', getglobal('setting/attachdir') . '/index.htm', FTP_BINARY);
} else {
$this->set_error(FTP_ERR_MKDIR);
}
}
$res = 0;
if (!$this->error()) {
if ($fp = @fopen($source, 'rb')) {
$res = $this->ftp_fput($filename, $fp, FTP_BINARY);
@fclose($fp);
!$res && $this->set_error(FTP_ERR_TARGET_WRITE);
} else {
$this->set_error(FTP_ERR_SOURCE_READ);
}
}
$this->ftp_chdir($old_dir);
return $res ? 1 : 0;
}
示例10: insert_by_uid
public function insert_by_uid($uid, $jobid)
{
if (!$jobid) {
return self::delete_by_uid($uid);
}
$setarr = array('uid' => $uid, 'jobid' => $jobid, 'dateline' => TIMESTAMP, 'opuid' => getglobal('uid'));
return parent::insert($setarr, 1, 1);
}
示例11: updatestat
function updatestat($type, $primary = 0, $num = 1)
{
$uid = getglobal('uid');
$updatestat = getglobal('setting/updatestat');
if (empty($uid) || empty($updatestat)) {
return false;
}
C::t('common_stat')->updatestat($uid, $type, $primary, $num);
}
示例12: dbsize
public static function dbsize()
{
$dbsize = 0;
$query = DB::query("SHOW TABLE STATUS LIKE '" . getglobal('config/db/1/tablepre') . "%'", 'SILENT');
while ($table = DB::fetch($query)) {
$dbsize += $table['Data_length'] + $table['Index_length'];
}
return $dbsize;
}
示例13: __construct
public function __construct()
{
$this->_table = 'common_block';
$this->_pk = 'bid';
parent::__construct();
$this->_allowmem = null;
$this->cache_ttl = $this->_cache_ttl = getglobal('setting/memory/diyblock');
$this->allowmem = $this->_cache_ttl !== null && memory('check');
}
示例14: memory_driver_redis
function &instance()
{
static $object;
if (empty($object)) {
$object = new memory_driver_redis();
$object->init(getglobal('config/memory/redis'));
}
return $object;
}
示例15: insert
public function insert($uid, $orgid)
{
if (!$uid || !$orgid) {
return 0;
}
$id = parent::insert(array("orgid" => $orgid, 'uid' => $uid, 'opuid' => getglobal('uid'), 'dateline' => TIMESTAMP), 1, 1);
self::update_groupid_by_uid($uid);
return DB::result_first('select id from %t where uid=%d and orgid=%d', array($this->_table, $uid, $orgid));
}