Example #1
0
 public function action_index()
 {
     $content = '';
     $main_items = Common::getMainItemsTransliterated();
     if (!empty($main_items)) {
         $main_key = null;
         $main_item_param = $this->request->param('main_item');
         if (!empty($main_item_param)) {
             if (in_array($main_item_param, array_column($main_items, 'translit'))) {
                 foreach ($main_items as $key => $item) {
                     if ($item['translit'] == $main_item_param) {
                         $main_key = $key;
                         $main_items[$key]['active'] = true;
                         break;
                     }
                 }
             } else {
                 throw new HTTP_Exception_404();
             }
         } else {
             $main_key = array_keys($main_items)[0];
         }
         $main_items[$main_key]['active'] = true;
         $secondary_item_param = $this->request->param('secondary_item');
         $secondary_items = Common::getSecondaryItemsTransliterated($main_key);
         if (!empty($secondary_item_param)) {
             if (in_array($secondary_item_param, array_column($secondary_items, 'translit'))) {
                 foreach ($secondary_items as $key => $item) {
                     if ($item['translit'] == $secondary_item_param) {
                         $secondary_items[$key]['active'] = true;
                         $secondary_item = ORM::factory('SecondaryItem', $key);
                         $content = View::factory('parts/items_content', ['item' => $secondary_item]);
                         $this->template->keywords = \Zver\StringHelper::load($secondary_item->keywords)->toHTMLEntities()->get();
                         $this->template->description = \Zver\StringHelper::load($secondary_item->description)->toHTMLEntities()->get();
                         $this->template->title = \Zver\StringHelper::load(empty($secondary_item->title) ? $secondary_item->name : $secondary_item->title)->toHTMLEntities()->get();
                         break;
                     }
                 }
             } else {
                 throw new HTTP_Exception_404();
             }
         } else {
             $main_item = ORM::factory('MainItem', $main_key);
             if (!empty($main_item->go_child)) {
                 $childHref = Common::getSecondaryItems($main_item->id, true)->current();
                 if (!empty($childHref->id)) {
                     $childHref = $childHref->getHref();
                 }
                 Common::redirect($childHref);
             }
             $content = View::factory('parts/items_content', ['item' => $main_item]);
             $this->template->keywords = \Zver\StringHelper::load($main_item->keywords)->toHTMLEntities()->get();
             $this->template->description = \Zver\StringHelper::load($main_item->description)->toHTMLEntities()->get();
             $this->template->title = \Zver\StringHelper::load(empty($main_item->title) ? $main_item->name : $main_item->title)->toHTMLEntities()->get();
         }
         $this->template->content = $content;
         $this->template->header = View::factory('parts/header', ['activeId' => $main_items[$main_key]['id']]);
         $this->template->footer = View::factory('parts/footer');
     }
 }
Example #2
0
if (!empty($keywords)) {
    ?>
            <meta name="keywords"
                  content="<?php 
    echo \Zver\StringHelper::load($keywords)->toHTMLEntities()->get();
    ?>
"/>
            <?php 
}
?>

        <?php 
if (!empty($title)) {
    ?>
            <title><?php 
    echo \Zver\StringHelper::load($title)->toHTMLEntities()->get();
    ?>
</title>
            <?php 
}
?>

        <link href="/inc/styles/style.css" rel="stylesheet">

        <!--[if lt IE 9]>

        <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>

        <![endif]-->
    </head>
Example #3
0
 public static function getMainItemsTransliterated($activeId = null)
 {
     $key = md5($activeId . __METHOD__ . 'mainItems');
     $generate = function () use($activeId) {
         $items = self::getMainItems();
         foreach ($items as $key => &$item) {
             $item = ['active' => !is_null($activeId) && $activeId == $key ? true : false, 'id' => $key, 'name' => $item, 'text' => $item, 'href' => ORM::factory('MainItem', $key)->getHREF(), 'translit' => \Zver\StringHelper::load($item)->slugify()->get()];
         }
         return $items;
     };
     return \Zver\FileCache::retrieve($key, $generate);
 }
Example #4
0
 protected function insertData()
 {
     foreach ($this->getInsertData() as $table => $data) {
         $table = \Zver\StringHelper::load($table)->remove('_\\d+$')->get();
         Minion_CLI::write('Inserting into ' . $table . '...');
         foreach ($data as $values) {
             DB::insert($table)->columns(array_keys($values))->values($values)->execute();
         }
     }
 }
Example #5
0
 public function getHref()
 {
     $parent = $this->getMainItem();
     return $parent->getHref() . '/' . \Zver\StringHelper::load($this->name)->slugify();
 }
Example #6
0
 public function getHref()
 {
     return '/' . \Zver\StringHelper::load($this->name)->slugify();
 }
</h1>
    <?php 
}
?>

<?php 
if (!\Zver\StringHelper::load($item->content)->isEmptyWithoutTags()) {
    ?>
    <div>
        <?php 
    echo $item->content;
    ?>
    </div>
    <?php 
}
?>

<?php 
$modulesOutput = Modules::render($item);
if (!\Zver\StringHelper::load($modulesOutput)->isEmptyWithoutTags()) {
    ?>
    <div>
        <?php 
    echo $modulesOutput;
    ?>
    </div>
    <?php 
}
?>

Example #8
0
 public function getHref()
 {
     return '/news/' . \Zver\StringHelper::load($this->id . ' ' . $this->caption)->slugify();
 }
Example #9
0
 public function action_register()
 {
     if (Common::config(['admin', 'SignInSignUp'])) {
         $email = $password = $error = $captcha = '';
         if ($this->auth->logged_in()) {
             self::goMenu();
         }
         if (!empty($_POST)) {
             if (!empty($_POST['email'])) {
                 $email = \Zver\StringHelper::load($_POST['email'])->toHTMLEntities()->get();
             }
             if (!empty($_POST['password'])) {
                 $password = \Zver\StringHelper::load($_POST['password'])->toHTMLEntities()->get();
             }
             if (!empty($_POST['captcha'])) {
                 $captcha = $_POST['captcha'];
             }
             if (!empty($email) && !empty($password) && !empty($captcha)) {
                 $exist = ORM::factory('User')->where('username', '=', $email)->find();
                 if (!empty($exist->id)) {
                     $error = 'Пользователь с таким email уже существует. Введите другой email.';
                 } elseif (filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
                     $error = 'Введите email правильно.';
                 } elseif (!Captcha::valid($_POST['captcha'])) {
                     $error = 'Неправильно введен проверочный код.';
                 } else {
                     $success = false;
                     try {
                         $user = new Model_User();
                         $user->username = $email;
                         $user->email = $email;
                         $user->registered = date('Y-m-d H:i:s');
                         $user->password = $password;
                         $user->save();
                         DB::insert('roles_users')->values(['user_id' => $user->id, 'role_id' => DB::select('id')->from('roles')->where('name', '=', 'user')])->execute();
                         if ($this->auth->login($email, $password)) {
                             $success = true;
                         }
                     } catch (\Exception $e) {
                     }
                     if ($success) {
                         Admin::setMessage('Вы успешно зарегистрировались!', 'success');
                         self::goMenu();
                     }
                 }
             } else {
                 if (empty($email)) {
                     $error = 'Введите email.';
                 } elseif (empty($password)) {
                     $error = 'Введите пароль.';
                 } else {
                     $error = 'Введите проверочный код';
                 }
             }
         }
         $this->template->content = View::factory('Admin/Register/Template', ['password' => $password, 'email' => $email, 'error' => $error]);
     }
 }
Example #10
0
            echo $new->getHREF();
            ?>
" class="list-group-item">
                    <p class="list-group-item-text">
                        <?php 
            echo FieldString::getFullRuDateFromMysqlDate($new->_datetime);
            ?>
                    </p>
                    <h4 class="list-group-item-heading">
                        <?php 
            echo $new->caption;
            ?>
                    </h4>
                    <p class="list-group-item-text">
                        <?php 
            echo \Zver\StringHelper::load($new->_text)->removeTags()->getFirst(250) . '...';
            ?>
                    </p>
                </a>

                <?php 
        }
        ?>
        </div>
        <?php 
    }
} else {
    ?>
    <div class="alert alert-info">
        Новостей пока нет
    </div>
Example #11
0
 public static function translateMonthRuEn($month)
 {
     $m = \Zver\StringHelper::load($month)->toLowerCase()->get();
     $ru = ['january' => 'января', 'february' => 'февраля', 'march' => 'марта', 'april' => 'апреля', 'may' => 'мая', 'june' => 'июня', 'july' => 'июля', 'august' => 'августа', 'september' => 'сентября', 'october' => 'октября', 'november' => 'ноября', 'december' => 'декабря'];
     return strtr($m, $ru);
 }
Example #12
0
unset($application, $modules, $system, $composer);
require APPPATH . 'bootstrap' . EXT;
if (AdminHREF::getSubdomain() == 'dev') {
    define('DEV', true);
    define('PRODUCTION', false);
} else {
    define('DEV', false);
    define('PRODUCTION', true);
}
if (PHP_SAPI == 'cli') {
    class_exists('Minion_Task') or die('Please enable the Minion module for CLI support.');
    set_exception_handler(['Minion_Exception', 'handler']);
    Minion_Task::factory(Minion_CLI::options())->execute();
} else {
    $request = Request::factory(true, [], false)->execute()->send_headers(true)->body();
    $request = \Zver\StringHelper::load($request)->trimSpaces();
    //$error = $request->getClone()
    //                 ->getPosition('#kohana_error');
    //if ($error === false
    //    || (DEV
    //        && Auth::instance()
    //               ->logged_in('superAdmin'))
    //)
    //{
    echo $request;
    //}
    //else
    //{
    //    $exceptionRaised = true;
    //}
}
Example #13
0
<?php

$module = ORM::factory('MainItem')->where('module', '=', Modules::$MOD_NEWS)->find();
$year = \Zver\StringHelper::load($new->_datetime)->getParts(0, '-')->get();
$month = \Zver\StringHelper::load($new->_datetime)->getParts(1, '-')->get();
$prev = null;
$next = null;
$news = ORM::factory('News')->where('visible', '=', 1)->order_by('_datetime', 'desc')->find_all()->as_array();
foreach ($news as $key => $value) {
    if ($value->id == $new->id) {
        if (!empty($news[$key - 1])) {
            $prev = $news[$key - 1];
        }
        if (!empty($news[$key + 1])) {
            $next = $news[$key + 1];
        }
    }
}
?>
<div class="container">

    <div>
        <a href="<?php 
echo $module->getHref();
?>
">
            <?php 
echo $module->name;
?>
        </a>
        <a href="<?php