本文整理汇总了PHP中e107::serialize方法的典型用法代码示例。如果您正苦于以下问题:PHP e107::serialize方法的具体用法?PHP e107::serialize怎么用?PHP e107::serialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类e107
的用法示例。
在下文中一共展示了e107::serialize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: convert_serialized
function convert_serialized($serializedData)
{
$arrayData = unserialize($serializedData);
return e107::serialize($arrayData, FALSE);
}
示例2: 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;
}
示例3: insert_default_prefs
function insert_default_prefs($id)
{
global $sql, $aa, $plugintable;
$plugintable = "pcontent";
$plugindir = e_PLUGIN . "content/";
unset($content_pref, $tmp);
if (!is_object($aa)) {
require_once $plugindir . "handlers/content_class.php";
$aa = new content();
}
$content_pref = $aa->ContentDefaultPrefs($id);
$tmp = e107::serialize($content_pref, true);
//$tmp = $eArrayStorage->WritexxxArray($content_pref);
$sql->db_Update($plugintable, "content_pref='{$tmp}' WHERE content_id='{$id}' ");
}
示例4: dbAssignAdmins
function dbAssignAdmins($mode, $id, $value)
{
global $plugintable, $qs, $sql;
if ($mode == "admin") {
$id = intval($id);
$sql->db_Select($plugintable, "content_pref", "content_id = '" . intval($id) . "' ");
$row = $sql->db_Fetch();
//get current preferences
$content_pref = e107::unserialize($row['content_pref']);
//$content_pref = $eArrayStorage->ReadxxxArray($row['content_pref']);
//assign new preferences
if ($value == "clear") {
$content_pref["content_manager_allowed"] = "";
} else {
$content_pref["content_manager_allowed"] = $value;
}
//create new array of preferences
$tmp = e107::serialize($content_pref, true);
//$tmp = $eArrayStorage->WritexxxArray($content_pref);
$sql->db_Update($plugintable, "content_pref = '{$tmp}' WHERE content_id = '" . intval($id) . "' ");
$message = CONTENT_ADMIN_CAT_LAN_34;
return $message;
} else {
return FALSE;
}
}
示例5: setParms
/**
* Set Parms for a specific menu.
* @param string $plugin ie. plugin folder name.
* @param string $menu menu name. including the _menu but not the .php
* @param array $parms
* @param string|int $location default 'all' or a menu area number..
* @return int|boolean number of records updated or false.
*/
public function setParms($plugin, $menu, $parms = array(), $location = 'all')
{
$qry = 'menu_parms="' . e107::serialize($parms) . '" WHERE menu_parms="" AND menu_path="' . $plugin . '/" AND menu_name="' . $menu . '" ';
$qry .= $location != 'all' ? 'menu_location=' . intval($location) : '';
return e107::getDb()->update('menus', $qry);
}
示例6: step10_ajax
//.........这里部分代码省略.........
$att['html'] = $match[0];
$att['name'] = str_replace(array("\r\n", "\n", "\r"), '', $match[1]);
$att['thumb'] = '';
$attachments[] = $att;
logAttachment($att['thread_id'], 'img', $att['name']);
}
}
}
/*
if (preg_match_all('#\[img.*?\](\.\./\.\./e107_files/public/.*?_FT\d+_.*?)\[/img\]#ms', $post['post_entry'], $matches, PREG_SET_ORDER))
{
foreach ($matches as $match)
{
//Ensure it hasn't already been handled above
if (!in_array($match[1], $foundFiles))
{
$att = array();
$att['thread_id'] = $post['post_thread'];
$att['type'] = 'img';
$att['html'] = $match[0];
$att['name'] = $match[1];
$att['thumb'] = '';
$attachments[] = $att;
}
}
}
*/
//[file={e_FILE}public/1230090820_1_FT0_julia.zip]julia.zip[/file]
//Check for attached file (non-images)
// if (preg_match_all('#\[file=({e_FILE}.*?)\](.*?)\[/file\]#ms', $post['post_entry'], $matches, PREG_SET_ORDER))
if (preg_match_all('#\\[file=(({e_FILE}|e107_files|\\.\\./\\.\\./e107_files)[^\\]]*)#ms', $post['post_entry'], $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$att = array();
$att['thread_id'] = $post['post_thread'];
$att['type'] = 'file';
$att['html'] = $match[0];
$att['name'] = $match[1];
$att['thumb'] = '';
$attachments[] = $att;
logAttachment($att['thread_id'], 'file', $att['name']);
}
}
/*
if (preg_match_all('#\[file=(\.\./\.\./e107_files/public/.*?)\](.*?)\[/file\]#ms', $post['post_entry'], $matches, PREG_SET_ORDER))
{
foreach ($matches as $match)
{
$att = array();
$att['thread_id'] = $post['post_thread'];
$att['type'] = 'file';
$att['html'] = $match[0];
$att['name'] = $match[1];
$att['thumb'] = '';
$attachments[] = $att;
}
}
*/
if (count($attachments)) {
$f->log("found " . count($attachments) . " attachments");
$newValues = array();
$info = array();
$info['post_entry'] = $post['post_entry'];
foreach ($attachments as $attachment) {
$error = '';
$f->log($attachment['name']);
if ($f->moveAttachment($attachment, $post, $error)) {
$type = $attachment['type'];
$newValues[$type][] = basename($attachment['name']);
$info['post_entry'] = str_replace($attachment['html'], '', $info['post_entry']);
} else {
$errorText .= "Failure processing post {$post['post_id']} - file {$attachment['name']} - {$error}<br />";
$f->log("Failure processing post {$post['post_id']} - file {$attachment['name']} - {$error}");
}
}
// echo $errorText."<br />";
// Did we make any changes at all?
if (count($newValues)) {
$info['WHERE'] = 'post_id = ' . $post['post_id'];
$info['post_attachments'] = e107::serialize($newValues);
// $sql->update('forum_post', $info); // XXX FIXME TODO screwed up due to _FIELD_DEFS
$sql->update('forum_post', "post_entry = \"" . $info['post_entry'] . "\", post_attachments=\"" . $info['post_attachments'] . "\" WHERE post_id = " . $post['post_id'] . "");
}
}
}
$totalOutput = round($_SESSION['forumupdate']['attachment_count'] / $_SESSION['forumupdate']['attachment_total'] * 100, 1);
echo $totalOutput;
/*
$debugRound = "
forumupdate_attachment_count = ".$_SESSION['forumupdate']['attachment_count']."
forumupdate_attachment_total = ".$_SESSION['forumupdate']['attachment_total']."
calculated = ".$totalOutput."
";
file_put_contents(e_LOG."forum_update_step10.log",$debugRound,FILE_APPEND);
*/
} else {
echo 100;
}
}
示例7: insertPost
/**
* Insert a new thread or a reply/quoted reply.
*/
function insertPost()
{
$postInfo = array();
$threadInfo = array();
$threadOptions = array();
$fp = new floodprotect();
if (isset($_POST['newthread']) && trim($_POST['subject']) == '' || trim($_POST['post']) == '') {
message_handler('ALERT', 5);
} else {
if ($fp->flood('forum_thread', 'thread_datestamp') == false && !ADMIN) {
echo "<script type='text/javascript'>document.location.href='" . e_BASE . "index.php'</script>\n";
exit;
}
$hasPoll = $this->action == 'nt' && varset($_POST['poll_title']) && $_POST['poll_option'][0] != '' && $_POST['poll_option'][1] != '';
if (USER) {
$postInfo['post_user'] = USERID;
$threadInfo['thread_lastuser'] = USERID;
$threadInfo['thread_user'] = USERID;
$threadInfo['thread_lastuser_anon'] = '';
} else {
$postInfo['post_user_anon'] = $_POST['anonname'];
$threadInfo['thread_lastuser_anon'] = $_POST['anonname'];
$threadInfo['thread_user_anon'] = $_POST['anonname'];
}
$time = time();
$postInfo['post_entry'] = $_POST['post'];
$postInfo['post_forum'] = $this->data['forum_id'];
$postInfo['post_datestamp'] = $time;
$postInfo['post_ip'] = e107::getIPHandler()->getIP(FALSE);
$threadInfo['thread_lastpost'] = $time;
if (isset($_POST['no_emote'])) {
$postInfo['post_options'] = serialize(array('no_emote' => 1));
}
//If we've successfully uploaded something, we'll have to edit the post_entry and post_attachments
$newValues = array();
if ($uploadResult = $this->processAttachments()) {
foreach ($uploadResult as $ur) {
//$postInfo['post_entry'] .= $ur['txt'];
// $_tmp = $ur['type'].'*'.$ur['file'];
// if($ur['thumb']) { $_tmp .= '*'.$ur['thumb']; }
// if($ur['fname']) { $_tmp .= '*'.$ur['fname']; }
$type = $ur['type'];
$newValues[$type][] = $ur['file'];
// $attachments[] = $_tmp;
}
// $postInfo['_FIELD_TYPES']['post_attachments'] = 'array';
$postInfo['post_attachments'] = e107::serialize($newValues);
//FIXME XXX - broken encoding when saved to DB.
}
// var_dump($uploadResult);
switch ($this->action) {
// Reply only. Add the post, update thread record with latest post info.
// Update forum with latest post info
case 'rp':
$postInfo['post_thread'] = $this->id;
$newPostId = $this->forumObj->postAdd($postInfo);
break;
// New thread started. Add the thread info (with lastest post info), add the post.
// Update forum with latest post info
// New thread started. Add the thread info (with lastest post info), add the post.
// Update forum with latest post info
case 'nt':
$threadInfo['thread_sticky'] = MODERATOR ? (int) $_POST['threadtype'] : 0;
$threadInfo['thread_name'] = $_POST['subject'];
$threadInfo['thread_forum_id'] = $this->id;
$threadInfo['thread_active'] = 1;
$threadInfo['thread_datestamp'] = $time;
if ($hasPoll) {
$threadOptions['poll'] = '1';
}
if (is_array($threadOptions) && count($threadOptions)) {
$threadInfo['thread_options'] = serialize($threadOptions);
} else {
$threadInfo['thread_options'] = '';
}
if ($postResult = $this->forumObj->threadAdd($threadInfo, $postInfo)) {
$newPostId = $postResult['postid'];
$newThreadId = $postResult['threadid'];
$this->data['thread_id'] = $newThreadId;
// $this->data['thread_sef'] = $postResult['threadsef'];
$this->data['thread_sef'] = eHelper::title2sef($threadInfo['thread_name'], 'dashl');
if ($_POST['email_notify']) {
$this->forumObj->track('add', USERID, $newThreadId);
}
}
break;
}
e107::getMessage()->addDebug(print_a($postInfo, true));
// e107::getMessage()->addDebug(print_a($this,true));
if ($postResult === -1 || $newPostId === -1) {
require_once HEADERF;
$message = LAN_FORUM_3006 . "<br ><a class='btn btn-default' href='" . $_SERVER['HTTP_REFERER'] . "'>Return</a>";
$text = e107::getMessage()->addError($message)->render();
e107::getRender()->tablerender(LAN_PLUGIN_FORUM_NAME, $text);
// change to forum-title pref.
require_once FOOTERF;
exit;
//.........这里部分代码省略.........
示例8: readTree
/**
* Ensure the tree of userclass data is stored in our object ($this->class_tree).
* Only read if its either not present, or the $force flag is set.
* Data is cached if enabled
*
* @param boolean $force - set to TRUE to force a re-read of the info regardless.
* @return none
*/
public function readTree($force = FALSE)
{
if (isset($this->class_tree) && count($this->class_tree) && !$force) {
return;
}
$e107 = e107::getInstance();
$this->class_tree = array();
$this->class_parents = array();
if ($temp = $e107->ecache->retrieve_sys(UC_CACHE_TAG)) {
$this->class_tree = e107::getArrayStorage()->read($temp);
unset($temp);
} else {
$this->sql_r->db_Select('userclass_classes', '*', 'ORDER BY userclass_parent', 'nowhere');
// The order statement should give a consistent return
while ($row = $this->sql_r->db_Fetch(MYSQL_ASSOC)) {
$this->class_tree[$row['userclass_id']] = $row;
$this->class_tree[$row['userclass_id']]['class_children'] = array();
// Create the child array in case needed
}
// Add in any fixed classes that aren't already defined (they historically didn't have a DB entry, although now its facilitated (and necessary for tree structure)
foreach ($this->fixed_classes as $c => $d) {
if (!isset($this->class_tree[$c])) {
switch ($c) {
case e_UC_ADMIN:
case e_UC_MAINADMIN:
$this->class_tree[$c]['userclass_parent'] = e_UC_NOBODY;
break;
case e_UC_NEWUSER:
$this->class_tree[$c]['userclass_parent'] = e_UC_MEMBER;
break;
default:
$this->class_tree[$c]['userclass_parent'] = e_UC_PUBLIC;
}
$this->class_tree[$c]['userclass_id'] = $c;
$this->class_tree[$c]['userclass_name'] = $d;
$this->class_tree[$c]['userclass_description'] = 'Fixed class';
$this->class_tree[$c]['userclass_visibility'] = e_UC_PUBLIC;
$this->class_tree[$c]['userclass_editclass'] = e_UC_MAINADMIN;
$this->class_tree[$c]['userclass_accum'] = $c;
$this->class_tree[$c]['userclass_type'] = UC_TYPE_STD;
}
}
$userCache = e107::serialize($this->class_tree, FALSE);
$e107->ecache->set_sys(UC_CACHE_TAG, $userCache);
unset($userCache);
}
// Now build the tree.
// There are just two top-level classes - 'Everybody' and 'Nobody'
$this->class_parents[e_UC_PUBLIC] = e_UC_PUBLIC;
$this->class_parents[e_UC_NOBODY] = e_UC_NOBODY;
foreach ($this->class_tree as $uc) {
if ($uc['userclass_id'] != e_UC_PUBLIC && $uc['userclass_id'] != e_UC_NOBODY) {
if (!isset($this->class_tree[$uc['userclass_parent']])) {
echo "Orphaned class record: ID=" . $uc['userclass_id'] . " Name=" . $uc['userclass_name'] . " Parent=" . $uc['userclass_parent'] . "<br />";
} else {
// Add to array
$this->class_tree[$uc['userclass_parent']]['class_children'][] = $uc['userclass_id'];
}
}
}
}
示例9: convertAttachment
function convertAttachment($row)
{
if ($row['post_attachment'] != 1) {
return;
}
$id = $row['post_id'];
if (isset($this->forum_attachments[$id])) {
$attach = array();
$forum = $this->helperClass;
// e107_plugins/forum/forum_class.php
if ($folder = $forum->getAttachmentPath($row['poster_id'], true)) {
e107::getMessage()->addDebug("Created Attachment Folder: " . $folder);
} else {
e107::getMessage()->addError("Couldn't find/create attachment folder for user-id: " . $row['poster_id']);
}
foreach ($this->forum_attachments[$id] as $file => $name) {
if (preg_match('#.JPG|.jpg|.gif|.png|.PNG|.GIF|.jpeg|.JPEG$#', $name)) {
$attach['img'][] = $file;
} else {
$attach['file'][] = $file;
}
if ($this->forum_attachment_path) {
$oldpath = e_BASE . $this->forum_attachment_path . "/" . $file;
$newpath = $folder . $file;
if (rename($oldpath, $newpath)) {
e107::getMessage()->addDebug("Renamed file from <b>{$oldpath}</b> to <b>{$newpath}</b>");
} else {
e107::getMessage()->addError("Couldn't rename file from <b>{$oldpath}</b> to <b>{$newpath}</b>");
}
}
}
}
return e107::serialize($attach);
// set attachments
}
示例10: loadPermList
private function loadPermList()
{
if ($tmp = e107::getCache()->setMD5(e_LANGUAGE . USERCLASS_LIST)->retrieve('forum_perms')) {
e107::getMessage()->addDebug("Using Permlist cache: True");
$this->permList = e107::unserialize($tmp);
// print_a($this->permList);
} else {
e107::getMessage()->addDebug("Using Permlist cache: False");
$this->_getForumPermList();
$tmp = e107::serialize($this->permList, false);
e107::getCache()->setMD5(e_LANGUAGE . USERCLASS_LIST)->set('forum_perms', $tmp);
}
unset($tmp);
}
示例11: UpdateContentPref
function UpdateContentPref($id)
{
global $qs, $plugintable, $sql, $tp;
if (!is_object($sql)) {
$sql = new db();
}
//insert default preferences into core
if ($id == "0") {
$num_rows = $sql->db_Select("core", "*", "e107_name='{$plugintable}' ");
if ($num_rows == 0) {
$sql->db_Insert("core", "'{$plugintable}', '' ");
} else {
$row = $sql->db_Fetch();
}
//prepare custom tags: use the posted value
$cp = $_POST['content_custom_preset_key'];
//insert category preferences into plugintable
} else {
//first get the existing prefs and parent
$sql->db_Select($plugintable, "content_pref, content_parent", "content_id='" . intval($id) . "' ");
$row = $sql->db_Fetch();
$current = e107::unserialize($row['content_pref']);
//$current = $eArrayStorage->ReadxxxArray($row['content_pref']);
$currentparent = $row['content_parent'];
//if we are updating options
if (isset($qs[0]) && $qs[0] == 'options') {
//only use the manager prefs from the existing set
foreach ($current as $k => $v) {
if (strpos($k, "content_manager_") === 0 || strpos($k, "content_restrict_") === 0) {
$content_pref[$k] = $tp->toDB($v);
}
}
//prepare custom tags: use the posted values
$cp = $_POST['content_custom_preset_key'];
//if we are updating manager
} elseif (isset($qs[0]) && ($qs[0] == 'manager' || $qs[0] == 'restrict')) {
//if this is a top level category we need to keep all existing options
if ($currentparent == '0') {
$content_pref = $current;
}
//prepare custom tags: use the existing content_pref values
$cp = $content_pref['content_custom_preset_key'];
}
}
//parse custom tags and covert them in $_POST values ($cp is derived above)
$string = array();
foreach ($cp as $ck => $cv) {
if (!empty($cv)) {
$string[] = $cv;
}
}
if (is_array($string) && !empty($string[0])) {
$_POST['content_custom_preset_key'] = $string;
}
//convert all $_POST to $content_pref for storage, and renew the existing stored prefs
foreach ($_POST as $k => $v) {
if (strpos($k, "content_") === 0) {
$content_pref[$k] = $tp->toDB($v);
}
}
//create new array of preferences
$tmp = e107::serialize($content_pref, true);
//$tmp = $eArrayStorage->WritexxxArray($content_pref);
//update core table
if ($id == "0") {
$sql->db_Update("core", "e107_value = '{$tmp}' WHERE e107_name = '{$plugintable}' ");
//update plugin table
} else {
$sql->db_Update($plugintable, "content_pref='{$tmp}' WHERE content_id='" . intval($id) . "' ");
}
return $content_pref;
}
示例12: targetToDb
/**
* Generate an array of mail recipient data which can be passed directly to the DB routines.
* Only valid DB fields are copied
* Combining/splitting of fields is done as necessary
* (This is essentially the translation between internal storage format and db storage format. If
* the DB format changes, only this routine and its counterpart should need changing)
*
* @param $data - array of email target-related data in internal format
* @param $addMissing - if TRUE, undefined fields are added
*
* @return void
*/
public function targetToDb(&$data, $addMissing = FALSE)
{
// Direct correspondence at present (apart from needing to convert potential array $data['mail_target_info']) - but could change
$res = array();
foreach ($this->dbTypes['mail_recipients'] as $f => $v) {
if (isset($data[$f])) {
$res[$f] = $data[$f];
} elseif ($addMissing) {
$res[$f] = '';
}
}
if (isset($data['mail_target_info']) && is_array($data['mail_target_info'])) {
$tmp = e107::serialize($data['mail_target_info'], TRUE);
$res['mail_target_info'] = $tmp;
}
return $res;
}
示例13: readFeedList
function readFeedList($force = FALSE)
{
$sql = e107::getDb();
if ($this->validFeedList && !$force) {
return;
// Already got list
}
if ($this->useCache) {
$eArrayStorage = e107::getArrayStorage();
global $e107;
if (!$force && ($temp = $e107->ecache->retrieve(NEWSFEED_LIST_CACHE_TAG))) {
$this->feedList = e107::unserialize($temp);
return;
}
}
$fieldList = '*';
if ($this->useCache) {
// Get all fields except the actual news
$fieldList = 'newsfeed_id, newsfeed_name, newsfeed_url, newsfeed_timestamp, newsfeed_description, newsfeed_image, newsfeed_active, newsfeed_updateint';
}
if ($sql->select("newsfeed", $fieldList, '`newsfeed_active` > 0')) {
while ($row = $sql->fetch(MYSQL_ASSOC)) {
$nfID = $row['newsfeed_id'];
if (isset($row['newsfeed_data'])) {
$this->newsList[$nfID]['newsfeed_data'] = $row['newsfeed_data'];
// Pull out the actual news - might as well since we're here
$this->newsList[$nfID]['newsfeed_timestamp'] = $row['newsfeed_timestamp'];
unset($row['newsfeed_data']);
// Don't keep this in memory twice!
}
$this->feedList[$nfID] = $row;
// Put the rest into the feed data
}
$this->validFeedList = TRUE;
}
if ($this->useCache) {
// Cache enabled - we need to save some updated info
$temp = e107::serialize($this->feedList, FALSE);
e107::getCache()->set(NEWSFEED_LIST_CACHE_TAG, $temp);
}
}
示例14: menuSaveParameters
function menuSaveParameters()
{
$sql = e107::getDb();
$id = intval($_POST['menu_id']);
if (isset($_POST['menu_parms'])) {
$parms = $sql->escape(strip_tags($_POST['menu_parms']));
} else {
unset($_POST['menu_id'], $_POST['mode'], $_POST['menuActivate'], $_POST['menuSetCustomPages']);
$parms = $sql->escape(e107::serialize($_POST));
if (e_DEBUG == true) {
// return array('msg'=>print_r($_POST,true),'error'=>true);
}
}
$check = $sql->update("menus", "menu_parms='" . $parms . "' WHERE menu_id=" . $id . "");
if ($check) {
return array('msg' => 'All Okay', 'error' => false);
// FIXME - menu log
//e107::getLog()->add('MENU_02',$_POST['menu_parms'].'[!br!]'.$parms.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,'');
// $this->menuAddMessage(LAN_SAVED,E_MESSAGE_SUCCESS);
} elseif (false === $check) {
return array('msg' => LAN_UPDATED_FAILED, 'error' => true);
} else {
return array('msg' => 'No Changes Made', 'error' => false);
// $this->menuAddMessage(LAN_NOCHANGE_NOTSAVED,E_MESSAGE_INFO);
}
}
示例15: convert_serialized
function convert_serialized($serializedData, $type = '')
{
$arrayData = unserialize($serializedData);
$data = e107::serialize($arrayData, FALSE);
return $data;
}