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; } }
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(); } }
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; } } } }
} 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();
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 />"; }
/** * Render Field Value * @param string $field field name * @param mixed $value field value * @param array $attributes field attributes including render parameters, element options - see e_admin_ui::$fields for required format * @return string */ function renderValue($field, $value, $attributes, $id = 0) { if (!empty($attributes['multilan']) && is_array($value)) { $value = varset($value[e_LANGUAGE], ''); } $parms = array(); if (isset($attributes['readParms'])) { if (!is_array($attributes['readParms'])) { parse_str($attributes['readParms'], $attributes['readParms']); } $parms = $attributes['readParms']; } if (vartrue($attributes['inline'])) { $parms['editable'] = true; } // attribute alias if (vartrue($attributes['sort'])) { $parms['sort'] = true; } // attribute alias if (!empty($parms['type'])) { $attributes['type'] = $parms['type']; } $this->renderValueTrigger($field, $value, $parms, $id); $tp = e107::getParser(); switch ($field) { case 'options': if (varset($attributes['type']) == "method") { $attributes['mode'] = "read"; if (isset($attributes['method']) && $attributes['method'] && method_exists($this, $attributes['method'])) { $method = $attributes['method']; return $this->{$method}($parms, $value, $id, $attributes); } elseif (method_exists($this, 'options')) { //return $this->options($field, $value, $attributes, $id); // consistent method arguments, fixed in admin cron administration return $this->options($parms, $value, $id, $attributes); // OLD breaks admin->cron 'options' column } } if (!$value) { parse_str(str_replace('&', '&', e_QUERY), $query); //FIXME - FIX THIS // keep other vars in tact $query['action'] = 'edit'; $query['id'] = $id; //$edit_query = array('mode' => varset($query['mode']), 'action' => varset($query['action']), 'id' => $id); $query = http_build_query($query); $value = "<div class='btn-group'>"; if (vartrue($parms['sort'])) { $mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], '')); $from = intval(vartrue($_GET['from'], 0)); $value .= "<a class='e-sort sort-trigger btn btn-default' style='cursor:move' data-target='" . e_SELF . "?mode={$mode}&action=sort&ajax_used=1&from={$from}' title='" . LAN_RE_ORDER . "'>" . ADMIN_SORT_ICON . "</a> "; } $cls = false; if (varset($parms['editClass'])) { $cls = deftrue($parms['editClass']) ? constant($parms['editClass']) : $parms['editClass']; } if ((false === $cls || check_class($cls)) && varset($parms['edit'], 1) == 1) { /* $value .= "<a href='".e_SELF."?{$query}' class='e-tip btn btn-large' title='".LAN_EDIT."' data-placement='left'> <img class='icon action edit list' src='".ADMIN_EDIT_ICON_PATH."' alt='".LAN_EDIT."' /></a>"; */ $value .= "<a href='" . e_SELF . "?{$query}' class='btn btn-default' title='" . LAN_EDIT . "' data-toggle='tooltip' data-placement='left'>\r\n\t\t\t\t\t\t" . ADMIN_EDIT_ICON . "</a>"; } $delcls = vartrue($attributes['noConfirm']) ? ' no-confirm' : ''; if (varset($parms['deleteClass']) && varset($parms['delete'], 1) == 1) { $cls = deftrue($parms['deleteClass']) ? constant($parms['deleteClass']) : $parms['deleteClass']; if (check_class($cls)) { $value .= $this->submit_image('etrigger_delete[' . $id . ']', $id, 'delete', LAN_DELETE . ' [ ID: ' . $id . ' ]', array('class' => 'action delete btn btn-default' . $delcls)); } } else { $value .= $this->submit_image('etrigger_delete[' . $id . ']', $id, 'delete', LAN_DELETE . ' [ ID: ' . $id . ' ]', array('class' => 'action delete btn btn-default' . $delcls)); } } //$attributes['type'] = 'text'; $value .= "</div>"; return $value; break; case 'checkboxes': $value = $this->checkbox(vartrue($attributes['toggle'], 'multiselect') . '[' . $id . ']', $id); //$attributes['type'] = 'text'; return $value; break; } switch ($attributes['type']) { case 'number': if (!$value) { $value = '0'; } if ($parms) { if (!isset($parms['sep'])) { $value = number_format($value, $parms['decimals']); } else { $value = number_format($value, $parms['decimals'], vartrue($parms['point'], '.'), vartrue($parms['sep'], ' ')); } } if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) { $mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], '')); $value = "<a class='e-tip e-editable editable-click' data-name='" . $field . "' title=\"" . LAN_EDIT . " " . $attributes['title'] . "\" data-type='text' data-pk='" . $id . "' data-url='" . e_SELF . "?mode={$mode}&action=inline&id={$id}&ajax_used=1' href='#'>" . $value . "</a>"; } $value = vartrue($parms['pre']) . $value . vartrue($parms['post']); // else same break; case 'ip': //$e107 = e107::getInstance(); $value = e107::getIPHandler()->ipDecode($value); // else same break; case 'templates': case 'layouts': $pre = vartrue($parms['pre']); $post = vartrue($parms['post']); unset($parms['pre'], $parms['post']); if ($parms) { $attributes['writeParms'] = $parms; } elseif (isset($attributes['writeParms'])) { if (is_string($attributes['writeParms'])) { parse_str($attributes['writeParms'], $attributes['writeParms']); } } $attributes['writeParms']['raw'] = true; $tmp = $this->renderElement($field, '', $attributes); // Inline Editing. //@SecretR - please FIXME! if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) { $mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], '')); $source = str_replace('"', "'", json_encode($wparms)); $value = "<a class='e-tip e-editable editable-click' data-name='" . $field . "' data-source=\"" . $source . "\" title=\"" . LAN_EDIT . " " . $attributes['title'] . "\" data-type='select' data-pk='" . $id . "' data-url='" . e_SELF . "?mode=&action=inline&id={$id}&ajax_used=1' href='#'>" . $value . "</a>"; } // $value = $pre.vartrue($tmp[$value]).$post; // FIXME "Fatal error: Only variables can be passed by reference" featurebox list page. break; case 'checkboxes': case 'comma': case 'dropdown': // XXX - should we use readParams at all here? see writeParms check below if ($parms && is_array($parms)) { //FIXME return no value at all when 'editable=1' is a readParm. See FAQs templates. // $value = vartrue($parms['pre']).vartrue($parms[$value]).vartrue($parms['post']); // break; } // NEW - multiple (array values) support // FIXME - add support for multi-level arrays (option groups) if (!is_array($attributes['writeParms'])) { parse_str($attributes['writeParms'], $attributes['writeParms']); } $wparms = $attributes['writeParms']; if (!is_array(varset($wparms['__options']))) { parse_str($wparms['__options'], $wparms['__options']); } if (!empty($wparms['optArray'])) { $fopts = $wparms; $wparms = $fopts['optArray']; unset($fopts['optArray']); $wparms['__options'] = $fopts; } $opts = $wparms['__options']; unset($wparms['__options']); $_value = $value; if ($attributes['type'] == 'checkboxes' || $attributes['type'] == 'comma') { $opts['multiple'] = true; } if (vartrue($opts['multiple'])) { $ret = array(); $value = is_array($value) ? $value : explode(',', $value); foreach ($value as $v) { if (isset($wparms[$v])) { $ret[] = $wparms[$v]; } } $value = implode(', ', $ret); } else { $ret = ''; if (isset($wparms[$value])) { $ret = $wparms[$value]; } $value = $ret; } $value = $value ? vartrue($parms['pre']) . defset($value, $value) . vartrue($parms['post']) : ''; // Inline Editing. // Inline Editing with 'comma' @SecretR - please FIXME - empty values added. @see news 'render type' or 'media-manager' category for test examples. if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) { $xtype = $attributes['type'] == 'dropdown' ? 'select' : 'checklist'; // $value = "<a class='e-tip e-editable editable-click' data-name='".$field."' data-value='{$_value}' data-source=\"".$source."\" title=\"".LAN_EDIT." ".$attributes['title']."\" data-type='".$xtype."' data-pk='".$id."' data-url='".e_SELF."?mode=&action=inline&id={$id}&ajax_used=1' href='#'>".$value."</a>"; $value = $this->renderInline($field, $id, $attributes['title'], $_value, $value, $xtype, $wparms); } // return ; break; case 'radio': if ($parms && is_array($parms)) { $value = vartrue($parms['pre']) . vartrue($parms[$value]) . vartrue($parms['post']); break; } if (!is_array($attributes['writeParms'])) { parse_str($attributes['writeParms'], $attributes['writeParms']); } $value = vartrue($attributes['writeParms']['__options']['pre']) . vartrue($attributes['writeParms'][$value]) . vartrue($attributes['writeParms']['__options']['post']); break; case 'tags': if (!empty($parms['constant'])) { $value = defset($value, $value); } if (vartrue($parms['truncate'])) { $value = $tp->text_truncate($value, $parms['truncate'], '...'); } elseif (vartrue($parms['htmltruncate'])) { $value = $tp->html_truncate($value, $parms['htmltruncate'], '...'); } if (vartrue($parms['wrap'])) { $value = $tp->htmlwrap($value, (int) $parms['wrap'], varset($parms['wrapChar'], ' ')); } if (vartrue($parms['link']) && $id) { $link = str_replace('[id]', $id, $parms['link']); $link = $tp->replaceConstants($link); // SEF URL is not important since we're in admin. $dialog = vartrue($parms['target']) == 'dialog' ? " e-dialog" : ""; // iframe $ext = vartrue($parms['target']) == 'blank' ? " rel='external' " : ""; // new window $modal = vartrue($parms['target']) == 'modal' ? " data-toggle='modal' data-cache='false' data-target='#uiModal' " : ""; if ($parms['link'] == 'sef' && $this->getController()->getListModel()) { $model = $this->getController()->getListModel(); // copy url config if (!$model->getUrl()) { $model->setUrl($this->getController()->getUrl()); } // assemble the url $link = $model->url(); } elseif (vartrue($data[$parms['link']])) { $link = $tp->replaceConstants(vartrue($data[$parms['link']])); } // in case something goes wrong... if ($link) { $value = "<a class='e-tip{$dialog}' {$ext} href='" . $link . "' {$modal} title='Quick View' >" . $value . "</a>"; } } if (empty($value)) { $value = '-'; $setValue = "data-value=''"; } else { $setValue = ""; if ($attributes['type'] == 'tags' && !empty($value)) { $setValue = "data-value='" . $value . "'"; $value = str_replace(",", ", ", $value); // add spaces so it wraps, but don't change the actual values. } } if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) { $options['selectize'] = array('create' => true, 'maxItems' => 7, 'mode' => 'multi', 'e_editable' => $field . '_' . $id); $tpl = $this->text($field, $value, 80, $options); $mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], '')); $value = "<a id='" . $field . '_' . $id . "' class='e-tip e-editable editable-click editable-tags' data-emptytext='-' data-tpl='" . str_replace("'", '"', $tpl) . "' data-name='" . $field . "' title=\"" . LAN_EDIT . " " . $attributes['title'] . "\" data-type='text' data-pk='" . $id . "' " . $setValue . " data-url='" . e_SELF . "?mode={$mode}&action=inline&id={$id}&ajax_used=1' href='#'>" . $value . "</a>"; } $value = vartrue($parms['pre']) . $value . vartrue($parms['post']); break; case 'text': if (!empty($parms['constant'])) { $value = defset($value, $value); } if (vartrue($parms['truncate'])) { $value = $tp->text_truncate($value, $parms['truncate'], '...'); } elseif (vartrue($parms['htmltruncate'])) { $value = $tp->html_truncate($value, $parms['htmltruncate'], '...'); } if (vartrue($parms['wrap'])) { $value = $tp->htmlwrap($value, (int) $parms['wrap'], varset($parms['wrapChar'], ' ')); } if (vartrue($parms['link']) && $id) { $link = str_replace('[id]', $id, $parms['link']); $link = $tp->replaceConstants($link); // SEF URL is not important since we're in admin. $dialog = vartrue($parms['target']) == 'dialog' ? " e-dialog" : ""; // iframe $ext = vartrue($parms['target']) == 'blank' ? " rel='external' " : ""; // new window $modal = vartrue($parms['target']) == 'modal' ? " data-toggle='modal' data-cache='false' data-target='#uiModal' " : ""; if ($parms['link'] == 'sef' && $this->getController()->getListModel()) { $model = $this->getController()->getListModel(); // copy url config if (!$model->getUrl()) { $model->setUrl($this->getController()->getUrl()); } // assemble the url $link = $model->url(); } elseif (vartrue($data[$parms['link']])) { $link = $tp->replaceConstants(vartrue($data[$parms['link']])); } // in case something goes wrong... if ($link) { $value = "<a class='e-tip{$dialog}' {$ext} href='" . $link . "' {$modal} title='Quick View' >" . $value . "</a>"; } } if (empty($value)) { $value = '-'; $setValue = "data-value=''"; } else { $setValue = ""; if ($attributes['type'] == 'tags' && !empty($value)) { $setValue = "data-value='" . $value . "'"; $value = str_replace(",", ", ", $value); // add spaces so it wraps, but don't change the actual values. } } if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) { $mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], '')); $value = "<a class='e-tip e-editable editable-click' data-emptytext='-' data-name='" . $field . "' title=\"" . LAN_EDIT . " " . $attributes['title'] . "\" data-type='text' data-pk='" . $id . "' " . $setValue . " data-url='" . e_SELF . "?mode={$mode}&action=inline&id={$id}&ajax_used=1' href='#'>" . $value . "</a>"; } $value = vartrue($parms['pre']) . $value . vartrue($parms['post']); break; case 'bbarea': case 'textarea': if ($attributes['type'] == 'textarea' && !vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) { return $this->renderInline($field, $id, $attributes['title'], $value, substr($value, 0, 50) . "...", 'textarea'); //FIXME. } $expand = '...'; $toexpand = false; if ($attributes['type'] == 'bbarea' && !isset($parms['bb'])) { $parms['bb'] = true; } //force bb parsing for bbareas $elid = trim(str_replace('_', '-', $field)) . '-' . $id; if (!vartrue($parms['noparse'])) { $value = $tp->toHTML($value, vartrue($parms['bb']) ? true : false, vartrue($parms['parse'])); } if (vartrue($parms['expand']) || vartrue($parms['truncate']) || vartrue($parms['htmltruncate'])) { $ttl = vartrue($parms['expand']); if ($ttl == 1) { $ttl = $expand . "<button class='btn btn-default btn-xs btn-mini pull-right'>More..</button>"; $ttl1 = "<button class='btn btn-default btn-xs btn-mini pull-right'>..Less</button>"; } else { $ttl1 = null; } $expands = '<a href="#' . $elid . '-expand" class="e-show-if-js e-expandit">' . defset($ttl, $ttl) . "</a>"; $contracts = '<a href="#' . $elid . '-expand" class="e-show-if-js e-expandit">' . defset($ttl1, $ttl1) . "</a>"; } $oldval = $value; if (vartrue($parms['truncate'])) { $value = $oldval = strip_tags($value); $value = $tp->text_truncate($value, $parms['truncate'], ''); $toexpand = $value != $oldval; } elseif (vartrue($parms['htmltruncate'])) { $value = $tp->html_truncate($value, $parms['htmltruncate'], ''); $toexpand = $value != $oldval; } if ($toexpand) { // force hide! TODO - core style .expand-c (expand container) // TODO: Hide 'More..' button when text fully displayed. $value .= '<span class="expand-c" style="display: none" id="' . $elid . '-expand"><span>' . str_replace($value, '', $oldval) . $contracts . '</span></span>'; $value .= $expands; // 'More..' button. Keep it at the bottom so it does't cut the sentence. } break; case 'icon': $value = $tp->toIcon($value, array('size' => '2x')); break; case 'file': if (vartrue($parms['base'])) { $url = $parms['base'] . $value; } else { $url = e107::getParser()->replaceConstants($value, 'full'); } $name = basename($value); $value = '<a href="' . $url . '" title="Direct link to ' . $name . '" rel="external">' . $name . '</a>'; break; case 'image': //TODO - thumb, js tooltip... if ($value) { if (strpos($value, ",") !== false) { $tmp = explode(",", $value); $value = $tmp[0]; unset($tmp); } $vparm = array('thumb' => 'tag', 'w' => vartrue($parms['thumb_aw'], '80')); if ($video = e107::getParser()->toVideo($value, $vparm)) { return $video; } $fileOnly = basename($value); // Not an image but a file. (media manager) if (!preg_match("/\\.(png|jpg|jpeg|gif|PNG|JPG|JPEG|GIF)\$/", $fileOnly) && false !== strpos($fileOnly, '.')) { $icon = "{e_IMAGE}filemanager/zip_32.png"; $src = $tp->replaceConstants(vartrue($parms['pre']) . $icon, 'abs'); // return $value; return e107::getParser()->toGlyph('fa-file', 'size=2x'); // return '<img src="'.$src.'" alt="'.$value.'" class="e-thumb" title="'.$value.'" />'; } if (vartrue($parms['thumb'])) { $thparms = array(); // Support readParms example: thumb=1&w=200&h=300 // Support readParms example: thumb=1&aw=80&ah=30 if (isset($parms['h'])) { $thparms['h'] = intval($parms['h']); } if (isset($parms['ah'])) { $thparms['ah'] = intval($parms['ah']); } if (isset($parms['w'])) { $thparms['w'] = intval($parms['w']); } if (isset($parms['aw'])) { $thparms['aw'] = intval($parms['aw']); } // Support readParms example: thumb=200x300 (wxh) if (strpos($parms['thumb'], 'x') !== false) { list($thparms['w'], $thparms['h']) = explode('x', $parms['thumb']); } // Support readParms example: thumb={width} if (!isset($parms['w']) && is_numeric($parms['thumb']) && '1' != $parms['thumb']) { $thparms['w'] = intval($parms['thumb']); } elseif (vartrue($parms['thumb_aw'])) { $thparms['aw'] = intval($parms['thumb_aw']); } // return print_a($thparms,true); $src = $tp->replaceConstants(vartrue($parms['pre']) . $value, 'abs'); $thsrc = $tp->thumbUrl(vartrue($parms['pre']) . $value, $thparms, varset($parms['thumb_urlraw'])); $alt = basename($src); $ttl = '<img src="' . $thsrc . '" alt="' . $alt . '" class="thumbnail e-thumb" />'; $value = '<a href="' . $src . '" data-modal-caption="' . $alt . '" data-target="#uiModal" class="e-modal e-image-preview" title="' . $alt . '" rel="external">' . $ttl . '</a>'; } else { $src = $tp->replaceConstants(vartrue($parms['pre']) . $value, 'abs'); $alt = $src; //basename($value); $ttl = vartrue($parms['title'], 'LAN_PREVIEW'); $value = '<a href="' . $src . '" class="e-image-preview" title="' . $alt . '" rel="external">' . defset($ttl, $ttl) . '</a>'; } } break; case 'files': $ret = '<ol>'; for ($i = 0; $i < 5; $i++) { $k = $key . '[' . $i . '][path]'; $ival = $value[$i]['path']; $ret .= '<li>' . $ival . '</li>'; } $ret .= '</ol>'; $value = $ret; break; case 'datestamp': $value = $value ? e107::getDate()->convert_date($value, vartrue($parms['mask'], 'short')) : ''; break; case 'date': // just show original value break; case 'userclass': $dispvalue = $this->_uc->uc_get_classname($value); // Inline Editing. if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) { $mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], '')); $uc_options = vartrue($parms['classlist'], 'public,guest,nobody,member,admin,main,classes'); // defaults to 'public,guest,nobody,member,classes' (userclass handler) unset($parms['classlist']); $array = e107::getUserClass()->uc_required_class_list($uc_options); //XXX Ugly looking (non-standard) function naming - TODO discuss name change. $source = str_replace('"', "'", json_encode($array, JSON_FORCE_OBJECT)); //NOTE Leading ',' required on $value; so it picks up existing value. $value = "<a class='e-tip e-editable editable-click' data-placement='left' data-value='" . $value . "' data-name='" . $field . "' data-source=\"" . $source . "\" title=\"" . LAN_EDIT . " " . $attributes['title'] . "\" data-type='select' data-pk='" . $id . "' data-url='" . e_SELF . "?mode={$mode}&action=inline&id={$id}&ajax_used=1' href='#'>" . $dispvalue . "</a>"; } else { $value = $dispvalue; } break; case 'userclasses': // return $value; $classes = explode(',', $value); $uv = array(); foreach ($classes as $cid) { if (!empty($parms['defaultLabel']) && $cid === '') { $uv[] = $parms['defaultLabel']; continue; } $uv[] = $this->_uc->getName($cid); } $dispvalue = implode(vartrue($parms['separator'], "<br />"), $uv); // Inline Editing. if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) { $uc_options = vartrue($parms['classlist'], 'public,guest, nobody,member,admin,main,classes'); // defaults to 'public,guest,nobody,member,classes' (userclass handler) $array = e107::getUserClass()->uc_required_class_list($uc_options); //XXX Ugly looking (non-standard) function naming - TODO discuss name change. //$mode = preg_replace('/[^\w]/', '', vartrue($_GET['mode'], '')); $mode = $tp->filter(vartrue($_GET['mode'], ''), 'w'); $source = str_replace('"', "'", json_encode($array, JSON_FORCE_OBJECT)); //NOTE Leading ',' required on $value; so it picks up existing value. $value = "<a class='e-tip e-editable editable-click' data-placement='bottom' data-value='," . $value . "' data-name='" . $field . "' data-source=\"" . $source . "\" title=\"" . LAN_EDIT . " " . $attributes['title'] . "\" data-type='checklist' data-pk='" . $id . "' data-url='" . e_SELF . "?mode={$mode}&action=inline&id={$id}&ajax_used=1' href='#'>" . $dispvalue . "</a>"; } else { $value = $dispvalue; } unset($parms['classlist']); break; /*case 'user_name': case 'user_loginname': case 'user_login': case 'user_customtitle': case 'user_email':*/ /*case 'user_name': case 'user_loginname': case 'user_login': case 'user_customtitle': case 'user_email':*/ case 'user': /*if(is_numeric($value)) { $value = e107::user($value); if($value) { $value = $value[$attributes['type']] ? $value[$attributes['type']] : $value['user_name']; } else { $value = 'not found'; } }*/ $row_id = $id; // Dirty, but the only way for now $id = 0; $ttl = LAN_ANONYMOUS; //Defaults to user_id and user_name (when present) and when idField and nameField are not present. // previously set - real parameters are idField && nameField $id = vartrue($parms['__idval']); if ($value && !is_numeric($value)) { $id = vartrue($parms['__idval']); $ttl = $value; } elseif ($value && is_numeric($value)) { $id = $value; if (vartrue($parms['__nameval'])) { $ttl = $parms['__nameval']; } else { $user = e107::user($value); if (vartrue($user['user_name'])) { $ttl = $user['user_name']; } } } if (!empty($parms['link']) && $id && $ttl && is_numeric($id)) { // Stay in admin area. $link = e_ADMIN . "users.php?mode=main&action=edit&id=" . $id . "&readonly=1&iframe=1"; // e107::getUrl()->create('user/profile/view', array('id' => $id, 'name' => $ttl)) $value = '<a class="e-modal" data-modal-caption="User #' . $id . ' : ' . $ttl . '" href="' . $link . '" title="Go to user profile">' . $ttl . '</a>'; } else { $value = $ttl; } // Inline Editing. if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) { // Need a Unique Field ID to store field settings using e107::js('settings'). $fieldID = $this->name2id($field . '_' . microtime(true)); // Unique ID for each rows. $eEditableID = $this->name2id($fieldID . '_' . $row_id); $tpl = $this->userpicker($field, '', $ttl, $id, array('id' => $fieldID, 'selectize' => array('e_editable' => $eEditableID))); $mode = preg_replace('/[^\\w]/', '', vartrue($_GET['mode'], '')); $value = "<a id='" . $eEditableID . "' class='e-tip e-editable editable-click editable-userpicker' data-clear='false' data-tpl='" . str_replace("'", '"', $tpl) . "' data-name='" . $field . "' title=\"" . LAN_EDIT . " " . $attributes['title'] . "\" data-type='text' data-pk='" . $row_id . "' data-value='" . $id . "' data-url='" . e_SELF . "?mode={$mode}&action=inline&id={$row_id}&ajax_used=1' href='#'>" . $ttl . "</a>"; } break; case 'bool': case 'boolean': $false = vartrue($parms['trueonly']) ? "" : ADMIN_FALSE_ICON; if (!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) { if (isset($parms['false'])) { $false = $parms['false']; } else { $false = $value === '' ? "□" : "✗"; } $true = varset($parms['true'], '✓'); // custom representation for 'true'. (supports font-awesome when set by css) $value = intval($value); $wparms = vartrue($parms['reverse']) ? array(0 => $true, 1 => $false) : array(0 => $false, 1 => $true); $dispValue = $wparms[$value]; return $this->renderInline($field, $id, $attributes['title'], $value, $dispValue, 'select', $wparms); } if (vartrue($parms['reverse'])) { $value = $value ? $false : ADMIN_TRUE_ICON; } 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'; $methodParms = null; break; } } if (!empty($xtype)) { $value = $this->renderInline($field, $id, $attributes['title'], $_value, $value, $xtype, $methodParms); } } break; case 'hidden': return vartrue($parms['show']) ? $value ? $value : vartrue($parms['empty']) : ''; break; case 'language': // All Known Languages. if (!empty($value)) { $_value = $value; if (strlen($value) === 2) { $value = e107::getLanguage()->convert($value); } } if (!vartrue($attributes['noedit']) && vartrue($parms['editable'])) { $wparms = e107::getLanguage()->getList(); return $this->renderInline($field, $id, $attributes['title'], $_value, $value, 'select', $wparms); } return $value; break; case 'lanlist': // installed languages. $options = e107::getLanguage()->getLanSelectArray(); if ($options) { if (!is_array($attributes['writeParms'])) { parse_str($attributes['writeParms'], $attributes['writeParms']); } $wparms = $attributes['writeParms']; if (!is_array(varset($wparms['__options']))) { parse_str($wparms['__options'], $wparms['__options']); } $opts = $wparms['__options']; if ($opts['multiple']) { $ret = array(); $value = is_array($value) ? $value : explode(',', $value); foreach ($value as $v) { if (isset($options[$v])) { $ret[] = $options[$v]; } } $value = implode(', ', $ret); } else { $ret = ''; if (isset($options[$value])) { $ret = $options[$value]; } $value = $ret; } $value = $value ? vartrue($parms['pre']) . $value . vartrue($parms['post']) : ''; } else { $value = ''; } break; //TODO - order //TODO - order default: //unknown type break; } return $value; }
/** * 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; }
/** * 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; } }
/** * 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; }
/** * 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; }
} 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;
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']); }
/** * 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; }
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; } }
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; }
/** * Called to process outstanding PMs (which are always bulk lists) * * Emails are added to the queue. * Various events are logged in a text file * * @return none */ public function processPM() { global $pref; require_once e_PLUGIN . 'pm/pm_class.php'; $this->startTime = mktime(0, 0, 0, date('n'), date('d'), date('Y')); // Date for start processing $this->logRequirement = varset($pref['eventpost_emaillog'], 0); if ($this->debugLevel >= 2) { $this->logRequirement = 2; } // Force full logging if debug // Start of the 'real' code if ($this->ourDB->select('generic', '*', "`gen_type` = 'pm_bulk' LIMIT 1")) { $pmRow = $this->ourDB->fetch(MYSQL_ASSOC); $this->logLine("\r\n\r\n" . str_replace('--NUM--', $pmRow['gen_intdata'], LAN_EC_PM_06) . date('D j M Y G:i:s')); $this->ourDB->delete('generic', "`gen_type` = 'pm_bulk' AND `gen_id` = " . $pmRow['gen_id']); $pmData = e107::unserialize($pmRow['gen_chardata']); unset($pmRow); $this->pmClass = new private_message(); $this->pmClass->add($pmData); $this->logLine(' .. Run completed', TRUE, TRUE); } return TRUE; }
/** * Return an Array of core preferences from e107 XML Dump data * * @param array $XMLData Raw XML e107 Export Data * @param string $prefType [optional] the type of core pref: core|emote|ipool|menu etc. * @return array preference array equivalent to the old $pref global; */ public function e107ImportPrefs($XMLData, $prefType = 'core') { if (!vartrue($XMLData['prefs'][$prefType])) { return array(); } //$mes = eMessage::getInstance(); $pref = array(); foreach ($XMLData['prefs'][$prefType] as $val) { $name = $val['@attributes']['name']; // if(strpos($val['@value'], 'array (') === 0) // { // echo '<pre>'.$val['@value']; // echo "\n"; // var_dump(e107::getArrayStorage()->ReadArray($val['@value'])); // echo $val['@value'].'</pre>'; // } $value = strpos($val['@value'], 'array (') === 0 ? e107::unserialize($val['@value']) : $val['@value']; $pref[$name] = $value; // $mes->add("Setting up ".$prefType." Pref [".$name."] => ".$value, E_MESSAGE_DEBUG); } return $pref; }
function getArray($name) { return e107::unserialize($this->get($name)); // return unserialize($this->get($name)); }
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; } }
function postDeleteAttachments($type = 'post', $id = '') { $e107 = e107::getInstance(); $sql = e107::getDb(); $log = e107::getAdminLog(); $id = (int) $id; if (!$id) { return; } // Moc: Is the code below used at all? When deleting a thread, threadDelete() loops through each post separately to delete attachments (type=post) /* if($type == 'thread') { if(!$sql->select('forum_post', 'post_id', 'post_attachments IS NOT NULL')) { return true; } $postList = array(); while($row = $sql->Fetch(MYSQL_ASSOC)) { $postList[] = $row['post_id']; } foreach($postList as $postId) { $this->postDeleteAttachment('post', $postId); } } */ // if we are deleting just a single post if ($type == 'post') { if (!$sql->select('forum_post', 'post_user, post_attachments', 'post_id = ' . $id)) { return true; } $tmp = $sql->fetch(MYSQL_ASSOC); $attachment_array = e107::unserialize($tmp['post_attachments']); $files = $attachment_array['file']; $imgs = $attachment_array['img']; // TODO see if files/images check can be written more efficiently // check if there are files to be deleted if (is_array($files)) { // loop through each file and delete it foreach ($files as $file) { $file = $this->getAttachmentPath($tmp['post_user']) . $file; @unlink($file); // Confirm that file has been deleted. Add warning to log file when file could not be deleted. if (file_exists($file)) { $log->addWarning("Could not delete file: " . $file . ". Please delete manually as this file is now no longer in use (orphaned)."); } } } // check if there are images to be deleted if (is_array($imgs)) { // loop through each image and delete it foreach ($imgs as $img) { $img = $this->getAttachmentPath($tmp['post_user']) . $img; @unlink($img); // Confirm that file has been deleted. Add warning to log file when file could not be deleted. if (file_exists($img)) { $log->addWarning("Could not delete image: " . $img . ". Please delete manually as this file is now no longer in use (orphaned)."); } } } // At this point we assume that all attachments have been deleted from the post. The log file may prove otherwise (see above). $log->toFile('forum_delete_attachments', 'Forum plugin - Delete attachments', TRUE); // Empty the post_attachments field for this post in the database (prevents loop when deleting entire thread) $sql->update("forum_post", "post_attachments = NULL WHERE post_id = " . $id); /* Old code when attachments were still stored in plugin folder. Left for review but may be deleted in future. foreach($attachments as $k => $a) { $info = explode('*', $a); if('' == $f || $info[1] == $f) { $fname = e_PLUGIN."forum/attachments/{$info[1]}"; @unlink($fname); //If attachment is an image and there is a thumb, remove it if('img' == $info[0] && $info[2]) { $fname = e_PLUGIN."forum/attachments/thumb/{$info[2]}"; @unlink($fname); } } unset($attachments[$k]); } $tmp = array(); if(count($attachments)) { $tmp['post_attachments'] = implode(',', $attachments); } else { $tmp['post_attachments'] = '_NULL_'; } $info = array(); $info['data'] = $tmp; $info['_FILE_TYPES']['post_attachments'] = 'array'; $info['WHERE'] = 'post_id = '.$id; $sql->update('forum_post', $info); */ } }
/** * Get the _FIELD_DEFS and _NOTNULL definitions for a table *<code> * The information is sought in a specific order: * a) In our internal cache * b) in the directory e_CACHE_DBDIR - file name $tableName.php * c) An override file for a core or plugin-related table. If found, the information is copied to the cache directory * For core overrides, e_ADMIN.'core_sql/db_field_defs.php' is searched * For plugins, $pref['e_sql_list'] is used as a search list - any file 'db_field_defs.php' in the plugin directory is earched * d) The table structure is read from the DB, and a definition created: * AUTOINCREMENT fields - ignored (or integer) * integer type fields - 'int' processing * character/string type fields - todb processing * fields which are 'NOT NULL' but have no default are added to the '_NOTNULL' list *</code> * @param string $tableName - table name, without any prefixes (language or general) * * @return boolean|array - FALSE if not found/not to be used. Array of field names and processing types and null overrides if found */ public function getFieldDefs($tableName) { if (!isset($this->dbFieldDefs[$tableName])) { if (is_readable(e_CACHE_DB . $tableName . '.php')) { $temp = file_get_contents(e_CACHE_DB . $tableName . '.php', FILE_TEXT); if ($temp !== FALSE) { $typeDefs = e107::unserialize($temp); unset($temp); $this->dbFieldDefs[$tableName] = $typeDefs; } } else { // Need to try and find a table definition $searchArray = array(e_CORE . 'sql/db_field_defs.php'); // e107::getPref() shouldn't be used inside db handler! See db_IsLang() comments $sqlFiles = (array) $this->getConfig()->get('e_sql_list', array()); // kill any PHP notices foreach ($sqlFiles as $p => $f) { $searchArray[] = e_PLUGIN . $p . '/db_field_defs.php'; } unset($sqlFiles); $found = FALSE; foreach ($searchArray as $defFile) { //echo "Check: {$defFile}, {$tableName}<br />"; if ($this->loadTableDef($defFile, $tableName)) { $found = TRUE; break; } } if (!$found) { // Need to read table structure from DB and create the file $this->makeTableDef($tableName); } } } return $this->dbFieldDefs[$tableName]; }
function get_prefs() { $sql = e107::getDb(); $num_rows = $sql->gen("SELECT * FROM #core WHERE e107_name='" . $this->table . "' "); if ($num_rows == 0) { $p = $this->default_prefs(); $tmp = $this->e107->arrayStorage->WriteArray($p); $sql->insert("core", "'" . $this->table . "', '{$tmp}' "); $sql->gen("SELECT * FROM #core WHERE e107_name='" . $this->table . "' "); } $row = $sql->fetch(); $p = e107::unserialize($row['e107_value']); //validation if (!array_key_exists('tagwords_activeareas', $p)) { $p['tagwords_activeareas'] = array(); } return $p; }
function print_item_pdf($id) { global $tp, $pref, $content_shortcodes; global $CONTENT_PRINT_IMAGES, $row, $content_image_path, $content_pref, $mainparent; //in this section you decide what to needs to be output to the pdf file $con = new convert(); require_once e_PLUGIN . "content/content_shortcodes.php"; require_once e_PLUGIN . "content/handlers/content_class.php"; $aa = new content(); if (!is_object($sql)) { $sql = new db(); } $sql->db_Select($plugintable, "content_id, content_heading, content_subheading, content_text, content_image, content_author, content_parent, content_datestamp, content_class, content_pref", "content_id='" . intval($id) . "' "); $row = $sql->db_Fetch(); if (!check_class($row['content_class'])) { header("location:" . e_PLUGIN . "content/content.php"); exit; } $authordetails = $aa->getAuthor($row['content_author']); $row['content_datestamp'] = $con->convert_date($row['content_datestamp'], "long"); $img = $tp->parseTemplate('{CONTENT_PRINT_IMAGES}', FALSE, $content_shortcodes); $mainparent = $aa->getMainParent(intval($id)); $content_pref = $aa->getContentPref($mainparent); $content_icon_path = $tp->replaceConstants($content_pref["content_icon_path"]); $content_image_path = $tp->replaceConstants($content_pref["content_image_path"]); $img = $tp->parseTemplate('{CONTENT_PDF_IMAGES}', FALSE, $content_shortcodes); //add custom and preset tags if present $custom = e107::unserialize($row['content_pref']); //$custom = $eArrayStorage->ReadxxxArray($row['content_pref']); $months = array(CONTENT_ADMIN_DATE_LAN_0, CONTENT_ADMIN_DATE_LAN_1, CONTENT_ADMIN_DATE_LAN_2, CONTENT_ADMIN_DATE_LAN_3, CONTENT_ADMIN_DATE_LAN_4, CONTENT_ADMIN_DATE_LAN_5, CONTENT_ADMIN_DATE_LAN_6, CONTENT_ADMIN_DATE_LAN_7, CONTENT_ADMIN_DATE_LAN_8, CONTENT_ADMIN_DATE_LAN_9, CONTENT_ADMIN_DATE_LAN_10, CONTENT_ADMIN_DATE_LAN_11); $CONTENT_CONTENT_TABLE_CUSTOM_TAGS = ""; if (!empty($custom)) { foreach ($custom as $k => $v) { if ($k == "content_custom_presettags") { if (isset($content_pref["content_content_presettags"]) && $content_pref["content_content_presettags"]) { foreach ($v as $ck => $cv) { if (is_array($cv)) { //date if (!($cv['day'] == "" && $cv['month'] == "" && $cv['year'] == "")) { $vv = $cv['day'] . " " . $months[$cv['month'] - 1] . " " . $cv['year']; } } else { $vv = $cv; } if (isset($ck) && $ck != "" && isset($vv) && $vv != "") { $CUSTOM_TAGS = TRUE; $CONTENT_CONTENT_TABLE_CUSTOM_KEY = $tp->toHTML($ck, true); $CONTENT_CONTENT_TABLE_CUSTOM_VALUE = $tp->toHTML($vv, true); $CONTENT_CONTENT_TABLE_CUSTOM_TAGS .= $CONTENT_CONTENT_TABLE_CUSTOM_KEY . " : " . $CONTENT_CONTENT_TABLE_CUSTOM_VALUE . "<br />"; } } } } else { if (isset($content_pref["content_content_customtags"]) && $content_pref["content_content_customtags"]) { $key = substr($k, 15); if (isset($key) && $key != "" && isset($v) && $v != "") { $CUSTOM_TAGS = TRUE; $CONTENT_CONTENT_TABLE_CUSTOM_KEY = $tp->toHTML($key, true); $CONTENT_CONTENT_TABLE_CUSTOM_VALUE = $tp->toHTML($v, true); $CONTENT_CONTENT_TABLE_CUSTOM_TAGS .= $CONTENT_CONTENT_TABLE_CUSTOM_KEY . " : " . $CONTENT_CONTENT_TABLE_CUSTOM_VALUE . "<br />"; } } } } } $text = "\n\t<b>" . $row['content_heading'] . "</b><br />\n\t" . $row['content_subheading'] . "<br />\n\t" . $authordetails[1] . ", " . $row['content_datestamp'] . "<br />\n\t<br />\n\t" . $row['content_text'] . "<br />\n\t" . ($CONTENT_CONTENT_TABLE_CUSTOM_TAGS ? $CONTENT_CONTENT_TABLE_CUSTOM_TAGS : "") . "\n\t<div style='float:left; padding-left:10px;'>" . $img . "</div>\n\t"; //the following defines are processed in the document properties of the pdf file //Do NOT add parser function to the variables, leave them as raw data ! //as the pdf methods will handle this ! $text = $text; //define text $creator = SITENAME; //define creator $author = $authordetails[1]; //define author $title = $row['content_heading']; //define title $subject = $row['content_subheading']; //define subject $keywords = ""; //define keywords //define url to use in the header of the pdf file $url = SITEURLBASE . e_PLUGIN_ABS . "content/content.php?content." . $row['content_id']; //always return an array with the following data: return array($text, $creator, $author, $title, $subject, $keywords, $url); }
/** * Search for requested data from available sources in this order: * - posted data * - default object data * - passed default value * * Use this method inside forms * * @param string $key * @param string $default * @param integer $index * @return string */ public function getIfPosted($key, $default = '', $index = null) { $d = $this->getDataFields(); if ($d[$key] == 'array') { return e107::unserialize($this->getData((string) $key, $default, $index)); } $posted = $this->getPostedData((string) $key, null, $index); if (null !== $posted) { // FIXED - double post_toFom() and toDB(post_toForm()) problems // setPosted|setPostedData|addPostedData methods are storing RAW data now return e107::getParser()->post_toForm($posted); } return e107::getParser()->toForm($this->getData((string) $key, $default, $index)); }
public function mail_attach($curVal, $mode) { if ($mode == 'read') { $val = stripslashes($this->getController()->getListModel()->get('mail_other')); $data = e107::unserialize($val); return basename($data['mail_attach']); } if ($mode == 'write') { $val = stripslashes($this->getController()->getModel()->get('mail_other')); $data = e107::unserialize($val); return $this->filepicker('mail_attach', $data['mail_attach'], $mode); } }
$handle = opendir(e_THEME); while ($file = readdir($handle)) { if ($file != "." && $file != ".." && $file != "templates" && $file != "" && $file != "CVS") { if (is_readable(e_THEME . $file . "/theme.php") && ($allThemes || in_Array($file, $themeList))) { $themelist[] = $file; $themecount[$file] = 0; } } } closedir($handle); if (count($themelist)) { $defaulttheme = $pref['sitetheme']; $count = 0; $totalct = $sql->select("user", "user_prefs", "user_prefs REGEXP('sitetheme') "); while ($row = $sql->fetch()) { $up = substr($row['user_prefs'], 0, 5) == "array" ? e107::unserialize($row['user_prefs']) : unserialize($row['user_prefs']); if (isset($themecount[$up['sitetheme']])) { $themecount[$up['sitetheme']]++; } } $defaultusers = $sql->count("user") - $totalct; $themecount[$defaulttheme] += $defaultusers; $text = "<form method='post' action='" . e_SELF . "'>\n\t\t\t<div style='text-align:center'>\n\t\t\t<select name='sitetheme' class='tbox' style='width: 95%;'>"; $counter = 0; while (isset($themelist[$counter]) && $themelist[$counter]) { $text .= "<option value='" . $themelist[$counter] . "' "; if ($themelist[$counter] == USERTHEME || USERTHEME == FALSE && $themelist[$counter] == $defaulttheme) { $text .= "selected='selected'"; } $text .= ">" . ($themelist[$counter] == $defaulttheme ? "[ " . $themelist[$counter] . " ]" : $themelist[$counter]) . ' (' . LAN_UMENU_THEME_3 . ' ' . $themecount[$themelist[$counter]] . ")</option>\n"; $counter++;
function parse_scbatch($fname, $type = 'file') { global $e107cache, $eArrayStorage; $cur_shortcodes = array(); if ($type == 'file') { $batch_cachefile = 'nomd5_scbatch_' . md5($fname); // $cache_filename = $e107cache->cache_fname("nomd5_{$batchfile_md5}"); $sc_cache = $e107cache->retrieve_sys($batch_cachefile); if (!$sc_cache) { $sc_batch = file($fname); } else { $cur_shortcodes = e107::unserialize($sc_cache); $sc_batch = ""; } } else { $sc_batch = $fname; } $this->debug_legacy = array('type' => $type, 'path' => str_replace(e_ROOT, "", $fname)); if ($sc_batch) { $cur_sc = ''; foreach ($sc_batch as $line) { if (trim($line) == 'SC_END') { $cur_sc = ''; } if ($cur_sc) { $cur_shortcodes[$cur_sc] .= $line; } if (preg_match('#^SC_BEGIN (\\w*).*#', $line, $matches)) { $cur_sc = $matches[1]; $cur_shortcodes[$cur_sc] = varset($cur_shortcodes[$cur_sc], ''); } } if ($type == 'file') { $sc_cache = $eArrayStorage->WriteArray($cur_shortcodes, false); $e107cache->set_sys($batch_cachefile, $sc_cache); } } foreach (array_keys($cur_shortcodes) as $cur_sc) { if (array_key_exists($cur_sc, $this->registered_codes)) { if ($this->registered_codes[$cur_sc]['type'] == 'plugin') { $scFile = e_PLUGIN . strtolower($this->registered_codes[$cur_sc]['path']) . '/' . strtolower($cur_sc) . '.sc'; } else { $scFile = THEME . strtolower($cur_sc) . '.sc'; } if (is_readable($scFile)) { $cur_shortcodes[$cur_sc] = file_get_contents($scFile); } } } return $cur_shortcodes; }
function show_content_item() { global $pref, $content_pref, $content_icon_path, $content_image_path, $content_file_path, $custom, $plugindir, $plugintable, $array, $datequery, $order, $nextprevquery, $from, $number, $row, $qs, $gen, $sql, $aa, $tp, $rs, $cobj, $e107, $e107cache, $ns, $rater, $ep, $row, $authordetails, $mainparent; global $CONTENT_CONTENT_TABLE_TEXT, $CONTENT_CONTENT_TABLE_PAGENAMES, $CONTENT_CONTENT_TABLE_SUMMARY, $CONTENT_CONTENT_TABLE_CUSTOM_TAGS, $CONTENT_CONTENT_TABLE_PARENT, $CONTENT_CONTENT_TABLE_INFO_PRE, $CONTENT_CONTENT_TABLE_INFO_POST, $CONTENT_CONTENT_TABLE_AUTHORDETAILS, $CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA, $CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA; global $CONTENT_CONTENT_TABLE_PREV_PAGE, $CONTENT_CONTENT_TABLE_NEXT_PAGE; $newcontent_shortcodes = e107::getScBatch('content', TRUE); //if we get here through the rated auto-redirect //we need to delete cache and redirect to the normal item url if (isset($qs[2]) && ($qs[2] == 'rated' || is_numeric($qs[2]) && $qs[3] == 'rated')) { $e107cache->clear("{$plugintable}.content.{$qs['1']}"); $e107cache->clear("comment.{$plugintable}.{$qs['1']}"); //and reset qs[2] if ($qs[2] == 'rated') { $qs[2] = ''; $qry = e_SELF . "?content." . $qs[1]; } else { $qs[3] = ''; $qry = e_SELF . "?content." . $qs[1] . "." . $qs[2]; } header("location:" . $qry); exit; } $mainparent = $aa->getMainParent(intval($qs[1])); $content_pref = $aa->getContentPref($mainparent); show_content_search_menu("item", $mainparent); //show navigator/search/order menu $array = $aa->getCategoryTree("", $mainparent, TRUE); $validparent = implode(",", array_keys($array)); $qry = "content_id='" . intval($qs[1]) . "' AND content_refer !='sa' AND content_parent REGEXP '" . $aa->CONTENTREGEXP($validparent) . "' " . $datequery . " AND content_class REGEXP '" . e_CLASS_REGEXP . "' "; if (!($resultitem = $sql->db_Select($plugintable, "*", $qry))) { header("location:" . e_SELF . "?recent." . $mainparent); exit; } else { $row = $sql->db_Fetch(); //update refer count outside of cache (count visits ^ count unique ips) if (isset($content_pref["content_log"]) && $content_pref["content_log"]) { $ip = $e107->getip(); $self = e_SELF; $refertmp = explode("^", $row['content_refer']); if (strpos($self, "admin") === FALSE) { if (strpos($refertmp[1], $ip) === FALSE) { $referiplist = $refertmp[1] ? $refertmp[1] . "-" . $ip : $ip; $contentrefernew = $refertmp[0] + 1 . "^" . $referiplist; } else { $contentrefernew = $refertmp[0] + 1 . "^" . $refertmp[1]; } $sql = new db(); $sql->db_Update($plugintable, "content_refer='" . $contentrefernew . "' WHERE content_id='" . intval($qs[1]) . "' "); $e107cache->clear("{$plugintable}.content.{$qs['1']}"); $e107cache->clear("{$plugintable}.recent.{$mainparent}"); $e107cache->clear("{$plugintable}.cat.list.{$mainparent}"); $e107cache->clear("{$plugintable}.cat.{$mainparent}"); $e107cache->clear("{$plugintable}.author.{$mainparent}"); $e107cache->clear("{$plugintable}.top.{$mainparent}"); } } if (!isset($qs[2]) || ($qs[2] = intval($qs[2])) <= 0) { $cacheid = 1; $qs[2] = 1; // Force first page } else { $cacheid = $qs[2]; } $cachestr = "{$plugintable}.content.{$qs['1']}.{$cacheid}"; $cachecheck = CachePre($cachestr); if ($cachecheck) { echo $cachecheck; // return; } else { $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_pref["content_icon_path"] = $content_pref["content_icon_path"] ? $content_pref["content_icon_path"] : "{e_PLUGIN}content/images/icon/"; $content_pref["content_image_path"] = $content_pref["content_image_path"] ? $content_pref["content_image_path"] : "{e_PLUGIN}content/images/image/"; $content_pref["content_file_path"] = $content_pref["content_file_path"] ? $content_pref["content_file_path"] : "{e_PLUGIN}content/images/file/"; $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"]); $content_image_path = $tp->replaceConstants($content_pref["content_image_path"]); $content_file_path = $tp->replaceConstants($content_pref["content_file_path"]); $number = isset($content_pref["content_nextprev_number"]) && $content_pref["content_nextprev_number"] ? $content_pref["content_nextprev_number"] : "5"; $nextprevquery = isset($content_pref["content_nextprev"]) && $content_pref["content_nextprev"] ? "LIMIT " . intval($from) . "," . intval($number) : ""; $CONTENT_CONTENT_TABLE_AUTHORDETAILS = $aa->prepareAuthor("content", $row['content_author'], $row['content_id']); $CONTENT_CONTENT_TABLE_TEXT = $row['content_text']; $CONTENT_CONTENT_TABLE_PREV_PAGE = FALSE; $CONTENT_CONTENT_TABLE_NEXT_PAGE = FALSE; $lastpage = FALSE; //boolean whether or not the current page is the last page if (preg_match_all("/\\[newpage.*?]/si", $row['content_text'], $matches)) { //remove html bbcode (since we're splitting the text, the html bbcode would not be parsed) $row['content_text'] = preg_replace("/\\[html\\](.*?)\\[\\/html\\]/si", '\\1', $row['content_text']); //split newpage $pages = preg_split("/\\[newpage.*?]/si", $row['content_text'], -1, PREG_SPLIT_NO_EMPTY); $pages = array_values($pages); //remove empty values if (trim($pages[0]) == "") { unset($pages[0]); } $pages = array_values($pages); if (count($pages) == count($matches[0])) { } elseif (count($pages) > count($matches[0])) { $matches[0] = array_pad($matches[0], -count($pages), "[newpage]"); } elseif (count($pages) < count($matches[0])) { } $CONTENT_CONTENT_TABLE_TEXT = $pages[!$qs[2] ? 0 : $qs[2] - 1]; $options = ""; for ($i = 0; $i < count($pages); $i++) { if (!isset($qs[2])) { $idp = 1; } else { $idp = $qs[2]; } if ($idp == $i + 1) { $pre = CONTENT_LAN_92; } else { $pre = ""; } if ($matches[0][$i] == "[newpage]") { $pagename[$i] = CONTENT_LAN_78; } else { $arrpagename = explode("[newpage=", $matches[0][$i]); $pagename[$i] = substr($arrpagename[1], 0, -1); } if (isset($content_pref["content_content_pagenames_nextprev"]) && $content_pref["content_content_pagenames_nextprev"]) { if ($idp > 1) { if (isset($content_pref["content_content_pagenames_nextprev_prevhead"]) && $content_pref["content_content_pagenames_nextprev_prevhead"]) { $cap = $content_pref["content_content_pagenames_nextprev_prevhead"]; $cap = str_replace("{PAGETITLE}", $pagename[$idp - 2], $cap); } else { $cap = CONTENT_LAN_90; } $CONTENT_CONTENT_TABLE_PREV_PAGE = "<a href='" . e_SELF . "?" . $qs[0] . "." . $qs[1] . "." . ($idp - 1) . "'>" . $cap . "</a>"; } else { $CONTENT_CONTENT_TABLE_PREV_PAGE = ' '; } if ($idp < count($pages)) { if (isset($content_pref["content_content_pagenames_nextprev_nexthead"]) && $content_pref["content_content_pagenames_nextprev_nexthead"]) { $cap = $content_pref["content_content_pagenames_nextprev_nexthead"]; $cap = str_replace("{PAGETITLE}", $pagename[$idp], $cap); } else { $cap = CONTENT_LAN_91; } $CONTENT_CONTENT_TABLE_NEXT_PAGE = "<a href='" . e_SELF . "?" . $qs[0] . "." . $qs[1] . "." . ($idp + 1) . "'>" . $cap . "</a>"; } else { $CONTENT_CONTENT_TABLE_NEXT_PAGE = ' '; } } //0:normal links, 1:selectbox //$content_pref["content_content_pagenames_rendertype"] = "1"; if (isset($content_pref["content_content_pagenames_rendertype"]) && $content_pref["content_content_pagenames_rendertype"] == "1") { $page = CONTENT_LAN_79 . " " . ($i + 1) . " " . $pre . " " . $pagename[$i]; $url = e_SELF . "?" . $qs[0] . "." . $qs[1] . "." . ($i + 1); $options .= $rs->form_option($page, $idp == $i + 1 ? "1" : "0", $url, ""); } else { $options .= CONTENT_LAN_79 . " " . ($i + 1) . " " . $pre . " : <a href='" . e_SELF . "?" . $qs[0] . "." . $qs[1] . "." . ($i + 1) . "'>" . $pagename[$i] . "</a><br />"; } if ($idp == 1) { $CONTENT_CONTENT_TABLE_SUMMARY = isset($content_pref["content_content_summary"]) && $content_pref["content_content_summary"] && $row['content_summary'] ? $tp->toHTML($row['content_summary'], TRUE, "SUMMARY") : ""; $CONTENT_CONTENT_TABLE_SUMMARY = $tp->replaceConstants($CONTENT_CONTENT_TABLE_SUMMARY); } else { $CONTENT_CONTENT_TABLE_SUMMARY = ""; } //render custom/preset on first page if (isset($content_pref['content_content_multipage_preset']) && $content_pref['content_content_multipage_preset']) { if ($idp == '1') { $lastpage = TRUE; } //render custom/preset on last page } else { if ($idp == count($pages)) { $lastpage = TRUE; } } } if ($content_pref["content_content_pagenames_rendertype"] == "1") { $selectjs = "onchange=\"if(this.options[this.selectedIndex].value != 'none'){ return document.location=this.options[this.selectedIndex].value; }\""; $CONTENT_CONTENT_TABLE_PAGENAMES = $rs->form_select_open("pagenames", $selectjs) . $rs->form_option(CONTENT_LAN_89, "1", "none", "") . $options . $rs->form_select_close(); } else { $CONTENT_CONTENT_TABLE_PAGENAMES = $options; } } else { $CONTENT_CONTENT_TABLE_SUMMARY = isset($content_pref["content_content_summary"]) && $content_pref["content_content_summary"] && $row['content_summary'] ? $tp->toHTML($row['content_summary'], TRUE, "SUMMARY") : ""; $CONTENT_CONTENT_TABLE_SUMMARY = $tp->replaceConstants($CONTENT_CONTENT_TABLE_SUMMARY); $lastpage = TRUE; } $CONTENT_CONTENT_TABLE_TEXT = $tp->replaceConstants($CONTENT_CONTENT_TABLE_TEXT); $CONTENT_CONTENT_TABLE_TEXT = $tp->toHTML($CONTENT_CONTENT_TABLE_TEXT, TRUE, "BODY"); $custom = e107::unserialize($row['content_pref']); $date = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_DATE}', FALSE, $newcontent_shortcodes); $auth = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_AUTHORDETAILS}', FALSE, $newcontent_shortcodes); $ep = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_EPICONS}', FALSE, $newcontent_shortcodes); $edit = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_EDITICON}', FALSE, $newcontent_shortcodes); $par = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_PARENT}', FALSE, $newcontent_shortcodes); $com = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_COMMENT}', FALSE, $newcontent_shortcodes); $score = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_SCORE}', FALSE, $newcontent_shortcodes); $ref = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_REFER}', FALSE, $newcontent_shortcodes); $ico = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_ICON}', FALSE, $newcontent_shortcodes); $sub = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_SUBHEADING}', FALSE, $newcontent_shortcodes); $rat = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_RATING}', FALSE, $newcontent_shortcodes); $fil = $tp->parseTemplate('{CONTENT_CONTENT_TABLE_FILE}', FALSE, $newcontent_shortcodes); $CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA = FALSE; $CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA = FALSE; $CONTENT_CONTENT_TABLE_INFO_PRE = FALSE; $CONTENT_CONTENT_TABLE_INFO_POST = FALSE; //if any of these exist, pre/post activate the container table if ($ico != "" || $date != "" || $auth != "" || $ep != "" || $edit != "" || $par != "" || $com != "" || $score != "" || $ref != "" || $sub != "" || $rat != "" || $fil != "") { $CONTENT_CONTENT_TABLE_INFO_PRE = TRUE; $CONTENT_CONTENT_TABLE_INFO_POST = TRUE; $CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA = TRUE; $CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA = TRUE; } if (!isset($CONTENT_CONTENT_TABLE)) { //if no theme has been set, use default theme if (!$content_pref["content_theme"]) { //if custom layout is set if ($row['content_layout']) { //if custom layout file exists if (is_readable($plugindir . "templates/default/" . $row['content_layout'])) { require_once $plugindir . "templates/default/" . $row['content_layout']; } else { require_once $plugindir . "templates/default/content_content_template.php"; } } else { require_once $plugindir . "templates/default/content_content_template.php"; } } else { //if custom layout is set if ($row['content_layout']) { //if custom layout file exists if (is_readable($tp->replaceConstants($content_pref["content_theme"]) . $row['content_layout'])) { require_once $tp->replaceConstants($content_pref["content_theme"]) . $row['content_layout']; } else { //if default layout from the set theme exists if (is_readable($tp->replaceConstants($content_pref["content_theme"]) . "content_content_template.php")) { require_once $tp->replaceConstants($content_pref["content_theme"]) . "content_content_template.php"; //else use default theme, default layout } else { require_once $plugindir . "templates/default/content_content_template.php"; } } //if no custom layout is set } else { //if default layout from the set theme exists if (is_readable($tp->replaceConstants($content_pref["content_theme"]) . "content_content_template.php")) { require_once $tp->replaceConstants($content_pref["content_theme"]) . "content_content_template.php"; //else use default theme, default layout } else { require_once $plugindir . "templates/default/content_content_template.php"; } } } } $months = array(CONTENT_ADMIN_DATE_LAN_0, CONTENT_ADMIN_DATE_LAN_1, CONTENT_ADMIN_DATE_LAN_2, CONTENT_ADMIN_DATE_LAN_3, CONTENT_ADMIN_DATE_LAN_4, CONTENT_ADMIN_DATE_LAN_5, CONTENT_ADMIN_DATE_LAN_6, CONTENT_ADMIN_DATE_LAN_7, CONTENT_ADMIN_DATE_LAN_8, CONTENT_ADMIN_DATE_LAN_9, CONTENT_ADMIN_DATE_LAN_10, CONTENT_ADMIN_DATE_LAN_11); $CONTENT_CONTENT_TABLE_CUSTOM_TAGS = ""; $CUSTOM_TAGS = FALSE; if ($lastpage === TRUE && !empty($custom)) { $CONTENT_CONTENT_TABLE_CUSTOM_PRE = ""; $CONTENT_CONTENT_TABLE_CUSTOM_TAGS = ""; //ksort($custom); foreach ($custom as $k => $v) { if ($k == "content_custom_presettags") { if (isset($content_pref["content_content_presettags"]) && $content_pref["content_content_presettags"]) { foreach ($v as $ck => $cv) { if (is_array($cv)) { //date if (!($cv['day'] == "" && $cv['month'] == "" && $cv['year'] == "")) { $vv = $cv['day'] . " " . $months[$cv['month'] - 1] . " " . $cv['year']; } } else { $vv = $cv; } if (isset($ck) && $ck != "" && isset($vv) && $vv != "") { $CUSTOM_TAGS = TRUE; $CONTENT_CONTENT_TABLE_CUSTOM_KEY = $tp->toHTML($ck, true); $CONTENT_CONTENT_TABLE_CUSTOM_VALUE = $tp->toHTML($vv, true); $CONTENT_CONTENT_TABLE_CUSTOM_TAGS .= preg_replace("/\\{(.*?)\\}/e", '$\\1', $CONTENT_CONTENT_TABLE_CUSTOM); } } } } else { if (isset($content_pref["content_content_customtags"]) && $content_pref["content_content_customtags"]) { $key = substr($k, 15); if (isset($key) && $key != "" && isset($v) && $v != "") { $CUSTOM_TAGS = TRUE; $CONTENT_CONTENT_TABLE_CUSTOM_KEY = $tp->toHTML($key, true); $CONTENT_CONTENT_TABLE_CUSTOM_VALUE = $tp->toHTML($v, true); $CONTENT_CONTENT_TABLE_CUSTOM_TAGS .= preg_replace("/\\{(.*?)\\}/e", '$\\1', $CONTENT_CONTENT_TABLE_CUSTOM); } } } } if ($CUSTOM_TAGS === TRUE) { $CONTENT_CONTENT_TABLE_CUSTOM_TAGS = $CONTENT_CONTENT_TABLE_CUSTOM_START . $CONTENT_CONTENT_TABLE_CUSTOM_TAGS . $CONTENT_CONTENT_TABLE_CUSTOM_END; } } $text = $tp->parseTemplate($CONTENT_CONTENT_TABLE, TRUE, $newcontent_shortcodes); $text = $aa->getCrumbPage("item", $array, $row['content_parent']) . $text; $caption = $row['content_heading']; $ns->tablerender($caption, $text); $cachecheck = CachePost($cachestr); } //recheck some thing when caching is enabled $pages = preg_split("/\\[newpage.*?]/si", $row['content_text'], -1, PREG_SPLIT_NO_EMPTY); $pages = array_values($pages); $cachestr = "comment.{$plugintable}.{$qs['1']}.{$cacheid}"; if (count($pages) == 0) { $lastpage = TRUE; } else { if ($cacheid == count($pages)) { $lastpage = TRUE; } } if ($lastpage && ($row['content_comment'] || isset($content_pref["content_content_comment_all"]) && $content_pref["content_content_comment_all"])) { $cachecheck = CachePre($cachestr); if ($cachecheck) { echo $cachecheck; return; } if (isset($content_pref["content_content_rating"]) && $content_pref["content_content_rating"] && $row['content_rate'] || isset($content_pref["content_content_rating_all"]) && $content_pref["content_content_rating_all"]) { $showrate = TRUE; } else { $showrate = FALSE; } $width = 0; $cobj->compose_comment($plugintable, "comment", $qs[1], $width, $row['content_heading'], $showrate); $cachecheck = CachePost($cachestr); } } //close sql }