本文整理汇总了PHP中read_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP read_cache函数的具体用法?PHP read_cache怎么用?PHP read_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了read_cache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
function init()
{
if ($this->crcuarr) {
return;
}
load_cache('currencys,crprojects,grouptypes');
global $db, $tblprefix, $curuser, $currencys, $crprojects, $grouptypes, $extract_mincount;
$discount = array();
# $mincount = empty($extract_mincount) ? array() : array($extract_mincount);
$mincount = array(isset($extract_mincount) ? $extract_mincount : 50);
foreach ($grouptypes as $k => $v) {
if (!$v['issystem'] && $curuser->info['grouptype' . $k]) {
$usergroup = read_cache('usergroup', $k, $curuser->info['grouptype' . $k]);
empty($usergroup[EX_DISCOUNT]) || ($discount[] = $usergroup[EX_DISCOUNT]);
# empty($usergroup[EX_MINCOUNT]) || $mincount[] = $usergroup[EX_MINCOUNT];
}
}
# $discount = array(90);$mincount = array(10);#test code
(empty($discount) || empty($mincount)) && mcmessage('no_extract_permission');
$this->crcuarr = array('ex' => array('cname' => lang('cashaccount'), 'unit' => lang('yuan'), 'count' => $curuser->info['currency0'], 'discount' => max($discount), 'mincount' => min($mincount)));
foreach ($crprojects as $v) {
$k = $curuser->info["currency{$v['scrid']}"];
if ($v['ecrid'] == 0 && $k) {
$this->crcuarr[$v['scrid']] = array('cname' => $currencys[$v['scrid']]['cname'], 'unit' => $currencys[$v['scrid']]['unit'], 'count' => $k, 'discount' => round($v['ecurrency'] / $v['scurrency'], 4) * 100);
}
}
}
示例2: arc_mid
function arc_mid($mid = 0, $matid = 0)
{
//从会员id读取档案资料
global $db, $tblprefix, $cotypes;
if (!($mid = max(0, intval($mid)))) {
return false;
}
$this->matid = max(0, intval($matid));
if (!($this->matid = max(0, intval($matid)))) {
return false;
}
if (!($this->matype = read_cache('matype', $this->matid))) {
return false;
}
$sqlstr = 'm.mchid,m.caid';
foreach ($cotypes as $k => $v) {
$sqlstr .= ",m.ccid{$k}";
}
if (!($this->archive = $db->fetch_one("SELECT ma.*,{$sqlstr} FROM {$tblprefix}members m LEFT JOIN {$tblprefix}marchives_{$this->matid} ma ON ma.mid=m.mid WHERE mid='{$mid}'"))) {
$this->init();
return false;
}
if (!($this->maid = @$this->archive['maid'])) {
$this->init();
return false;
}
arr_tag2atm($this->archive, 'ma');
return true;
}
示例3: field_votes
function field_votes($fname, $type, $id, $onlyvote = 1)
{
global $db, $tblprefix;
$arr = array('archives' => array('fields', 'aid', 'chid'), 'members' => array('mfields', 'mid', 'mchid'), 'farchives' => array('ffields', 'aid', 'chid'), 'catalogs' => array('cafields', 'caid', ''), 'coclass' => array('ccfields', 'ccid', ''), 'offers' => array('ofields', 'cid', ''), 'replys' => array('rfields', 'cid', ''), 'comments' => array('cfields', 'cid', ''), 'mcfields' => array('mcomments', 'cid', ''), 'mrfields' => array('mreplys', 'cid', ''));
if (!$fname || !$type || !$arr[$type][0] || !$id || !($item = $db->fetch_one("SELECT * FROM {$tblprefix}{$type} WHERE " . $arr[$type][1] . "='{$id}'", 'SILENT'))) {
return array();
}
$typeid = $arr[$type][2] ? $item[$arr[$type][2]] : '';
$fields = read_cache($arr[$type][0], $typeid);
if (!($field = @$fields[$fname]) || $field['datatype'] != 'vote') {
return array();
}
$needadd = true;
if ($type == 'archives' && !$field['mcommon']) {
$tbl = $type . "_{$typeid}";
} elseif ($type == 'members') {
$tbl = $type . ($field['mcommon'] ? '_sub' : "_{$typeid}");
} elseif ($type == 'farchives') {
$tbl = $type . "_{$typeid}";
} else {
$needadd = false;
}
if ($needadd && ($r = $db->fetch_one("SELECT * FROM {$tblprefix}{$tbl} WHERE " . $arr[$type][1] . "='{$id}'", 'SILENT'))) {
$item += $r;
}
return empty($item[$fname]) || !($votes = @unserialize($item[$fname])) ? array() : ($onlyvote ? $votes : $item);
}
示例4: olc_cache_also_purchased
function olc_cache_also_purchased($auto_expire = false, $refresh = false)
{
if ($refresh == true || !read_cache($cache_output, 'also_purchased-' . SESSION_LANGUAGE . '.cache' . $_GET['products_id'], $auto_expire)) {
ob_start();
include DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS;
$cache_output = ob_get_contents();
ob_end_clean();
write_cache($cache_output, 'also_purchased-' . SESSION_LANGUAGE . '.cache' . $_GET['products_id']);
}
return $cache_output;
}
示例5: olc_cache_manufacturers_box
function olc_cache_manufacturers_box($auto_expire = false, $refresh = false)
{
if ($refresh == true || !read_cache($cache_output, 'manufacturers_box-' . SESSION_LANGUAGE . '.cache' . $_GET['manufacturers_id'], $auto_expire)) {
ob_start();
include box_code_script_path('manufacturers.php');
$cache_output = ob_get_contents();
ob_end_clean();
write_cache($cache_output, 'manufacturers_box-' . SESSION_LANGUAGE . '.cache' . $_GET['manufacturers_id']);
}
return $cache_output;
}
示例6: olc_cache_categories_box
function olc_cache_categories_box($auto_expire = false, $refresh = false)
{
global $cPath, $foo, $id, $categories_string;
if ($refresh == true || !read_cache($cache_output, 'categories_box-' . SESSION_LANGUAGE . '.cache' . $cPath, $auto_expire)) {
ob_start();
include box_code_script_path('categories.php');
$cache_output = ob_get_contents();
ob_end_clean();
write_cache($cache_output, 'categories_box-' . SESSION_LANGUAGE . '.cache' . $cPath);
}
return $cache_output;
}
示例7: cu_fields_deal
function cu_fields_deal($cuid = 0, $varpre = 'archivenew', &$oldarr)
{
global ${$varpre}, $currencys, $commus, $enablestock, $useredits, $curuser;
if (!$cuid || !($commu = read_cache('commu', $cuid))) {
return '';
}
$freeupdate = empty($oldarr['checked']) || empty($useredits) || $curuser->check_allow('freeupdatecheck');
if ($commu['cclass'] == 'answer') {
if (isset(${$varpre}['question'])) {
if ($freeupdate || in_array('question', $useredits)) {
${$varpre}['question'] = trim(${$varpre}['question']);
if (empty(${$varpre}['question'])) {
return lang('questcontnotn');
}
}
}
if (isset(${$varpre}['currency'])) {
if ($freeupdate || in_array('currency', $useredits)) {
if (empty($commu['setting']['crid']) || empty($currencys[$commu['setting']['crid']])) {
return lang('choose_reward_cutype');
}
if (isset($oldarr['crid']) && $commu['setting']['crid'] != $oldarr['crid']) {
return lang('rewcurtychdomoarc');
}
${$varpre}['crid'] = $commu['setting']['crid'];
${$varpre}['currency'] = max(0, intval(${$varpre}['currency']));
if (!empty($oldarr['checked']) && isset($oldarr['currency']) && ${$varpre}['currency'] < $oldarr['currency']) {
return lang('dontredrewcur');
}
if (!empty($commu['setting']['mini']) && ${$varpre}['currency'] < $commu['setting']['mini']) {
return lang('recusmmiva');
}
if (!empty($commu['setting']['max']) && ${$varpre}['currency'] > $commu['setting']['max']) {
${$varpre}['currency'] = $commu['setting']['max'];
}
}
}
} elseif ($commu['cclass'] == 'purchase') {
if (isset(${$varpre}['price'])) {
if ($freeupdate || in_array('price', $useredits)) {
${$varpre}['price'] = max(0, round(${$varpre}['price'], 2));
}
}
if (isset(${$varpre}['storage'])) {
if ($freeupdate || in_array('storage', $useredits)) {
$enablestock && (${$varpre}['storage'] = max(0, intval(${$varpre}['storage'])));
}
}
}
return '';
}
示例8: unyaml
function unyaml($file)
{
static $yaml = false;
if ($_SERVER['HTTP_HOST'] != 'localhost:8000') {
if (cache_exists($file)) {
return read_cache($file);
}
}
if (!$yaml) {
$yaml = new sfYamlParser();
}
$data = $yaml->parse(file_get_contents($file));
$data = fix_comments($data);
write_cache($file, $data);
return $data;
}
示例9: get_db_cache
function get_db_cache($sql, &$var, $filename, $refresh = false)
{
$var = array();
// check for the refresh flag and try to the data
if ($refresh == true || !read_cache($var, $filename)) {
// Didn' get cache so go to the database.
// $conn = mysql_connect("localhost", "apachecon", "apachecon");
$res = xtc_db_query($sql);
// if ($err = mysql_error()) trigger_error($err, E_USER_ERROR);
// loop through the results and add them to an array
while ($rec = xtc_db_fetch_array($res)) {
$var[] = $rec;
}
// write the data to the file
write_cache($var, $filename);
}
}
示例10: arc_allowstatic
function arc_allowstatic(&$archive)
{
//文档页是否允许静态
global $catalogs, $cotypes, $permissions, $vcps;
if (empty($archive['checked'])) {
return false;
}
if (!empty($vcps['sale'][$archive['salecp']])) {
return false;
}
if ($archive['rpmid'] > 0) {
return false;
}
$pmids = array();
$catalog = read_cache('catalog', $archive['caid'], '', $archive['sid']);
if (!empty($catalog['taxcp']) && !empty($vcps['tax'][$catalog['taxcp']])) {
return false;
}
if (!empty($catalog['rpmid']) && $archive['rpmid'] == -1) {
$pmids[] = $catalog['rpmid'];
}
foreach ($cotypes as $coid => $cotype) {
//任务一个类目都可以否决生成静态
$ccids = array_filter(explode(',', $archive["ccid{$coid}"]));
foreach ($ccids as $ccid) {
$coclass = read_cache('coclass', $coid, $ccid);
if (!empty($coclass['taxcp']) && !empty($vcps['tax'][$coclass['taxcp']])) {
return false;
}
if (!empty($cotype['permission']) && !empty($coclass['rpmid']) && $archive['rpmid'] == -1) {
$pmids[] = $coclass['rpmid'];
}
}
}
unset($catalog, $coclass);
if (!$pmids) {
return true;
}
$vpmids = array();
foreach ($permissions as $k => $v) {
if (in_array($k, $pmids) && $v['aread']) {
$vpmids[] = $k;
}
}
return $vpmids ? false : true;
}
示例11: read
function read($cid = 0, $cclass = 'offer')
{
global $db, $tblprefix, $ofields, $rfields, $cfields;
if (!in_array($cclass, array('offer', 'reply', 'comment'))) {
return $this->err_no(1);
}
if (!$cid) {
return $this->err_no(1);
}
if ($this->info) {
return 0;
}
if (!($this->info = $db->fetch_one("SELECT cu.*,cu.createdate AS ucreatedate,a.sid,a.createdate,a.caid,a.chid,a.customurl,a.subject FROM {$tblprefix}" . $cclass . "s cu LEFT JOIN {$tblprefix}archives a ON a.aid=cu.aid WHERE cu.cid='{$cid}'"))) {
return $this->err_no(1);
//指定的交互记录不存在
}
$this->cid = $cid;
$this->cclass = $cclass;
if (!($this->aid = $this->info['aid'])) {
return $this->err_no(2);
}
//文档主体不存在
$channel = read_cache('channel', $this->info['chid']);
if (!$channel[$cclass] || !($this->commu = read_cache('commu', $channel[$cclass]))) {
return $this->err_no(3);
}
//当前文档指定的交互设置不存在
cu_checkend($this->info, $cclass);
$this->citems = empty($this->commu['setting']['citems']) ? array() : explode(',', $this->commu['setting']['citems']);
$this->useredits = empty($this->commu['setting']['useredits']) ? array() : explode(',', $this->commu['setting']['useredits']);
$fvar = substr($cclass, 0, 1) . 'fields';
global ${$fvar};
foreach (${$fvar} as $k => $v) {
if (in_array($k, $this->citems)) {
$this->fields[$k] = $v;
if ($v['isfunc']) {
$this->func = 1;
}
}
}
if ($this->commu['func']) {
$this->func = 1;
}
unset($channel, $v);
return 0;
}
示例12: arcid
function arcid($aid)
{
global $db, $tblprefix, $fcatalogs, $fchannels;
$aid = max(0, intval($aid));
if (!$aid) {
return false;
}
if (!($this->archive = $db->fetch_one("SELECT * FROM {$tblprefix}farchives WHERE aid='{$aid}'"))) {
$this->init();
return false;
}
$this->aid = $this->archive['aid'];
$this->channel = $fchannels[$this->archive['chid']];
$this->catalog = read_cache('fcatalog', $this->archive['fcaid']);
if ($archive = $db->fetch_one("SELECT * FROM {$tblprefix}farchives_" . $this->archive['chid'] . " WHERE aid='" . $this->aid . "'")) {
$this->archive = array_merge($this->archive, $archive);
unset($archive);
}
arr_tag2atm($this->archive, 'f');
$this->archive['catalog'] = $fcatalogs[$this->archive['fcaid']]['title'];
$this->archive['channle'] = $this->channel['cname'];
return true;
}
示例13: tep_cache_also_purchased
function tep_cache_also_purchased($auto_expire = false, $refresh = false)
{
global $_GET, $language, $languages_id;
$cache_output = '';
if (isset($_GET['products_id']) && is_numeric($_GET['products_id'])) {
if ($refresh == true || !read_cache($cache_output, 'also_purchased-' . $language . '.cache' . $_GET['products_id'], $auto_expire)) {
ob_start();
include DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS;
$cache_output = ob_get_contents();
ob_end_clean();
write_cache($cache_output, 'also_purchased-' . $language . '.cache' . $_GET['products_id']);
}
}
return $cache_output;
}
示例14: empty
include_once M_ROOT . "./include/fields.cls.php";
include_once M_ROOT . "./include/upload.cls.php";
include_once M_ROOT . "./include/marcedit.cls.php";
$forward = empty($forward) ? M_REFERER : $forward;
$forwardstr = '&forward=' . rawurlencode($forward);
$maid = empty($maid) ? 0 : max(0, intval($maid));
$matid = empty($matid) ? 0 : max(0, intval($matid));
$aedit = new cls_marcedit();
$aedit->set_id($maid, $matid, 0);
if (!$aedit->maid) {
mcmessage('choosemarchive');
}
if ($aedit->archive['mid'] != $memberid) {
mcmessage('selectyoumarc');
}
$fields = read_cache('mafields', $matid);
if (!submitcheck('bmarchive')) {
$a_field = new cls_field();
$submitstr = '';
tabheader($aedit->matype['cname'] . ' - ' . lang('contentsetting'), 'marchive', "?matid={$matid}&maid={$maid}&action=marchive{$param_suffix}{$forwardstr}", 2, 1, 1, 1);
foreach ($fields as $k => $field) {
if ($field['available'] && !$field['isadmin'] && !$field['isfunc']) {
$a_field->init();
$a_field->field = $field;
$a_field->oldvalue = isset($aedit->archive[$k]) ? $aedit->archive[$k] : '';
$a_field->trfield('marchivenew', '', 'ma', $matid);
$submitstr .= $a_field->submitstr;
}
}
unset($a_field);
tabfooter('bmarchive');
示例15: deal_search
function deal_search($fpre = '')
{
//$fpre为查询字串中的表别名,如a.,c.,m.等
if (!$this->field['available'] || !$this->field['issearch']) {
return;
}
$fn = $this->field['ename'];
global ${$fn}, ${$fn . 'str'}, ${$fn . 'from'}, ${$fn . 'to'}, ${$fn . '_0'}, ${$fn . '_1'}, ${$fn . 'diff'};
if ($this->field['datatype'] == 'select') {
if ($this->field['issearch'] == '1') {
if (${$fn} != '') {
$this->searchstr = $fpre . $fn . "='" . ${$fn} . "'";
$this->filterstr = $fn . "=" . rawurlencode(stripslashes(${$fn}));
}
} else {
if (!empty(${$fn})) {
${$fn . 'str'} = implode("\t", ${$fn});
} elseif (!empty(${$fn . 'str'})) {
${$fn} = explode("\t", ${$fn . 'str'});
} else {
${$fn . 'str'} = '';
}
if (${$fn . 'str'} != '') {
$this->searchstr = $fpre . $fn . " " . multi_str(${$fn});
$this->filterstr = $fn . "str=" . rawurlencode(stripslashes(${$fn . 'str'}));
}
}
} elseif ($this->field['datatype'] == 'mselect') {
if ($this->field['issearch'] == '1') {
if (${$fn} != '') {
$this->searchstr = $fpre . $fn . " LIKE '%" . str_replace(array(' ', '*'), '%', addcslashes(${$fn}, '%_')) . "%'";
$this->filterstr = $fn . "=" . rawurlencode(stripslashes(${$fn}));
}
} else {
if (!empty(${$fn})) {
${$fn . 'str'} = implode("\t", ${$fn});
} elseif (!empty(${$fn . 'str'})) {
${$fn} = explode("\t", ${$fn . 'str'});
} else {
${$fn . 'str'} = '';
}
if (${$fn . 'str'} != '') {
foreach (${$fn} as $v) {
$this->searchstr .= ($this->searchstr ? ' OR ' : '') . $fpre . $fn . " LIKE '%" . str_replace(array(' ', '*'), '%', addcslashes($v, '%_')) . "%'";
}
$this->searchstr = '(' . $this->searchstr . ')';
$this->filterstr = $fn . "str=" . rawurlencode(stripslashes(${$fn . 'str'}));
}
}
} elseif ($this->field['datatype'] == 'text') {
${$fn} = empty(${$fn}) ? '' : cutstr(trim(${$fn}), 20, '');
if (${$fn} != '') {
$this->searchstr = $this->field['issearch'] == 1 ? $fpre . $fn . "='" . ${$fn} . "'" : $fpre . $fn . " LIKE '%" . str_replace(array(' ', '*'), '%', addcslashes(${$fn}, '%_')) . "%'";
$this->filterstr = $fn . "=" . rawurlencode(stripslashes(${$fn}));
}
} elseif ($this->field['datatype'] == 'cacc') {
if (${$fn} = empty(${$fn}) ? 0 : max(0, intval(${$fn}))) {
$arr = $this->field['length'] ? read_cache('coclasses', $this->field['length']) : read_cache('acatalogs');
$this->searchstr = caccsql($fpre . $fn, $this->field['issearch'] == 1 ? array(${$fn}) : cnsonids(${$fn}, $arr), $this->field['max']);
$this->filterstr = $fn . "=" . ${$fn};
}
} elseif ($this->field['datatype'] == 'map') {
if (${$fn . 'diff'} = empty(${$fn . 'diff'}) ? 0 : abs(${$fn . 'diff'})) {
$this->searchstr = mapsql(${$fn . '_0'}, ${$fn . '_1'}, ${$fn . 'diff'}, $this->field['issearch'], $fpre . $fn);
$this->filterstr = $fn . '_0=' . ${$fn . '_0'} . '&' . $fn . '_1=' . ${$fn . '_1'} . '&' . $fn . 'diff=' . ${$fn . 'diff'};
}
} elseif (in_array($this->field['datatype'], array('int', 'float', 'date'))) {
if ($this->field['issearch'] == '1') {
${$fn} = trim(${$fn});
if ($this->field['datatype'] == 'date' && !isdate(${$fn}) || in_array($this->field['datatype'], array('int', 'float')) && !is_numeric(${$fn})) {
${$fn} = '';
}
if (${$fn} != '') {
$this->field['datatype'] == 'int' && (${$fn} = intval(${$fn}));
$this->field['datatype'] == 'float' && (${$fn} = floatval(${$fn}));
$this->searchstr = $this->field['datatype'] == 'date' ? $fpre . $fn . "='" . strtotime(${$fn}) . "'" : $fpre . $fn . "='" . ${$fn} . "'";
$this->filterstr = $fn . "=" . rawurlencode(${$fn});
}
} else {
${$fn . 'from'} = trim(${$fn . 'from'});
if ($this->field['datatype'] == 'date' && !isdate(${$fn . 'from'}) || in_array($this->field['datatype'], array('int', 'float')) && !is_numeric(${$fn . 'from'})) {
${$fn . 'from'} = '';
}
if (${$fn . 'from'} != '') {
$this->field['datatype'] == 'int' && (${$fn . 'from'} = intval(${$fn . 'from'}));
$this->field['datatype'] == 'float' && (${$fn . 'from'} = floatval(${$fn . 'from'}));
$this->searchstr = $this->field['datatype'] == 'date' ? $fpre . $fn . ">='" . strtotime(${$fn . 'from'}) . "'" : $fpre . $fn . ">='" . ${$fn . 'from'} . "'";
$this->filterstr = $fn . "from=" . rawurlencode(${$fn . 'from'});
}
${$fn . 'to'} = trim(${$fn . 'to'});
if ($this->field['datatype'] == 'date' && !isdate(${$fn . 'to'}) || in_array($this->field['datatype'], array('int', 'float')) && !is_numeric(${$fn . 'to'})) {
${$fn . 'to'} = '';
}
if (${$fn . 'to'} != '') {
$this->field['datatype'] == 'int' && (${$fn . 'to'} = intval(${$fn . 'to'}));
$this->field['datatype'] == 'float' && (${$fn . 'to'} = floatval(${$fn . 'to'}));
$this->searchstr .= ($this->searchstr ? " AND " : "") . $fpre . $fn . "<'" . ($this->field['datatype'] == 'date' ? strtotime(${$fn . 'to'}) : ${$fn . 'to'}) . "'";
$this->filterstr .= ($this->filterstr ? '&' : '') . $fn . "to=" . rawurlencode(${$fn . 'to'});
}
}
//.........这里部分代码省略.........