本文整理汇总了PHP中eHelper类的典型用法代码示例。如果您正苦于以下问题:PHP eHelper类的具体用法?PHP eHelper怎么用?PHP eHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: loop
/**
* Loops through the authorization array
*
*/
public function loop($array = null)
{
//reasons to fail
if (is_null($array)) {
return false;
}
if (!is_array($array)) {
return false;
}
//Populating class properties
$user =& JFactory::getUser();
if ($user->guest) {
$user->usertype = 'Public';
}
foreach ($array as $group => $pages) {
foreach ($pages as $page) {
//reasons to continue
if (strlen(trim($group)) < 1) {
continue;
}
if (strlen(trim($page)) < 1) {
continue;
}
eHelper::eb_acl($page, $group);
}
}
return true;
}
开发者ID:Jonathonbyrd,项目名称:Joomla-Listings,代码行数:32,代码来源:authorization.php
示例2: sc_faq_question
function sc_faq_question($parm = '')
{
$tp = e107::getParser();
$parm = eHelper::scDualParams($parm);
$param = $parm[1];
$params = $parm[2];
$new = e107::pref('faqs', 'new', 3);
$newDate = strtotime($new . " days ago");
$faqNew = $this->var['faq_datestamp'] > $newDate ? " faq-new" : "";
if ($param == 'expand' && !empty($this->var['faq_answer'])) {
$id = "faq_" . $this->var['faq_id'];
$url = e107::url('faqs', 'item', $this->var, 'full');
$question = $tp->toHTML($this->var['faq_question'], true, 'TITLE');
$hide = $this->item != $this->var['faq_id'] ? 'e-hideme' : '';
$text = "\n\t\t\t<a class='e-expandit faq-question{$faqNew}' href='#{$id}'>" . $question . "</a>\n\t\t\t<div id='{$id}' class='" . $hide . " faq-answer faq_answer clearfix {$faqNew}'>";
$text .= $tp->toHTML($this->var['faq_answer'], true, 'BODY');
$text .= "<div class='faq-extras'>";
if (vartrue($params['tags']) && $this->var['faq_tags']) {
$text .= "<div class='faq-tags'>" . LAN_FAQS_TAGS . ": " . $this->sc_faq_tags() . "</div>";
}
if ($this->datestamp == true) {
$text .= "<div class='faq-datestamp'>" . $tp->toDate($this->var['faq_datestamp']) . "</div>";
}
if ($this->share == true) {
$text .= "<div class='faq-share'>" . $tp->parseTemplate("{SOCIALSHARE: size=xs&type=basic&url=" . $url . "&title=" . $question . "&tags=" . $this->var['faq_tags'] . "}", true) . "</div>";
}
$text .= "</div></div>\n\t\t\t";
} else {
$text = $tp->toHTML($this->var['faq_question'], true, 'BODY');
}
return $text;
}
开发者ID:KonzolozZ,项目名称:e107,代码行数:32,代码来源:faqs_shortcodes.php
示例3: compile
function compile($row)
{
$tp = e107::getParser();
$res = array();
$datestamp = $tp->toDate($row['thread_datestamp'], "long");
if ($row['thread_parent']) {
$title = $row['parent_name'];
} else {
$title = $row['thread_name'];
}
$link_id = $row['thread_id'];
$uparams = array('id' => $row['user_id'], 'name' => $row['user_name']);
$link = e107::getUrl()->create('user/profile/view', $uparams);
$userlink = "<a href='" . $link . "'>" . $row['user_name'] . "</a>";
$row['thread_sef'] = eHelper::title2sef($row['thread_name'], 'dashl');
$forumTitle = "<a href='" . e107::url('forum', 'forum', $row) . "'>" . $row['forum_name'] . "</a>";
$res['link'] = e107::url('forum', 'topic', $row, array('query' => array('f' => 'post', 'id' => $row['post_id'])));
// e_PLUGIN."forum/forum_viewtopic.php?".$link_id.".post";
$res['pre_title'] = '';
// $title ? FOR_SCH_LAN_5.": " : "";
$res['title'] = $title ? $forumTitle . " | " . $title : LAN_SEARCH_9;
$res['pre_summary'] = "";
$res['summary'] = $row['post_entry'];
$res['detail'] = LAN_SEARCH_7 . $userlink . LAN_SEARCH_8 . $datestamp;
return $res;
}
开发者ID:KonzolozZ,项目名称:e107,代码行数:26,代码来源:e_search.php
示例4: toHTML
/**
* Translate to <p> tag
*/
function toHTML($code_text, $parm)
{
if ($parm && !strpos($parm, '=')) {
$parm = 'class=' . $parm;
}
$code_text = trim($code_text);
$parms = eHelper::scParams($parm);
$class = " " . e107::getBB()->getClass('p');
// consistent classes across all themes.
$id = varsettrue($parms['id']) ? ' id="' . eHelper::secureIdAttr($parms['id']) . '"' : '';
$style = varsettrue($parms['style']) ? ' style="' . eHelper::secureStyleAttr($parms['style']) . '"' : '';
return "<p{$id}{$class}{$style}>" . $code_text . '</p>';
}
开发者ID:notzen,项目名称:e107,代码行数:16,代码来源:bb_p.php
示例5: busca_categorias_tags_pai
/**
* Busca o id da categoria/tag PAI
*
* @param integer $idcomponente
* @param integer $idstart
* @param boolean $tree
* @param string [categorias | tags]
* @return object/JCRUD
*/
function busca_categorias_tags_pai($idcomponente, $idstart = 0, $tabela = 'categorias')
{
$tb = $tabela == 'categorias' ? ECOMP_TABLE_CATEGORIAS : ECOMP_TABLE_TAGS;
$t = new JCRUD($tb);
$a = $t->busca("WHERE idcomponente = '{$idcomponente}' AND id = '{$idstart}'");
if ($a->idpai != 0) {
$tt = $t->busca("WHERE idcomponente = '{$idcomponente}' AND idpai = '{$idstart}'");
foreach ($tt as $tr) {
$a = eHelper::busca_categorias_tags_pai($idcomponente, $tr->id, $tabela);
}
}
return $a->id;
}
开发者ID:eliasrosa,项目名称:eJoomla,代码行数:22,代码来源:ebasic.helper.php
示例6: url_shortcode
/**
* Example usage (valid news data + option for full URL)
* {URL=news/view/item|news_id=1&news_sef=sef-string&category_id=1&category_sef=category-sef&options[full]=1}
*/
function url_shortcode($parm)
{
list($route, $parms) = eHelper::scDualParams($parm);
if (empty($route)) {
return '';
}
$options = array();
if (isset($parms['options'])) {
$options = $parms['options'];
unset($parms['options']);
}
return e107::getUrl()->create($route, $parms, $options);
}
开发者ID:armpit,项目名称:e107,代码行数:17,代码来源:url.php
示例7: toHTML
/**
* Translate youtube bbcode into the appropriate HTML
*/
function toHTML($code_text, $parm)
{
// transform to class, equal sign at 0 position is not well formed parm string
if ($parm && !strpos($parm, '=')) {
$parm = 'class=' . $parm;
}
$parms = eHelper::scParams($parm);
$class = " " . e107::getBB()->getClass('block');
$id = varsettrue($parms['id']) ? ' id=' . eHelper::secureIdAttr($parms['id']) : '';
$style = varsettrue($parms['style']) ? ' style="' . eHelper::secureStyleAttr($parms['style']) . '"' : '';
if (empty($code_text)) {
$code_text = '<!-- -->';
}
return '<div' . $id . $class . $style . '>' . $code_text . '</div>';
}
开发者ID:notzen,项目名称:e107,代码行数:18,代码来源:bb_block.php
示例8: toHTML
/**
* Translate to <h*> tag
*/
function toHTML($code_text, $parm)
{
$code_text = trim($code_text);
if (empty($code_text)) {
return '';
}
$bparms = eHelper::scDualParams($parm);
$h = 'h' . ($bparms[1] ? intval($bparms[1]) : 2);
$parms = $bparms[2];
unset($bparms);
$class = " " . e107::getBB()->getClass('h2');
// consistent classes across all themes.
$id = varsettrue($parms['id']) ? ' id=' . eHelper::secureIdAttr($parms['id']) : '';
$style = varsettrue($parms['style']) ? ' style="' . eHelper::secureStyleAttr($parms['style']) . '"' : '';
return "<{$h}{$id}{$class}{$style}>" . $code_text . "</{$h}>";
}
开发者ID:notzen,项目名称:e107,代码行数:19,代码来源:bb_h.php
示例9: toDB
function toDB($code_text, $parm)
{
$parms = eHelper::scParams($parm);
$safe = array();
if (vartrue($parms['class'])) {
$safe['class'] = eHelper::secureClassAttr($parms['class']);
}
if (vartrue($parms['id'])) {
$safe['id'] = eHelper::secureIdAttr($parms['id']);
}
if (vartrue($parms['style'])) {
$safe['style'] = eHelper::secureStyleAttr($parms['style']);
}
if ($safe) {
return '[img ' . eHelper::buildAttr($safe) . ']' . $code_text . '[/img]';
}
return '[img]' . $code_text . '[/img]';
}
开发者ID:armpit,项目名称:e107,代码行数:18,代码来源:bb_img.php
示例10: upgrade_post
function upgrade_post($var)
{
$db = e107::getDb();
$currentVersion = $var->current_plug['plugin_version'];
if ($currentVersion == '1.0') {
/* to fill SEF URL FOR categories*/
$db = e107::getDb();
if ($allRows = $db->retrieve('SELECT * FROM #links_page_cat', TRUE)) {
foreach ($allRows as $row) {
$id = $row["link_category_id"];
$where = 'link_category_id = ' . $id;
$update = array('link_category_sef' => eHelper::title2sef($row['link_category_name']), 'WHERE' => $where);
$db->update('links_page_cat', $update);
}
}
/* to set all existing links as active */
$db = e107::getDb('links_page');
$update = array('link_active' => 1);
$db->update('links_page', $update);
}
}
开发者ID:Jimmi08,项目名称:links_page,代码行数:21,代码来源:links_page_setup.php
示例11: 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;
//.........这里部分代码省略.........
开发者ID:JBeezygit,项目名称:e107,代码行数:101,代码来源:forum_post.php
示例12: sc_gallery_slides
/**
* All possible parameters
* {GALLERY_SLIDES=4|limit=16&template=MY_SLIDESHOW_SLIDE_ITEM}
* first parameter is always number of slides, default is 3
* limit - (optional) total limit of pcitures to be shown
* template - (optional) template - name of template to be used for parsing the slideshow item
*/
function sc_gallery_slides($parm)
{
$tp = e107::getParser();
$this->slideMode = TRUE;
$parms = eHelper::scDualParams($parm);
$amount = $parms[1] ? intval($parms[1]) : 3;
// vartrue(e107::getPlugPref('gallery','slideshow_perslide'),3);
$parms = $parms[2];
$limit = (int) vartrue($parms['limit'], 16);
$list = e107::getMedia()->getImages('gallery_' . $this->sliderCat . '|gallery_image_' . $this->sliderCat, 0, $limit);
$tmpl = e107::getTemplate('gallery', 'gallery');
$tmpl = array_change_key_case($tmpl);
// change template key to lowercase (BC fix)
$tmpl_key = vartrue($parms['template'], 'slideshow_slide_item');
$item_template = $tmpl[$tmpl_key];
// e107::getTemplate('gallery','gallery', vartrue($parms['template'], 'SLIDESHOW_SLIDE_ITEM'));
$catList = e107::getMedia()->getCategories('gallery');
$cat = $catList['gallery_' . $this->sliderCat];
$count = 1;
foreach ($list as $row) {
$this->setVars($row)->addVars($cat);
$inner .= $count == 1 ? "\n\n<!-- SLIDE " . $count . " -->\n<div class='slide' id='gallery-item-" . $this->slideCount . "'>\n" : "";
$inner .= "\n\t" . $tp->parseTemplate($item_template, TRUE) . "\n";
$inner .= $count == $amount ? "\n</div>\n\n" : "";
if ($count == $amount) {
$count = 1;
$this->slideCount++;
} else {
$count++;
}
}
$inner .= $count != 1 ? "</div><!-- END SLIDES -->" : "";
return $inner;
}
开发者ID:armpit,项目名称:e107,代码行数:41,代码来源:e_shortcode.php
示例13: view_all_query
function view_all_query($srch = '')
{
$sql = e107::getDb();
$tp = e107::getParser();
$text = "";
$insert = "";
$item = false;
$removeUrl = e107::url('faqs', 'index');
if (!empty($srch)) {
$srch = $tp->toDB($srch);
$insert = " AND (f.faq_question LIKE '%" . $srch . "%' OR f.faq_answer LIKE '%" . $srch . "%' OR FIND_IN_SET ('" . $srch . "', f.faq_tags) ) ";
$message = "<span class='label label-lg label-info'>" . $srch . " <a class='e-tip' title='Remove' href='" . $removeUrl . "'>×</a></span>";
e107::getMessage()->setClose(false, E_MESSAGE_INFO)->setTitle(LAN_FAQS_FILTER_ACTIVE, E_MESSAGE_INFO)->addInfo($message);
$text = e107::getMessage()->render();
}
if (!empty($_GET['id'])) {
$srch = intval($_GET['id']);
// $insert = " AND (f.faq_id = ".$srch.") ";
$item = $srch;
}
if (!empty($_GET['cat'])) {
$srch = $tp->toDB($_GET['cat']);
$insert = " AND (cat.faq_info_sef = '" . $srch . "') ";
}
if (!empty($_GET['tag'])) {
$srch = $tp->toDB($_GET['tag']);
$insert = " AND FIND_IN_SET ('" . $srch . "', f.faq_tags) ";
$message = "<span class='label label-lg label-info'>" . $srch . " <a class='e-tip' title='Remove' href='" . $removeUrl . "'>×</a></span>";
e107::getMessage()->setClose(false, E_MESSAGE_INFO)->setTitle(LAN_FAQS_FILTER_ACTIVE, E_MESSAGE_INFO)->addInfo($message);
$text = e107::getMessage()->render();
}
list($orderBy, $ascdesc) = explode('-', vartrue($this->pref['orderby'], 'faq_order-ASC'));
$query = "SELECT f.*,cat.* FROM #faqs AS f LEFT JOIN #faqs_info AS cat ON f.faq_parent = cat.faq_info_id WHERE cat.faq_info_class IN (" . USERCLASS_LIST . ") " . $insert . " ORDER BY cat.faq_info_order, f." . $orderBy . " " . $ascdesc . " ";
if (!$sql->gen($query)) {
$message = !empty($srch) ? "<b>" . $srch . "</b> was not found in search results. <a class='e-tip' title='Reset' href='" . $removeUrl . "'>Reset</a>" : LAN_FAQS_NONE_AVAILABLE;
return "<div class='alert alert-warning alert-block'>" . $message . "</div>";
//TODO LAN
}
// -----------------
$FAQ_LISTALL = e107::getTemplate('faqs', true, 'all');
$prevcat = "";
$sc = e107::getScBatch('faqs', true);
$sc->counter = 1;
$sc->tag = htmlspecialchars($tag, ENT_QUOTES, 'utf-8');
$sc->category = $category;
if (!empty($_GET['id'])) {
$sc->item = intval($_GET['id']);
$js = "\n\t\t\t\t\$( document ).ready(function() {\n \$('html, body').animate({ scrollTop: \$('div#faq_" . $sc->item . "').offset().top - 300 }, 4000);\n\t\t\t\t});\n\n\t\t\t\t";
e107::js('footer-inline', $js);
}
// $text = $tp->parseTemplate($FAQ_START, true, $sc);
// $text = "";
if ($this->pref['list_type'] == 'ol') {
$reversed = $ascdesc == 'DESC' ? 'reversed ' : '';
$tsrch = array('<ul ', '/ul>');
$trepl = array('<ol ' . $reversed, '/ol>');
$FAQ_LISTALL['start'] = str_replace($tsrch, $trepl, $FAQ_LISTALL['start']);
$FAQ_LISTALL['end'] = str_replace($tsrch, $trepl, $FAQ_LISTALL['end']);
}
while ($rw = $sql->fetch()) {
$rw['faq_sef'] = eHelper::title2sef($tp->toText($rw['faq_question']), 'dashl');
$sc->setVars($rw);
if ($sc->item == $rw['faq_id']) {
$this->pageTitle = $rw['faq_question'];
$this->pageDescription = $rw['faq_answer'];
}
if ($rw['faq_info_order'] != $prevcat) {
if ($prevcat != '') {
$text .= $tp->parseTemplate($FAQ_LISTALL['end'], true, $sc);
}
$text .= "\n\n<!-- FAQ Start " . $rw['faq_info_order'] . "-->\n\n";
$text .= $tp->parseTemplate($FAQ_LISTALL['start'], true, $sc);
$start = TRUE;
}
$text .= $tp->parseTemplate($FAQ_LISTALL['item'], true, $sc);
$prevcat = $rw['faq_info_order'];
$sc->counter++;
}
$text .= $start ? $tp->parseTemplate($FAQ_LISTALL['end'], true, $sc) : "";
// $text .= $tp->parseTemplate($FAQ_END, true, $sc);
return $text;
}
开发者ID:armpit,项目名称:e107,代码行数:82,代码来源:faqs.php
示例14: step5
function step5()
{
$sql = e107::getDb();
$ns = e107::getRender();
$mes = e107::getMessage();
$stepCaption = 'Step 5: Migrate forum data';
if (!isset($_POST['move_forum_data'])) {
$text = "This step will copy all of your forum configuration from the `forum` table into the `forum_new` table.<br />\n\t\tOnce the information is successfully copied, the existing 1.0 forum table will be renamed `forum_old` and the newly created `forum_new` table will be renamed `forum`.<br />\n\t\t<br /><br />";
$text .= "\n\t\t<form method='post'>\n\t\t<input class='btn btn-success' data-loading-text='Please wait...' type='submit' name='move_forum_data' value='Proceed with forum data move' />\n\t\t</form>\n\t\t";
$ns->tablerender($stepCaption, $mes->render() . $text);
return;
}
$counts = array('parents' => 0, 'forums' => 0, 'subs' => 0);
//XXX Typo on 'parents' ?
if ($sql->select('forum')) {
$forumList = $sql->db_getList();
foreach ($forumList as $forum) {
if ($forum['forum_parent'] == 0) {
$counts['parents']++;
} elseif ($forum['forum_sub'] != 0) {
$counts['subs']++;
} else {
$counts['forums']++;
}
$tmp = $forum;
$tmp['forum_threadclass'] = $tmp['forum_postclass'];
$tmp['forum_options'] = '_NULL_';
$tmp['forum_sef'] = eHelper::title2sef($forum['forum_name'], 'dashl');
// $tmp['_FIELD_TYPES'] = $ftypes['_FIELD_TYPES'];
if ($sql->insert('forum_new', $tmp)) {
} else {
$mes->addError("Insert failed on " . print_a($tmp, true));
}
}
} else {
$counts = array('parents' => 'n/a', 'forums' => 'n/a', 'subs' => 'n/a');
}
$mes->addSuccess("\n\t\tForum data move results:\n\t\t<ul>\n\t\t<li>Number of forum parents processed: {$counts['parents']} </li>\n\t\t<li>Number of forums processed: {$counts['forums']} </li>\n\t\t<li>Number of sub forums processed: {$counts['subs']} </li>\n\t\t</ul>\n\t\t");
$result = $sql->gen('RENAME TABLE `#forum` TO `#forum_old` ') ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add("Renaming forum to forum_old", $result);
$result = $sql->gen('RENAME TABLE `#forum_new` TO `#forum` ') ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add("Renaming forum_new to forum", $result);
$text = "\n\t\t<form method='post' action='" . e_SELF . "?step=6'>\n\t\t<input class='btn btn-success' type='submit' name='nextStep[6]' value='Proceed to step 6' />\n\t\t</form>\n\t\t";
$ns->tablerender($stepCaption, $mes->render() . $text);
}
开发者ID:armpit,项目名称:e107,代码行数:45,代码来源:forum_update.php
示例15: createUserCategory
/**
* Create a user Media-Category.
* @param $type string image | file | video
* @param $userId int - leave empty for currently logged in user.
* @param $userName string - leave blank for currently logged in user
* @param $parms (optional) - for future use.
* @return bool|int
*/
public function createUserCategory($type = 'image', $userId = USERID, $userName = USERNAME, $parms = null)
{
if ($type != 'image' && ($type = 'file' && $type != 'video')) {
return false;
}
$cat = 'user_' . $type . '_' . intval($userId);
if (!e107::getDb()->gen('SELECT media_cat_id FROM #core_media_cat WHERE media_cat_category = "' . $cat . '" LIMIT 1')) {
$insert = array('owner' => 'user', 'category' => $cat, 'title' => $userName, 'sef' => 'media-' . eHelper::title2sef($userName), 'diz' => '', 'class' => '', 'image' => '', 'order' => '');
return $this->createCategory($insert);
}
return false;
}
开发者ID:KonzolozZ,项目名称:e107,代码行数:20,代码来源:media_class.php
示例16: submit_item
function submit_item($news, $smessages = false)
{
$tp = e107::getParser();
$sql = e107::getDb();
$admin_log = e107::getAdminLog();
$pref = e107::getPref();
$e_event = e107::getEvent();
$e107cache = e107::getCache();
$emessage = e107::getMessage();
$error = false;
if (empty($news['news_title'])) {
$error = true;
$emessage->add('Validation error: News title can\'t be empty!', E_MESSAGE_ERROR, $smessages);
if (!empty($news['news_sef'])) {
$news['news_sef'] = eHelper::secureSef($news['news_sef']);
}
} else {
// first format sef...
if (empty($news['news_sef'])) {
$news['news_sef'] = eHelper::title2sef($news['news_title']);
} else {
$news['news_sef'] = eHelper::secureSef($news['news_sef']);
}
}
// ...then check it
if (empty($news['news_sef'])) {
$error = true;
$emessage->add('Validation error: News SEF URL value is required field and can\'t be empty!', E_MESSAGE_ERROR, $smessages);
} elseif ($sql->db_Count('news', '(news_id)', ($news['news_sef'] ? 'news_id<>' . intval($news['news_id']) . ' AND ' : '') . "news_sef='" . $tp->toDB($news['news_sef']) . "'")) {
$error = true;
$emessage->add('Validation error: News SEF URL is unique field - current value already in use! Please choose another SEF URL value.', E_MESSAGE_ERROR, $smessages);
}
if (empty($news['news_category'])) {
$error = true;
$emessage->add('Validation error: News category can\'t be empty!', E_MESSAGE_ERROR, $smessages);
}
$data = array();
//DB Array
$data['data']['news_title'] = $news['news_title'];
$data['_FIELD_TYPES']['news_title'] = 'todb';
$data['data']['news_sef'] = $news['news_sef'];
$data['_FIELD_TYPES']['news_sef'] = 'todb';
$data['data']['news_body'] = $news['news_body'];
$data['_FIELD_TYPES']['news_body'] = 'todb';
$data['data']['news_extended'] = $news['news_extended'];
$data['_FIELD_TYPES']['news_extended'] = 'todb';
$data['data']['news_datestamp'] = $news['news_datestamp'];
$data['_FIELD_TYPES']['news_datestamp'] = 'int';
$data['data']['news_author'] = $news['news_author'] ? $news['news_author'] : USERID;
$data['_FIELD_TYPES']['news_author'] = 'int';
$data['data']['news_category'] = $news['news_category'];
$data['_FIELD_TYPES']['news_category'] = 'int';
$data['data']['news_allow_comments'] = $news['news_allow_comments'];
$data['_FIELD_TYPES']['news_allow_comments'] = 'int';
$data['data']['news_start'] = $news['news_start'];
$data['_FIELD_TYPES']['news_start'] = 'int';
$data['data']['news_end'] = $news['news_end'];
$data['_FIELD_TYPES']['news_end'] = 'int';
$data['data']['news_class'] = $news['news_class'];
$data['_FIELD_TYPES']['news_class'] = 'todb';
$data['data']['news_render_type'] = $news['news_render_type'];
$data['_FIELD_TYPES']['news_render_type'] = 'todb';
//news_comment_total
$data['data']['news_summary'] = $news['news_summary'];
$data['_FIELD_TYPES']['news_summary'] = 'todb';
$data['data']['news_thumbnail'] = $news['news_thumbnail'];
$data['_FIELD_TYPES']['news_thumbnail'] = 'todb';
$data['data']['news_sticky'] = $news['news_sticky'];
$data['_FIELD_TYPES']['news_sticky'] = 'int';
$data['data']['news_meta_keywords'] = eHelper::formatMetaKeys($news['news_meta_keywords']);
$data['_FIELD_TYPES']['news_meta_keywords'] = 'todb';
$data['data']['news_meta_description'] = eHelper::formatMetaDescription($news['news_meta_description']);
//handle bbcodes
$data['_FIELD_TYPES']['news_meta_description'] = 'todb';
if ($error) {
$data['error'] = true;
return $data;
}
// Calculate short strings for admin logging - no need to clog up the log with potentially long items
$logData = $data['data'];
if (isset($logData['news_body'])) {
$logData['news_body'] = $tp->text_truncate($tp->toDB($logData['news_body']), 300, '...');
}
if (isset($logData['news_extended'])) {
$logData['news_extended'] = $tp->text_truncate($tp->toDB($logData['news_extended']), 300, '...');
}
//XXX - Now hooks are executed only if no mysql error is found. Should it stay so? Seems sensible to me!
if ($news['news_id']) {
// Updating existing item
$data['WHERE'] = 'news_id=' . intval($news['news_id']);
//$vals = "news_datestamp = '".intval($news['news_datestamp'])."', ".$author_insert." news_title='".$news['news_title']."', news_body='".$news['news_body']."', news_extended='".$news['news_extended']."', news_category='".intval($news['cat_id'])."', news_allow_comments='".intval($news['news_allow_comments'])."', news_start='".intval($news['news_start'])."', news_end='".intval($news['news_end'])."', news_class='".$tp->toDB($news['news_class'])."', news_render_type='".intval($news['news_rendertype'])."' , news_summary='".$news['news_summary']."', news_thumbnail='".$tp->toDB($news['news_thumbnail'])."', news_sticky='".intval($news['news_sticky'])."' WHERE news_id='".intval($news['news_id'])."' ";
if ($sql->db_Update('news', $data)) {
e107::getAdminLog()->logArrayAll('NEWS_09', $logData);
$data['data']['news_id'] = $news['news_id'];
e107::getEvent()->trigger('newsupd', $data['data']);
e107::getEvent()->trigger('admin_news_updated', $data['data']);
$message = LAN_UPDATED;
$emessage->add(LAN_UPDATED, E_MESSAGE_SUCCESS, $smessages);
e107::getCache()->clear('news.php');
//FIXME - triggerHook should return array(message, message_type)
//.........这里部分代码省略.........
开发者ID:KonzolozZ,项目名称:e107,代码行数:101,代码来源:news_class.php
示例17: submitPage
function submitPage($mode = FALSE, $type = FALSE)
{
global $e107cache, $admin_log, $e_event;
$frm = e107::getForm();
$sql = e107::getDb();
$tp = e107::getParser();
$ns = e107::getRender();
$mes = e107::getMessage();
$page_title = $tp->toDB($_POST['page_title']);
// print_a($_POST);
// if(is_array($_POST['data']) && is_array($_POST['subtitle']))
$newData = array();
foreach ($_POST as $k => $v) {
if (substr($k, 0, 4) == 'data' && trim($v) != '') {
list($tm, $key) = explode("_", $k);
if ($mode == FALSE) {
$newData[] = "[newpage=" . $_POST['page_subtitle'][$key] . "]\n";
}
$newData[] = $v;
}
// return;
}
// return;
$newData = implode("\n\n", $newData);
// echo nl2br($newData);
$page_text = $tp->toDB($newData);
$pauthor = $_POST['page_display_authordate_flag'] ? USERID : 0;
// Ideally, this check should be done in the front-end.
$update = 0;
// Make sure some updates happen
$page_sef = '';
$page_metad = '';
$page_metak = '';
if (!$type) {
if (!empty($_POST['page_sef'])) {
$page_sef = eHelper::secureSef($_POST['page_sef']);
}
if (empty($page_sef)) {
$page_sef = eHelper::title2sef($_POST['page_title']);
}
if (!empty($_POST['page_metadscr'])) {
$page_metad = $tp->toDB(eHelper::formatMetaDescription($_POST['page_metadscr']));
}
if (!empty($_POST['page_metakeys'])) {
$page_metak = eHelper::formatMetaKeys($_POST['page_metakeys']);
}
}
if (!$type && (!$page_title || !$page_sef)) {
e107::getMessage()->addError(CUSLAN_34, 'default', true);
e107::getRedirect()->redirect(e_ADMIN_ABS . 'cpage.php');
}
// FIXME Causes false positives on Update.. - what is trying to be achieved with this check?
/*
if(!$type && $sql->db_Count('page', '(page_id)', ($mode ? "page_id != {$mode} AND " : '')."page_sef != '{$page_sef}'"))
{
e107::getMessage()->addError(CUSLAN_34, 'default', true);
e107::getMessage()->addDebug("type=".$type, 'default', true);
e107::getMessage()->addDebug("page_title=".$page_title, 'default', true);
e107::getMessage()->addDebug("page_sef=".$page_sef, 'default', true);
e107::getMessage()->addDebug("Mode=".$mode, 'default', true);
e107::getRedirect()->redirect(e_ADMIN_ABS.'cpage.php');
}
*/
if ($type && empty($_POST['menu_name'])) {
e107::getMessage()->addError(CUSLAN_36, 'default', true);
e107::getRedirect()->redirect(e_ADMIN_ABS . 'cpage.php');
}
if ($mode) {
// Saving existing page/menu after edit
// Don't think $_POST['page_ip_restrict'] is ever set.
$menuname = $type && vartrue($_POST['menu_name']) ? ", page_theme = '" . $tp->toDB($_POST['menu_name']) . "'" : "";
$status = $sql->db_Update("page", "page_title='{$page_title}', page_sef='{$page_sef}', page_chapter='" . intval($_POST['page_chapter']) . "', page_metakeys='{$page_metak}', page_metadscr='{$page_metad}', page_text='{$page_text}', page_datestamp='" . time() . "', page_author='{$pauthor}', page_rating_flag='" . intval($_POST['page_rating_flag']) . "', page_comment_flag='" . intval($_POST['page_comment_flag']) . "', page_password='" . $_POST['page_password'] . "', page_class='" . $_POST['page_class'] . "', page_ip_restrict='" . varset($_POST['page_ip_restrict'], '') . "', page_template='" . $_POST['page_template'] . "' {$menuname} WHERE page_id='{$mode}'") ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
if ($status == E_MESSAGE_SUCCESS) {
$update++;
}
$mes->add($message, $status);
$admin_log->log_event('CPAGE_02', $mode . '[!br!]' . $page_title . '[!br!]' . $pauthor, E_LOG_INFORMATIVE, '');
$e107cache->clear("page_{$mode}");
$e107cache->clear("page-t_{$mode}");
$data = array('method' => 'update', 'table' => 'page', 'id' => $mode, 'plugin' => 'page', 'function' => 'submitPage');
$this->message = $e_event->triggerHook($data);
if ($type) {
$menu_name = $tp->toDB($_POST['menu_name']);
// not to be confused with menu-caption.
// Need to check whether menu already in table, else we can't distinguish between a failed update and no update needed
if ($sql->db_Select('menus', 'menu_name', "`menu_path` = '{$mode}'")) {
// Updating existing entry
if ($sql->db_Update('menus', "menu_name='{$menu_name}' WHERE menu_path='{$mode}' ") !== FALSE) {
$update++;
}
}
}
//$url = e107::getUrl()->sc('page/view', array('name' => $tp->post_toForm($_POST['page_title']), 'id' => $mode));
/*
// Prevent links being updated in another language unless the table is present.
if((($pref['sitelanguage'] != $sql->mySQLlanguage) && ($sql->mySQLlanguage!='')) && ($sql->db_IsLang("links")=='links'))
{
//.........这里部分代码省略.........
开发者ID:notzen,项目名称:e107,代码行数:101,代码来源:cpage.php
示例18: beforeUpdate
public function beforeUpdate($new_data, $old_data, $id)
{
$mes = e107::getMessage();
if ($new_data['media_cat_owner'] != "gallery") {
$mes->addError(LAN_IMA_001);
return FALSE;
}
if (empty($new_data['media_cat_sef'])) {
$new_data['media_cat_sef'] = eHelper::title2sef($new_data['media_cat_title']);
}
return $new_data;
}
开发者ID:e107Bulgaria,项目名称:e107,代码行数:12,代码来源:image.php
示例19: beforeUpdate
public function beforeUpdate($new_data, $old_data, $id)
{
if (empty($new_data['forum_sef']) && !empty($new_data['forum_name'])) {
$new_data['forum_sef'] = eHelper::title2sef($new_data['forum_name']);
}
return $new_data;
}
开发者ID:JBeezygit,项目名称:e107,代码行数:7,代码来源:forum_admin.php
-
librespeed/speedtest: Self-hosted Speedtest for HTML5 and more. Easy setup, exam
阅读:1218|2022-08-30
-
avehtari/BDA_m_demos: Bayesian Data Analysis demos for Matlab/Octave
阅读:1130|2022-08-17
-
女人怀孕后,为了有一个健康聪明的宝宝,经历各种体检、筛查。其实这些体检和筛查中的
阅读:941|2022-11-06
-
1,基本思路梯度法也称最速下降法。目标函数的...
阅读:531|2022-07-18
-
medfreeman/markdown-it-toc-and-anchor: markdown-it plugin to add a toc and ancho
阅读:1335|2022-08-18
-
本文借鉴小墨学FPGA的文章《零基础学FPGA(三十二)写在京城,多级FIR半带滤波器的FPG
阅读:1002|2022-07-18
-
The dainst/cilantro repository through 0.0.4 on GitHub allows absolute path trav
阅读:771|2022-07-29
-
sydney0zq/covid-19-detection: The implementation of A Weakly-supervised Framewor
阅读:485|2022-08-16
-
containous/traefik-library-image: ARCHIVED
阅读:1342|2022-08-15
-
离中国最远的国家是阿根廷。从太平洋直线计算,即往东线走,北京到阿根廷的布宜诺斯艾
阅读:640|2022-11-06
|
请发表评论