mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 12:48:26 +02:00
Updated e_notify.php to v2.x spec.
This commit is contained in:
@@ -30,7 +30,9 @@ require_once('auth.php');
|
|||||||
require_once(e_HANDLER.'userclass_class.php');
|
require_once(e_HANDLER.'userclass_class.php');
|
||||||
|
|
||||||
$frm = e107::getForm();
|
$frm = e107::getForm();
|
||||||
|
|
||||||
$nc = new notify_config;
|
$nc = new notify_config;
|
||||||
|
|
||||||
$uc = new user_class;
|
$uc = new user_class;
|
||||||
$mes = e107::getMessage();
|
$mes = e107::getMessage();
|
||||||
|
|
||||||
@@ -55,6 +57,7 @@ if (isset($_POST['update']))
|
|||||||
|
|
||||||
// $ns -> tablerender($message,"<div style='text-align:center'>".$message."</div>");
|
// $ns -> tablerender($message,"<div style='text-align:center'>".$message."</div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
$nc -> config();
|
$nc -> config();
|
||||||
|
|
||||||
|
|
||||||
@@ -62,8 +65,9 @@ class notify_config
|
|||||||
{
|
{
|
||||||
var $notify_prefs;
|
var $notify_prefs;
|
||||||
var $changeList = array();
|
var $changeList = array();
|
||||||
|
var $pluginConfig = array();
|
||||||
|
|
||||||
function notify_config()
|
function __construct()
|
||||||
{
|
{
|
||||||
global $sysprefs, $eArrayStorage;
|
global $sysprefs, $eArrayStorage;
|
||||||
$ns = e107::getRender();
|
$ns = e107::getRender();
|
||||||
@@ -79,33 +83,62 @@ class notify_config
|
|||||||
// load every e_notify.php file.
|
// load every e_notify.php file.
|
||||||
if($pref['e_notify_list'])
|
if($pref['e_notify_list'])
|
||||||
{
|
{
|
||||||
foreach($pref['e_notify_list'] as $val)
|
foreach($pref['e_notify_list'] as $val) // List of available e_notify.php files.
|
||||||
{
|
{
|
||||||
if (!isset($this -> notify_prefs['plugins'][$val]))
|
// if (!isset($this->notify_prefs['plugins'][$val]))
|
||||||
{
|
{
|
||||||
|
|
||||||
$this -> notify_prefs['plugins'][$val] = TRUE;
|
$this -> notify_prefs['plugins'][$val] = TRUE;
|
||||||
|
|
||||||
if (is_readable(e_PLUGIN.$val."/e_notify.php"))
|
if (is_readable(e_PLUGIN.$val."/e_notify.php"))
|
||||||
{
|
{
|
||||||
require_once(e_PLUGIN.$val.'/e_notify.php');
|
require_once(e_PLUGIN.$val.'/e_notify.php');
|
||||||
foreach ($config_events as $event_id => $event_text)
|
|
||||||
{
|
if(class_exists($val."_notify")) // new v2.x
|
||||||
$this -> notify_prefs['event'][$event_id] = array('class' => '255', 'email' => '');
|
{
|
||||||
|
$legacy = 0; // Newe.
|
||||||
|
$config_events = array();
|
||||||
|
|
||||||
|
$data = e107::callMethod($val."_notify", 'config');
|
||||||
|
|
||||||
|
$config_category = str_replace("_menu","",ucfirst($val))." Events";
|
||||||
|
|
||||||
|
foreach($data as $v)
|
||||||
|
{
|
||||||
|
$func = $v['function'];
|
||||||
|
$config_events[$func] = $v['name'];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$legacy = 1; // Legacy Mode.
|
||||||
|
}
|
||||||
|
|
||||||
|
// foreach ($config_events as $event_id => $event_text)
|
||||||
|
// {
|
||||||
|
// $this -> notify_prefs['event'][$event_id] = array('class' => '255', 'email' => '', 'plugin'=> $val);
|
||||||
|
|
||||||
|
// }
|
||||||
|
$this->pluginConfig[$val] = array('category' => $config_category, 'events' => $config_events, 'legacy'=> $legacy);
|
||||||
$recalibrate = true;
|
$recalibrate = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// print_a($this->pluginConfig);
|
||||||
|
|
||||||
if ($recalibrate)
|
if ($recalibrate)
|
||||||
{
|
{
|
||||||
$s_prefs = $tp -> toDB($this -> notify_prefs);
|
$s_prefs = $tp -> toDB($this -> notify_prefs);
|
||||||
$s_prefs = $eArrayStorage -> WriteArray($s_prefs);
|
$s_prefs = $eArrayStorage -> WriteArray($s_prefs);
|
||||||
$sql -> db_Update("core", "e107_value='".$s_prefs."' WHERE e107_name='notify_prefs'");
|
// $sql -> db_Update("core", "e107_value='".$s_prefs."' WHERE e107_name='notify_prefs'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function config()
|
function config()
|
||||||
{
|
{
|
||||||
//global $ns, $rs, $frm, $emessage;
|
//global $ns, $rs, $frm, $emessage;
|
||||||
@@ -212,14 +245,15 @@ class notify_config
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
</div>";
|
</div>";
|
||||||
|
|
||||||
|
foreach ($this->notify_prefs['plugins'] as $plugin_id => $plugin_settings)
|
||||||
|
|
||||||
foreach ($this -> notify_prefs['plugins'] as $plugin_id => $plugin_settings)
|
|
||||||
{
|
{
|
||||||
if(is_readable(e_PLUGIN.$plugin_id.'/e_notify.php'))
|
if(is_readable(e_PLUGIN.$plugin_id.'/e_notify.php'))
|
||||||
{
|
{
|
||||||
require(e_PLUGIN.$plugin_id.'/e_notify.php');
|
$config_category = $this->pluginConfig[$plugin_id]['category'];
|
||||||
//$text .= "</fieldset>
|
$legacy = $this->pluginConfig[$plugin_id]['legacy'];
|
||||||
|
|
||||||
|
// require(e_PLUGIN.$plugin_id.'/e_notify.php');
|
||||||
|
|
||||||
$text .= "<div class='tab-pane' id='notify-".$plugin_id."'>
|
$text .= "<div class='tab-pane' id='notify-".$plugin_id."'>
|
||||||
<fieldset id='core-notify-".str_replace(" ","_",$config_category)."'>
|
<fieldset id='core-notify-".str_replace(" ","_",$config_category)."'>
|
||||||
<legend>".$config_category."</legend>
|
<legend>".$config_category."</legend>
|
||||||
@@ -228,10 +262,13 @@ class notify_config
|
|||||||
<col class='col-label' />
|
<col class='col-label' />
|
||||||
<col class='col-control' />
|
<col class='col-control' />
|
||||||
</colgroup>";
|
</colgroup>";
|
||||||
foreach ($config_events as $event_id => $event_text)
|
;
|
||||||
|
|
||||||
|
foreach ($this->pluginConfig[$plugin_id]['events'] as $event_id => $event_text)
|
||||||
{
|
{
|
||||||
$text .= $this -> render_event($event_id, $event_text);
|
$text .= $this->render_event($event_id, $event_text, $plugin_id, $legacy);
|
||||||
}
|
}
|
||||||
|
|
||||||
$text .= "</table>
|
$text .= "</table>
|
||||||
</div>";
|
</div>";
|
||||||
}
|
}
|
||||||
@@ -251,16 +288,17 @@ class notify_config
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function render_event($id, $description)
|
function render_event($id, $description, $include='', $legacy = 0)
|
||||||
{
|
{
|
||||||
global $uc; // $rs
|
global $uc; // $rs
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
|
$frm = e107::getForm();
|
||||||
|
|
||||||
$text = "
|
$text = "
|
||||||
<tr>
|
<tr>
|
||||||
<td >".$description.": </td>
|
<td >".$description.": </td>
|
||||||
<td class='nowrap'>
|
<td class='nowrap'>
|
||||||
".$uc->uc_dropdown('event['.$id.'][class]', $this -> notify_prefs['event'][$id]['class'],"nobody,main,admin,member,classes,email","onchange=\"mail_field(this.value,'event_".$id."');\" ");
|
".$uc->uc_dropdown('event['.$id.'][class]', varset($this->notify_prefs['event'][$id]['class'],255), "nobody,main,admin,member,classes,email","onchange=\"mail_field(this.value,'event_".$id."');\" ");
|
||||||
|
|
||||||
if($this -> notify_prefs['event'][$id]['class'] == 'email')
|
if($this -> notify_prefs['event'][$id]['class'] == 'email')
|
||||||
{
|
{
|
||||||
@@ -275,6 +313,9 @@ class notify_config
|
|||||||
|
|
||||||
$text .= "<input type='text' style='width:180px;$disp' class='tbox' id='event_".$id."' name='event[".$id."][email]' value=\"".$value."\" />\n";
|
$text .= "<input type='text' style='width:180px;$disp' class='tbox' id='event_".$id."' name='event[".$id."][email]' value=\"".$value."\" />\n";
|
||||||
|
|
||||||
|
$text .= $frm->hidden("event[".$id."][include]", $include);
|
||||||
|
$text .= $frm->hidden("event[".$id."][legacy]", $legacy); // function or method
|
||||||
|
|
||||||
$text .= "</td>
|
$text .= "</td>
|
||||||
</tr>";
|
</tr>";
|
||||||
return $text;
|
return $text;
|
||||||
@@ -301,6 +342,8 @@ class notify_config
|
|||||||
$pref['notify'] = FALSE;
|
$pref['notify'] = FALSE;
|
||||||
}
|
}
|
||||||
save_prefs();
|
save_prefs();
|
||||||
|
|
||||||
|
// print_a($this->notify_prefs);
|
||||||
/*
|
/*
|
||||||
$s_prefs = $tp -> toDB($this -> notify_prefs);
|
$s_prefs = $tp -> toDB($this -> notify_prefs);
|
||||||
$s_prefs = $eArrayStorage -> WriteArray($s_prefs);
|
$s_prefs = $eArrayStorage -> WriteArray($s_prefs);
|
||||||
@@ -333,6 +376,13 @@ class notify_config
|
|||||||
$this -> notify_prefs['event'][$id]['email'] = $_POST['event'][$id]['email'];
|
$this -> notify_prefs['event'][$id]['email'] = $_POST['event'][$id]['email'];
|
||||||
$changed = TRUE;
|
$changed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this -> notify_prefs['event'][$id]['include'] = $_POST['event'][$id]['include'];
|
||||||
|
$this -> notify_prefs['event'][$id]['legacy'] = $_POST['event'][$id]['legacy'];
|
||||||
|
|
||||||
|
unset($this -> notify_prefs['event'][$id]['plugin']);
|
||||||
|
unset($this -> notify_prefs['event'][$id]['type']);
|
||||||
|
|
||||||
if ($changed)
|
if ($changed)
|
||||||
{
|
{
|
||||||
$this->changeList[$id] = $this->notify_prefs['event'][$id]['class'].', '.$this->notify_prefs['event'][$id]['email'];
|
$this->changeList[$id] = $this->notify_prefs['event'][$id]['class'].', '.$this->notify_prefs['event'][$id]['email'];
|
||||||
|
@@ -1263,6 +1263,7 @@ function update_706_to_800($type='')
|
|||||||
$notify_prefs['event'][$e]['class'] = e_UC_NOBODY; // Just disable if we don't know what else to do
|
$notify_prefs['event'][$e]['class'] = e_UC_NOBODY; // Just disable if we don't know what else to do
|
||||||
}
|
}
|
||||||
$nt_changed++;
|
$nt_changed++;
|
||||||
|
$notify_prefs['event'][$e]['legacy'] = 1;
|
||||||
unset($notify_prefs['event'][$e]['type']);
|
unset($notify_prefs['event'][$e]['type']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -39,6 +39,17 @@ class e107_event
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function debug()
|
||||||
|
{
|
||||||
|
|
||||||
|
print_a($this->functions);
|
||||||
|
print_a($this->includes);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trigger event
|
* Trigger event
|
||||||
* TODO - admin log for failed callback attempts?
|
* TODO - admin log for failed callback attempts?
|
||||||
@@ -109,6 +120,11 @@ class e107_event
|
|||||||
return (isset($ret) ? $ret : false);
|
return (isset($ret) ? $ret : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function triggerAdminEvent($type, $parms=array())
|
function triggerAdminEvent($type, $parms=array())
|
||||||
{
|
{
|
||||||
global $pref;
|
global $pref;
|
||||||
@@ -164,6 +180,7 @@ class e107_event
|
|||||||
{
|
{
|
||||||
$text = '';
|
$text = '';
|
||||||
$e_event_list = e107::getPref('e_event_list');
|
$e_event_list = e107::getPref('e_event_list');
|
||||||
|
|
||||||
if(is_array($e_event_list))
|
if(is_array($e_event_list))
|
||||||
{
|
{
|
||||||
foreach($e_event_list as $hook)
|
foreach($e_event_list as $hook)
|
||||||
|
@@ -33,7 +33,27 @@ class notify
|
|||||||
{
|
{
|
||||||
if ($status['class'] != 255)
|
if ($status['class'] != 255)
|
||||||
{
|
{
|
||||||
$e_event->register($id, 'notify_'.$id);
|
if($status['include']) // Plugin
|
||||||
|
{
|
||||||
|
$include = e_PLUGIN.$status['include']."/e_notify.php";
|
||||||
|
|
||||||
|
if($status['legacy'] != 1)
|
||||||
|
{
|
||||||
|
$class = $status['include']."_notify";
|
||||||
|
$method = $id;
|
||||||
|
$e_event->register($id, array($class, $method), $include);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$e_event->register($id, 'notify_'.$id, $include);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // core
|
||||||
|
{
|
||||||
|
$e_event->register($id, 'notify_'.$id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -253,7 +273,7 @@ function notify_fileupload($data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (isset($nt->notify_prefs['plugins']))
|
if (isset($nt->notify_prefs['plugins']) && e_PAGE != 'notify.php')
|
||||||
{
|
{
|
||||||
foreach ($nt->notify_prefs['plugins'] as $plugin_id => $plugin_settings)
|
foreach ($nt->notify_prefs['plugins'] as $plugin_id => $plugin_settings)
|
||||||
{
|
{
|
||||||
|
@@ -2,25 +2,19 @@
|
|||||||
/*
|
/*
|
||||||
* e107 website system
|
* e107 website system
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
||||||
* Released under the terms and conditions of the
|
* Released under the terms and conditions of the
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/chatbox_menu/e_notify.php,v $
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
/*
|
||||||
if(defined('ADMIN_PAGE') && ADMIN_PAGE === true)
|
if(defined('ADMIN_PAGE') && ADMIN_PAGE === true)
|
||||||
{
|
{
|
||||||
include_lan(e_PLUGIN."chatbox_menu/languages/".e_LANGUAGE."/".e_LANGUAGE.".php");
|
include_lan(e_PLUGIN."chatbox_menu/languages/".e_LANGUAGE."/".e_LANGUAGE.".php");
|
||||||
$config_category = NT_LAN_CB_1;
|
// $config_category = NT_LAN_CB_1;
|
||||||
$config_events = array('cboxpost' => NT_LAN_CB_2);
|
// $config_events = array('cboxpost' => NT_LAN_CB_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -33,4 +27,36 @@ if (!function_exists('notify_cboxpost')) {
|
|||||||
$nt -> send('cboxpost', NT_LAN_CB_6, $message);
|
$nt -> send('cboxpost', NT_LAN_CB_6, $message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// v2.x Standard
|
||||||
|
class chatbox_menu_notify extends notify // plugin-folder + '_notify'
|
||||||
|
{
|
||||||
|
function config()
|
||||||
|
{
|
||||||
|
// include_lan(e_PLUGIN."chatbox_menu/languages/".e_LANGUAGE."/".e_LANGUAGE.".php"); Use English_global.php instead.
|
||||||
|
|
||||||
|
$config = array();
|
||||||
|
|
||||||
|
$config[] = array(
|
||||||
|
'name' => NT_LAN_CB_2, // "Message posted"
|
||||||
|
'function' => "cboxpost",
|
||||||
|
'category' => ''
|
||||||
|
);
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
function cboxpost($data)
|
||||||
|
{
|
||||||
|
include_lan(e_PLUGIN."chatbox_menu/languages/".e_LANGUAGE."/".e_LANGUAGE.".php"); // Use English_global.php instead.
|
||||||
|
|
||||||
|
$message = NT_LAN_CB_3.': '.USERNAME.' ('.NT_LAN_CB_4.': '.e107::getIPHandler()->ipDecode($data['ip']).' )<br />';
|
||||||
|
$message .= NT_LAN_CB_5.':<br />'.$data['cmessage'].'<br /><br />';
|
||||||
|
|
||||||
|
$this->send('cboxpost', NT_LAN_CB_6, $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -5,6 +5,7 @@ define("LAN_PLUGIN_CHATBOX_MENU_NAME", "Chatbox");
|
|||||||
define("LAN_PLUGIN_CHATBOX_MENU_DESCRIPTION", "Chatbox Menu");
|
define("LAN_PLUGIN_CHATBOX_MENU_DESCRIPTION", "Chatbox Menu");
|
||||||
|
|
||||||
// Admin Log
|
// Admin Log
|
||||||
|
//FIXME - Global LANS must begin with LAN_PLUGIN_{FOLDER_NAME}_
|
||||||
define("LAN_AL_CHBLAN_01","Chatbox settings updated");
|
define("LAN_AL_CHBLAN_01","Chatbox settings updated");
|
||||||
define("LAN_AL_CHBLAN_02","Chatbox pruned");
|
define("LAN_AL_CHBLAN_02","Chatbox pruned");
|
||||||
define("LAN_AL_CHBLAN_03","Chatbox posts recalculated");
|
define("LAN_AL_CHBLAN_03","Chatbox posts recalculated");
|
||||||
|
Reference in New Issue
Block a user