function DoAction($action, $id, $params, $returnid = -1)
 {
     @set_time_limit(9999);
     switch ($action) {
         case 'recurseinstall':
             die('call installmodule action');
             // fallback through to call the action.xxxx.php file
         // fallback through to call the action.xxxx.php file
         default:
             parent::DoAction($action, $id, $params, $returnid);
             break;
     }
 }
Example #2
0
 function DoAction($action, $id, $params, $returnid = -1)
 {
     global $gCms;
     $smarty =& $gCms->GetSmarty();
     $smarty->assign_by_ref('mod', $this);
     switch ($action) {
         case 'default':
             break;
         case 'setadminprefs':
             $this->_SetAdminPrefs($id, $params, $returnid);
             break;
         default:
             parent::DoAction($action, $id, $params, $returnid);
     }
 }
Example #3
0
 function DoAction($action, $id, $params, $returnid = -1)
 {
     switch ($action) {
         case 'installmodule':
             if ($this->CheckAccess($id, $params, $returnid, 'Modify Modules')) {
                 $this->_DoRecursiveInstall($id, $params, $returnid);
             }
             break;
         case 'doinstall':
             if ($this->CheckAccess($id, $params, $returnid, 'Modify Modules')) {
                 $this->_DoInstallLoop($id, $params, $returnid);
             }
             break;
         case 'modulehelp':
             $this->_DisplayAdminSoapModuleHelp($id, $params, $returnid);
             break;
         case 'moduledepends':
             $this->_DisplayAdminSoapModuleDepends($id, $params, $returnid);
             break;
         case 'moduleabout':
             $this->_DisplayAdminSoapModuleAbout($id, $params, $returnid);
             break;
         case 'recurseinstall':
             $this->_DoRecursiveInstall($id, $params, $returnid);
             // fallback through to call the action.xxxx.php file
         // fallback through to call the action.xxxx.php file
         default:
             parent::DoAction($action, $id, $params, $returnid);
             break;
     }
 }
 function DoAction($name, $id, $params, $returnid = '')
 {
     global $gCms;
     $smarty =& $gCms->GetSmarty();
     $this->module_id = $id;
     parent::DoAction($name, $id, $params, $returnid);
 }
 /**
  * A replacement for the built in DoAction method
  * For CGExtensions derived modules some  builtin smarty variables are created
  * module hints are handled,  and input type=image values are corrected in input parameters.
  *
  * this method also handles setting the active tab, and displaying any messages or errors
  * set with the SetError or SetMessage methods.
  *
  * This method is called automatically by the system based on the incoming request, and the page template.
  * It should almost never be called manually.
  *
  * @see SetError()
  * @see SetMessage()
  * @see SetCurrentTab()
  * @see RedirectToTab()
  * @param string $name the action name
  * @param string $id The module action id
  * @param array  $params The module parameters
  * @param int    $returnid  The page that will contain the HTML results.  This is empty for admin requests.
  */
 public function DoAction($name, $id, $params, $returnid = '')
 {
     if (!method_exists($this, 'set_action_id') && $this->GetName() != MOD_CGEXTENSIONS) {
         die('FATAL ERROR: A module derived from CGExtensions is not handling the set_action_id method');
     }
     $this->set_action_id($id);
     // handle the stupid input type='image' problem.
     foreach ($params as $key => $value) {
         if (endswith($key, '_x')) {
             $base = substr($key, 0, strlen($key) - 2);
             if (isset($params[$base . '_y']) && !isset($params[$base])) {
                 $params[$base] = $base;
             }
         }
     }
     // handle module hints
     $hints = cms_utils::get_app_data('__MODULE_HINT__' . $this->GetName());
     if (is_array($hints)) {
         foreach ($hints as $key => $value) {
             if (isset($params[$key])) {
                 continue;
             }
             $params[$key] = $value;
         }
     }
     /*
     if( !CmsApp::get_instance()->is_frontend_request() && $this->CheckPermission('Modify Modules') ) {
         // display module integrity stuff
         // only to people with appropriate permission, and only on admin requests
         // data is cached for one day (or until cache is cleared)
         $cge = \cms_utils::get_module(MOD_CGEXTENSIONS);
         $rec = \CGExtensions\internal\ModuleIntegrityTools::get_cached_status($this->GetName());
         switch( $rec['status'] ) {
         case -1: // no checksum stuff
             // only display this once per day
             if( !\cge_utils::done_today('module_sig'.$this->GetName()) ) {
                 $out = '<div class="cge_sig sig_error" title="'.$cge->Lang('info_vrfy_nodata').'"/>';
                 $out .= '<span>'.$rec['message'].'</span>';
                 $out .= '</div>';
                 $out .= '<div class="clearb"></div>';
                 echo $out;
             }
             break;
     
         case 0: // validation failed or some other error
             $out = '<div class="cge_sig sig_error" title="'.$cge->Lang('info_vrfy_failed').'"/>';
             $out .= '<span>'.$rec['message'].'</span>';
             $out .= '</div>';
             $out .= '<div class="clearb"></div>';
             echo $out;
             break;
     
         case 1:
             // it is all good, display the module signature.
             $out = '<div class="cge_sig" title="'.$cge->Lang('info_vrfy_signature').'"/>';
             $out .= $cge->Lang('module_signature').':';
             $out .= '<span>'.$rec['checksum'].'</span>';
             $out .= '</div>';
             $out .= '<div class="clearb"></div>';
             echo $out;
             break;
         }
     }
     */
     // redundant for cmsms 2.0
     $smarty = null;
     if (version_compare(CMS_VERSION, '2.0.1') < 0) {
         $smarty = Smarty_CMS::get_instance();
     } else {
         $smarty = $this->GetActionTemplateObject();
     }
     $smarty->assign('actionid', $id);
     $smarty->assign('actionparams', $params);
     $smarty->assign('returnid', $returnid);
     $smarty->assign('mod', $this);
     $smarty->assign($this->GetName(), $this);
     cge_tmpdata::set('module', $this->GetName());
     if ($returnid == '') {
         // admin action
         if (isset($params['cg_activetab'])) {
             $this->_current_tab = trim($params['cg_activetab']);
             unset($params['cg_activetab']);
         }
         if (isset($params['cg_error'])) {
             $this->_errormsg = explode(':err:', $params['cg_error']);
             unset($params['cg_error']);
         }
         if (isset($params['cg_message'])) {
             $this->_messages = explode(':msg:', $params['cg_message']);
             unset($params['cg_message']);
         }
         $this->DisplayErrors();
         $this->DisplayMessages();
     }
     parent::DoAction($name, $id, $params, $returnid);
 }
 public function DoAction($action, $id, $params, $returnid = '')
 {
     switch ($action) {
         case 'deleteMultiInput':
         case 'deleteMultiInputTpl':
         case 'default':
         case 'savePrefs':
         case 'defaultadmin':
         case 'addMultiInput':
         case 'editMultiInput':
         case 'addMultiInputTpl':
         case 'editMultiInputTpl':
             parent::DoAction($action, $id, $params, $returnid);
             break;
         default:
             break;
     }
 }
 public function DoAction($name, $id, $params, $returnid = '')
 {
     if (!method_exists($this, 'set_action_id') && $this->GetName() != 'CGExtensions') {
         die('FATAL ERROR: A module derived from CGExtensions is not handling the set_action_id method');
     }
     $this->set_action_id($id);
     // handle the stupid input type='image' problem.
     foreach ($params as $key => $value) {
         if (endswith($key, '_x')) {
             $base = substr($key, 0, strlen($key) - 2);
             if (isset($params[$base . '_y']) && !isset($params[$base])) {
                 $params[$base] = $base;
             }
         }
     }
     $smarty = cmsms()->GetSmarty();
     $smarty->assign('actionid', $id);
     $smarty->assign('actionparams', $params);
     $smarty->assign('returnid', $returnid);
     $smarty->assign_by_ref('mod', $this);
     $smarty->assign_by_ref($this->GetName(), $this);
     cge_tmpdata::set('module', $this->GetName());
     if ($returnid == '') {
         if (isset($params['cg_activetab'])) {
             $this->_current_tab = trim($params['cg_activetab']);
             unset($params['cg_activetab']);
         }
         if (isset($params['cg_error'])) {
             $this->_errormsg = explode(':err:', $params['cg_error']);
             unset($params['cg_error']);
         }
         if (isset($params['cg_message'])) {
             $this->_messages = explode(':msg:', $params['cg_message']);
             unset($params['cg_message']);
         }
         $this->DisplayErrors();
         $this->DisplayMessages();
     }
     $cge = $this->GetModuleInstance('CGExtensions');
     if ($cge->GetPreference('cache_modulecalls', 0) && (!isset($params['nocache']) || !$params['nocache']) && cms_cache_handler::can_cache()) {
         $key = '';
         if (isset($params['cache_key'])) {
             $key = trim($params['cache_key']);
         } else {
             $tmp = debug_backtrace();
             $bt = array();
             foreach ($tmp as $elem) {
                 $bt[] = $elem['file'] . ':' . $elem['line'];
             }
             $key = 'm' . md5($this->GetName() . serialize($params) . serialize($bt) . $id . $returnid);
         }
         $output = '';
         if (!cms_cache_handler::get_instance()->exists($key, 'cge_module')) {
             @ob_start();
             parent::DoAction($name, $id, $params, $returnid);
             $output = @ob_get_contents();
             @ob_end_clean();
             if (strlen($output)) {
                 cms_cache_handler::get_instance()->set($key, $output, 'cge_module');
             }
         } else {
             $output = cms_cache_handler::get_instance()->get($key, 'cge_module');
         }
         echo $output;
         return;
     }
     parent::DoAction($name, $id, $params, $returnid);
 }
 public function DoAction($name, $id, $params, $returnid = '')
 {
     //diversions
     switch ($name) {
         case 'default':
             $name = 'payplus';
             break;
     }
     parent::DoAction($name, $id, $params, $returnid);
 }
 function DoAction($name, $id, $params, $returnid = '')
 {
     //diversions
     switch ($name) {
         case 'addedit_comp':
             if (!empty($params['real_action'])) {
                 //'real_action' will be correctly set only if js is enabled
                 $task = substr($params['real_action'], strlen($id));
                 switch ($task) {
                     case 'apply':
                     case 'cancel':
                     case 'submit':
                         $name = 'save_comp';
                         break;
                     case 'addteam':
                         $name = 'addedit_team';
                         break;
                     case 'delteams':
                         $name = 'delete_team';
                         break;
                     case 'notify':
                     case 'abandon':
                     case 'getscore':
                     case 'export':
                         $name = 'multi_task';
                         break;
                     case 'chart':
                     case 'list':
                     case 'print':
                         $name = 'show_comp';
                         break;
                     case 'reset':
                         $name = 'schedule';
                         break;
                     case 'connect':
                         $params['real_action'] = $task;
                         break;
                     case 'import_team':
                     case 'schedule':
                     case 'upload_css':
                     case 'changelog':
                         $name = $task;
                         break;
                 }
                 if (substr($task, 0, 4) == 'edit') {
                     $name = 'addedit_team';
                 } elseif (substr($task, 0, 6) == 'update') {
                     $name = 'save_comp';
                 } elseif (substr($task, 0, 11) == 'delete_team') {
                     $name = 'delete_team';
                 } elseif (substr($task, 0, 8) == 'movedown') {
                     $params['real_action'] = $task;
                 } elseif (substr($task, 0, 6) == 'moveup') {
                     $params['real_action'] = $task;
                 }
             }
             break;
         case 'process_items':
             if (!empty($params['import'])) {
                 $name = 'import_comp';
             }
             break;
         case 'default':
             if (!empty($params['result'])) {
                 $name = 'result';
             }
             break;
         case 'result':
             if (empty($params['send'])) {
                 $name = 'default';
             }
             break;
         case 'addgroup':
             $name = 'defaultadmin';
             $params = array('showtab' => 1, 'addgroup' => TRUE);
             break;
     }
     parent::DoAction($name, $id, $params, $returnid);
 }
 function DoAction($name, $id, $params, $returnid = '')
 {
     $smarty = cmsms()->GetSmarty();
     $this->module_id = $id;
     parent::DoAction($name, $id, $params, $returnid);
 }