Ejemplo n.º 1
0
 /**
  * This method provides a generic handling of all edit requests.
  *
  * @param string  $ot           Treated object type.
  * @param string  $tpl          Name of alternative template (for alternative display options, feeds and xml output)
  * @param boolean $raw          Optional way to display a template instead of fetching it (needed for standalone output)
  *
  * @return mixed Output.
  */
 public function edit()
 {
     $id = $this->request->query->filter('id', 0);
     if ($id > 0) {
         $url = ModUtil::url($this->name, 'user', 'view');
         return System::redirect($url);
     }
     $controllerHelper = new Reviews_Util_Controller($this->serviceManager);
     // parameter specifying which type of objects we are treating
     $objectType = $this->request->query->filter('ot', 'review', FILTER_SANITIZE_STRING);
     $utilArgs = array('controller' => 'user', 'action' => 'edit');
     if (!in_array($objectType, $controllerHelper->getObjectTypes('controllerAction', $utilArgs))) {
         $objectType = $controllerHelper->getDefaultObjectType('controllerAction', $utilArgs);
     }
     $this->throwForbiddenUnless(SecurityUtil::checkPermission($this->name . ':' . ucwords($objectType) . ':', '::', ACCESS_EDIT), LogUtil::getErrorMsgPermission());
     // create new Form reference
     $view = FormUtil::newForm($this->name, $this);
     // build form handler class name
     $handlerClass = $this->name . '_Form_Handler_User_' . ucfirst($objectType) . '_Edit';
     // determine the output template
     $viewHelper = new Reviews_Util_View($this->serviceManager);
     $template = $viewHelper->getViewTemplate($this->view, 'user', $objectType, 'edit', array());
     // execute form using supplied template and page event handler
     return $view->execute($template, new $handlerClass());
 }
Ejemplo n.º 2
0
 /**
  * Configuration screen.
  *
  * @return string Plugin configuration output.
  */
 public function configure()
 {
     // Create form
     $form = FormUtil::newForm($this->pluginName, $this);
     $form->setCompileId($this->pluginName);
     return $form->execute('configure.tpl', new Scribite_FormHandler_ModifyEditor());
 }
Ejemplo n.º 3
0
 public function modifyconfig()
 {
     $this->throwForbiddenUnless(SecurityUtil::checkPermission('Scribite::', '::', ACCESS_ADMIN), LogUtil::getErrorMsgPermission());
     // Create form
     $form = FormUtil::newForm('Scribite', $this);
     return $form->execute('admin/modifyconfig.tpl', new Scribite_FormHandler_ModifyConfig());
 }
Ejemplo n.º 4
0
 /**
  * Main Admin function
  */
 public function main()
 {
     if (!SecurityUtil::checkPermission('BBSmile::', '::', ACCESS_ADMIN)) {
         return LogUtil::registerPermissionError(System::getHomepageUrl());
     }
     $form = FormUtil::newForm('BBSmile', $this);
     return $form->execute('admin/modifyconfig.tpl', new BBSmile_Form_Handler_Admin_ModifyConfig());
 }
Ejemplo n.º 5
0
 /**
  * Create or edit record.
  *
  * @return string|boolean Output.
  */
 public function edit()
 {
     if (!SecurityUtil::checkPermission('ExampleDoctrine::', '::', ACCESS_ADD)) {
         return LogUtil::registerPermissionError(ModUtil::url('ExampleDoctrine', 'user', 'main'));
     }
     $form = FormUtil::newForm('ExampleDoctrine', $this);
     return $form->execute('exampledoctrine_user_edit.tpl', new ExampleDoctrine_Handler_Edit());
 }
Ejemplo n.º 6
0
    /**
     * This function displays a form to sent a test mail
     * @return string HTML string
     */
    public function testconfig()
    {
        $this->throwForbiddenUnless(SecurityUtil::checkPermission('Mailer::', '::', ACCESS_ADMIN));

        $form = FormUtil::newForm('Mailer', $this);

        return $form->execute('mailer_admin_testconfig.tpl', new Mailer_Form_Handler_TestConfig());
    }
Ejemplo n.º 7
0
 /**
  * This method takes care of the application configuration.
  *
  * @return string Output
  */
 public function getVideos()
 {
     // DEBUG: permission check aspect starts
     $this->throwForbiddenUnless(SecurityUtil::checkPermission('MUVideo::', '::', ACCESS_EDIT));
     // DEBUG: permission check aspect ends
     // parameter specifying which type of objects we are treating
     $objectType = isset($args['ot']) && !empty($args['ot']) ? $args['ot'] : $this->request->getGet()->filter('ot', 'collection', FILTER_SANITIZE_STRING);
     $utilArgs = array('controller' => 'user', 'action' => 'getVideos');
     if (!in_array($objectType, MUVideo_Util_Controller::getObjectTypes('controllerAction', $utilArgs))) {
         $objectType = MUVideo_Util_Controller::getDefaultObjectType('controllerAction', $utilArgs);
     }
     // create new Form reference
     $view = FormUtil::newForm($this->name, $this);
     // build form handler class name
     $handlerClass = 'MUVideo_Form_Handler_' . ucfirst($objectType) . '_GetVideos';
     // determine the output template
     $viewHelper = new MUVideo_Util_View($this->serviceManager);
     $template = $viewHelper->getViewTemplate($this->view, $objectType, 'getVideos', array());
     // execute form using supplied template and page event handler
     return $view->execute($template, new $handlerClass());
 }
Ejemplo n.º 8
0
 /**
  * modify the configuration
  *
  * @author       J?rg Napp, Frank Schummertz
  * @return       output       The modify config page.
  */
 public function modifyconfig()
 {
     if (!SecurityUtil::checkPermission('Avatar::', '::', ACCESS_ADMIN)) {
         return LogUtil::registerPermissionError();
     }
     // Create output object
     $avatarform = FormUtil::newForm('Avatar', $this);
     // Return the output that has been generated by this function
     return $avatarform->execute('Avatar_admin_modifyconfig.htm', new Avatar_Form_Handler_Admin_ModifyConfig());
 }
Ejemplo n.º 9
0
 /**
  * Modify a comment
  *
  * This is a standard function that is called whenever an comment owner
  * wishes to modify a comment
  *
  * @param  tid the id of the comment to be modified
  * @return string the modification page
  */
 public function modify($args)
 {
     // get our input
     $id = isset($args['id']) ? $args['id'] : FormUtil::getPassedValue('id', null, 'GETPOST');
     // Security check
     $securityCheck = ModUtil::apiFunc('EZComments', 'user', 'checkPermission', array('module' => '', 'objectid' => '', 'commentid' => $id, 'level' => ACCESS_EDIT));
     if (!$securityCheck) {
         $redirect = base64_decode(FormUtil::getPassedValue('redirect'));
         if (!isset($redirect)) {
             $redirect = System::getHomepageUrl();
         }
         return LogUtil::registerPermissionError($redirect);
     }
     // Create Form output object
     $render = FormUtil::newForm('EZComments', $this);
     // Return the output that has been generated by this function
     return $render->execute("ezcomments_user_modify.tpl", new EZComments_Form_Handler_User_Modify());
 }
Ejemplo n.º 10
0
 /**
  * This method provides a generic handling of all edit requests.
  *
  * @param string  $ot           Treated object type.
  * @param string  $tpl          Name of alternative template (for alternative display options, feeds and xml output)
  * @param boolean $raw          Optional way to display a template instead of fetching it (needed for standalone output)
  * @return mixed Output.
  */
 public function edit($args)
 {
     // DEBUG: permission check aspect starts
     $this->throwForbiddenUnless(SecurityUtil::checkPermission('MUBoard::', '::', ACCESS_EDIT));
     // DEBUG: permission check aspect ends
     // parameter specifying which type of objects we are treating
     $objectType = isset($args['ot']) && !empty($args['ot']) ? $args['ot'] : $this->request->getGet()->filter('ot', 'category', FILTER_SANITIZE_STRING);
     $utilArgs = array('controller' => 'user', 'action' => 'edit');
     if (!in_array($objectType, MUBoard_Util_Controller::getObjectTypes('controllerAction', $utilArgs))) {
         $objectType = MUBoard_Util_Controller::getDefaultObjectType('controllerAction', $utilArgs);
     }
     // create new Form reference
     $view = FormUtil::newForm($this->name, $this);
     // build form handler class name
     $handlerClass = 'MUBoard_Form_Handler_User_' . ucfirst($objectType) . '_Edit';
     // execute form using supplied template and page event handler
     return $view->execute('user/' . $objectType . '/edit.tpl', new $handlerClass());
 }
Ejemplo n.º 11
0
 /**
  * This method takes care of the application configuration.
  *
  * @return string Output
  */
 public function config()
 {
     $this->throwForbiddenUnless(SecurityUtil::checkPermission($this->name . '::', '::', ACCESS_ADMIN));
     // Create new Form reference
     $view = FormUtil::newForm($this->name, $this);
     // Execute form using supplied template and page event handler
     return $view->execute('admin/config.tpl', new MUBoard_Form_Handler_Admin_Config());
 }
Ejemplo n.º 12
0
 /**
  * Restore deleted pages
  * @param <type> $args
  * @return <type>
  */
 public function deletedpages($args)
 {
     $view = FormUtil::newForm('Content', $this);
     return $view->execute('admin/deletedpages.tpl', new Content_Form_Handler_Admin_DeletedPages($args));
 }
Ejemplo n.º 13
0
 /**
  * Modify configuration
  *
  * This is a standard function to modify the configuration parameters of the
  * module
  *
  * @return string The configuration page
  */
 public function modifyconfig()
 {
     // Security check
     if (!SecurityUtil::checkPermission('EZComments::', '::', ACCESS_ADMIN)) {
         return LogUtil::registerPermissionError();
     }
     // Create Form output object
     $render = FormUtil::newForm('EZComments', $this);
     // Return the output that has been generated by this function
     return $render->execute('ezcomments_admin_modifyconfig.tpl', new EZComments_Form_Handler_Admin_ModifyConfig());
 }
Ejemplo n.º 14
0
 /**
  * This method provides a handling of edit requests.
  *
  * @param string  $tpl          Name of alternative template (to be used instead of the default template).
  * @param boolean $raw          Optional way to display a template instead of fetching it (required for standalone output).
  *
  * @return mixed Output.
  */
 public function edit()
 {
     $legacyControllerType = $this->request->query->filter('lct', 'user', FILTER_SANITIZE_STRING);
     System::queryStringSetVar('type', $legacyControllerType);
     $this->request->query->set('type', $legacyControllerType);
     $controllerHelper = new MUVideo_Util_Controller($this->serviceManager);
     // parameter specifying which type of objects we are treating
     $objectType = 'movie';
     $utilArgs = array('controller' => 'movie', 'action' => 'edit');
     $permLevel = $legacyControllerType == 'admin' ? ACCESS_ADMIN : ACCESS_EDIT;
     $this->throwForbiddenUnless(SecurityUtil::checkPermission($this->name . ':' . ucfirst($objectType) . ':', '::', $permLevel), LogUtil::getErrorMsgPermission());
     // create new Form reference
     $view = FormUtil::newForm($this->name, $this);
     // build form handler class name
     $handlerClass = $this->name . '_Form_Handler_Movie_Edit';
     // determine the output template
     $viewHelper = new MUVideo_Util_View($this->serviceManager);
     $template = $viewHelper->getViewTemplate($this->view, $objectType, 'edit', array());
     // execute form using supplied template and page event handler
     return $view->execute($template, new $handlerClass());
 }