Exemplo n.º 1
0
 public static function getInstance()
 {
     if (self::$_instance === NULL) {
         self::$_instance = new self(IniParser::getInstance()->getSection('error'));
     }
     return self::$_instance;
 }
Exemplo n.º 2
0
 public function __construct($siteId)
 {
     $this->siteId = $siteId;
     $this->dbAdapter = Zend_Registry::get('dbAdapter');
     $dbAdapter = Zend_Registry::get('dbAdapter');
     $config = Zend_Registry::get('config');
     $params = $config->db->config->toArray();
     //        	$params['dbname'] 	= 'venginse_all';
     $params['dbname'] = $config->db->config->dballname;
     $this->alldbAdapter = Zend_Db::factory($config->db->adapter, $params);
     $select = $dbAdapter->select();
     $select->from('sites', array('s_dbname', 's_path'));
     $select->where('s_id = ?', $siteId);
     $config = $dbAdapter->fetchRow($select->__toString());
     $this->siteDbName = $config['s_dbname'];
     $this->sitePath = $config['s_path'];
     include_once $this->sitePath . 'application/includes.inc.php';
     IniParser::getInstance()->setIni($this->sitePath . 'application/config.ini', TRUE);
     $config = Zend_Registry::get('config');
     $params = $config->db->config->toArray();
     $params['dbname'] = $this->siteDbName;
     $this->siteDbAdapter = Zend_Db::factory($config->db->adapter, $params);
     Zend_Registry::set('siteDbAdapter', $this->siteDbAdapter);
     $this->siteDbAdapter->query('SET NAMES utf8');
     $this->alldbAdapter->query('SET NAMES utf8');
     $this->loadLangs();
     $this->recCount = $this->countStrings();
     $this->recPerPage = 20;
 }
Exemplo n.º 3
0
 public function __construct($pageId = NULL)
 {
     if ($access = IniParser::getInstance()->getSection('access')) {
         if (isset($access['ip'])) {
             $ips = explode(',', $access['ip']);
             if (in_array(self::getIp(), $ips)) {
                 if (!defined('WWW2')) {
                     define('WWW2', true);
                 }
             }
         }
     }
     $this->isCacher = FALSE;
     if (isset($pageId)) {
         $this->pageId = $pageId;
         $this->isCacher = TRUE;
     } else {
         @($this->requestURI = '/' . $_GET['request']);
     }
     if (!VBox::isExist('ConstData')) {
         $this->constData = VBox::get('ConstData');
     } else {
         $this->constData = new ConstData();
         VBox::set('ConstData', $this->constData);
     }
     /* italiano, 14.01.2015
        if(!VBox::isExist('Event')) { 
            VBox::set('Event', new Event());
        }
        /* end */
 }
Exemplo n.º 4
0
 public function get_pages_text($num_page, $page_count, $url_mask, $link_class = 'nav_page', $current_page_class = 'nav_current_page')
 {
     $limit = IniParser::getInstance()->getSettring('count', 'records_on_page');
     $pages_text = "";
     //	$pages_text = "<span class='$link_class'>Îòîáðàæàòü ïî</span> <input type=text name='records_on_page' value=$limit style='width:50px'>";
     $from = $num_page - (int) $limit;
     if ($from < 0) {
         $from = 0;
     }
     $to = $num_page + (int) $limit;
     if ($to > $page_count - 1) {
         $to = $page_count - 1;
     }
     if ($num_page > 0) {
         $pages_text .= "<a href='" . $url_mask[start] . ($num_page - 1) . $url_mask[end] . "' title='<<' class='prev_{$link_class}'></a>&nbsp;&nbsp;&nbsp;";
     }
     if ($page_count > 1) {
         for ($i = $from; $i <= $to; $i++) {
             if ($i != $num_page) {
                 $pages_text .= "<a href='{$url_mask['start']}{$i}{$url_mask['end']}' title='" . ($i + 1) . "' class='{$link_class}'>" . ($i + 1) . "</a>";
             } else {
                 $pages_text .= "<span class='" . $current_page_class . "'>" . ($i + 1) . "</span>";
             }
             if ($i <= $to - 1) {
                 $pages_text .= "&nbsp;&nbsp;&nbsp;";
             }
         }
     }
     if ($num_page < $page_count - 1) {
         $pages_text .= "&nbsp;&nbsp;&nbsp;<a href='" . $url_mask[start] . ($num_page + 1) . $url_mask[end] . "' title=' >>' class='next_{$link_class}' style='text-decoration:none;'></a>";
     }
     return $pages_text;
 }
Exemplo n.º 5
0
 /**
  * Parse config files.
  */
 private function _parse()
 {
     //Parse default config file
     $config_default = rtrim(self::$_config['dir'], '/') . '/' . self::$_config['file_default'] . '.ini';
     self::$_items = IniParser::getInstance()->get($config_default);
     //Parse local config file and update/add keys of default config
     $config_local = rtrim(self::$_config['dir'], '/') . '/' . self::$_config['file_local'] . '.ini';
     self::$_items = array_merge(self::$_items, IniParser::getInstance()->get($config_local));
 }
Exemplo n.º 6
0
 /**
  * Parse language files.
  *
  * @param string $language
  */
 private function _parse($language)
 {
     //Parse default language file
     $language_default = rtrim(self::$_config['dir'], '/') . '/' . self::$_config['file_default'] . '.ini';
     self::$_items[$language] = IniParser::getInstance()->get($language_default);
     //Parse additional language file and update/add keys of default language
     if ($language != self::$_config['file_default']) {
         $language_additional = rtrim(self::$_config['dir'], '/') . '/' . $language . '.ini';
         self::$_items[$language] = array_merge(self::$_items[$language], IniParser::getInstance()->get($language_additional));
     }
 }
Exemplo n.º 7
0
 public function add_data()
 {
     $id = 0;
     $error = '';
     $message = array();
     if ($id = DB::_add_data()) {
         /*--if gifts > 0*/
         if (isset($_POST['link']) && $_POST['link'] > 0 && $id > 0) {
             $q = 'INSERT INTO case_studies_links(csl_cs_id, csl_url, csl_comment) ';
             $firstIteration = true;
             foreach ($_POST['link'] as $key => $val) {
                 $q .= (!$firstIteration ? ',' : 'VALUES') . '(' . $id . ', ' . DB::_quote($val) . ',' . DB::_quote($_POST['comment_link'][$key]) . ')';
                 $firstIteration = false;
             }
             DB::executeAlter($q, 'update_case_studies_links');
         }
         /*--if images_and_files > 0*/
         $countfiles = count($_FILES['images_and_files']['name']);
         if ($countfiles > 0) {
             if (!file_exists(LOCAL_PATH . IniParser::getInstance()->getSettring('path', 'localupload') . $id)) {
                 mkdir(LOCAL_PATH . IniParser::getInstance()->getSettring('path', 'localupload') . $id);
             }
             for ($i = 0; $i < $countfiles; $i++) {
                 $resupload = true;
                 // test FILE is IMAGE
                 if (!getimagesize($_FILES['images_and_files']['tmp_name'][$i])) {
                     array_push($message, 'File is not image type - ' . $_FILES['images_and_files']['name'][$i]);
                     $resupload = false;
                 }
                 // test FILESIZE
                 if ($_FILES['images_and_files']['size'][$i] > IniParser::getInstance()->getSettring('path', 'maxfilesize')) {
                     array_push($message, 'Limit filesize  - ' . $_FILES['images_and_files']['name'][$i]);
                     $resupload = false;
                 }
                 if ($_FILES['images_and_files']['size'][$i] == 0) {
                     array_push($message, 'Filesize is null  - ' . $_FILES['images_and_files']['name'][$i]);
                     $resupload = false;
                 }
                 if ($resupload) {
                     if (move_uploaded_file($_FILES['images_and_files']['tmp_name'][$i], LOCAL_PATH . IniParser::getInstance()->getSettring('path', 'localupload') . $id . '/' . $_FILES['images_and_files']['name'][$i])) {
                         $q = 'INSERT INTO case_studies_files(csf_cs_id, csf_name, csf_comment) values(' . $id . ',' . DB::_quote($_FILES['images_and_files']['name'][$i]) . ',' . DB::_quote($_POST['comment_is_obligatory'][$i]) . ')';
                         DB::executeAlter($q, 'images_and_files');
                     } else {
                         array_push($message, 'File not upload  - ' . $_FILES['images_and_files']['name'][$i]);
                     }
                 }
             }
         }
     } else {
         $error = 'Run time error';
     }
     return array('id' => $id, 'message' => $message, 'error' => $error);
 }
Exemplo n.º 8
0
 /**
  * Parse platform files.
  *
  * @param string $platform
  */
 private function _parse($platform)
 {
     //Parse default platform file
     $platform_default = rtrim(self::$_config['dir'], '/') . '/' . self::$_config['file_default'] . '.ini';
     self::$_items[$platform] = IniParser::getInstance()->get($platform_default);
     //Parse local platform file and update/add keys of default platform
     $platform_local = rtrim(self::$_config['dir'], '/') . '/' . self::$_config['file_local'] . '.ini';
     self::$_items[$platform] = array_merge(self::$_items[$platform], IniParser::getInstance()->get($platform_local));
     //Parse additional platform file and update/add keys of default platform
     if ($platform != self::$_config['file_default']) {
         $platform_additional = rtrim(self::$_config['dir'], '/') . '/' . $platform . '.ini';
         self::$_items[$platform] = array_merge(self::$_items[$platform], IniParser::getInstance()->get($platform_additional));
     }
 }
Exemplo n.º 9
0
<?php

date_default_timezone_set('UTC');
ini_set('display_errors', 1);
if (!defined('LOCAL_PATH')) {
    define('LOCAL_PATH', $_SERVER['DOCUMENT_ROOT'] . '/');
}
if (!defined('ENGINE_PATH')) {
    define('ENGINE_PATH', LOCAL_PATH . 'libs/');
}
if (!defined('LIB_PATH')) {
    define('LIB_PATH', LOCAL_PATH . 'libs/');
}
include_once ENGINE_PATH . 'class/classError.php';
include_once ENGINE_PATH . 'class/classVException.php';
include_once ENGINE_PATH . 'class/classIniParser.php';
include_once ENGINE_PATH . 'class/classDB.php';
include_once ENGINE_PATH . 'class/classConstData.php';
include_once ENGINE_PATH . 'class/classVBox.php';
include_once ENGINE_PATH . 'class/classAgregator.php';
IniParser::getInstance()->setIni(LOCAL_PATH . 'application/config.ini', true);
Exemplo n.º 10
0
 public function SendMail($email_subject, $email_message, $fromName = '', $email_from = NULL, $fileatt = NULL, $fileatt_name = NULL)
 {
     $email_to = '';
     $email_from = $email_from ? $email_from : 'norepeat@' . $_SERVER['HTTP_HOST'];
     foreach ($this->mSettings as $key => $val) {
         if (1 == substr_count($key, 'mail')) {
             $email_to .= $val . ',';
         }
     }
     if (!empty($email_to)) {
         $email_to = trim($email_to, ',');
     } else {
         return FALSE;
     }
     $headers = "From: " . $email_from;
     $semi_rand = md5(time());
     $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
     $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";
     $email_message .= "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type:text/html; charset=\"utf-8\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . str_replace("\n", "<br>", $email_message) . "\n\n";
     /*
      FILE
     */
     $ok = false;
     if ($fileatt != '') {
         $fileatt_type = "application/octet-stream";
         // File Type
         $file = fopen($fileatt, 'rb');
         $data = fread($file, filesize($fileatt));
         $data = chunk_split(base64_encode($data));
         fclose($file);
         $email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}\n";
         $ok = @mail($email_to, $email_subject, $email_message, $headers);
         if ($ok == true) {
             unlink($fileatt);
         }
         unset($data, $file, $fileatt, $fileatt_type, $fileatt_name);
     }
     if ($ok == false) {
         @mail($email_to, $email_subject, $email_message, $headers);
         if ((bool) IniParser::getInstance()->getSettring('mail', 'toMail')) {
             $adminMail = IniParser::getInstance()->getSettring('mail', 'adminMail');
             $subjectMail = IniParser::getInstance()->getSettring('mail', 'subjectMail');
             @mail($adminMail, $email_subject . ($subjectMail ? $subjectMail : ''), $email_message, $headers);
         }
         /* Äîáîâëÿåì ïèñüìî â àðõèâ */
         $q = 'INSERT INTO ' . VBox::get('ConstData')->getConst('langsDb') . '.email_archive
 	              SET ea_email_to = ?,
     	              ea_email_from = ?,
         	          ea_subject = ?,
             	      ea_message = ?';
         DB::executeAlter($q, array($email_to, $email_from, $email_subject, $email_message));
     }
     return TRUE;
 }
Exemplo n.º 11
0
 public function get_page_count_date($where_str = '')
 {
     $where_str = $this->_get_where($where_str);
     $count = $this->get_count_data($where_str);
     //var_dump($count, IniParser::getInstance()->getSettring('count', 'in_page'));
     $page_count = ceil($count / (int) IniParser::getInstance()->getSettring('count', 'in_page'));
     return $page_count;
 }