本文整理汇总了PHP中libfile函数的典型用法代码示例。如果您正苦于以下问题:PHP libfile函数的具体用法?PHP libfile怎么用?PHP libfile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了libfile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getdata
function getdata($style, $parameter)
{
$array = array();
foreach ($parameter as $key => $value) {
if (is_array($value)) {
$parameter[$key] = implode(',', $value);
}
}
$parameter['clientid'] = $this->blockdata['clientid'];
$parameter['op'] = 'getdata';
$parameter['charset'] = CHARSET;
$parameter['version'] = $this->blockdata['version'];
$xmlurl = $this->blockdata['url'];
$parse = parse_url($xmlurl);
if (!empty($parse['host'])) {
define('IN_ADMINCP', true);
require_once libfile('function/importdata');
$importtxt = @dfsockopen($xmlurl, 0, create_sign_url($parameter, $this->blockdata['key'], $this->blockdata['signtype']));
} else {
$importtxt = @file_get_contents($xmlurl);
}
if ($importtxt) {
require libfile('class/xml');
$array = xml2array($importtxt);
}
$idtype = 'xml_' . $this->blockdata['id'];
foreach ($array['data'] as $key => $value) {
$value['idtype'] = $idtype;
$array['data'][$key] = $value;
}
if (empty($array['data'])) {
$array['data'] = null;
}
return $array;
}
示例2: user_login
function user_login($uid)
{
$member = getuserbyuid($uid);
$cookietime = 1296000;
require_once libfile('function/member');
setloginstatus($member, $cookietime);
}
示例3: common
function common()
{
global $_G;
$seccodecheck = $secqaacheck = false;
if ($_GET['type'] == 'register') {
$seccodecheck = $_G['setting']['seccodestatus'] & 1;
$secqaacheck = $_G['setting']['secqaa']['status'] & 1;
} elseif ($_GET['type'] == 'login') {
$seccodecheck = $_G['setting']['seccodestatus'] & 2;
} elseif ($_GET['type'] == 'post') {
$seccodecheck = $_G['setting']['seccodestatus'] & 4 && (!$_G['setting']['seccodedata']['minposts'] || getuserprofile('posts') < $_G['setting']['seccodedata']['minposts']);
$secqaacheck = $_G['setting']['secqaa']['status'] & 2 && (!$_G['setting']['secqaa']['minposts'] || getuserprofile('posts') < $_G['setting']['secqaa']['minposts']);
}
$sechash = random(8);
if ($seccodecheck || $secqaacheck) {
$variable = array('sechash' => $sechash);
if ($seccodecheck) {
$variable['seccode'] = $_G['siteurl'] . 'api/mobile/index.php?module=seccode&sechash=' . $sechash . '&version=' . (empty($_GET['secversion']) ? '1' : $_GET['secversion']);
}
if ($secqaacheck) {
require_once libfile('function/seccode');
$variable['secqaa'] = make_secqaa($sechash);
}
}
mobile_core::result(mobile_core::variable($variable));
}
示例4: build_cache_heats
function build_cache_heats()
{
global $_G;
$addsql = '';
$data = array();
if (discuz_process::islocked('update_heats_list')) {
return false;
}
if ($_G['setting']['indexhot']['status']) {
require_once libfile('function/post');
$_G['setting']['indexhot'] = array('status' => 1, 'limit' => intval($_G['setting']['indexhot']['limit'] ? $_G['setting']['indexhot']['limit'] : 10), 'days' => intval($_G['setting']['indexhot']['days'] ? $_G['setting']['indexhot']['days'] : 7), 'expiration' => intval($_G['setting']['indexhot']['expiration'] ? $_G['setting']['indexhot']['expiration'] : 900), 'messagecut' => intval($_G['setting']['indexhot']['messagecut'] ? $_G['setting']['indexhot']['messagecut'] : 200));
$messageitems = 2;
$limit = $_G['setting']['indexhot']['limit'];
foreach (C::t('forum_thread')->fetch_all_heats() as $heat) {
$post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($heat['tid']);
$heat = array_merge($heat, (array) $post);
if ($limit == 0) {
break;
}
if ($messageitems > 0) {
$heat['message'] = !$heat['price'] ? messagecutstr($heat['message'], $_G['setting']['indexhot']['messagecut']) : '';
$data['message'][$heat['tid']] = $heat;
} else {
unset($heat['message']);
$data['subject'][$heat['tid']] = $heat;
}
$messageitems--;
$limit--;
}
$data['expiration'] = TIMESTAMP + $_G['setting']['indexhot']['expiration'];
}
savecache('heats', $data);
discuz_process::unlock('update_heats_list');
}
示例5: updatersscache
function updatersscache($num)
{
global $_G;
DB::query("DELETE FROM " . DB::table('forum_rsscache') . "");
require_once libfile('function/post');
foreach ($_G['cache']['forums'] as $fid => $forum) {
if ($forum['type'] != 'group') {
$query = DB::query("SELECT t.tid, t.readperm, t.author, t.dateline, t.subject\n\t\t\t\tFROM " . DB::table('forum_thread') . " t\n\t\t\t\tWHERE t.fid='{$fid}' AND t.displayorder>='0' AND t.price='0'\n\t\t\t\tORDER BY t.dateline DESC LIMIT {$num}");
$forum['name'] = addslashes($forum['name']);
while ($thread = DB::fetch($query)) {
$thread['author'] = $thread['author'] != '' ? addslashes($thread['author']) : 'Anonymous';
$thread['subject'] = addslashes($thread['subject']);
$posttable = getposttablebytid($thread['tid']);
$post = DB::fetch_first("SELECT pid, attachment, message, status FROM " . DB::table($posttable) . " WHERE tid='{$thread['tid']}' AND first='1'");
$attachdata = '';
if ($post['attachment'] == 2) {
$attach = DB::fetch_first("SELECT remote, attachment, filesize FROM " . DB::table('forum_attachment') . " WHERE pid='{$post['pid']}' AND isimage='1' ORDER BY dateline LIMIT 1");
$attachdata = "\t" . $attach['remote'] . "\t" . $attach['attachment'] . "\t" . $attach['filesize'];
}
$thread['message'] = $post['message'];
$thread['status'] = $post['status'];
$thread['description'] = $thread['readperm'] > 0 || $thread['price'] > 0 || $thread['status'] & 1 ? '' : addslashes(nl2br(messagecutstr($thread['message'], 250 - strlen($attachdata))) . $attachdata);
DB::query("REPLACE INTO " . DB::table('forum_rsscache') . " (lastupdate, fid, tid, dateline, forum, author, subject, description)\n\t\t\t\t\tVALUES ('{$_G['timestamp']}', '{$fid}', '{$thread['tid']}', '{$thread['dateline']}', '{$forum['name']}', '{$thread['author']}', '{$thread['subject']}', '{$thread['description']}')");
}
}
}
}
示例6: onMobileModule
public function onMobileModule()
{
global $_G;
if (!$_G['setting']['plugins']['available']) {
return '';
}
require_once libfile('function/admincp');
loadcache('pluginlanguage_script', 1);
$return = array();
foreach ($_G['setting']['plugins']['available'] as $pluginid) {
$row = array();
$modulefile = DISCUZ_ROOT . './source/plugin/' . $pluginid . '/discuz_mobile_' . $pluginid . '.xml';
if (file_exists($modulefile)) {
$_GET['importtxt'] = @implode('', file($modulefile));
$pluginarray = getimportdata('Discuz! Mobile', 0, 1);
if ($pluginarray) {
foreach ($pluginarray as $name => $value) {
$row[] = array('name' => isset($_G['cache']['pluginlanguage_script'][$pluginid][$name]) ? $_G['cache']['pluginlanguage_script'][$pluginid][$name] : $name, 'logo' => $value['logo'], 'url' => preg_match('/^http:\\/\\//', $value['url']) ? $value['url'] : $_G['siteurl'] . $value['url']);
}
}
}
$return[$pluginid] = $row;
}
return $return;
}
示例7: build_cache_diytemplatename
function build_cache_diytemplatename()
{
$data = array();
$apps = array('portal', 'forum', 'group', 'home');
$nullname = lang('portalcp', 'diytemplate_name_null');
$scriptarr = $lostname = array();
foreach (C::t('common_diy_data')->range() as $datarow) {
$datarow['name'] = $datarow['name'] ? $datarow['name'] : lang('portalcp', $datarow['targettplname'], '', '');
if (empty($datarow['name'])) {
$lostname[$datarow['targettplname']] = $datarow['targettplname'];
$datarow['name'] = $nullname;
}
$data[$datarow['targettplname']] = dhtmlspecialchars($datarow['name']);
$curscript = substr($datarow['targettplname'], 0, strpos($datarow['targettplname'], '/'));
if (in_array($curscript, $apps)) {
$scriptarr[$curscript][$datarow['targettplname']] = true;
}
}
if ($lostname) {
require_once libfile('function/portalcp');
foreach (getdiytplnames($lostname) as $pre => $datas) {
foreach ($datas as $id => $name) {
$data[$pre . $id] = $name;
}
}
}
savecache('diytemplatename', $data);
foreach ($scriptarr as $curscript => $value) {
savecache('diytemplatename' . $curscript, $value);
}
}
示例8: build_cache_forumrecommend
function build_cache_forumrecommend()
{
$data = array();
$fids = C::t('forum_forum')->fetch_all_fids();
foreach ($fids as $row) {
require_once libfile('function/group');
$recommendlist = C::t('forum_forum')->fetch_all_recommend_by_fid($row['fid']);
foreach ($recommendlist as $info) {
$group = array('fid' => $info['fid'], 'name' => $info['name'], 'threads' => $info['threads'], 'lastpost' => $info['lastpost'], 'icon' => $info['icon'], 'membernum' => $info['membernum'], 'description' => $info['description']);
$group['icon'] = get_groupimg($group['icon'], 'icon');
$lastpost = array(0, 0, '', '');
$group['lastpost'] = is_string($group['lastpost']) ? explode("\t", $group['lastpost']) : $group['lastpost'];
$group['lastpost'] = count($group['lastpost']) != 4 ? $lastpost : $group['lastpost'];
list($lastpost['tid'], $lastpost['subject'], $lastpost['dateline'], $lastpost['author']) = $group['lastpost'];
if ($lastpost['tid']) {
$lastpost['dateline'] = dgmdate($lastpost['dateline'], 'Y-m-d H:i:s');
if ($lastpost['author']) {
$lastpost['encode_author'] = rawurlencode($lastpost['author']);
}
$group['lastpost'] = $lastpost;
} else {
$group['lastpost'] = '';
}
$data[$row['fid']][] = $group;
}
}
savecache('forumrecommend', $data);
}
示例9: output
function output()
{
global $_G;
//帖子列表增加图片 -start
require_once libfile('function/discuzcode');
foreach ($GLOBALS['data']['my']['threadlist'] as $k => $thread) {
$post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($GLOBALS['data']['my']['threadlist'][$k]['tid'], 0);
$attachment[$post['pid']] = array();
$GLOBALS['data']['my']['threadlist'][$k]['pid'] = $post['pid'];
//TODO:下面的代码直接调用discuzcode时,会报错
//./source/plugin/mobile/template/discuzcode.htm 文件不存在
//cp ./source/plugin/mobile/template/mobile/discuzcode.htm ./source/plugin/mobile/template/
//拷贝一份就可以了,原因未查明
$GLOBALS['data']['my']['threadlist'][$k]['message'] = discuzcode($post['message']);
//附件,0无附件 1普通附件 2有图片附件
if (!empty($post['attachment']) && intval($post['attachment']) == 2) {
$GLOBALS['data']['my']['threadlist'][$k]['attachments'] = array();
$GLOBALS['data']['my']['threadlist'][$k]['imagelist'] = array();
require_once libfile('function/attachment');
$_G['tid'] = $post['tid'];
parseattach(array_keys($attachment), array(), $attachment);
$GLOBALS['data']['my']['threadlist'][$k]['attachments'] = $attachment[$post['pid']]['attachments'];
$GLOBALS['data']['my']['threadlist'][$k]['imagelist'] = $attachment[$post['pid']]['imagelist'];
unset($_G['tid']);
}
}
//帖子列表增加图片 -end
$data['forumnames'] = $GLOBALS['data']['my']['forumnames'];
$data['threadcount'] = $GLOBALS['data']['my']['threadcount'];
$data['threadlist'] = array_values($GLOBALS['data']['my']['threadlist']);
$variable = array('data' => $data, 'perpage' => $GLOBALS['perpage']);
mobile_core::result(mobile_core::variable($variable));
}
示例10: censormod
function censormod($message)
{
require_once libfile('class/censor');
$censor = discuz_censor::instance();
$censor->check($message);
return $censor->modmoderated();
}
示例11: updatersscache
function updatersscache($num)
{
global $_G;
$processname = 'portal_rss_cache';
if (discuz_process::islocked($processname, 600)) {
return false;
}
DB::query("DELETE FROM " . DB::table('portal_rsscache') . "");
require_once libfile('function/post');
foreach ($_G['cache']['portalcategory'] as $catid => $catarray) {
$query = DB::query("SELECT aid, username, author, dateline, title, summary\r\n\t\t\tFROM " . DB::table('portal_article_title') . "\r\n\t\t\tWHERE catid='{$catid}' AND status=0\r\n\t\t\tORDER BY aid DESC LIMIT {$num}");
$catarray['catname'] = addslashes($catarray['catname']);
while ($article = DB::fetch($query)) {
$article['author'] = $article['author'] != '' ? addslashes($article['author']) : ($article['username'] ? addslashes($article['username']) : 'Anonymous');
$article['title'] = addslashes($article['title']);
$articleattach = DB::fetch_first("SELECT * FROM " . DB::table('portal_attachment') . " WHERE aid='" . $article['aid'] . "' AND isimage=1");
$attachdata = '';
if (!empty($articleattach)) {
$attachdata = "\t" . $articleattach['remote'] . "\t" . $articleattach['attachment'] . "\t" . $articleattach['filesize'];
}
$article['description'] = addslashes(messagecutstr($article['summary'], 250 - strlen($attachdata)) . $attachdata);
DB::query("REPLACE INTO " . DB::table('portal_rsscache') . " (lastupdate, catid, aid, dateline, catname, author, subject, description)\r\n\t\t\t\tVALUES ('{$_G['timestamp']}', '{$catid}', '{$article['aid']}', '{$article['dateline']}', '{$catarray['catname']}', '{$article['author']}', '{$article['title']}', '{$article['description']}')");
}
}
discuz_process::unlock($processname);
return true;
}
示例12: make_secqaa
function make_secqaa($idhash)
{
global $_G;
loadcache('secqaa');
$secqaakey = max(1, random(1, 1));
if ($_G['cache']['secqaa'][$secqaakey]['type']) {
$etype = explode(':', $_G['cache']['secqaa'][$secqaakey]['question']);
if (count($etype) > 1 && preg_match('/^[\\w\\_]+$/', $etype[0]) && preg_match('/^[\\w\\_]+$/', $etype[1])) {
$qaafile = DISCUZ_ROOT . './source/plugin/' . $etype[0] . '/secqaa/secqaa_' . $etype[1] . '.php';
$class = $etype[1];
} else {
$qaafile = libfile('secqaa/' . $_G['cache']['secqaa'][$secqaakey]['question'], 'class');
$class = $_G['cache']['secqaa'][$secqaakey]['question'];
}
if (file_exists($qaafile)) {
@(include_once $qaafile);
$class = 'secqaa_' . $class;
if (class_exists($class)) {
$qaa = new $class();
if (method_exists($qaa, 'make')) {
$_G['cache']['secqaa'][$secqaakey]['answer'] = md5($qaa->make($_G['cache']['secqaa'][$secqaakey]['question']));
}
}
}
}
dsetcookie('secqaa' . $idhash, authcode($_G['cache']['secqaa'][$secqaakey]['answer'] . "\t" . (TIMESTAMP - 180) . "\t" . $idhash . "\t" . FORMHASH, 'ENCODE', $_G['config']['security']['authkey']), 0, 1, true);
return $_G['cache']['secqaa'][$secqaakey]['question'];
}
示例13: usesubmit
function usesubmit()
{
global $_G;
if (empty($_GET['pid'])) {
showmessage(lang('magic/repent', 'repent_info_nonexistence'));
}
$_G['tid'] = $_GET['ptid'];
$post = getpostinfo($_GET['pid'], 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid', 'p.replycredit', 't.status as thread_status'));
$this->_check($post);
require_once libfile('function/post');
require_once libfile('function/delete');
if ($post['first']) {
if ($have_replycredit = C::t('forum_replycredit')->fetch($post['tid'])) {
$thread = C::t('forum_thread')->fetch($post['tid']);
if ($thread['replycredit']) {
updatemembercount($post['authorid'], array($_G['setting']['creditstransextra'][10] => $replycredit));
}
C::t('forum_replycredit')->delete($post['tid']);
C::t('common_credit_log')->delete_by_operation_relatedid(array('RCT', 'RCA', 'RCB'), $post['tid']);
}
deletethread(array($post['tid']));
updateforumcount($post['fid']);
} else {
if ($post['replycredit'] > 0) {
updatemembercount($post['authorid'], array($_G['setting']['creditstransextra'][10] => -$post['replycredit']));
C::t('common_credit_log')->delete_by_uid_operation_relatedid($post['authorid'], 'RCA', $post['tid']);
}
deletepost(array($_GET['pid']));
updatethreadcount($post['tid']);
}
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['tid']);
showmessage(lang('magic/repent', 'repent_succeed'), $post['first'] ? 'forum.php?mod=forumdisplay&fid=' . $post['fid'] : dreferer(), array(), array('alert' => 'right', 'showdialog' => 1, 'locationtime' => true));
}
示例14: check_seccode
public static function check_seccode($value, $idhash)
{
global $_G;
if (!$_G['setting']['seccodestatus']) {
return true;
}
if (!is_numeric($_G['setting']['seccodedata']['type'])) {
$codefile = libfile('seccode/' . $_G['setting']['seccodedata']['type'], 'class');
$class = $_G['setting']['seccodedata']['type'];
if (file_exists($codefile)) {
@(include_once $codefile);
$class = 'seccode_' . $class;
if (class_exists($class)) {
$code = new $class();
if (method_exists($code, 'check')) {
return $code->check($value, $idhash);
}
}
}
return false;
}
if (!isset($_G['cookie']['seccode' . $idhash])) {
return false;
}
list($checkvalue, $checktime, $checkidhash, $checkformhash) = explode("\t", authcode($_G['cookie']['seccode' . $idhash], 'DECODE', $_G['config']['security']['authkey']));
return $checkvalue == strtoupper($value) && TIMESTAMP - 180 > $checktime && $checkidhash == $idhash && FORMHASH == $checkformhash;
}
示例15: fetch_by_jobid
function fetch_by_jobid($jobid)
{
include_once libfile('function/organization');
$data = parent::fetch($jobid);
$data['orgtree'] = getTreeByOrgid($data['orgid']);
return $data;
}