Merge branch 'master' of ssh://172.20.0.1/var/git/espo/backend
This commit is contained in:
@@ -21,6 +21,7 @@ module.exports = function (grunt) {
|
||||
'index.php',
|
||||
'LICENSE.txt',
|
||||
'.htaccess',
|
||||
'Web.config',
|
||||
],
|
||||
dest: 'build/',
|
||||
},
|
||||
|
||||
+113
-70
@@ -18,13 +18,16 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
use Espo\Core\Utils\Util;
|
||||
|
||||
class Installer
|
||||
{
|
||||
protected $app = null;
|
||||
protected $i18n = null;
|
||||
protected $i18n = null;
|
||||
|
||||
protected $systemHelper = null;
|
||||
|
||||
protected $isAuth = false;
|
||||
|
||||
@@ -36,10 +39,10 @@ class Installer
|
||||
|
||||
/**
|
||||
* Ajax Urls, pairs: url:directory (if bad permission)
|
||||
*
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $ajaxUrls = array(
|
||||
protected $ajaxUrls = array(
|
||||
'api/v1/Settings' => 'api',
|
||||
'api/v1' => 'api',
|
||||
'client/res/templates/login.tpl' => 'client/res/templates',
|
||||
@@ -53,9 +56,9 @@ class Installer
|
||||
'weekStart',
|
||||
'defaultCurrency' => array(
|
||||
'currencyList', 'defaultCurrency',
|
||||
),
|
||||
'smtpSecurity',
|
||||
'language',
|
||||
),
|
||||
'smtpSecurity',
|
||||
'language',
|
||||
);
|
||||
|
||||
|
||||
@@ -67,6 +70,9 @@ class Installer
|
||||
|
||||
$user = $this->getEntityManager()->getEntity('User');
|
||||
$this->app->getContainer()->setUser($user);
|
||||
|
||||
require_once('install/core/SystemHelper.php');
|
||||
$this->systemHelper = new SystemHelper();
|
||||
}
|
||||
|
||||
protected function getEntityManager()
|
||||
@@ -74,17 +80,22 @@ class Installer
|
||||
return $this->app->getContainer()->get('entityManager');
|
||||
}
|
||||
|
||||
protected function getSystemHelper()
|
||||
{
|
||||
return $this->systemHelper;
|
||||
}
|
||||
|
||||
|
||||
protected function auth()
|
||||
{
|
||||
if (!$this->isAuth) {
|
||||
$auth = new \Espo\Core\Utils\Auth($this->app->getContainer());
|
||||
$auth->useNoAuth();
|
||||
$auth->useNoAuth();
|
||||
|
||||
$this->isAuth = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->isAuth;
|
||||
return $this->isAuth;
|
||||
}
|
||||
|
||||
public function isInstalled()
|
||||
@@ -101,7 +112,7 @@ class Installer
|
||||
protected function getI18n()
|
||||
{
|
||||
if (!isset($this->i18n)) {
|
||||
$this->i18n = $this->app->getContainer()->get('i18n');
|
||||
$this->i18n = $this->app->getContainer()->get('i18n');
|
||||
}
|
||||
|
||||
return $this->i18n;
|
||||
@@ -112,16 +123,16 @@ class Installer
|
||||
$config = $this->app->getContainer()->get('config');
|
||||
|
||||
$languageList = $config->get('languageList');
|
||||
|
||||
$translated = $this->getI18n()->translate('language', 'options', 'Global', $languageList);
|
||||
|
||||
$translated = $this->getI18n()->translate('language', 'options', 'Global', $languageList);
|
||||
|
||||
return $translated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save data
|
||||
*
|
||||
* @param array $database
|
||||
* Save data
|
||||
*
|
||||
* @param array $database
|
||||
* array (
|
||||
* 'driver' => 'pdo_mysql',
|
||||
* 'host' => 'localhost',
|
||||
@@ -129,16 +140,19 @@ class Installer
|
||||
* 'user' => 'root',
|
||||
* 'password' => '',
|
||||
* ),
|
||||
* @param string $language
|
||||
* @return bool
|
||||
* @param string $language
|
||||
* @return bool
|
||||
*/
|
||||
public function saveData($database, $language)
|
||||
{
|
||||
$initData = include('install/core/init/config.php');
|
||||
|
||||
$siteUrl = $this->getSystemHelper()->getBaseUrl();
|
||||
|
||||
$data = array(
|
||||
'database' => $database,
|
||||
'language' => $language,
|
||||
'database' => $database,
|
||||
'language' => $language,
|
||||
'siteUrl' => $siteUrl,
|
||||
);
|
||||
|
||||
$data = array_merge($data, $initData);
|
||||
@@ -151,7 +165,7 @@ class Installer
|
||||
public function saveConfig($data)
|
||||
{
|
||||
$config = $this->app->getContainer()->get('config');
|
||||
|
||||
|
||||
$result = $config->set($data);
|
||||
|
||||
return $result;
|
||||
@@ -162,7 +176,7 @@ class Installer
|
||||
{
|
||||
try {
|
||||
$this->app->getContainer()->get('schema')->rebuild();
|
||||
} catch (\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
@@ -176,44 +190,73 @@ class Installer
|
||||
return $this->saveConfig($preferences);
|
||||
}
|
||||
|
||||
protected function createRecords()
|
||||
{
|
||||
$records = include('install/core/init/records.php');
|
||||
|
||||
$result = true;
|
||||
foreach ($records as $entityName => $recordList) {
|
||||
foreach ($recordList as $data) {
|
||||
$result &= $this->createRecord($entityName, $data);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function createRecord($entityName, $data)
|
||||
{
|
||||
if (isset($data['id'])) {
|
||||
|
||||
$entity = $this->getEntityManager()->getEntity($entityName, $data['id']);
|
||||
|
||||
if (!isset($entity)) {
|
||||
$pdo = $this->getEntityManager()->getPDO();
|
||||
|
||||
$sql = "SELECT id FROM `".Util::toUnderScore($entityName)."` WHERE `id` = '".$data['id']."'";
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute();
|
||||
|
||||
$deletedEntity = $sth->fetch(\PDO::FETCH_ASSOC);
|
||||
|
||||
if ($deletedEntity) {
|
||||
$sql = "UPDATE `".Util::toUnderScore($entityName)."` SET deleted = '0' WHERE `id` = '".$data['id']."'";
|
||||
$pdo->prepare($sql)->execute();
|
||||
|
||||
$entity = $this->getEntityManager()->getEntity($entityName, $data['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($entity)) {
|
||||
$entity = $this->getEntityManager()->getEntity($entityName);
|
||||
}
|
||||
|
||||
$entity->set($data);
|
||||
|
||||
$id = $this->getEntityManager()->saveEntity($entity);
|
||||
|
||||
return is_string($id);
|
||||
}
|
||||
|
||||
|
||||
public function createUser($userName, $password)
|
||||
{
|
||||
$this->auth();
|
||||
|
||||
$userId = '1';
|
||||
$user = array(
|
||||
'id' => '1',
|
||||
'userName' => $userName,
|
||||
'password' => md5($password),
|
||||
'lastName' => 'Admin',
|
||||
'isAdmin' => '1',
|
||||
);
|
||||
|
||||
$entity = $this->getEntityManager()->getEntity('User', $userId);
|
||||
$result = $this->createRecord('User', $user);
|
||||
|
||||
if (!isset($entity)) {
|
||||
$pdo = $this->getEntityManager()->getPDO();
|
||||
$result &= $this->createRecords();
|
||||
|
||||
$sql = "SELECT id FROM `user` WHERE `id` = '".$userId."'";
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute();
|
||||
|
||||
$deletedUser = $sth->fetch(\PDO::FETCH_ASSOC);
|
||||
|
||||
if ($deletedUser) {
|
||||
$sql = "UPDATE `user` SET deleted = '0' WHERE `id` = '".$userId."'";
|
||||
$pdo->prepare($sql)->execute();
|
||||
|
||||
$entity = $this->getEntityManager()->getEntity('User', $userId);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($entity)) {
|
||||
$entity = $this->getEntityManager()->getEntity('User');
|
||||
$entity->set('id', $userId);
|
||||
}
|
||||
|
||||
$entity->set('userName', $userName);
|
||||
$entity->set('password', md5($password));
|
||||
$entity->set('lastName', 'Admin');
|
||||
$entity->set('isAdmin', '1');
|
||||
|
||||
$userId = $this->getEntityManager()->saveEntity($entity);
|
||||
|
||||
return is_string($userId);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function isWritable()
|
||||
@@ -228,15 +271,15 @@ class Installer
|
||||
if (!file_exists($item)) {
|
||||
$item = $fileManager->getDirName($item);
|
||||
}
|
||||
|
||||
|
||||
if (file_exists($item) && !is_writable($item)) {
|
||||
|
||||
$fileManager->getPermissionUtils()->setDefaultPermissions($item);
|
||||
if (!is_writable($item)) {
|
||||
$result = false;
|
||||
$this->writableListError[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
@@ -260,14 +303,14 @@ class Installer
|
||||
$uniqueList = array_unique($this->ajaxUrls);
|
||||
foreach ($uniqueList as $url => $path) {
|
||||
$result = $fileManager->getPermissionUtils()->chmod($path, $permission, true);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
if (isset($this->ajaxUrls[$url])) {
|
||||
$path = $this->ajaxUrls[$url];
|
||||
$path = $this->ajaxUrls[$url];
|
||||
$result = $fileManager->getPermissionUtils()->chmod($path, $permission, true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -282,9 +325,9 @@ class Installer
|
||||
|
||||
public function getSettingDefaults()
|
||||
{
|
||||
$defaults = array();
|
||||
$defaults = array();
|
||||
|
||||
$settingDefs = $this->app->getMetadata()->get('entityDefs.Settings.fields');
|
||||
$settingDefs = $this->app->getMetadata()->get('entityDefs.Settings.fields');
|
||||
|
||||
foreach ($this->settingList as $fieldName => $field) {
|
||||
|
||||
@@ -292,19 +335,19 @@ class Installer
|
||||
$fieldDefaults = array();
|
||||
foreach ($field as $subField) {
|
||||
if (isset($settingDefs[$subField])) {
|
||||
$fieldDefaults = array_merge($fieldDefaults, $this->translateSetting($subField, $settingDefs[$subField]));
|
||||
$fieldDefaults = array_merge($fieldDefaults, $this->translateSetting($subField, $settingDefs[$subField]));
|
||||
}
|
||||
}
|
||||
$defaults[$fieldName] = $fieldDefaults;
|
||||
|
||||
} else if (isset($settingDefs[$field])) {
|
||||
|
||||
$defaults[$field] = $this->translateSetting($field, $settingDefs[$field]);
|
||||
$defaults[$field] = $this->translateSetting($field, $settingDefs[$field]);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($defaults['language'])) {
|
||||
$defaults['language']['options'] = $this->getLanguageList();
|
||||
$defaults['language']['options'] = $this->getLanguageList();
|
||||
}
|
||||
|
||||
return $defaults;
|
||||
@@ -316,7 +359,7 @@ class Installer
|
||||
$optionLabel = $this->getI18n()->translate($name, 'options', 'Settings');
|
||||
|
||||
if ($optionLabel == $name) {
|
||||
$optionLabel = $this->getI18n()->translate($name, 'options', 'Global');
|
||||
$optionLabel = $this->getI18n()->translate($name, 'options', 'Global');
|
||||
}
|
||||
|
||||
if ($optionLabel == $name) {
|
||||
@@ -326,9 +369,9 @@ class Installer
|
||||
}
|
||||
}
|
||||
|
||||
$settingDefs['options'] = $optionLabel;
|
||||
}
|
||||
|
||||
$settingDefs['options'] = $optionLabel;
|
||||
}
|
||||
|
||||
return $settingDefs;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,28 +18,30 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
|
||||
class SystemTest
|
||||
class SystemHelper
|
||||
{
|
||||
|
||||
protected $requirements = array(
|
||||
'phpVersion' => '5.4',
|
||||
|
||||
|
||||
'exts' => array(
|
||||
'json',
|
||||
'mcrypt',
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
|
||||
protected $modRewriteUrl = '/api/v1/Metadata';
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function checkRequirements()
|
||||
{
|
||||
$result['success'] = true;
|
||||
@@ -57,14 +59,14 @@ class SystemTest
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function checkDbConnection($hostName, $dbUserName, $dbUserPass, $dbName, $dbDriver = 'pdo_mysql')
|
||||
|
||||
public function checkDbConnection($hostName, $dbUserName, $dbUserPass, $dbName, $dbDriver = 'pdo_mysql')
|
||||
{
|
||||
$result['success'] = true;
|
||||
|
||||
|
||||
switch ($dbDriver) {
|
||||
case 'mysqli':
|
||||
$mysqli = new mysqli($hostName, $dbUserName, $dbUserPass, $dbName);
|
||||
@@ -77,36 +79,138 @@ class SystemTest
|
||||
$result['success'] = false;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'pdo_mysql':
|
||||
try {
|
||||
$dbh = new PDO("mysql:host={$hostName};dbname={$dbName}", $dbUserName, $dbUserPass);
|
||||
$dbh = null;
|
||||
} catch (PDOException $e) {
|
||||
|
||||
|
||||
$result['errors']['dbConnect']['errorCode'] = $e->getCode();
|
||||
$result['errors']['dbConnect']['errorMsg'] = $e->getMessage();
|
||||
$result['success'] = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public function checkModRewrite()
|
||||
{
|
||||
if ( function_exists('apache_get_modules') && in_array('mod_rewrite',apache_get_modules()) ) {
|
||||
return true;
|
||||
} elseif (isset($_SERVER['IIS_UrlRewriteModule'])) {
|
||||
return true;
|
||||
return true;
|
||||
} elseif (getenv('ESPO_MR')=='On' ) {
|
||||
return true;
|
||||
} elseif (isset($_SERVER['ESPO_MR'])) {
|
||||
return true;
|
||||
} elseif ($this->checkModRewriteByUrl()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function checkModRewriteByUrl()
|
||||
{
|
||||
$url = $this->getBaseUrl().$this->modRewriteUrl;
|
||||
|
||||
if (!$this->isCurl()) {
|
||||
$httpCode = $this->getHttpCodeByCurl($url);
|
||||
}
|
||||
|
||||
$httpCode = $this->getHttpCodeByHeader($url);
|
||||
|
||||
if ($httpCode != false && !empty($httpCode)) {
|
||||
if ($httpCode == '200' || $httpCode == '401') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getModRewriteUrl()
|
||||
{
|
||||
return $this->modRewriteUrl;
|
||||
}
|
||||
|
||||
protected function getHttpCodeByCurl($url)
|
||||
{
|
||||
$ch = curl_init($url);
|
||||
|
||||
curl_setopt($ch, CURLOPT_NOSIGNAL, 1);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
||||
|
||||
$response = curl_exec($ch);
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
if ($response != false && !empty($httpCode)) {
|
||||
return $httpCode;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function getHttpCodeByHeader($url)
|
||||
{
|
||||
stream_context_set_default(
|
||||
array(
|
||||
'http' => array(
|
||||
'timeout' => 3.0,
|
||||
)
|
||||
)
|
||||
);
|
||||
$headers = get_headers($url);
|
||||
|
||||
if ($headers != false) {
|
||||
|
||||
preg_match('/HTTP.*([0-9]{3})/i', $headers[0], $match);
|
||||
|
||||
return $httpCode = trim($match[1]);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function isCurl()
|
||||
{
|
||||
return function_exists('curl_version');
|
||||
}
|
||||
|
||||
public function getBaseUrl()
|
||||
{
|
||||
$pageUrl = ($_SERVER["HTTPS"] == 'on') ? 'https://' : 'http://';
|
||||
|
||||
if ($_SERVER["SERVER_PORT"] != "80") {
|
||||
$pageUrl .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
|
||||
} else {
|
||||
$pageUrl .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
|
||||
}
|
||||
|
||||
$baseUrl = str_ireplace('/install/index.php', '', $pageUrl);
|
||||
|
||||
return $baseUrl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get web server name
|
||||
*
|
||||
* @return string Ex. "microsoft-iis", "nginx", "apache"
|
||||
*/
|
||||
public function getServerType()
|
||||
{
|
||||
$serverSoft = $_SERVER['SERVER_SOFTWARE'];
|
||||
|
||||
preg_match('/^(.*)\//i', $serverSoft, $match);
|
||||
$serverName = strtolower( trim($match[1]) );
|
||||
|
||||
return $serverName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,7 +19,22 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
|
||||
|
||||
|
||||
$serverType = $systemHelper->getServerType();
|
||||
$rootDir = dirname(__FILE__);
|
||||
$rootDir = preg_replace('/\/install\/core\/actions\/?/', '', $rootDir, 1);
|
||||
$cronFile = $rootDir.'/cron.php';
|
||||
$phpBinDir = (defined("PHP_BINDIR"))? PHP_BINDIR.'/php' : 'php';
|
||||
|
||||
$cronHelp = (isset($langs['cronHelp'][$serverType]))? $langs['cronHelp'][$serverType] : $langs['cronHelp']['default'];
|
||||
$cronHelp = str_replace('<cron-file>', $cronFile, $cronHelp);
|
||||
$cronHelp = str_replace('<php-bin-dir>', $phpBinDir, $cronHelp);
|
||||
$cronTitle = (isset($langs['cronTitle'][$serverType]))? $langs['cronTitle'][$serverType] : $langs['cronTitle']['default'];
|
||||
|
||||
$smarty->assign('cronTitle', $cronTitle);
|
||||
$smarty->assign('cronHelp', $cronHelp);
|
||||
// clean session
|
||||
$installer->setSuccess();
|
||||
session_unset();
|
||||
@@ -28,7 +28,7 @@ if (!empty($_SESSION['install'])) {// required fields //['user-name']) && !empty
|
||||
'dateFormat' => $_SESSION['install']['dateFormat'],
|
||||
'timeFormat' => $_SESSION['install']['timeFormat'],
|
||||
'timeZone' => $_SESSION['install']['timeZone'],
|
||||
'weekStart' => $_SESSION['install']['weekStart'],
|
||||
'weekStart' => (int)$_SESSION['install']['weekStart'],
|
||||
'defaultCurrency' => $_SESSION['install']['defaultCurrency'],
|
||||
'thousandSeparator' => $_SESSION['install']['thousandSeparator'],
|
||||
'decimalMark' => $_SESSION['install']['decimalMark'],
|
||||
|
||||
@@ -18,38 +18,44 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
ob_start();
|
||||
|
||||
$result = array('success' => true, 'errors' => array());
|
||||
|
||||
$res = $systemTest->checkRequirements();
|
||||
$res = $systemHelper->checkRequirements();
|
||||
$result['success'] &= $res['success'];
|
||||
if (!empty($res['errors'])) {
|
||||
$result['errors'] = array_merge($result['errors'], $res['errors']);
|
||||
}
|
||||
|
||||
if (!$systemTest->checkModRewrite()) {
|
||||
/*if (!$systemHelper->checkModRewrite()) {
|
||||
$result['success'] = false;
|
||||
$result['errors']['modRewrite'] = 'Enable mod_rewrite in Apache server';
|
||||
}
|
||||
$result['errors']['modRewrite'] = $langs['modRewriteHelp']['default'];
|
||||
|
||||
$serverType = $systemHelper->getServerType();
|
||||
if (isset($langs['modRewriteHelp'][$serverType])) {
|
||||
$result['errors']['modRewrite'] = $langs['modRewriteHelp'][$serverType];
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
if (!empty($_REQUEST['dbName']) && !empty($_REQUEST['hostName']) && !empty($_REQUEST['dbUserName'])) {
|
||||
$connect = false;
|
||||
|
||||
|
||||
$dbName = $_REQUEST['dbName'];
|
||||
$hostName = $_REQUEST['hostName'];
|
||||
$dbUserName = $_REQUEST['dbUserName'];
|
||||
$dbUserPass = $_REQUEST['dbUserPass'];
|
||||
$dbDriver = (!empty($_REQUEST['dbDriver']))? $_REQUEST['dbDriver'] : 'pdo_mysql';
|
||||
|
||||
$res = $systemTest->checkDbConnection($hostName, $dbUserName, $dbUserPass, $dbName, $dbDriver);
|
||||
|
||||
$res = $systemHelper->checkDbConnection($hostName, $dbUserName, $dbUserPass, $dbName, $dbDriver);
|
||||
$result['success'] &= $res['success'];
|
||||
if (!empty($res['errors'])) {
|
||||
$result['errors'] = array_merge($result['errors'], $res['errors']);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
ob_clean();
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
return array(
|
||||
'Main page title' => 'Welcome to EspoCRM',
|
||||
@@ -44,7 +44,7 @@ return array(
|
||||
'Congratulation! Welcome to EspoCRM!' => 'Congratulation! EspoCRM has been successfully installed.',
|
||||
'admin' => 'admin',
|
||||
'localhost' => 'localhost',
|
||||
|
||||
|
||||
'Locale' => 'Locale',
|
||||
'Outbound Email Configuration' => 'Outbound Email Configuration',
|
||||
'SMTP' => 'SMTP',
|
||||
@@ -60,7 +60,7 @@ return array(
|
||||
'Default Currency' => 'Default Currency',
|
||||
'Currency List' => 'Currency List',
|
||||
'Language' => 'Language',
|
||||
|
||||
|
||||
'smtpServer' => 'Server',
|
||||
'smtpPort' => 'Port',
|
||||
'smtpAuth' => 'Auth',
|
||||
@@ -68,8 +68,8 @@ return array(
|
||||
'smtpUsername' => 'Username',
|
||||
'emailAddress' => 'Email',
|
||||
'smtpPassword' => 'Password',
|
||||
|
||||
|
||||
|
||||
|
||||
// messages
|
||||
'Some errors occurred!' => 'Some errors occurred!',
|
||||
'Supported php version >=' => 'Supported php version >=',
|
||||
@@ -90,11 +90,46 @@ return array(
|
||||
'Permission denied' => 'Permission denied',
|
||||
'Cannot write to files' => 'Cannot write to file(s)',
|
||||
'Can not save settings' => 'Can not save settings',
|
||||
|
||||
'Cannot save preferences' => 'Cannot save preferences',
|
||||
|
||||
'db driver' => array(
|
||||
'mysqli' => 'MySQLi',
|
||||
'pdo_mysql' => 'PDO MySQL',
|
||||
),
|
||||
),
|
||||
|
||||
'modRewriteHelp' => array(
|
||||
'apache' => 'Enable "mod_rewrite" in Apache server',
|
||||
'nginx' => 'Add this code to Nginx Host Config (inside "server" block):<br>
|
||||
<pre>
|
||||
location /api/v1/ {
|
||||
if (!-e $request_filename){
|
||||
rewrite ^/api/v1/(.*)$ /api/v1/index.php last; break;
|
||||
}
|
||||
}
|
||||
|
||||
location / {
|
||||
rewrite reset/?$ reset.html break;
|
||||
}</pre>',
|
||||
'microsoft-iis' => 'Enable "URL Rewrite" Module in IIS server',
|
||||
'default' => 'Enable Rewrite Module in your server (e.g. mod_rewrite in Apache)',
|
||||
),
|
||||
|
||||
'cronTitle' => array(
|
||||
'apache' => 'To Setup Crontab:',
|
||||
'nginx' => 'To Setup Crontab:',
|
||||
'microsoft-iis' => 'To Setup Scheduled Task:',
|
||||
'default' => 'To Setup Cron job:',
|
||||
),
|
||||
|
||||
'cronHelp' => array(
|
||||
'apache' => 'Note: Add this line to the crontab file to run Espo Scheduled Jobs:
|
||||
* * * * * <php-bin-dir> -f <cron-file> > /dev/null 2>&1',
|
||||
'nginx' => 'Note: Add this line to Tasks to run Espo Scheduled Jobs:
|
||||
* * * * * <php-bin-dir> -f <cron-file> > /dev/null 2>&1',
|
||||
'microsoft-iis' => 'Note: Create a batch file with the following commands to run Espo Scheduled Jobs using Windows Scheduled Tasks:
|
||||
<php-bin-dir>.exe -f <cron-file>',
|
||||
'default' => 'Run command <cron-file>',
|
||||
),
|
||||
|
||||
// controll
|
||||
'Start' => 'Start',
|
||||
@@ -103,7 +138,7 @@ return array(
|
||||
'Go to EspoCRM' => 'Go to EspoCRM',
|
||||
'Re-check' => 'Re-check',
|
||||
'Test settings' => 'Test Connection',
|
||||
|
||||
|
||||
// db errors
|
||||
'1049' => 'Unknown database',
|
||||
'2005' => 'Unknown MySQL server host',
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'EmailTemplate' => array(
|
||||
0 => array(
|
||||
'name' => 'Case-to-Email auto-reply',
|
||||
'subject' => 'Case has been created',
|
||||
'body' => '<p>Hi {Person.name}</p><p>Case \'<span style="line-height: 1.36;">{Case.name}\'</span><span style="line-height: 1.36;"> has been created with number \'{Case.number}\' and a</span><span style="line-height: 1.36;">ssigned to {User.name}.</span></p>',
|
||||
'isHtml ' => '1',
|
||||
),
|
||||
),
|
||||
'ScheduledJob' => array(
|
||||
0 => array(
|
||||
'name' => 'Check Inbound Emails',
|
||||
'job' => 'CheckInboundEmails',
|
||||
'status' => 'Active',
|
||||
'scheduling' => '/10 * * * *',
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -20,10 +20,15 @@
|
||||
{literal}
|
||||
$(function(){
|
||||
{/literal}
|
||||
var langs = {$langsJs};
|
||||
var ajaxUrls = {$ajaxUrls};
|
||||
var opt = {
|
||||
action: 'errors',
|
||||
langs: {$langsJs},
|
||||
ajaxUrls: {$ajaxUrls},
|
||||
modRewriteUrl: '{$modRewriteUrl}',
|
||||
serverType: '{$serverType}'
|
||||
}
|
||||
{literal}
|
||||
var installScript = new InstallScript({action: 'errors', langs: langs, ajaxUrls: ajaxUrls});
|
||||
var installScript = new InstallScript(opt);
|
||||
})
|
||||
{/literal}
|
||||
</script>
|
||||
@@ -12,6 +12,13 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{if $cronHelp}
|
||||
{$cronTitle}
|
||||
<pre>
|
||||
{$cronHelp}
|
||||
</pre>
|
||||
{/if}
|
||||
<footer class="modal-footer">
|
||||
<button class="btn btn-primary" type="button" id="start">{$langs['Go to EspoCRM']}</button>
|
||||
</footer>
|
||||
|
||||
@@ -47,10 +47,15 @@
|
||||
{literal}
|
||||
$(function(){
|
||||
{/literal}
|
||||
var langs = {$langsJs};
|
||||
var ajaxUrls = {$ajaxUrls};
|
||||
var opt = {
|
||||
action: 'step3',
|
||||
langs: {$langsJs},
|
||||
ajaxUrls: {$ajaxUrls},
|
||||
modRewriteUrl: '{$modRewriteUrl}',
|
||||
serverType: '{$serverType}'
|
||||
}
|
||||
{literal}
|
||||
var installScript = new InstallScript({action: 'step3', langs: langs, ajaxUrls: ajaxUrls});
|
||||
var installScript = new InstallScript(opt);
|
||||
})
|
||||
{/literal}
|
||||
</script>
|
||||
+11
-7
@@ -18,7 +18,7 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
error_reporting(0);
|
||||
session_start();
|
||||
@@ -29,7 +29,7 @@ require_once ('install/vendor/smarty/libs/Smarty.class.php');
|
||||
|
||||
require_once 'core/Installer.php';
|
||||
|
||||
require_once 'core/SystemTest.php';
|
||||
require_once 'core/SystemHelper.php';
|
||||
|
||||
$smarty = new Smarty();
|
||||
$installer = new Installer();
|
||||
@@ -73,7 +73,7 @@ if (file_exists('install/'.$langFileName)) {
|
||||
$smarty->assign("langs", $langs);
|
||||
$smarty->assign("langsJs", json_encode($langs));
|
||||
|
||||
$systemTest = new SystemTest();
|
||||
$systemHelper = new SystemHelper();
|
||||
|
||||
// include actions and set tpl name
|
||||
$tplName = 'main.tpl';
|
||||
@@ -84,20 +84,24 @@ $action = (!empty($_REQUEST['action']))? $_REQUEST['action'] : 'main';
|
||||
switch ($action) {
|
||||
case 'main':
|
||||
$languageList = $installer->getLanguageList();
|
||||
$smarty->assign("languageList", $languageList);
|
||||
$smarty->assign("languageList", $languageList);
|
||||
break;
|
||||
|
||||
case 'step3':
|
||||
case 'errors':
|
||||
$ajaxUrls = $installer->getAjaxUrls();
|
||||
$smarty->assign("ajaxUrls", json_encode($ajaxUrls));
|
||||
$smarty->assign("ajaxUrls", json_encode($ajaxUrls));
|
||||
$modRewriteUrl = $systemHelper->getModRewriteUrl();
|
||||
$smarty->assign("modRewriteUrl", $modRewriteUrl);
|
||||
$serverType = $systemHelper->getServerType();
|
||||
$smarty->assign("serverType", $serverType);
|
||||
break;
|
||||
|
||||
case 'step4':
|
||||
case 'errors':
|
||||
$settingsDefaults = $installer->getSettingDefaults();
|
||||
$smarty->assign("settingsDefaults", $settingsDefaults);
|
||||
break;
|
||||
$smarty->assign("settingsDefaults", $settingsDefaults);
|
||||
break;
|
||||
}
|
||||
|
||||
$actionFile = $actionsDir.'/'.$action.'.php';
|
||||
|
||||
+126
-62
@@ -17,40 +17,52 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
************************************************************************/
|
||||
var InstallScript = function(opt) {
|
||||
this.reChecking = false;
|
||||
|
||||
|
||||
if (typeof(opt.action) !== 'undefined') {
|
||||
var action = opt.action;
|
||||
this.action = action;
|
||||
this[action]();
|
||||
}
|
||||
|
||||
|
||||
if (typeof(opt.langs) !== 'undefined') {
|
||||
this.langs = opt.langs;
|
||||
}
|
||||
|
||||
|
||||
if (typeof(opt.ajaxUrls) !== 'undefined') {
|
||||
this.ajaxUrls = opt.ajaxUrls;
|
||||
}
|
||||
|
||||
|
||||
if (typeof(opt.modRewriteUrl) !== 'undefined') {
|
||||
this.modRewriteUrl = opt.modRewriteUrl;
|
||||
}
|
||||
|
||||
if (typeof(opt.serverType) !== 'undefined') {
|
||||
this.serverType = opt.serverType;
|
||||
}
|
||||
|
||||
this.connSett = {};
|
||||
this.userSett = {};
|
||||
this.firstUserPreferences = {};
|
||||
this.checkActions = [
|
||||
{
|
||||
'action': 'checkModRewrite',
|
||||
'break': true,
|
||||
},
|
||||
{
|
||||
'action': 'checkWritable',
|
||||
'break': true,
|
||||
},
|
||||
},
|
||||
{
|
||||
'action': 'applySett',
|
||||
'break': true,
|
||||
},
|
||||
},
|
||||
{
|
||||
'action': 'buildDatabse',
|
||||
'break': true,
|
||||
},
|
||||
},
|
||||
{
|
||||
'action': 'createUser',
|
||||
'break': true,
|
||||
@@ -67,12 +79,12 @@ var InstallScript = function(opt) {
|
||||
InstallScript.prototype.main = function() {
|
||||
var self = this;
|
||||
var nextAction = 'step1';
|
||||
|
||||
|
||||
$("#start").click(function(){
|
||||
$(this).attr('disabled', 'disabled');
|
||||
self.goTo(nextAction);
|
||||
})
|
||||
|
||||
|
||||
$('[name="user-lang"]').change(function(){
|
||||
self.goTo(self.action);
|
||||
})
|
||||
@@ -82,16 +94,16 @@ InstallScript.prototype.step1 = function() {
|
||||
var self = this;
|
||||
var backAction = 'main';
|
||||
var nextAction = 'step2';
|
||||
|
||||
|
||||
$('#back').click(function(){
|
||||
$(this).attr('disabled', 'disabled');
|
||||
self.goTo(backAction);
|
||||
})
|
||||
|
||||
|
||||
$("#next").click(function(){
|
||||
$(this).attr('disabled', 'disabled');
|
||||
var licenseAgree = $('#license-agree');
|
||||
|
||||
|
||||
if (licenseAgree.length > 0 && !licenseAgree.is(':checked')) {
|
||||
$(this).removeAttr('disabled');
|
||||
self.showMsg({msg: self.getLang('You must agree to the license agreement'), error: true});
|
||||
@@ -106,12 +118,12 @@ InstallScript.prototype.step2 = function() {
|
||||
var self = this;
|
||||
var backAction = 'step1';
|
||||
var nextAction = 'step3';
|
||||
|
||||
|
||||
$('#back').click(function(){
|
||||
$(this).attr('disabled', 'disabled');
|
||||
self.goTo(backAction);
|
||||
})
|
||||
|
||||
|
||||
$('#test-connection, #next').click(function(){
|
||||
$(this).attr('disabled', 'disabled');
|
||||
self.setConnSett();
|
||||
@@ -120,7 +132,7 @@ InstallScript.prototype.step2 = function() {
|
||||
return;
|
||||
}
|
||||
self.showLoading();
|
||||
|
||||
|
||||
var btn = $(this);
|
||||
self.checkSett({
|
||||
success: function(data) {
|
||||
@@ -139,9 +151,9 @@ InstallScript.prototype.step2 = function() {
|
||||
$('#test-connection').removeAttr('disabled');
|
||||
self.hideLoading();
|
||||
}, // success END
|
||||
|
||||
|
||||
}) // checkSett END
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
@@ -149,12 +161,12 @@ InstallScript.prototype.step3 = function() {
|
||||
var self = this;
|
||||
var backAction = 'step2';
|
||||
var nextAction = 'step4';
|
||||
|
||||
|
||||
$('#back').click(function(){
|
||||
$(this).attr('disabled', 'disabled');
|
||||
self.goTo(backAction);
|
||||
})
|
||||
|
||||
|
||||
$("#next").click(function(){
|
||||
$(this).attr('disabled', 'disabled');
|
||||
self.setUserSett();
|
||||
@@ -162,7 +174,7 @@ InstallScript.prototype.step3 = function() {
|
||||
$(this).removeAttr('disabled');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
self.checkPass({
|
||||
success: function(){
|
||||
self.showLoading();
|
||||
@@ -181,12 +193,12 @@ InstallScript.prototype.step4 = function() {
|
||||
var self = this;
|
||||
var backAction = 'step3';
|
||||
var nextAction = 'finish';
|
||||
|
||||
|
||||
$('#back').click(function(){
|
||||
$(this).attr('disabled', 'disabled');
|
||||
self.goTo(backAction);
|
||||
})
|
||||
|
||||
|
||||
$("#next").click(function(){
|
||||
$(this).attr('disabled', 'disabled');
|
||||
self.setFirstUserPreferences();
|
||||
@@ -195,7 +207,7 @@ InstallScript.prototype.step4 = function() {
|
||||
return;
|
||||
}
|
||||
var data = self.firstUserPreferences;
|
||||
|
||||
|
||||
data.action = 'setPreferences';
|
||||
$.ajax({
|
||||
url: "index.php",
|
||||
@@ -209,15 +221,15 @@ InstallScript.prototype.step4 = function() {
|
||||
}
|
||||
})
|
||||
.fail(function(ajaxData){
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
InstallScript.prototype.errors = function() {
|
||||
var self = this;
|
||||
|
||||
|
||||
this.reChecking = true;
|
||||
var nextAction = '';
|
||||
$("#re-check").click(function(){
|
||||
@@ -229,7 +241,7 @@ InstallScript.prototype.errors = function() {
|
||||
|
||||
InstallScript.prototype.finish = function() {
|
||||
var self = this;
|
||||
|
||||
|
||||
var nextAction = '';
|
||||
$("#start").click(function(){
|
||||
self.goToEspo();
|
||||
@@ -274,7 +286,7 @@ InstallScript.prototype.setFirstUserPreferences = function() {
|
||||
InstallScript.prototype.checkSett = function(opt) {
|
||||
var self = this;
|
||||
this.hideMsg();
|
||||
|
||||
|
||||
var data = this.connSett;
|
||||
data.action = 'settingsTest';
|
||||
$.ajax({
|
||||
@@ -295,7 +307,7 @@ InstallScript.prototype.checkSett = function(opt) {
|
||||
if (typeof(errors.phpVersion) !== 'undefined') {
|
||||
msg += self.getLang('Supported php version >=')+' '+errors.phpVersion+rowDelim;
|
||||
}
|
||||
|
||||
|
||||
if (typeof(errors.exts) !== 'undefined') {
|
||||
var exts = errors.exts;
|
||||
var len = exts.length;
|
||||
@@ -305,11 +317,11 @@ InstallScript.prototype.checkSett = function(opt) {
|
||||
msg += temp+rowDelim;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (typeof(errors.modRewrite) !== 'undefined') {
|
||||
msg += self.getLang('Enable mod_rewrite in Apache server')+rowDelim;
|
||||
msg += errors.modRewrite+rowDelim;
|
||||
}
|
||||
|
||||
|
||||
if (typeof(errors.dbConnect) !== 'undefined') {
|
||||
if (typeof(errors.dbConnect.errorCode) !== 'undefined') {
|
||||
var temp = self.getLang(errors.dbConnect.errorCode);
|
||||
@@ -321,13 +333,13 @@ InstallScript.prototype.checkSett = function(opt) {
|
||||
msg += temp+rowDelim;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (msg == '') {
|
||||
msg = self.getLang('Some errors occurred!');
|
||||
}
|
||||
self.showMsg({msg: msg, error: true});
|
||||
}
|
||||
|
||||
|
||||
opt.success(data);
|
||||
})
|
||||
.fail(function(){
|
||||
@@ -351,8 +363,8 @@ InstallScript.prototype.validate = function() {
|
||||
case 'step4':
|
||||
fieldRequired = ['thousandSeparator', 'decimalMark', 'smtpUsername'];
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
var len = fieldRequired.length;
|
||||
for (var index = 0; index < len; index++) {
|
||||
@@ -361,13 +373,13 @@ InstallScript.prototype.validate = function() {
|
||||
if (elem.val() == '') {
|
||||
elem.parent().parent().addClass('has-error');
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
elem.parent().parent().removeClass('has-error');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
@@ -376,62 +388,62 @@ InstallScript.prototype.setForm = function(opt) {
|
||||
var formId = opt.formId || 'nav';
|
||||
var action = opt.action || 'main';
|
||||
var desc = opt.desc || '';
|
||||
|
||||
|
||||
var actionField = $('<input>', {'name': 'action', 'value': action, 'type': 'hidden'});
|
||||
$('#'+formId).append(actionField);
|
||||
var descField = $('<textarea>', {'name': 'desc', 'value': action, 'type': 'hidden'});
|
||||
descField.val(desc);
|
||||
descField.css('display', 'none');
|
||||
$('#'+formId).append(descField);
|
||||
|
||||
|
||||
$('#'+formId).attr('method', 'POST');
|
||||
}
|
||||
|
||||
InstallScript.prototype.goTo = function(action) {
|
||||
InstallScript.prototype.goTo = function(action) {
|
||||
this.setForm({action: action});
|
||||
$('#nav').submit();
|
||||
}
|
||||
|
||||
InstallScript.prototype.getLang = function(key) {
|
||||
InstallScript.prototype.getLang = function(key) {
|
||||
return (typeof(this.langs) !== 'undefined' && typeof(this.langs[key]) !== 'undefined')? this.langs[key] : key;
|
||||
}
|
||||
|
||||
InstallScript.prototype.showMsg = function(opt) {
|
||||
this.hideMsg();
|
||||
|
||||
|
||||
var msg = opt.msg || '';
|
||||
var error = opt.error || false;
|
||||
$('#msg-box').html(msg);
|
||||
$('#msg-box').removeClass('hide');
|
||||
$('#msg-box').removeClass('alert-success');
|
||||
$('#msg-box').removeClass('alert-danger');
|
||||
|
||||
|
||||
if (error) $('#msg-box').addClass('alert-danger');
|
||||
else $('#msg-box').addClass('alert-success');
|
||||
}
|
||||
|
||||
InstallScript.prototype.hideMsg = function() {
|
||||
InstallScript.prototype.hideMsg = function() {
|
||||
$('#msg-box').html('');
|
||||
$('#msg-box').addClass('hide');
|
||||
}
|
||||
|
||||
InstallScript.prototype.showLoading = function() {
|
||||
InstallScript.prototype.showLoading = function() {
|
||||
$('.loading-icon').removeClass('hide');
|
||||
}
|
||||
|
||||
InstallScript.prototype.hideLoading = function() {
|
||||
InstallScript.prototype.hideLoading = function() {
|
||||
$('.loading-icon').addClass('hide');
|
||||
}
|
||||
|
||||
InstallScript.prototype.checkPass = function(opt) {
|
||||
var succesHand = opt.success || function(){};
|
||||
var errorHand = opt.error || function(msg){};
|
||||
|
||||
|
||||
if (this.userSett.pass != this.userSett.confPass) {
|
||||
errorHand('Passwords do not match');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
succesHand();
|
||||
}
|
||||
|
||||
@@ -447,7 +459,7 @@ InstallScript.prototype.actionsChecking = function() {
|
||||
InstallScript.prototype.checkAction = function(dataMain) {
|
||||
var self = this;
|
||||
var data = {};
|
||||
|
||||
|
||||
if (this.checkIndex == this.checkActions.length) {
|
||||
self.callbackChecking(dataMain);
|
||||
return;
|
||||
@@ -455,6 +467,11 @@ InstallScript.prototype.checkAction = function(dataMain) {
|
||||
var currIndex = this.checkIndex;
|
||||
var checkAction = this.checkActions[currIndex].action;
|
||||
this.checkIndex++;
|
||||
|
||||
if (checkAction == 'checkModRewrite') {
|
||||
this.checkModRewrite();
|
||||
return;
|
||||
}
|
||||
if (checkAction == 'checkAjaxPermission') {
|
||||
this.checkAjaxPermission();
|
||||
return;
|
||||
@@ -463,7 +480,7 @@ InstallScript.prototype.checkAction = function(dataMain) {
|
||||
data['user-name'] = this.userSett.name;
|
||||
data['user-pass'] = this.userSett.pass;
|
||||
}
|
||||
|
||||
|
||||
data.action = checkAction;
|
||||
$.ajax({
|
||||
url: "index.php",
|
||||
@@ -473,12 +490,12 @@ InstallScript.prototype.checkAction = function(dataMain) {
|
||||
})
|
||||
.done(function(ajaxData){
|
||||
if (typeof(ajaxData) != 'undefined' && ajaxData.success) {
|
||||
|
||||
|
||||
self.checkAction(ajaxData);
|
||||
}
|
||||
else {
|
||||
if (typeof(self.checkActions[currIndex]) != 'undefined'
|
||||
&& typeof(self.checkActions[currIndex].break) != 'undefined'
|
||||
if (typeof(self.checkActions[currIndex]) != 'undefined'
|
||||
&& typeof(self.checkActions[currIndex].break) != 'undefined'
|
||||
&& self.checkActions[currIndex].break) {
|
||||
// break next checking
|
||||
self.callbackChecking(ajaxData);
|
||||
@@ -486,8 +503,8 @@ InstallScript.prototype.checkAction = function(dataMain) {
|
||||
}
|
||||
})
|
||||
.fail(function(ajaxData){
|
||||
if (typeof(self.checkActions[currIndex]) != 'undefined'
|
||||
&& typeof(self.checkActions[currIndex].break) != 'undefined'
|
||||
if (typeof(self.checkActions[currIndex]) != 'undefined'
|
||||
&& typeof(self.checkActions[currIndex].break) != 'undefined'
|
||||
&& self.checkActions[currIndex].break) {
|
||||
// break next checking
|
||||
var ajaxData = {
|
||||
@@ -504,11 +521,11 @@ InstallScript.prototype.checkAction = function(dataMain) {
|
||||
|
||||
InstallScript.prototype.checkAjaxPermission = function() {
|
||||
var self = this;
|
||||
|
||||
|
||||
this.ajaxUrlFinished = 0;
|
||||
this.ajaxUrlPermRes = true;
|
||||
this.ajaxUrlPermMsgs = [];
|
||||
|
||||
|
||||
var len = this.ajaxUrls.length;
|
||||
for (var count = 0; count < len; count++) {
|
||||
var url = this.ajaxUrls[count];
|
||||
@@ -516,9 +533,31 @@ InstallScript.prototype.checkAjaxPermission = function() {
|
||||
}
|
||||
}
|
||||
|
||||
InstallScript.prototype.checkModRewrite = function() {
|
||||
var self = this;
|
||||
this.modRewriteUrl;
|
||||
|
||||
var urlAjax = '..'+this.modRewriteUrl;;
|
||||
var realJqXHR = $.ajax({
|
||||
url: urlAjax,
|
||||
type: "GET",
|
||||
})
|
||||
.always(function(data, textStatus, jqXHR){
|
||||
var status = jqXHR.status || realJqXHR.status || 404;
|
||||
status += '';
|
||||
var data = {'success': 0};
|
||||
if (status == '200' || status == '401') {
|
||||
var data = {'success': 1};
|
||||
}
|
||||
|
||||
self.callbackModRewrite(data);
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
InstallScript.prototype.checkAjaxPermUrl = function(url) {
|
||||
var self = this;
|
||||
|
||||
|
||||
var urlAjax = '../'+url;
|
||||
var realJqXHR = $.ajax({
|
||||
url: urlAjax,
|
||||
@@ -545,7 +584,7 @@ InstallScript.prototype.checkAjaxPermUrl = function(url) {
|
||||
self.callbackAjaxPerm(ajaxData);
|
||||
})
|
||||
.fail(function(){
|
||||
|
||||
|
||||
var ajaxData = {
|
||||
'success': false,
|
||||
'errorMsg': ['Ajax failed']+': '+url,
|
||||
@@ -562,7 +601,7 @@ InstallScript.prototype.callbackAjaxPerm = function(data) {
|
||||
this.ajaxUrlPermRes = false;
|
||||
this.ajaxUrlPermMsgs.push(data.errorMsg);
|
||||
}
|
||||
|
||||
|
||||
if (this.ajaxUrlFinished == this.ajaxUrls.length) {
|
||||
// all urls was checked
|
||||
var ajaxData = {
|
||||
@@ -576,6 +615,31 @@ InstallScript.prototype.callbackAjaxPerm = function(data) {
|
||||
}
|
||||
}
|
||||
|
||||
InstallScript.prototype.callbackModRewrite = function(data) {
|
||||
var ajaxData = {
|
||||
'success': true,
|
||||
}
|
||||
|
||||
if (typeof(data.success) != 'undefined' && data.success) {
|
||||
this.checkAction(ajaxData);
|
||||
return;
|
||||
}
|
||||
ajaxData.success = false;
|
||||
ajaxData.errorMsg = (typeof(this.langs) !== 'undefined' && typeof(this.langs['modRewriteHelp'][this.serverType]) !== 'undefined')? this.langs['modRewriteHelp'][this.serverType] : this.langs['modRewriteHelp']['default'];
|
||||
|
||||
var realCheckIndex = this.checkIndex - 1;
|
||||
if (typeof(this.checkActions[realCheckIndex]) != 'undefined'
|
||||
&& typeof(this.checkActions[realCheckIndex].break) != 'undefined') {
|
||||
if (this.checkActions[realCheckIndex].break) {
|
||||
// break next checking
|
||||
this.callbackChecking(ajaxData);
|
||||
}
|
||||
else {
|
||||
this.checkAction(ajaxData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InstallScript.prototype.callbackChecking = function(data) {
|
||||
this.hideLoading();
|
||||
if (typeof(data) != 'undefined' && data.success) {
|
||||
|
||||
Reference in New Issue
Block a user