Beispiel #1
0
 /**
  * Send email notification to administrator about access key
  *
  * @param boolean $keyChanged is access key was changed
  *
  * @return void
  */
 public static function sendNotification($keyChanged = false)
 {
     if (!\Includes\Decorator\Utils\CacheManager::isRebuildNeeded(\Includes\Decorator\Utils\CacheManager::STEP_THIRD)) {
         // Send email notification
         \XLite\Core\Mailer::sendSafeModeAccessKeyNotification(\Includes\Utils\FileManager::read(static::getAccessKeyFileName()), $keyChanged);
     }
 }
Beispiel #2
0
 /**
  * Mark templates
  *
  * @return boolean
  */
 protected function isMarkTemplates()
 {
     return !\XLite::isAdminZone() && \XLite\Module\XC\ThemeTweaker\Main::isTargetAllowed() && \XLite\Module\XC\ThemeTweaker\Main::isUserAllowed() && !\XLite\Core\Request::getInstance()->isPost() && !\XLite\Core\Request::getInstance()->isCLI() && !\XLite\Core\Request::getInstance()->isAJAX() && !\Includes\Decorator\Utils\CacheManager::isRebuildNeeded() && \XLite\Core\Config::getInstance()->XC->ThemeTweaker->edit_mode;
 }
Beispiel #3
0
/**
 * Check if LiteCommerce installed
 * Use into Drupal connector
 *
 * :FIXME: check this carefully
 *
 * @param string $dbURL Database Url string (e.g. mysql://username:password@localhost/databasename)
 *
 * @return bool
 */
function isLiteCommerceInstalled($dbURL = null, &$message)
{
    // Check by template and config.php file
    $checkResult = file_exists(LC_DIR_SKINS . 'admin/en/welcome.tpl') && (file_exists(LC_DIR_CONFIG . 'config.php') || file_exists(LC_DIR_CONFIG . 'config.local.php'));
    if ($checkResult) {
        // Get database options from config.php
        $configData = \Includes\Utils\ConfigParser::getOptions('database_details');
        if (is_array($configData)) {
            // Check if host, dbname and username is not empty
            $checkResult = !empty($configData['hostspec']) && !empty($configData['database']) && !empty($configData['username']);
            if ($checkResult) {
                if (isset($dbURL)) {
                    // Support of Drupal 6 installation
                    if (is_array($dbURL)) {
                        $data = $dbURL;
                    } else {
                        $data = parseDbURL($dbURL);
                    }
                    if (!empty($data)) {
                        // Compare database options from config and from parameter
                        $checkResult = $configData['hostspec'] == $data['mysqlhost'] && $configData['username'] == $data['mysqluser'] && $configData['password'] == $data['mysqlpass'] && $configData['database'] == $data['mysqlbase'] && (!isset($data['mysqlport']) || $configData['port'] == $data['mysqlport']) && (!isset($data['mysqlsock']) || $configData['socket'] == $data['mysqlsock']);
                        if (!$checkResult) {
                            $message = 'Database parameters (specified in Drupal and LiteCommerce configs) comparison failed';
                        }
                    } else {
                        $message = '$dbURL passed but hasn\'t any data or corrupted';
                        $checkResult = false;
                    }
                } else {
                    $data = null;
                }
                if ($checkResult) {
                    // Check if connection works
                    $checkResult = dbConnect($data, $errorMsg);
                    if ($checkResult) {
                        $res = dbFetchColumn('SELECT profile_id from xlite_profiles LIMIT 1', $errorMsg);
                        if (empty($res)) {
                            $message = 'There are no profiles found in the database';
                            $checkResult = false;
                        } elseif (\Includes\Decorator\Utils\CacheManager::isRebuildNeeded(\Includes\Decorator\Utils\CacheManager::STEP_THIRD)) {
                            $message = 'Cache isn\'t built yet';
                            $checkResult = false;
                        }
                    } else {
                        $message = 'Cannot connect to the database';
                    }
                }
            } else {
                $message = 'Host, username or database name are empty';
            }
        } else {
            $message = 'Corrupted LiteCommerce config file';
            $checkResult = false;
        }
    } else {
        $message = 'config.php or admin/en/welcome.tpl files are not found';
    }
    return $checkResult;
}
Beispiel #4
0
 /**
  * getStartupFlag
  *
  * @return boolean
  */
 protected function getStartupFlag()
 {
     return \XLite::getInstance()->getOptions(array('profiler_details', 'enabled')) && $this->isTargetAllowed() && !\XLite\Core\Request::getInstance()->isPost() && !\XLite\Core\Request::getInstance()->isCLI() && !\XLite\Core\Request::getInstance()->isAJAX() && !\Includes\Decorator\Utils\CacheManager::isRebuildNeeded();
 }
Beispiel #5
0
 /**
  * getStartupFlag
  *
  * @return boolean
  */
 protected function getStartupFlag()
 {
     return $this->isTargetAllowed() && $this->isUserAllowed() && !\XLite\Core\Request::getInstance()->isPost() && !\XLite\Core\Request::getInstance()->isCLI() && !\XLite\Core\Request::getInstance()->isAJAX() && !\Includes\Decorator\Utils\CacheManager::isRebuildNeeded() && \XLite\Core\Config::getInstance()->XC->WebmasterKit->profilerEnabled;
 }