2006-12-02 04:36:16 +00:00
|
|
|
|
<?php
|
|
|
|
|
/*
|
|
|
|
|
+ ----------------------------------------------------------------------------+
|
|
|
|
|
| e107 website system
|
|
|
|
|
|
|
|
|
|
|
| <EFBFBD>Steve Dunstan 2001-2002
|
|
|
|
|
| http://e107.org
|
|
|
|
|
| jalist@e107.org
|
|
|
|
|
|
|
|
|
|
|
| Released under the terms and conditions of the
|
|
|
|
|
| GNU General Public License (http://gnu.org).
|
|
|
|
|
|
|
|
|
|
|
| $Source: /cvs_backup/e107_0.8/e107_admin/wmessage.php,v $
|
2009-07-17 07:53:13 +00:00
|
|
|
|
| $Revision: 1.5 $
|
|
|
|
|
| $Date: 2009-07-17 07:53:13 $
|
2009-07-10 14:25:23 +00:00
|
|
|
|
| $Author: e107coders $
|
2006-12-02 04:36:16 +00:00
|
|
|
|
+----------------------------------------------------------------------------+
|
|
|
|
|
*/
|
|
|
|
|
require_once("../class2.php");
|
2008-11-02 12:23:56 +00:00
|
|
|
|
if (!getperms("M"))
|
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
|
header("location:".e_BASE."index.php");
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
$e_sub_cat = 'wmessage';
|
|
|
|
|
|
|
|
|
|
require_once(e_HANDLER."preset_class.php");
|
|
|
|
|
$pst = new e_preset;
|
|
|
|
|
$pst->form = "wmform";
|
|
|
|
|
$pst->page = "wmessage.php?create";
|
|
|
|
|
$pst->id = "admin_wmessage";
|
|
|
|
|
require_once("auth.php");
|
|
|
|
|
$pst->save_preset(); // save and render result
|
|
|
|
|
|
|
|
|
|
require_once(e_HANDLER.'form_handler.php');
|
|
|
|
|
require_once(e_HANDLER.'userclass_class.php');
|
|
|
|
|
require_once(e_HANDLER."ren_help.php");
|
|
|
|
|
|
|
|
|
|
$rs = new form;
|
2009-07-10 14:25:23 +00:00
|
|
|
|
$frm = new e_form;
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
2008-11-02 12:23:56 +00:00
|
|
|
|
$action == '';
|
|
|
|
|
if (e_QUERY)
|
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
|
$tmp = explode('.', e_QUERY);
|
|
|
|
|
$action = $tmp[0];
|
|
|
|
|
$sub_action = $tmp[1];
|
|
|
|
|
$id = $tmp[2];
|
|
|
|
|
unset($tmp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($_POST)
|
|
|
|
|
{
|
|
|
|
|
$e107cache->clear("wmessage");
|
|
|
|
|
}
|
|
|
|
|
|
2008-11-02 12:23:56 +00:00
|
|
|
|
if (isset($_POST['wm_update']))
|
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
|
$data = $tp->toDB($_POST['data']);
|
|
|
|
|
$wm_title = $tp->toDB($_POST['wm_caption']);
|
2008-11-02 12:23:56 +00:00
|
|
|
|
$wmId = intval($_POST['wm_id']);
|
|
|
|
|
welcome_adminlog('02', $wmId, $wm_title);
|
|
|
|
|
$message = ($sql->db_Update("generic", "gen_chardata ='{$data}',gen_ip ='{$wm_title}', gen_intdata='".$_POST['wm_active']."' WHERE gen_id=".$wmId." ")) ? LAN_UPDATED : LAN_UPDATED_FAILED;
|
2006-12-02 04:36:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-11-02 12:23:56 +00:00
|
|
|
|
if (isset($_POST['wm_insert']))
|
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
|
$wmtext = $tp->toDB($_POST['data']);
|
|
|
|
|
$wmtitle = $tp->toDB($_POST['wm_caption']);
|
2008-11-02 12:23:56 +00:00
|
|
|
|
welcome_adminlog('01', 0, $wmtitle);
|
2006-12-02 04:36:16 +00:00
|
|
|
|
$message = ($sql->db_Insert("generic", "0, 'wmessage', '".time()."', ".USERID.", '{$wmtitle}', '{$_POST['wm_active']}', '{$wmtext}' ")) ? LAN_CREATED : LAN_CREATED_FAILED ;
|
|
|
|
|
}
|
|
|
|
|
|
2008-11-02 12:23:56 +00:00
|
|
|
|
if (isset($_POST['updateoptions']))
|
|
|
|
|
{
|
|
|
|
|
$changed = FALSE;
|
|
|
|
|
foreach (array('wm_enclose','wmessage_sc') as $opt)
|
|
|
|
|
{
|
|
|
|
|
$temp = intval($_POST[$opt]);
|
|
|
|
|
if ($temp != $pref[$opt])
|
|
|
|
|
{
|
|
|
|
|
$pref[$opt] = $temp;
|
|
|
|
|
$changed = TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($changed)
|
|
|
|
|
{
|
|
|
|
|
save_prefs();
|
|
|
|
|
welcome_adminlog('04', 0, $pref['wm_enclose'].', '.$pref['wmessage_sc']);
|
|
|
|
|
$message = LAN_SETSAVED;
|
|
|
|
|
}
|
2006-12-02 04:36:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-11-02 12:23:56 +00:00
|
|
|
|
if (isset($_POST['main_delete']))
|
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
|
$del_id = array_keys($_POST['main_delete']);
|
2008-11-02 12:23:56 +00:00
|
|
|
|
welcome_adminlog('03', $wmId, '');
|
2006-12-02 04:36:16 +00:00
|
|
|
|
$message = ($sql->db_Delete("generic", "gen_id='".$del_id[0]."' ")) ? LAN_DELETED : LAN_DELETED_FAILED ;
|
|
|
|
|
}
|
|
|
|
|
|
2008-11-02 12:23:56 +00:00
|
|
|
|
if (isset($message))
|
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
|
$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Show Existing -------
|
2008-11-02 12:23:56 +00:00
|
|
|
|
if ($action == "main" || $action == "")
|
|
|
|
|
{
|
|
|
|
|
if ($wm_total = $sql->db_Select("generic", "*", "gen_type='wmessage' ORDER BY gen_id ASC"))
|
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
|
$wmList = $sql->db_getList();
|
|
|
|
|
$text = $rs->form_open("post", e_SELF, "myform_{$gen_id}", "", "");
|
|
|
|
|
$text .= "<div style='text-align:center'>
|
2009-07-17 07:53:13 +00:00
|
|
|
|
<table cellpadding='0' cellspacing='0' class='adminlist'>
|
|
|
|
|
<colgroup span='4'>
|
|
|
|
|
<col style='width:5%' />
|
|
|
|
|
<col style='width:60%' />
|
|
|
|
|
<col style='width:20%' />
|
|
|
|
|
<col style='width:10%' />
|
|
|
|
|
</colgroup>
|
|
|
|
|
<thead>
|
2006-12-02 04:36:16 +00:00
|
|
|
|
<tr>
|
2009-07-17 07:53:13 +00:00
|
|
|
|
<th>ID</th>
|
|
|
|
|
<th>".WMLAN_02."</th>
|
|
|
|
|
<th class='center'>".WMLAN_03."</th>
|
|
|
|
|
<th class='center'>".LAN_OPTIONS."</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>";
|
|
|
|
|
|
2008-11-02 12:23:56 +00:00
|
|
|
|
foreach($wmList as $row)
|
|
|
|
|
{
|
2006-12-02 04:36:16 +00:00
|
|
|
|
$text .= "
|
|
|
|
|
<tr>
|
2009-07-17 07:53:13 +00:00
|
|
|
|
<td class='center' style='text-align: center; vertical-align: middle'>".$row['gen_id']."</td>
|
|
|
|
|
<td>".strip_tags($tp->toHTML($row['gen_ip']))."</td>
|
|
|
|
|
<td>".r_userclass_name($row['gen_intdata'])."</td>
|
|
|
|
|
<td class='center nowrap'>
|
2006-12-02 04:36:16 +00:00
|
|
|
|
<a href='".e_SELF."?create.edit.{$row['gen_id']}'>".ADMIN_EDIT_ICON."</a>
|
|
|
|
|
<input type='image' title='".LAN_DELETE."' name='main_delete[".$row['gen_id']."]' src='".ADMIN_DELETE_ICON_PATH."' onclick=\"return jsconfirm('".LAN_CONFIRMDEL." [ID: {$row['gen_id']} ]')\"/>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>";
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-17 07:53:13 +00:00
|
|
|
|
$text .= "</tbody></table></div>";
|
2006-12-02 04:36:16 +00:00
|
|
|
|
$text .= $rs->form_close();
|
|
|
|
|
} else {
|
|
|
|
|
$text .= "<div style='text-align:center'>".WMLAN_09."</div>";
|
|
|
|
|
}
|
|
|
|
|
$ns->tablerender(WMLAN_00, $text);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create and Edit
|
|
|
|
|
if ($action == "create" || $action == "edit")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if ($sub_action == "edit")
|
|
|
|
|
{
|
|
|
|
|
$sql->db_Select("generic", "gen_intdata, gen_ip, gen_chardata", "gen_id = $id");
|
|
|
|
|
$row = $sql->db_Fetch();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($sub_action != 'edit')
|
|
|
|
|
{
|
|
|
|
|
$preset = $pst->read_preset("admin_wmessage");
|
|
|
|
|
extract($preset);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$text = "
|
|
|
|
|
<div style='text-align:center'>
|
|
|
|
|
<form method='post' action='".e_SELF."' id='wmform'>
|
2009-07-10 14:25:23 +00:00
|
|
|
|
<fieldset id='code-wmessage-create'>
|
|
|
|
|
<table cellpadding='0' cellspacing='0' class='adminform'>
|
|
|
|
|
<colgroup span='2'>
|
|
|
|
|
<col class='col-label' />
|
|
|
|
|
<col class='col-control' />
|
|
|
|
|
</colgroup>
|
2006-12-02 04:36:16 +00:00
|
|
|
|
";
|
|
|
|
|
|
|
|
|
|
$text .= "
|
|
|
|
|
<tr>
|
2009-07-10 14:25:23 +00:00
|
|
|
|
<td>".WMLAN_10."</td>
|
|
|
|
|
<td>
|
2006-12-02 04:36:16 +00:00
|
|
|
|
<input type='text' class='tbox' id='wm_caption' name='wm_caption' maxlength='80' style='width:95%' value=\"".$tp->toForm($row['gen_ip'])."\" />
|
|
|
|
|
</td>
|
|
|
|
|
</tr>";
|
|
|
|
|
|
|
|
|
|
$text .= "<tr>
|
2009-07-10 14:25:23 +00:00
|
|
|
|
<td>".WMLAN_04."</td>
|
|
|
|
|
<td>
|
2009-07-14 11:05:54 +00:00
|
|
|
|
<textarea class='e-wysiwyg tbox' id='data' name='data' cols='70' rows='15' style='width:95%' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this)'>".$tp->toForm($row['gen_chardata'])."</textarea>
|
2006-12-02 04:36:16 +00:00
|
|
|
|
<br />";
|
|
|
|
|
|
|
|
|
|
$text .= display_help("helpb", "admin");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$text .= "
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
2009-07-10 14:25:23 +00:00
|
|
|
|
<tr><td>".WMLAN_03."</td>
|
|
|
|
|
<td>".r_userclass("wm_active", $row['gen_intdata'], "off", "public,guest,nobody,member,admin,classes")."</td></tr>
|
|
|
|
|
</table>";
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
|
|
$text .= "
|
2009-07-10 14:25:23 +00:00
|
|
|
|
<div class='buttons-bar center'>";
|
|
|
|
|
|
|
|
|
|
if($sub_action == "edit")
|
|
|
|
|
{
|
|
|
|
|
$text .= $frm->admin_button('wm_update', LAN_UPDATE, 'update');
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$text .= $frm->admin_button('wm_insert', LAN_CREATE);
|
|
|
|
|
}
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
|
|
|
|
$text .= "<input type='hidden' name='wm_id' value='".$id."' />";
|
2009-07-10 14:25:23 +00:00
|
|
|
|
$text .= "</div>
|
|
|
|
|
</fieldset>
|
2006-12-02 04:36:16 +00:00
|
|
|
|
</form>
|
|
|
|
|
</div>";
|
|
|
|
|
$ns->tablerender(WMLAN_01, $text);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($action == "opt") {
|
|
|
|
|
global $pref, $ns;
|
|
|
|
|
$text = "<div style='text-align:center'>
|
|
|
|
|
<form method='post' action='".e_SELF."?".e_QUERY."'>\n
|
2009-07-10 14:25:23 +00:00
|
|
|
|
<fieldset id='code-wmessage-options'>
|
|
|
|
|
<table cellpadding='0' cellspacing='0' class='adminform'>
|
|
|
|
|
<colgroup span='2'>
|
|
|
|
|
<col class='col-label' />
|
|
|
|
|
<col class='col-control' />
|
|
|
|
|
</colgroup>
|
2006-12-02 04:36:16 +00:00
|
|
|
|
<tr>
|
|
|
|
|
|
2009-07-10 14:25:23 +00:00
|
|
|
|
<td>
|
2006-12-02 04:36:16 +00:00
|
|
|
|
".WMLAN_05."<br />
|
|
|
|
|
<span class='smalltext'>".WMLAN_06."</span>
|
|
|
|
|
</td>
|
2009-07-10 14:25:23 +00:00
|
|
|
|
<td>". ($pref['wm_enclose'] ? "<input type='checkbox' name='wm_enclose' value='1' checked='checked' />" : "<input type='checkbox' name='wm_enclose' value='1' />")."
|
2006-12-02 04:36:16 +00:00
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
|
2009-07-10 14:25:23 +00:00
|
|
|
|
<td>
|
2006-12-02 04:36:16 +00:00
|
|
|
|
".WMLAN_07."
|
|
|
|
|
</td>
|
2009-07-10 14:25:23 +00:00
|
|
|
|
<td>". ($pref['wmessage_sc'] ? "<input type='checkbox' name='wmessage_sc' value='1' checked='checked' />" : "<input type='checkbox' name='wmessage_sc' value='1' />")."
|
2006-12-02 04:36:16 +00:00
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
2009-07-10 14:25:23 +00:00
|
|
|
|
</table>
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
2009-07-10 14:25:23 +00:00
|
|
|
|
<div class='buttons-bar center'>";
|
2006-12-02 04:36:16 +00:00
|
|
|
|
|
2009-07-10 14:25:23 +00:00
|
|
|
|
$text .= $frm->admin_button('updateoptions', LAN_SAVE);
|
|
|
|
|
$text .= "
|
|
|
|
|
</div>
|
|
|
|
|
</fieldset>
|
2006-12-02 04:36:16 +00:00
|
|
|
|
</form>
|
|
|
|
|
</div>";
|
|
|
|
|
|
|
|
|
|
$ns->tablerender(WMLAN_00.": ".LAN_PREFS, $text);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function wmessage_adminmenu() {
|
|
|
|
|
global $action;
|
|
|
|
|
if ($action == "") {
|
|
|
|
|
$action = "main";
|
|
|
|
|
}
|
|
|
|
|
$var['main']['text'] = WMLAN_00;
|
|
|
|
|
$var['main']['link'] = e_SELF;
|
|
|
|
|
$var['create']['text'] = WMLAN_01;
|
|
|
|
|
$var['create']['link'] = e_SELF."?create";
|
|
|
|
|
$var['opt']['text'] = LAN_PREFS;
|
|
|
|
|
$var['opt']['link'] = e_SELF."?opt";
|
|
|
|
|
|
|
|
|
|
show_admin_menu(LAN_OPTIONS, $action, $var);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
require_once("footer.php");
|
2008-11-02 12:23:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Log event to admin log
|
|
|
|
|
function welcome_adminlog($msg_num='00', $id=0, $woffle='')
|
|
|
|
|
{
|
|
|
|
|
global $pref, $admin_log;
|
|
|
|
|
// if (!varset($pref['admin_log_log']['admin_welcome'],0)) return;
|
|
|
|
|
$msg = '';
|
|
|
|
|
if ($id) $msg = 'ID: '.$id;
|
|
|
|
|
if ($woffle)
|
|
|
|
|
{
|
|
|
|
|
if ($msg) $msg .= '[!br!]';
|
|
|
|
|
$msg .= $woffle;
|
|
|
|
|
}
|
|
|
|
|
$admin_log->log_event('WELCOME_'.$msg_num,$msg,E_LOG_INFORMATIVE,'');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-12-02 04:36:16 +00:00
|
|
|
|
?>
|