1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

Event trigger-name updates (backward compatible)

This commit is contained in:
Cameron 2015-02-09 02:21:41 -08:00
parent 1697b1474b
commit d018cef6de
6 changed files with 25 additions and 22 deletions

View File

@ -88,7 +88,7 @@ class banlist_ui extends e_admin_ui
{
protected $pluginTitle = BANLAN_16;
// protected $pluginName = 'myplugin';
protected $eventName = 'ban';
protected $table = 'banlist';
protected $pid = 'banlist_id';
protected $perPage = 10;

View File

@ -49,20 +49,9 @@ class comments_admin_ui extends e_admin_ui
protected $pluginTitle = LAN_COMMENTMAN;
protected $pluginName = 'core';
protected $eventName = 'comment';
protected $table = "comments";
/**
* If present this array will be used to build your list query
* You can link fileds from $field array with 'table' parameter, which should equal to a key (table) from this array
* 'leftField', 'rightField' and 'fields' attributes here are required, the rest is optional
*
* @var array [optional]
*/
// protected $tableJoin = array (
// 'u.user' => array('leftField' => 'comment_author_id', 'rightField' => 'user_id', 'fields' => '*'/*, 'leftTable' => '', 'joinType' => 'LEFT JOIN', 'whereJoin' => 'AND u.user_ban=0', 'where' => ''*/)
// );
//protected $listQry = "SELECT SQL_CALC_FOUND_ROWS * FROM #comments"; // without any Order or Limit.
protected $listQry = "SELECT c.*,u.user_name FROM #comments as c LEFT JOIN #user AS u ON c.comment_author_id = u.user_id ";
protected $listOrder = "comment_id desc";
//protected $editQry = "SELECT * FROM #comments WHERE comment_id = {ID}";

View File

@ -415,6 +415,7 @@ class page_admin_ui extends e_admin_ui
{
protected $pluginTitle = ADLAN_42;
protected $pluginName = 'core';
protected $eventName = 'page';
protected $table = "page";
protected $listQry = "SELECT SQL_CALC_FOUND_ROWS

View File

@ -86,6 +86,7 @@ class news_cat_ui extends e_admin_ui
{
protected $pluginTitle = ADLAN_0; // "News"
protected $pluginName = 'core';
protected $eventName = 'news-category';
protected $table = "news_category";
protected $pid = "category_id";
protected $perPage = 0; //no limit
@ -1287,6 +1288,7 @@ class admin_newspost
e107::getEvent()->trigger("newsdel", $del_id);
if($sql->delete("news", "news_id={$del_id}"))
{
e107::getEvent()->trigger("admin-news-delete", $del_id);
e107::getLog()->add('NEWS_01',$del_id,E_LOG_INFORMATIVE,'');
$this->show_message(NWSLAN_31." #".$del_id." ".NWSLAN_32, E_MESSAGE_SUCCESS);
$this->clear_cache();
@ -1561,8 +1563,8 @@ class admin_newspost
$this->show_message(NWSLAN_35, E_MESSAGE_SUCCESS);
$this->clear_cache();
//TODO - add to WIKI docs
e107::getEvent()->trigger("newscatpost", array_merge($inserta['data'], $rwinserta['data']));
e107::getEvent()->trigger("newscatpost", array_merge($inserta['data'], $rwinserta['data'])); // @deprecated
e107::getEvent()->trigger("admin-news-category-create", array_merge($inserta['data'], $rwinserta['data']));
}
else
{
@ -1670,8 +1672,9 @@ class admin_newspost
$this->show_message(NWSLAN_36, E_MESSAGE_SUCCESS);
$this->clear_cache();
//TODO - add to WIKI docs
e107::getEvent()->trigger("newscatupd", array_merge($updatea['data'], $inserta['data']));
e107::getEvent()->trigger("newscatupd", array_merge($updatea['data'], $inserta['data'])); // @deprecated
e107::getEvent()->trigger("admin-news-category-update", array_merge($updatea['data'], $inserta['data']));
}
else
{

View File

@ -47,13 +47,18 @@ if (isset($_POST['update_settings']))
$userData['WHERE'] = 'user_id='.USERID;
validatorClass::addFieldTypes($userMethods->userVettingInfo,$userData, $userMethods->otherFieldTypes);
$check = $sql -> db_Update('user',$userData);
$check = $sql->update('user',$userData);
if ($check)
{
e107::getLog()->add('ADMINPW_01', '', E_LOG_INFORMATIVE, '');
$userMethods->makeUserCookie(array('user_id' => USERID,'user_password' => $userData['data']['user_password']), FALSE); // Can't handle autologin ATM
$mes->addSuccess(UDALAN_3." ".ADMINNAME);
$e_event -> trigger('adpword');
$e_event->trigger('adpword'); //@deprecated
$eventData = array('user_id'=> USERID, 'user_pwchange'=> $userData['data']['user_pwchange']);
e107::getEvent()->trigger('admin-password-update',$eventData );
$ns->tablerender(UDALAN_2, $mes->render());
}
else

View File

@ -209,6 +209,7 @@ class download_main_admin_ui extends e_admin_ui
// required
protected $pluginTitle = LAN_PLUGIN_DOWNLOAD_NAME;
protected $pluginName = 'download';
protected $eventName = 'download';
protected $table = "download"; // DB Table, table alias is supported. Example: 'r.release'
protected $listQry = "SELECT m.*,u.user_id,u.user_name FROM #download AS m LEFT JOIN #user AS u ON m.download_author = u.user_id "; // without any Order or Limit.
@ -1781,11 +1782,13 @@ $columnInfo = array(
$this->downloadLog('DOWNL_06',$dlInfo,$dlMirrors);
$dlInfo['download_datestamp'] = $time; // This is what 0.7 did, regardless of settings
unset($dlInfo['download_class']); // Also replicating 0.7
$e_event->trigger('dlupdate', $dlInfo);
$e_event->trigger('dlupdate', $dlInfo); // @deprecated
e107::getEvent()->trigger('admin-download-update',$dlInfo);
}
else // Its a new entry.
{
if ($download_id = $sql->db_Insert('download',array_merge($dlInfo,$dlMirrors)))
if ($download_id = $sql->insert('download',array_merge($dlInfo,$dlMirrors)))
{
// Process triggers before calling admin_update so trigger messages can be shown
$data = array('method'=>'create', 'table'=>'download', 'id'=>$download_id, 'plugin'=>'download', 'function'=>'create_download');
@ -1799,7 +1802,9 @@ $columnInfo = array(
$this->downloadLog('DOWNL_05',$dlInfo,$dlMirrors);
$dlInfo['download_datestamp'] = $time; // This is what 0.7 did, regardless of settings
unset($dlInfo['download_class']); // Also replicating 0.7
$e_event->trigger("dlpost", $dlInfo);
$e_event->trigger("dlpost", $dlInfo); // @deprecated
e107::getEvent()->trigger('admin-download-create',$dlInfo);
if ($_POST['remove_upload'])
{