Esempio n. 1
0
 /**
  * The function returns Captcha object.
  * 
  * @static
  * @access public
  * @return object The Captcha.
  */
 public static function getCaptcha()
 {
     if (self::$instance === null) {
         include_once Runtime::get('LIBS_DIR') . '/secureimage/securimage.php';
         self::$instance = new Securimage();
         self::$instance->code_length = 4;
         self::$instance->image_width = 80;
         self::$instance->shadow_text = true;
         self::$instance->line_color = '#3399ee';
         self::$instance->arc_line_colors = '#3399ee';
         self::$instance->text_color = '#1177cc';
     }
     return self::$instance;
 }
Esempio n. 2
0
 /**
  * The function returns full locale file path.
  * 
  * @static
  * @access protected
  * @return string The locale file path.
  */
 private static function getFilePath($file)
 {
     return Runtime::get('LOCALE_DIR') . '/' . self::get() . '/' . $file;
 }
Esempio n. 3
0
 /**
  * @see parent::getUser()
  */
 public function getUser()
 {
     return Runtime::get('SECURITY_USER');
 }
Esempio n. 4
0
 /**
  * The function initializes and runs current controller.
  * 
  * @static
  * @access private 
  */
 private static function initController()
 {
     session_start();
     // for shopping cart
     self::setContent(Controller::executeController(Runtime::get('ROUTING_CONTROLLER'), Runtime::get('ROUTING_ARGUMENTS')));
 }
Esempio n. 5
0
 /**
  * The function returns TRUE if Target object is current URL.
  * 
  * @static
  * @access public
  * @param object $Target The Target.
  * @return bool TRUE on success, FALSE on failure.
  */
 public static function on($Target)
 {
     $uri = Runtime::get('REQUEST_URI');
     if ($Target instanceof Content_Page) {
         return $Target->Link == $uri;
     }
     if ($Target instanceof Article) {
         return $Target->Link == $uri;
     }
     return $Target == $uri;
 }
Esempio n. 6
0
            foreach (explode(',', $arr[1]) as $col) {
                $cols[] = '`' . $col . '`';
            }
            $result['*' . trim($cols[0], '`')] = 'alter table `' . $new['name'] . '` add ' . str_replace('primary', 'primary key', $arr[0]) . ' (' . implode(',', $cols) . ')';
        }
    }
    return $result;
}
include_once dirname(dirname(__FILE__)) . '/includes/application.php';
Application::run('config');
$codes = array('00000', '42S01', '23000', '42S21');
$DB = Database::getInstance();
$len = strlen(Runtime::get('INCLUDE_DIR') . '/models') + 1;
$error = array();
Console::writeln('Database objects update');
foreach (File::readDir(Runtime::get('INCLUDE_DIR') . '/models', true, null, '*.php') as $file) {
    $content = file_get_contents($file);
    if (preg_match('/{INSTALL:SQL{(.*)}}/is', $content, $res)) {
        $file = substr($file, $len);
        //Console::writeln( $file, 30 );
        $lines = preg_split("/;(\n|\r\n){2}/", $res[1]);
        foreach ($lines as $query) {
            $new = parseCreateTable(trim($query));
            if ($new) {
                if (preg_match('/class ([\\w\\_]+) extends/i', $content, $res)) {
                    $obj = new $res[1]();
                    $missed = $extra = $cols = array();
                    foreach (get_object_vars($obj) as $field => $value) {
                        $found = false;
                        foreach ($new['columns'] as $col) {
                            $arr = explode(' ', $col, 2);
Esempio n. 7
0
 /**
  * TLhe function returns array of layouts.
  * 
  * @static
  * @access public
  * @return array The array of layouts.
  */
 public static function getLayouts()
 {
     $result = array();
     foreach (File::readDir(Runtime::get('TEMPLATE_DIR') . '/frontend/layout/') as $file) {
         $result[basename($file)] = basename($file, '.html');
     }
     asort($result);
     return $result;
 }
Esempio n. 8
0
 /**
  * The class constructor.
  * 
  * @access public
  * @param object $Object The Object.
  */
 public function __construct(Object $Object = null)
 {
     $this->setObject($Object);
     $this->layoutDir = Runtime::get('TEMPLATE_DIR') . '/email';
 }
Esempio n. 9
0
 /**
  * @see parent::getTo()
  */
 protected function getSubject()
 {
     return 'Перезвоните мне с сайта ' . Runtime::get('HTTP_HOST');
 }
Esempio n. 10
0
 /**
  * The function returns file path for object by index.
  * 
  * @static
  * @access public
  * @param object Object The object.
  * @param int $index The index of file.
  * @return string The file path.
  */
 public static function path(Object $Object, $index = null)
 {
     if (!$Object->Id) {
         return null;
     }
     $info = $Object->getUploadFileInfo();
     $limit = isset($info['folderLimit']) ? $info['folderLimit'] : 1000;
     $folder = isset($info['folder']) ? $info['folder'] : get_class($Object);
     $folderID = isset($info['folderFormat']) ? sprintf($info['folderFormat'], floor($Object->Id / $limit)) : null;
     if (!isset($info['extension'])) {
         $info['extension'] = 'jpg';
     }
     $ext = property_exists($Object, 'Filename') ? self::extension($Object->Filename) : $info['extension'];
     if ($index === null) {
         $index = 'orig';
     }
     if ($info['extension'] && $index !== 'orig') {
         $ext = $info['extension'];
     }
     $ext = strtolower($ext);
     return Runtime::get('FILES_DIR') . '/' . $folder . '/' . ($folderID === null ? '' : $folderID . '/') . $index . '/' . $Object->Id . '.' . $ext;
 }
Esempio n. 11
0
<?php

include_once dirname(dirname(__FILE__)) . '/includes/application.php';
Application::run('config');
for ($i = 0; $i < 10; $i++) {
    if (!isset($argv[$i])) {
        $argv[$i] = null;
    }
}
$m = File::readClasses(INCLUDE_MODELS_DIR);
$c = File::readClasses(INCLUDE_CONTROLLERS_DIR, 'Controller_');
$v = File::readClasses(INCLUDE_VIEWS_DIR, 'View_');
$t = array();
$dir = Runtime::get('TEMPLATE_DIR');
foreach (File::readDir($dir, true, null, '.html') as $file) {
    if (is_dir($file)) {
        continue;
    }
    $text = file_get_contents($file);
    $arr = explode("\n", $text);
    $t[] = array(str_replace($dir . '/', '', $file), filesize($file), count($arr));
}
$stats = array('size' => array('m' => 0, 'c' => 0, 'v' => 0, 't' => 0, 'a' => 0), 'lines' => array('m' => 0, 'c' => 0, 'v' => 0, 't' => 0, 'a' => 0));
foreach ($stats['size'] as $i => $value) {
    if ($i == 'a') {
        break;
    }
    foreach (${$i} as $item) {
        $stats['size'][$i] += $item[1];
        $stats['lines'][$i] += $item[2];
        $stats['size']['a'] += $item[1];
Esempio n. 12
0
 /**
  * The function returns currency sign.
  *
  * @static
  * @access public
  * @return string The sign.
  */
 public static function sign()
 {
     $Default = Runtime::get('CURRENCY_DEFAULT', new Currency());
     return $Default->Sign;
 }
Esempio n. 13
0
 /**
  * The function returns current templates (layout) directory.
  * 
  * @access protected
  * @return string The directory path.
  */
 protected function getLayoutDir()
 {
     return Runtime::get('TEMPLATE_DIR');
 }