mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 12:48:26 +02:00
Fix for plugins extending admin-ui. Record ID was missing in 'create' mode. $id is now sent as a separate parameter to the "process" method. See e107_plugins/social/e_admin.php for an example.
This commit is contained in:
@@ -4071,7 +4071,13 @@ class e_admin_controller_ui extends e_admin_controller
|
|||||||
// Scenario I - use request owned POST data - toForm already executed
|
// Scenario I - use request owned POST data - toForm already executed
|
||||||
$model->setPostedData($_posted, null, false, false) // insert() or update() dbInsert();
|
$model->setPostedData($_posted, null, false, false) // insert() or update() dbInsert();
|
||||||
->save(true);
|
->save(true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// if(!empty($_POST))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Scenario II - inner model sanitize
|
// Scenario II - inner model sanitize
|
||||||
//$this->getModel()->setPosted($this->convertToData($_POST, null, false, true);
|
//$this->getModel()->setPosted($this->convertToData($_POST, null, false, true);
|
||||||
@@ -4081,7 +4087,9 @@ class e_admin_controller_ui extends e_admin_controller
|
|||||||
{
|
{
|
||||||
// callback (if any)
|
// callback (if any)
|
||||||
$new_data = $model->getData();
|
$new_data = $model->getData();
|
||||||
$id = $model->getId();
|
$id = $model->getId();
|
||||||
|
|
||||||
|
e107::getAddonConfig('e_admin',null,'process', $this, $id);
|
||||||
|
|
||||||
// Trigger Admin-ui event. 'post'
|
// Trigger Admin-ui event. 'post'
|
||||||
if($triggerName = $this->getEventTriggerName($_posted['etrigger_submit'],'after')) // 'created' or 'updated';
|
if($triggerName = $this->getEventTriggerName($_posted['etrigger_submit'],'after')) // 'created' or 'updated';
|
||||||
@@ -4272,10 +4280,7 @@ class e_admin_ui extends e_admin_controller_ui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($_POST))
|
|
||||||
{
|
|
||||||
e107::getAddonConfig('e_admin',null,'process', $this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1873,7 +1873,7 @@ class e107
|
|||||||
* @param string $methodName [optional] (if different from 'config')
|
* @param string $methodName [optional] (if different from 'config')
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getAddonConfig($addonName, $className = '', $methodName='config', $param=null )
|
public static function getAddonConfig($addonName, $className = '', $methodName='config', $param=null,$param2=null )
|
||||||
{
|
{
|
||||||
$new_addon = array();
|
$new_addon = array();
|
||||||
|
|
||||||
@@ -1896,7 +1896,7 @@ class e107
|
|||||||
include_once(e_PLUGIN.$key.'/'.$filename.'.php');
|
include_once(e_PLUGIN.$key.'/'.$filename.'.php');
|
||||||
|
|
||||||
$class_name = $key.'_'.$className;
|
$class_name = $key.'_'.$className;
|
||||||
$array = self::callMethod($class_name, $methodName,$param);
|
$array = self::callMethod($class_name, $methodName,$param,$param2);
|
||||||
|
|
||||||
if($array)
|
if($array)
|
||||||
{
|
{
|
||||||
@@ -1915,10 +1915,11 @@ class e107
|
|||||||
* Safe way to call user methods.
|
* Safe way to call user methods.
|
||||||
* @param string|object $class_name
|
* @param string|object $class_name
|
||||||
* @param string $method_name
|
* @param string $method_name
|
||||||
* @param string $param
|
* @param mixed $param -1st parameter sent to method
|
||||||
|
* @param mixed $param2 - 2nd parameter sent to method
|
||||||
* @return array|bool FALSE
|
* @return array|bool FALSE
|
||||||
*/
|
*/
|
||||||
public static function callMethod($class_name, $method_name, $param='')
|
public static function callMethod($class_name, $method_name, $param=null, $param2=null)
|
||||||
{
|
{
|
||||||
$mes = e107::getMessage();
|
$mes = e107::getMessage();
|
||||||
|
|
||||||
@@ -1941,7 +1942,7 @@ class e107
|
|||||||
{
|
{
|
||||||
$mes->addDebug('Executing <strong>'.$class_name.' :: '.$method_name.'()</strong>');
|
$mes->addDebug('Executing <strong>'.$class_name.' :: '.$method_name.'()</strong>');
|
||||||
}
|
}
|
||||||
return call_user_func(array($obj, $method_name),$param);
|
return call_user_func(array($obj, $method_name),$param, $param2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -57,10 +57,14 @@ class social_admin
|
|||||||
* Process Posted Data.
|
* Process Posted Data.
|
||||||
* @param $ui admin-ui object
|
* @param $ui admin-ui object
|
||||||
*/
|
*/
|
||||||
public function process($ui)
|
public function process($ui, $id=0)
|
||||||
{
|
{
|
||||||
$data = $ui->getPosted();
|
$data = $ui->getPosted();
|
||||||
|
$action = $ui->getAction(); // current mode: create, edit, list
|
||||||
//e107::getHybridAuth('twitter');
|
//e107::getHybridAuth('twitter');
|
||||||
|
e107::getMessage()->addDebug("e107_plugins/social/e_admin.php :: process method called.");
|
||||||
|
e107::getMessage()->addDebug("ID: ".$id);
|
||||||
|
e107::getMessage()->addDebug("Action: ".$action);
|
||||||
e107::getMessage()->addDebug(print_a($data,true));
|
e107::getMessage()->addDebug(print_a($data,true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user