Пример #1
0
 function handleCommand(Zikula_Form_View $view, &$args)
 {
     if ($args['commandName'] == 'cancel') {
         $url = ModUtil::url('Scribite', 'admin', 'main');
         return $view->redirect($url);
     } else {
         if ($args['commandName'] == 'restore') {
             $classname = 'ModulePlugin_Scribite_' . $this->editor . '_Plugin';
             if (method_exists($classname, 'getDefaults')) {
                 $defaults = $classname::getDefaults();
                 if (!empty($defaults)) {
                     ModUtil::setVars("moduleplugin.scribite." . strtolower($this->editor), $defaults);
                     LogUtil::registerStatus('Defaults succesfully restored.');
                 }
             }
             return true;
         }
     }
     // check for valid form
     if (!$view->isValid()) {
         return false;
     }
     $data = $view->getValues();
     ModUtil::setVars("moduleplugin.scribite." . strtolower($this->editor), $data);
     LogUtil::registerStatus($this->__('Done! Module configuration updated.'));
     return true;
 }
Пример #2
0
 function handleCommand(Zikula_Form_View $view, &$args)
 {
     $url = ModUtil::url('Scribite', 'admin', 'main');
     if ($args['commandName'] == 'cancel') {
         return $view->redirect($url);
     }
     // check for valid form
     if (!$view->isValid()) {
         return false;
     }
     // get passed args and store to array
     $data = $view->getValues();
     $this->setVars($data);
     LogUtil::registerStatus($this->__('Done! Module configuration updated.'));
     return $view->redirect($url);
 }
Пример #3
0
    public function handleCommand(Zikula_Form_View $view, &$args)
    {
        switch($args['commandName']) {
            case 'cancel':
                break;
            case 'save':
                if (!$view->isValid()) {
                    return false;
                }
                $formValues = $view->getValues();
                $toname = (string)$formValues['toname'];
                $toaddress = (string)$formValues['toaddress'];
                $subject = (string)$formValues['subject'];
                $msgtype = (string)$formValues['msgtype'];
                $textBody = (string)$formValues['mailer_textbody'];
                $htmlBody = (string)$formValues['mailer_body'];

                $html = in_array($msgtype, array('html', 'multipart')) ? true : false;
                if ($html) {
                    $msgBody = $htmlBody;
                    $altBody = $textBody;
                } else {
                    $msgBody = $textBody;
                    $altBody = '';
                }

                // set the email
                $result = ModUtil::apiFunc('Mailer', 'user', 'sendmessage', array(
                    'toname' => $toname,
                    'toaddress' => $toaddress,
                    'subject' => $subject,
                    'body' => $msgBody,
                    'altbody' => $altBody,
                    'html' => $html)
                );

                // check our result and return the correct error code
                if ($result === true) {
                    // Success
                    LogUtil::registerStatus($this->__('Done! Message sent.'));
                } elseif ($result === false) {
                    // Failiure
                    LogUtil::registerError($this->__f('Error! Could not send message. %s', ''));
                } else {
                    // Failiure with error
                    LogUtil::registerError($this->__f('Error! Could not send message. %s', $result));
                }

                break;
        }

        return $view->redirect(ModUtil::url('Mailer', 'admin', 'testconfig'));
    }
Пример #4
0
 function handleCommand(Zikula_Form_View $view, &$args)
 {
     if ($args['commandName'] == 'cancel') {
         $url = ModUtil::url('BBSmile', 'admin', 'main');
         return $view->redirect($url);
     }
     // Security check
     if (!SecurityUtil::checkPermission('BBSmile::', '::', ACCESS_ADMIN)) {
         return LogUtil::registerPermissionError(ModUtil::url('BBSmile', 'admin', 'main'));
     }
     // check for valid form
     if (!$view->isValid()) {
         return false;
     }
     $ok = true;
     $data = $view->getValues();
     $ossmiliepath = DataUtil::formatForOS($data['smiliepath']);
     if (!file_exists($ossmiliepath) || !is_readable($ossmiliepath)) {
         $ifield = $this->view->getPluginById('smiliepath');
         $ifield->setError(DataUtil::formatForDisplay($this->__('The path does not exists or the system cannot read it.')));
         $ok = false;
     }
     $osautosmiliepath = DataUtil::formatForOS($data['smiliepath_auto']);
     if (!file_exists($osautosmiliepath) || !is_readable($osautosmiliepath)) {
         $ifield = $this->view->getPluginById('smiliepath_auto');
         $ifield->setError(DataUtil::formatForDisplay($this->__('The path does not exists or the system cannot read it.')));
         $ok = false;
     }
     if ($ok == false) {
         return false;
     }
     $this->setVar('smiliepath', $data['smiliepath']);
     $this->setVar('smiliepath_auto', $data['smiliepath_auto']);
     $this->setVar('activate_auto', $data['activate_auto']);
     $this->setVar('remove_inactive', $data['remove_inactive']);
     LogUtil::registerStatus($this->__('BBSmile configuration updated'));
     return true;
 }
Пример #5
0
    public function handleCommand(Zikula_Form_View $view, &$args)
    {
        switch($args['commandName']) {
            case 'cancel':
                break;
            case 'save':
                if (!$view->isValid()) {
                    return false;
                }
                $this->formValues = $view->getValues();

                // set our new module variable values
                $vars = array();
                $vars['mailertype'] = (int)$this->getFormValue('mailertype', 1);

                $vars['charset'] = (string)$this->getFormValue('charset', ZLanguage::getEncoding());

                $vars['encoding'] = (string)$this->getFormValue('encoding', '8bit');

                $vars['html'] = (bool)$this->getFormValue('html', false);

                $vars['wordwrap'] = (int)$this->getFormValue('wordwrap', 50);

                $vars['msmailheaders'] = (bool)$this->getFormValue('msmailheaders', false);

                $vars['sendmailpath'] = (string)$this->getFormValue('sendmailpath', '/usr/sbin/sendmail');

                $vars['smtpauth'] = (bool)$this->getFormValue('smtpauth', false);

                $vars['smtpserver'] = (string)$this->getFormValue('smtpserver', 'localhost');

                $vars['smtpport'] = (int)$this->getFormValue('smtpport', 25);

                $vars['smtptimeout'] = (int)$this->getFormValue('smtptimeout', 10);

                $vars['smtpusername'] = (string)$this->getFormValue('smtpusername', '');

                $vars['smtppassword'] = (string)$this->getFormValue('smtppassword', '');

                $vars['smtpsecuremethod'] = (string)$this->getFormValue('smtpsecuremethod', '');

                $this->setVars($vars);

                // the module configuration has been updated successfuly
                LogUtil::registerStatus($this->__('Done! Saved module configuration.'));
                break;
        }

        return $view->redirect(ModUtil::url('Mailer', 'admin', 'modifyconfig'));
    }
Пример #6
0
 /**
  * Handle form submission.
  *
  * @param Zikula_Form_View $view  Current Zikula_Form_View instance.
  * @param array            &$args Args.
  *
  * @return boolean
  */
 public function handleCommand(Zikula_Form_View $view, &$args)
 {
     // check for valid form
     if (!$view->isValid()) {
         return false;
     }
     // load form values
     $data = $view->getValues();
     $user = $this->_user;
     // merge attributes
     foreach ($data['attributes'] as $name => $value) {
         $user->setAttribute($name, $value);
     }
     // merge metadata
     $metadata = $user->getMetadata();
     if ($metadata == null) {
         $metadata = new ExampleDoctrine_Entity_UserMetadata($user);
         $user->setMetadata($metadata);
     }
     $metadata->merge($data['meta']);
     unset($data['attributes'], $data['meta']);
     // merge user and save everything
     $user->merge($data);
     $this->entityManager->persist($user);
     $this->entityManager->flush();
     return $view->redirect(ModUtil::url('ExampleDoctrine', 'user', 'view'));
 }