Ejemplo n.º 1
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     if (interface_exists('JModel')) {
         $params = JModelLegacy::getInstance('Storage', 'AdmintoolsModel');
     } else {
         $params = JModel::getInstance('Storage', 'AdmintoolsModel');
     }
     $dirperms = '0' . ltrim(trim($params->getValue('dirperms', '0755')), '0');
     $fileperms = '0' . ltrim(trim($params->getValue('fileperms', '0644')), '0');
     $dirperms = octdec($dirperms);
     if ($dirperms < 0400 || $dirperms > 0777) {
         $dirperms = 0755;
     }
     $this->dirperms = $dirperms;
     $fileperms = octdec($fileperms);
     if ($fileperms < 0400 || $fileperms > 0777) {
         $fileperms = 0755;
     }
     $this->fileperms = $fileperms;
     $db = $this->getDBO();
     $query = $db->getQuery(true)->select(array($db->quoteName('path'), $db->quoteName('perms')))->from($db->quoteName('#__admintools_customperms'))->order($db->quoteName('path') . ' ASC');
     $db->setQuery($query);
     $this->customperms = $db->loadAssocList('path');
     // Add cache, tmp and log to the exceptions
     $this->skipDirs[] = rtrim(JPATH_CACHE, '/');
     $this->skipDirs[] = rtrim(JPATH_ROOT . '/cache', '/');
     $this->skipDirs[] = rtrim(JFactory::getConfig()->get('tmp_path', JPATH_ROOT . '/tmp'), '/');
     $this->skipDirs[] = rtrim(JFactory::getConfig()->get('log_path', JPATH_ROOT . '/logs'), '/');
 }
Ejemplo n.º 2
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     // This fixes an issue where sometimes no profiles are shown
     $this->setState('configuration', '');
     $this->setState('filter', '');
 }
Ejemplo n.º 3
0
 public function __construct(array $config)
 {
     parent::__construct($config);
     // Load the Akeeba Engine autoloader
     define('AKEEBAENGINE', 1);
     require_once JPATH_ADMINISTRATOR . '/components/com_admintools/engine/Autoloader.php';
     // Load the platform
     \Akeeba\Engine\Platform::addPlatform('filescan', JPATH_ADMINISTRATOR . '/components/com_admintools/platform/Filescan');
 }
Ejemplo n.º 4
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     // Load the Akeeba Engine autoloader
     define('AKEEBAENGINE', 1);
     require_once JPATH_ADMINISTRATOR . '/components/com_admintools/engine/Autoloader.php';
     // Load the platform
     \Akeeba\Engine\Platform::addPlatform('filescan', JPATH_ADMINISTRATOR . '/components/com_admintools/platform/Filescan');
     // Load the engine configuration
     \Akeeba\Engine\Platform::getInstance()->load_configuration(1);
     $this->aeconfig = \Akeeba\Engine\Factory::getConfiguration();
 }
Ejemplo n.º 5
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;
    }
Ejemplo n.º 6
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';
 }
Ejemplo n.º 7
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'];
         }
     }
 }
Ejemplo n.º 8
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     $session = JFactory::getSession();
     $encodedCacheData = $session->get('validation_cache_data', null, 'com_akeebasubs');
     if (!is_null($encodedCacheData)) {
         $this->_cache = json_decode($encodedCacheData, true);
     } else {
         $this->_cache = array();
     }
     // Load the state from cache, GET or POST variables
     if (!array_key_exists('state', $this->_cache)) {
         $this->_cache['state'] = array('paymentmethod' => '', 'username' => '', 'password' => '', 'password2' => '', 'name' => '', 'email' => '', 'email2' => '', 'address1' => '', 'address2' => '', 'country' => 'XX', 'state' => '', 'city' => '', 'zip' => '', 'isbusiness' => '', 'businessname' => '', 'vatnumber' => '', 'coupon' => '', 'occupation' => '', 'custom' => array(), 'subcustom' => array());
     }
     // Otherwise we always see the same level over and over again
     if (array_key_exists('id', $this->_cache['state'])) {
         unset($this->_cache['state']['id']);
     }
     $rawDataCache = $this->_cache['state'];
     $rawDataPost = JRequest::get('POST', 2);
     $rawDataGet = JRequest::get('GET', 2);
     $rawData = array_merge($rawDataCache, $rawDataGet, $rawDataPost);
     if (!empty($rawData)) {
         foreach ($rawData as $k => $v) {
             if (substr($k, 0, 1) == chr(0)) {
                 // Some people reported a key starting with a null byte causing a fatal error. Uh?!
                 continue;
             }
             if (empty($k)) {
                 // Some people reported an empty(!!!) key causing a fatal error. WTF?!
                 continue;
             }
             $this->setState($k, $v);
         }
     }
     // Save the new state data in the cache
     $this->_cache['state'] = (array) $this->getState();
     $encodedCacheData = json_encode($this->_cache);
     $session->set('validation_cache_data', $encodedCacheData, 'com_akeebasubs');
 }
Ejemplo n.º 9
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     $myURI = JURI::getInstance();
     $path = $myURI->getPath();
     $path_parts = explode('/', $path);
     $path_parts = array_slice($path_parts, 0, count($path_parts) - 2);
     $path = implode('/', $path_parts);
     $myURI->setPath($path);
     // Unset any query parameters
     $myURI->setQuery('');
     $host = $myURI->toString();
     $host = substr($host, strpos($host, '://') + 3);
     $path = trim($path, '/');
     if (!empty($path)) {
         $this->defaultConfig['rewritebase'] = $path;
     } else {
         $this->defaultConfig['rewritebase'] = '/';
     }
     $this->defaultConfig['httphost'] = $host;
     $this->defaultConfig['httpshost'] = $host;
     $this->defaultConfig = (object) $this->defaultConfig;
 }
Ejemplo n.º 10
0
 /**
  * Overridden constructor; lets us inject a different session
  *
  * @param array $config
  */
 public function __construct($config = array())
 {
     $this->session = isset($config['session']) ? $config['session'] : JFactory::getSession();
     parent::__construct($config);
 }
Ejemplo n.º 11
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 description
     if (isset($config['update_component_description'])) {
         $this->component = $config['update_component_description'];
     } else {
         // Try to auto-translate (hopefully you've loaded the language files)
         $key = strtoupper($this->component);
         $description = JText::_($key);
     }
     // Get the component version
     if (isset($config['update_version'])) {
         $this->version = $config['update_version'];
     }
     // Get the common key
     if (isset($config['common_key'])) {
         $this->commonKey = $config['common_key'];
     } else {
         // Convert com_foobar, pkg_foobar etc to "foobar"
         $this->commonKey = substr($this->component, 4);
     }
     // 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 update site's name
     if (isset($config['update_sitename'])) {
         $this->updateSiteName = $config['update_sitename'];
     }
     // Find the extension ID
     $db = F0FPlatform::getInstance()->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'];
         }
     }
 }
Ejemplo n.º 12
0
 function __construct($config = array())
 {
     parent::__construct($config);
 }
Ejemplo n.º 13
0
 /**
  * Constructor.
  *
  * @param   array  $config  An optional associative array of configuration settings.
  */
 public function __construct($config = array())
 {
     require_once dirname(__FILE__) . '/../helpers/update.php';
     parent::__construct($config);
 }
Ejemplo n.º 14
0
 /**
  * Constructor; dummy for now
  *
  */
 public function __construct()
 {
     parent::__construct();
 }
Ejemplo n.º 15
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     $this->initialize();
 }
Ejemplo n.º 16
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     $this->table = 'customperm';
 }