1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 12:48:26 +02:00

More admin->Custom-page and admin->News fixes.

This commit is contained in:
CaMer0n
2012-04-19 03:53:58 +00:00
parent 8be3353a6d
commit 5178e66567
5 changed files with 734 additions and 534 deletions

View File

@@ -31,14 +31,14 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
$e_sub_cat = 'custom'; $e_sub_cat = 'custom';
require_once('auth.php');
require_once(e_HANDLER.'userclass_class.php'); require_once(e_HANDLER.'userclass_class.php');
require_once(e_HANDLER.'message_handler.php'); require_once(e_HANDLER.'message_handler.php');
require_once(e_HANDLER.'form_handler.php'); require_once(e_HANDLER.'form_handler.php');
$frm = new e_form(true); $frm = new e_form(true);
$emessage = &eMessage::getInstance(); $emessage = eMessage::getInstance();
$page = new page; // $page = new page;
/*
if (e_QUERY) if (e_QUERY)
{ {
$tmp = explode(".", e_QUERY); $tmp = explode(".", e_QUERY);
@@ -47,36 +47,13 @@ if (e_QUERY)
$id = intval(varset($tmp[2], 0)); $id = intval(varset($tmp[2], 0));
$from = intval(varset($tmp[3], 0)); $from = intval(varset($tmp[3], 0));
} }
*/
if(isset($_POST['submitPage']))
{
$page->submitPage();
}
if(isset($_POST['uploadfiles']))
{
$page->uploadPage();
$id = intval(varset($_POST['pe_id'], 0));
$sub_action = ($_POST['pe_id']) ? "edit" : "";
$page->createPage($_POST['mode']);
}
if(isset($_POST['submitMenu']))
{
$page->submitPage("", TRUE);
}
if(isset($_POST['updateMenu']))
{
$page->submitPage($_POST['pe_id'], TRUE);
}
if(isset($_POST['updatePage']))
{
$page->submitPage($_POST['pe_id']);
}
/*
if(isset($_POST['delete']) || varset($_POST['etrigger_delete'])) if(isset($_POST['delete']) || varset($_POST['etrigger_delete']))
{ {
if($_POST['etrigger_delete']) if($_POST['etrigger_delete'])
@@ -93,12 +70,10 @@ if(isset($_POST['delete']) || varset($_POST['etrigger_delete']))
$page->delete_page($pid); $page->delete_page($pid);
} }
} }
*/
if (isset($_POST['saveOptions']))
{
$page->saveSettings();
}
/*
if(!e_QUERY) if(!e_QUERY)
{ {
if(getperms('5')) if(getperms('5'))
@@ -129,144 +104,176 @@ else
$function = $action.'Page'; $function = $action.'Page';
$page->$function(); $page->$function();
} }
*/
require_once(e_ADMIN.'footer.php');
// FIXME - add page link to sitelinks is completely disabled as current implementation is not reliable (+ is obsolete and generates sql error)
class page
{
var $fields;
function page()
class page_admin extends e_admin_dispatcher
{ {
global $pref,$user_pref, $admin_log; protected $modes = array(
if(isset($_POST['etrigger_ecolumns'])) 'main' => array(
{ 'controller' => 'page_admin_ui',
$user_pref['admin_cpage_columns'] = $_POST['e-columns']; 'path' => null,
save_prefs('user'); 'ui' => 'page_admin_form_ui',
'uipath' => null
)
);
protected $adminMenu = array(
'main/list' => array('caption'=> CUSLAN_48, 'perm' => '5'),
'main/menus' => array('caption'=> CUSLAN_49, 'perm' => 'J'),
'main/create' => array('caption'=> CUSLAN_12, 'perm' => '5'),
'main/createem' => array('caption'=> CUSLAN_31, 'perm' => 'J'),
'main/options' => array('caption'=> LAN_OPTIONS, 'perm' => '0')
);
protected $adminMenuAliases = array(
'main/edit' => 'main/list'
);
protected $menuTitle = 'Custom Pages';
} }
$this->fieldpref = (varset($user_pref['admin_cpage_columns'])) ? $user_pref['admin_cpage_columns'] : array("page_id","page_title","page_theme"); ;
$this->fields = array( class page_admin_form_ui extends e_admin_form_ui
{
/*public function faq_info_parent($curVal,$mode)
{
// TODO - catlist combo without current cat ID in write mode, parents only for batch/filter
// Get UI instance
$controller = $this->getController();
switch($mode)
{
case 'read':
return e107::getParser()->toHTML($controller->getFaqCategoryTree($curVal), false, 'TITLE');
break;
case 'write':
return $this->selectbox('faq_info_parent', $controller->getFaqCategoryTree(), $curVal);
break;
case 'filter':
case 'batch':
return $controller->getFaqCategoryTree();
break;
}
}*/
}
class page_admin_ui extends e_admin_ui
{
protected $pluginTitle = ADLAN_42;
protected $pluginName = 'core';
protected $table = "page";
protected $listQry = "SELECT p.*,u.user_id,u.user_name FROM #page AS p LEFT JOIN #user AS u ON p.page_author = u.user_id WHERE p.page_theme = '' "; // without any Order or Limit.
//protected $editQry = "SELECT * FROM #comments WHERE comment_id = {ID}";
protected $pid = "page_id";
protected $listOrder = 'p.page_id desc';
protected $perPage = 10;
protected $batchDelete = true;
protected $batchCopy = true;
protected $fields = array(
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
'page_id' => array('title'=> 'ID', 'width'=>'5%', 'forced'=> TRUE), 'page_id' => array('title'=> 'ID', 'width'=>'5%', 'forced'=> TRUE),
'page_title' => array('title'=> CUSLAN_1, 'type' => 'text', 'width'=>'auto'), 'page_title' => array('title'=> CUSLAN_1, 'type' => 'text', 'width'=>'auto'),
'page_theme' => array('title'=> CUSLAN_2, 'type' => 'text', 'width' => 'auto','nolist'=>true), 'page_theme' => array('title'=> CUSLAN_2, 'type' => 'text', 'width' => 'auto','nolist'=>true),
'page_template' => array('title'=> 'Template', 'type' => 'text', 'width' => 'auto'), 'page_template' => array('title'=> 'Template', 'type' => 'text', 'width' => 'auto'),
'page_author' => array('title'=> LAN_AUTHOR, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left'), 'page_author' => array('title'=> LAN_AUTHOR, 'type' => 'user', 'width' => 'auto', 'thclass' => 'left'),
'page_datestamp' => array('title'=> LAN_DATE, 'type' => 'datestamp', 'width' => 'auto'), 'page_datestamp' => array('title'=> LAN_DATE, 'type' => 'datestamp', 'width' => 'auto'),
'page_class' => array('title'=> LAN_USERCLASS, 'type' => 'userclass', 'width' => 'auto'), 'page_class' => array('title'=> LAN_USERCLASS, 'type' => 'userclass', 'width' => 'auto', 'filter' => true, 'batch' => true),
'page_rating_flag' => array('title'=> LAN_RATING, 'type' => 'boolean', 'width' => '10%', 'thclass' => 'center', 'class' => 'center' ), 'page_rating_flag' => array('title'=> LAN_RATING, 'type' => 'boolean', 'width' => '10%', 'thclass' => 'center', 'class' => 'center' ),
'page_comment_flag' => array('title'=> ADLAN_114, 'type' => 'boolean', 'width' => '10%', 'thclass' => 'center', 'class' => 'center' ), 'page_comment_flag' => array('title'=> ADLAN_114, 'type' => 'boolean', 'width' => '10%', 'thclass' => 'center', 'class' => 'center' ),
// 'page_password' => array('title'=> LAN_USER_05, 'type' => 'text', 'width' => 'auto'), // 'page_password' => array('title'=> LAN_USER_05, 'type' => 'text', 'width' => 'auto'),
// 'page_ip_restrict' => array('title'=> LAN_USER_07, 'type' => 'text', 'width' => 'auto'), // Avatar // 'page_ip_restrict' => array('title'=> LAN_USER_07, 'type' => 'text', 'width' => 'auto'), // Avatar
'options' => array('title'=> LAN_OPTIONS, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center') 'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center')
); );
// $this->fieldpref = array("page_id","page_title","page_author","page_class"); protected $fieldpref = array("page_id","page_title","page_template","page_author","page_class");
function init()
{
//FIX ME - mode not retained after using drop-down 'filter' or 'search'.
if($_GET['mode'] =='main' && $_GET['action'] =='menus')
{
$this->listQry = "SELECT p.*,u.user_id,u.user_name FROM #page AS p LEFT JOIN #user AS u ON p.page_author = u.user_id WHERE p.page_theme != '' "; // without any Order or Limit.
} }
// -------------------------------------------------------------------------- if(isset($_POST['uploadfiles']))
{
function menusPage() $this->uploadPage();
$id = intval(varset($_POST['pe_id'], 0));
$sub_action = ($_POST['pe_id']) ? "edit" : "";
$this->createPage($_POST['mode']);
}
if (isset($_POST['saveOptions']))
{
$this->saveSettings();
}
if(isset($_POST['submitPage']))
{
$this->submitPage();
}
if(isset($_POST['submitMenu']))
{
$this->submitPage("", TRUE);
}
if(isset($_POST['updateMenu']))
{
$this->submitPage($_POST['pe_id'], TRUE);
}
if(isset($_POST['updatePage']))
{
$this->submitPage($_POST['pe_id']);
}
}
// Create Menu Page.
function createemPage()
{ {
if(!getperms("J")){ return; } if(!getperms("J")){ return; }
return $this->showExistingPages('menus'); $this->createPage('menu');
}
// --------------------------------------------------------------------------
function showExistingPages($mode=FALSE)
{
global $sql, $e107, $emessage, $frm, $pref;
$text = "<form method='post' action='".e_SELF."?".e_QUERY."'>
<fieldset id='core-cpage-list'>
<legend class='e-hideme'>".CUSLAN_5."</legend>
<table cellpadding='0' cellspacing='0' class='adminlist'>".
$frm->colGroup($this->fields,$this->fieldpref).
$frm->thead($this->fields,$this->fieldpref).
"<tbody>";
if($mode=='menus')
{
$qry = "page_theme !='' ";
$caption = CUSLAN_50;
}
else
{
if(!getperms("5")){ return; }
$qry = "page_theme ='' ";
$caption = CUSLAN_5;
}
if(!$sql->db_Select("page", "*", $qry." ORDER BY page_datestamp DESC"))
{
$text .= "
<tr>
<td colspan='4' class='center middle'>
".CUSLAN_42."
</td>
</tr>
";
}
else
{
$pages = $sql->db_getList('ALL', FALSE, FALSE);
foreach($pages as $pge)
{
$title_text = $pge['page_title'] ? $pge['page_title'] : ($pge['page_theme'] ? CUSLAN_43.$pge['page_theme'] : CUSLAN_44);
$pge['page_title'] = "<a href='".($pge['page_theme'] ? e_ADMIN."menus.php" : e107::getUrl()->create('page/view', $pge, 'allow=page_id,page_sef'))."'>{$title_text}</a>";
$authorData = get_user_data($pge['page_author']);
$pge['page_author'] = varset($authorData['user_name'], '?');
$text .= $frm->renderTableRow($this->fields,$this->fieldpref,$pge,'page_id');
}
}
$text .= "
</tbody>
</table>
</fieldset>
</form>
";
$e107->ns->tablerender($caption, $emessage->render().$text);
} }
function createmPage()
{
$this->createPage(TRUE);
}
function uploadPage()
{
global $pref;
$pref['upload_storagetype'] = "1";
require_once(e_HANDLER."upload_handler.php");
$uploaded = file_upload(e_IMAGE."custom/");
}
// Create Page Page.
function createPage($mode=FALSE) function createPage($mode=FALSE)
{ {
/* mode: FALSE == page, mode: TRUE == menu */ /* mode: FALSE == page, mode: TRUE == menu */
global $e107, $sub_action, $id, $e_userclass, $e_event;
global $e107, $e_userclass, $e_event;
$frm = e107::getForm(); $frm = e107::getForm();
$sql = e107::getDb(); $sql = e107::getDb();
$tp = e107::getParser(); $tp = e107::getParser();
$ns = e107::getRender(); $ns = e107::getRender();
$mes = e107::getMessage();
$id = intval($_GET['id']);
$sub_action = $_GET['action'];
$edit = ($sub_action == 'edit'); $edit = ($sub_action == 'edit');
$caption =(!$mode ? ($edit ? CUSLAN_23 : CUSLAN_24) : ($edit ? CUSLAN_25 : CUSLAN_26)); $caption =(!$mode ? ($edit ? CUSLAN_23 : CUSLAN_24) : ($edit ? CUSLAN_25 : CUSLAN_26));
@@ -509,16 +516,97 @@ class page
</form> </form>
"; ";
$ns->tablerender($caption, $text); // $ns->tablerender($caption, $text);
echo $mes->render().$text;
} }
function optionsPage()
{
global $e107, $pref;
$ns = e107::getRender();
$mes = e107::getMessage();
$frm = e107::getForm();
$sql = e107::getDb();
$tp = e107::getParser();
if(!isset($pref['pageCookieExpire'])) $pref['pageCookieExpire'] = 84600;
//XXX Lan - Options
$text = "
<form method='post' action='".e_SELF."?".e_QUERY."'>
<fieldset id='core-cpage-options'>
<legend class='e-hideme'>".LAN_OPTIONS."</legend>
<table cellpadding='0' cellspacing='0' class='adminform'>
<colgroup span='2'>
<col class='col-label' />
<col class='col-control' />
</colgroup>
<tbody>
<tr>
<td class='label'>".CUSLAN_29."</td>
<td class='control'>
".$frm->radio_switch('listPages', $pref['listPages'])."
</td>
</tr>
<tr>
<td class='label'>".CUSLAN_30."</td>
<td class='control'>
".$frm->text('pageCookieExpire', $pref['pageCookieExpire'], 10)."
</td>
</tr>
</tbody>
</table>
<div class='buttons-bar center'>
".$frm->admin_button('saveOptions', CUSLAN_40, 'submit')."
</div>
</fieldset>
</form>
";
//$ns->tablerender(LAN_OPTIONS, $mes->render().$text);
echo $mes->render().$text;
}
function saveSettings()
{
global $pref, $admin_log, $emessage;
$temp['listPages'] = $_POST['listPages'];
$temp['pageCookieExpire'] = $_POST['pageCookieExpire'];
if ($admin_log->logArrayDiffs($temp, $pref, 'CPAGE_04'))
{
save_prefs(); // Only save if changes
$emessage->add(LAN_SETSAVED, E_MESSAGE_SUCCESS);
}
else
{
$emessage->add(LAN_NOCHANGE_NOTSAVED);
}
}
// Write new/edited page/menu to the DB // Write new/edited page/menu to the DB
// $mode - zero for new page, page id for existing // $mode - zero for new page, page id for existing
// $type = FALSE for page, TRUE for menu // $type = FALSE for page, TRUE for menu
function submitPage($mode = FALSE, $type=FALSE) function submitPage($mode = FALSE, $type=FALSE)
{ {
global $sql, $tp, $e107cache, $admin_log, $e_event;
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']); $page_title = $tp->toDB($_POST['page_title']);
$page_text = $tp->toDB($_POST['data']); $page_text = $tp->toDB($_POST['data']);
@@ -580,7 +668,7 @@ class page
$status = $sql -> db_Update("page", "page_title='{$page_title}', page_sef='{$page_sef}', 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; $status = $sql -> db_Update("page", "page_title='{$page_title}', page_sef='{$page_sef}', 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++; if ($status == E_MESSAGE_SUCCESS) $update++;
$mes = e107::getMessage();
$mes->add($message, $status); $mes->add($message, $status);
$admin_log->log_event('CPAGE_02',$mode.'[!br!]'.$page_title.'[!br!]'.$pauthor,E_LOG_INFORMATIVE,''); $admin_log->log_event('CPAGE_02',$mode.'[!br!]'.$page_title.'[!br!]'.$pauthor,E_LOG_INFORMATIVE,'');
@@ -628,6 +716,8 @@ class page
$e107cache->clear("sitelinks"); $e107cache->clear("sitelinks");
} }
}*/ }*/
admin_update($update, 'update', LAN_UPDATED, false, false); // Display result of update admin_update($update, 'update', LAN_UPDATED, false, false); // Display result of update
} }
else else
@@ -684,8 +774,150 @@ class page
} }
} }
function uploadPage()
{
global $pref;
$pref['upload_storagetype'] = "1";
require_once(e_HANDLER."upload_handler.php");
$uploaded = file_upload(e_IMAGE."custom/");
}
}
require_once('auth.php');
new page_admin();
e107::getAdminUI()->runPage();
require_once(e_ADMIN.'footer.php');
// FIXME - add page link to sitelinks is completely disabled as current implementation is not reliable (+ is obsolete and generates sql error)
class page
{
var $fields;
// DEPRECATED
function page()
{
global $pref,$user_pref, $admin_log;
if(isset($_POST['etrigger_ecolumns']))
{
$user_pref['admin_cpage_columns'] = $_POST['e-columns'];
save_prefs('user');
}
$this->fieldpref = (varset($user_pref['admin_cpage_columns'])) ? $user_pref['admin_cpage_columns'] : array("page_id","page_title","page_theme"); ;
$this->fields = array(
'page_id' => array('title'=> 'ID', 'width'=>'5%', 'forced'=> TRUE),
'page_title' => array('title'=> CUSLAN_1, 'type' => 'text', 'width'=>'auto'),
'page_theme' => array('title'=> CUSLAN_2, 'type' => 'text', 'width' => 'auto','nolist'=>true),
'page_template' => array('title'=> 'Template', 'type' => 'text', 'width' => 'auto'),
'page_author' => array('title'=> LAN_AUTHOR, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left'),
'page_datestamp' => array('title'=> LAN_DATE, 'type' => 'datestamp', 'width' => 'auto'),
'page_class' => array('title'=> LAN_USERCLASS, 'type' => 'userclass', 'width' => 'auto', 'filter' => true, 'batch' => true,),
'page_rating_flag' => array('title'=> LAN_RATING, 'type' => 'boolean', 'width' => '10%', 'thclass' => 'center', 'class' => 'center' ),
'page_comment_flag' => array('title'=> ADLAN_114, 'type' => 'boolean', 'width' => '10%', 'thclass' => 'center', 'class' => 'center' ),
// 'page_password' => array('title'=> LAN_USER_05, 'type' => 'text', 'width' => 'auto'),
// 'page_ip_restrict' => array('title'=> LAN_USER_07, 'type' => 'text', 'width' => 'auto'), // Avatar
'options' => array('title'=> LAN_OPTIONS, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center')
);
// $this->fieldpref = array("page_id","page_title","page_author","page_class");
}
// --------------------------------------------------------------------------
// DEPRECATED
/*
function menusPage()
{
if(!getperms("J")){ return; }
return $this->showExistingPages('menus');
}
**/
// --------------------------------------------------------------------------
/*
function showExistingPages($mode=FALSE)
{
global $sql, $e107, $emessage, $frm, $pref;
$text = "<form method='post' action='".e_SELF."?".e_QUERY."'>
<fieldset id='core-cpage-list'>
<legend class='e-hideme'>".CUSLAN_5."</legend>
<table cellpadding='0' cellspacing='0' class='adminlist'>".
$frm->colGroup($this->fields,$this->fieldpref).
$frm->thead($this->fields,$this->fieldpref).
"<tbody>";
if($mode=='menus')
{
$qry = "page_theme !='' ";
$caption = CUSLAN_50;
}
else
{
if(!getperms("5")){ return; }
$qry = "page_theme ='' ";
$caption = CUSLAN_5;
}
if(!$sql->db_Select("page", "*", $qry." ORDER BY page_datestamp DESC"))
{
$text .= "
<tr>
<td colspan='4' class='center middle'>
".CUSLAN_42."
</td>
</tr>
";
}
else
{
$pages = $sql->db_getList('ALL', FALSE, FALSE);
foreach($pages as $pge)
{
$title_text = $pge['page_title'] ? $pge['page_title'] : ($pge['page_theme'] ? CUSLAN_43.$pge['page_theme'] : CUSLAN_44);
$pge['page_title'] = "<a href='".($pge['page_theme'] ? e_ADMIN."menus.php" : e107::getUrl()->create('page/view', $pge, 'allow=page_id,page_sef'))."'>{$title_text}</a>";
$authorData = get_user_data($pge['page_author']);
$pge['page_author'] = varset($authorData['user_name'], '?');
$text .= $frm->renderTableRow($this->fields,$this->fieldpref,$pge,'page_id');
}
}
$text .= "
</tbody>
</table>
</fieldset>
</form>
";
$e107->ns->tablerender($caption, $emessage->render().$text);
}
*/
// DEPRECATED
function delete_page($del_id) function delete_page($del_id)
{ {
return;
global $sql, $e107cache, $admin_log, $e_event; global $sql, $e107cache, $admin_log, $e_event;
//if(!$sql->db_Select('page', '*', "page_id={$del_id}")) return; //if(!$sql->db_Select('page', '*', "page_id={$del_id}")) return;
//$row = $sql->db_Fetch(); //$row = $sql->db_Fetch();
@@ -707,51 +939,8 @@ class page
$this->message = $e_event->triggerHook($data); $this->message = $e_event->triggerHook($data);
} }
function optionsPage()
{
global $e107, $pref, $frm, $emessage;
$ns = e107::getRender();
if(!isset($pref['pageCookieExpire'])) $pref['pageCookieExpire'] = 84600;
//XXX Lan - Options
$text = "
<form method='post' action='".e_SELF."?".e_QUERY."'>
<fieldset id='core-cpage-options'>
<legend class='e-hideme'>".LAN_OPTIONS."</legend>
<table cellpadding='0' cellspacing='0' class='adminform'>
<colgroup span='2'>
<col class='col-label' />
<col class='col-control' />
</colgroup>
<tbody>
<tr>
<td class='label'>".CUSLAN_29."</td>
<td class='control'>
".$frm->radio_switch('listPages', $pref['listPages'])."
</td>
</tr>
<tr>
<td class='label'>".CUSLAN_30."</td>
<td class='control'>
".$frm->text('pageCookieExpire', $pref['pageCookieExpire'], 10)."
</td>
</tr>
</tbody>
</table>
<div class='buttons-bar center'>
".$frm->admin_button('saveOptions', CUSLAN_40, 'submit')."
</div>
</fieldset>
</form>
";
$ns->tablerender(LAN_OPTIONS, $emessage->render().$text);
}
/*
function saveSettings() function saveSettings()
{ {
global $pref, $admin_log, $emessage; global $pref, $admin_log, $emessage;
@@ -803,8 +992,10 @@ class page
e_admin_menu(CUSLAN_33, $action, $var); e_admin_menu(CUSLAN_33, $action, $var);
} }
*/
} }
function cpage_adminmenu() function cpage_adminmenu()
{ {
global $page; global $page;
@@ -819,6 +1010,7 @@ function cpage_adminmenu()
*/ */
function headerjs() function headerjs()
{ {
return;
require_once(e_HANDLER.'js_helper.php'); require_once(e_HANDLER.'js_helper.php');
$ret = " $ret = "
<script type='text/javascript'> <script type='text/javascript'>

View File

@@ -266,14 +266,23 @@ class admin_newspost
$this->fields = array( $this->fields = array(
'checkboxes' => array('title' => '', 'type' => null, 'width' => '3%', 'thclass' => 'center first', 'class' => 'center', 'nosort' => true, 'toggle' => 'news_selected', 'forced' => TRUE), 'checkboxes' => array('title' => '', 'type' => null, 'width' => '3%', 'thclass' => 'center first', 'class' => 'center', 'nosort' => true, 'toggle' => 'news_selected', 'forced' => TRUE),
'news_id' => array('title' => LAN_NEWS_45, 'type' => 'number', 'width' => '5%', 'thclass' => 'center', 'class' => 'center', 'nosort' => false), 'news_id' => array('title' => LAN_NEWS_45, 'type' => 'number', 'width' => '5%', 'thclass' => 'center', 'class' => 'center', 'nosort' => false),
'news_thumbnail' => array('title' => NWSLAN_67, 'type' => 'image', 'width' => '110px', 'thclass' => 'center', 'class' => "center", 'nosort' => false, 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','writeParams' => 'path={e_MEDIA}','readonly'=>false),
'news_title' => array('title' => NWSLAN_40, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false), 'news_title' => array('title' => NWSLAN_40, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
'news_summary' => array('title' => LAN_NEWS_27, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
'news_meta_keywords' => array('title' => LAN_KEYWORDS, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
'news_meta_description' => array('title' => LAN_DESCRIPTION,'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
'news_sef' => array('title' => 'SEF URL', 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false), 'news_sef' => array('title' => 'SEF URL', 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
'user_name' => array('title' => LAN_NEWS_50, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false), 'user_name' => array('title' => LAN_NEWS_50, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
'news_datestamp' => array('title' => LAN_NEWS_32, 'type' => 'datestamp', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'parms' => 'mask=%A %d %B %Y'), 'news_datestamp' => array('title' => LAN_NEWS_32, 'type' => 'datestamp', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'parms' => 'mask=%A %d %B %Y'),
'category_name' => array('title' => NWSLAN_6, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false), 'category_name' => array('title' => NWSLAN_6, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
'news_start' => array('title' => "Start", 'type' => 'datestamp', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'parms' => 'mask=%A %d %B %Y'),
'news_end' => array('title' => "End", 'type' => 'datestamp', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'parms' => 'mask=%A %d %B %Y'),
'news_class' => array('title' => NWSLAN_22, 'type' => 'userclass', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false), 'news_class' => array('title' => NWSLAN_22, 'type' => 'userclass', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
'news_render_type' => array('title' => LAN_NEWS_49, 'type' => 'number', 'width' => 'auto', 'thclass' => 'center', 'class' => null, 'nosort' => false), 'news_render_type' => array('title' => LAN_NEWS_49, 'type' => 'number', 'width' => 'auto', 'thclass' => 'center', 'class' => null, 'nosort' => false),
'news_thumbnail' => array('title' => LAN_NEWS_22, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
'news_sticky' => array('title' => LAN_NEWS_28, 'type' => 'boolean', 'width' => 'auto', 'thclass' => 'center', 'class' => 'center', 'nosort' => false), 'news_sticky' => array('title' => LAN_NEWS_28, 'type' => 'boolean', 'width' => 'auto', 'thclass' => 'center', 'class' => 'center', 'nosort' => false),
'news_allow_comments' => array('title' => NWSLAN_15, 'type' => 'boolean', 'width' => 'auto', 'thclass' => 'center', 'class' => 'center', 'nosort' => false), 'news_allow_comments' => array('title' => NWSLAN_15, 'type' => 'boolean', 'width' => 'auto', 'thclass' => 'center', 'class' => 'center', 'nosort' => false),
'news_comment_total' => array('title' => LAN_NEWS_60, 'type' => 'number', 'width' => '10%', 'thclass' => '', 'class' => null, 'nosort' => false), 'news_comment_total' => array('title' => LAN_NEWS_60, 'type' => 'number', 'width' => '10%', 'thclass' => '', 'class' => null, 'nosort' => false),
@@ -281,6 +290,7 @@ class admin_newspost
); );
/* $ren_type = array(NWSLAN_75,NWSLAN_76,NWSLAN_77,NWSLAN_77." 2"); /* $ren_type = array(NWSLAN_75,NWSLAN_76,NWSLAN_77,NWSLAN_77." 2");
$r_array = array(); $r_array = array();
foreach($ren_type as $key=>$value) foreach($ren_type as $key=>$value)
@@ -1089,7 +1099,6 @@ class admin_newspost
// PREPARE SOME DATA // PREPARE SOME DATA
// safe to pass $row as it contains username and id only (no sensitive data), user_id and user_name will be internal converted to 'id', 'name' vars // safe to pass $row as it contains username and id only (no sensitive data), user_id and user_name will be internal converted to 'id', 'name' vars
$row['user_name'] = "<a href='".e107::getUrl()->create('user/profile/view', $row)."' title='{$row['user_name']}'>{$row['user_name']}</a>"; $row['user_name'] = "<a href='".e107::getUrl()->create('user/profile/view', $row)."' title='{$row['user_name']}'>{$row['user_name']}</a>";
$row['news_thumbnail'] = ($row['news_thumbnail'] && is_readable(e_NEWSIMAGE.$row['news_thumbnail'])) ? "<a href='".e_NEWSIMAGE_ABS.$row['news_thumbnail']."' title='{$row['news_thumbnail']}' rel='external' class='e-image-preview'>".e107::getParser()->text_truncate($row['news_thumbnail'], 20, '...')."</a>" : "";
$row['news_title'] = "<a href='".e107::getUrl()->create('news/view/item', $row)."'>".$e107->tp->toHTML($row['news_title'], false, 'TITLE')."</a>"; $row['news_title'] = "<a href='".e107::getUrl()->create('news/view/item', $row)."'>".$e107->tp->toHTML($row['news_title'], false, 'TITLE')."</a>";
$row['category_name'] = "<a href='".e107::getUrl()->create('news/list/items', $row)."'>".$row['category_name']."</a>"; $row['category_name'] = "<a href='".e107::getUrl()->create('news/list/items', $row)."'>".$row['category_name']."</a>";
$row['news_render_type'] = $ren_type[$row['news_render_type']]; $row['news_render_type'] = $ren_type[$row['news_render_type']];
@@ -1101,6 +1110,8 @@ class admin_newspost
"; ";
$row['checkboxes'] = $row['news_id']; $row['checkboxes'] = $row['news_id'];
// AUTO RENDER // AUTO RENDER
$text .= $frm->renderTableRow($this->fields, $this->fieldpref, $row, 'news_id'); $text .= $frm->renderTableRow($this->fields, $this->fieldpref, $row, 'news_id');
} }

View File

@@ -1,8 +0,0 @@
//<?php
/*
* This bbcode has been removed for increased security within e107.
* If you know PHP, it is recommended that instead of using a php bbcode, you write your own bbcode, shortcode or .php script.
* For more details, please see the documentation (wiki) at www.e107.org
*
*/
return "No Longer Supported";

View File

@@ -3276,7 +3276,8 @@ class e_admin_controller_ui extends e_admin_controller
if(count($searchQry) > 0) if(count($searchQry) > 0)
{ {
// add more where details on the fly via $this->listQrySql['db_where']; // add more where details on the fly via $this->listQrySql['db_where'];
$qry .= " WHERE ".implode(" AND ", $searchQry); $qry .= (strripos($qry, 'where')==FALSE) ? " WHERE " : " AND "; // Allow 'where' in custom listqry
$qry .= implode(" AND ", $searchQry);
} }
// GROUP BY if needed // GROUP BY if needed
@@ -4411,6 +4412,8 @@ class e_admin_form_ui extends e_form
$fields = $this->getController()->getFields(); $fields = $this->getController()->getFields();
if(!varset($fields['checkboxes'])) if(!varset($fields['checkboxes']))
{ {
$mes = e107::getMessage();
$mes->add("Cannot display Batch drop-down as 'checkboxes' was not found in \$fields array.", E_MESSAGE_DEBUG);
return ''; return '';
} }
// TODO - core ui-batch-option class!!! REMOVE INLINE STYLE! // TODO - core ui-batch-option class!!! REMOVE INLINE STYLE!

View File

@@ -321,6 +321,8 @@ define("LAN_FILE", "File");
define("LAN_EXECUTE","Execute"); define("LAN_EXECUTE","Execute");
define("LAN_SEFURL","SEF URL"); define("LAN_SEFURL","SEF URL");
define("LAN_COPY","Copy"); define("LAN_COPY","Copy");
define("LAN_KEYWORDS","Keywords");
define("LAN_SECURITYL_0", "Looking for trouble (none)"); define("LAN_SECURITYL_0", "Looking for trouble (none)");