本文整理汇总了PHP中e107::unserialize方法的典型用法代码示例。如果您正苦于以下问题:PHP e107::unserialize方法的具体用法?PHP e107::unserialize怎么用?PHP e107::unserialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类e107
的用法示例。
在下文中一共展示了e107::unserialize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sc_attachments
function sc_attachments($parm = array())
{
$tp = e107::getParser();
if ($this->postInfo['post_attachments']) {
$baseDir = $this->forum->getAttachmentPath($this->postInfo['post_user']);
$images = array();
$txt = '';
$attachArray = e107::unserialize($this->postInfo['post_attachments']);
//print_a($attachArray);
foreach ($attachArray as $type => $vals) {
foreach ($vals as $key => $file) {
list($date, $user, $name) = explode("_", $file, 3);
switch ($type) {
case "file":
$url = e_REQUEST_SELF . "?id=" . $this->postInfo['post_id'] . "&dl=" . $key;
if (defset("BOOTSTRAP") == 3) {
$txt .= "<a class='forum-attachment-file btn btn-sm btn-default' href='" . $url . "'>" . $tp->toGlyph('glyphicon-save') . " {$name}</a><br />";
} else {
$txt .= IMAGE_attachment . " <a href='" . $url . "'>{$name}</a><br />";
}
break;
case 'img':
//Always use thumb to hide the hash.
// return $baseDir.$file;
if (file_exists($baseDir . $file)) {
$thumb = $tp->thumbUrl($baseDir . $file, 'x=1', true);
$full = $tp->thumbUrl($baseDir . $file, 'w=1000&x=1', true);
$inc = vartrue($parm['modal']) ? "data-toggle='modal' data-target='#" . $parm['modal'] . "' " : "";
$images[] = "<a {$inc} rel='external' href='{$full}' class='forum-attachment-image' ><img class='thumbnail' src='{$thumb}' alt='' /></a>";
} elseif (ADMIN) {
$images[] = "Missing File: " . $baseDir . $file;
}
break;
}
}
}
if (count($images)) {
if (deftrue('BOOTSTRAP')) {
return "<ul class='thumbnails list-unstyled list-inline'><li>" . implode("</li><li>", $images) . "</li></ul>" . vartrue($txt);
} else {
return implode("<br />", $images) . "<br />" . vartrue($txt);
}
}
return $txt;
}
}
示例2: __construct
public function __construct($force = false)
{
$this->ranks = array();
$this->userRanks = array();
$this->imageFolder = is_dir(THEME . 'images/ranks') ? THEME_ABS . 'images/ranks/' : e_IMAGE_ABS . 'ranks/';
$e107 = e107::getInstance();
$sql = e107::getDb();
//Check to see if we can get it from cache
if ($force == false && ($ranks = $e107->ecache->retrieve_sys('nomd5_user_ranks'))) {
$this->ranks = e107::unserialize($ranks);
} else {
//force is true, or cache doesn't exist, or system cache disabled, let's get it from table
$this->ranks = array();
if ($sql->select('generic', '*', "gen_type = 'user_rank_data' ORDER BY gen_intdata ASC")) {
$i = 1;
while ($row = $sql->fetch()) {
$tmp = array();
$tmp['name'] = $row['gen_ip'];
$tmp['thresh'] = $row['gen_intdata'];
$tmp['lan_pfx'] = $row['gen_user_id'];
$tmp['image'] = $row['gen_chardata'];
$tmp['id'] = $row['gen_id'];
if ($row['gen_datestamp']) {
$this->ranks['special'][$row['gen_datestamp']] = $tmp;
} else {
$this->ranks['data'][$i++] = $tmp;
}
}
}
$e107->ecache->set_sys('nomd5_user_ranks', $e107->arrayStorage->WriteArray($this->ranks, false));
}
// defaults
if (empty($this->ranks)) {
$this->setDefaultRankData();
}
}
示例3: checkPersonalManager
function checkPersonalManager()
{
global $sql, $plugintable;
$array = $this->getCategoryTree("", "", TRUE);
$catarray = array_keys($array);
$qry = "";
foreach ($catarray as $catid) {
$qry .= " content_id='" . $catid . "' || ";
}
$qry = substr($qry, 0, -3);
if ($sql->db_Select($plugintable, "content_id, content_heading, content_pref", $qry)) {
while ($row = $sql->db_Fetch(MYSQL_ASSOC)) {
if (isset($row['content_pref']) && $row['content_pref']) {
$content_pref = e107::unserialize($row['content_pref']);
//$content_pref = $eArrayStorage->ReadxxxArray($row['content_pref']);
}
if (isset($content_pref["content_manager_approve"]) && $content_pref["content_manager_approve"] != e_UC_PUBLIC && check_class($content_pref["content_manager_approve"]) || isset($content_pref["content_manager_personal"]) && $content_pref["content_manager_personal"] != e_UC_PUBLIC && check_class($content_pref["content_manager_personal"]) || isset($content_pref["content_manager_category"]) && $content_pref["content_manager_category"] != e_UC_PUBLIC && check_class($content_pref["content_manager_category"])) {
return TRUE;
}
}
}
}
示例4: elseif
} elseif (file_exists(THEME . 'banner_template.php')) {
require THEME . 'banner_template.php';
} else {
require e_PLUGIN . 'banner/banner_template.php';
}
$menu_pref = e107::getConfig('menu')->getPref('');
// legacy preference lookup.
if (defset('BOOTSTRAP')) {
$BANNER_MENU_START = $BANNER_TEMPLATE['menu']['start'];
$BANNER_MENU_ITEM = $BANNER_TEMPLATE['menu']['item'];
$BANNER_MENU_END = $BANNER_TEMPLATE['menu']['end'];
} else {
$BANNER_MENU_ITEM = $BANNER_MENU;
}
if (!empty($parm)) {
if (!($tmp = e107::unserialize($parm))) {
parse_str($parm, $parms);
// if it fails, use legacy method. (query string format)
} else {
$menu_pref = $tmp;
$menu_pref['banner_campaign'] = implode("|", $menu_pref['banner_campaign']);
unset($parm);
}
}
if (isset($parms['w']) && isset($parms['h'])) {
e107::getParser()->setThumbSize(intval($parms['w']), intval($parms['h']));
}
// print_a($menu_pref);
if (!empty($menu_pref['banner_campaign']) && !empty($menu_pref['banner_amount'])) {
$sc = e107::getScBatch('banner');
$ret = array();
示例5: upgrade_1_24
function upgrade_1_24()
{
global $sql, $sql2, $tp, $aa;
$upgrade = TRUE;
$sqlc = new db();
$sqld = new db();
//add new preferences in core
if ($sqlc->db_Select("core", "*", "e107_name='pcontent' ")) {
$row = $sqlc->db_Fetch();
$content_pref = e107::unserialize($row['e107_value']);
//$content_pref = $eArrayStorage->ReadxxxArray($row['e107_value']);
//update theme
if (strpos($content_pref['content_theme'], "{e_") !== FALSE) {
} else {
$content_pref['content_theme'] = "{e_PLUGIN}content/templates/" . $content_pref['content_theme'] . "/";
}
$tmp1 = e107::serialize($content_pref, true);
//$tmp1 = $eArrayStorage->WritexxxArray($content_pref);
$sqld->db_Update("core", "e107_value = '{$tmp1}' WHERE e107_name = 'pcontent' ");
}
//add new preferences for each main parent
if ($sqlc->db_Select("pcontent", "content_id, content_heading, content_pref", "content_parent = '0' ")) {
while ($row = $sqlc->db_Fetch()) {
$id = $row['content_id'];
$content_pref = e107::unserialize($row['content_pref']);
//update theme
if (strpos($content_pref['content_theme'], "{e_") !== FALSE) {
} else {
$content_pref['content_theme'] = "{e_PLUGIN}content/templates/" . $content_pref['content_theme'] . "/";
}
$tmp1 = e107::serialize($content_pref, true);
$sqld->db_Update("pcontent", "content_pref='{$tmp1}' WHERE content_id='{$id}' ");
}
}
return CONTENT_ADMIN_CONVERSION_LAN_68 . "<br />";
}
示例6: renderValue
//.........这里部分代码省略.........
} else {
$value = $value ? ADMIN_TRUE_ICON : $false;
}
break;
case 'url':
if (!$value) {
break;
}
$ttl = $value;
if (vartrue($parms['href'])) {
return $tp->replaceConstants(vartrue($parms['pre']) . $value, varset($parms['replace_mod'], 'abs'));
}
if (vartrue($parms['truncate'])) {
$ttl = $tp->text_truncate($value, $parms['truncate'], '...');
}
$value = "<a href='" . $tp->replaceConstants(vartrue($parms['pre']) . $value, 'abs') . "' title='{$value}'>" . $ttl . "</a>";
break;
case 'email':
if (!$value) {
break;
}
$ttl = $value;
if (vartrue($parms['truncate'])) {
$ttl = $tp->text_truncate($value, $parms['truncate'], '...');
}
$value = "<a href='mailto:" . $value . "' title='{$value}'>" . $ttl . "</a>";
break;
case 'method':
// Custom Function
$method = $attributes['field'];
// prevents table alias in method names. ie. u.my_method.
$_value = $value;
if ($attributes['data'] == 'array') {
$value = e107::unserialize($value);
// (saved as array, return it as an array)
}
$meth = !empty($attributes['method']) ? $attributes['method'] : $method;
if (method_exists($this, $meth)) {
$parms['field'] = $field;
$value = call_user_func_array(array($this, $meth), array($value, 'read', $parms));
} else {
return "<span class='label label-important label-danger'>Missing: " . $method . "()</span>";
}
// print_a($attributes);
// Inline Editing.
if (!vartrue($attributes['noedit']) && vartrue($parms['editable'])) {
$mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], ''));
$methodParms = call_user_func_array(array($this, $method), array($value, 'inline', $parms));
if (!empty($methodParms['inlineType'])) {
$attributes['inline'] = $methodParms['inlineType'];
$methodParms = !empty($methodParms['inlineData']) ? $methodParms['inlineData'] : null;
}
if (is_string($attributes['inline'])) {
switch ($attributes['inline']) {
case 'checklist':
$xtype = 'checklist';
break;
case 'select':
case 'dropdown':
$xtype = 'select';
break;
case 'textarea':
$xtype = 'textarea';
break;
default:
$xtype = 'text';
示例7: getGlyphs
/**
* Get all Glyphs
*/
function getGlyphs($type = 'fa4', $prefix = '')
{
$icons = array();
if ($type == 'bs2') {
$matches = array('glass', 'music', 'search', 'envelope', 'heart', 'star', 'star-empty', 'user', 'film', 'th-large', 'th', 'th-list', 'ok', 'remove', 'zoom-in', 'zoom-out', 'off', 'signal', 'cog', 'trash', 'home', 'file', 'time', 'road', 'download-alt', 'download', 'upload', 'inbox', 'play-circle', 'repeat', 'refresh', 'list-alt', 'lock', 'flag', 'headphones', 'volume-off', 'volume-down', 'volume-up', 'qrcode', 'barcode', 'tag', 'tags', 'book', 'bookmark', 'print', 'camera', 'font', 'bold', 'italic', 'text-height', 'text-width', 'align-left', 'align-center', 'align-right', 'align-justify', 'list', 'indent-left', 'indent-right', 'facetime-video', 'picture', 'pencil', 'map-marker', 'adjust', 'tint', 'edit', 'share', 'check', 'move', 'step-backward', 'fast-backward', 'backward', 'play', 'pause', 'stop', 'forward', 'fast-forward', 'step-forward', 'eject', 'chevron-left', 'chevron-right', 'plus-sign', 'minus-sign', 'remove-sign', 'ok-sign', 'question-sign', 'info-sign', 'screenshot', 'remove-circle', 'ok-circle', 'ban-circle', 'arrow-left', 'arrow-right', 'arrow-up', 'arrow-down', 'share-alt', 'resize-full', 'resize-small', 'plus', 'minus', 'asterisk', 'exclamation-sign', 'gift', 'leaf', 'fire', 'eye-open', 'eye-close', 'warning-sign', 'plane', 'calendar', 'random', 'comment', 'magnet', 'chevron-up', 'chevron-down', 'retweet', 'shopping-cart', 'folder-close', 'folder-open', 'resize-vertical', 'resize-horizontal', 'hdd', 'bullhorn', 'bell', 'certificate', 'thumbs-up', 'thumbs-down', 'hand-right', 'hand-left', 'hand-up', 'hand-down', 'circle-arrow-right', 'circle-arrow-left', 'circle-arrow-up', 'circle-arrow-down', 'globe', 'wrench', 'tasks', 'filter', 'briefcase', 'fullscreen');
foreach ($matches as $match) {
$icons[] = $prefix . $match;
}
return $icons;
}
if ($type == 'bs3') {
$matches = array('adjust', 'align-center', 'align-justify', 'align-left', 'align-right', 'arrow-down', 'arrow-left', 'arrow-right', 'arrow-up', 'asterisk', 'backward', 'ban-circle', 'barcode', 'bell', 'bold', 'book
', 'bookmark', 'briefcase', 'bullhorn', 'calendar', 'camera', 'certificate', 'check', 'chevron-down', 'chevron-left', 'chevron-right', 'chevron-up', 'circle-arrow-down', 'circle-arrow-left', 'circle-arrow-right
', 'circle-arrow-up', 'cloud', 'cloud-download', 'cloud-upload', 'cog', 'collapse-down', 'collapse-up', 'comment', 'compressed', 'copyright-mark', 'credit-card', 'cutlery', 'dashboard', 'download', 'download-alt
', 'earphone', 'edit', 'eject', 'envelope', 'euro', 'exclamation-sign', 'expand', 'export', 'eye-close', 'eye-open', 'facetime-video', 'fast-backward', 'fast-forward', 'file', 'film', 'filter', 'fire', 'flag
', 'flash', 'floppy-disk', 'floppy-open', 'floppy-remove', 'floppy-save', 'floppy-saved', 'folder-close', 'folder-open', 'font', 'forward', 'fullscreen', 'gbp', 'gift
', 'glass', 'globe', 'hand-down', 'hand-left', 'hand-right', 'hand-up', 'hd-video', 'hdd', 'header', 'headphones', 'heart', 'heart-empty', 'home', 'import', 'inbox', 'indent-left', 'indent-right', 'info-sign', 'italic', 'leaf', 'link', 'list
', 'list-alt', 'lock', 'log-in', 'log-out', 'magnet', 'map-marker', 'minus', 'minus-sign', 'move', 'music', 'new-window', 'off', 'ok', 'ok-circle', 'ok-sign', 'open', 'paperclip', 'pause', 'pencil', 'phone', 'phone-alt', 'picture
', 'plane', 'play', 'play-circle', 'plus', 'plus-sign', 'print', 'pushpin', 'qrcode', 'question-sign', 'random', 'record', 'refresh', 'registration-mark', 'remove', 'remove-circle', 'remove-sign', 'repeat', 'resize-full', 'resize-horizontal
', 'resize-small', 'resize-vertical', 'retweet', 'road', 'save', 'saved', 'screenshot', 'sd-video', 'search', 'send', 'share', 'share-alt', 'shopping-cart', 'signal', 'sort', 'sort-by-alphabet', 'sort-by-alphabet-alt
', 'sort-by-attributes', 'sort-by-attributes-alt', 'sort-by-order', 'sort-by-order-alt', 'sound-5-1', 'sound-6-1', 'sound-7-1', 'sound-dolby', 'sound-stereo', 'star', 'stats', 'step-backward', 'step-forward', 'stop
', 'subtitles', 'tag', 'tags', 'tasks', 'text-height', 'text-width', 'th', 'th-large', 'th-list', 'thumbs-down', 'thumbs-up', 'time', 'tint', 'tower', 'transfer', 'trash', 'tree-conifer', 'tree-deciduous', 'unchecked', 'upload
', 'usd', 'user', 'volume-down', 'volume-off', 'volume-up', 'warning-sign', 'wrench', 'zoom-in', 'zoom-out');
foreach ($matches as $match) {
$icons[] = $prefix . $match;
}
return $icons;
}
$cache = e107::getCache();
$cache->setMD5('_' . $prefix . $type);
if ($data = $cache->retrieve($type, 360, true)) {
return e107::unserialize($data);
}
if ($type == 'fa4') {
$pattern = '/\\.(fa-(?:\\w+(?:-)?)+):before/';
$subject = e107::getFile()->getRemoteContent('http://netdna.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.css');
// print_a($subject);
} elseif ($type == 'fa3') {
$pattern = '/\\.(icon-(?:\\w+(?:-)?)+):before/';
$subject = file_get_contents(e_WEB_JS . 'font-awesome/css/font-awesome.css');
}
preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
$icons[] = $prefix . substr($match[1], 3);
}
$data = e107::serialize($icons);
$cache->set($type, $data, true);
return $icons;
}
示例8: renderMenu
/**
* Render menu
*
* @param string $mpath menu path
* @param string $mname menu name
* @param string $parm menu parameters
* @param boolean $return
* return string if required
*/
public function renderMenu($mpath, $mname = '', $parm = '', $return = false)
{
// global $sql; // required at the moment.
global $sc_style, $e107_debug;
$sql = e107::getDb();
$ns = e107::getRender();
$tp = e107::getParser();
if ($tmp = e107::unserialize($parm)) {
$parm = $tmp;
unset($tmp);
}
$this->_current_parms = $parm;
$this->_current_menu = $mname;
if ($return) {
ob_start();
}
if (e_DEBUG === true) {
echo "\n<!-- Menu Start: " . $mname . " -->\n";
}
e107::getDB()->db_Mark_Time($mname);
if (is_numeric($mpath) || $mname === false) {
$query = $mname === false ? "menu_name = '" . $mpath . "' " : "page_id=" . intval($mpath) . " ";
// load by ID or load by menu-name (menu_name)
$sql->select("page", "*", $query);
$page = $sql->fetch();
if (!empty($page['menu_class']) && !check_class($page['menu_class'])) {
echo "\n<!-- Menu not rendered due to userclass settings -->\n";
return;
}
$caption = vartrue($page['menu_icon']) ? $tp->toIcon($page['menu_icon']) : '';
$caption .= $tp->toHTML($page['menu_title'], true, 'parse_sc, constants');
if (vartrue($page['menu_template'])) {
$template = e107::getCoreTemplate('menu', $page['menu_template'], true, true);
// override and merge required. ie. when menu template is not in the theme, but only in the core.
$page_shortcodes = e107::getScBatch('page', null, 'cpage');
$page_shortcodes->setVars($page);
$head = $tp->parseTemplate($template['start'], true);
$foot = $tp->parseTemplate($template['end'], true);
// print_a($template['body']);
$text = $head . $tp->parseTemplate($template['body'], true, $page_shortcodes) . $template['end'];
// echo "TEMPLATE= ($mpath)".$page['menu_template'];
// if($template['noTableRender'] !==true) // XXX Deprecated - causes confusion while themeing. use {SETSTYLE=none} instead.
// {
$ns->tablerender($caption, $text, 'cmenu-' . $page['menu_template']);
// }
// else
// {
// echo $text;
// }
} else {
$text = $tp->toHTML($page['menu_text'], true, 'parse_sc, constants');
$ns->tablerender($caption, $text, 'cmenu');
}
} else {
// not sure what would break this, but it's good idea to go away
e107::loadLanFiles($mpath);
//include once is not an option anymore
//e107_include will break many old menus (evil globals), so we'll wait for a while...
//e107_include(e_PLUGIN.$mpath."/".$mname.".php");
//if(substr($mpath,-1)!='/')
//{
// $mpath .= '/';
//}
$mpath = trim($mpath, '/') . '/';
// faster...
$e107_debug ? include e_PLUGIN . $mpath . $mname . '.php' : @(include e_PLUGIN . $mpath . $mname . '.php');
}
e107::getDB()->db_Mark_Time("(After " . $mname . ")");
if ($error_handler->debug == true) {
echo "\n<!-- Menu End: " . $mname . " -->\n";
}
if ($return) {
$ret = ob_get_contents();
ob_end_clean();
return $ret;
}
}
示例9: load
/**
* Load data from user preferences string
* @param boolean $force
* @return e_user_pref
*/
public function load($force = false)
{
if ($force || !$this->hasData()) {
$data = $this->_user->get('user_prefs', '');
if (!empty($data)) {
// BC
$data = substr($data, 0, 5) == "array" ? e107::unserialize($data) : unserialize($data);
if (!$data) {
$data = array();
}
} else {
$data = array();
}
$this->setData($data);
}
return $this;
}
示例10: dbToBoth
/**
* Given an array (row) of data retrieved from the DB table, converts to internal format.
* Combining/splitting of fields is done as necessary
* This version intended for 'Joined' reads which have both recipient and content data
*
* @param $data - array of DB-sourced target-related data
* @param $addMissing - if TRUE, undefined fields are added
*
* @return array
*/
public function dbToBoth(&$data, $addMissing = FALSE)
{
$res = array();
$oneToOne = array_merge($this->dbTypes['mail_content'], $this->dbTypes['mail_recipients']);
// List of valid elements
// Start with simple 'one to one' fields
foreach ($oneToOne as $f => $v) {
if (isset($data[$f])) {
$res[$f] = $data[$f];
} elseif ($addMissing) {
$res[$f] = '';
}
}
// Now array fields
if (isset($data['mail_other'])) {
$tmp = e107::unserialize(str_replace('\\\'', '\'', $data['mail_other']));
// May have escaped data
if (is_array($tmp)) {
$res = array_merge($res, $tmp);
}
unset($res['mail_other']);
} elseif ($addMissing) {
foreach ($this->dbOther as $f => $v) {
$res[$f] = '';
}
}
if (isset($data['mail_target_info'])) {
$clean = stripslashes($data['mail_target_info']);
$tmp = e107::unserialize($clean);
// May have escaped data
$res['mail_target_info'] = $tmp;
}
if (isset($data['mail_media'])) {
$res['mail_media'] = e107::unserialize($data['mail_media']);
}
return $res;
}
示例11: while
} else {
if (!isset($CONTENT_SUBMIT_TYPE_TABLE)) {
if (is_readable(e_THEME . $pref['sitetheme'] . "/content/content_submit_type_template.php")) {
require_once e_THEME . $pref['sitetheme'] . "/content/content_submit_type_template.php";
} else {
require_once e_PLUGIN . "content/templates/content_submit_type_template.php";
}
}
$sql2 = "";
$content_submit_type_table_string = "";
$count = "0";
while ($row = $sql->db_Fetch()) {
if (!is_object($sql2)) {
$sql2 = new db();
}
$content_pref = e107::unserialize($row['content_pref']);
//$content_pref = $eArrayStorage->ReadxxxArray($row['content_pref']);
$content_pref["content_cat_icon_path_large"] = $content_pref["content_cat_icon_path_large"] ? $content_pref["content_cat_icon_path_large"] : "{e_PLUGIN}content/images/cat/48/";
$content_pref["content_cat_icon_path_small"] = $content_pref["content_cat_icon_path_small"] ? $content_pref["content_cat_icon_path_small"] : "{e_PLUGIN}content/images/cat/16/";
$content_cat_icon_path_large = $tp->replaceConstants($content_pref["content_cat_icon_path_large"]);
$content_cat_icon_path_small = $tp->replaceConstants($content_pref["content_cat_icon_path_small"]);
$content_icon_path = $tp->replaceConstants($content_pref["content_icon_path"]);
if ($content_pref["content_submit"] && check_class($content_pref["content_submit_class"])) {
$content_submit_type_table_string .= $tp->parseTemplate($CONTENT_SUBMIT_TYPE_TABLE, FALSE, $newcontent_shortcodes);
$count = $count + 1;
}
}
if ($count == "0") {
$text .= "<div style='text-align:center;'>" . CONTENT_ADMIN_SUBMIT_LAN_0 . "</div>";
} else {
$text = $CONTENT_SUBMIT_TYPE_TABLE_START . $content_submit_type_table_string . $CONTENT_SUBMIT_TYPE_TABLE_END;
示例12: getFeed
function getFeed($feedID, $force = FALSE)
{
global $e107, $admin_log;
$tp = e107::getParser();
$sql = e107::getDb();
$eArrayStorage = e107::getArrayStorage();
$this->readFeedList();
// Make sure we've got the feed data.
if (!isset($this->feedList[$feedID])) {
if (NEWSFEED_DEBUG) {
echo "Invalid feed number: {$feedID}<br />";
}
return FALSE;
}
if (strpos($this->newsList[$feedID]['newsfeed_data'], 'MagpieRSS')) {
$force = true;
}
if ($force || !isset($this->newsList[$feedID]['newsfeed_data']) || !$this->newsList[$feedID]['newsfeed_data']) {
// No data already in memory
if ($force || !($this->newsList[$feedID]['newsfeed_data'] = $e107->ecache->retrieve(NEWSFEED_NEWS_CACHE_TAG . $feedID, $this->feedList[$feedID]['newsfeed_updateint'] / 60))) {
// Need to re-read from source - either no cached data yet, or cache expired
if (NEWSFEED_DEBUG) {
$admin_log->e_log_event(10, debug_backtrace(), "DEBUG", "Newsfeed update", "Refresh item: " . $feedID, FALSE, LOG_TO_ROLLING);
}
require_once e_HANDLER . 'xml_class.php';
$xml = new xmlClass();
require_once e_HANDLER . 'magpie_rss.php';
$dbData = array();
// In case we need to update DB
if ($rawData = $xml->getRemoteFile($this->feedList[$feedID]['newsfeed_url'])) {
$rss = new MagpieRSS($rawData);
list($newsfeed_image, $newsfeed_showmenu, $newsfeed_showmain) = explode("::", $this->feedList[$feedID]['newsfeed_image']);
$temp['channel'] = $rss->channel;
if ($newsfeed_showmenu == 0 || $newsfeed_showmain == 0) {
$temp['items'] = $rss->items;
// Unlimited items
} else {
$temp['items'] = array_slice($rss->items, 0, max($newsfeed_showmenu, $newsfeed_showmain));
// Limited items
}
$newsfeed_des = FALSE;
if ($this->feedList[$feedID]['newsfeed_description'] == 'default') {
$temp['newsfeed_description'] = 'default';
// This prevents db writes if no better data found
if ($rss->channel['description']) {
$newsfeed_des = $tp->toDB($rss->channel['description']);
$temp['newsfeed_description'] = $newsfeed_des;
} elseif ($rss->channel['tagline']) {
$newsfeed_des = $tp->toDB($rss->channel['tagline']);
$temp['newsfeed_description'] = $newsfeed_des;
}
if ($temp['newsfeed_description'] != $this->feedList[$feedID]['newsfeed_description']) {
// Need to write updated feed name to DB
$this->feedList[$feedID]['newsfeed_description'] = $temp['newsfeed_description'];
$dbData['newsfeed_description'] = $temp['newsfeed_description'];
if ($this->useCache) {
$e107->ecache->clear(NEWSFEED_LIST_CACHE_TAG);
// Clear the newsfeed cache so its re-read next time
}
}
}
if ($newsfeed_image == 'default') {
$temp['newsfeed_image_link'] = "<a href='" . $rss->image['link'] . "' rel='external'><img src='" . $rss->image['url'] . "' alt='" . $rss->image['title'] . "' style='vertical-align: middle;' /></a>";
} else {
$temp['newsfeed_image_link'] = "<img src='" . $this->feedList[$feedID]['newsfeed_image'] . "' alt='' />";
}
$serializedArray = $eArrayStorage->WriteArray($temp, FALSE);
$now = time();
$this->newsList[$feedID]['newsfeed_data'] = $serializedArray;
$this->newsList[$feedID]['newsfeed_timestamp'] = $now;
if ($this->useCache) {
$e107->ecache->set(NEWSFEED_NEWS_CACHE_TAG . $feedID, $serializedArray);
} else {
$dbData['newsfeed_data'] = addslashes($serializedArray);
$dbData['newsfeed_timestamp'] = $now;
}
if (count($dbData)) {
if (FALSE === $sql->db_UpdateArray('newsfeed', $dbData, " WHERE newsfeed_id=" . $feedID)) {
if (NEWSFEED_DEBUG) {
echo NFLAN_48 . "<br /><br />" . var_dump($dbData);
}
}
}
unset($rss);
} else {
if (NEWSFEED_DEBUG) {
echo $xml->error;
}
return FALSE;
}
}
}
return e107::unserialize($this->newsList[$feedID]['newsfeed_data']);
}
示例13: menuInstanceParameters
/**
* This one will be greatly extended, allowing menus to offer UI and us
* settings per instance later ($parm variable available for menus - same as shortcode's $parm)
*/
function menuInstanceParameters()
{
if (!vartrue($_GET['parmsId'])) {
return;
}
$id = intval($_GET['parmsId']);
$frm = e107::getForm();
$sql = e107::getDb();
if (!$sql->select("menus", "*", "menu_id=" . $id)) {
$this->menuAddMessage("Couldn't Load Menu", E_MESSAGE_ERROR);
return;
}
$row = $sql->fetch();
$text = "<div style='text-align:center;'>\n\t\t<form id='e-save-form' method='post' action='" . e_SELF . "?lay=" . $this->curLayout . "'>\n <fieldset id='core-menus-parametersform'>\n\t\t<legend>" . MENLAN_44 . " " . $row['menu_name'] . "</legend>\n <table class='table '>\n <colgroup>\n <col class='col-label' />\n <col class='col-control' />\n </colgroup>\n\n\t\t";
if (file_exists(e_PLUGIN . $row['menu_path'] . "e_menu.php")) {
$plug = rtrim($row['menu_path'], '/');
$obj = e107::getAddon($plug, 'e_menu');
if (!is_object($obj)) {
$text .= "<tr><td colspan='2' class='alert alert-danger'>{$plug} object not found. Try re-scanning plugin directories in Tools > Database. </td></tr>";
} else {
$menuName = substr($row['menu_name'], 0, -5);
}
$fields = e107::callMethod($obj, 'config', $menuName);
if (!($form = e107::getAddon($plug, 'e_menu', $plug . "_menu_form"))) {
$form = $frm;
}
$value = e107::unserialize($row['menu_parms']);
if (!empty($fields)) {
foreach ($fields as $k => $v) {
$text .= "<tr><td class='text-left'>" . $v['title'] . "</td>";
$v['writeParms']['class'] = 'e-save';
$i = $k;
if (!empty($v['multilan'])) {
$i = $k . '[' . e_LANGUAGE . ']';
if (isset($value[$k][e_LANGUAGE])) {
$value[$k] = varset($value[$k][e_LANGUAGE], '');
}
}
$text .= "<td class='text-left'>" . $form->renderElement($i, $value[$k], $v) . "</td></tr>";
}
} else {
$text .= "<tr><td colspan='2' class='alert alert-danger'>No Fields Set in " . $row['menu_path'] . "e_menu.php</td></tr>";
}
} else {
$text .= "<tr>\n\t\t\t<td>\n\t\t\t" . MENLAN_45 . "</td>\n\t\t\t<td>\n\t\t\t" . $frm->text('menu_parms', $row['menu_parms'], 900, 'class=e-save&size=xxlarge') . "\n\t\t\t</td>\n\t\t\t</tr>";
}
$text .= "</table>";
/*
$text .= "
<div class='buttons-bar center'>";
$text .= $frm->admin_button('parms_submit', LAN_SAVE, 'update');
$text .= "<input type='hidden' name='menu_id' value='".$id."' />
</div>";
*/
$text .= $frm->hidden('mode', 'parms');
$text .= $frm->hidden('menu_id', $id);
$text .= "\n\t\t</fieldset>\n\t\t</form>\n\t\t</div>";
return $text;
}
示例14: show_contentmanager
function show_contentmanager($mode, $userid = "", $username = "")
{
global $row, $tp, $sql, $ns, $rs, $plugintable, $plugindir, $aa;
global $CONTENT_CONTENTMANAGER_CATEGORY, $CONTENT_CONTENTMANAGER_TABLE, $CONTENT_CONTENTMANAGER_TABLE_START, $CONTENT_CONTENTMANAGER_TABLE_END, $content_pref, $pref;
$newcontent_shortcodes = e107::getScBatch('content', TRUE);
$personalmanagercheck = FALSE;
if (!isset($CONTENT_CONTENTMANAGER_TABLE)) {
if (is_readable(e_THEME . $pref['sitetheme'] . "/content/content_manager_template.php")) {
require_once e_THEME . $pref['sitetheme'] . "/content/content_manager_template.php";
} else {
require_once e_PLUGIN . "content/templates/content_manager_template.php";
}
}
$array = $aa->getCategoryTree("", "", TRUE);
$catarray = array_keys($array);
$content_contentmanager_table_string = "";
foreach ($catarray as $catid) {
if ($sql->db_Select($plugintable, "content_id, content_heading, content_pref", " content_id='" . intval($catid) . "' ")) {
$row = $sql->db_Fetch(MYSQL_ASSOC);
$content_pref = e107::unserialize($row['content_pref']);
//$content_pref = $eArrayStorage->ReadxxxArray($row['content_pref']);
if (isset($content_pref["content_manager_approve"]) && $content_pref["content_manager_approve"] != e_UC_PUBLIC && check_class($content_pref["content_manager_approve"]) || isset($content_pref["content_manager_personal"]) && $content_pref["content_manager_personal"] != e_UC_PUBLIC && check_class($content_pref["content_manager_personal"]) || isset($content_pref["content_manager_category"]) && $content_pref["content_manager_category"] != e_UC_PUBLIC && check_class($content_pref["content_manager_category"])) {
$personalmanagercheck = TRUE;
$content_contentmanager_table_string .= $tp->parseTemplate($CONTENT_CONTENTMANAGER_TABLE, FALSE, $newcontent_shortcodes);
}
}
}
if ($personalmanagercheck == TRUE) {
$text = $CONTENT_CONTENTMANAGER_TABLE_START . $content_contentmanager_table_string . $CONTENT_CONTENTMANAGER_TABLE_END;
$ns->tablerender(CONTENT_ADMIN_ITEM_LAN_56, $text);
} else {
header("location:" . $plugindir . "content.php");
exit;
}
}
示例15: to_html
function to_html($text, $area = 'olddefault')
{
if (is_string($this->area_opts)) {
$this->area_opts = e107::unserialize($this->area_opts);
}
if (!$this->lw_enabled || !count($this->area_opts) || !array_key_exists($area, $this->area_opts) || !$this->area_opts[$area]) {
return $text;
}
// No linkwords in disabled areas
// Split up by HTML tags and process the odd bits here
$ptext = "";
$lflag = FALSE;
// Shouldn't need utf-8 on next line - just looking for HTML tags
$content = preg_split('#(<.*?>)#mis', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
foreach ($content as $cont) {
if ($cont[0] == "<") {
// Its some HTML
$ptext .= $cont;
if (substr($cont, 0, 2) == "<a") {
$lflag = TRUE;
}
if (substr($cont, 0, 3) == "</a") {
$lflag = FALSE;
}
} else {
if ($lflag) {
$ptext .= $cont;
} else {
if (trim($cont)) {
// Some non-white space - worth word matching
$ptext .= $this->linksproc($cont, 0, count($this->word_list));
// echo "Check linkwords: ".count($this->word_list).'<br />';
} else {
$ptext .= $cont;
}
}
}
}
// print_a($this->wordCount);
return $ptext;
}