Exemplo n.º 1
3
 /**
  * Method to toggle the featured setting of a list of articles.
  *
  * @return	void
  * @since	1.6
  */
 function featured()
 {
     // Check for request forgeries
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     // Initialise variables.
     $user = JFactory::getUser();
     $ids = JRequest::getVar('cid', array(), '', 'array');
     $values = array('featured' => 1, 'unfeatured' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($values, $task, 0, 'int');
     // Access checks.
     foreach ($ids as $i => $id) {
         if (!$user->authorise('core.edit.state', 'com_content.article.' . (int) $id)) {
             // Prune items that you can't change.
             unset($ids[$i]);
             JError::raiseNotice(403, JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));
         }
     }
     if (empty($ids)) {
         JError::raiseWarning(500, JText::_('JERROR_NO_ITEMS_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Publish the items.
         if (!$model->featured($ids, $value)) {
             JError::raiseWarning(500, $model->getError());
         }
     }
     $this->setRedirect('index.php?option=com_content&view=articles');
 }
 public function delete()
 {
     // Check for request forgeries
     JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
     // Get items to remove from the request.
     $cid = JFactory::getApplication()->input->get('cid', array(), 'array');
     if (!is_array($cid) || count($cid) < 1) {
         JLog::add(JText::_($this->text_prefix . '_NO_ITEM_SELECTED'), JLog::WARNING, 'jerror');
     } else {
         // Get the model.
         $model = $this->getModel();
         // Make sure the item ids are integers
         jimport('joomla.utilities.arrayhelper');
         JArrayHelper::toInteger($cid);
         // Remove the items.
         if ($model->delete($cid)) {
             $this->setMessage(JText::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid)));
         } else {
             $this->setMessage($model->getError());
         }
     }
     $version = new JVersion();
     if ($version->isCompatible('3.0')) {
         // Invoke the postDelete method to allow for the child class to access the model.
         $this->postDeleteHook($model, $cid);
     }
     $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
 }
Exemplo n.º 3
0
 /**
  * Stick items
  *
  * @return  void
  *
  * @since   1.6
  */
 public function sticky_publish()
 {
     // Check for request forgeries.
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $ids = $this->input->get('cid', array(), 'array');
     $values = array('sticky_publish' => 1, 'sticky_unpublish' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($values, $task, 0, 'int');
     if (empty($ids)) {
         JError::raiseWarning(500, JText::_('COM_BANNERS_NO_BANNERS_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Change the state of the records.
         if (!$model->stick($ids, $value)) {
             JError::raiseWarning(500, $model->getError());
         } else {
             if ($value == 1) {
                 $ntext = 'COM_BANNERS_N_BANNERS_STUCK';
             } else {
                 $ntext = 'COM_BANNERS_N_BANNERS_UNSTUCK';
             }
             $this->setMessage(JText::plural($ntext, count($ids)));
         }
     }
     $this->setRedirect('index.php?option=com_banners&view=banners');
 }
Exemplo n.º 4
0
 /**
  * Method to request a username reminder.
  *
  * @return  boolean
  *
  * @since   1.6
  */
 public function remind()
 {
     // Check the request token.
     JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN'));
     $model = $this->getModel('Remind', 'UsersModel');
     $data = $this->input->post->get('jform', array(), 'array');
     // Submit the password reset request.
     $return = $model->processRemindRequest($data);
     // Check for a hard error.
     if ($return == false) {
         // The request failed.
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getRemindRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=remind' . $itemid;
         // Go back to the request form.
         $message = JText::sprintf('Request failed: Your account is not activated yet or is under review. Please contact the admin more for details.', $model->getError());
         $this->setRedirect(JRoute::_($route, false), $message, 'notice');
         return false;
     } else {
         // The request succeeded.
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getRemindRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=login' . $itemid;
         // Proceed to step two.
         $message = JText::_('COM_USERS_REMIND_REQUEST_SUCCESS');
         $this->setRedirect(JRoute::_($route, false), $message);
         return true;
     }
 }
 /**
  * Method to toggle the featured setting of a list of memberss.
  *
  * @return    void
  *
  * @since    1.7.0
  */
 public function featured()
 {
     // Check for request forgeries
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     // Initialise variables.
     $user = JFactory::getUser();
     $app = JFactory::getApplication();
     $ids = $app->input->get('id', [], 'array');
     $task = $this->getTask();
     $value = Joomla\Utilities\ArrayHelper::getValue($values, $task, 0, 'int');
     // Get the model.
     $model = $this->getModel();
     // Access checks.
     foreach ($ids as $i => $id) {
         if (!$user->authorise('core.edit.state')) {
             // Prune items that you can't change.
             unset($ids[$i]);
             $app->enqueueMessage(JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), 'notice');
         }
     }
     if (empty($ids)) {
         $app->enqueueMessage(JText::_('COM_CHURCHDIRECTORY_NO_ITEM_SELECTED'), 'warning');
     } else {
         // Publish the items.
         if (!$model->featured($ids, $value)) {
             $app->enqueueMessage($model->getError(), 'warning');
         }
     }
     $this->setRedirect('index.php?option=com_churchdirectory&view=postions');
 }
Exemplo n.º 6
0
} else {
    require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_languages' . DS . 'helpers' . DS . 'jsonresponse.php';
}
/**
 * Content controller class.
 */
class J2XMLControllerCategories extends JControllerAbstract
{
    function __construct($default = array())
    {
        parent::__construct();
    }
    public function display($cachable = false, $urlparams = false)
    {
        JRequest::setVar('view', 'categories');
        parent::display($cachable, $urlparams);
    }
    function send()
    {
        if (!JSession::checkToken('request')) {
            // Check for a valid token. If invalid, send a 403 with the error message.
            JError::raiseWarning(403, JText::_('JINVALID_TOKEN'));
            echo version_compare(JPlatform::RELEASE, '12', 'ge') ? new JResponseJson() : new JJsonResponse();
            return;
        }
        $cid = JRequest::getVar('cid', array(0), null, 'array');
        $sid = JRequest::getVar('w_id', null, null, 'int');
Exemplo n.º 7
0
 /**
  * Get a list of logged users.
  *
  * @param	JObject	The module parameters.
  * @return	mixed	An array of articles, or false on error.
  */
 public static function getList($params)
 {
     $db = JFactory::getDbo();
     $user = JFactory::getUser();
     $query = $db->getQuery(true);
     $query->select('s.time, s.client_id, u.id, u.name, u.username');
     $query->from('#__session AS s');
     $query->leftJoin('#__users AS u ON s.userid = u.id');
     $query->where('s.guest = 0');
     $db->setQuery($query, 0, $params->get('count', 5));
     try {
         $results = $db->loadObjectList();
     } catch (RuntimeException $e) {
         JError::raiseError(500, $e->getMessage());
         return false;
     }
     foreach ($results as $k => $result) {
         $results[$k]->logoutLink = '';
         if ($user->authorise('core.manage', 'com_users')) {
             $results[$k]->editLink = JRoute::_('index.php?option=com_users&task=user.edit&id=' . $result->id);
             $results[$k]->logoutLink = JRoute::_('index.php?option=com_login&task=logout&uid=' . $result->id . '&' . JSession::getFormToken() . '=1');
         }
         if ($params->get('name', 1) == 0) {
             $results[$k]->name = $results[$k]->username;
         }
     }
     return $results;
 }
Exemplo n.º 8
0
 /**
  * Display the button
  *
  * @return array A four element array of (article_id, article_title, category_id, object)
  */
 function onDisplay($name)
 {
     /*
      * Javascript to insert the link
      * View element calls jSelectArticle when an article is clicked
      * jSelectArticle creates the link tag, sends it to the editor,
      * and closes the select frame.
      */
     $js = "\r\r\n\t\tfunction jSelectArticle(id, title, catid, object, link, lang) {\r\r\n\t\t\tvar hreflang = '';\r\r\n\t\t\tif (lang !== '') {\r\r\n\t\t\t\tvar hreflang = ' hreflang = \"' + lang + '\"';\r\r\n\t\t\t}\r\r\n\t\t\tvar tag = '<a' + hreflang + ' href=\"' + link + '\">' + title + '</a>';\r\r\n\t\t\tjInsertEditorText(tag, '" . $name . "');\r\r\n\t\t\tSqueezeBox.close();\r\r\n\t\t}";
     $doc = JFactory::getDocument();
     $doc->addScriptDeclaration($js);
     JHtml::_('behavior.modal');
     /*
      * Use the built-in element view to select the article.
      * Currently uses blank class.
      */
     $link = 'index.php?option=com_content&amp;view=articles&amp;layout=modal&amp;tmpl=component&amp;' . JSession::getFormToken() . '=1';
     $button = new JObject();
     $button->set('modal', true);
     $button->set('link', $link);
     $button->set('text', JText::_('PLG_ARTICLE_BUTTON_ARTICLE'));
     $button->set('name', 'article');
     $button->set('options', "{handler: 'iframe', size: {x: 770, y: 400}}");
     return $button;
 }
Exemplo n.º 9
0
 /**
  * Save an item
  */
 public function save($key = null, $urlVar = null)
 {
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     /** @var $app JApplicationAdministrator */
     $data = $app->input->post->get('jform', array(), 'array');
     $itemId = JArrayHelper::getValue($data, "id");
     $redirectData = array("task" => $this->getTask(), "id" => $itemId);
     $model = $this->getModel();
     /** @var $model SocialCommunityModelCountry */
     $form = $model->getForm($data, false);
     /** @var $form JForm */
     if (!$form) {
         throw new Exception(JText::_("COM_SOCIALCOMMUNITY_ERROR_FORM_CANNOT_BE_LOADED"));
     }
     // Validate the form
     $validData = $model->validate($form, $data);
     // Check for errors
     if ($validData === false) {
         $this->displayNotice($form->getErrors(), $redirectData);
         return;
     }
     try {
         $itemId = $model->save($validData);
         $redirectData["id"] = $itemId;
     } catch (Exception $e) {
         JLog::add($e->getMessage());
         throw new Exception(JText::_('COM_SOCIALCOMMUNITY_ERROR_SYSTEM'));
     }
     $this->displayMessage(JText::_('COM_SOCIALCOMMUNITY_COUNTRY_SAVED'), $redirectData);
 }
Exemplo n.º 10
0
 public function help()
 {
     $user = JFactory::getUser();
     $jinput = JFactory::getApplication()->input;
     // Check Token!
     $token = JSession::getFormToken();
     $call_token = $jinput->get('token', 0, 'ALNUM');
     if ($user->id != 0 && $token == $call_token) {
         $task = $this->getTask();
         switch ($task) {
             case 'getText':
                 try {
                     $idValue = $jinput->get('id', 0, 'INT');
                     if ($idValue) {
                         $result = $this->getHelpDocumentText($idValue);
                     } else {
                         $result = '';
                     }
                     echo $result;
                     // stop execution gracefully
                     jexit();
                 } catch (Exception $e) {
                     // stop execution gracefully
                     jexit();
                 }
                 break;
         }
     } else {
         // stop execution gracefully
         jexit();
     }
 }
Exemplo n.º 11
0
 public function create()
 {
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     // Get form data
     $pks = $this->input->post->get('cid', array(), 'array');
     $model = $this->getModel('Profile', 'GamificationModel');
     /** @var $model GamificationModelProfile */
     $pks = Joomla\Utilities\ArrayHelper::toInteger($pks);
     // Check for validation errors.
     if (!$pks) {
         $this->defaultLink .= '&view=' . $this->view_list;
         $this->setMessage(JText::_('COM_GAMIFICATION_INVALID_ITEM'), 'notice');
         $this->setRedirect(JRoute::_($this->defaultLink, false));
         return;
     }
     try {
         $pks = $model->filterProfiles($pks);
         if (!$pks) {
             $this->defaultLink .= '&view=' . $this->view_list;
             $this->setMessage(JText::_('COM_GAMIFICATION_INVALID_ITEM'), 'notice');
             $this->setRedirect(JRoute::_($this->defaultLink, false));
             return;
         }
         $model->create($pks);
     } catch (Exception $e) {
         JLog::add($e->getMessage(), JLog::ERROR, 'com_gamification');
         throw new Exception(JText::_('COM_GAMIFICATION_ERROR_SYSTEM'));
     }
     $msg = JText::plural('COM_GAMIFICATION_N_PROFILES_CREATED', count(pks));
     $link = $this->defaultLink . '&view=' . $this->view_list;
     $this->setRedirect(JRoute::_($link, false), $msg);
 }
 /**
  * Method to update members geoupdate location.
  *
  * @return    void
  *
  * @since    1.7.0
  */
 public function geoupdate()
 {
     // Check for request forgeries
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $ids = $this->input->get('cid', [], 'array');
     // Get the model.
     /** @var  ChurchDirectoryModelGeoStatus $model */
     $model = $this->getModel();
     // Access checks.
     foreach ($ids as $i => $id) {
         $item = $model->getItem($id);
         if (!$user->authorise('core.edit.state', 'com_churchdirectory.category.' . (int) $item->catid)) {
             // Prune items that you can't change.
             unset($ids[$i]);
             $app->enqueueMessage(JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), 'notice');
         }
     }
     if (empty($ids)) {
         $app->enqueueMessage(JText::_('COM_CHURCHDIRECTORY_NO_ITEM_SELECTED'), 'error');
     } else {
         // Publish the items.
         if (!$model->update($ids)) {
             $app->enqueueMessage($model->getError(), 'error');
         }
     }
     $this->setRedirect('index.php?option=com_churchdirectory&view=geostatus');
 }
Exemplo n.º 13
0
 /**
  * Method to get the field input markup.
  *
  * @return	string	The field input markup.
  * @since	1.6
  */
 protected function getInput()
 {
     // Load the modal behavior script.
     JHtml::_('behavior.modal', 'a.modal');
     // Build the script.
     $script = array();
     $script[] = '	function onArrowsSelect(data){';
     $script[] = '		UniteAdminRev.onArrowsChange(data);';
     $script[] = '		SqueezeBox.close();';
     $script[] = '	}';
     // Add the script to the document head.
     JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
     // Setup variables for display.
     $html = array();
     $link = 'index.php?option=' . GlobalsUniteRev::COMPONENT_NAME . '&view=slider&layout=arrows&tmpl=component&settingid=' . $this->id;
     $buttonType = $this->value;
     $arrArrowSet = HelperUniteRev::getArrowSet($buttonType);
     $arrowName = $arrArrowSet["name"];
     $html[] = '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . $this->value . '" />';
     $buttonID = $this->id . "-btn";
     $desc = UniteFunctionsRev::getVal($this->element, "description");
     // The the arrow
     $imageArrow = $arrArrowSet["url_right"];
     $html[] = '<span class="chooser-image-wrapper"><img id="' . $this->id . '-img" title="' . $arrowName . '" src="' . $imageArrow . '"></span>';
     //put select button
     $html[] = '	<a id="' . $buttonID . '" class="modal button-secondary button-chooser" href="' . $link . '&amp;' . JSession::getFormToken() . '=1" rel="{handler: \'iframe\', size: {x: 900, y: 450}}">Change</a>';
     $html = implode("\n", $html);
     return $html;
 }
Exemplo n.º 14
0
 public function revert()
 {
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     $pks = $app->input->post->get('cid', array(), 'array');
     $pk = (int) count($pks) ? $pks[0] : 0;
     $type = $app->input->post->getString('element_type', 'type');
     $model = $this->getModel();
     $user = JFactory::getUser();
     $res = $user->authorise('core.edit', CCK_COM) ? $model->revert($pk, $type) : false;
     if ($res) {
         if ($type == 'search') {
             $link = _C4_LINK;
         } elseif ($type == 'type') {
             $link = _C2_LINK;
         }
         $msg = JText::_('COM_CCK_SUCCESSFULLY_RESTORED');
         $type = 'message';
     } else {
         $link = _C6_LINK . '&filter_e_type=' . $type;
         $msg = JText::_('JERROR_AN_ERROR_HAS_OCCURRED');
         $type = 'error';
     }
     $this->setRedirect($link, $msg, $type);
 }
Exemplo n.º 15
0
 /**
  * Display the button
  *
  * @param   string  $name  The name of the button to add
  *
  * @return array A four element array of (article_id, article_title, category_id, object)
  */
 public function onDisplay($name)
 {
     $app = JFactory::getApplication();
     if (!$app->isSite()) {
         return false;
     }
     /*
      * Javascript to insert the link
      * View element calls jSelectEvent when an event is clicked
      * jSelectEvent creates the link tag, sends it to the editor,
      * and closes the select frame.
      */
     $js = "\n\t\tfunction jSelectEvent(id, title, object, link, lang)\n\t\t{\n\t\t\tvar hreflang = '';\n\t\t\tif (lang !== '')\n\t\t\t{\n\t\t\t\tvar hreflang = ' hreflang = \"' + lang + '\"';\n\t\t\t}\n\t\t\tvar tag = '<a' + hreflang + ' href=\"' + link + '\">' + title + '</a>';\n\t\t\tjInsertEditorText(tag, '" . $name . "');\n\t\t\tSqueezeBox.close();\n\t\t}";
     $doc = JFactory::getDocument();
     $doc->addScriptDeclaration($js);
     JHtml::_('behavior.modal');
     /*
      * Use the built-in element view to select the event.
      * Currently uses blank class.
      */
     $app = JFactory::getApplication();
     if ($app->isSite()) {
         $link = 'index.php?option=com_jem&amp;view=eventslist&amp;layout=modal&amp;tmpl=component&amp;' . JSession::getFormToken() . '=1';
     } else {
         $link = 'index.php?option=com_jem&amp;view=events&amp;layout=modal&amp;tmpl=component&amp;' . JSession::getFormToken() . '=1';
     }
     $button = new JObject();
     $button->modal = true;
     $button->class = 'btn';
     $button->link = $link;
     $button->text = JText::_('PLG_EVENT_BUTTON_EVENT');
     $button->name = 'calendar';
     $button->options = "{handler: 'iframe', size: {x: 800, y: 500}}";
     return $button;
 }
Exemplo n.º 16
0
 /**
  * Method to remove a record.
  *
  * @return  void
  *
  * @since   1.6
  */
 public function delete()
 {
     // Check for request forgeries.
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     // Get the model.
     $model = $this->getModel();
     // Load the filter state.
     $app = JFactory::getApplication();
     $type = $app->getUserState($this->context . '.filter.type');
     $model->setState('filter.type', $type);
     $begin = $app->getUserState($this->context . '.filter.begin');
     $model->setState('filter.begin', $begin);
     $end = $app->getUserState($this->context . '.filter.end');
     $model->setState('filter.end', $end);
     $categoryId = $app->getUserState($this->context . '.filter.category_id');
     $model->setState('filter.category_id', $categoryId);
     $clientId = $app->getUserState($this->context . '.filter.client_id');
     $model->setState('filter.client_id', $clientId);
     $model->setState('list.limit', 0);
     $model->setState('list.start', 0);
     $count = $model->getTotal();
     // Remove the items.
     if (!$model->delete()) {
         JError::raiseWarning(500, $model->getError());
     } else {
         $this->setMessage(JText::plural('COM_BANNERS_TRACKS_N_ITEMS_DELETED', $count));
     }
     $this->setRedirect('index.php?option=com_banners&view=tracks');
 }
Exemplo n.º 17
0
 public function save($key = null, $urlVar = null)
 {
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $data = $this->input->post->get('jform', array(), 'array');
     $itemId = Joomla\Utilities\ArrayHelper::getValue($data, "id");
     $redirectOptions = array("task" => $this->getTask(), "id" => $itemId);
     $model = $this->getModel();
     /** @var $model CrowdfundingModelComment */
     $form = $model->getForm($data, false);
     /** @var $form JForm */
     if (!$form) {
         throw new Exception(JText::_("COM_CROWDFUNDING_ERROR_FORM_CANNOT_BE_LOADED"), 500);
     }
     // Validate the form data
     $validData = $model->validate($form, $data);
     // Check for errors
     if ($validData === false) {
         $this->displayNotice($form->getErrors(), $redirectOptions);
         return;
     }
     try {
         $itemId = $model->save($validData);
         $redirectOptions["id"] = $itemId;
     } catch (Exception $e) {
         JLog::add($e->getMessage());
         throw new Exception(JText::_('COM_CROWDFUNDING_ERROR_SYSTEM'));
     }
     $this->displayMessage(JText::_('COM_CROWDFUNDING_COMMENT_SAVED'), $redirectOptions);
 }
Exemplo n.º 18
0
 function copy()
 {
     if (!$this->isAllowed($this->aclCat, 'manage')) {
         return;
     }
     JRequest::checkToken() || JRequest::checkToken('get') || JSession::checkToken('get') || die('Invalid Token');
     $cids = JRequest::getVar('cid', array(), '', 'array');
     $db = JFactory::getDBO();
     $time = time();
     $my = JFactory::getUser();
     $creatorId = intval($my->id);
     $addSendDate = '';
     if (!empty($this->copySendDate)) {
         $addSendDate = ', `senddate`';
     }
     foreach ($cids as $oneMailid) {
         $query = 'INSERT INTO `#__acymailing_mail` (`subject`, `body`, `altbody`, `published`' . $addSendDate . ', `created`, `fromname`, `fromemail`, `replyname`, `replyemail`, `type`, `visible`, `userid`, `alias`, `attach`, `html`, `tempid`, `key`, `frequency`, `params`,`filter`,`metakey`,`metadesc`)';
         $query .= " SELECT CONCAT('copy_',`subject`), `body`, `altbody`, 0" . $addSendDate . ", '.{$time}.', `fromname`, `fromemail`, `replyname`, `replyemail`, `type`, `visible`, '.{$creatorId}.', `alias`, `attach`, `html`, `tempid`, " . $db->Quote(acymailing_generateKey(8)) . ', `frequency`, `params`,`filter`,`metakey`,`metadesc` FROM `#__acymailing_mail` WHERE `mailid` = ' . (int) $oneMailid;
         $db->setQuery($query);
         $db->query();
         $newMailid = $db->insertid();
         $db->setQuery('INSERT IGNORE INTO `#__acymailing_listmail` (`listid`,`mailid`) SELECT `listid`,' . $newMailid . ' FROM `#__acymailing_listmail` WHERE `mailid` = ' . (int) $oneMailid);
         $db->query();
     }
     return $this->listing();
 }
 /**
  * Execute the controller.
  *
  * @return  void
  *
  * @since   3.1
  */
 public function execute()
 {
     // Get the application
     /* @var InstallationApplicationWeb $app */
     $app = $this->getApplication();
     // Check for request forgeries.
     JSession::checkToken() or $app->sendJsonResponse(new Exception(JText::_('JINVALID_TOKEN'), 403));
     // Get the setup model.
     $model = new InstallationModelSetup();
     // Get the data
     $data = $app->input->post->get('jform', array(), 'array');
     // Store the options in the session.
     $vars = $model->storeOptions($data);
     // Get the database model.
     $ftp = new InstallationModelFtp();
     // Attempt to detect the Joomla root from the ftp account.
     $return = $ftp->verifyFtpSettings($vars);
     // Build the response object
     $r = new stdClass();
     $r->view = 'ftp';
     // If we got a FTP root, add it to the response object
     if ($return) {
         $r->valid = $return;
     }
     $app->sendJsonResponse($r);
 }
Exemplo n.º 20
0
 /**
  * Display the button
  *
  * @param   string  $name  The name of the button to add
  *
  * @return array A four element array of (article_id, article_title, category_id, object)
  */
 public function onDisplay($name)
 {
     /*
      * Javascript to insert the link
      * View element calls jSelectArticle when an article is clicked
      * jSelectArticle creates the link tag, sends it to the editor,
      * and closes the select frame.
      */
     $js = "\n\t\tfunction jSelectArticle(id, title, catid, object, link, lang)\n\t\t{\n\t\t\tvar hreflang = '';\n\t\t\tif (lang !== '')\n\t\t\t{\n\t\t\t\tvar hreflang = ' hreflang = \"' + lang + '\"';\n\t\t\t}\n\t\t\tvar tag = '<a' + hreflang + ' href=\"' + link + '\">' + title + '</a>';\n\t\t\tjInsertEditorText(tag, '" . $name . "');\n\t\t\tjModalClose();\n\t\t}";
     $doc = JFactory::getDocument();
     $doc->addScriptDeclaration($js);
     /*
      * Use the built-in element view to select the article.
      * Currently uses blank class.
      */
     $link = 'index.php?option=com_content&amp;view=articles&amp;layout=modal&amp;tmpl=component&amp;' . JSession::getFormToken() . '=1';
     $button = new JObject();
     $button->modal = true;
     $button->class = 'btn';
     $button->link = $link;
     $button->text = JText::_('PLG_ARTICLE_BUTTON_ARTICLE');
     $button->name = 'file-add';
     $button->options = "{handler: 'iframe', size: {x: 800, y: 500}}";
     return $button;
 }
Exemplo n.º 21
0
 /**
  * Enable auto-update.
  *
  * @throws  Exception
  * @return  void
  */
 public function enableau()
 {
     // Check for request forgeries
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $redirectOptions = array("view" => "urls");
     $cid = $this->input->post->get("cid", array(), "array");
     $cid = Joomla\Utilities\ArrayHelper::toInteger($cid);
     $data = array('enableau' => 1, 'disableau' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($data, $task, 0, 'int');
     if (empty($cid)) {
         $this->displayNotice(JText::_($this->text_prefix . '_ERROR_NO_ITEM_SELECTED'), $redirectOptions);
         return;
     }
     try {
         $model = $this->getModel();
         $model->updateAutoupdate($cid, $value);
     } catch (Exception $e) {
         JLog::add($e->getMessage());
         throw new Exception(JText::_('COM_ITPMETA_ERROR_SYSTEM'));
     }
     if ($value == 1) {
         $msg = $this->text_prefix . '_N_ITEMS_AUTOUPDATE_ENABLED';
     } else {
         $msg = $this->text_prefix . '_N_ITEMS_AUTOUPDATE_DISABLED';
     }
     $this->displayMessage(JText::plural($msg, count($cid)), $redirectOptions);
 }
Exemplo n.º 22
0
 public function delete()
 {
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     $cid = $app->input->get('cid', array(), 'array');
     if (!is_array($cid) || count($cid) < 1) {
         JError::raiseWarning(500, JText::_($this->text_prefix . '_NO_ITEM_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Make sure the item ids are integers
         jimport('joomla.utilities.arrayhelper');
         JArrayHelper::toInteger($cid);
         // Remove the items.
         if ($model->delete($cid)) {
             $this->setMessage(JText::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid)));
         } else {
             $this->setMessage($model->getError());
         }
     }
     $vars = '';
     $extension = $app->input->get('extension', '');
     if ($extension) {
         $vars = '&extension=' . $extension;
     }
     $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $vars, false));
 }
Exemplo n.º 23
0
 /**
  * Method to toggle the featured setting of a list of teamids.
  *
  * @return	void
  * 
  */
 public function featured()
 {
     // Check for request forgeries
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $user = JFactory::getUser();
     $ids = $this->input->getVar('cid', array(), 'array');
     $values = array('featured' => 1, 'unfeatured' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($values, $task, 0, 'int');
     // Get the model.
     $model = $this->getModel();
     // Access checks.
     foreach ($ids as $i => $id) {
         $item = $model->getItem($id);
         if (!$user->authorise('core.edit.state', 'com_knvbapi2.teamid.' . $id)) {
             // Prune items that you can't change.
             unset($ids[$i]);
             JError::raiseNotice(403, JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));
         }
     }
     if (empty($ids)) {
         JError::raiseWarning(500, JText::_('COM_KNVBAPI2_TEAMIDS_NO_ITEM_SELECTED'));
     } else {
         // Publish the items.
         if (!$model->featured($ids, $value)) {
             JError::raiseWarning(500, $model->getError());
         }
         if ($value == 1) {
             $message = JText::plural('COM_KNVBAPI2_TEAMIDS_N_ITEMS_FEATURED', count($ids));
         } else {
             $message = JText::plural('COM_KNVBAPI2_TEAMIDS_N_ITEMS_UNFEATURED', count($ids));
         }
     }
     $this->setRedirect(JRoute::_('index.php?option=com_knvbapi2&view=teamids', false), $message);
 }
Exemplo n.º 24
0
 /**
  * Method to set the home property for a list of items
  *
  * @since	1.6
  */
 function setDefault()
 {
     // Check for request forgeries
     JSession::checkToken('request') or die(JText::_('JINVALID_TOKEN'));
     // Get items to publish from the request.
     $cid = JRequest::getVar('cid', array(), '', 'array');
     $data = array('setDefault' => 1, 'unsetDefault' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($data, $task, 0, 'int');
     if (empty($cid)) {
         JError::raiseWarning(500, JText::_($this->text_prefix . '_NO_ITEM_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Make sure the item ids are integers
         JArrayHelper::toInteger($cid);
         // Publish the items.
         if (!$model->setHome($cid, $value)) {
             JError::raiseWarning(500, $model->getError());
         } else {
             if ($value == 1) {
                 $ntext = 'COM_MENUS_ITEMS_SET_HOME';
             } else {
                 $ntext = 'COM_MENUS_ITEMS_UNSET_HOME';
             }
             $this->setMessage(JText::plural($ntext, count($cid)));
         }
     }
     $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
 }
 public function importData()
 {
     // Check for request forgeries
     JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
     // check if import is allowed for this user.
     $user = JFactory::getUser();
     if ($user->authorise('help_document.import', 'com_costbenefitprojection') && $user->authorise('core.import', 'com_costbenefitprojection')) {
         // Get the import model
         $model = $this->getModel('Help_documents');
         // get the headers to import
         $headers = $model->getExImPortHeaders();
         if (CostbenefitprojectionHelper::checkObject($headers)) {
             // Load headers to session.
             $session = JFactory::getSession();
             $headers = json_encode($headers);
             $session->set('help_document_VDM_IMPORTHEADERS', $headers);
             $session->set('backto_VDM_IMPORT', 'help_documents');
             $session->set('dataType_VDM_IMPORTINTO', 'help_document');
             // Redirect to import view.
             $message = JText::_('COM_COSTBENEFITPROJECTION_IMPORT_SELECT_FILE_FOR_HELP_DOCUMENTS');
             $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=import', false), $message);
             return;
         }
     }
     // Redirect to the list screen with error.
     $message = JText::_('COM_COSTBENEFITPROJECTION_IMPORT_FAILED');
     $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=help_documents', false), $message, 'error');
     return;
 }
Exemplo n.º 26
0
 protected function getInput()
 {
     $document = JFactory::getDocument();
     $app = JFactory::getApplication();
     $id = $app->input->getInt('id', 0);
     $attachments = array();
     if ($this->value) {
         $registry = new JRegistry();
         $registry->loadString($this->value);
         $attachments = $registry->toObject();
     }
     $token = JSession::getFormToken();
     $script = "jQuery(document).ready(function(\$){\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\$('#add_attachments').click(function() {\n\t\t\t\t\t\t\t\t\$('<tr><td><input type=\"file\" name=\"attachmentfiles[]\" multiple /></td><td><a href=\"#\" class=\"remove_attachment\" onclick=\"return false;\">" . JText::_('COM_JUDIRECTORY_REMOVE') . "</a></td></tr>').appendTo(\"#juemail table\");\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\$('#juemail').on('click', '.remove_attachment', function() {\n\t\t\t\t\t\t\t\t\$(this).parent().parent().remove();\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\$(\"#email-lists\").dragsort({ dragSelector: \"li\", dragEnd: saveOrder, placeHolderTemplate: \"<li class='placeHolder'></li>\", dragSelectorExclude: \"input, textarea, span\"});\n\t\t\t\t\t        function saveOrder() {\n\t\t\t\t\t\t\t\tvar data = \$(\"#juemail li\").map(function() { return \$(this).data(\"itemid\"); }).get();\n\t\t\t\t\t        };\n\t\t\t\t\t\t});";
     $document->addScriptDeclaration($script);
     $html = '<div id="juemail" class="juemail" style="float: left">';
     if ($attachments) {
         $html .= '<ul id="email-lists" class="email-lists">';
         foreach ($attachments as $attachment) {
             $html .= '<li>';
             $html .= '<a class="drag-icon"></a>';
             $html .= '<input type="checkbox" name="' . $this->name . '[]" checked value="' . $attachment . '" />';
             $html .= '<a href="index.php?option=com_judirectory&task=email.downloadattachment&id=' . $id . '&file=' . $attachment . '&' . $token . '=1"><span class="attachment">' . $attachment . '</span></a>';
             $html .= '</li>';
         }
         $html .= '</ul>';
     }
     $html .= '<table></table>';
     $html .= '<a href="#" class="btn btn-mini btn-primary add_attachments" id="add_attachments" onclick="return false;"><i class="icon-new"></i> ' . JText::_('COM_JUDIRECTORY_ADD_ATTACHMENT') . '</a>';
     $html .= '</div>';
     return $html;
 }
Exemplo n.º 27
0
 /**
  * Method to get the field input markup.
  *
  * @return	string	The field input markup.
  * @since	1.6
  */
 protected function getInput()
 {
     // Load the modal behavior script.
     JHtml::_('behavior.modal', 'a.modal');
     // Build the script.
     $script = array();
     $script[] = '	function onBulletsSelect(data){';
     $script[] = '		alert("do something: " + data)';
     $script[] = '		SqueezeBox.close();';
     $script[] = '	}';
     // Add the script to the document head.
     JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
     // Setup variables for display.
     $html = array();
     $link = 'index.php?option=com_unitehcarousel&view=slider&layout=bullets&tmpl=component';
     $html[] = '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . $this->value . '" />';
     $bulletsText = "Change Bullets";
     $buttonID = $this->id . "-btn";
     $desc = UniteFunctionsHCar::getVal($this->element, "description");
     $htmlAddon = "";
     if (!empty($desc)) {
         $htmlAddon = ' title="' . $desc . '"';
         //$class .= " hasTip";	//making problems with rel
     }
     // The user select button.
     $html[] = '	<a id="' . $buttonID . '" class="modal panel_button" ' . $htmlAddon . '  href="' . $link . '&amp;' . JSession::getFormToken() . '=1" rel="{handler: \'iframe\', size: {x: 900, y: 450}}">' . $bulletsText . '</a>';
     $html = implode("\n", $html);
     return $html;
 }
Exemplo n.º 28
0
 /**
  * Execute the controller.
  *
  * @return  void
  *
  * @since   3.1
  */
 public function execute()
 {
     // Get the application
     /* @var InstallationApplicationWeb $app */
     $app = $this->getApplication();
     // Check for request forgeries.
     JSession::checkToken() or $app->sendJsonResponse(new Exception(JText::_('JINVALID_TOKEN'), 403));
     // Get array of selected languages
     $lids = $this->input->get('cid', array(), 'array');
     JArrayHelper::toInteger($lids, array());
     // Get the languages model.
     $model = new InstallationModelLanguages();
     if (!$lids) {
         // No languages have been selected
         $app->enqueueMessage(JText::_('INSTL_LANGUAGES_NO_LANGUAGE_SELECTED'), 'warning');
     } else {
         // Install selected languages
         $model->install($lids);
         // Publish the Content Languages.
         $model->publishContentLanguages();
         $app->enqueueMessage(JText::_('INSTL_LANGUAGES_MORE_LANGUAGES'), 'notice');
     }
     // Redirect to the page.
     $r = new stdClass();
     $r->view = 'defaultlanguage';
     $app->sendJsonResponse($r);
 }
Exemplo n.º 29
0
 /**
  * Removes an item.
  *
  * @return  void
  *
  * @since   1.6
  */
 public function delete()
 {
     // Check for request forgeries
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $user = JFactory::getUser();
     $ids = $this->input->get('cid', array(), 'array');
     // Access checks.
     foreach ($ids as $i => $id) {
         if (!$user->authorise('core.delete', 'com_content.article.' . (int) $id)) {
             // Prune items that you can't delete.
             unset($ids[$i]);
             JError::raiseNotice(403, JText::_('JERROR_CORE_DELETE_NOT_PERMITTED'));
         }
     }
     if (empty($ids)) {
         JError::raiseWarning(500, JText::_('JERROR_NO_ITEMS_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Remove the items.
         if (!$model->featured($ids, 0)) {
             JError::raiseWarning(500, $model->getError());
         }
     }
     $this->setRedirect('index.php?option=com_content&view=featured');
 }
Exemplo n.º 30
0
 /**
  * Constructor for the JSON response
  *
  * @param   mixed  $data  Exception if there is an error, otherwise, the session data
  *
  * @since   3.1
  */
 public function __construct($data)
 {
     // The old token is invalid so send a new one.
     $this->token = JSession::getFormToken(true);
     // Get the language and send it's tag along
     $this->lang = JFactory::getLanguage()->getTag();
     // Get the message queue
     $messages = JFactory::getApplication()->getMessageQueue();
     // Build the sorted message list
     if (is_array($messages) && count($messages)) {
         foreach ($messages as $msg) {
             if (isset($msg['type']) && isset($msg['message'])) {
                 $lists[$msg['type']][] = $msg['message'];
             }
         }
     }
     // If messages exist add them to the output
     if (isset($lists) && is_array($lists)) {
         $this->messages = $lists;
     }
     // Check if we are dealing with an error.
     if ($data instanceof Exception) {
         // Prepare the error response.
         $this->error = true;
         $this->header = JText::_('INSTL_HEADER_ERROR');
         $this->message = $data->getMessage();
     } else {
         // Prepare the response data.
         $this->error = false;
         $this->data = $data;
     }
 }