Inital commit
This commit is contained in:
@@ -50,8 +50,12 @@ class ConfigQuery extends BaseConfigQuery
|
||||
$config->setName($configName);
|
||||
}
|
||||
|
||||
if ($secured !== null) $config->setSecured($secured ? 1 : 0);
|
||||
if ($hidden !== null) $config->setHidden($hidden ? 1 : 0);
|
||||
if ($secured !== null) {
|
||||
$config->setSecured($secured ? 1 : 0);
|
||||
}
|
||||
if ($hidden !== null) {
|
||||
$config->setHidden($hidden ? 1 : 0);
|
||||
}
|
||||
|
||||
$config->setValue($value);
|
||||
$config->save();
|
||||
@@ -112,6 +116,67 @@ class ConfigQuery extends BaseConfigQuery
|
||||
{
|
||||
return self::read('unknown-flag-path', '/assets/img/flags/unknown.png');
|
||||
}
|
||||
|
||||
public static function getStoreEmail()
|
||||
{
|
||||
return self::read('store_email', null);
|
||||
}
|
||||
|
||||
public static function getStoreName()
|
||||
{
|
||||
return self::read('store_name', '');
|
||||
}
|
||||
|
||||
public static function getStoreDescription()
|
||||
{
|
||||
return self::read('store_description', '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.3.0-alpha2
|
||||
* @return int|null the store country id
|
||||
*/
|
||||
public static function getStoreCountry()
|
||||
{
|
||||
return self::read('store_country', null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.3.0-alpha2
|
||||
* @return bool
|
||||
*/
|
||||
public static function getNotifyNewsletterSubscription()
|
||||
{
|
||||
return self::read('notify_newsletter_subscription', 0) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 2.4
|
||||
* @return bool
|
||||
*/
|
||||
public static function isCustomerEmailConfirmationEnable()
|
||||
{
|
||||
return (bool) self::read('customer_email_confirmation', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array a list of email addresses to send the shop's notifications
|
||||
*/
|
||||
public static function getNotificationEmailsList()
|
||||
{
|
||||
$contactEmail = self::getStoreEmail();
|
||||
|
||||
$list = preg_split("/[,;]/", self::read('store_notification_emails', $contactEmail));
|
||||
|
||||
$arr = [];
|
||||
|
||||
foreach ($list as $item) {
|
||||
$arr[] = trim($item);
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/* smtp config */
|
||||
public static function isSmtpEnable()
|
||||
{
|
||||
@@ -170,42 +235,96 @@ class ConfigQuery extends BaseConfigQuery
|
||||
|
||||
public static function setSmtpHost($value)
|
||||
{
|
||||
return self::write('smtp.host', $value, 1, 1);
|
||||
self::write('smtp.host', $value, 1, 1);
|
||||
}
|
||||
|
||||
public static function setSmtpPort($value)
|
||||
{
|
||||
return self::write('smtp.port', $value, 1, 1);
|
||||
self::write('smtp.port', $value, 1, 1);
|
||||
}
|
||||
|
||||
public static function setSmtpEncryption($value)
|
||||
{
|
||||
return self::write('smtp.encryption', $value, 1, 1);
|
||||
self::write('smtp.encryption', $value, 1, 1);
|
||||
}
|
||||
|
||||
public static function setSmtpUsername($value)
|
||||
{
|
||||
return self::write('smtp.username', $value, 1, 1);
|
||||
self::write('smtp.username', $value, 1, 1);
|
||||
}
|
||||
|
||||
public static function setSmtpPassword($value)
|
||||
{
|
||||
return self::write('smtp.password', $value, 1, 1);
|
||||
self::write('smtp.password', $value, 1, 1);
|
||||
}
|
||||
|
||||
public static function setSmtpAuthMode($value)
|
||||
{
|
||||
return self::write('smtp.authmode', $value, 1, 1);
|
||||
self::write('smtp.authmode', $value, 1, 1);
|
||||
}
|
||||
|
||||
public static function setSmtpTimeout($value)
|
||||
{
|
||||
return self::write('smtp.timeout', $value, 1, 1);
|
||||
self::write('smtp.timeout', $value, 1, 1);
|
||||
}
|
||||
|
||||
public static function setSmtpSourceIp($value)
|
||||
{
|
||||
return self::write('smtp.sourceip', $value, 1, 1);
|
||||
self::write('smtp.sourceip', $value, 1, 1);
|
||||
}
|
||||
/* end smtp config */
|
||||
} // ConfigQuery
|
||||
|
||||
/* Thelia version */
|
||||
public static function getTheliaSimpleVersion()
|
||||
{
|
||||
$majorVersion = self::read('thelia_major_version');
|
||||
$minorVersion = self::read('thelia_minus_version');
|
||||
$releaseVersion = self::read('thelia_release_version');
|
||||
|
||||
return $majorVersion.'.'.$minorVersion.'.'.$releaseVersion;
|
||||
}
|
||||
|
||||
public static function isShowingErrorMessage()
|
||||
{
|
||||
return (bool) static::read("error_message.show", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $v
|
||||
*/
|
||||
public static function setShowingErrorMessage($v)
|
||||
{
|
||||
static::write("error_message.show", (int) (@(bool) $v));
|
||||
}
|
||||
|
||||
public static function getErrorMessagePageName()
|
||||
{
|
||||
return static::read("error_message.page_name");
|
||||
}
|
||||
|
||||
public static function setErrorMessagePageName($v)
|
||||
{
|
||||
static::write("error_message.page_name", $v);
|
||||
}
|
||||
|
||||
public static function getAdminCacheHomeStatsTTL()
|
||||
{
|
||||
return intval(static::read("admin_cache_home_stats_ttl", 600));
|
||||
}
|
||||
|
||||
/**
|
||||
* check if Thelia multi domain is activated. (Means one domain for each language)
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isMultiDomainActivated()
|
||||
{
|
||||
return (bool) self::read("one_domain_foreach_lang", false);
|
||||
}
|
||||
|
||||
public static function getMinimuAdminPasswordLength()
|
||||
{
|
||||
return self::read("minimum_admin_password_length", 4);
|
||||
}
|
||||
}
|
||||
// ConfigQuery
|
||||
|
||||
Reference in New Issue
Block a user