예제 #1
0
 public function onBrowse($tpl = null)
 {
     AkeebaStrapper::addJSfile('media://com_akeeba/js/fsfilter.js');
     $model = $this->getModel();
     $task = $model->getState('browse_task', 'normal');
     // Add custom submenus
     $toolbar = F0FToolbar::getAnInstance($this->input->get('option', 'com_foobar', 'cmd'), $this->config);
     $toolbar->appendLink(JText::_('FILTERS_LABEL_NORMALVIEW'), JUri::base() . 'index.php?option=com_akeeba&view=fsfilter&task=normal', $task == 'normal');
     $toolbar->appendLink(JText::_('FILTERS_LABEL_TABULARVIEW'), JUri::base() . 'index.php?option=com_akeeba&view=fsfilter&task=tabular', $task == 'tabular');
     $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
     $filters = Factory::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.Fsfilters.activeRootChanged();"';
     $this->root_select = JHTML::_('select.genericlist', $options, 'root', $attribs, 'value', 'text', $site_root, 'active_root');
     $this->roots = $roots;
     switch ($task) {
         case 'normal':
         default:
             $this->setLayout('default');
             // Get a JSON representation of the directory data
             $model = $this->getModel();
             $json = json_encode($model->make_listing($site_root, array(), ''));
             $this->json = $json;
             break;
         case 'tabular':
             $this->setLayout('tabular');
             // Get a JSON representation of the tabular filter data
             $model = $this->getModel();
             $json = json_encode($model->get_filters($site_root));
             $this->json = $json;
             break;
     }
     // Get profile ID
     $profileid = Platform::getInstance()->get_active_profile();
     $this->profileid = $profileid;
     // Get profile name
     $pmodel = F0FModel::getAnInstance('Profiles', 'AkeebaModel');
     $pmodel->setId($profileid);
     $profile_data = $pmodel->getItem();
     $this->profilename = $this->escape($profile_data->description);
     return true;
 }
예제 #2
0
파일: cpanel.php 프로젝트: kidaa30/lojinha
 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 = Factory::getConfiguration();
         // Invalidate stale backups
         Factory::resetState(array('global' => true, 'log' => false, 'maxrun' => $params->get('failure_timeout', 180)));
         // Just in case the reset() loaded a stale configuration...
         Platform::getInstance()->load_configuration();
         // Let's make sure the temporary and output directories are set correctly and writable...
         $wizmodel = F0FModel::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
         /** @var AkeebaModelUpdates $updateModel */
         $updateModel = F0FModel::getTmpInstance('Updates', 'AkeebaModel');
         $updateModel->refreshUpdateSite();
     }
     return $result;
 }
예제 #3
0
 public function onBeforeDispatch()
 {
     $result = parent::onBeforeDispatch();
     if ($result) {
         // Clear com_modules and com_plugins cache (needed when we alter module/plugin state)
         $core_components = array('com_modules', 'com_plugins');
         foreach ($core_components as $component) {
             try {
                 $cache = JFactory::getCache($component);
                 $cache->clean();
             } catch (Exception $e) {
                 // suck it up
             }
         }
         // Merge the language overrides
         $paths = array(JPATH_ROOT, JPATH_ADMINISTRATOR);
         $jlang = JFactory::getLanguage();
         $jlang->load($this->component, $paths[0], 'en-GB', true);
         $jlang->load($this->component, $paths[0], null, true);
         $jlang->load($this->component, $paths[1], 'en-GB', true);
         $jlang->load($this->component, $paths[1], null, true);
         $jlang->load($this->component . '.override', $paths[0], 'en-GB', true);
         $jlang->load($this->component . '.override', $paths[0], null, true);
         $jlang->load($this->component . '.override', $paths[1], 'en-GB', true);
         $jlang->load($this->component . '.override', $paths[1], null, true);
         // Load Akeeba Strapper
         if (!defined('ADMINTOOLSMEDIATAG')) {
             $staticFilesVersioningTag = md5(ADMINTOOLS_VERSION . ADMINTOOLS_DATE);
             define('ADMINTOOLSMEDIATAG', $staticFilesVersioningTag);
         }
         include_once JPATH_ROOT . '/media/akeeba_strapper/strapper.php';
         AkeebaStrapper::$tag = ADMINTOOLSMEDIATAG;
         AkeebaStrapper::bootstrap();
         AkeebaStrapper::jQueryUI();
         AkeebaStrapper::addCSSfile('admin://components/com_admintools/media/css/backend.css');
         // Work around non-transparent proxy and reverse proxy IP issues
         if (class_exists('F0FUtilsIp', true)) {
             F0FUtilsIp::workaroundIPIssues();
         }
         // Control Check
         $view = F0FInflector::singularize($this->input->getCmd('view', $this->defaultView));
         if ($view == 'liveupdate') {
             $url = JUri::base() . 'index.php?option=com_admintools';
             JFactory::getApplication()->redirect($url);
             return;
         }
         // ========== Master PW check ==========
         /** @var AdmintoolsModelMasterpw $model */
         $model = F0FModel::getAnInstance('Masterpw', 'AdmintoolsModel');
         if (!$model->accessAllowed($view)) {
             $url = $view == 'cpanel' ? 'index.php' : 'index.php?option=com_admintools&view=cpanel';
             JFactory::getApplication()->redirect($url, JText::_('ATOOLS_ERR_NOTAUTHORIZED'), 'error');
             return;
         }
     }
     return $result;
 }
예제 #4
0
 public function ajax()
 {
     $act = $this->input->get('act', '', 'cmd');
     $model = F0FModel::getAnInstance('Confwiz', 'AkeebaModel');
     $model->setState('act', $act);
     $ret = $model->runAjax();
     @ob_end_clean();
     echo '###' . json_encode($ret) . '###';
     flush();
     JFactory::getApplication()->close();
 }
예제 #5
0
 /**
  * Called whenever a subscription is modified. Namely, when its enabled status,
  * payment status or valid from/to dates are changed.
  */
 public function onAKSubscriptionChange($row, $info)
 {
     if (is_null($info['modified']) || empty($info['modified'])) {
         return;
     }
     //if(!array_key_exists('enabled', (array)$info['modified'])) return;
     // Load the plugin's language files
     $lang = JFactory::getLanguage();
     $lang->load('plg_akeebasubs_invoices', JPATH_ADMINISTRATOR, 'en-GB', true);
     $lang->load('plg_akeebasubs_invoices', JPATH_ADMINISTRATOR, null, true);
     // Akeeba Subscriptions language files
     $lang->load('com_akeebasubs', JPATH_SITE, 'en-GB', true);
     $lang->load('com_akeebasubs', JPATH_SITE, $lang->getDefault(), true);
     $lang->load('com_akeebasubs', JPATH_SITE, null, true);
     $lang->load('com_akeebasubs', JPATH_ADMINISTRATOR, 'en-GB', true);
     $lang->load('com_akeebasubs', JPATH_ADMINISTRATOR, $lang->getDefault(), true);
     $lang->load('com_akeebasubs', JPATH_ADMINISTRATOR, null, true);
     // Do not issue invoices for free subscriptions
     if ($row->gross_amount < 0.01) {
         return;
     }
     // Should we handle this subscription?
     $generateAnInvoice = $row->state == "C";
     $whenToGenerate = $this->params->get('generatewhen', '0');
     if ($whenToGenerate == 1) {
         // Handle new subscription, even if they are not yet enabled
         $specialCasePending = in_array($row->state, array('P', 'C')) && !$row->enabled;
         $generateAnInvoice = $generateAnInvoice || $specialCasePending;
     }
     // If the payment is over a week old do not generate an invoice. This
     // prevents accidentally creating an invoice for pas subscriptions not
     // handled by ccInvoices
     JLoader::import('joomla.utilities.date');
     $jCreated = new JDate($row->created_on);
     $jNow = new JDate();
     $dateDiff = $jNow->toUnix() - $jCreated->toUnix();
     if ($dateDiff > 604800) {
         return;
     }
     // Only handle not expired subscriptions
     if ($generateAnInvoice && !defined('AKEEBA_INVOICE_GENERATED')) {
         define('AKEEBA_INVOICE_GENERATED', 1);
         $db = JFactory::getDBO();
         // Check if there is an invoice for this subscription already
         $query = $db->getQuery(true)->select('*')->from('#__akeebasubs_invoices')->where($db->qn('akeebasubs_subscription_id') . ' = ' . $db->q($row->akeebasubs_subscription_id));
         $db->setQuery($query);
         $oldInvoices = $db->loadObjectList('akeebasubs_subscription_id');
         if (count($oldInvoices) > 0) {
             return;
         }
         // Create (and, optionally, send) a new invoice
         F0FModel::getAnInstance('Invoices', 'AkeebasubsModel')->createInvoice($row);
     }
 }
예제 #6
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 = F0FModel::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
         /** @var AkeebaModelUpdates $updateModel */
         $updateModel = F0FModel::getTmpInstance('Updates', 'AkeebaModel');
         $updateModel->refreshUpdateSite();
         // Check the last installed version and show the post-setup page on Joomla! 3.1 or earlier
         if (!version_compare(JVERSION, '3.2.0', 'ge')) {
             $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;
 }
예제 #7
0
 public function onBrowse($tpl = null)
 {
     // Get a list of log names
     /** @var AkeebaModelLogs $model */
     $model = $this->getModel();
     $this->logs = $model->getLogList();
     $tag = $model->getState('tag');
     if (empty($tag)) {
         $tag = null;
     }
     $this->tag = $tag;
     // Get profile ID
     $profileid = Platform::getInstance()->get_active_profile();
     $this->profileid = $profileid;
     // Get profile name
     $pmodel = F0FModel::getAnInstance('Profiles', 'AkeebaModel');
     $pmodel->setId($profileid);
     $profile_data = $pmodel->getItem();
     $this->profilename = $this->escape($profile_data->description);
     return true;
 }
예제 #8
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 = F0FModel::getAnInstance('Profiles', 'AkeebaModel');
     $pmodel->setId($profileid);
     $profile_data = $pmodel->getItem();
     $this->profilename = $profile_data->description;
     return true;
 }
예제 #9
0
 /**
  * This mess of a code is probably not one of my highlights in my code
  * writing career. It's logically organized, badly architectured but I can
  * still maintain it - and it works!
  */
 public function onAdd($tpl = null)
 {
     /** @var AkeebaModelBackups $model */
     $model = $this->getModel();
     // Load the Status Helper
     if (!class_exists('AkeebaHelperStatus')) {
         JLoader::import('helpers.status', JPATH_COMPONENT_ADMINISTRATOR);
     }
     $helper = AkeebaHelperStatus::getInstance();
     // Determine default description
     JLoader::import('joomla.utilities.date');
     $jregistry = JFactory::getConfig();
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $tzDefault = $jregistry->get('offset');
     } else {
         $tzDefault = $jregistry->getValue('config.offset');
     }
     $user = JFactory::getUser();
     $tz = $user->getParam('timezone', $tzDefault);
     $dateNow = new JDate('now', $tz);
     $default_description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->format(JText::_('DATE_FORMAT_LC2'), true);
     $default_description = AkeebaHelperEscape::escapeJS($default_description, "'");
     $backup_description = $model->getState('description', $default_description);
     $comment = $model->getState('comment', '');
     // Get a potential return URL
     $returnurl = $model->getState('returnurl');
     if (empty($returnurl)) {
         $returnurl = '';
     }
     // If a return URL is set *and* the profile's name is "Site Transfer
     // Wizard", we are running the Site Transfer Wizard
     if (!class_exists('AkeebaModelProfiles')) {
         JLoader::import('models.profiles', JPATH_COMPONENT_ADMINISTRATOR);
     }
     /** @var AkeebaModelCpanels $cpanelmodel */
     $cpanelmodel = F0FModel::getAnInstance('Cpanels', 'AkeebaModel');
     $profilemodel = new AkeebaModelProfiles();
     $profilemodel->setId($cpanelmodel->getProfileID());
     $profile_data = $profilemodel->getProfile();
     $isSTW = $profile_data->description == 'Site Transfer Wizard (do not rename)' && !empty($returnurl);
     $this->isSTW = $isSTW;
     // Get the domain details from scripting facility
     $registry = Factory::getConfiguration();
     $tag = $model->getState('tag');
     $script = $tag == 'restorepoint' ? 'full' : $registry->get('akeeba.basic.backup_type', 'full');
     $scripting = Factory::getEngineParamsProvider()->loadScripting();
     $domains = array();
     if (!empty($scripting)) {
         foreach ($scripting['scripts'][$script]['chain'] as $domain) {
             $description = JText::_($scripting['domains'][$domain]['text']);
             $domain_key = $scripting['domains'][$domain]['domain'];
             if ($isSTW && $domain_key == 'Packing') {
                 $description = JText::_('BACKUP_LABEL_DOMAIN_PACKING_STW');
             }
             $domains[] = array($domain_key, $description);
         }
     }
     $json_domains = AkeebaHelperEscape::escapeJS(json_encode($domains), '"\\');
     // Get the maximum execution time and bias
     $maxexec = $registry->get('akeeba.tuning.max_exec_time', 14) * 1000;
     $bias = $registry->get('akeeba.tuning.run_time_bias', 75);
     // Check if the output directory is writable
     $quirks = Factory::getConfigurationChecks()->getDetailedStatus();
     $unwritableOutput = array_key_exists('001', $quirks);
     // Pass on data
     $this->haserrors = !$helper->status;
     $this->hasquirks = $helper->hasQuirks();
     $this->quirks = $helper->getQuirksCell(!$helper->status);
     $this->description = $backup_description;
     $this->default_descr = $default_description;
     $this->comment = $comment;
     $this->domains = $json_domains;
     $this->maxexec = $maxexec;
     $this->bias = $bias;
     $this->useiframe = $registry->get('akeeba.basic.useiframe', 0) ? 'true' : 'false';
     $this->returnurl = $returnurl;
     $this->unwritableoutput = $unwritableOutput;
     if ($registry->get('akeeba.advanced.archiver_engine', 'jpa') == 'jps') {
         $this->showjpskey = 1;
         $this->jpskey = $registry->get('engine.archiver.jps.key', '');
     } else {
         $this->showjpskey = 0;
     }
     if (AKEEBA_PRO) {
         $this->showangiekey = 1;
         $this->angiekey = $registry->get('engine.installer.angie.key', '');
     } else {
         $this->showangiekey = 0;
         $this->angiekey = '';
     }
     $this->autostart = $model->getState('autostart');
     // Pass on profile info
     $this->profileid = $cpanelmodel->getProfileID();
     // Active profile ID
     $this->profilelist = $cpanelmodel->getProfilesList();
     // List of available profiles
     // Pass on state information pertaining to SRP
     $this->srpinfo = $model->getState('srpinfo');
     // Add live help
     AkeebaHelperIncludes::addHelp('backup');
     // Set the toolbar title
     if ($this->srpinfo['tag'] == 'restorepoint') {
         $subtitle = JText::_('AKEEBASRP');
     } elseif ($isSTW) {
         $subtitle = JText::_('SITETRANSFERWIZARD');
     } else {
         $subtitle = JText::_('BACKUP');
     }
     JToolBarHelper::title(JText::_('AKEEBA') . ':: <small>' . $subtitle . '</small>', 'akeeba');
     return true;
 }
예제 #10
0
 protected function onBrowse($tpl = null)
 {
     // Is this the Professional release?
     JLoader::import('joomla.filesystem.file');
     $isPro = ADMINTOOLS_PRO == 1;
     $this->isPro = $isPro;
     // Should we show the stats and graphs?
     JLoader::import('joomla.html.parameter');
     JLoader::import('joomla.application.component.helper');
     $db = JFactory::getDbo();
     $sql = $db->getQuery(true)->select($db->qn('params'))->from($db->qn('#__extensions'))->where($db->qn('type') . ' = ' . $db->q('component'))->where($db->qn('element') . ' = ' . $db->q('com_admintools'));
     $db->setQuery($sql);
     $rawparams = $db->loadResult();
     $params = new JRegistry();
     $params->loadString($rawparams, 'JSON');
     $this->showstats = $params->get('showstats', 1);
     $reorderPlugin = $params->get('reorderplugin', 1);
     // Load the models
     /** @var AdmintoolsModelCpanels $model */
     $model = $this->getModel();
     /** @var AdmintoolsModelAdminpw $adminpwmodel */
     $adminpwmodel = F0FModel::getAnInstance('Adminpw', 'AdmintoolsModel');
     /** @var AdmintoolsModelMasterpw $mpModel */
     $mpModel = F0FModel::getAnInstance('Masterpw', 'AdmintoolsModel');
     /** @var AdmintoolsModelGeoblock $geoModel */
     $geoModel = F0FModel::getAnInstance('Geoblock', 'AdmintoolsModel');
     /** @var AdmintoolsModelStats $statsModel */
     $statsModel = F0FModel::getAnInstance('Stats', 'AdmintoolsModel');
     /** Reorder the Admin Tools plugin */
     if ($reorderPlugin) {
         $model->reorderPlugin();
     }
     // Decide on the administrator password padlock icon
     $adminlocked = $adminpwmodel->isLocked();
     $this->adminLocked = $adminlocked;
     // Do we have to show a master password box?
     $this->hasValidPassword = $mpModel->hasValidPassword();
     // Is this MySQL?
     $dbType = JFactory::getDbo()->name;
     $isMySQL = strpos($dbType, 'mysql') !== false;
     // If the user doesn't have a valid master pw for some views, don't show
     // the buttons.
     $this->enable_cleantmp = $mpModel->accessAllowed('cleantmp');
     $this->enable_fixperms = $mpModel->accessAllowed('fixperms');
     $this->enable_purgesessions = $mpModel->accessAllowed('purgesessions');
     $this->enable_dbtools = $mpModel->accessAllowed('dbtools');
     $this->enable_dbchcol = $mpModel->accessAllowed('dbchcol');
     $this->isMySQL = $isMySQL;
     $this->pluginid = $model->getPluginID();
     $this->hasplugin = $geoModel->hasGeoIPPlugin();
     $this->pluginNeedsUpdate = $geoModel->dbNeedsUpdate();
     // Is this a very old version? If it's older than 90 days let's warn the user
     $this->oldVersion = false;
     $relDate = new JDate(ADMINTOOLS_DATE);
     $interval = time() - $relDate->toUnix();
     if ($interval > 60 * 60 * 24 * 90) {
         $this->oldVersion = true;
     }
     $this->loadHelper('servertech');
     // Is .htaccess Maker supported?
     $this->htMakerSupported = AdmintoolsHelperServertech::isHtaccessSupported();
     // Is NginX Configuration Maker supported?
     $this->nginxMakerSupported = AdmintoolsHelperServertech::isNginxSupported();
     // Collect information about the site
     $this->statsIframe = F0FModel::getTmpInstance('Stats', 'AdmintoolsModel')->collectStatistics(true);
     // Post-installation messages information
     $this->hasPostInstallationMessages = $model->hasPostInstallMessages();
     $this->extension_id = $model->getState('extension_id', 0, 'int');
     $this->needsdlid = $model->needsDownloadID();
     return true;
 }
예제 #11
0
파일: relation.php 프로젝트: esorone/efcpw
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  */
 protected function getOptions()
 {
     $options = array();
     $this->value = array();
     $value_field = $this->element['value_field'] ? (string) $this->element['value_field'] : 'title';
     $input = new F0FInput();
     $component = ucfirst(str_replace('com_', '', $input->getString('option')));
     $view = ucfirst($input->getString('view'));
     $relation = F0FInflector::pluralize((string) $this->element['name']);
     $model = F0FModel::getTmpInstance(ucfirst($relation), $component . 'Model');
     $table = $model->getTable();
     $key = $table->getKeyName();
     $value = $table->getColumnAlias($value_field);
     foreach ($model->getItemList(true) as $option) {
         $options[] = JHtml::_('select.option', $option->{$key}, $option->{$value});
     }
     if ($id = F0FModel::getAnInstance($view)->getId()) {
         $table = F0FTable::getInstance($view, $component . 'Table');
         $table->load($id);
         $relations = $table->getRelations()->getMultiple($relation);
         foreach ($relations as $item) {
             $this->value[] = $item->getId();
         }
     }
     return $options;
 }
예제 #12
0
 /**
  * Generates a selectlist for shipping methods
  *
  * @param unknown_type $selected
  * @param unknown_type $name
  * @param unknown_type $attribs
  * @param unknown_type $idtag
  * @return unknown_type
  */
 public static function shippingmethod($selected, $name = 'filter_shipping_method', $attribs = array('class' => 'inputbox'), $idtag = null)
 {
     $list = array();
     F0FModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_j2store/models');
     //JModelLegacy::addIncludePath( JPATH_ADMINISTRATOR.'/components/com_j2store/models' );
     $model = F0FModel::getAnInstance('Shippingmethods', 'J2StoreModel');
     $model->setState('filter_enabled', true);
     $items = $model->getList();
     foreach (@$items as $item) {
         $list[] = self::option($item->shipping_method_id, JText::_($item->shipping_method_name));
     }
     return JHTML::_('select.radiolist', $list, $name, $attribs, 'value', 'text', $selected, $idtag);
 }
예제 #13
0
 /**
  * Method to set variant
  */
 function setvariant()
 {
     $app = JFactory::getApplication();
     $model = F0FModel::getAnInstance('Variants', 'J2StoreModel');
     $view = $this->getThisView();
     $variant_id = $app->input->getInt('variant_id');
     $item = $model->getItem($variant_id);
     $product_id = $item->product_id;
     $product_item = F0FModel::getAnInstance('Products', 'J2StoreModel')->getItem($product_id);
     $view = $this->getThisView();
     $view->set('item', $item);
     $view->addTemplatePath(JPATH_ADMINISTRATOR . '/components/com_j2store/views/product/tmpl/');
     $view->set('product_item', $product_item);
     $view->set('form_prefix', 'jform[j2store][attribs]');
     $view = $this->display();
 }
예제 #14
0
 /**
  * This mess of a code is probably not one of my highlights in my code
  * writing career. It's logically organized, badly architectured but I can
  * still maintain it - and it works!
  */
 public function onAdd($tpl = null)
 {
     AkeebaStrapper::addJSfile('media://com_akeeba/js/backup.js');
     /** @var AkeebaModelBackups $model */
     $model = $this->getModel();
     // Load the Status Helper
     if (!class_exists('AkeebaHelperStatus')) {
         JLoader::import('helpers.status', JPATH_COMPONENT_ADMINISTRATOR);
     }
     $helper = AkeebaHelperStatus::getInstance();
     // Determine default description
     JLoader::import('joomla.utilities.date');
     $jregistry = JFactory::getConfig();
     $tzDefault = $jregistry->get('offset');
     $user = JFactory::getUser();
     $tz = $user->getParam('timezone', $tzDefault);
     $dateNow = new JDate('now', $tz);
     $default_description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->format(JText::_('DATE_FORMAT_LC2'), true);
     $default_description = AkeebaHelperEscape::escapeJS($default_description, "'");
     $backup_description = $model->getState('description', $default_description);
     $comment = $model->getState('comment', '');
     // Get a potential return URL
     $returnurl = $model->getState('returnurl');
     if (empty($returnurl)) {
         $returnurl = '';
     }
     // Only allow internal URLs for the redirection
     if (!JUri::isInternal($returnurl)) {
         $returnurl = '';
     }
     // If a return URL is set *and* the profile's name is "Site Transfer
     // Wizard", we are running the Site Transfer Wizard
     if (!class_exists('AkeebaModelProfiles')) {
         JLoader::import('models.profiles', JPATH_COMPONENT_ADMINISTRATOR);
     }
     /** @var AkeebaModelCpanels $cpanelmodel */
     $cpanelmodel = F0FModel::getAnInstance('Cpanels', 'AkeebaModel');
     $profilemodel = new AkeebaModelProfiles();
     $profilemodel->setId($cpanelmodel->getProfileID());
     $profile_data = $profilemodel->getProfile();
     // Get the domain details from scripting facility
     $registry = Factory::getConfiguration();
     $tag = $model->getState('tag');
     $script = $registry->get('akeeba.basic.backup_type', 'full');
     $scripting = Factory::getEngineParamsProvider()->loadScripting();
     $domains = array();
     if (!empty($scripting)) {
         foreach ($scripting['scripts'][$script]['chain'] as $domain) {
             $description = JText::_($scripting['domains'][$domain]['text']);
             $domain_key = $scripting['domains'][$domain]['domain'];
             $domains[] = array($domain_key, $description);
         }
     }
     $json_domains = AkeebaHelperEscape::escapeJS(json_encode($domains), '"\\');
     // Get the maximum execution time and bias
     $maxexec = $registry->get('akeeba.tuning.max_exec_time', 14) * 1000;
     $bias = $registry->get('akeeba.tuning.run_time_bias', 75);
     // Check if the output directory is writable
     $quirks = Factory::getConfigurationChecks()->getDetailedStatus();
     $unwritableOutput = array_key_exists('001', $quirks);
     // Pass on data
     $this->haserrors = !$helper->status;
     $this->hasquirks = $helper->hasQuirks();
     $this->quirks = $helper->getQuirksCell(!$helper->status);
     $this->description = $backup_description;
     $this->default_descr = $default_description;
     $this->comment = $comment;
     $this->domains = $json_domains;
     $this->maxexec = $maxexec;
     $this->bias = $bias;
     $this->useiframe = $registry->get('akeeba.basic.useiframe', 0) ? 'true' : 'false';
     $this->returnurl = $returnurl;
     $this->unwritableoutput = $unwritableOutput;
     if ($registry->get('akeeba.advanced.archiver_engine', 'jpa') == 'jps') {
         $this->showjpskey = 1;
         $this->jpskey = $registry->get('engine.archiver.jps.key', '');
     } else {
         $this->showjpskey = 0;
     }
     if (AKEEBA_PRO) {
         $this->showangiekey = 1;
         $this->angiekey = $registry->get('engine.installer.angie.key', '');
     } else {
         $this->showangiekey = 0;
         $this->angiekey = '';
     }
     $this->autostart = $model->getState('autostart');
     // Pass on profile info
     $this->profileid = $cpanelmodel->getProfileID();
     // Active profile ID
     $this->profilelist = $cpanelmodel->getProfilesList();
     // List of available profiles
     // Should I ask for permission to display desktop notifications?
     JLoader::import('joomla.application.component.helper');
     $this->desktop_notifications = \Akeeba\Engine\Util\Comconfig::getValue('desktop_notifications', '0') ? 1 : 0;
     // Set the toolbar title
     $subtitle = JText::_('BACKUP');
     JToolBarHelper::title(JText::_('AKEEBA') . ':: <small>' . $subtitle . '</small>', 'akeeba');
     return true;
 }
예제 #15
0
 protected function onGetexpirations($tpl = null)
 {
     $model = F0FModel::getAnInstance('Subscriptions', 'AkeebasubsModel');
     $this->setModel($model, true);
     return parent::onDisplay($tpl);
 }
예제 #16
0
 /**
  * Creates a new model object
  *
  * @param   string  $name    The name of the model class, e.g. Items
  * @param   string  $prefix  The prefix of the model class, e.g. FoobarModel
  * @param   array   $config  The configuration parameters for the model class
  *
  * @return  F0FModel  The model object
  */
 protected function createModel($name, $prefix = '', $config = array())
 {
     // Make sure $config is an array
     if (is_object($config)) {
         $config = (array) $config;
     } elseif (!is_array($config)) {
         $config = array();
     }
     $result = null;
     // Clean the model name
     $modelName = preg_replace('/[^A-Z0-9_]/i', '', $name);
     $classPrefix = preg_replace('/[^A-Z0-9_]/i', '', $prefix);
     $result = F0FModel::getAnInstance($modelName, $classPrefix, $config);
     return $result;
 }
예제 #17
0
 /**
  * Use the slug instead of the id to read a record
  *
  * @return bool
  */
 public function onBeforeRead()
 {
     // Do we have an affiliate code?
     $affid = $this->input->getInt('affid', 0);
     if ($affid) {
         $session = JFactory::getSession();
         $session->set('affid', $affid, 'com_akeebasubs');
     }
     // Fetch the subscription slug from page parameters
     $params = JFactory::getApplication()->getPageParameters();
     $pageslug = $params->get('slug', '');
     $slug = $this->input->getString('slug', null);
     if ($pageslug) {
         $slug = $pageslug;
         $this->input->set('slug', $slug);
     }
     $this->getThisModel()->setIDsFromRequest();
     $this->getThisModel()->access_user_id(JFactory::getUser()->id);
     $id = $this->getThisModel()->getId();
     if (!$id && $slug) {
         $item = F0FModel::getTmpInstance('Levels', 'AkeebasubsModel')->slug($slug)->getFirstItem();
         if (!empty($item->akeebasubs_level_id)) {
             $id = $item->akeebasubs_level_id;
             $this->getThisModel()->setId($item->akeebasubs_level_id);
         }
     }
     // Working around Progressive Caching
     JFactory::getApplication()->input->set('slug', $slug);
     JFactory::getApplication()->input->set('id', $id);
     $this->registerUrlParams(array('slug' => 'STRING', 'id' => 'INT'));
     // Get the current level
     $level = $this->getThisModel()->getItem();
     // Make sure the level exists
     if ($level->akeebasubs_level_id == 0) {
         return false;
     }
     // Make sure the level is published
     if (!$level->enabled) {
         return false;
     }
     // Check for "Forbid renewal" conditions
     if ($level->only_once) {
         $levels = F0FModel::getTmpInstance('Levels', 'AkeebasubsModel')->slug($level->slug)->only_once(1)->getItemList();
         if (!count($levels)) {
             // User trying to renew a level which is marked as only_once
             if ($level->renew_url) {
                 JFactory::getApplication()->redirect($level->renew_url);
             }
             return false;
         }
         $this->getThisModel()->setId($id);
     }
     $view = $this->getThisView();
     // Get the user model and load the user data
     $userparams = F0FModel::getTmpInstance('Users', 'AkeebasubsModel')->user_id(JFactory::getUser()->id)->getMergedData(JFactory::getUser()->id);
     $view->assign('userparams', $userparams);
     // Load any cached user supplied information
     $vModel = F0FModel::getAnInstance('Subscribes', 'AkeebasubsModel')->slug($slug)->id($id);
     $cache = (array) $vModel->getData();
     if ($cache['firstrun']) {
         foreach ($cache as $k => $v) {
             if (empty($v)) {
                 if (property_exists($userparams, $k)) {
                     $cache[$k] = $userparams->{$k};
                 }
             }
         }
     }
     $view->assign('cache', (array) $cache);
     $view->assign('validation', $vModel->getValidation());
     // If we accidentally have the awesome layout set, please reset to default
     if ($this->layout == 'awesome') {
         $this->layout = 'default';
     }
     if ($this->layout == 'item') {
         $this->layout = 'default';
     }
     if (empty($this->layout)) {
         $this->layout = 'default';
     }
     return true;
 }
예제 #18
0
 function setRates()
 {
     $app = JFactory::getApplication();
     $this->includeCustomModel('ShippingRates');
     $sid = $app->input->getInt('sid');
     $lists = array();
     $this->includeCustomTables();
     $row = F0FTable::getAnInstance('ShippingMethod', 'J2StoreTable');
     $row->load($sid);
     $model = F0FModel::getAnInstance('ShippingRates', 'J2StoreModel');
     //set the shipping method id
     $model->set('filter_shippingmethod', $sid);
     $items = $model->getList();
     //form
     $form = array();
     $form['action'] = $this->baseLink();
     JToolBarHelper::title(JText::_('J2STORE_SHIPM_SHIPPING_METHODS'), 'j2store-logo');
     // view
     $view = $this->getView('ShippingMethods', 'html');
     $view->setModel($model, true);
     $view->addTemplatePath(JPATH_SITE . '/plugins/j2store/' . $this->_element . '/' . $this->_element . '/tmpl');
     $view->set('row', $row);
     $view->items = $items;
     $view->set('total', $model->getTotal());
     $view->set('pagination', $model->getPagination());
     //$view->lists = $lists ;
     $view->form2 = $form;
     $view->baseLink = $this->baseLink();
     $view->setLayout('setrates');
     $view->display();
 }