Example #1
0
 public static function init()
 {
     if (empty(self::$data)) {
         $conf = (require_once JPATH_APP_CONFIG . DS . 'site.php');
         self::$data = $conf;
     }
 }
Example #2
0
 public function init()
 {
     // регистрация автолоадера
     joosAutoloader::init();
     // сначала инициализация базовой конфигурации
     joosConfig::init();
     // отправка заголовков
     joosDocument::header();
     return $this;
 }
Example #3
0
 /**
  * Очень упрощённая функция базовой отправки сообщения на email
  *
  * @tutorial joosMail::simply('*****@*****.**','Hello!','From Russia!');
  *
  * @param  string $to      email получателя
  * @param  string $title   заголовк сообщения
  * @param  string $message текст сообщения
  * @return bool
  */
 public static function simply($to, $title, $message)
 {
     $headers = "MIME-Version: 1.0\n";
     $headers .= "Content-type: text/html; charset=utf-8\n";
     $headers .= "X-Priority: 3\n";
     $headers .= "X-MSMail-Priority: Normal\n";
     $headers .= "X-Mailer: JoostinaCoreMail\n";
     $headers .= sprintf("From: JoostinaCore <%s>\n", joosConfig::get2('mail', 'system_email'));
     return (bool) mail($to, $title, $message, $headers);
 }
Example #4
0
 /**
  * Получение уникального ключа для значения пользовательской сессии
  *
  * @static
  * @param  null   $hash_key
  * @return string
  *
  * @todo добавить возможность работы через прокси, когда у пользователя меняется конечный IP, но единый IP прокси
  */
 public static function session_cookie_value($hash_key = null)
 {
     $user_ip = joosRequest::user_ip();
     $user_browser = joosRequest::server('HTTP_USER_AGENT', 'none');
     $type = joosConfig::get2('session', 'type', 2);
     switch ($type) {
         case 1:
             $value = md5($hash_key . $user_ip);
             break;
         default:
             $value = joosCSRF::hash($hash_key . $user_ip . $user_browser);
             break;
     }
     return $value;
 }
Example #5
0
 /**
  * Расширенная функция отправки сообщения на email
  *
  * @tutorial joosSimpleMail::send_email('*****@*****.**','Hello!','From Russia!');
  *
  * @param string|array $to      email получателя
  * @param string       $title   заголовк сообщения
  * @param string       $message текст сообщения
  * @param string|bool  $from    email отправителя, по умолчанию используется системный параметр
  *
  * @return bool|Void
  */
 public static function send_email($to, $title, $message, $from = false)
 {
     try {
         $email_obj = new SimpleMail();
         $email_obj->From = $from ? $from : joosConfig::get2('mail', 'system_email');
         $email_obj->To = is_array($to) ? $to : array($to);
         $email_obj->Subject = $title;
         $body = strip_tags($message);
         $email_obj->addBody($body);
         if ($body !== $message) {
             $email_obj->addBody($message, 'text/html');
         }
         $email_obj->send();
         return true;
     } catch (joosSimpleMailException $e) {
         return false;
     }
 }
Example #6
0
 /**
  * Получение инстанции для работы с базой данных
  * @return joosDatabaseMysqli - объект базы данных
  */
 public static function instance()
 {
     // отметка получения инстенции базы данных
     JDEBUG ? joosDebug::inc('joosDatabaseMysqli::instance()') : null;
     if (self::$instance === NULL) {
         $db_config = joosConfig::get('db');
         $database = new self($db_config['host'], $db_config['user'], $db_config['password'], $db_config['name']);
         if ($database->_error_num) {
             $error_message = $database->_error_msg;
             joosPages::error_database($error_message);
         }
         self::$instance = $database;
     }
     return self::$instance;
 }
Example #7
0
            <?php 
}
?>

            <div class="content">
                <?php 
echo joosDocument::body();
?>
            </div>

            <hr>

            <footer>
                <p>&copy; Company 2012</p>
            </footer>

        </div>

        <div id="modal-output"></div>

    <?php 
joosDocument::instance()->add_js_file(JPATH_SITE . '/media/js/jquery.js', array('first' => true));
if (joosConfig::get('debug_template')) {
    joosDocument::instance()->add_js_file(JTEMPLATE_LIVE . '/js/lib/less-1.3.0.min.js');
}
joosDocument::instance()->add_js_file(JTEMPLATE_LIVE . '/js/plugins/bootstrap/bootstrap-transition.js')->add_js_file(JTEMPLATE_LIVE . '/js/plugins/bootstrap/bootstrap-alert.js')->add_js_file(JTEMPLATE_LIVE . '/js/plugins/bootstrap/bootstrap-modal.js')->add_js_file(JTEMPLATE_LIVE . '/js/plugins/bootstrap/bootstrap-dropdown.js')->add_js_file(JTEMPLATE_LIVE . '/js/plugins/bootstrap/bootstrap-scrollspy.js')->add_js_file(JTEMPLATE_LIVE . '/js/plugins/bootstrap/bootstrap-tab.js')->add_js_file(JTEMPLATE_LIVE . '/js/plugins/bootstrap/bootstrap-tooltip.js')->add_js_file(JTEMPLATE_LIVE . '/js/plugins/bootstrap/bootstrap-popover.js')->add_js_file(JTEMPLATE_LIVE . '/js/plugins/bootstrap/bootstrap-button.js')->add_js_file(JTEMPLATE_LIVE . '/js/plugins/bootstrap/bootstrap-collapse.js')->add_js_file(JTEMPLATE_LIVE . '/js/plugins/bootstrap/bootstrap-carousel.js')->add_js_file(JTEMPLATE_LIVE . '/js/plugins/bootstrap/bootstrap-typeahead.js')->add_js_file(JTEMPLATE_LIVE . '/js/plugins/bootstrap/bootstrap-typeahead.js')->add_js_file(JTEMPLATE_LIVE . '/js/plugins/bootstrap/bootstrap-datepicker.js')->add_js_file(JTEMPLATE_LIVE . '/js/plugins/jquery.plugins/jquery.noty.js')->add_js_file(JTEMPLATE_LIVE . '/js/app.js');
echo joosDocument::javascript();
?>
    </body>
</html>
Example #8
0
 */
// запрет прямого доступа
defined('_JOOS_CORE') or exit;
?>
<!DOCTYPE html>
<html>
<head>
    <title><?php 
echo joosConfig::get2('info', 'title');
?>
</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <META name="robots" content="noindex,nofollow" />
    <link rel="stylesheet" href="<?php 
echo JPATH_SITE;
?>
/app/templates/system/media/css/app.css">
</head>
<body>
    <h2><?php 
echo joosConfig::get2('info', 'title');
?>
</h2>
    <h6>В доступе отказано</h6>
    <!-- <?php 
echo joosFilter::htmlspecialchars($message);
?>
 -->
</body>
</html>
Example #9
0
 public static function pagenav($total)
 {
     $com_name = self::$option;
     $limit = (int) joosSession::get_user_state_from_request("{$com_name}_viewlistlimit", 'limit', joosConfig::get2('admin', 'list_limit', 25));
     $limitstart = (int) joosSession::get_user_state_from_request("{$com_name}_limitstart" . self::get_active_model_name(), 'limitstart', 0);
     return new joosAdminPagenator($total, $limitstart, $limit);
 }
Example #10
0
 public function set($key, $value, $ttl = 0)
 {
     //если кэш запрещен
     if (!joosConfig::get2('cache', 'enable')) {
         return;
     }
     switch ($this->type) {
         case 'apc':
             apc_store($key, serialize($value), $ttl);
             return;
         case 'file':
             $this->cache[$key] = array('value' => $value, 'expire' => !$ttl ? 0 : time() + $ttl);
             $this->state = 'dirty';
             return;
         case 'memcache':
             if ($ttl > 2592000) {
                 $ttl = time() + 2592000;
             }
             $this->data_store->set($key, $value, 0, $ttl);
             return;
     }
 }
Example #11
0
 /**
  * Простой синглетон для единого коннекта к базе данных
  *
  * @return joosDatabasePDO Объект соединений с базой
  */
 public static function instance()
 {
     //объект создается однажды
     if (self::$instance === NULL) {
         $db = joosConfig::get('db');
         joosDatabasePDO::$instance = new joosDatabasePDO($db['host'], $db['user'], $db['password'], $db['name'], $db['charset'], $db['prefix']);
     }
     return joosDatabasePDO::$instance;
 }
Example #12
0
 public static function head()
 {
     $jdocument = self::instance();
     $meta = joosDocument::get_data('meta');
     $n = count($meta);
     $description = $keywords = false;
     for ($i = 0; $i < $n; $i++) {
         if ($meta[$i][0] == 'keywords') {
             $keywords = $meta[$i][1];
         } else {
             if ($meta[$i][0] == 'description') {
                 $description = $meta[$i][1];
             }
         }
     }
     $description ? null : $jdocument->append_meta_tag('description', joosConfig::get2('info', 'description'));
     $keywords ? null : $jdocument->append_meta_tag('keywords', joosConfig::get2('info', 'keywords'));
     if (joosDocument::$config['seotag'] == true) {
         foreach (self::$seotag as $key => $value) {
             $value != false ? $jdocument->add_meta_tag($key, $value) : null;
         }
     }
     echo $jdocument->get_head();
     // favourites icon
     if (self::$config['favicon'] == true) {
         $icon = JPATH_SITE . '/media/favicon.ico?v=2';
         echo "\t" . '<link rel="shortcut icon" href="' . $icon . '" />' . "\n\t";
     }
 }
Example #13
0
 public function order_down_icon2($id, $order)
 {
     if ($order == 0) {
         $img = 'downarrow.png';
         $show = true;
     } elseif ($order < 0) {
         $img = 'downarrow.png';
         $show = true;
     } else {
         $img = 'downarrow.png';
         $show = true;
     }
     if ($show) {
         $output = '<a href="#ordering" onClick="listItemTask(\'cb' . $id . '\',\'orderdown\')" title="' . _NAV_ORDER_DOWN . '">';
         $output .= '<img src="' . joosConfig::get('admin_icons_path') . $img . '" width="12" height="12" border="0" alt="' . _NAV_ORDER_DOWN . '" title="' . _NAV_ORDER_DOWN . '" /></a>';
         return $output;
     } else {
         return '&nbsp;';
     }
 }
Example #14
0
 public static function render(joosModel $obj, array $element_param, $key, $value, stdClass $values, $option)
 {
     return '<img src="' . joosConfig::get('admin_icons_path') . '/cursor_drag_arrow.png" alt="' . 'Переместить' . '" />';
 }