Example #1
0
 /**
  * Method to clone existing Ingredients
  *
  * @return void
  */
 public function duplicate()
 {
     // Check for request forgeries
     Jsession::checkToken() or jexit(JText::_("JINVALID_TOKEN"));
     // Get id(s)
     $pks = $this->input->post->get("cid", array(), "array");
     try {
         if (empty($pks)) {
             throw new Exception(JText::_("COM_AKRECIPES_NO_ELEMENT_SELECTED"));
         }
         ArrayHelper::toInteger($pks);
         $model = $this->getModel();
         $model->duplicate($pks);
         $this->setMessage(Jtext::_("COM_AKRECIPES_ITEMS_SUCCESS_DUPLICATED"));
     } catch (Exception $e) {
         JFactory::getApplication()->enqueueMessage($e->getMessage(), "warning");
     }
     $this->setRedirect("index.php?option=com_akrecipes&view=ingredients");
 }
Example #2
0
 /**
  * Method to clone existing Categories
  *
  * @return void
  */
 public function duplicate()
 {
     // Check for request forgeries
     Jsession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     // Get id(s)
     $pks = $this->input->post->get('cid', array(), 'array');
     try {
         if (empty($pks)) {
             throw new Exception(JText::_('COM_VOCAB_NO_ELEMENT_SELECTED'));
         }
         ArrayHelper::toInteger($pks);
         $model = $this->getModel();
         $model->duplicate($pks);
         $this->setMessage(Jtext::_('COM_VOCAB_ITEMS_SUCCESS_DUPLICATED'));
     } catch (Exception $e) {
         JFactory::getApplication()->enqueueMessage($e->getMessage(), 'warning');
     }
     $this->setRedirect('index.php?option=com_vocab&view=categories');
 }
Example #3
0
    /**
     * create joomla account task (miután a user kitöltötte a nick nevet a regist formon)
     * @return void
     * @param object $mainframe
     * @JREquest nick, adaid, adaemail, assurance
     */
    public function createJoomlaAccount($mainframe)
    {
        $nick = JRequest::getVar('nick');
        $adaid = JRequest::getVar('adaid');
        $adaemail = JRequest::getVar('adaemail');
        $assurance = JRequest::getVar('assurance');
        Jsession::checkToken() or die('invalid CSRF protect token');
        $db = JFactory::getDBO();
        if ($nick == '') {
            $this->registForm($adaid, $adaemail, $assurance, 'Az álnév nem lehet üres');
        } else {
            $db->setQuery('select * from #__users where username = "******"');
            $res = $db->loadObject();
            if ($res == false) {
                $s = $this->registUser($adaid, $nick, $adaemail, $assurance);
                if ($s != '') {
                    echo '<p>' . $s . '</p>';
                    return;
                }
                $userId = $this->checkUser($adaid, $adaemail);
                $user = $this->loginToJoomla($userId, $mainframe);
                if ($user->id > 0) {
                    echo '<html>
						<body>
						<script language="javascript">; 
						if (opener) {
				          opener.location.href = "' . $this->home . '/index.php";
				          window.close();	
						} else {
				          location.href = "' . $this->home . '/index.php";
						}
				        </script>
						</body>
						</html>
						';
                } else {
                    echo '<p>' . $this->ERROR . ' (5)</p>';
                    exit;
                }
            } else {
                $this->registForm($adaid, $adaemail, $assurance, $nick . ' ' . $this->NICK_FOGLALT);
            }
        }
    }