Esempio n. 1
0
 /**
  * redirects to correct view...
  *
  * @return bool
  *
  * @throws Exception
  */
 public function onBeforeAdd()
 {
     $user = JFactory::getUser();
     if (!$user) {
         throw new Exception('access not allowed', 403);
     }
     // If the user is logged, check if he already has a profile
     $model = FOFModel::getTmpInstance('IndividualEdits', 'TracksModel');
     $ind = $model->getUserIndividual($user->get('id'));
     if (!$ind) {
         $allow_register = JComponentHelper::getParams('com_tracks')->get('user_registration', 0);
         if (!$allow_register) {
             throw new Exception('Create individuals not allowed', 403);
         }
         // Redirect to individual edit
         $link = JRoute::_(TrackslibHelperRoute::getEditIndividualRoute());
     } else {
         // Redirect to individual edit
         $link = JRoute::_(TrackslibHelperRoute::getEditIndividualRoute($ind));
     }
     $this->setRedirect($link);
     $this->redirect();
     // We shouldn't arrive at that point ;)
     return false;
 }
Esempio n. 2
0
 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise a Error object.
  */
 public function display($tpl = null)
 {
     // Set toolbar items for the page
     JToolbarHelper::title(JText::_('COM_CPANEL'), 'home-2 cpanel');
     JToolbarHelper::help('screen.cpanel');
     $input = JFactory::getApplication()->input;
     /*
      * Set the template - this will display cpanel.php
      * from the selected admin template.
      */
     $input->set('tmpl', 'cpanel');
     // Display the cpanel modules
     $this->modules = JModuleHelper::getModules('cpanel');
     // Load the RAD layer and count the number of post-installation messages
     if (!defined('FOF_INCLUDED')) {
         require_once JPATH_LIBRARIES . '/fof/include.php';
     }
     try {
         $messages_model = FOFModel::getTmpInstance('Messages', 'PostinstallModel')->eid(700);
         $messages = $messages_model->getItemList();
     } catch (RuntimeException $e) {
         $messages = array();
         // Still render the error message from the Exception object
         JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error');
     }
     $this->postinstall_message_count = count($messages);
     parent::display($tpl);
 }
 public function onAdd($tpl = null)
 {
     $media_folder = JURI::base() . '../media/com_akeeba/';
     // Get a JSON representation of GUI data
     $json = AkeebaHelperEscape::escapeJS(AEUtilInihelper::getJsonGuiDefinition(), '"\\');
     $this->assignRef('json', $json);
     // Get profile ID
     $profileid = AEPlatform::getInstance()->get_active_profile();
     $this->assign('profileid', $profileid);
     // Get profile name
     $profileName = FOFModel::getTmpInstance('Profiles', 'AkeebaModel')->setId($profileid)->getItem()->description;
     $this->assign('profilename', $profileName);
     // Get the root URI for media files
     $this->assign('mediadir', AkeebaHelperEscape::escapeJS($media_folder . 'theme/'));
     // Are the settings secured?
     if (AEPlatform::getInstance()->get_platform_configuration_option('useencryption', -1) == 0) {
         $this->assign('securesettings', -1);
     } elseif (!AEUtilSecuresettings::supportsEncryption()) {
         $this->assign('securesettings', 0);
     } else {
         JLoader::import('joomla.filesystem.file');
         $filename = JPATH_COMPONENT_ADMINISTRATOR . '/akeeba/serverkey.php';
         if (JFile::exists($filename)) {
             $this->assign('securesettings', 1);
         } else {
             $this->assign('securesettings', 0);
         }
     }
     // Add live help
     AkeebaHelperIncludes::addHelp('config');
 }
Esempio n. 4
0
 public function get()
 {
     $input = JFactory::getApplication()->input;
     $user = $this->plugin->getUser();
     $filters = array('search' => '', 'title' => '', 'enabled' => '', 'level' => '', 'publish_up' => '', 'publish_down' => '', 'user_id', 'paystate' => '', 'processor' => '', 'paykey' => '', 'since' => '', 'until' => '', 'contact_flag' => '', 'expires_from' => '', 'expires_to' => '', 'refresh' => '', 'groupbydate' => '', 'groupbyweek' => '', 'groupbylevel' => '', 'moneysum' => '', 'coupon_id' => '', 'filter_discountmode' => '', 'filter_discountcode' => '', 'nozero' => '', 'nojoins' => '');
     if (!$user) {
         $this->plugin->setResponse($this->getErrorResponse(404, JText::_('JERROR_ALERTNOAUTHOR')));
         return;
     }
     $authorised = $user->authorise('core.manage', 'com_akeebasubs');
     if (!$authorised) {
         $this->plugin->setResponse($this->getErrorResponse(404, JText::_('JERROR_ALERTNOAUTHOR')));
         return;
     }
     $subscriptionsmodel = FOFModel::getTmpInstance('Subscriptions', 'AkeebasubsModel');
     $order = $input->get('filter_order', 'akeebasubs_subscription_id');
     $orderdir = $input->get('filter_order_Dir', 'DESC');
     if (!in_array($order, array_keys($subscriptionsmodel->getTable()->getData()))) {
         $order = 'akeebasubs_subscription_id';
     }
     $subscriptionsmodel->setState('filter_order', $order);
     $subscriptionsmodel->setState('filter_order_Dir', $orderdir);
     foreach ($filters as $filter => $val) {
         $subscriptionsmodel->setState($filter, $input->get($filter, $val));
     }
     $subscriptionsmodel->limit($input->get('limit', 10))->limitstart($input->get('limit', 0));
     $this->plugin->setResponse($subscriptionsmodel->getList());
 }
Esempio n. 5
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     // make sure ZOO exist
     jimport('joomla.filesystem.file');
     if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_zoo/config.php') || !JComponentHelper::getComponent('com_zoo', true)->enabled) {
         return;
     }
     // load zoo
     require_once JPATH_ADMINISTRATOR . '/components/com_zoo/config.php';
     $this->app = App::getInstance('zoo');
     // Load from cache
     require_once JPATH_ADMINISTRATOR . '/components/com_zlmanager/helpers/cparams.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_zlmanager/helpers/download.php';
     $username = ZLManagerHelperCparams::getParam('username', '');
     $password = ZLManagerHelperCparams::getParam('password', '');
     $key = md5($username . ':' . $password);
     $cache = $this->getCache($key);
     if (!$cache || !($json = $cache->get('json'))) {
         $url = 'https://www.zoolanders.com/index.php?option=com_zoo&controller=zooextensions&task=getList&format=raw&username='******'&password='******'/tmp/zlmanager.json';
         ZLManagerDownloadHelper::download($url, $file);
         $json = JFile::read($file);
         JFile::delete($file);
         if ($cache) {
             $cache->set('json', $json)->save();
         }
     }
     $this->_json = json_decode($json);
     $this->setState('limit', 50);
 }
Esempio n. 6
0
 public function check()
 {
     $result = true;
     //Alias
     if (empty($this->alias)) {
         $this->alias = JFilterOutput::stringURLSafe($this->title);
     } else {
         $this->alias = JFilterOutput::stringURLSafe($this->alias);
     }
     $existingAlias = FOFModel::getTmpInstance('Tags', 'SpsimpleportfolioModel')->alias($this->alias)->getList(true);
     if (!empty($existingAlias)) {
         $count = 0;
         $k = $this->getKeyName();
         foreach ($existingAlias as $item) {
             if ($item->{$k} != $this->{$k}) {
                 $count++;
             }
         }
         if ($count) {
             $this->setError(JText::_('COM_SPSIMPLEPORTFOLIO_ALIAS_ERR_SLUGUNIQUE'));
             $result = false;
         }
     }
     return $result;
 }
Esempio n. 7
0
 public function check()
 {
     $result = true;
     //Alias
     if (empty($this->alias)) {
         // Auto-fetch a alias
         $this->alias = JFilterOutput::stringURLSafe($this->title);
     } else {
         // Make sure nobody adds crap characters to the alias
         $this->alias = JFilterOutput::stringURLSafe($this->alias);
     }
     $existingAlias = FOFModel::getTmpInstance('Items', 'SpsimpleportfolioModel')->alias($this->alias)->getList(true);
     if (!empty($existingAlias)) {
         $count = 0;
         $k = $this->getKeyName();
         foreach ($existingAlias as $item) {
             if ($item->{$k} != $this->{$k}) {
                 $count++;
             }
         }
         if ($count) {
             $this->setError(JText::_('COM_SPSIMPLEPORTFOLIO_ALIAS_ERR_SLUGUNIQUE'));
             $result = false;
         }
     }
     //Tags
     if (is_array($this->spsimpleportfolio_tag_id)) {
         if (!empty($this->spsimpleportfolio_tag_id)) {
             $this->spsimpleportfolio_tag_id = json_encode($this->spsimpleportfolio_tag_id);
         }
     }
     if (is_null($this->spsimpleportfolio_tag_id) || empty($this->spsimpleportfolio_tag_id)) {
         $this->spsimpleportfolio_tag_id = '';
     }
     //Generate Thumbnails
     if ($result) {
         $params = JComponentHelper::getParams('com_spsimpleportfolio');
         $square = strtolower($params->get('square', '600x600'));
         $rectangle = strtolower($params->get('rectangle', '600x400'));
         $tower = strtolower($params->get('tower', '600x800'));
         $cropratio = $params->get('cropratio', 4);
         if (!is_null($this->image)) {
             jimport('joomla.filesystem.file');
             jimport('joomla.filesystem.folder');
             jimport('joomla.image.image');
             $image = JPATH_ROOT . '/' . $this->image;
             $path = JPATH_ROOT . '/images/spsimpleportfolio/' . $this->alias;
             if (!file_exists($path)) {
                 JFolder::create($path, 0755);
             }
             $sizes = array($square, $rectangle, $tower);
             $image = new JImage($image);
             $image->createThumbs($sizes, $cropratio, $path);
         }
     }
     return $result;
 }
 /**
  * Setup the toolbar and title
  *
  * @return  void
  *
  * @since   3.2
  */
 public function onMessages()
 {
     $extension_name = JText::_('COM_POSTINSTALL_TITLE_JOOMLA');
     $eid = $this->input->getInt('eid', 700);
     if ($eid != 700) {
         $model = FOFModel::getTmpInstance('Messages', 'PostinstallModel');
         $extension_name = $model->getExtensionName($eid);
     }
     JToolBarHelper::title(JText::sprintf('COM_POSTINSTALL_MESSAGES_TITLE', $extension_name));
     JToolBarHelper::preferences($this->config['option'], 550, 875);
 }
 public function ajax()
 {
     $act = $this->input->get('act', '', 'cmd');
     $model = FOFModel::getAnInstance('Confwiz', 'AkeebaModel');
     $model->setState('act', $act);
     $ret = $model->runAjax();
     @ob_end_clean();
     echo '###' . json_encode($ret) . '###';
     flush();
     JFactory::getApplication()->close();
 }
Esempio n. 10
0
 public static function getExtensionsAndVersions()
 {
     require_once dirname(__FILE__) . '/../models/jextensions.php';
     require_once dirname(__FILE__) . '/../models/elements.php';
     require_once dirname(__FILE__) . '/../models/apps.php';
     $jmodel = FOFModel::getTmpInstance('JExtensions', 'ZLManagerModel', array('input' => array()));
     $emodel = FOFModel::getTmpInstance('Elements', 'ZLManagerModel', array('input' => array()));
     $amodel = FOFModel::getTmpInstance('Apps', 'ZLManagerModel', array('input' => array()));
     $extensions = FOFModel::getTmpInstance('Extensions', 'ZLManagerModel', array('input' => array()))->getItemList();
     $exts = array();
     foreach ($extensions as &$e) {
         // QUick naming fix
         if (trim($e->title) == 'ZL Extensions Manager') {
             $e->title = 'ZLManager';
         }
         $exts[] = trim($e->title);
     }
     // Filter extensions
     $jmodel->setState('extensions', $exts);
     $jextensions = $jmodel->getItemList();
     // Get Elements
     $elements = $emodel->getItemList();
     // Get Apps
     $apps = $amodel->getItemList();
     // Extensions
     $jexts = array();
     $jextsv = array();
     foreach ($jextensions as $je) {
         $jexts[] = $je->name;
         $jextsv[$je->name] = $je->version;
     }
     // Elements
     $el = array();
     $elv = array();
     if ($elements && count($elements)) {
         foreach ($elements as $e) {
             $el[] = $e->getMetaData('name');
             $elv[$e->getMetaData('name')] = $e->getMetaData('version');
         }
     }
     // Apps
     $applications = array();
     $applicationsv = array();
     if ($apps && count($apps)) {
         foreach ($apps as $a) {
             $applications[] = $a->getMetaData('name');
             $applicationsv[$a->getMetaData('name')] = $a->getMetaData('version');
         }
     }
     $jexts = array_merge($jexts, $el, $applications);
     $jextv = array_merge($jextsv, $elv, $applicationsv);
     return array('extensions' => $jexts, 'versions' => $jextv);
 }
Esempio n. 11
0
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  */
 protected function getOptions()
 {
     $options = array();
     // Initialize some field attributes.
     $key = $this->element['key_field'] ? (string) $this->element['key_field'] : 'value';
     $value = $this->element['value_field'] ? (string) $this->element['value_field'] : (string) $this->element['name'];
     $applyAccess = $this->element['apply_access'] ? (string) $this->element['apply_access'] : 'false';
     $modelName = (string) $this->element['model'];
     $nonePlaceholder = (string) $this->element['none'];
     $translate = empty($this->element['translate']) ? 'true' : (string) $this->element['translate'];
     $translate = in_array(strtolower($translate), array('true', 'yes', '1', 'on')) ? true : false;
     if (!empty($nonePlaceholder)) {
         $options[] = JHtml::_('select.option', JText::_($nonePlaceholder), null);
     }
     // Process field atrtibutes
     $applyAccess = strtolower($applyAccess);
     $applyAccess = in_array($applyAccess, array('yes', 'on', 'true', '1'));
     // Explode model name into model name and prefix
     $parts = FOFInflector::explode($modelName);
     $mName = ucfirst(array_pop($parts));
     $mPrefix = FOFInflector::implode($parts);
     // Get the model object
     $config = array('savestate' => 0);
     $model = FOFModel::getTmpInstance($mName, $mPrefix, $config);
     if ($applyAccess) {
         $model->applyAccessFiltering();
     }
     // Process state variables
     foreach ($this->element->children() as $stateoption) {
         // Only add <option /> elements.
         if ($stateoption->getName() != 'state') {
             continue;
         }
         $stateKey = (string) $stateoption['key'];
         $stateValue = (string) $stateoption;
         $model->setState($stateKey, $stateValue);
     }
     // Set the query and get the result list.
     $items = $model->getItemList(true);
     // Build the field options.
     if (!empty($items)) {
         foreach ($items as $item) {
             if ($translate == true) {
                 $options[] = JHtml::_('select.option', $item->{$key}, JText::_($item->{$value}));
             } else {
                 $options[] = JHtml::_('select.option', $item->{$key}, $item->{$value});
             }
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Esempio n. 12
0
 /**
  * Builds the SELECT query
  *
  * @param   boolean  $overrideLimits  Are we requested to override the set limits?
  *
  * @return  JDatabaseQuery
  *
  * @since   3.2
  */
 public function buildQuery($overrideLimits = false)
 {
     $query = parent::buildQuery($overrideLimits);
     $db = $this->getDbo();
     // Add a forced extension filtering to the list
     $eid = $this->getState('eid', 700);
     $query->where($db->qn('extension_id') . ' = ' . $db->q($eid));
     // Force filter only enabled messages
     $published = $this->getState('published', 1, 'int');
     $query->where($db->qn('enabled') . ' = ' . $db->q($published));
     return $query;
 }
Esempio n. 13
0
 public function onAdd($tpl = null)
 {
     // Get profile ID
     $profileid = AEPlatform::getInstance()->get_active_profile();
     $this->profileid = $profileid;
     // Get profile name
     $profileName = FOFModel::getTmpInstance('Profiles', 'AkeebaModel')->setId($profileid)->getItem()->description;
     $this->profilename = $profileName;
     // Get the CRON paths
     $this->croninfo = $this->getModel()->getPaths();
     // Add live help
     AkeebaHelperIncludes::addHelp('schedule');
 }
Esempio n. 14
0
 public function onDisplay($tpl = null)
 {
     $model = $this->getModel();
     $task = $model->getState('task', 'components');
     // Add submenus (those nifty text links below the toolbar!)
     $toolbar = FOFToolbar::getAnInstance($this->input->get('option', 'com_foobar', 'cmd'), $this->config);
     $link = JURI::base() . '?option=com_akeeba&view=extfilter&task=components';
     $toolbar->appendLink(JText::_('EXTFILTER_COMPONENTS'), $link, $task == 'components');
     $link = JURI::base() . '?option=com_akeeba&view=extfilter&task=modules';
     $toolbar->appendLink(JText::_('EXTFILTER_MODULES'), $link, $task == 'modules');
     $link = JURI::base() . '?option=com_akeeba&view=extfilter&task=plugins';
     $toolbar->appendLink(JText::_('EXTFILTER_PLUGINS'), $link, $task == 'plugins');
     $link = JURI::base() . '?option=com_akeeba&view=extfilter&task=languages';
     $toolbar->appendLink(JText::_('EXTFILTER_LANGUAGES'), $link, $task == 'languages');
     $link = JURI::base() . '?option=com_akeeba&view=extfilter&task=templates';
     $toolbar->appendLink(JText::_('EXTFILTER_TEMPLATES'), $link, $task == 'templates');
     switch ($task) {
         case 'components':
             // Pass along the list of components
             $this->components = $model->getComponents();
             break;
         case 'modules':
             // Pass along the list of components
             $this->modules = $model->getModules();
             break;
         case 'plugins':
             // Pass along the list of components
             $this->plugins = $model->getPlugins();
             break;
         case 'templates':
             // Pass along the list of components
             $this->templates = $model->getTemplates();
             break;
         case 'languages':
             // Pass along the list of components
             $this->languages = $model->getLanguages();
             break;
     }
     $this->setLayout($task);
     // Add live help
     AkeebaHelperIncludes::addHelp('extfilter');
     // Get profile ID
     $profileid = AEPlatform::getInstance()->get_active_profile();
     $this->profileid = $profileid;
     // Get profile name
     $pmodel = FOFModel::getAnInstance('Profiles', 'AkeebaModel');
     $pmodel->setId($profileid);
     $profile_data = $pmodel->getItem();
     $this->profilename = $profile_data->description;
     return true;
 }
Esempio n. 15
0
 private function notifyMC($row, $info)
 {
     $session = JFactory::getSession();
     // Trigger plugin only if user comes from Mailchimp
     if (!$session->get('mc', '0')) {
         return;
     }
     $shop_name = $this->params->get("store_name", "Your shop");
     $shop_id = $this->params->get("store_id", 42);
     $akeebasubsLevel = FOFModel::getTmpInstance('Levels', 'AkeebasubsModel')->setId($row->akeebasubs_level_id)->getItem();
     $akeeba_subscription_name = $akeebasubsLevel->title;
     $products = array(0 => array("product_id" => $info['current']->akeebasubs_level_id, "sku" => "", "product_name" => $akeeba_subscription_name, "category_id" => 0, "category_name" => "", "qty" => 1.0, "cost" => $info['current']->gross_amount));
     CmcHelperEcom360::sendOrderInformations($shop_id, $shop_name, $info['current']->akeebasubs_subscription_id, $info['current']->gross_amount, $info['current']->tax_percent, 0.0, $products);
 }
Esempio n. 16
0
 public function onBeforeBrowse()
 {
     $result = parent::onBeforeBrowse();
     if ($result) {
         $params = JComponentHelper::getParams('com_akeeba');
         $model = $this->getThisModel();
         $view = $this->getThisView();
         /** @var AkeebaModelCpanels $model */
         $view->setModel($model);
         $aeconfig = AEFactory::getConfiguration();
         // Invalidate stale backups
         AECoreKettenrad::reset(array('global' => true, 'log' => false, 'maxrun' => $params->get('failure_timeout', 180)));
         // Just in case the reset() loaded a stale configuration...
         AEPlatform::getInstance()->load_configuration();
         // Let's make sure the temporary and output directories are set correctly and writable...
         $wizmodel = FOFModel::getAnInstance('Confwiz', 'AkeebaModel');
         $wizmodel->autofixDirectories();
         // Check if we need to toggle the settings encryption feature
         $model->checkSettingsEncryption();
         // Update the magic component parameters
         $model->updateMagicParameters();
         // Run the automatic database check
         $model->checkAndFixDatabase();
         // Run the automatic update site refresh
         $model->refreshUpdateSite();
         // Check the last installed version
         $versionLast = null;
         if (file_exists(JPATH_COMPONENT_ADMINISTRATOR . '/akeeba.lastversion.php')) {
             include_once JPATH_COMPONENT_ADMINISTRATOR . '/akeeba.lastversion.php';
             if (defined('AKEEBA_LASTVERSIONCHECK')) {
                 $versionLast = AKEEBA_LASTVERSIONCHECK;
             }
         }
         if (is_null($versionLast)) {
             $component = JComponentHelper::getComponent('com_akeeba');
             if (is_object($component->params) && $component->params instanceof JRegistry) {
                 $params = $component->params;
             } else {
                 $params = new JParameter($component->params);
             }
             $versionLast = $params->get('lastversion', '');
         }
         if (version_compare(AKEEBA_VERSION, $versionLast, 'ne') || empty($versionLast)) {
             $this->setRedirect('index.php?option=com_akeeba&view=postsetup');
             return true;
         }
     }
     return $result;
 }
Esempio n. 17
0
 public function browse()
 {
     // Check permissions
     $this->_checkPermissions();
     /** @var AkeebaModelStatistics $model */
     $model = FOFModel::getTmpInstance('Statistics', 'AkeebaModel');
     $model->setInput($this->input);
     $result = $model->notifyFailed();
     $message = $result['result'] ? '200 ' : '500 ';
     $message .= implode(', ', $result['message']);
     @ob_end_clean();
     echo $message;
     flush();
     JFactory::getApplication()->close();
 }
Esempio n. 18
0
    public function __construct($config = array())
    {
        parent::__construct($config);
        $schemata['#__ak_profiles'] = <<<ENDSQL
CREATE TABLE IF NOT EXISTS `#__ak_profiles` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `description` varchar(255) NOT NULL,
  `configuration` longtext,
  `filters` longtext,
  PRIMARY KEY  (`id`)
) DEFAULT CHARACTER SET utf8;
ENDSQL;
        $schemata['default_profile'] = <<<ENDSQL
INSERT IGNORE INTO `#__ak_profiles` (`id`,`description`, `configuration`, `filters`) VALUES (1,'Default Backup Profile','','');
ENDSQL;
        $schemata['#__ak_stats'] = <<<ENDSQL
CREATE TABLE IF NOT EXISTS `#__ak_stats` (
  `id` bigint(20) unsigned NOT NULL auto_increment,
  `description` varchar(255) NOT NULL,
  `comment` longtext,
  `backupstart` timestamp NOT NULL default '0000-00-00 00:00:00',
  `backupend` timestamp NOT NULL default '0000-00-00 00:00:00',
  `status` enum('run','fail','complete') NOT NULL default 'run',
  `origin` VARCHAR(30) NOT NULL DEFAULT 'backend',
  `type` VARCHAR(30) NOT NULL DEFAULT 'full',
  `profile_id` bigint(20) NOT NULL default '1',
  `archivename` longtext,
  `absolute_path` longtext,
  `multipart` INT NOT NULL DEFAULT 0,
  `tag` VARCHAR(255) NULL,
  `filesexist` TINYINT(3) NOT NULL DEFAULT '1',
  `remote_filename` varchar(1000) DEFAULT NULL,
  `total_size` bigint(20) NOT NULL DEFAULT '0',
  INDEX `idx_fullstatus`(`filesexist`, `status`),
  INDEX `idx_stale`(`status`, `origin`),
  PRIMARY KEY  (`id`)
) DEFAULT CHARACTER SET utf8;
ENDSQL;
        $schemata['#__ak_storage'] = <<<ENDSQL
CREATE TABLE IF NOT EXISTS `#__ak_storage` (
\t`tag` VARCHAR(255) NOT NULL,
\t`lastupdate` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
\t`data` LONGTEXT,
\tPRIMARY KEY (`tag`)
) DEFAULT CHARACTER SET utf8;
ENDSQL;
    }
 /**
  * Constructor.
  */
 public function __construct($config = array())
 {
     parent::__construct($config);
     // Get the pagination request variables
     $app = JFactory::getApplication();
     if (!$app instanceof JApplication) {
         $limit = 0;
         $limitstart = 0;
     } else {
         $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'));
         $limitstart = $app->getUserStateFromRequest('com_akeebaprofileslimitstart', 'limitstart', 0);
     }
     // Set the page pagination variables
     $this->setState('limit', $limit);
     $this->setState('limitstart', $limitstart);
     $this->table = 'stat';
 }
 /**
  * Tries to copy the profile whose ID is set in the model to a new record
  *
  * @return bool True on success
  */
 public function copy()
 {
     $id = $this->getId();
     // Check for invalid id's (not numeric, or <= 0)
     if (!is_numeric($id) || $id <= 0) {
         $this->setError(JText::_('PROFILE_INVALID_ID'));
         return false;
     }
     $profile = FOFModel::getTmpInstance('Profiles', 'AkeebaModel')->setId($id)->getItem()->getData();
     $profile['id'] = 0;
     $oProfile = $this->getTable();
     $oProfile->reset();
     $status = $oProfile->save($profile);
     if ($status) {
         $this->setId($oProfile->id);
     }
     return $status;
 }
 public function onBrowse($tpl = null)
 {
     $media_folder = JURI::base() . '../media/com_akeeba/';
     // Get the root URI for media files
     $this->assign('mediadir', AkeebaHelperEscape::escapeJS($media_folder . 'theme/'));
     // Get a JSON representation of the available roots
     $filters = AEFactory::getFilters();
     $root_info = $filters->getInclusions('dir');
     $roots = array();
     $options = array();
     if (!empty($root_info)) {
         // Loop all dir definitions
         foreach ($root_info as $dir_definition) {
             if (is_null($dir_definition[1])) {
                 // Site root definition has a null element 1. It is always pushed on top of the stack.
                 array_unshift($roots, $dir_definition[0]);
             } else {
                 $roots[] = $dir_definition[0];
             }
             $options[] = JHTML::_('select.option', $dir_definition[0], $dir_definition[0]);
         }
     }
     $site_root = $roots[0];
     $attribs = 'onchange="akeeba_active_root_changed();"';
     $this->assign('root_select', JHTML::_('select.genericlist', $options, 'root', $attribs, 'value', 'text', $site_root, 'active_root'));
     $this->assign('roots', $roots);
     $tpl = null;
     // Get a JSON representation of the directory data
     $model = $this->getModel();
     $json = json_encode($model->get_regex_filters($site_root));
     $this->assignRef('json', $json);
     // Add live help
     AkeebaHelperIncludes::addHelp('regexfsfilter');
     // Get profile ID
     $profileid = AEPlatform::getInstance()->get_active_profile();
     $this->assign('profileid', $profileid);
     // Get profile name
     $pmodel = FOFModel::getAnInstance('Profiles', 'AkeebaModel');
     $pmodel->setId($profileid);
     $profile_data = $pmodel->getItem();
     $this->assign('profilename', $profile_data->description);
     return true;
 }
Esempio n. 22
0
 /**
  * Constructor.
  */
 public function __construct($config = array())
 {
     parent::__construct($config);
     // Get the pagination request variables (we only have them if we're not in CLI
     if (JFactory::$application) {
         $app = JFactory::getApplication();
     } else {
         $app = new stdClass();
     }
     if (!($app instanceof JApplication || $app instanceof JApplicationAdministrator)) {
         $limit = 0;
         $limitstart = 0;
     } else {
         $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'));
         $limitstart = $app->getUserStateFromRequest('com_akeebaprofileslimitstart', 'limitstart', 0);
     }
     // Set the page pagination variables
     $this->setState('limit', $limit);
     $this->setState('limitstart', $limitstart);
     $this->table = 'stat';
 }
Esempio n. 23
0
 /**
  * Public constructor. Initialises the protected members as well. Useful $config keys:
  * update_component		The component name, e.g. com_foobar
  * update_version		The default version if the manifest cache is unreadable
  * update_site			The URL to the component's update XML stream
  * update_extraquery	The extra query to append to (commercial) components' download URLs
  * update_sitename		The update site's name (description)
  *
  * @param array $config
  */
 public function __construct($config = array())
 {
     parent::__construct($config);
     // Get an instance of the updater class
     $this->updater = JUpdater::getInstance();
     // Get the component name
     if (isset($config['update_component'])) {
         $this->component = $config['update_component'];
     } else {
         $this->component = $this->input->getCmd('option', '');
     }
     // Get the component version
     if (isset($config['update_version'])) {
         $this->version = $config['update_version'];
     }
     // Get the update site
     if (isset($config['update_site'])) {
         $this->updateSite = $config['update_site'];
     }
     // Get the extra query
     if (isset($config['update_extraquery'])) {
         $this->extraQuery = $config['update_extraquery'];
     }
     // Get the extra query
     if (isset($config['update_sitename'])) {
         $this->updateSiteName = $config['update_sitename'];
     }
     // Find the extension ID
     $db = $this->getDbo();
     $query = $db->getQuery(true)->select('*')->from($db->qn('#__extensions'))->where($db->qn('type') . ' = ' . $db->q('component'))->where($db->qn('element') . ' = ' . $db->q($this->component));
     $db->setQuery($query);
     $extension = $db->loadObject();
     if (is_object($extension)) {
         $this->extension_id = $extension->extension_id;
         $data = json_decode($extension->manifest_cache, true);
         if (isset($data['version'])) {
             $this->version = $data['version'];
         }
     }
 }
Esempio n. 24
0
 public function onBrowse($tpl = null)
 {
     // Add live help
     AkeebaHelperIncludes::addHelp('log');
     // Get a list of log names
     $model = $this->getModel();
     $this->logs = $model->getLogList();
     $tag = $model->getState('tag');
     if (empty($tag)) {
         $tag = null;
     }
     $this->tag = $tag;
     // Get profile ID
     $profileid = AEPlatform::getInstance()->get_active_profile();
     $this->profileid = $profileid;
     // Get profile name
     $pmodel = FOFModel::getAnInstance('Profiles', 'AkeebaModel');
     $pmodel->setId($profileid);
     $profile_data = $pmodel->getItem();
     $this->profilename = $profile_data->description;
     return true;
 }
 public function onBrowse($tpl = null)
 {
     $media_folder = JURI::base() . '../media/com_akeeba/';
     // Get the root URI for media files
     $this->assign('mediadir', AkeebaHelperEscape::escapeJS($media_folder . 'theme/'));
     // Get a JSON representation of the directories data
     $model = $this->getModel();
     $directories = $model->get_directories();
     $json = json_encode($directories);
     $this->assign('json', $json);
     // Add live help
     AkeebaHelperIncludes::addHelp('eff');
     // Get profile ID
     $profileid = AEPlatform::getInstance()->get_active_profile();
     $this->assign('profileid', $profileid);
     // Get profile name
     $pmodel = FOFModel::getAnInstance('Profiles', 'AkeebaModel');
     $pmodel->setId($profileid);
     $profile_data = $pmodel->getItem();
     $this->assign('profilename', $profile_data->description);
     return true;
 }
Esempio n. 26
0
 public function add()
 {
     $mainframe = JFactory::getApplication();
     $option = $this->input->getCmd('option', 'com_tracks');
     $db = JFactory::getDBO();
     $individualid = $this->input->getInt("individualid", 0);
     $name = $this->input->get("quickadd", '', 'request', 'string');
     $srid = $this->input->getInt("subround_id", 0);
     $projectid = $mainframe->getUserState($option . "project");
     // add the new individual as their name was sent through.
     if (!$individualid) {
         $model = FOFModel::getAnInstance('Individuals', 'TracksModel');
         $name = explode(" ", $name);
         $firstname = ucfirst(array_shift($name));
         $lastname = ucfirst(implode(" ", $name));
         $data = array("first_name" => $firstname, "last_name" => $lastname);
         $res = $model->save($data);
         if (!$res) {
             $msg = Jtext::_('COM_TRACKS_Error_adding_individual') . ': ' . $model->getError();
             $this->setRedirect("index.php?option=com_tracks&view=subroundresults&subround_id=" . $srid, $msg, 'error');
         }
         $individualid = $model->getId();
     }
     // check if indivual belongs to project
     $query = ' SELECT individual_id FROM #__tracks_projects_individuals ' . ' WHERE project_id = ' . $db->Quote($projectid) . '   AND individual_id = ' . $db->Quote($individualid);
     $db->setQuery($query);
     $res = $db->loadResult();
     if (!$res) {
         $db->setQuery("INSERT INTO #__tracks_projects_individuals (individual_id, project_id) VALUES (" . $individualid . ", " . $projectid . ")");
         $db->query();
     }
     // assign the individual to the subround.
     if ($individualid && $srid) {
         $db->setQuery("INSERT INTO #__tracks_rounds_results (individual_id, subround_id) VALUES (" . $individualid . ", " . $srid . ")");
         $db->query();
     }
     $this->setRedirect("index.php?option=com_tracks&view=subroundresults&subround_id=" . $srid);
 }
Esempio n. 27
0
 public function onDisplay($tpl = null)
 {
     $aeconfig = AEFactory::getConfiguration();
     // Add live help
     AkeebaHelperIncludes::addHelp('stw');
     $model = $this->getModel();
     $step = $model->getState('stwstep', 1);
     switch ($step) {
         case 1:
         default:
             $cpanelmodel = FOFModel::getTmpInstance('Cpanels', 'AkeebaModel');
             $this->profilelist = $cpanelmodel->getProfilesList();
             $this->stw_profile_id = $model->getSTWProfileID();
             break;
         case 2:
             $this->opts = $model->getTransferSettings();
             break;
         case 3:
             break;
     }
     $this->setLayout('step' . $step);
     return true;
 }
Esempio n. 28
0
 public function onBrowse($tpl = null)
 {
     $media_folder = JURI::base() . '../media/com_akeeba/';
     // Get the root URI for media files
     $this->mediadir = AkeebaHelperEscape::escapeJS($media_folder . 'theme/');
     // Get a JSON representation of the available roots
     $model = $this->getModel();
     $root_info = $model->get_roots();
     $roots = array();
     if (!empty($root_info)) {
         // Loop all dir definitions
         foreach ($root_info as $def) {
             $roots[] = $def->value;
             $options[] = JHTML::_('select.option', $def->value, $def->text);
         }
     }
     $site_root = '[SITEDB]';
     $attribs = 'onchange="akeeba_active_root_changed();"';
     $this->root_select = JHTML::_('select.genericlist', $options, 'root', $attribs, 'value', 'text', $site_root, 'active_root');
     $this->roots = $roots;
     $tpl = null;
     // Get a JSON representation of the directory data
     $model = $this->getModel();
     $json = json_encode($model->get_regex_filters($site_root));
     $this->json = $json;
     // Add live help
     AkeebaHelperIncludes::addHelp('regexdbfilter');
     // Get profile ID
     $profileid = AEPlatform::getInstance()->get_active_profile();
     $this->profileid = $profileid;
     // Get profile name
     $pmodel = FOFModel::getAnInstance('Profiles', 'AkeebaModel');
     $pmodel->setId($profileid);
     $profile_data = $pmodel->getItem();
     $this->profilename = $profile_data->description;
     return true;
 }
Esempio n. 29
0
 function _updateAdminToolsHtaccess()
 {
     // Define the files and folders to add to .htaccess Maker here:
     $base = 'plugins/editors/jckeditor/';
     $registry = null;
     jimport('joomla.filesystem.folder');
     $buffer = JFile::read(JPATH_ROOT . '/' . $base . 'install/access/exceptions.ini');
     $chunks = explode(chr(13), trim($buffer));
     $folders = array();
     $files = array();
     foreach ($chunks as $chunk) {
         list($k, $v) = explode('=', $chunk);
         if ($v == 'folder') {
             $folders[] = $base . trim($k);
         } elseif ($k && $v) {
             $files[] = $base . trim($k) . '.' . trim($v);
         }
     }
     $htmaker_additions = array('folders' => $folders, 'files' => $files);
     // DO NOT MODIFY BELOW THIS LINE
     // Is Admin Tools installed?
     if (!is_dir(JPATH_ADMINISTRATOR . '/components/com_admintools')) {
         return;
     }
     // Is it the Professional version?
     if (!is_file(JPATH_ADMINISTRATOR . '/components/com_admintools/models/htaccess.php') && !is_file(JPATH_ADMINISTRATOR . '/components/com_admintools/models/htmaker.php')) {
         return;
     }
     // Is Admin Tools enabled?
     $db = JFactory::getDbo();
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         $query = $db->getQuery(true)->select($db->qn('enabled'))->from($db->qn('#__extensions'))->where($db->qn('element') . ' = ' . $db->q('com_admintools'))->where($db->qn('type') . ' = ' . $db->q('component'));
         $db->setQuery($query);
     } else {
         $db->setQuery('SELECT `enabled` FROM `#__components` WHERE `link` = "option=com_admintools"');
     }
     $enabled = $db->loadResult();
     if (!$enabled) {
         return;
     }
     // Do we have a custom .htaccess file?
     $generateHtaccess = false;
     jimport('joomla.filesystem.file');
     if (JFile::exists(JPATH_ROOT . '/.htaccess')) {
         $htaccess = JFile::read(JPATH_ROOT . '/.htaccess');
         if ($htaccess !== false) {
             $htaccess = explode("\n", $htaccess);
             if ($htaccess[1] == '### Security Enhanced & Highly Optimized .htaccess File for Joomla!') {
                 $generateHtaccess = true;
             }
         }
     }
     // Load the FoF library
     if (!defined('FOF_INCLUDED')) {
         include_once JPATH_LIBRARIES . '/fof/include.php';
     }
     // Load the .htaccess Maker configuration
     if (!class_exists('AdmintoolsModelStorage')) {
         include_once JPATH_ADMINISTRATOR . '/components/com_admintools/models/storage.php';
     }
     $model = FOFModel::getTmpInstance('Htmaker', 'AdmintoolsModel');
     $config = $model->loadConfiguration();
     if (is_string($config->exceptionfiles)) {
         $config->exceptionfiles = explode("\n", $config->exceptionfiles);
     }
     if (is_string($config->exceptiondirs)) {
         $config->exceptiondirs = explode("\n", $config->exceptiondirs);
     }
     // Initialise
     $madeChanges = false;
     // Add missing files
     if (!empty($htmaker_additions['files'])) {
         foreach ($htmaker_additions['files'] as $f) {
             if (!in_array($f, $config->exceptionfiles)) {
                 $config->exceptionfiles[] = $f;
                 $madeChanges = true;
             }
         }
     }
     // Add missing folders
     if (!empty($htmaker_additions['folders'])) {
         foreach ($htmaker_additions['folders'] as $f) {
             if (!in_array($f, $config->exceptiondirs)) {
                 $config->exceptiondirs[] = $f;
                 $madeChanges = true;
             }
         }
     }
     if ($madeChanges) {
         // Save the configuration
         $customhead = $config->custhead;
         if (!strpos($customhead, 'pixlr.com')) {
             $customhead .= "\nRewriteCond %{QUERY_STRING} image=http://[a-zA-Z0-9_]+\\.pixlr.com\r\nRewriteRule .* - [L]";
         }
         $updates = array('exceptionfiles' => implode("\n", $config->exceptionfiles), 'exceptiondirs' => implode("\n", $config->exceptiondirs), 'custhead' => $customhead);
         $model->saveConfiguration($updates);
         if ($generateHtaccess) {
             $model->writeHtaccess();
         }
     }
 }
Esempio n. 30
0
 private function checkLevel($level)
 {
     $akeeba_level = FOFModel::getTmpInstance('Levels', 'AkeebasubsModel')->only_once(1)->enabled(1)->getItem($level);
     return $akeeba_level->enabled && $akeeba_level->akeebasubs_level_id == $level;
 }