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

Newspost administration - work in progress (BROKEN, almost there);

overall admin related improvements
This commit is contained in:
secretr
2009-01-15 15:42:24 +00:00
parent e804cd28e9
commit 575ba728ee
14 changed files with 529 additions and 384 deletions

View File

@@ -9,20 +9,28 @@
* News Administration * News Administration
* *
* $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $ * $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $
* $Revision: 1.20 $ * $Revision: 1.21 $
* $Date: 2009-01-13 17:09:30 $ * $Date: 2009-01-15 15:42:24 $
* $Author: secretr $ * $Author: secretr $
*/ */
require_once("../class2.php"); require_once("../class2.php");
if (!getperms("H")) if (!getperms("H"))
{ {
header("location:".e_BASE."index.php"); header("Location:".e_BASE."index.php");
exit; exit;
} }
$newspost = new admin_newspost(e_QUERY); // -------- Presets. ------------ // always load before auth.php
require_once(e_HANDLER."preset_class.php");
$pst = new e_preset();
$pst->form = "core-newspost-create-form"; // form id of the form that will have it's values saved.
$pst->page = "newspost.php?create"; // display preset options on which page(s).
$pst->id = "admin_newspost";
// ------------------------------
$newspost = new admin_newspost(e_QUERY, $pst);
function headerjs() function headerjs()
{ {
global $newspost; global $newspost;
@@ -49,148 +57,30 @@ function headerjs()
$e_sub_cat = 'news'; $e_sub_cat = 'news';
$e_wysiwyg = "data,news_extended"; $e_wysiwyg = "data,news_extended";
// -------- Presets. ------------ // always load before auth.php
require_once(e_HANDLER."preset_class.php");
$pst = new e_preset;
$pst->form = "dataform"; // form id of the form that will have it's values saved.
$pst->page = "newspost.php?create"; // display preset options on which page(s).
$pst->id = "admin_newspost";
// ------------------------------
require_once("auth.php"); require_once("auth.php");
$pst->save_preset('news_datestamp'); // save and render result using unique name. Don't save item datestamp
require_once(e_HANDLER."userclass_class.php");
require_once(e_HANDLER."ren_help.php");
require_once(e_HANDLER."form_handler.php");
require_once(e_HANDLER."file_class.php");
require_once (e_HANDLER."message_handler.php"); require_once (e_HANDLER."message_handler.php");
$fl = new e_file;
$rs = new form();
$frm = new e_form(true); //enable inner tabindex counter
$emessage = &eMessage::getInstance();
if (e_QUERY)
{
$tmp = explode(".", e_QUERY);
$action = $tmp[0];
$sub_action = varset($tmp[1],'');
$id = intval(varset($tmp[2],0));
$sort_order = varset($tmp[2],'desc');
$from = intval(varset($tmp[3],0));
unset($tmp);
}
$from = ($from ? $from : 0);
// ##### Main loop -----------------------------------------------------------------------------------------------------------------------
if(isset($_POST['news_userclass']))
{
unset($temp);
foreach ($_POST['news_userclass'] as $k => $v)
{
$temp[] = intval($k);
}
$_POST['news_class'] = implode(",", $temp);
unset($temp);
unset($_POST['news_userclass']);
}
/* /*
* Observe for delete action * Observe for delete action
*/ */
$newspost->observer(); $newspost->observer();
/*
* Show requested page
*/
$newspost->show_page();
// required. /* OLD JS? Can't find references to this func
if (isset($_POST['preview']))
{
$_POST['news_title'] = $tp->toDB($_POST['news_title']);
$_POST['news_summary'] = $tp->toDB($_POST['news_summary']);
$newspost->preview_item($id);
}
if (!e_QUERY || $action == "main")
{
$newspost->show_existing_items();
}
if ($action == "create")
{
$preset = $pst->read_preset("admin_newspost"); //only works here because $_POST is used.
if ($sub_action == "edit" && !$_POST['preview'] && !$_POST['submit_news'])
{
if ($sql->db_Select("news", "*", "news_id='{$id}' "))
{
$row = $sql->db_Fetch();
extract($row);
$_POST['news_title'] = $news_title;
$_POST['data'] = $news_body;
$_POST['news_author'] = $row['news_author'];
$_POST['news_extended'] = $news_extended;
$_POST['news_allow_comments'] = $news_allow_comments;
$_POST['news_class'] = $news_class;
$_POST['news_summary'] = $news_summary;
$_POST['news_sticky'] = $news_sticky;
$_POST['news_datestamp'] = ($_POST['news_datestamp']) ? $_POST['news_datestamp'] : $news_datestamp;
$_POST['cat_id'] = $news_category;
$_POST['news_start'] = $news_start;
$_POST['news_end'] = $news_end;
$_POST['comment_total'] = $sql->db_Count("comments", "(*)", " WHERE comment_item_id='$news_id' AND comment_type='0' ");
$_POST['news_rendertype'] = $news_render_type;
$_POST['news_thumbnail'] = $news_thumbnail;
}
}
$newspost->create_item($sub_action, $id);
}
if ($action == "cat")
{
$newspost->show_categories($sub_action, $id);
}
if ($action == "sn")
{
$newspost->submitted_news($sub_action, $id);
}
if ($action == "pref")
{
$newspost->show_news_prefs($sub_action, $id);
}
echo " echo "
<script type=\"text/javascript\"> <script type=\"text/javascript\">
function fclear() { function fclear() {
document.getElementById('dataform').data.value = \"\"; document.getElementById('core-newspost-create-form').data.value = \"\";
document.getElementById('dataform').news_extended.value = \"\"; document.getElementById('core-newspost-create-form').news_extended.value = \"\";
} }
</script>\n"; </script>\n";
*/
require_once("footer.php"); require_once("footer.php");
exit; exit;
@@ -203,16 +93,17 @@ class admin_newspost
{ {
var $_request = array(); var $_request = array();
var $_cal = array(); var $_cal = array();
var $_frm = array(); var $_pst;
function admin_newspost($qry) function admin_newspost($qry, $pstobj)
{ {
$this->parseRequest($qry); $this->parseRequest($qry);
require_once(e_HANDLER."calendar/calendar_class.php"); require_once(e_HANDLER."calendar/calendar_class.php");
$this->_cal = new DHTML_Calendar(true); $this->_cal = new DHTML_Calendar(true);
$this->_pst = &$pstobj;
} }
function parseRequest($qry) function parseRequest($qry)
@@ -263,6 +154,13 @@ class admin_newspost
function observer() function observer()
{ {
//Required on create & savepreset action triggers
if(isset($_POST['news_userclass']) && is_array($_POST['news_userclass']))
{
$_POST['news_class'] = implode(",", array_keys($_POST['news_userclass']));
unset($_POST['news_userclass']);
}
if(isset($_POST['delete']) && is_array($_POST['delete'])) if(isset($_POST['delete']) && is_array($_POST['delete']))
{ {
$this->_observe_delete(); $this->_observe_delete();
@@ -289,6 +187,39 @@ class admin_newspost
} }
} }
function show_page()
{
switch ($this->getAction()) {
case 'savepreset':
case 'clr_preset':
$this->_pst->save_preset('news_datestamp', false); // save and render result using unique name. Don't save item datestamp
$_POST = array();
$this->parseRequest('');
$this->show_existing_items();
break;
case 'create':
$this->_pst->read_preset('admin_newspost'); //only works here because $_POST is used.
$this->show_create_item();
break;
case 'cat':
$this->show_categories();
break;
case 'sn':
$this->show_submitted_news();
break;
case 'pref':
$this->show_news_prefs();
break;
default:
$this->show_existing_items();
break;
}
}
function _observe_delete() function _observe_delete()
{ {
global $admin_log; global $admin_log;
@@ -313,7 +244,7 @@ class admin_newspost
$this->clear_cache(); $this->clear_cache();
$data = array('method'=>'delete', 'table'=>'news', 'id'=>$del_id, 'plugin'=>'news', 'function'=>'delete'); $data = array('method'=>'delete', 'table'=>'news', 'id'=>$del_id, 'plugin'=>'news', 'function'=>'delete');
$this->show_message($e107->e_event->triggerHook($data), E_MESSAGE_ERROR); $this->show_message($e107->e_event->triggerHook($data), E_MESSAGE_WARNING);
admin_purge_related("news", $del_id); admin_purge_related("news", $del_id);
} }
@@ -404,11 +335,17 @@ class admin_newspost
$_POST['cat_id'] = 1; $_POST['cat_id'] = 1;
} }
list($_POST['news_author'], $empty) = explode(chr(35), $_POST['news_author']); $tmp = explode(chr(35), $_POST['news_author']);
$_POST['news_author'] = $tmp[0];
$this->show_message($ix->submit_item($_POST)); //$this->show_message($ix->submit_item($_POST), E_MESSAGE_SUCCESS, true);
unset($_POST['news_title'], $_POST['cat_id'], $_POST['data'], $_POST['news_extended'], $_POST['news_allow_comments'], $_POST['startday'], $_POST['startmonth'], $_POST['startyear'], $_POST['endday'], $_POST['endmonth'], $_POST['endyear'], $_POST['news_id'], $_POST['news_class']); //unset($_POST['news_title'], $_POST['cat_id'], $_POST['data'], $_POST['news_extended'], $_POST['news_allow_comments'], $_POST['startday'], $_POST['startmonth'], $_POST['startyear'], $_POST['endday'], $_POST['endmonth'], $_POST['endyear'], $_POST['news_id'], $_POST['news_class']);
$this->clear_cache(); $ix->submit_item($_POST, true);
$this->clear_cache();
session_write_close();
header('Location:'.e_SELF);
exit;
} }
function _observe_create_category() function _observe_create_category()
@@ -595,7 +532,7 @@ class admin_newspost
} }
else else
{ {
$text .= "<div style='text-align:center'>".NWSLAN_43."</div>"; $text .= "<div class='center'>".NWSLAN_43."</div>";
} }
$newsposts = $e107->sql->db_Count('news'); $newsposts = $e107->sql->db_Count('news');
@@ -621,15 +558,53 @@ class admin_newspost
} }
function _pre_create()
{
if($this->getSubAction() == "edit" && !$_POST['preview'] && !$_POST['submit_news'])
{
$e107 = &e107::getInstance();
if($e107->sql->db_Select("news", "*", "news_id='".$this->getId()."'"))
{
$row = $e107->sql->db_Fetch();
function create_item($sub_action, $id) $_POST['news_title'] = $row['news_title'];
$_POST['data'] = $row['news_body'];
$_POST['news_author'] = $row['news_author'];
$_POST['news_extended'] = $row['news_extended'];
$_POST['news_allow_comments'] = $row['news_allow_comments'];
$_POST['news_class'] = $row['news_class'];
$_POST['news_summary'] = $row['news_summary'];
$_POST['news_sticky'] = $row['news_sticky'];
$_POST['news_datestamp'] = ($_POST['news_datestamp']) ? $_POST['news_datestamp'] : $row['news_datestamp'];
$_POST['cat_id'] = $row['news_category'];
$_POST['news_start'] = $row['news_start'];
$_POST['news_end'] = $row['news_end'];
$_POST['comment_total'] = $e107->sql->db_Count("comments", "(*)", " WHERE comment_item_id={$row['news_id']} AND comment_type='0'");
$_POST['news_rendertype'] = $row['news_render_type'];
$_POST['news_thumbnail'] = $row['news_thumbnail'];
}
}
}
function show_create_item()
{ {
global $pref; global $pref;
// ##### Display creation form
$this->_pre_create();
require_once(e_HANDLER."userclass_class.php");
require_once(e_HANDLER."form_handler.php"); require_once(e_HANDLER."form_handler.php");
$frm = new e_form(true); //enable inner tabindex counter $frm = new e_form(true); //enable inner tabindex counter
$text = '';
if (isset($_POST['preview']))
{
$text = $this->preview_item($this->getId());
}
$sub_action = $this->getSubAction(); $sub_action = $this->getSubAction();
$id = $this->getId(); $id = $this->getId();
@@ -645,7 +620,7 @@ class admin_newspost
$_POST['data'] = $row['submitnews_item']; $_POST['data'] = $row['submitnews_item'];
$_POST['cat_id'] = $row['submitnews_category']; $_POST['cat_id'] = $row['submitnews_category'];
if (e_WYSIWYG) if (defsettrue('e_WYSIWYG'))
{ {
if (substr($_POST['data'],-7,7) == '[/html]') $_POST['data'] = substr($_POST['data'],0,-7); if (substr($_POST['data'],-7,7) == '[/html]') $_POST['data'] = substr($_POST['data'],0,-7);
if (substr($_POST['data'],0,6) == '[html]') $_POST['data'] = substr($_POST['data'],6); if (substr($_POST['data'],0,6) == '[html]') $_POST['data'] = substr($_POST['data'],6);
@@ -675,9 +650,9 @@ class admin_newspost
} }
} }
$text = " $text .= "
<form method='post' action='".e_SELF."?".e_QUERY."' id='dataform' ".(FILE_UPLOADS ? "enctype='multipart/form-data'" : "")." > <form method='post' action='".e_SELF."?".e_QUERY."' id='core-newspost-create-form' ".(FILE_UPLOADS ? "enctype='multipart/form-data'" : "")." >
<fieldset id='core-newspost-edit'> <fieldset id='core-newspost-create'>
<legend>".LAN_NEWS_52."</legend> <legend>".LAN_NEWS_52."</legend>
<table cellpadding='0' cellspacing='0' class='adminedit'> <table cellpadding='0' cellspacing='0' class='adminedit'>
<colgroup span='2'> <colgroup span='2'>
@@ -803,8 +778,8 @@ class admin_newspost
<tr> <tr>
<td class='label'>".NWSLAN_14.":</td> <td class='label'>".NWSLAN_14.":</td>
<td class='control'> <td class='control'>
<a href='#news_extended' class='e-expandit' onclick=\"$ff_expand\">".NWSLAN_83."</a> <a href='#news-extended-cont' class='e-expandit' onclick=\"$ff_expand\">".NWSLAN_83."</a>
<div class='e-hideme'> <div class='e-hideme' id='news-extended-cont'>
".$frm->bbarea('news_extended', $val, 'extended', 'helpc')." ".$frm->bbarea('news_extended', $val, 'extended', 'helpc')."
</div> </div>
</td> </td>
@@ -812,8 +787,8 @@ class admin_newspost
<tr> <tr>
<td class='label'>".NWSLAN_66.":</td> <td class='label'>".NWSLAN_66.":</td>
<td class='control'> <td class='control'>
<a class='e-pointer' onclick='expandit(this);'>".NWSLAN_69."</a> <a href='#news-upload-cont' class='e-expandit'>".NWSLAN_69."</a>
<div class='e-hideme'> <div class='e-hideme' id='news-upload-cont'>
"; ";
if (!FILE_UPLOADS) if (!FILE_UPLOADS)
@@ -835,8 +810,11 @@ class admin_newspost
$up_value = array("resize", "image", "thumb", "file"); $up_value = array("resize", "image", "thumb", "file");
$text .= " $text .= "
<div id='up_container' > <div class='field-spacer'>
<span id='upline' class='nowrap'> ".$frm->admin_button('dupfield', LAN_NEWS_26, 'action', '', array('other' => 'onclick="duplicateHTML(\'upline\',\'up_container\');"'))."
</div>
<div id='up_container' class='field-spacer'>
<div id='upline' class='left nowrap'>
".$frm->file('file_userfile[]')." ".$frm->file('file_userfile[]')."
".$frm->select_open('uploadtype[]')." ".$frm->select_open('uploadtype[]')."
"; ";
@@ -847,15 +825,14 @@ class admin_newspost
//FIXME - upload shortcode, flexible enough to be used everywhere //FIXME - upload shortcode, flexible enough to be used everywhere
$text .= " $text .= "
</select> </select>
</span> </div>
</div>
<div class='field-spacer'>
<span class='smalltext'>".LAN_NEWS_25."</span>&nbsp;".$frm->text('resize_value', ($_POST['resize_value'] ? $_POST['resize_value'] : '100'), 4, 'size=3&class=tbox')."&nbsp;px
</div>
<div class='field-spacer'>
".$frm->admin_button('submitupload', NWSLAN_66, 'upload')."
</div> </div>
<table style='width:100%'>
<tr>
<td>".$frm->admin_button('dupfield', LAN_NEWS_26, 'action', '', array('other' => 'onclick="duplicateHTML(\'upline\',\'up_container\');"'))."</td>
<td><span class='smalltext'>".LAN_NEWS_25."</span>&nbsp;>".$frm->text('resize_value', ($_POST['resize_value'] ? $_POST['resize_value'] : '100'), 4, 'size=3&class=tbox')."&nbsp;px</td>
<td>".$frm->admin_button('submitupload', NWSLAN_66, 'upload')."</td>
</tr>
</table>
"; ";
} }
@@ -866,23 +843,25 @@ class admin_newspost
<tr> <tr>
<td class='label'>".NWSLAN_67.":</td> <td class='label'>".NWSLAN_67.":</td>
<td class='control'> <td class='control'>
<a class='e-pointer' onclick='expandit(this);'>".LAN_NEWS_23."</a> <a href='#news-images-cont' class='e-expandit'>".LAN_NEWS_23."</a>
<div class='e-hideme'> <div class='e-hideme' id='news-images-cont'>
"; ";
$parms = "name=news_thumbnail"; $parms = "name=news_thumbnail";
$parms .= "&path=".e_IMAGE."newspost_images/"; $parms .= "&path=".e_IMAGE."newspost_images/";
$parms .= "&default=".$_POST['news_thumbnail']; $parms .= "&filter=0";
$parms .= "&width=100px"; $parms .= "&fullpath=1";
$parms .= "&height=100px"; $parms .= "&default=".urlencode('{e_IMAGE}newspost_images/'.$_POST['news_thumbnail']);
$parms .= "&multiple=TRUE"; $parms .= "&multiple=FALSE";
$parms .= "&label=-- ".LAN_NEWS_48." --"; $parms .= "&label=-- ".LAN_NEWS_48." --";
$parms .= "&click_target=data"; $parms .= "&subdirs=0";
$parms .= "&click_prefix=[img][[e_IMAGE]]newspost_images/"; $parms .= "&tabindex=".$frm->getNext();
$parms .= "&click_postfix=[/img]"; //$parms .= "&click_target=data";
//$parms .= "&click_prefix=[img][[e_IMAGE]]newspost_images/";
//$parms .= "&click_postfix=[/img]";
$text .= "<div class='field-section'>".$e107->tp->parseTemplate("{IMAGESELECTOR={$parms}&scaction=select}")."</div>";
$text .= $e107->tp->parseTemplate("{IMAGESELECTOR={$parms}}"); $text .= "<div class='field-spacer'>".$e107->tp->parseTemplate("{IMAGESELECTOR={$parms}&scaction=preview}")."</div>";
$text .= " $text .= "
</div> </div>
@@ -896,7 +875,7 @@ class admin_newspost
//Begin Options block //Begin Options block
$text .= " $text .= "
<fieldset id='core-newspost-edit-options'> <fieldset id='core-newspost-edit-options'>
<legend>".LAN_OPTIONS."</legend> <legend>".LAN_NEWS_53."</legend>
<table cellpadding='0' cellspacing='0' class='adminedit'> <table cellpadding='0' cellspacing='0' class='adminedit'>
<colgroup span='2'> <colgroup span='2'>
<col class='col-label' /> <col class='col-label' />
@@ -906,17 +885,15 @@ class admin_newspost
<tr> <tr>
<td class='label'>".NWSLAN_15.":</td> <td class='label'>".NWSLAN_15.":</td>
<td class='control'> <td class='control'>
<a class='e-pointer' onclick='expandit(this);'>".NWSLAN_18."</a> ".$frm->radio_switch('news_allow_comments', $_POST['news_allow_comments'])."
<div class='e-hideme'> <div class='field-help'>
". ($_POST['news_allow_comments'] ? "<input name='news_allow_comments' type='radio' value='0' />".LAN_ENABLED."&nbsp;&nbsp;<input name='news_allow_comments' type='radio' value='1' checked='checked' />".LAN_DISABLED : "<input name='news_allow_comments' type='radio' value='0' checked='checked' />".LAN_ENABLED."&nbsp;&nbsp;<input name='news_allow_comments' type='radio' value='1' />".LAN_DISABLED)." ".NWSLAN_18."
</div> </div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class='label'>".NWSLAN_73.":</td> <td class='label'>".NWSLAN_73.":</td>
<td class='control'> <td class='control'>
<a class='e-pointer' onclick='expandit(this);'>".NWSLAN_74."</a>
<div class='e-hideme'>
"; ";
$ren_type = array(NWSLAN_75,NWSLAN_76,NWSLAN_77,NWSLAN_77." 2"); $ren_type = array(NWSLAN_75,NWSLAN_76,NWSLAN_77,NWSLAN_77." 2");
@@ -933,16 +910,16 @@ class admin_newspost
$text .= " $text .= "
".$frm->radio_multi('news_rendertype', $r_array, $_POST['news_rendertype'], true)." ".$frm->radio_multi('news_rendertype', $r_array, $_POST['news_rendertype'], true)."
</div> <div class='field-help'>
".NWSLAN_74."
</div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class='label'>".NWSLAN_19.":</td> <td class='label'>".NWSLAN_19.":</td>
<td class='control'> <td class='control'>
<a class='e-pointer' onclick='expandit(this);'>".NWSLAN_72."</a> <div class='field-spacer'>".NWSLAN_21.":</div>
<div class='e-hideme'> <div class='field-spacer'>
<div class='field-spacer'>".NWSLAN_21.":</div>
<div class='field-spacer'>
"; ";
$_startdate = ($_POST['news_start'] > 0) ? date("d/m/Y", $_POST['news_start']) : ""; $_startdate = ($_POST['news_start'] > 0) ? date("d/m/Y", $_POST['news_start']) : "";
@@ -955,6 +932,7 @@ class admin_newspost
$cal_attrib['size'] = "10"; $cal_attrib['size'] = "10";
$cal_attrib['name'] = "news_start"; $cal_attrib['name'] = "news_start";
$cal_attrib['value'] = $_startdate; $cal_attrib['value'] = $_startdate;
$cal_attrib['tabindex'] = $frm->getNext();
$text .= $this->_cal->make_input_field($cal_options, $cal_attrib); $text .= $this->_cal->make_input_field($cal_options, $cal_attrib);
$text .= " - "; $text .= " - ";
@@ -971,19 +949,20 @@ class admin_newspost
$cal_attrib['size'] = "10"; $cal_attrib['size'] = "10";
$cal_attrib['name'] = "news_end"; $cal_attrib['name'] = "news_end";
$cal_attrib['value'] = $_enddate; $cal_attrib['value'] = $_enddate;
$cal_attrib['tabindex'] = $frm->getNext();
$text .= $this->_cal->make_input_field($cal_options, $cal_attrib); $text .= $this->_cal->make_input_field($cal_options, $cal_attrib);
$text .= " $text .= "
</div> </div>
<div class='field-help'>
".NWSLAN_72."
</div> </div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class='label'>".LAN_NEWS_32.":</td> <td class='label'>".LAN_NEWS_32.":</td>
<td class='control'> <td class='control'>
<a class='e-pointer' onclick='expandit(this);'>".LAN_NEWS_33."</a> <div class='field-spacer'>
<div class='e-hideme'>
<div class='field-spacer'>
"; ";
$_update_datestamp = ($_POST['news_datestamp'] > 0 && !strpos($_POST['news_datestamp'],"/")) ? date("d/m/Y H:i:s", $_POST['news_datestamp']) : trim($_POST['news_datestamp']); $_update_datestamp = ($_POST['news_datestamp'] > 0 && !strpos($_POST['news_datestamp'],"/")) ? date("d/m/Y H:i:s", $_POST['news_datestamp']) : trim($_POST['news_datestamp']);
@@ -1000,10 +979,12 @@ class admin_newspost
$text .= $this->_cal->make_input_field($cal_options, $cal_attrib); $text .= $this->_cal->make_input_field($cal_options, $cal_attrib);
$text .= " $text .= "
</div> </div>
<div class='field-spacer'> <div class='field-spacer'>
".$frm->checkbox('update_datestamp', '1', $_POST['update_datestamp']).$frm->label(NWSLAN_105, 'update_datestamp', '1')." ".$frm->checkbox('update_datestamp', '1', $_POST['update_datestamp']).$frm->label(NWSLAN_105, 'update_datestamp', '1')."
</div> </div>
<div class='field-help'>
".LAN_NEWS_33."
</div> </div>
</td> </td>
</tr> </tr>
@@ -1018,19 +999,18 @@ class admin_newspost
<tr> <tr>
<td class='label'>".NWSLAN_22.":</td> <td class='label'>".NWSLAN_22.":</td>
<td class='control'> <td class='control'>
<a class='e-pointer' onclick='expandit(this);'>".NWSLAN_84."</a> ".r_userclass_check("news_userclass", $_POST['news_class'], "nobody,public,guest,member,admin,classes,language")."
<div class='e-hideme'> <div class='field-help'>
".r_userclass_check("news_userclass", $_POST['news_class'], "nobody,public,guest,member,admin,classes,language")." ".NWSLAN_84."
</div> </div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class='label'>".LAN_NEWS_28.":</td> <td class='label'>".LAN_NEWS_28.":</td>
<td class='control'> <td class='control'>
<a class='e-pointer' onclick='expandit(this);'>".LAN_NEWS_29."</a> ".$frm->checkbox('news_sticky', '1', $_POST['news_sticky']).$frm->label(LAN_NEWS_30, 'news_sticky', '1')."
<div class='e-hideme'> <div class='field-help'>
".$frm->checkbox('news_sticky', '1', $_POST['news_sticky']).$frm->label(LAN_NEWS_30, 'news_sticky', '1')." ".LAN_NEWS_29."
</div> </div>
</td> </td>
</tr> </tr>
@@ -1091,15 +1071,22 @@ class admin_newspost
"; ";
$emessage = &eMessage::getInstance();
$emessage = &eMessage::getInstance();
$e107->ns->tablerender(NWSLAN_29, $emessage->render().$text); $e107->ns->tablerender(NWSLAN_29, $emessage->render().$text);
} }
function preview_item($id) function preview_item($id)
{ {
// ##### Display news preview ---------------------------------------------------------------------------------------------------------
global $tp, $sql, $ix, $IMAGES_DIRECTORY; require_once(e_HANDLER."news_class.php");
$ix = new news;
$e107 = &e107::getInstance();
$_POST['news_title'] = $e107->tp->toDB($_POST['news_title']);
$_POST['news_summary'] = $e107->tp->toDB($_POST['news_summary']);
$_POST['news_id'] = $id; $_POST['news_id'] = $id;
@@ -1123,6 +1110,7 @@ class admin_newspost
$_POST['news_end'] = 0; $_POST['news_end'] = 0;
} }
$matches = array();
if(preg_match("#(.*?)/(.*?)/(.*?) (.*?):(.*?):(.*?)$#", $_POST['news_datestamp'], $matches)) if(preg_match("#(.*?)/(.*?)/(.*?) (.*?):(.*?):(.*?)$#", $_POST['news_datestamp'], $matches))
{ {
$_POST['news_datestamp'] = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]); $_POST['news_datestamp'] = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]);
@@ -1137,33 +1125,46 @@ class admin_newspost
$_POST['news_datestamp'] = time(); $_POST['news_datestamp'] = time();
} }
$sql->db_Select("news_category", "*", "category_id='".$_POST['cat_id']."' "); $e107->sql->db_Select("news_category", "*", "category_id='".intval($_POST['cat_id'])."'");
list($_POST['category_id'], $_POST['category_name'], $_POST['category_icon']) = $sql->db_Fetch(); list($_POST['category_id'], $_POST['category_name'], $_POST['category_icon']) = $e107->sql->db_Fetch();
// $_POST['user_id'] = USERID;
// $_POST['user_name'] = USERNAME."blabla"; list($_POST['user_id'],$_POST['user_name']) = explode(chr(35), $_POST['news_author']);
list($_POST['user_id'],$_POST['user_name']) = explode(chr(35),$_POST['news_author']);
$_POST['news_author'] = $_POST['user_id']; $_POST['news_author'] = $_POST['user_id'];
$_POST['comment_total'] = $comment_total; $_POST['comment_total'] = $this->getId() ? $e107->sql->db_Count("comments", "(*)", " WHERE comment_item_id=".$this->getId()." AND comment_type='0'") : 0;
$_PR = $_POST; $_PR = $_POST;
$_PR['news_body'] = $tp->post_toHTML($_PR['data'],FALSE); $_PR['news_body'] = $e107->tp->post_toHTML($_PR['data'],FALSE);
$_PR['news_title'] = $tp->post_toHTML($_PR['news_title'],FALSE,"emotes_off, no_make_clickable"); $_PR['news_title'] = $e107->tp->post_toHTML($_PR['news_title'],FALSE,"emotes_off, no_make_clickable");
$_PR['news_summary'] = $tp->post_toHTML($_PR['news_summary']); $_PR['news_summary'] = $e107->tp->post_toHTML($_PR['news_summary']);
$_PR['news_extended'] = $tp->post_toHTML($_PR['news_extended']); $_PR['news_extended'] = $e107->tp->post_toHTML($_PR['news_extended']);
$_PR['news_file'] = $_POST['news_file']; $_PR['news_file'] = $_POST['news_file'];
$_PR['news_image'] = $_POST['news_image']; $_PR['news_image'] = $_POST['news_image'];
$ix -> render_newsitem($_PR); //$ix->render_newsitem($_PR);
echo $tp -> parseTemplate('{NEWSINFO}', FALSE, $news_shortcodes);
return "
<fieldset id='core-newspost-preview'>
<legend>".NWSLAN_27."</legend>
<table cellpadding='0' cellspacing='0' class='admininfo'>
<tbody>
<tr>
<td class='label' colspan='2'>
".$e107->tp->parseTemplate('{NEWSINFO}').$ix->render_newsitem($_PR, 'return')."
</td>
</tr>
</tbody>
</table>
</fieldset>
";
} }
function show_message($message, $type = '') function show_message($message, $type = E_MESSAGE_INFO, $session = false)
{ {
// ##### Display comfort --------------------------------------------------------------------------------------------------------- // ##### Display comfort ---------------------------------------------------------------------------------------------------------
//global $ns; //global $ns;
//$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>"); //$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
$emessage = &eMessage::getInstance(); $emessage = &eMessage::getInstance();
$emessage->add($message, $type OR E_MESSAGE_INFO); $emessage->add($message, $type, $session);
} }
function show_categories($sub_action, $id) function show_categories($sub_action, $id)
@@ -1185,8 +1186,8 @@ class admin_newspost
} }
$text = " $text = "
<form method='post' action='".e_SELF."?cat' id='dataform'> <form method='post' action='".e_SELF."?cat' id='core-newspost-cat-create'>
<fieldset id='core-newspost-cat-edit'> <fieldset id='core-newspost-cat-create'>
<legend>".NWSLAN_56."</legend> <legend>".NWSLAN_56."</legend>
<table cellpadding='0' cellspacing='0' class='adminform'> <table cellpadding='0' cellspacing='0' class='adminform'>
<colgroup span='2'> <colgroup span='2'>
@@ -1312,7 +1313,7 @@ class admin_newspost
global $sql, $rs, $ns, $pref, $frm; global $sql, $rs, $ns, $pref, $frm;
$text = " $text = "
<form method='post' action='".e_SELF."?pref' id='dataform'> <form method='post' action='".e_SELF."?pref' id='core-newspost-settings-form'>
<fieldset id='core-newspost-settings'> <fieldset id='core-newspost-settings'>
<legend class='e-hideme'>".NWSLAN_90."</legend> <legend class='e-hideme'>".NWSLAN_90."</legend>
<table cellpadding='0' cellspacing='0' class='adminform'> <table cellpadding='0' cellspacing='0' class='adminform'>
@@ -1445,10 +1446,13 @@ class admin_newspost
//XXX Lan - many many lans //XXX Lan - many many lans
function submitted_news($sub_action, $id) function show_submitted_news()
{ {
global $rs, $ns, $tp, $frm, $e107; global $rs, $ns, $tp, $frm, $e107;
$sql2 = new db; $sql2 = new db;
$sub_action = $this->getSubAction();
$id = $this->getId();
if ($category_total = $sql2->db_Select("submitnews", "*", "submitnews_id !='' ORDER BY submitnews_id DESC")) if ($category_total = $sql2->db_Select("submitnews", "*", "submitnews_id !='' ORDER BY submitnews_id DESC"))
{ {
$text .= " $text .= "

View File

@@ -9,8 +9,8 @@
* Administration - Site Preferences * Administration - Site Preferences
* *
* $Source: /cvs_backup/e107_0.8/e107_admin/prefs.php,v $ * $Source: /cvs_backup/e107_0.8/e107_admin/prefs.php,v $
* $Revision: 1.25 $ * $Revision: 1.26 $
* $Date: 2009-01-09 17:25:50 $ * $Date: 2009-01-15 15:42:24 $
* $Author: secretr $ * $Author: secretr $
* *
*/ */
@@ -215,8 +215,8 @@ $parms .= "&label=-- No Image --";
$parms .= "&subdirs=1"; $parms .= "&subdirs=1";
$parms .= "&tabindex=".$frm->getNext(); $parms .= "&tabindex=".$frm->getNext();
$text .= $tp->parseTemplate("{IMAGESELECTOR={$parms}&scaction=select}"); $text .= "<div class='field-section'>".$tp->parseTemplate("{IMAGESELECTOR={$parms}&scaction=select}")."</div>";
$text .= "<div class='field-help'>".$tp->parseTemplate("{IMAGESELECTOR={$parms}&scaction=preview}")."</div>"; $text .= "<div class='field-spacer'>".$tp->parseTemplate("{IMAGESELECTOR={$parms}&scaction=preview}")."</div>";
$text .= " $text .= "
</td> </td>

View File

@@ -1,7 +1,7 @@
<?php <?php
/* /*
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt) * Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id: admin_shortcodes_class.php,v 1.2 2009-01-10 11:42:19 secretr Exp $ * $Id: admin_shortcodes_class.php,v 1.3 2009-01-15 15:42:24 secretr Exp $
* *
* Admin shortcode batch - class * Admin shortcode batch - class
*/ */
@@ -651,6 +651,7 @@ class admin_shortcodes
if(ADMIN && getperms('0')) if(ADMIN && getperms('0'))
{ {
global $sql,$pst,$ns,$tp,$e_wysiwyg,$pref; global $sql,$pst,$ns,$tp,$e_wysiwyg,$pref;
if(isset($pst) && $pst->form && $pst->page) if(isset($pst) && $pst->form && $pst->page)
{ {
$thispage = urlencode(e_SELF.'?'.e_QUERY); $thispage = urlencode(e_SELF.'?'.e_QUERY);
@@ -919,7 +920,7 @@ class admin_shortcodes
{ {
/* /*
* e107 website system (c) 2001-2008 Steve Dunstan (e107.org) * e107 website system (c) 2001-2008 Steve Dunstan (e107.org)
* $Id: admin_shortcodes_class.php,v 1.2 2009-01-10 11:42:19 secretr Exp $ * $Id: admin_shortcodes_class.php,v 1.3 2009-01-15 15:42:24 secretr Exp $
*/ */
if (ADMIN) if (ADMIN)

View File

@@ -1,7 +1,7 @@
<?php <?php
/* /*
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt) * Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id: news_shortcodes.php,v 1.16 2009-01-07 21:21:12 mcfly_e107 Exp $ * $Id: news_shortcodes.php,v 1.17 2009-01-15 15:42:24 secretr Exp $
* *
* News shortcode batch * News shortcode batch
*/ */
@@ -342,7 +342,8 @@ class news_shortcodes
$info .= '<br />'.($news_item['news_allow_comments'] ? LAN_NEWS_13 : LAN_NEWS_12); $info .= '<br />'.($news_item['news_allow_comments'] ? LAN_NEWS_13 : LAN_NEWS_12);
$info .= LAN_NEWS_14.$news_item['news_start'].$news_item['news_end'].'<br />'; $info .= LAN_NEWS_14.$news_item['news_start'].$news_item['news_end'].'<br />';
$info .= LAN_NEWS_15.strlen($news_item['news_body']).LAN_NEWS_16.strlen($news_item['news_extended']).LAN_NEWS_17."<br /><br />"; $info .= LAN_NEWS_15.strlen($news_item['news_body']).LAN_NEWS_16.strlen($news_item['news_extended']).LAN_NEWS_17."<br /><br />";
return $this->e107->ns->tablerender(LAN_NEWS_18, $info); //return $this->e107->ns->tablerender(LAN_NEWS_18, $info);
return $info;
} }

View File

@@ -9,8 +9,8 @@
* Form Handler * Form Handler
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $
* $Revision: 1.14 $ * $Revision: 1.15 $
* $Date: 2009-01-07 15:40:06 $ * $Date: 2009-01-15 15:42:24 $
* $Author: secretr $ * $Author: secretr $
* *
*/ */
@@ -80,7 +80,7 @@ class e_form
function file($name, $options = array()) function file($name, $options = array())
{ {
$options = $this->format_options('text', $name, $options); $options = $this->format_options('file', $name, $options);
//never allow id in format name-value for text fields //never allow id in format name-value for text fields
return "<input type='file' name='{$name}'".$this->get_attributes($options, $name)." />"; return "<input type='file' name='{$name}'".$this->get_attributes($options, $name)." />";
} }
@@ -151,7 +151,7 @@ class e_form
} }
function radio_multi($name, $elements, $checked) function radio_multi($name, $elements, $checked, $multi_line = false)
{ {
$text = array(); $text = array();
if(is_string($elements)) parse_str($elements, $elements); if(is_string($elements)) parse_str($elements, $elements);
@@ -160,8 +160,10 @@ class e_form
{ {
$text[] = $this->radio($name, $value, $checked == $value)."".$this->label($label, $name, $value); $text[] = $this->radio($name, $value, $checked == $value)."".$this->label($label, $name, $value);
} }
if(!$multi_line)
return implode("&nbsp;&nbsp;", $text);
return implode("&nbsp;&nbsp;\n", $text); return "<div class='field-spacer'>".implode("</div><div class='field-spacer'>", $text)."</div>";
} }
@@ -393,6 +395,11 @@ class e_form
unset($def_options['selected'], $def_options['checked']); unset($def_options['selected'], $def_options['checked']);
break; break;
case 'file':
$def_options['class'] = 'tbox file';
unset($def_options['selected'], $def_options['checked']);
break;
case 'textarea': case 'textarea':
$def_options['class'] = 'tbox textarea'; $def_options['class'] = 'tbox textarea';
unset($def_options['selected'], $def_options['checked'], $def_options['size']); unset($def_options['selected'], $def_options['checked'], $def_options['size']);

View File

@@ -9,20 +9,22 @@
* News handler * News handler
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/news_class.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/news_class.php,v $
* $Revision: 1.9 $ * $Revision: 1.10 $
* $Date: 2009-01-07 19:57:09 $ * $Date: 2009-01-15 15:42:24 $
* $Author: mcfly_e107 $ * $Author: secretr $
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
class news { class news {
function submit_item($news) function submit_item($news, $smessages = false)
{ {
global $sql, $tp, $e107cache, $e_event, $pref, $admin_log; global $sql, $tp, $e107cache, $e_event, $pref, $admin_log;
if (!is_object($tp)) $tp = new e_parse; if (!is_object($tp)) $tp = new e_parse;
if (!is_object($sql)) $sql = new db; if (!is_object($sql)) $sql = new db;
require_once (e_HANDLER."message_handler.php");
$emessage = &eMessage::getInstance();
$news['news_title'] = $tp->toDB($news['news_title']); $news['news_title'] = $tp->toDB($news['news_title']);
$news['news_body'] = $tp->toDB($news['data']); $news['news_body'] = $tp->toDB($news['data']);
@@ -41,14 +43,22 @@ class news {
$admin_log->logArrayAll('NEWS_09', $news); $admin_log->logArrayAll('NEWS_09', $news);
$e_event -> trigger('newsupd', $news); $e_event -> trigger('newsupd', $news);
$message = LAN_NEWS_21; $message = LAN_NEWS_21;
$emessage->add(LAN_NEWS_21, E_MESSAGE_SUCCESS, $smessages);
$e107cache -> clear('news.php'); $e107cache -> clear('news.php');
} }
else else
{ {
$message = "<strong>".(!mysql_errno() ? LAN_NEWS_46 : LAN_NEWS_5)."</strong>"; $message = "<strong>".(!mysql_errno() ? LAN_NEWS_46 : LAN_NEWS_5)."</strong>";
if(mysql_errno())
$emessage->add(LAN_NEWS_5, E_MESSAGE_ERROR, $smessages);
else
$emessage->add(LAN_NEWS_46, E_MESSAGE_INFO, $smessages);
} }
$data = array('method'=>'update', 'table'=>'news', 'id'=>$news['news_id'], 'plugin'=>'news', 'function'=>'submit_item'); $data = array('method'=>'update', 'table'=>'news', 'id'=>$news['news_id'], 'plugin'=>'news', 'function'=>'submit_item');
$message .= $e_event->triggerHook($data); //$message .= $e_event->triggerHook($data);
$emessage->add($e_event->triggerHook($data), E_MESSAGE_INFO, $smessages);
} }
else else
{ // Adding item { // Adding item
@@ -57,14 +67,17 @@ class news {
$admin_log->logArrayAll('NEWS_08', $news); $admin_log->logArrayAll('NEWS_08', $news);
$e_event -> trigger('newspost', $news); $e_event -> trigger('newspost', $news);
$message = LAN_NEWS_6; $message = LAN_NEWS_6;
$emessage->add(LAN_NEWS_6, E_MESSAGE_SUCCESS, $smessages);
$e107cache -> clear('news.php'); $e107cache -> clear('news.php');
$id = mysql_insert_id(); $id = mysql_insert_id();
$data = array('method'=>'create', 'table'=>'news', 'id'=>$id, 'plugin'=>'news', 'function'=>'submit_item'); $data = array('method'=>'create', 'table'=>'news', 'id'=>$id, 'plugin'=>'news', 'function'=>'submit_item');
$message .= $e_event->triggerHook($data); //$message .= $e_event->triggerHook($data);
$emessage->add($e_event->triggerHook($data), E_MESSAGE_INFO, $smessages);
} }
else else
{ {
$message = "<strong>".LAN_NEWS_7."</strong>"; $message = "<strong>".LAN_NEWS_7."</strong>";
$emessage->add(LAN_NEWS_7, E_MESSAGE_ERROR, $smessages);
} }
} }
@@ -85,8 +98,10 @@ class news {
if(!$error = $trackback -> sendTrackback($permLink, $pingurl, $news['news_title'], $excerpt)) if(!$error = $trackback -> sendTrackback($permLink, $pingurl, $news['news_title'], $excerpt))
{ {
$message .= "<br />successfully pinged {$pingurl}."; $message .= "<br />successfully pinged {$pingurl}.";
$emessage->add("Successfully pinged {$pingurl}.", E_MESSAGE_SUCCESS, $smessages);
} else { } else {
$message .= "<br />was unable to ping {$pingurl}<br />[ Error message returned was : '{$error}'. ]"; $message .= "<br />was unable to ping {$pingurl}<br />[ Error message returned was : '{$error}'. ]";
$emessage->add("was unable to ping {$pingurl}<br />[ Error message returned was : '{$error}'. ]", E_MESSAGE_ERROR, $smessages);
} }
} }
} }
@@ -101,16 +116,19 @@ class news {
if ($trackback -> sendTrackback($permLink, $pingurl, $news['news_title'], $excerpt)) if ($trackback -> sendTrackback($permLink, $pingurl, $news['news_title'], $excerpt))
{ {
$message .= "<br />successfully pinged {$pingurl}."; $message .= "<br />successfully pinged {$pingurl}.";
$emessage->add("Successfully pinged {$pingurl}.", E_MESSAGE_SUCCESS, $smessages);
} }
else else
{ {
$message .= "Pingback to {$pingurl} failed ..."; $message .= "Pingback to {$pingurl} failed ...";
$emessage->add("Pingback to {$pingurl} failed ...", E_MESSAGE_ERROR, $smessages);
} }
} }
} }
else else
{ {
$message .= "<br />No pingback addresses were discovered"; $message .= "<br />No pingback addresses were discovered";
$emessage->add("No pingback addresses were discovered", E_MESSAGE_INFO, $smessages);
} }
} }
} }

View File

@@ -11,75 +11,128 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/preset_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/preset_class.php,v $
| $Revision: 1.2 $ | $Revision: 1.3 $
| $Date: 2007-02-07 21:22:09 $ | $Date: 2009-01-15 15:42:24 $
| $Author: e107steved $ | $Author: secretr $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
if (!defined('e107_INIT')) { exit; } if(!defined('e107_INIT'))
{
exit();
}
class e_preset { /**
* Form presets handler
*
* NEW in 0.8 - it wont output messages anymore,
* all pages should use eMessage:render() to catch up the
* preset message.
*
* TODO - multiple user defined presets per unique_id
*
*/
class e_preset
{
var $form; var $form;
var $page; var $page;
var $id; var $id;
function save_preset($exclude_fields = '') // Comma separated list of fields not to save /**
* Save preset
*
* @param string $exclude_fields Comma separated list of fields not to save
* @param bool $output output message or use message handler. NOTE - default value will be changed to false, update your code.
*/
function save_preset($exclude_fields = '', $output = true)
{ {
global $sql,$tp,$ns; global $sql, $ns, $tp;
$qry = explode(".",e_QUERY); $qry = explode(".", e_QUERY);
$unique_id = is_array($this->id) ? $this->id : array($this->id); $unique_id = is_array($this->id) ? $this->id : array($this->id);
$uid = $qry[1]; $uid = $qry[1];
if($_POST && $qry[0] =="savepreset") if($_POST && $qry[0] == "savepreset")
{
$exclude_array = explode(',',$exclude_fields);
foreach($_POST as $key => $value)
{
if (!in_array($key,$exclude_array))
{ {
$value = $tp->toDB($value); $exclude_array = explode(',', $exclude_fields);
if ($sql -> db_Update("preset", "preset_value='$value' WHERE preset_name ='".$unique_id[$uid]."' AND preset_field ='$key' "))
{
} foreach($_POST as $key => $value)
elseif ($value !="" && !$sql -> db_Select("preset","*","preset_name ='".$unique_id[$uid]."' AND preset_field ='$key' ")) { //TODO - array values disabled for now, handle them in the future
{ if(!in_array($key, $exclude_array) && !is_array($value))
$sql -> db_Insert("preset", "0, '".$unique_id[$uid]."', '$key', '$value' "); {
} $value = $tp->toDB($value);
if($sql->db_Update("preset", "preset_value='$value' WHERE preset_name ='".$unique_id[$uid]."' AND preset_field ='$key' "))
{
if($value == "") }
{ elseif($value != "" && !$sql->db_Select("preset", "*", "preset_name ='".$unique_id[$uid]."' AND preset_field ='$key' "))
$sql -> db_Delete("preset", "preset_field ='".$key."' "); {
} $sql->db_Insert("preset", "0, '".$unique_id[$uid]."', '$key', '$value' ");
} }
}
$ns -> tablerender(LAN_SAVED, LAN_PRESET_SAVED);
}
if ($_POST['delete_preset'] && e_QUERY=="clr_preset"){ if($value == "")
$del = $_POST['del_id']; {
$text = ($sql -> db_Delete("preset", "preset_name ='".$unique_id[$del]."' ")) ? LAN_DELETED : LAN_DELETED_FAILED; $sql->db_Delete("preset", "preset_field ='".$key."' ");
$ns -> tablerender($text, LAN_PRESET_DELETED); }
} }
}
} if(!$output)
{
// ------------------------------------------------------------------------ $ns->tablerender(LAN_SAVED, LAN_PRESET_SAVED);
return;
function read_preset($unique_id){ }
global $sql,$tp;
if (!$_POST){ require_once (e_HANDLER."message_handler.php");
if ($sql -> db_Select("preset", "*", "preset_name ='$unique_id' ")){ $emessage = &eMessage::getInstance();
while ($row = $sql-> db_Fetch()){ $emessage->add(LAN_PRESET_SAVED, E_MESSAGE_SUCCESS);
extract($row); }
$val[$preset_field] = $tp->toForm($preset_value);
$_POST[$preset_field] = $tp->toForm($preset_value); if($_POST['delete_preset'] && e_QUERY == "clr_preset")
{
$del = $_POST['del_id'];
$check = $sql->db_Delete("preset", "preset_name ='".$unique_id[$del]."' ");
if(!$output)
{
$ns->tablerender(LAN_SAVED, $check ? LAN_PRESET_DELETED : LAN_DELETED_FAILED);
return;
}
require_once (e_HANDLER."message_handler.php");
$emessage = &eMessage::getInstance();
if($check)
$emessage->add(LAN_PRESET_DELETED, E_MESSAGE_SUCCESS);
else
$emessage->add(LAN_DELETED_FAILED, E_MESSAGE_ERROR);
}
}
/**
* Read preset
*
* @param string $unique_id
* @return array values
*/
function read_preset($unique_id)
{
global $sql, $tp;
$val = array();
if(!$_POST)
{
if($sql->db_Select("preset", "*", "preset_name ='$unique_id' "))
{
while($row = $sql->db_Fetch())
{
$val[$row['preset_field']] = $tp->toForm($row['preset_value']);
$_POST[$row['preset_field']] = $tp->toForm($row['preset_value']);
} }
return $val;
} }
} }
return $val;
} }
// --------------------------------------------------- // ---------------------------------------------------

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/ren_help.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/ren_help.php,v $
| $Revision: 1.8 $ | $Revision: 1.9 $
| $Date: 2009-01-07 15:40:06 $ | $Date: 2009-01-15 15:42:24 $
| $Author: secretr $ | $Author: secretr $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -83,7 +83,7 @@ function display_help($tagid="helpb", $mode = 1, $addtextfunc = "addtext", $help
if(is_readable(e_FILE."shortcode/batch/bbcode_shortcodes.php")) if(is_readable(e_FILE."shortcode/batch/bbcode_shortcodes.php"))
{ {
require_once(e_FILE."shortcode/batch/bbcode_shortcodes.php"); require_once(e_FILE."shortcode/batch/bbcode_shortcodes.php");
return $tp->parseTemplate($BBCODE_TEMPLATE, FALSE, $bbcode_shortcodes); return $tp->parseTemplate($BBCODE_TEMPLATE);
} }
else else
{ {

View File

@@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/userclass_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/userclass_class.php,v $
| $Revision: 1.27 $ | $Revision: 1.28 $
| $Date: 2008-12-29 22:30:16 $ | $Date: 2009-01-15 15:42:24 $
| $Author: e107steved $ | $Author: secretr $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -57,18 +57,18 @@ class user_class
{ {
var $class_tree; // Simple array, filled with current tree. Additional field class_children is an array of child user classes (by ID) var $class_tree; // Simple array, filled with current tree. Additional field class_children is an array of child user classes (by ID)
var $class_parents; // Array of class IDs of 'parent' (i.e. top level) classes var $class_parents; // Array of class IDs of 'parent' (i.e. top level) classes
var $fixed_classes = array(); // The 'predefined' classes of 0.7 var $fixed_classes = array(); // The 'predefined' classes of 0.7
var $text_class_link = array(); // List of 'core' user classes and the related constants var $text_class_link = array(); // List of 'core' user classes and the related constants
var $sql_r; // We'll use our own DB to avoid interactions var $sql_r; // We'll use our own DB to avoid interactions
var $isAdmin; // Set true if we're an instance of user_class_admin var $isAdmin; // Set true if we're an instance of user_class_admin
// Constructor // Constructor
function user_class() function user_class()
{ {
global $imode; global $imode;
$this->sql_r = new db; $this->sql_r = new db;
$this->isAdmin = FALSE; $this->isAdmin = FALSE;
@@ -81,8 +81,8 @@ class user_class
e_UC_READONLY => UC_LAN_4, e_UC_READONLY => UC_LAN_4,
e_UC_NEWUSER => UC_LAN_9 e_UC_NEWUSER => UC_LAN_9
); );
$this->text_class_link = array('public' => e_UC_PUBLIC, 'guest' => e_UC_GUEST, 'nobody' => e_UC_NOBODY, 'member' => e_UC_MEMBER, $this->text_class_link = array('public' => e_UC_PUBLIC, 'guest' => e_UC_GUEST, 'nobody' => e_UC_NOBODY, 'member' => e_UC_MEMBER,
'admin' => e_UC_ADMIN, 'main' => e_UC_MAINADMIN, 'readonly' => e_UC_READONLY, 'new' => e_UC_NEWUSER); 'admin' => e_UC_ADMIN, 'main' => e_UC_MAINADMIN, 'readonly' => e_UC_READONLY, 'new' => e_UC_NEWUSER);
$this->readTree(TRUE); // Initialise the classes on entry $this->readTree(TRUE); // Initialise the classes on entry
@@ -90,13 +90,13 @@ class user_class
/* /*
Ensure the tree of userclass data is stored in our object. Ensure the tree of userclass data is stored in our object.
Only read if its either not present, or the $force flag is set Only read if its either not present, or the $force flag is set
*/ */
function readTree($force = FALSE) function readTree($force = FALSE)
{ {
if (isset($this->class_tree) && count($this->class_tree) && !$force) return $this->class_tree; if (isset($this->class_tree) && count($this->class_tree) && !$force) return $this->class_tree;
global $e107; global $e107;
$this->class_tree = array(); $this->class_tree = array();
$this->class_parents = array(); $this->class_parents = array();
@@ -111,7 +111,7 @@ class user_class
{ {
$this->sql_r->db_Select("userclass_classes", '*', "ORDER BY userclass_parent", 'nowhere'); // The order statement should give a consistent return $this->sql_r->db_Select("userclass_classes", '*', "ORDER BY userclass_parent", 'nowhere'); // The order statement should give a consistent return
while ($row = $this->sql_r->db_Fetch(MYSQL_ASSOC)) while ($row = $this->sql_r->db_Fetch(MYSQL_ASSOC))
{ {
$this->class_tree[$row['userclass_id']] = $row; $this->class_tree[$row['userclass_id']] = $row;
$this->class_tree[$row['userclass_id']]['class_children'] = array(); // Create the child array in case needed $this->class_tree[$row['userclass_id']]['class_children'] = array(); // Create the child array in case needed
@@ -169,7 +169,7 @@ class user_class
$this->class_tree[$uc['userclass_parent']]['class_children'][] = $uc['userclass_id']; $this->class_tree[$uc['userclass_parent']]['class_children'][] = $uc['userclass_id'];
} }
} }
} }
} }
@@ -214,7 +214,7 @@ class user_class
} }
// Combines the selected editable classes into the main class list for a user. // Combines the selected editable classes into the main class list for a user.
// $combined - the complete list of current class memberships // $combined - the complete list of current class memberships
// $possible - the classes which are being edited // $possible - the classes which are being edited
@@ -284,8 +284,8 @@ class user_class
return implode(',',$new_classes); return implode(',',$new_classes);
} }
/* Generate a dropdown list of user classes from which to select - virtually as r_userclass() /* Generate a dropdown list of user classes from which to select - virtually as r_userclass()
$optlist allows selection of the classes to be shown in the dropdown. All or none can be included, separated by comma. Valid options are: $optlist allows selection of the classes to be shown in the dropdown. All or none can be included, separated by comma. Valid options are:
@@ -306,16 +306,16 @@ class user_class
force - show all classes (subject to the other options, including matchclass) - added for 0.8 force - show all classes (subject to the other options, including matchclass) - added for 0.8
$extra_js - can add JS handlers (e.g. 'onclick', 'onchange') if required $extra_js - can add JS handlers (e.g. 'onclick', 'onchange') if required
[ $mode parameter of r_userclass() removed - $optlist is more flexible) ] [ $mode parameter of r_userclass() removed - $optlist is more flexible) ]
*/ */
function uc_dropdown($fieldname, $curval = 0, $optlist = "", $extra_js = '') function uc_dropdown($fieldname, $curval = 0, $optlist = "", $extra_js = '')
{ {
global $pref; global $pref;
$show_classes = $this->uc_required_class_list($optlist); $show_classes = $this->uc_required_class_list($optlist);
$text = ''; $text = '';
foreach ($show_classes as $k => $v) foreach ($show_classes as $k => $v)
{ {
if ($k == e_UC_BLANK) if ($k == e_UC_BLANK)
@@ -324,12 +324,12 @@ class user_class
} }
else else
{ {
$s = ($curval == $k && $curval !== '') ? "selected='selected'" : ""; $s = ($curval == $k && $curval !== '') ? "selected='selected'" : "";
$text .= "<option value='".$k."' ".$s.">".$v."</option>\n"; $text .= "<option value='".$k."' ".$s.">".$v."</option>\n";
} }
} }
if (strpos($optlist, "language") !== FALSE && $pref['multilanguage']) if (strpos($optlist, "language") !== FALSE && $pref['multilanguage'])
{ {
$text .= "<optgroup label=' ------ ' />\n"; $text .= "<optgroup label=' ------ ' />\n";
$tmpl = explode(",",e_LANLIST); $tmpl = explode(",",e_LANLIST);
@@ -356,7 +356,7 @@ class user_class
{ {
$ret = array(); $ret = array();
if (!$optlist) $optlist = 'public,guest,nobody,member,classes'; // Set defaults to simplify ongoing processing if (!$optlist) $optlist = 'public,guest,nobody,member,classes'; // Set defaults to simplify ongoing processing
if ($optlist == 'editable') if ($optlist == 'editable')
{ {
$temp = array_flip(explode(',',$this->get_editable_classes())); $temp = array_flip(explode(',',$this->get_editable_classes()));
@@ -369,8 +369,8 @@ class user_class
} }
$opt_arr = explode(',',$optlist); $opt_arr = explode(',',$optlist);
foreach ($opt_arr as $k => $v) foreach ($opt_arr as $k => $v)
{ {
$opt_arr[$k] = trim($v); $opt_arr[$k] = trim($v);
} }
@@ -378,7 +378,7 @@ class user_class
if (isset($opt_arr['force'])) unset($opt_arr['filter']); if (isset($opt_arr['force'])) unset($opt_arr['filter']);
if (isset($opt_arr['blank'])) if (isset($opt_arr['blank']))
{ {
$ret[e_UC_BLANK] = 1; $ret[e_UC_BLANK] = 1;
} }
@@ -415,7 +415,7 @@ class user_class
} }
} }
} }
/* Above loop slightly changes the display order of earlier code versions. /* Above loop slightly changes the display order of earlier code versions.
If readonly must be last (after language), delete it from the $text_class_link array, and uncomment the following code If readonly must be last (after language), delete it from the $text_class_link array, and uncomment the following code
if (isset($opt_arr['readonly'])) if (isset($opt_arr['readonly']))
@@ -425,8 +425,8 @@ class user_class
*/ */
return $ret; return $ret;
} }
/* /*
Very similar to r_userclass, but returns a list of check boxes. Doesn't encapsulate it. Very similar to r_userclass, but returns a list of check boxes. Doesn't encapsulate it.
@@ -449,21 +449,21 @@ class user_class
{ {
$c = (in_array($k,$curArray)) ? " checked='checked'" : ""; $c = (in_array($k,$curArray)) ? " checked='checked'" : "";
if ($showdescription) $v .= " (".$this->uc_get_classdescription($k).")"; if ($showdescription) $v .= " (".$this->uc_get_classdescription($k).")";
$ret .= "<label><input type='checkbox' class='checkbox' name='{$fieldname}[{$k}]' value='{$k}' {$c} /> ".$v."</label><br />\n"; $ret .= "<div class='field-spacer'><input type='checkbox' class='checkbox' name='{$fieldname}[{$k}]' id='{$fieldname}-{$k}' value='{$k}'{$c} /><label for='{$fieldname}-{$k}'>".$v."</label></div>\n";
} }
} }
if (strpos($optlist, "language") !== FALSE && $pref['multilanguage']) if (strpos($optlist, "language") !== FALSE && $pref['multilanguage'])
{ {
$ret .= "<hr />\n"; $ret .= "<div class='separator'><!-- --></div>\n";
$tmpl = explode(",",e_LANLIST); $tmpl = explode(",",e_LANLIST);
foreach($tmpl as $lang) foreach($tmpl as $lang)
{ {
$c = (in_array($lang, $curArray)) ? " checked='checked' " : ""; $c = (in_array($lang, $curArray)) ? " checked='checked' " : "";
$ret .= "<label><input type='checkbox' class='checkbox' name='{$fieldname}[{$lang}]' value='1' {$c} /> {$lang}</label><br />"; $ret .= "<div class='field-spacer'><input type='checkbox' class='checkbox' name='{$fieldname}[{$lang}]' id='{$fieldname}-{$lang}' value='1'{$c} /><label for='{$fieldname}-{$lang}'>{$lang}</label></div>";
} }
} }
return $ret; return $ret;
} }
@@ -471,7 +471,7 @@ class user_class
/* /*
Next two routines create an indented tree - for example within a select box or a list of check boxes. Next two routines create an indented tree - for example within a select box or a list of check boxes.
For each displayed element, the callback routine is called For each displayed element, the callback routine is called
$treename is the name given to the elements where required $treename is the name given to the elements where required
$callback is a routine used to generate each element; there are two implemented within this class: $callback is a routine used to generate each element; there are two implemented within this class:
@@ -585,7 +585,7 @@ class user_class
/* /*
Return array of all classes, limited according to membership of the userclass_visibility field if $filter is set. Return array of all classes, limited according to membership of the userclass_visibility field if $filter is set.
Index field - userclass_id Index field - userclass_id
@@ -604,8 +604,8 @@ class user_class
} }
return $ret; return $ret;
} }
function uc_get_classname($id) function uc_get_classname($id)
{ {
if (isset($this->class_tree[$id])) if (isset($this->class_tree[$id]))
@@ -618,8 +618,8 @@ class user_class
} }
return ''; return '';
} }
function uc_get_classdescription($id) function uc_get_classdescription($id)
{ {
if (isset($this->class_tree[$id])) if (isset($this->class_tree[$id]))
@@ -641,7 +641,7 @@ class user_class
} }
return ''; return '';
} }
function ucGetClassIDFromName($name) function ucGetClassIDFromName($name)
{ {
$this->readTree(); $this->readTree();
@@ -655,7 +655,7 @@ class user_class
} }
return FALSE; // not found return FALSE; // not found
} }
// Utility to remove a specified class ID from the default comma-separated list // Utility to remove a specified class ID from the default comma-separated list
function ucRemove($classID, $from, $asArray = FALSE) function ucRemove($classID, $from, $asArray = FALSE)
@@ -670,8 +670,8 @@ class user_class
if (count($tmp) == 0) { return ''; } if (count($tmp) == 0) { return ''; }
return implode(',',$tmp); return implode(',',$tmp);
} }
// Utility to add a specified class ID to the default comma-separated list // Utility to add a specified class ID to the default comma-separated list
function ucAdd($classID, $to, $asArray = FALSE) function ucAdd($classID, $to, $asArray = FALSE)
{ {
@@ -681,17 +681,17 @@ class user_class
if ($asArray) { return $tmp; } if ($asArray) { return $tmp; }
return implode(',',$tmp); return implode(',',$tmp);
} }
/* /*
Return all users in a particular class or set of classes. Return all users in a particular class or set of classes.
$classlist is a comma separated list of classes - if the 'predefined' classes are required, they must be included. No spaces allowed $classlist is a comma separated list of classes - if the 'predefined' classes are required, they must be included. No spaces allowed
$field_list is used to select the returned fields ($user_id is the primary index) $field_list is used to select the returned fields ($user_id is the primary index)
****** Can be verrrrryyyy slow - has to scan the whole user database at present ****** ****** Can be verrrrryyyy slow - has to scan the whole user database at present ******
********* NOT TESTED ********** ********* NOT TESTED **********
***** NOT SURE WHETHER THIS IS REALLY A USER OR A USER CLASS FUNCTION ***** ***** NOT SURE WHETHER THIS IS REALLY A USER OR A USER CLASS FUNCTION *****
*/ */
function get_users_in_class($classlist, $field_list = 'user_name, user_loginname', $include_ancestors = FALSE, $order_by = 'user_id') function get_users_in_class($classlist, $field_list = 'user_name, user_loginname', $include_ancestors = FALSE, $order_by = 'user_id')
@@ -740,11 +740,11 @@ $mode = 'off' turns off listing of admin/main admin classes unless enabled in $o
*/ */
function r_userclass($fieldname, $curval = 0, $mode = "off", $optlist = "") function r_userclass($fieldname, $curval = 0, $mode = "off", $optlist = "")
{ {
// echo "Call r_userclass{$fieldname}, CV: {$curval} opts: {$optlist}<br />"; // echo "Call r_userclass{$fieldname}, CV: {$curval} opts: {$optlist}<br />";
global $e_userclass; global $e_userclass;
if ($mode != 'off') if ($mode != 'off')
{ // Handle legacy code { // Handle legacy code
if ($optlist) $optlist .= ','; if ($optlist) $optlist .= ',';
$optlist .= 'admin,main'; $optlist .= 'admin,main';
@@ -763,7 +763,7 @@ function r_userclass_check($fieldname, $curval = '', $optlist = "")
global $e_userclass; global $e_userclass;
if (!is_object($e_userclass)) $e_userclass = new user_class; if (!is_object($e_userclass)) $e_userclass = new user_class;
$ret = $e_userclass->uc_checkboxes($fieldname,$curval,$optlist); $ret = $e_userclass->uc_checkboxes($fieldname,$curval,$optlist);
if ($ret) $ret = "<div class='tbox' style='margin-left:0px;margin-right:auto;width:60%;height:58px;overflow:auto'>".$ret."</div>"; if ($ret) $ret = "<div class='check-block'>".$ret."</div>";
return $ret; return $ret;
} }
@@ -779,7 +779,7 @@ function get_userclass_list()
function r_userclass_name($id) function r_userclass_name($id)
{ {
// echo "Call r_userclass_name<br />"; // echo "Call r_userclass_name<br />";
global $e_userclass; global $e_userclass;
@@ -803,11 +803,11 @@ function r_userclass_radio($fieldname, $curval = '')
class user_class_admin extends user_class class user_class_admin extends user_class
{ {
var $field_list = array('userclass_name' => "varchar(100) NOT NULL default ''", var $field_list = array('userclass_name' => "varchar(100) NOT NULL default ''",
'userclass_description' => "varchar(250) NOT NULL default ''", 'userclass_description' => "varchar(250) NOT NULL default ''",
'userclass_editclass' => "tinyint(3) unsigned NOT NULL default '0'", 'userclass_editclass' => "tinyint(3) unsigned NOT NULL default '0'",
'userclass_parent' => "tinyint(3) unsigned NOT NULL default '0'", 'userclass_parent' => "tinyint(3) unsigned NOT NULL default '0'",
'userclass_accum' => "varchar(250) NOT NULL default ''", 'userclass_accum' => "varchar(250) NOT NULL default ''",
'userclass_visibility' => "tinyint(3) unsigned NOT NULL default '0'", 'userclass_visibility' => "tinyint(3) unsigned NOT NULL default '0'",
'userclass_type' =>"tinyint(1) unsigned NOT NULL default '0'", 'userclass_type' =>"tinyint(1) unsigned NOT NULL default '0'",
'userclass_icon' => "varchar(250) NOT NULL default ''" 'userclass_icon' => "varchar(250) NOT NULL default ''"
@@ -826,7 +826,7 @@ class user_class_admin extends user_class
{ {
$this->user_class(); // Call constructor from ancestor class $this->user_class(); // Call constructor from ancestor class
$this->isAdmin = TRUE; $this->isAdmin = TRUE;
// Have to initialise the images this way - PHP4 won't take a nested array assignment in the variable list // Have to initialise the images this way - PHP4 won't take a nested array assignment in the variable list
$this->tree_icons = array( $this->tree_icons = array(
FALSE => array( // No children FALSE => array( // No children
@@ -853,7 +853,7 @@ class user_class_admin extends user_class
); );
} }
/* /*
Next three routines are used to update the database after adding/deleting a class Next three routines are used to update the database after adding/deleting a class
@@ -868,12 +868,12 @@ class user_class_admin extends user_class
$this->rebuild_tree($cp,$rights); // increasing rights going down the tree $this->rebuild_tree($cp,$rights); // increasing rights going down the tree
} }
} }
// Internal function, called recursively to rebuild the permissions tree where rights increase going down the tree // Internal function, called recursively to rebuild the permissions tree where rights increase going down the tree
// $parent is the class number being processed. // $parent is the class number being processed.
// $rights is the array of rights accumulated so far in the walk down the tree // $rights is the array of rights accumulated so far in the walk down the tree
function rebuild_tree($parent, $rights) function rebuild_tree($parent, $rights)
{ {
if ($this->class_tree[$parent]['userclass_parent'] == e_UC_NOBODY) if ($this->class_tree[$parent]['userclass_parent'] == e_UC_NOBODY)
{ {
@@ -896,12 +896,12 @@ class user_class_admin extends user_class
{ {
$this->rebuild_tree($cc,$rights); // Recursive call $this->rebuild_tree($cc,$rights); // Recursive call
} }
} }
// Internal function, called recursively to rebuild the permissions tree where rights increase going up the tree // Internal function, called recursively to rebuild the permissions tree where rights increase going up the tree
// Returns an array // Returns an array
function topdown_tree($our_class) function topdown_tree($our_class)
{ {
$rights = array($our_class); // Accumulator always has rights to its own class $rights = array($our_class); // Accumulator always has rights to its own class
@@ -919,7 +919,7 @@ class user_class_admin extends user_class
$this->class_tree[$our_class]['change_flag'] = 'UPDATE'; $this->class_tree[$our_class]['change_flag'] = 'UPDATE';
} }
return $rights; return $rights;
} }
function save_tree() function save_tree()
@@ -943,7 +943,7 @@ class user_class_admin extends user_class
} }
} }
} }
/* /*
@@ -963,7 +963,7 @@ class user_class_admin extends user_class
} }
return $ret; return $ret;
} }
function show_tree($add_class = FALSE) function show_tree($add_class = FALSE)
{ {
$ret = ''; $ret = '';
@@ -991,13 +991,13 @@ class user_class_admin extends user_class
$tag_name = 'uclass_tree_'.$listnum; $tag_name = 'uclass_tree_'.$listnum;
$ret = "<div class='uclass_tree' style='height: 20px'>\n"; $ret = "<div class='uclass_tree' style='height: 20px'>\n";
foreach ($indent_images as $im) foreach ($indent_images as $im)
{ {
$ret .= "<img src='".UC_ICON_DIR.$im."' alt='class icon' />"; $ret .= "<img src='".UC_ICON_DIR.$im."' alt='class icon' />";
} }
// If this link has children, wrap the next image in a link and an expand/hide option // If this link has children, wrap the next image in a link and an expand/hide option
if ($num_children) if ($num_children)
{ {
$ret .= "<span onclick=\"javascript: expandit('{$tag_name}'); expandit('{$tag_name}_p'); expandit('{$tag_name}_m')\"><img src='".UC_ICON_DIR.$this->tree_icons[TRUE][$is_last][TRUE]."' alt='class icon' id='{$tag_name}_m' />"; $ret .= "<span onclick=\"javascript: expandit('{$tag_name}'); expandit('{$tag_name}_p'); expandit('{$tag_name}_m')\"><img src='".UC_ICON_DIR.$this->tree_icons[TRUE][$is_last][TRUE]."' alt='class icon' id='{$tag_name}_m' />";
$ret .= "<img src='".UC_ICON_DIR.$this->tree_icons[TRUE][$is_last][FALSE]."' style='display:none' id='{$tag_name}_p' alt='class icon' /></span>\n"; $ret .= "<img src='".UC_ICON_DIR.$this->tree_icons[TRUE][$is_last][FALSE]."' style='display:none' id='{$tag_name}_p' alt='class icon' /></span>\n";
@@ -1054,7 +1054,7 @@ class user_class_admin extends user_class
} }
return $ret; return $ret;
} }
function show_graphical_tree($show_debug=FALSE) function show_graphical_tree($show_debug=FALSE)
@@ -1069,7 +1069,7 @@ class user_class_admin extends user_class
foreach ($this->class_parents as $p) foreach ($this->class_parents as $p)
{ {
$num_parents--; $num_parents--;
$ret .= $this->show_graphical_subtree($p, $indent_images, ($num_parents == 0)); $ret .= $this->show_graphical_subtree($p, $indent_images, ($num_parents == 0));
} }
return $ret; return $ret;
} }
@@ -1103,7 +1103,7 @@ class user_class_admin extends user_class
} }
$i++; $i++;
if ($i < e_UC_SPECIAL_BASE) return $i; if ($i < e_UC_SPECIAL_BASE) return $i;
// Looks like we've had a lot of activity in classes - try and find a gap. // Looks like we've had a lot of activity in classes - try and find a gap.
for ($i = 1; ($i < e_UC_SPECIAL_BASE); $i++) for ($i = 1; ($i < e_UC_SPECIAL_BASE); $i++)
{ {
@@ -1138,12 +1138,12 @@ class user_class_admin extends user_class
$this->clearCache(); $this->clearCache();
return TRUE; return TRUE;
} }
function save_edited_class($classrec) function save_edited_class($classrec)
{ {
// echo "Save edited class: ".implode(',', $classrec)."<br />"; // echo "Save edited class: ".implode(',', $classrec)."<br />";
if (!$classrec['userclass_id']) if (!$classrec['userclass_id'])
{ {
echo "Programming bungle on save<br />"; echo "Programming bungle on save<br />";
return FALSE; return FALSE;
@@ -1159,7 +1159,7 @@ class user_class_admin extends user_class
$classrec['userclass_accum'] = implode(',',$temp); $classrec['userclass_accum'] = implode(',',$temp);
} }
} }
foreach ($this->field_list as $fl => $val) foreach ($this->field_list as $fl => $val)
{ {
if (isset($classrec[$fl])) if (isset($classrec[$fl]))
@@ -1176,7 +1176,7 @@ class user_class_admin extends user_class
return TRUE; return TRUE;
} }
function delete_class($class_id) function delete_class($class_id)
{ {
@@ -1254,38 +1254,38 @@ class user_class_admin extends user_class
{ {
// If they don't exist, we need to create class records for the 'standard' user classes // If they don't exist, we need to create class records for the 'standard' user classes
$init_list = array( $init_list = array(
array('userclass_id' => e_UC_MEMBER, 'userclass_name' => UC_LAN_3, array('userclass_id' => e_UC_MEMBER, 'userclass_name' => UC_LAN_3,
'userclass_description' => UCSLAN_75, 'userclass_description' => UCSLAN_75,
'userclass_editclass' => e_UC_MAINADMIN, 'userclass_editclass' => e_UC_MAINADMIN,
'userclass_parent' => e_UC_PUBLIC, 'userclass_parent' => e_UC_PUBLIC,
'userclass_visibility' => e_UC_MEMBER 'userclass_visibility' => e_UC_MEMBER
), ),
array('userclass_id' => e_UC_ADMINMOD, 'userclass_name' => UC_LAN_8, array('userclass_id' => e_UC_ADMINMOD, 'userclass_name' => UC_LAN_8,
'userclass_description' => UCSLAN_74, 'userclass_description' => UCSLAN_74,
'userclass_editclass' => e_UC_MAINADMIN, 'userclass_editclass' => e_UC_MAINADMIN,
'userclass_parent' => e_UC_MAINADMIN, 'userclass_parent' => e_UC_MAINADMIN,
'userclass_visibility' => e_UC_MEMBER 'userclass_visibility' => e_UC_MEMBER
), ),
array('userclass_id' => e_UC_ADMIN, 'userclass_name' => UC_LAN_5, array('userclass_id' => e_UC_ADMIN, 'userclass_name' => UC_LAN_5,
'userclass_description' => UCSLAN_76, 'userclass_description' => UCSLAN_76,
'userclass_editclass' => e_UC_MAINADMIN, 'userclass_editclass' => e_UC_MAINADMIN,
'userclass_parent' => e_UC_ADMINMOD, 'userclass_parent' => e_UC_ADMINMOD,
'userclass_visibility' => e_UC_MEMBER 'userclass_visibility' => e_UC_MEMBER
), ),
array('userclass_id' => e_UC_MAINADMIN, 'userclass_name' => UC_LAN_6, array('userclass_id' => e_UC_MAINADMIN, 'userclass_name' => UC_LAN_6,
'userclass_description' => UCSLAN_77, 'userclass_description' => UCSLAN_77,
'userclass_editclass' => e_UC_MAINADMIN, 'userclass_editclass' => e_UC_MAINADMIN,
'userclass_parent' => e_UC_NOBODY, 'userclass_parent' => e_UC_NOBODY,
'userclass_visibility' => e_UC_MEMBER 'userclass_visibility' => e_UC_MEMBER
), ),
array('userclass_id' => e_UC_MODS, 'userclass_name' => UC_LAN_7, array('userclass_id' => e_UC_MODS, 'userclass_name' => UC_LAN_7,
'userclass_description' => UCSLAN_78, 'userclass_description' => UCSLAN_78,
'userclass_editclass' => e_UC_MAINADMIN, 'userclass_editclass' => e_UC_MAINADMIN,
'userclass_parent' => e_UC_ADMINMOD, 'userclass_parent' => e_UC_ADMINMOD,
'userclass_visibility' => e_UC_MEMBER 'userclass_visibility' => e_UC_MEMBER
), ),
array('userclass_id' => e_UC_NEWUSER, 'userclass_name' => UC_LAN_9, array('userclass_id' => e_UC_NEWUSER, 'userclass_name' => UC_LAN_9,
'userclass_description' => UCSLAN_87, 'userclass_description' => UCSLAN_87,
'userclass_editclass' => e_UC_MAINADMIN, 'userclass_editclass' => e_UC_MAINADMIN,
'userclass_parent' => e_UC_MEMBER, 'userclass_parent' => e_UC_MEMBER,
'userclass_visibility' => e_UC_ADMIN 'userclass_visibility' => e_UC_ADMIN
@@ -1304,7 +1304,7 @@ class user_class_admin extends user_class
} }
} }
} }
function clearCache() function clearCache()
{ {
global $e107; global $e107;
@@ -1325,7 +1325,7 @@ class user_class_admin extends user_class
// class_create() - called only from forum update routines - could probably go // class_create() - called only from forum update routines - could probably go
class e_userclass class e_userclass
{ {
function class_add($cid, $uinfoArray) function class_add($cid, $uinfoArray)
{ {

View File

@@ -4,8 +4,8 @@
| e107 website system - Language File. | e107 website system - Language File.
| |
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_newspost.php,v $ | $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_newspost.php,v $
| $Revision: 1.4 $ | $Revision: 1.5 $
| $Date: 2009-01-13 17:09:30 $ | $Date: 2009-01-15 15:42:24 $
| $Author: secretr $ | $Author: secretr $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -171,4 +171,5 @@ define("LAN_NEWS_50", "Author");
define("LAN_NEWS_51", "Modification of the news-item author can be done by:"); define("LAN_NEWS_51", "Modification of the news-item author can be done by:");
define("LAN_NEWS_52", "General Information"); define("LAN_NEWS_52", "General Information");
define("LAN_NEWS_53", "News Item Options");
?> ?>

View File

@@ -131,6 +131,18 @@ input.radio { margin-right: 3px; }
label { cursor: pointer; } label { cursor: pointer; }
.checkbox { margin-right: 5px; } .checkbox { margin-right: 5px; }
.check-block { /* see administration newspost.php */
padding: 2px 0px;
border-width:1px;
border-style:solid;
border-color:#aaa #c8c8c8 #c8c8c8 #aaa;
background:#fff;
font:12px arial, helvetica, sans-serif;
overflow:auto
}
.check-block .checkbox { margin-left: 2px }
.check-block .separator { clear: both; border-bottom: 1px solid #aaa; margin-bottom: 4px; height: 4px }
.field-help { width: 280px; line-height: 1.4em; padding-top: 3px; color:#333333; font-size: 11px; } .field-help { width: 280px; line-height: 1.4em; padding-top: 3px; color:#333333; font-size: 11px; }
.label-note { font-style: italic; } .label-note { font-style: italic; }
@@ -153,6 +165,8 @@ label { cursor: pointer; }
.adminform td div.field-spacer { margin-bottom: 3px; } /* multi-fields per row separator */ .adminform td div.field-spacer { margin-bottom: 3px; } /* multi-fields per row separator */
.adminform td div.field-section { clear: both; margin-bottom: 10px; } /* multi-field sections per row - wrapper */ .adminform td div.field-section { clear: both; margin-bottom: 10px; } /* multi-field sections per row - wrapper */
.adminform td .check-block { width:95%; height:60px; }
.adminform .select { width: 280px;} .adminform .select { width: 280px;}
.adminform .input-text { width: 274px;} .adminform .input-text { width: 274px;}
.adminform td.control textarea { width: 274px;} .adminform td.control textarea { width: 274px;}
@@ -172,6 +186,8 @@ label { cursor: pointer; }
.adminedit td.control textarea { width: 274px;} .adminedit td.control textarea { width: 274px;}
.adminedit td.control textarea.large { width: 400px; } .adminedit td.control textarea.large { width: 400px; }
.adminedit td .check-block { width:95%; height:60px; }
.adminedit td.label {} .adminedit td.label {}
.adminedit td.control {} .adminedit td.control {}
@@ -180,8 +196,6 @@ label { cursor: pointer; }
.admininfo { width:100%; border:1px solid #ddd;} .admininfo { width:100%; border:1px solid #ddd;}
.admininfo td { padding: 1px 5px; text-align: left} .admininfo td { padding: 1px 5px; text-align: left}
.admininfo td.label { border-right:1px solid #ddd; }
.admininfo td.control {}
.info-bar { padding: 5px 0px; } .info-bar { padding: 5px 0px; }

View File

@@ -9,8 +9,8 @@
* Admin template - _blank theme * Admin template - _blank theme
* *
* $Source: /cvs_backup/e107_0.8/e107_themes/_blank/admin_template.php,v $ * $Source: /cvs_backup/e107_0.8/e107_themes/_blank/admin_template.php,v $
* $Revision: 1.10 $ * $Revision: 1.11 $
* $Date: 2009-01-09 17:25:50 $ * $Date: 2009-01-15 15:42:24 $
* $Author: secretr $ * $Author: secretr $
* *
*/ */
@@ -88,7 +88,7 @@ $ADMIN_FOOTER = "
</table> </table>
</div> </div>
<div class='admin-footer'> <div class='admin-footer'>
{ADMIN_CREDITS} <!-- -->
</div> </div>
</div> </div>
"; ";

View File

@@ -97,4 +97,43 @@ function tablestyle($caption, $text, $mod) {
$HEADER = ''; $HEADER = '';
$FOOTER = ''; $FOOTER = '';
define('ICONMAIL', 'email_16.png');
define('ICONPRINT', 'print_16.png');
define('ICONSTYLE', 'border: 0px');
define('COMMENTLINK', LAN_THEME_2);
define('COMMENTOFFSTRING', LAN_THEME_1);
define('PRE_EXTENDEDSTRING', '<br /><br />');
define('EXTENDEDSTRING', LAN_THEME_3);
define('POST_EXTENDEDSTRING', '<br />');
define('TRACKBACKSTRING', LAN_THEME_4);
define('TRACKBACKBEFORESTRING', '&nbsp;|&nbsp;');
$sc_style['NEWSIMAGE']['pre'] = '<div style="float: left; margin-right: 15px">';
$sc_style['NEWSIMAGE']['post'] = '</div>';
$sc_style['NEWSICON']['pre'] = '<div style="float: left; margin-right: 15px">';
$sc_style['NEWSICON']['post'] = '</div>';
$NEWSSTYLE = '
<div class="newsItem clear">
<h4>{NEWSTITLE}</h4>
<span class="newsAuthor">{NEWSAUTHOR}</span>
<span class="newsDate">{NEWSDATE}</span>
<div style="clear: both; margin-bottom: 5px;"><!-- --></div>
{NEWSIMAGE}
{NEWSBODY}
{EXTENDED}
{TRACKBACK}
<div style="clear: both; margin-bottom: 5px;"><!-- --></div>
<table class="newsComments" cellpadding="0" cellspacing="0" style="border: 0px none; width: 100%" >
<tr>
<td valign="middle" style="text-align: left">
{NEWSCOMMENTS}
</td>
<td valign="middle" style="text-align: right">
{ADMINOPTIONS}{EMAILICON}{PRINTICON}{PDFICON}
</td>
</tr>
</table>
</div>
';
?> ?>

View File

@@ -4,4 +4,11 @@ define("EMESSLAN_TITLE_ERROR", "Error");
define("EMESSLAN_TITLE_SUCCESS", "Success"); define("EMESSLAN_TITLE_SUCCESS", "Success");
define("EMESSLAN_TITLE_WARNING", "Warning"); define("EMESSLAN_TITLE_WARNING", "Warning");
define("EMESSLAN_TITLE_DEBUG", "System Debug"); define("EMESSLAN_TITLE_DEBUG", "System Debug");
define("LAN_THEME_1", "Comments are turned off for this item");
define("LAN_THEME_2", "Read/Post Comment: ");
define("LAN_THEME_3", "Read the rest...");
define("LAN_THEME_4", "Trackbacks: ");
define("LAN_THEME_5", "Posted by ");
define("LAN_THEME_6", "on ");
?> ?>