本文整理汇总了PHP中eHelper::title2sef方法的典型用法代码示例。如果您正苦于以下问题:PHP eHelper::title2sef方法的具体用法?PHP eHelper::title2sef怎么用?PHP eHelper::title2sef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eHelper
的用法示例。
在下文中一共展示了eHelper::title2sef方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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);
}
}
示例3: beforeUpdate
public function beforeUpdate($new_data, $old_data, $id)
{
if (!empty($new_data['news_thumbnail'])) {
$new_data['news_thumbnail'] = $this->processThumbs($new_data['news_thumbnail']);
}
if (isset($new_data['news_datestamp']) && empty($new_data['news_datestamp'])) {
$new_data['news_datestamp'] = time();
}
if (isset($new_data['news_sef']) && empty($new_data['news_sef']) && !empty($new_data['news_title'])) {
$new_data['news_sef'] = eHelper::title2sef($new_data['news_title']);
}
if (!empty($new_data['news_author'])) {
$tmp = explode(chr(35), $new_data['news_author']);
$new_data['news_author'] = intval($tmp[0]);
}
if (E107_DBG_SQLQUERIES) {
e107::getMessage()->addInfo("<h3>Raw _POST data</h3>" . print_a($_POST, true));
}
return $new_data;
}
示例4: move2download
protected function move2download($upload)
{
if (!$upload['upload_active']) {
return 0;
}
$media = e107::getMedia();
$uploadPath = e_UPLOAD;
if (!file_exists($uploadPath . $upload['upload_file'])) {
$this->getModel()->addValidationError(LAN_FILE_NOT_FOUND);
return false;
}
$downloadPath = $media->importFile($upload['upload_file'], 'download_file', $uploadPath . $upload['upload_file'], array('media_caption' => $upload['upload_name']));
if (false === $downloadPath) {
$this->getModel()->addValidationError(UPLLAN_66);
return false;
}
$imagePath = null;
if ($upload['upload_ss'] && file_exists($uploadPath . $upload['upload_ss'])) {
$imagePath = $media->importFile($upload['upload_ss'], '_common_image', $uploadPath . $upload['upload_ss'], array('media_caption' => $upload['upload_name'] . ' ' . LAN_PREVIEW));
}
$author = $upload['upload_poster'] ? e107::getSystemUser($upload['upload_poster'])->getRealName() : LAN_ANONYMOUS;
$dl = array('download_name' => $upload['upload_name'], 'download_url' => $downloadPath, 'download_sef' => eHelper::title2sef($upload['upload_name']), 'download_author' => $author, 'download_author_email' => $upload['upload_email'], 'download_author_website' => $upload['upload_website'], 'download_description' => $upload['upload_description'], 'download_keywords' => null, 'download_filesize' => $upload['upload_filesize'], 'download_requested' => 0, 'download_category' => $upload['upload_category'], 'download_active' => 1, 'download_datestamp' => $upload['upload_datestamp'], 'download_thumb' => null, 'download_image' => $imagePath, 'download_comment' => 1, 'download_class' => e_UC_MEMBER, 'download_visible' => e_UC_MEMBER, 'download_mirror' => null, 'download_mirror_type' => 0);
$sql = e107::getDb('activate');
$id = $sql->insert('download', $dl);
if (!$id) {
$this->getModel()->addValidationError(UPLLAN_68 . ' #' . $sql->getLastErrorNumber() . ' ' . $sql->getLastErrorText());
e107::getMessage()->addDebug($sql->getLastQuery());
return;
}
return $id;
}
示例5: forum_track
function forum_track()
{
global $forum;
$trackPref = $forum->prefs->get('track');
if (empty($trackPref)) {
echo "Disabled";
return false;
}
$FORUM_TEMPLATE = null;
include e_PLUGIN . 'forum/templates/forum_template.php';
// Override with theme template
if (file_exists(THEME . 'forum_template.php')) {
include THEME . 'forum_template.php';
} elseif (file_exists(THEME . 'templates/forum/forum_template.php')) {
require THEME . 'templates/forum/forum_template.php';
}
$IMAGE_nonew_small = IMAGE_nonew_small;
$IMAGE_new_small = IMAGE_new_small;
if (is_array($FORUM_TEMPLATE) && deftrue('BOOTSTRAP', false)) {
$FORUM_TRACK_START = $FORUM_TEMPLATE['track']['start'];
// $FORUM_TEMPLATE['track-start'];
$FORUM_TRACK_MAIN = $FORUM_TEMPLATE['track']['item'];
// $FORUM_TEMPLATE['track-main'];
$FORUM_TRACK_END = $FORUM_TEMPLATE['track']['end'];
// $FORUM_TEMPLATE['track-end'];
$IMAGE_nonew_small = IMAGE_nonew;
$IMAGE_new_small = IMAGE_new;
}
$sql = e107::getDb();
$tp = e107::getParser();
if ($trackedThreadList = $forum->getTrackedThreadList(USERID, 'list')) {
$viewed = $forum->threadGetUserViewed();
$qry = "SELECT t.*,th.*, f.* FROM `#forum_track` AS t\n\t\tLEFT JOIN `#forum_thread` AS th ON t.track_thread = th.thread_id\n\t\tLEFT JOIN `#forum` AS f ON th.thread_forum_id = f.forum_id\n\t\tWHERE t.track_userid = " . USERID . " ORDER BY th.thread_lastpost DESC";
$forum_trackstring = '';
$data = array();
if ($sql->gen($qry)) {
while ($row = $sql->fetch(MYSQL_ASSOC)) {
$row['thread_sef'] = eHelper::title2sef($row['thread_name'], 'dashl');
$data['NEWIMAGE'] = $IMAGE_nonew_small;
if ($row['thread_datestamp'] > USERLV && !in_array($row['thread_id'], $viewed)) {
$data['NEWIMAGE'] = $IMAGE_new_small;
}
$buttonId = "forum-track-button-" . intval($row['thread_id']);
$forumUrl = e107::url('forum', 'forum', $row);
$threadUrl = e107::url('forum', 'topic', $row, array('query' => array('last' => 1)));
// ('forum/thread/view', $row); // configs will be able to map thread_* vars to the url
$data['TRACKPOSTNAME'] = "<a href='" . $forumUrl . "'>" . $row['forum_name'] . "</a> / <a href='" . $threadUrl . "'>" . $tp->toHTML($row['thread_name']) . '</a>';
// $data['UNTRACK'] = "<a class='btn btn-default' href='".e_SELF."?untrack.".$row['thread_id']."'>".LAN_FORUM_0070."</a>";
$data['UNTRACK'] = "<a id='" . $buttonId . "' href='#' title=\"" . LAN_FORUM_3040 . "\" data-token='" . e_TOKEN . "' data-forum-insert='" . $buttonId . "' data-forum-post='" . $row['thread_forum_id'] . "' data-forum-thread='" . $row['thread_id'] . "' data-forum-action='track' name='track' class='btn btn-primary' >" . IMAGE_track . "</a>";
$forum_trackstring .= $tp->simpleParse($FORUM_TRACK_MAIN, $data);
}
}
// print_a($FORUM_TRACK_START);
if (deftrue('BOOTSTRAP')) {
$breadarray = array(array('text' => e107::pref('forum', 'title', LAN_PLUGIN_FORUM_NAME), 'url' => e107::url('forum', 'index')), array('text' => LAN_FORUM_0030, 'url' => null));
$data['FORUM_BREADCRUMB'] = e107::getForm()->breadcrumb($breadarray);
}
$forum_track_start = $tp->simpleParse($FORUM_TRACK_START, $data);
$forum_track_end = $tp->simpleParse($FORUM_TRACK_END, $data);
// $ns->tablerender($forum->prefs->get('title'), $forum_track_start.$forum_trackstring.$forum_track_end, array('forum', 'main1'));
$tracktext = $forum_track_start . $forum_trackstring . $forum_track_end;
}
$text = '';
$text .= $tracktext;
$text .= "<div class='center'>" . e107::getForm()->pagination(e107::url('forum', 'index'), LAN_BACK) . "</div>";
e107::getRender()->tablerender(LAN_FORUM_0030, $text, array('forum', 'forum_track'));
}
示例6: 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'))
{
//.........这里部分代码省略.........
示例7: 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;
}
示例8: rebuild
/**
* Rebuild SEF Urls for a particular table
* @param $table
* @param primary field id.
* @param input field (title)
* @param output field (sef)
*/
private function rebuild($table, $primary, $input, $output)
{
if (empty($table) || empty($input) || empty($output) || empty($primary)) {
e107::getMessage()->addError("Missing Generator data");
return;
}
$sql = e107::getDb();
$data = $sql->retrieve($table, $primary . "," . $input, $input . " != '' ", true);
$success = 0;
$failed = 0;
foreach ($data as $row) {
$sef = eHelper::title2sef($row[$input]);
if ($sql->update($table, $output . " = '" . $sef . "' WHERE " . $primary . " = " . intval($row[$primary]) . " LIMIT 1") !== false) {
$success++;
} else {
$failed++;
}
// echo $row[$input]." => ".$output ." = '".$sef."' WHERE ".$primary. " = ".intval($row[$primary]). " LIMIT 1 <br />";
}
if ($success) {
e107::getMessage()->addSuccess($success . LAN_EURL_SURL_UPD);
}
if ($failed) {
e107::getMessage()->addError($failed . LAN_EURL_SURL_NUPD);
}
}
示例9: zip
/**
* Zip up folders and files
* @param array $filePaths
* @param string $newFile
*/
public function zip($filePaths = null, $newFile = '', $options = array())
{
if (empty($newFile)) {
$newFile = e_BACKUP . eHelper::title2sef(SITENAME) . "_" . date("Y-m-d-H-i-s") . ".zip";
}
if (is_null($filePaths)) {
return "No file-paths set!";
}
require_once e_HANDLER . 'pclzip.lib.php';
$archive = new PclZip($newFile);
$removePath = !empty($options['remove_path']) ? $options['remove_path'] : e_BASE;
if ($archive->create($filePaths, PCLZIP_OPT_REMOVE_PATH, $removePath) == 0) {
$error = $archive->errorInfo(true);
e107::getAdminLog()->addError($error)->save('FILE', E_LOG_NOTICE);
return false;
} else {
return $newFile;
}
}
示例10: beforeCreate
function beforeCreate($newdata, $olddata)
{
$newdata['menu_name'] = preg_replace('/[^\\w-*]/', '-', $newdata['menu_name']);
if (empty($newdata['page_sef'])) {
if (!empty($newdata['page_title'])) {
$newdata['page_sef'] = eHelper::title2sef($newdata['page_title']);
} elseif (!empty($newdata['menu_name'])) {
$newdata['page_sef'] = eHelper::title2sef($newdata['menu_name']);
}
} else {
$newdata['page_sef'] = eHelper::secureSef($newdata['page_sef']);
}
$sef = e107::getParser()->toDB($newdata['page_sef']);
if (e107::getDb()->count('page', '(*)', "page_sef='{$sef}'")) {
e107::getMessage()->addError(CUSLAN_57);
return false;
}
return $newdata;
}
示例11: 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']);
$message = LAN_NEWS_21;
$emessage->add(LAN_NEWS_21, E_MESSAGE_SUCCESS, $smessages);
e107::getCache()->clear('news.php');
//FIXME - triggerHook should return array(message, message_type)
$evdata = array('method' => 'update', 'table' => 'news', 'id' => $news['news_id'], 'plugin' => 'news', 'function' => 'submit_item');
//.........这里部分代码省略.........
示例12: while
while (@ob_end_clean()) {
}
if (varset($_GET['mode']) == 'backup') {
echo "Starting file backup...<br />";
$data = array();
$data[] = e_MEDIA;
$data[] = e_LOG;
$data[] = e_IMPORT;
$data[] = e_TEMP;
$data[] = e_SYSTEM . "filetypes.xml";
$data[] = e_THEME . e107::getPref('sitetheme');
$plugins = e107::getPlugin()->getOtherPlugins();
foreach ($plugins as $dir) {
$data[] = e_PLUGIN . $dir;
}
$newFile = eHelper::title2sef(SITENAME) . "_" . date("Y-m-d-H-i-s");
$zip = e107::getFile()->zip($data, e_BACKUP . $newFile . ".zip");
echo DBLAN_60 . " <small>(" . $zip . ")</small><br />";
echo DBLAN_61 . "<br />";
$dbfile = e107::getDb()->backup('*', $newFile . ".sql", array('nologs' => 1, 'droptable' => 1));
echo DBLAN_62 . " <small>(" . $dbfile . ")</small>";
e107::getAdminLog()->addSuccess($zip . " " . $dbfile, false)->save(DBLAN_63);
}
exit;
}
require_once "auth.php";
$st = new system_tools();
/* No longer needed after XML feature added.
if(isset($_POST['backup_core']) || $_GET['mode']=='backup_core')
{
示例13: threadGetNextPrev
function threadGetNextPrev($which, $threadId, $forumId, $lastpost)
{
$sql = e107::getDb();
$forumId = (int) $forumId;
$lastpost = (int) $lastpost;
$dir = $which == 'next' ? '<' : '>';
$qry = "\n\t\t\tSELECT t.thread_id, t.thread_name, f.forum_id, f.forum_sef FROM `#forum_thread` AS t\n\t\t\tLEFT JOIN `#forum` AS f ON t.thread_forum_id = f.forum_id\n\t\t\tWHERE t.thread_forum_id = {$forumId}\n\t\t\tAND t.thread_lastpost {$dir} {$lastpost}\n\t\t\tORDER BY\n\t\t\tt.thread_sticky DESC,\n\t\t\tt.thread_lastpost ASC\n\t\t\tLIMIT 1";
// e107::getMessage()->addDebug(ucfirst($which)." Thread Qry: ".$qry);
if ($sql->gen($qry)) {
$row = $sql->fetch();
$row['thread_sef'] = eHelper::title2sef($row['thread_name'], 'dashl');
// e107::getMessage()->addInfo(ucfirst($which).print_a($row,true));
return $row;
// return $row['thread_id'];
} else {
// e107::getMessage()->addDebug(ucfirst($which)." Thread Qry Returned Nothing: ".$qry);
}
return false;
}
示例14: _observe_update_category
function _observe_update_category()
{
if (!getperms('0|7')) {
$this->noPermissions();
}
$this->setId(intval($_POST['category_id']));
if (!$this->getId()) {
return;
}
//FIXME - lan, e_model based news administration model
$this->error = false;
if (empty($_POST['category_name'])) {
$this->show_message('Validation Error: Missing Category name', E_MESSAGE_ERROR);
$this->error = true;
if (!empty($_POST['category_sef'])) {
$_POST['category_sef'] = eHelper::secureSef($_POST['category_sef']);
}
} else {
// first format sef...
if (empty($_POST['category_sef'])) {
$_POST['category_sef'] = eHelper::title2sef($_POST['category_name']);
} else {
$_POST['category_sef'] = eHelper::secureSef($_POST['category_sef']);
}
}
// ...then check it
if (empty($_POST['category_sef'])) {
$this->error = true;
$this->show_message('Validation error: News Category SEF URL value is required field and can\'t be empty!', E_MESSAGE_ERROR);
} elseif (e107::getDb()->db_Count('news_category', '(category_id)', "category_id<>" . $this->getId() . " AND category_sef='" . (e107::getParser()->toDB($_POST['category_sef']) . "'"))) {
$this->error = true;
$this->show_message('Validation error: News Category SEF URL is unique field - current value already in use! Please choose another SEF URL value.', E_MESSAGE_ERROR);
}
if (!$this->error) {
$updatea = array();
$updatea['data']['category_icon'] = $_POST['category_icon'];
$updatea['_FIELD_TYPES']['category_icon'] = 'todb';
$updatea['data']['category_name'] = $_POST['category_name'];
$updatea['_FIELD_TYPES']['category_name'] = 'todb';
$updatea['data']['category_sef'] = $_POST['category_sef'];
$updatea['_FIELD_TYPES']['category_sef'] = 'todb';
$updatea['data']['category_meta_description'] = strip_tags($_POST['category_meta_description']);
$updatea['_FIELD_TYPES']['category_meta_description'] = 'str';
$updatea['data']['category_meta_keywords'] = $_POST['category_meta_keywords'];
$updatea['_FIELD_TYPES']['category_meta_keywords'] = 'str';
$updatea['data']['category_manager'] = $_POST['category_manager'];
$updatea['_FIELD_TYPES']['category_manager'] = 'int';
$updatea['data']['category_order'] = $_POST['category_order'];
$updatea['_FIELD_TYPES']['category_order'] = 'int';
$updatea['WHERE'] = 'category_id=' . $this->getId();
$inserta = array();
$rid = 0;
$upcheck = e107::getDb()->db_Update("news_category", $updatea);
$rwupcheck = false;
if ($upcheck || !e107::getDb()->getLastErrorNumber()) {
if ($upcheck || $rwupcheck) {
//admin log now supports DB array and method chaining
$updatea['data']['category_id'] = $this->getId();
if ($upcheck) {
e107::getAdminLog()->log_event('NEWS_05', $updatea['data'], E_LOG_INFORMATIVE, '');
}
if ($rwupcheck && $inserta['data']) {
e107::getAdminLog()->log_event('NEWS_10', $inserta['data'], E_LOG_INFORMATIVE, '');
}
$this->show_message(NWSLAN_36, E_MESSAGE_SUCCESS);
$this->clear_cache();
//TODO - add to WIKI docs
e107::getEvent()->trigger("newscatupd", array_merge($updatea['data'], $inserta['data']));
} else {
$this->show_message(LAN_NO_CHANGE);
}
$this->setId(0);
} else {
$this->error = true;
$this->setSubAction('edit');
$this->show_message('mySQL Error detected!', E_MESSAGE_ERROR);
$this->show_message('#' . e107::getDb()->getLastErrorNumber() . ': ' . e107::getDb()->getLastErrorText(), E_MESSAGE_DEBUG);
return;
}
}
}
示例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;
}