示例#1
0
 function display($tpl = null)
 {
     require_once JPATH_SITE . '/components/com_proofreader/helpers/layout.php';
     $this->donate = ProofreaderLayoutHelper::render('donate', array(), JPATH_ADMINISTRATOR . '/components/com_proofreader/layouts');
     $this->version = ProofreaderHelper::getVersion();
     JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
     JHtml::_('proofreader.stylesheet');
     JHtml::_('behavior.framework');
     if (version_compare(JVERSION, '3.0', 'ge')) {
         ProofreaderHelper::addSubmenu('about');
         $this->bootstrap = true;
         $this->sidebar = JHtmlSidebar::render();
     } else {
         ProofreaderHelper::addSubmenu('about');
     }
     $this->addToolbar();
     parent::display($tpl);
 }
示例#2
0
 public static function getForm($url = null, $title = null)
 {
     self::initialize();
     $model = JModelLegacy::getInstance('Typo', 'ProofreaderModel');
     if (empty($url)) {
         $url = JURI::getInstance()->toString();
     }
     if (empty($title)) {
         $title = JFactory::getDocument()->getTitle();
     }
     $data = array();
     $data['page_url'] = $url;
     $data['page_title'] = $title;
     $data['hash'] = md5($url . JFactory::getConfig()->get('secret'));
     $displayData = array();
     $displayData['action'] = JRoute::_('index.php?option=com_proofreader&task=typo.submit');
     $displayData['form'] = $model->getForm($data);
     $html = ProofreaderLayoutHelper::render('form', $displayData, JPATH_SITE . '/components/com_proofreader/layouts');
     return $html;
 }
示例#3
0
 /**
  * Method to save the form data.
  *
  * @param  array $data The form data.
  *
  * @return boolean  True on success, False on error.
  */
 public function save($data)
 {
     $table = $this->getTable();
     $user = JFactory::getUser();
     if (!$table->bind($data)) {
         $this->setError($table->getError());
         return false;
     }
     $table->id = 0;
     $table->page_language = JFactory::getLanguage()->getTag();
     $table->created = JFactory::getDate()->toSql();
     $table->created_by = $user->get('id');
     $table->created_by_ip = JFactory::getApplication()->input->server->get('REMOTE_ADDR', '', 'string');
     $table->created_by_name = $user->get('name');
     if (!$table->check()) {
         $this->setError($table->getError());
         return false;
     }
     if (!$table->store()) {
         $this->setError($table->getError());
         return false;
     }
     $params = JComponentHelper::getParams('com_proofreader', true);
     if ($params->get('notifications')) {
         $editorId = $params->get('editor');
         if (!empty($editorId)) {
             $config = JFactory::getConfig();
             $editor = JFactory::getUser($editorId);
             $subject = JText::sprintf('COM_PROOFREADER_NOTIFICATION_SUBJECT', $config->get('sitename'));
             $displayData = array();
             $displayData['page_url'] = $table->page_url;
             $displayData['page_title'] = $table->page_title;
             $displayData['typo_text'] = $table->typo_text;
             $displayData['typo_prefix'] = $table->typo_prefix;
             $displayData['typo_suffix'] = $table->typo_suffix;
             $displayData['typo_comment'] = $table->typo_comment;
             require_once JPATH_SITE . '/components/com_proofreader/helpers/layout.php';
             $body = ProofreaderLayoutHelper::render('notification', $displayData, JPATH_SITE . '/components/com_proofreader/layouts');
             $return = JFactory::getMailer()->sendMail($config->get('mailfrom'), $config->get('fromname'), $editor->email, $subject, $body, true);
             if ($return !== true) {
                 $this->setError(JText::_('COM_PROOFREADER_ERROR_NOTIFICATION_SEND_MAIL_FAILED'));
                 return false;
             }
         }
     }
     return true;
 }
示例#4
0
 function displayDonation()
 {
     require_once JPATH_SITE . '/components/com_proofreader/helpers/layout.php';
     $html = ProofreaderLayoutHelper::render('donate', array(), JPATH_ADMINISTRATOR . '/components/com_proofreader/layouts');
     echo $html;
 }