Advertisement
Guest User

Untitled

a guest
Jan 28th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. class Settings extends ActiveRecord
  2. {
  3. const CODE = 'code'; // ключ
  4. const VALUE = 'value'; // значение
  5. const DESCRIPTION = 'description'; // описание функционала
  6.  
  7. /**
  8. * @inheritdoc
  9. */
  10. public static function tableName()
  11. {
  12. return '{{%settings}}';
  13. }
  14.  
  15. /**
  16. * Возвращает значение Value из таблицы Settings по ключу Code
  17. *
  18. * @param string $code
  19. * @return string
  20. */
  21. public static function Code(string $code) : string {
  22. return static::findOne([self::CODE => $code])[self::VALUE];
  23. }
  24. }
  25.  
  26. // Host
  27. define('HOST_DEFAULT', !empty($_SERVER['HTTP_HOST']) ? trim($_SERVER['HTTP_HOST']) : 'test.webstart.spb.ru');
  28. define('URL_ROOT', sprintf('http%s://%s/', !empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443 ? 's' : '', HOST_DEFAULT));
  29.  
  30. // Path
  31. define('DIR_HOME', __DIR__.'/');
  32. define('DIR_IMAGE', DIR_HOME.'image/');
  33. define('DIR_SYSTEM', DIR_HOME.'system/');
  34. define('DIR_CONFIG', DIR_SYSTEM.'config/');
  35. define('DIR_CACHE', DIR_SYSTEM.'storage/cache/');
  36. define('DIR_DOWNLOAD', DIR_SYSTEM.'storage/download/');
  37. define('DIR_LOGS', DIR_HOME.'../log/');
  38. define('DIR_MODIFICATION', DIR_SYSTEM.'storage/modification/');
  39. define('DIR_UPLOAD', DIR_SYSTEM.'storage/upload/');
  40.  
  41. // DB
  42. const DB_DRIVER = 'mysqli';
  43. const DB_HOSTNAME = null;
  44. const DB_USERNAME = '******';
  45. const DB_PASSWORD = '*******';
  46. const DB_DATABASE = '*********';
  47. const DB_PORT = '3306';
  48. const DB_PREFIX = 'oc_';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement