Your IP : 216.73.216.218


Current Path : /home/antonen/poznajlitwe.lt/administrator/components/com_aimysitemap/controllers/
Upload File :
Current File : /home/antonen/poznajlitwe.lt/administrator/components/com_aimysitemap/controllers/url.php

<?php
/*
 * Copyright (c) 2017-2019 Aimy Extensions, Netzum Sorglos Software GmbH
 * Copyright (c) 2014-2017 Aimy Extensions, Lingua-Systems Software GmbH
 *
 * https://www.aimy-extensions.com/
 *
 * License: GNU GPLv2, see LICENSE.txt within distribution and/or
 *          https://www.aimy-extensions.com/software-license.html
 */
 defined( '_JEXEC' ) or die(); jimport( 'joomla.session.session' ); require_once( JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'rights.php' ); class AimySitemapControllerUrl extends JControllerForm { public function edit( $key = null, $url_var = null ) { if ( ! JSession::checkToken( 'get' ) and ! JSession::checkToken( 'post' ) ) { jexit( JText::_( 'JINVALID_TOKEN' ) ); } $rights = AimySitemapRightsHelper::getRights(); if ( ! $rights->get( 'core.edit' ) ) { $this->setError( JText::_( 'JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED' ) ); $this->setMessage( $this->getError(), 'error' ); $this->setRedirect( JRoute::_( 'index.php?option=com_aimysitemap&view=urls', false ) ); return false; } return parent::edit( $key, $url_var ); } public function toggle_state() { if ( ! JSession::checkToken( 'get' ) and ! JSession::checkToken( 'post' ) ) { jexit( JText::_( 'JINVALID_TOKEN' ) ); } $rights = AimySitemapRightsHelper::getRights(); if ( ! $rights->get( 'core.edit' ) ) { $this->setError( JText::_( 'JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED' ) ); $this->setMessage( $this->getError(), 'error' ); $this->setRedirect( JRoute::_( 'index.php?option=com_aimysitemap&view=urls', false ) ); return false; } $id = $this->input->getInt( 'id', 0 ); if ( $id <= 0 ) { return false; } $model = $this->getModel(); $model->toggle_state( $id ); $this->setRedirect( JRoute::_( 'index.php?option=com_aimysitemap&view=urls', false ) ); } public function toggle_lock() { if ( ! JSession::checkToken( 'get' ) and ! JSession::checkToken( 'post' ) ) { jexit( JText::_( 'JINVALID_TOKEN' ) ); } $rights = AimySitemapRightsHelper::getRights(); if ( ! $rights->get( 'core.edit' ) ) { $this->setError( JText::_( 'JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED' ) ); $this->setMessage( $this->getError(), 'error' ); $this->setRedirect( JRoute::_( 'index.php?option=com_aimysitemap&view=urls', false ) ); return false; } $id = $this->input->getInt( 'id', 0 ); if ( $id <= 0 ) { return false; } $model = $this->getModel(); $model->toggle_lock( $id ); $this->setRedirect( JRoute::_( 'index.php?option=com_aimysitemap&view=urls', false ) ); } public function change_priority_ajax() { JSession::checkToken() or jexit( JText::_( 'INVALID TOKEN' ) ); $rights = AimySitemapRightsHelper::getRights(); if ( ! $rights->get( 'core.edit' ) ) { jexit( JText::_( 'JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN' ) ); } header( 'Content-Type: application/json; charset=UTF-8' ); $jinput = JFactory::getApplication()->input; $id = $jinput->get( 'id', null, 'uint' ); $prio = $jinput->get( 'val', null, 'float' ); if ( ! is_null( $id ) && ! is_null( $prio ) && $id !== 0 && $prio >= 0.1 && $prio <= 1.0 ) { if ( $this->getModel()->set_priority( $id, $prio ) ) { echo json_encode( array( 'ok' => 1 ) ); } } JFactory::getApplication()->close(); } public function change_changefreq_ajax() { JSession::checkToken() or jexit( JText::_( 'INVALID TOKEN' ) ); $rights = AimySitemapRightsHelper::getRights(); if ( ! $rights->get( 'core.edit' ) ) { jexit( JText::_( 'JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN' ) ); } header( 'Content-Type: application/json; charset=UTF-8' ); $jinput = JFactory::getApplication()->input; $id = $jinput->get( 'id', null, 'uint' ); $freq = $jinput->get( 'val', null, 'word' ); $freqs = array( 'always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never' ); if ( ! is_null( $id ) && ! is_null( $freq ) && $id !== 0 && in_array( $freq, $freqs ) ) { if ( $this->getModel()->set_changefreq( $id, $freq ) ) { echo json_encode( array( 'ok' => 1 ) ); } } JFactory::getApplication()->close(); } public function toggle_state_ajax() { JSession::checkToken() or jexit( JText::_( 'INVALID TOKEN' ) ); $rights = AimySitemapRightsHelper::getRights(); if ( ! $rights->get( 'core.edit' ) ) { jexit( JText::_( 'JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN' ) ); } header( 'Content-Type: application/json; charset=UTF-8' ); $jinput = JFactory::getApplication()->input; $id = $jinput->get( 'id', null, 'uint' ); if ( ! is_null( $id ) && $id !== 0 ) { if ( $this->getModel()->toggle_state( $id ) ) { echo json_encode( array( 'ok' => 1 ) ); } } JFactory::getApplication()->close(); } }