Пример #1
0
 /**
  * handleRequest
  *
  * @return void
  */
 public function handleRequest()
 {
     if (!$this->getModuleID()) {
         $this->setReturnURL($this->buildURL('addons_list_installed'));
     }
     parent::handleRequest();
 }
Пример #2
0
 /**
  * init
  *
  * @return void
  */
 public function init()
 {
     parent::init();
     if (empty(\XLite\Core\Request::getInstance()->login)) {
         \XLite\Core\Request::getInstance()->login = \XLite\Core\Auth::getInstance()->remindLogin();
     }
 }
Пример #3
0
 /**
  * Controller constructor
  *
  * @param array $params
  */
 public function __construct(array $params = array())
 {
     parent::__construct($params);
     if ('view_license' === $this->getAction()) {
         $this->getLicense();
     }
 }
Пример #4
0
 /**
  * handleRequest
  *
  * @return void
  */
 public function handleRequest()
 {
     if (\XLite\Core\Request::getInstance()->isPost()) {
         set_time_limit(0);
     }
     $this->sqldumpFile = LC_DIR_BACKUP . 'sqldump.sql.php';
     parent::handleRequest();
 }
Пример #5
0
 /**
  * getViewerTemplate
  *
  * @return string
  */
 protected function getViewerTemplate()
 {
     $result = parent::getViewerTemplate();
     if ('print_label' === \XLite\Core\Request::getInstance()->mode) {
         $result = 'modules/XC/PitneyBowes/asn/label/body.tpl';
     }
     return $result;
 }
Пример #6
0
 /**
  * Initialize controller
  *
  * @return void
  */
 public function init()
 {
     parent::init();
     // Download data from marketplace
     \XLite\Core\Marketplace::getInstance()->saveAddonsList();
     // Download data from marketplace
     \XLite\Core\Marketplace::getInstance()->checkAddonsKeys();
 }
Пример #7
0
 /**
  * Get return URL
  *
  * @return string
  */
 public function getReturnURL()
 {
     if (\XLite\Core\Request::getInstance()->action) {
         $url = $this->buildURL('languages', '', array('language' => \XLite\Core\Request::getInstance()->language, 'page' => max(1, intval(\XLite\Core\Request::getInstance()->page))));
     } else {
         $url = parent::getReturnURL();
     }
     return $url;
 }
Пример #8
0
 /**
  * init
  *
  * @return void
  */
 public function init()
 {
     if (!in_array('country_code', $this->params)) {
         $this->params[] = 'country_code';
     }
     parent::init();
     $countryCode = isset(\XLite\Core\Request::getInstance()->country_code) ? \XLite\Core\Request::getInstance()->country_code : \XLite\Core\Config::getInstance()->General->default_country;
     $this->set('country_code', $countryCode);
 }
Пример #9
0
 /**
  * Get return URL
  *
  * @return string
  */
 public function getReturnURL()
 {
     if (\XLite\Core\Request::getInstance()->action) {
         $data = array();
         if (\XLite\Core\Request::getInstance()->code) {
             $data['code'] = \XLite\Core\Request::getInstance()->code;
         }
         $url = $this->buildURL('labels', '', $data);
     } else {
         $url = parent::getReturnURL();
     }
     return $url;
 }
Пример #10
0
 /**
  * Check ACL permissions
  *
  * @return boolean
  */
 public function checkACL()
 {
     $result = parent::checkACL();
     if (!$result) {
         foreach (static::getSearchCodePermissions() as $code => $permissions) {
             if (static::isSearchPermissionAllowed($permissions)) {
                 $result = true;
                 break;
             }
         }
     }
     return $result;
 }
Пример #11
0
 /**
  * Check ACL permissions
  *
  * @return boolean
  */
 public function checkACL()
 {
     $result = parent::checkACL();
     if (!$result) {
         $dictionary = \XLite\Core\Request::getInstance()->dictionary;
         $permissions = $this->getDictionaryPermissions();
         if (!empty($permissions[$dictionary])) {
             foreach ($permissions[$dictionary] as $p) {
                 if (\XLite\Core\Auth::getInstance()->isPermissionAllowed($p)) {
                     $result = true;
                     break;
                 }
             }
         }
     }
     return $result;
 }
Пример #12
0
 /**
  * Returns value by request
  *
  * @param string $name Type of value
  *
  * @return string
  */
 public function get($name)
 {
     $return = '';
     switch ($name) {
         case 'phpversion':
             $return = PHP_VERSION;
             break;
         case 'os_type':
             list($osType) = explode(' ', PHP_OS);
             $return = $osType;
             break;
         case 'mysql_server':
             $return = \Includes\Utils\Database::getDbVersion();
             break;
         case 'innodb_support':
             $return = \Includes\Utils\Database::isInnoDBSupported();
             break;
         case 'root_folder':
             $return = getcwd();
             break;
         case 'web_server':
             if (isset($_SERVER['SERVER_SOFTWARE'])) {
                 $return = $_SERVER['SERVER_SOFTWARE'];
             } else {
                 $return = '';
             }
             break;
         case 'xml_parser':
             ob_start();
             phpinfo(INFO_MODULES);
             $phpInfo = ob_get_contents();
             ob_end_clean();
             if (preg_match('/EXPAT.+>([\\.\\d]+)/mi', $phpInfo, $m)) {
                 $return = $m[1];
             } else {
                 $return = function_exists('xml_parser_create') ? 'found' : '';
             }
             break;
         case 'gdlib':
             if (!$this->is('GDLibLoaded')) {
                 $return = '';
             } else {
                 ob_start();
                 phpinfo(INFO_MODULES);
                 $phpInfo = ob_get_contents();
                 ob_end_clean();
                 if (preg_match('/GD.+>([\\.\\d]+)/mi', $phpInfo, $m)) {
                     $gdVersion = $m[1];
                 } else {
                     $gdVersion = @gd_info();
                     if (is_array($gdVersion) && isset($gdVersion['GD Version'])) {
                         $gdVersion = $gdVersion['GD Version'];
                     } else {
                         $gdVersion = 'unknown';
                     }
                 }
                 $return = 'found (' . $gdVersion . ')';
             }
             break;
         case 'core_version':
             $return = \XLite::getInstance()->getVersion();
             break;
         case 'libcurl':
             $libcurlVersion = curl_version();
             if (is_array($libcurlVersion)) {
                 $libcurlVersion = $libcurlVersion['version'];
             }
             $return = $libcurlVersion;
             break;
         case 'check_files':
             $result = array();
             $files = array();
             foreach ($files as $file) {
                 $mode = $this->getFilePermission($file);
                 $modeStr = $this->getFilePermissionStr($file);
                 $res = array('file' => $file, 'error' => '');
                 if (!is_file($file)) {
                     $res['error'] = 'does_not_exist';
                     $result[] = $res;
                     continue;
                 }
                 $perm = substr(sprintf('%o', @fileperms($file)), -4);
                 if ($perm != $modeStr) {
                     if (!@chmod($file, $mode)) {
                         $res['error'] = 'cannot_chmod';
                         $result[] = $res;
                         continue;
                     }
                 } else {
                     if ($this->getComplex('xlite.suMode') != 0) {
                         if (!@chmod($file, $mode)) {
                             $res['error'] = 'wrong_owner';
                             $result[] = $res;
                             continue;
                         }
                     }
                 }
                 $result[] = $res;
             }
             $return = $result;
             break;
             // :FIXME: checng to the constants
         // :FIXME: checng to the constants
         case 'check_dirs':
             $result = array();
             $dirs = array('var/run', 'var/log', 'var/html', 'var/backup', 'var/tmp', 'catalog', 'images', 'classes/modules', 'skins/default/en/modules', 'skins/admin/en/modules', 'skins/default/en/images/modules', 'skins/admin/en/images/modules', 'skins/mail/en/modules', 'skins/mail/en/images/modules');
             foreach ($dirs as $dir) {
                 $mode = $this->getDirPermission($dir);
                 $modeStr = $this->getDirPermissionStr($dir);
                 $res = array('dir' => $dir, 'error' => '', 'subdirs' => array());
                 if (!is_dir($dir)) {
                     $fullPath = '';
                     $path = explode('/', $dir);
                     foreach ($path as $sub) {
                         $fullPath .= $sub . '/';
                         if (!is_dir($fullPath) && @mkdir($fullPath, $mode) !== true) {
                             break;
                         }
                     }
                 }
                 if (!is_dir($dir)) {
                     $res['error'] = 'cannot_create';
                     $result[] = $res;
                     continue;
                 }
                 $perm = substr(sprintf('%o', @fileperms($dir)), -4);
                 if ($perm != $modeStr) {
                     if (!@chmod($dir, $mode)) {
                         $res['error'] = 'cannot_chmod';
                         $result[] = $res;
                         continue;
                     }
                 } else {
                     if ($this->getComplex('xlite.suMode') != 0 || strpos($dir, 'var') !== false) {
                         if (!@chmod($dir, $mode)) {
                             $res['error'] = 'wrong_owner';
                             $result[] = $res;
                             continue;
                         }
                     }
                 }
                 $subdirs = array();
                 if ('catalog' != $dir && 'images' != $dir) {
                     $this->checkSubdirs($dir, $subdirs);
                 }
                 if (!empty($subdirs)) {
                     $res['error'] = 'cannot_chmod_subdirs';
                     $res['subdirs'] = $subdirs;
                     $result[] = $res;
                     continue;
                 }
                 $result[] = $res;
             }
             $return = $result;
             break;
         default:
             $return = parent::get($name);
     }
     return $return;
 }
Пример #13
0
 /**
  * Check if current page is accessible
  *
  * @return boolean
  */
 public function checkAccess()
 {
     return parent::checkAccess() && $this->isAJAX();
 }
Пример #14
0
 /**
  * Process 'no action'
  *
  * @return void
  */
 protected function doNoAction()
 {
     parent::doNoAction();
     if (\XLite\Core\Request::getInstance()->fast_search) {
         // Clear stored search conditions
         \XLite\Core\Session::getInstance()->{$this->getSessionCellName()} = array();
         $this->prepareSearchParams();
         // Get ItemsList widget
         $widget = new \XLite\View\ItemsList\Model\Order\Admin\Search();
         // Search for single order
         $entity = $widget->searchForSingleEntity();
         if ($entity && $entity instanceof \XLite\Model\Order) {
             // Prepare redirect to order page
             $url = $this->buildURL('order', '', array('order_number' => $entity->getOrderNumber()));
             $this->setReturnURL($url);
         }
     }
 }
Пример #15
0
 /**
  * Run controller
  *
  * @return void
  */
 protected function run()
 {
     if (\XLite\Core\Request::getInstance()->cancel_import) {
         $this->clearImportCell();
     }
     parent::run();
 }
Пример #16
0
 /**
  * Return current category Id
  *
  * @return integer
  */
 public function getCategoryId()
 {
     return parent::getCategoryId() ?: $this->getRootCategoryId();
 }
Пример #17
0
 /**
  * Check if current page is accessible
  *
  * @return boolean
  */
 public function checkAccess()
 {
     return parent::checkAccess() && $this->getProductsReturn();
 }
Пример #18
0
 /**
  * Run controller
  *
  * @return void
  */
 protected function run()
 {
     \XLite\Core\Marketplace::getInstance()->updateShippingMethods();
     parent::run();
 }
Пример #19
0
 /**
  * Define the actions with no secure token
  *
  * @return array
  */
 public static function defineFreeFormIdActions()
 {
     return array_merge(parent::defineFreeFormIdActions(), array('test'));
 }
Пример #20
0
 /**
  * Check if current page is accessible
  *
  * @return boolean
  */
 public function checkAccess()
 {
     return parent::checkAccess() && $this->isOrigProfile();
 }
Пример #21
0
 /**
  * Handles the request.
  * Parses the request variables if necessary. Attempts to call the specified action function
  *
  * @return void
  */
 public function handleRequest()
 {
     parent::handleRequest();
     $this->headerStatus(403);
 }
Пример #22
0
 /**
  * Define the actions with no secure token
  *
  * @return array
  */
 public static function defineFreeFormIdActions()
 {
     return array_merge(parent::defineFreeFormIdActions(), array('finishOperateAs'));
 }
Пример #23
0
 /**
  * Define the actions with no secure token
  *
  * @return array
  */
 public static function defineFreeFormIdActions()
 {
     $list = parent::defineFreeFormIdActions();
     $list[] = 'get';
     return $list;
 }
Пример #24
0
 /**
  * Call controller action
  *
  * @return void
  */
 protected function callAction()
 {
     $this->checkForDemoController() ? $this->forbidInDemoMode() : parent::callAction();
 }
Пример #25
0
 /**
  * Define the actions with no secure token
  *
  * @return array
  */
 public static function defineFreeFormIdActions()
 {
     return array_merge(parent::defineFreeFormIdActions(), array('export_finished'));
 }
Пример #26
0
 /**
  * Get session cell name for pager widget
  *
  * @return string
  */
 public function getPagerSessionCell()
 {
     return parent::getPagerSessionCell() . '_' . md5(microtime(true));
 }
Пример #27
0
 /**
  * Check ACL permissions
  *
  * @return boolean
  */
 public function checkACL()
 {
     return parent::checkACL() || \XLite\Core\Auth::getInstance()->isAdmin();
 }
Пример #28
0
 /**
  * Define the actions with no secure token
  *
  * @return array
  */
 public static function defineFreeFormIdActions()
 {
     return array_merge(parent::defineFreeFormIdActions(), array('pack', 'download'));
 }
Пример #29
0
 /**
  * Check ACL permissions
  *
  * @return boolean
  * @see    ____func_see____
  * @since  1.0.17
  */
 public function checkACL()
 {
     return parent::checkACL() || \XLite\Core\Auth::getInstance()->isPermissionAllowed('manage custom pages');
 }
Пример #30
0
 /**
  * Define the actions with no secure token
  *
  * @return array
  */
 public static function defineFreeFormIdActions()
 {
     return array_merge(parent::defineFreeFormIdActions(), array('phpinfo', 'switch_clean_url'));
 }