Current Path :
/
home
/
develito
/
public_html
/
components
/
com_abook
/
controllers
/
Or
Select Your Path :
Upload File :
New :
File
Dir
/home/develito/public_html/components/com_abook/controllers/book.php
<?php /** * @package Joomla * @subpackage Abook * @copyright (C) 2010-2019 Federica Ugolotti * @license GNU/GPL, see LICENSE.php * Abook is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License 3 * as published by the Free Software Foundation. * Abook is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with Abook; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ defined('_JEXEC') or die( 'Restricted access' ); jimport('joomla.application.component.controllerform'); class AbookControllerBook extends JControllerForm { public function vote(){ // Check for request forgeries. JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $user_rating = $this->input->getInt('user_rating', -1); if ( $user_rating > -1 ) { $url = $this->input->getString('url', ''); $id = $this->input->getInt('id', 0); $viewName = $this->input->getString('view', $this->default_view); $model = $this->getModel($viewName); if ($model->storeVote($id, $user_rating)) { $this->setRedirect($url, JText::_('COM_ABOOK_BOOK_VOTE_SUCCESS')); } else { $this->setRedirect($url, JText::_('COM_ABOOK_BOOK_VOTE_FAILURE')); } } } function lendrequest(){ $app = JFactory::getApplication(); $url = $this->input->getString('url', ''); $user = JFactory::getUser(); $params = JComponentHelper::getParams('com_abook'); $captcha=$params->get('captcha', JFactory::getConfig()->get('captcha')); if ($user->guest && $captcha!="0"){ // Check for request forgeries. $code= $this->input->get('dynamic_recaptcha_1'); $captcha=$params->get('captcha', JFactory::getConfig()->get('captcha')); JPluginHelper::importPlugin('captcha', $captcha); $dispatcher = JDispatcher::getInstance(); $res = $dispatcher->trigger('onCheckAnswer',$code); if(!$res[0]){ $this->setRedirect($url, JText::sprintf('COM_ABOOK_BOOK_LEND_REQUEST_FAILURE', JText::_('COM_ABOOK_ERROR_CAPTCHA')), "error"); return; } } $user = JFactory::getUser(); if ($params->get( 'show_lend_request', 1 )==1 && in_array($params->get('allow_lend_request'), $user->getAuthorisedViewLevels())) { JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $id = $this->input->getInt('id', 0); $lend_out = $this->input->getVar('lend_out', '0000-00-00'); $lend_in = $this->input->getVar('lend_in', '0000-00-00'); $name = $this->input->getVar('custom_user_name', ''); $email = $this->input->getVar('custom_user_email', ''); $viewName = $this->input->getString('view', $this->default_view); $model = $this->getModel($viewName); if ($model->lendRequest($id, $lend_out, $lend_in, $name, $email)) { $this->setRedirect($url, JText::_('COM_ABOOK_BOOK_LEND_REQUEST_SUCCESS'), "info"); } else { $this->setRedirect($url, JText::sprintf('COM_ABOOK_BOOK_LEND_REQUEST_FAILURE', $model->getError()), "error"); } return; } $this->setRedirect($url, JText::sprintf('COM_ABOOK_BOOK_LEND_REQUEST_FAILURE', JText::_('JGLOBAL_AUTH_ACCESS_DENIED')), "error"); } }