Beispiel #1
0
 /**
  * Find a value by it's name accepting dotted path.
  * If you are sure that the value you want to get is a direct value,
  * please consider using getDirectValue for performance purposes
  * @param string $path the path of the data, accepts dotted notation
  * @return mixed the value
  */
 public function findValue($path)
 {
     if (!$this->isArray()) {
         return null;
     }
     return $this->navigator->arrayGet($this->data, $path);
 }
 private function getComments()
 {
     $result = array();
     // Если запрос был со стороны сайта выполняется первая ветка условия. Иначе - вторая.
     if (isset($_POST['showComments']) && isset($_POST['uri'])) {
         $uri = explode('/', $_POST['uri']);
         if (!empty($uri[1])) {
             unset($uri[0]);
             $uri = implode('/', $uri);
         } else {
             $uri = $uri[0];
         }
         // Запрос для генерации блока пагинации
         $sql = "\n\t\t\t\tSELECT id, name, comment, UNIX_TIMESTAMP(date) as date\n\t\t\t\tFROM `comments` \n\t\t\t\tWHERE uri = " . DB::quote($uri) . " AND approved = '1'\n\t\t\t\tORDER BY `id` DESC";
         $res = DB::query($sql);
         //Получаем блок пагинации
         if ($_POST["page"]) {
             $page = $_POST["page"];
         }
         //если был произведен запрос другой страницы, то присваиваем переменной новый индекс
         $navigator = new Navigator($sql, $page, MG::getOption('countPrintRowsComments'));
         //определяем класс
         $pagination = $navigator->getPager('forAjax');
         /* Получаем непосредственно комментарии.
            	 Если была запрошена не первая страница комментариев, выполняем вторую ветку условия.
            */
         if (empty($_POST['page'])) {
             $sql = "\n\t\t\t\tSELECT id, name, comment, UNIX_TIMESTAMP(date) as date\n\t\t\t\tFROM `comments` \n\t\t\t\tWHERE uri = " . DB::quote($uri) . " AND approved = '1'\n\t\t\t\tORDER BY `id` DESC\n\t\t\t\tLIMIT 0, " . MG::getOption('countPrintRowsComments');
             $res = DB::query($sql);
         } else {
             $start = ($_POST['page'] - 1) * MG::getOption('countPrintRowsComments');
             $amount = MG::getOption('countPrintRowsComments');
             $sql = "\n\t\t\t\tSELECT id, name, comment, UNIX_TIMESTAMP(date) as date\n\t\t\t\tFROM `comments` \n\t\t\t\tWHERE uri = " . DB::quote($uri) . " AND approved = '1'\n\t\t\t\tORDER BY `id` DESC\n\t\t\t\tLIMIT " . $start . ", " . $amount;
             $res = DB::query($sql);
         }
         while ($row = DB::fetchAssoc($res)) {
             $row['date'] = date('d.m.Y H:i', $row['date']);
             $result['comments'][] = $row;
         }
         $result['pagination'] = $pagination;
         echo json_encode($result);
         exit;
     } else {
         $sql = "\n\t\t\t\tSELECT id, name, comment, date\n\t\t\t\tFROM `comments`\n\t\t\t\tORDER BY date DESC";
         $res = DB::query($sql);
         while ($row = DB::fetchAssoc($res)) {
             $row['date'] = date('d.m.Y H:i', $row['date']);
             $result[$row['id']] = $row;
         }
         return $result;
     }
 }
Beispiel #3
0
 static function getEntity()
 {
     $result = array();
     $sql = "SELECT * FROM `" . PREFIX . "call_back` ORDER BY id ASC";
     if ($_POST["page"]) {
         $page = $_POST["page"];
     }
     $navigator = new Navigator($sql, $page);
     $entity = $navigator->getRowsSql();
     $pagination = $navigator->getPager('forAjax');
     $result = array('entity' => $entity, 'pagination' => $pagination);
     return $result;
 }
 public function __construct()
 {
     parent::__construct();
     $db = Config::get('database.default');
     if ($db != null) {
         View::share('navLinks', Admin_Menu::menuGenerator());
         View::share('sidebar', Navigator::sidebar());
         View::share('breadcrumb', Navigator::breadcrumb());
     }
     $class = get_called_class();
     if (!Request::ajax()) {
         switch ($class) {
             case 'Home_Controller':
                 $this->filter('before', 'nonauth');
                 break;
             case 'Setup_Controller':
                 $this->filter('before', 'nonauth');
                 break;
             case 'Admin_Auth_Controller':
                 $this->filter('before', 'auth')->except(array('authenticate', 'verifyupdate', 'logout'));
                 break;
             default:
                 $this->filter('before', 'auth');
                 break;
         }
     }
 }
 /**
  * Initialize demanded controller.
  * 
  * @param Registry $registry Registry object.
  * @return Controller | void
  * @author anza
  */
 public static function create($registry)
 {
     $parser = new URLParser();
     $controller = $parser->getController();
     $actions = $parser->getActions();
     if ($controller == null) {
         $controller = self::$inSession[0];
     }
     if ($controller == 'logout') {
         $registry->session->destroy();
         $controller = self::$inSession[0];
     }
     $controllerName = $controller . 'Controller';
     $modelName = $controller . 'Model';
     $allowedControllers = $registry->session->isStarted() ? self::$inSession : self::$noSession;
     $target = $registry->session->isStarted() ? self::$inSession[0] : self::$noSession[0];
     if (in_array($controller, $allowedControllers)) {
         $registry->controllerName = $controller;
         $controller = new $controllerName($actions, $registry);
         $controller->model = new $modelName($registry);
         return $controller;
     } else {
         Navigator::redirectTo($target);
     }
 }
 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new Navigator();
     }
     return self::$instance;
 }
Beispiel #7
0
 /**
  * Выводит страницу настроек плагина в админке
  */
 static function pageSettingsPlugin()
 {
     if ($_POST["page"]) {
         $page = $_POST["page"];
         //если был произведен запрос другой страницы, то присваиваем переменной новый индекс
     }
     $navigator = new Navigator("\n      SELECT p. * , u.email, COUNT( p.id ) as count_orders\n      FROM  `" . PREFIX . "partner` AS p\n      LEFT JOIN  `" . PREFIX . "user` AS u ON u.id = p.user_id\n      LEFT JOIN  `" . PREFIX . "partner_order` AS po ON po.partner_id = p.id\n      GROUP BY p.id\n      ORDER BY p.payments_amount DESC  ", $page, 20);
     //определяем класс
     $partners = $navigator->getRowsSql();
     $pagination = $navigator->getPager('forAjax');
     $option = MG::getSetting('partners-program');
     $option = stripslashes($option);
     $options = unserialize($option);
     // подключаем view для страницы плагина
     include 'pagePlugin.php';
 }
Beispiel #8
0
 private function getPage($mod)
 {
     self::$urlSys = $_SESSION['URL_SYS'];
     $url = '';
     switch ($mod) {
         case 'logou':
             $url .= self::$urlSys['ADMIN_URL'] . "painel_admin.php";
             break;
         case 'naoLogou':
             $url .= self::$urlSys['ADMIN_URL'] . "index.php";
             break;
         case 'error_auth':
             $url .= self::$urlSys['ADMIN_URL'] . 'index.php';
             break;
         case 'categoria':
             $url .= self::$urlSys['CATEGORIA_URL'] . 'categoria.php';
             break;
         case 'erro_categoria':
             $url .= self::$urlSys['CATEGORIA_URL'] . 'categoria.php?erro';
             break;
         case 'evento':
             $url .= self::$urlSys['EVENTO_URL'] . 'evento.php';
             break;
         case 'erro_evento':
             $url .= self::$urlSys['EVENTO_URL'] . 'evento.php?erro';
             break;
         case 'pontoTuristico':
             $url .= self::$urlSys['PONTOTURISTICO_URL'] . 'pontoTuristico.php';
             break;
         case 'erro_pontoTuristico':
             $url .= self::$urlSys['PONTOTURISTICO_URL'] . 'pontoTuristico.php?erro';
             break;
         case 'patrocinio':
             $url .= self::$urlSys['PATROCINIO_URL'] . 'patrocinio.php';
             break;
         case 'erro_patrocinio':
             $url .= self::$urlSys['PATROCINIO_URL'] . 'patrocinio.php?erro';
             break;
         case 'mapa':
             $url .= self::$urlSys['MAPA_URL'] . 'mapa.php';
             break;
         case 'erro_mapa':
             $url .= self::$urlSys['MAPA_URL'] . 'mapa.php?erro';
             break;
         case 'galeria':
             $url .= self::$urlSys['GALERIA_URL'] . 'galeriaFotos.php';
             break;
         case 'erro_galeria':
             $url .= self::$urlSys['GALERIA_URL'] . 'galeriaFotos.php?erro';
             break;
         default:
             $url .= self::$urlSys['BASE_URL'] . 'index.php';
             break;
     }
     return $url;
 }
Beispiel #9
0
 public function getComments()
 {
     $result = array();
     // Если запрос был со стороны сайта выполняется первая ветка условия. Иначе - вторая.
     if (isset($_POST['showComments']) && isset($_POST['uri'])) {
         $uri = explode('/', $_POST['uri']);
         if (!empty($uri[1])) {
             unset($uri[0]);
             $uri = implode('/', $uri);
         } else {
             $uri = $uri[0];
         }
         // Запрос для генерации блока пагинации
         $sql = "\r\n\t\t\t\tSELECT id, name, comment, date\r\n\t\t\t\tFROM `" . PREFIX . "comments` \r\n\t\t\t\tWHERE (uri = " . DB::quote($uri) . " OR uri = " . DB::quote($uri . ".html") . ") AND approved = '1'\r\n\t\t\t\tORDER BY `id` DESC";
         $res = DB::query($sql);
         //Получаем блок пагинации
         if ($_POST["page"]) {
             $page = $_POST["page"];
         }
         //если был произведен запрос другой страницы, то присваиваем переменной новый индекс
         $navigator = new Navigator($sql, $page, MG::getSetting('countPrintRowsComments'));
         //определяем класс
         $comments = $navigator->getRowsSql();
         $pagination = $navigator->getPager('forAjax');
         /*
         * Получаем непосредственно комментарии.
          Если была запрошена не первая страница комментариев, выполняем вторую ветку условия.
         */
         foreach ($comments as $key => $value) {
             $comments[$key]['date'] = date('d.m.Y H:i', $result['comments']['date']);
         }
         $result['pagination'] = $pagination;
         $this->data = $result;
         return true;
     } else {
         $sql = "\r\n\t\t\t\tSELECT id, name, comment, date\r\n\t\t\t\tFROM `" . PREFIX . "comments`\r\n\t\t\t\tORDER BY date DESC";
         $res = DB::query($sql);
         while ($row = DB::fetchAssoc($res)) {
             $result[$row['id']] = $row;
         }
         return $result;
     }
 }
 /**
  * @Invocable
  */
 protected function find()
 {
     if ($this->request->hasKey('friend')) {
         $name = Regex::replace('/[^A-Za-z0-9]/', '', $this->request->valueOf('friend'));
         Navigator::redirectTo($this->url->getParametersPath($name));
     }
     $name = $this->url->getParameter(0);
     if ($name == null) {
         return;
     }
     $this->getUsers($name);
 }
 /**
  * @Invocable
  */
 protected function add()
 {
     try {
         $fo = FOFactory::build('newvideo');
         if (!$fo->isSent()) {
             return;
         }
         $this->model->add($fo);
         Navigator::redirectTo('video');
     } catch (FormValidationException $e) {
         $e->getTraceAsString();
         $this->request->error = Bundle::get('form.validation.invalid.value', $e->getMessage());
     } catch (VideoNotExistsException $e) {
         $e->getTraceAsString();
         $this->request->error = Bundle::get('form.validation.video.url.incorrect', $e->getMessage());
     }
 }
Beispiel #12
0
 public function __construct()
 {
     parent::__construct();
     View::share('sidebar', Navigator::sidebar());
     $class = get_called_class();
     if (!Request::ajax()) {
         switch ($class) {
             case 'Home_Controller':
                 $this->filter('before', 'nonauth')->except('dashboard');
                 break;
             case 'Console_Auth_Controller':
                 $this->filter('before', 'auth')->except(array('authenticate', 'verifyupdate', 'logout'));
                 break;
             default:
                 $this->filter('before', 'auth');
                 break;
         }
     }
 }
Beispiel #13
0
            if (strpos(File::N($v), $filter) === false) {
                unset($takes[$k]);
            }
        }
    }
    if ($_files = Mecha::eat($takes)->chunk($offset, $config->per_page * 2)->vomit()) {
        $files = array();
        foreach ($_files as $_file) {
            $files[] = File::inspect($_file);
        }
        $files = Mecha::eat($files)->order('ASC', 'path')->vomit();
        unset($_files);
    } else {
        $files = false;
    }
    Config::set(array('page_title' => $speak->assets . $config->title_separator . $config->manager->title, 'offset' => $offset, 'files' => $files, 'pagination' => Navigator::extract($takes, $offset, $config->per_page * 2, $config->manager->slug . '/asset'), 'cargo' => DECK . DS . 'workers' . DS . 'cargo.asset.php'));
    Shield::lot('segment', 'asset')->attach('manager', false);
});
/**
 * Asset Repair
 * ------------
 */
Route::accept($config->manager->slug . '/asset/repair/(file|files):(:all)', function ($path = "", $old = "") use($config, $speak) {
    if (Guardian::get('status') !== 'pilot') {
        Shield::abort();
    }
    $old = File::path($old);
    $p = Request::get('path');
    $p = $p ? '?path=' . urlencode($p) : "";
    if (!($file = File::exist(ASSET . DS . $old))) {
        Shield::abort();
 /**
  * Logout and destroy session.
  * Redirect to app starting point.
  * @Invocable
  */
 protected function logout()
 {
     Session::getInstance()->destroy();
     Navigator::redirectTo();
 }
Beispiel #15
0
if ($browse != "") {
    $ibid = rawurldecode(decrypt($browse));
    if (substr(@php_uname(), 0, 7) == "Windows") {
        $ibid = preg_replace('#[\\*\\?"<>|]#i', '', $ibid);
    } else {
        $ibid = preg_replace('#[\\:\\*\\?"<>|]#i', '', $ibid);
    }
    $ibid = str_replace("..", "", $ibid);
    // contraint à rester dans la zone de repertoire définie
    $ibid = $basedir_fma . substr($ibid, strlen($basedir_fma));
    $base = $ibid;
} else {
    $base = $basedir_fma;
}
// initialisation de la classe
$obj = new Navigator();
$obj->Extension = explode(" ", $extension_fma);
// Construction de la Classe
if ($obj->File_Navigator($base, $tri_fma['tri'], $tri_fma['sens'], $dirsize_fma)) {
    // Current PWD and Url_back / match by OS determination
    if (substr(@php_uname(), 0, 7) == "Windows") {
        $cur_nav = str_replace("\\", "/", $obj->Pwd());
        $cur_nav_back = dirname($base);
    } else {
        $cur_nav = $obj->Pwd();
        $cur_nav_back = str_replace("\\", "/", dirname($base));
    }
    $home = "/" . basename($basedir_fma);
    $cur_nav_href_back = "<a href=\"modules.php?ModPath={$ModPath}&amp;ModStart={$ModStart}&amp;FmaRep={$FmaRep}&amp;browse=" . rawurlencode(encrypt($cur_nav_back)) . "\">" . str_replace(dirname($basedir_fma), "", $cur_nav_back) . "</a>/" . basename($cur_nav);
    if ($home_fma != "") {
        $cur_nav_href_back = str_replace($home, $home_fma, $cur_nav_href_back);
 public function getNavigationLinks()
 {
     $navigation = Navigator::getInstance();
     $navigation->page_list = $this->page_list;
     $navigation->start();
     $this->context->smarty->assign('navigator', $navigation->getCrumbQueue());
     $this->context->smarty->assign('current_page', $navigation->getCurrentPage());
 }
Beispiel #17
0
if (isset($browse)) {
    $ibid = rawurldecode(decrypt($browse));
    if (substr(@php_uname(), 0, 7) == 'Windows') {
        $ibid = preg_replace('#[\\*\\?"<>|]#i', '', $ibid);
    } else {
        $ibid = preg_replace('#[\\:\\*\\?"<>|]#i', '', $ibid);
    }
    $ibid = str_replace('..', '', $ibid);
    // contraint à rester dans la zone de repertoire définie (CHROOT)
    $base = $basedir_fma . substr($ibid, strlen($basedir_fma));
} else {
    $browse = "";
    $base = $basedir_fma;
}
// initialisation de la classe
$obj = new Navigator();
$obj->Extension = explode(" ", $extension_fma);
// traitements
$rename_dir = '';
$remove_dir = '';
$chmod_dir = '';
$remove_file = '';
$move_file = '';
$rename_file = '';
$chmod_file = '';
$edit_file = '';
if (substr(@php_uname(), 0, 7) == "Windows") {
    $log_dir = str_replace($basedir_fma, '', $base);
} else {
    $log_dir = str_replace("\\", "/", str_replace($basedir_fma, "", $base));
}
 private function redirectToCaller($redirect)
 {
     $url = $this->url->getActionParamURL($redirect, array($this->url->getParameter(0)));
     Navigator::redirectToURL($url);
 }
Beispiel #19
0
 /**
  * Вывод страницы плагина в админке
  */
 static function pagePluginComments()
 {
     $lang = PM::plugLocales('comments');
     if ($_POST["page"]) {
         $page = $_POST["page"];
     }
     //если был произведен запрос другой страницы, то присваиваем переменной новый индекс
     $countPrintRowsComments = MG::getSetting('countPrintRowsComments');
     $navigator = new Navigator("SELECT  *  FROM `" . PREFIX . "comments` ORDER BY `id` DESC", $page, $countPrintRowsComments);
     //определяем класс
     $comments = $navigator->getRowsSql();
     $pagination = $navigator->getPager('forAjax');
     // подключаем view для страницы плагина
     include 'pagePlugin.php';
 }
Beispiel #20
0
<?php

/**
 * Cache Manager
 * -------------
 */
Route::accept(array($config->manager->slug . '/cache', $config->manager->slug . '/cache/(:num)'), function ($offset = 1) use($config, $speak) {
    if (!Guardian::happy(1)) {
        Shield::abort();
    }
    $filter = Request::get('q', "");
    $filter = $filter ? Text::parse($filter, '->safe_file_name') : "";
    $files = Get::files(CACHE, '*', 'DESC', 'update', $filter);
    $files_chunk = Mecha::eat($files)->chunk($offset, $config->per_page * 2)->vomit();
    Config::set(array('page_title' => $speak->caches . $config->title_separator . $config->manager->title, 'offset' => $offset, 'pagination' => Navigator::extract($files, $offset, $config->per_page * 2, $config->manager->slug . '/cache'), 'cargo' => 'cargo.cache.php'));
    Shield::lot(array('segment' => 'cache', 'files' => $files_chunk ? Mecha::O($files_chunk) : false))->attach('manager');
});
/**
 * Cache Repairer
 * --------------
 */
Route::accept($config->manager->slug . '/cache/repair/(file|files):(:all)', function ($prefix = "", $file = "") use($config, $speak) {
    if (!Guardian::happy(1)) {
        Shield::abort();
    }
    $path = File::path($file);
    if (!($file = File::exist(CACHE . DS . $path))) {
        Shield::abort();
        // File not found!
    }
    $G = array('data' => array('path' => $file));
Beispiel #21
0
    if ($files = Get::comments(null, 'DESC', 'txt,hold')) {
        $comments = array();
        $comments_id = array();
        foreach ($files as $file) {
            $parts = explode('_', File::B($file));
            $comments_id[] = $parts[1];
        }
        rsort($comments_id);
        foreach (Mecha::eat($comments_id)->chunk($offset, $config->manager->per_page)->vomit() as $comment) {
            $comments[] = Get::comment($comment);
        }
        unset($comments_id, $files);
    } else {
        $comments = false;
    }
    Config::set(array('page_title' => $speak->comments . $config->title_separator . $config->manager->title, 'offset' => $offset, 'responses' => $comments, 'pagination' => Navigator::extract(Get::comments(null, 'DESC', 'txt,hold'), $offset, $config->manager->per_page, $config->manager->slug . '/comment'), 'cargo' => DECK . DS . 'workers' . DS . 'cargo.comment.php'));
    Shield::lot('segment', 'comment')->attach('manager', false);
});
/**
 * Comment Repair
 * --------------
 */
Route::accept($config->manager->slug . '/comment/repair/id:(:num)', function ($id = "") use($config, $speak) {
    if (Guardian::get('status') !== 'pilot' || !($comment = Get::comment($id))) {
        Shield::abort();
    }
    if (!isset($comment->content_type)) {
        $comment->content_type = $config->html_parser;
    }
    File::write($config->total_comments_backend)->saveTo(SYSTEM . DS . 'log' . DS . 'comments.total.log', 0600);
    Config::set(array('page_title' => $speak->editing . ': ' . $speak->comment . $config->title_separator . $config->manager->title, 'response' => Mecha::A($comment), 'cargo' => DECK . DS . 'workers' . DS . 'repair.comment.php'));
Beispiel #22
0
/**
 * This file is part of the SMS application
 * Created: 11.11.2015 24:21 (8:21 AM)
 *
 * (c) 2015 Samuel Adeshina
 */
namespace SMS\App\www\App\Layout\Navigator;

require $_SERVER["DOCUMENT_ROOT"] . '/vendor/autoload.php';
/**
 * Navigator View
 *
 * @package SMS\App\www\App\Layout\Navigator
 * @author Samuel Adeshina
 * @version 0.0.1
 */
$navigator = new Navigator();
$navigator->__setRelativeTo($__file);
$bin = $_SERVER["DOCUMENT_ROOT"] . "/www/App/bin/";
?>
<aside class="main-sidebar">
   <section class="sidebar">
      <?php 
include $navigator->pluginLoader->formatter->getRelativePath($__file, __DIR__ . "/menu/user-panel.php");
include $navigator->pluginLoader->formatter->getRelativePath($__file, __DIR__ . "/menu/search-form.php");
include $navigator->pluginLoader->formatter->getRelativePath($__file, __DIR__ . "/menu/sidebar-menu.php");
?>
   </section>
</aside>
<?php 
Beispiel #23
0
$filter = new Filter($property);
$arr = array('date_add' => array(!empty($_POST['date_add'][0]) ? $_POST['date_add'][0] : $minDate, !empty($_POST['date_add'][1]) ? $_POST['date_add'][1] : $maxDate, 'date'), 'email' => !empty($_POST['email']) ? $_POST['email'] : null, 'role' => !empty($_POST['role']) ? $_POST['role'] : 'null');
$userFilter = $filter->getFilterSql($arr, explode('|', $_POST['sorter']));
$sorterData = explode('|', $_POST['sorter']);
if ($sorterData[1] > 0) {
    $sorterData[3] = 'desc';
} else {
    $sorterData[3] = 'asc';
}
$countPrintRowsUser = MG::getSetting('countPrintRowsUser');
if (empty($_POST['sorter'])) {
    if (empty($userFilter)) {
        $userFilter .= ' 1=1 ';
    }
    $userFilter .= "ORDER BY `date_add` DESC";
}
$navigator = new Navigator("SELECT  *  FROM `" . PREFIX . "user` WHERE " . $userFilter . "", $page, $countPrintRowsUser);
//определяем класс
$users = $navigator->getRowsSql();
$this->accessStatus = USER::$accessStatus;
$this->groupName = USER::$groupName;
$this->users = $navigator->getRowsSql();
$this->pagination = $navigator->getPager('forAjax');
$this->countPrintRowsUser = $countPrintRowsUser;
$res = DB::query("SELECT id  FROM `" . PREFIX . "user`");
$count = DB::numRows($res);
$this->usersCount = $count;
$this->displayFilter = $_POST['role'] != "null" && !empty($_POST['role']) || isset($_POST['applyFilter']);
// так проверяем произошол ли запрос по фильтрам или нет
$this->filter = $filter->getHtmlFilter();
$this->sorterData = $sorterData;
Beispiel #24
0
 /**
  * Возвращает список найденных продуктов соответствующих поисковой фразе.
  * @param string $keyword - поисковая фраза.
  * @param string $allRows - получить сразу все записи.
  * @param string $onlyActive - учитывать только активные продукты.
  * @param boolean $adminPanel - запрос из публичной части или админки.
  * @return array
  */
 public function getListProductByKeyWord($keyword, $allRows = false, $onlyActive = false, $adminPanel = false, $mode = false)
 {
     $result = array('catalogItems' => array(), 'pager' => null, 'numRows' => null);
     $keyword = htmlspecialchars($keyword);
     $keywordUnTrim = $keyword;
     $keyword = trim($keyword);
     if (empty($keyword) || strlen($keyword) <= 2) {
         return $result;
     }
     $currencyRate = MG::getSetting('currencyRate');
     $currencyShopIso = MG::getSetting('currencyShopIso');
     // Поиск по точному соответствию.
     // Пример $keyword = " 'красный',   зеленый "
     // Убираем начальные пробелы и конечные.
     $keyword = trim($keyword);
     //$keyword = "'красный',   зеленый"
     if (SEARCH_FULLTEXT) {
         // Вырезаем спец символы из поисковой фразы.
         $keyword = preg_replace('/[`~!#$%^*()=+\\\\|\\/\\[\\]{};:"\',<>?]+/', '', $keyword);
         //$keyword = "красный   зеленый"
         // Замена повторяющихся пробелов на на один.
         $keyword = preg_replace('/ +/', ' ', $keyword);
         //$keyword = "красный зеленый"
         // Обрамляем каждое слово в звездочки, для расширенного поиска.
         $keyword = str_replace(' ', '* +', $keyword);
         //$keyword = "красный* *зеленый"
         // Добавляем по краям звездочки.
         $keyword = '+' . $keyword . '*';
         //$keyword = "*красный* *зеленый*"
         $sql = "\n      SELECT distinct p.code, CONCAT(c.parent_url,c.url) AS category_url,\n        p.url AS product_url, p.*, pv.product_id as variant_exist, pv.id as variant_id, rate,(p.price_course + p.price_course * (IFNULL(rate,0))) as `price_course`\n      FROM  `" . PREFIX . "product` AS p\n      LEFT JOIN  `" . PREFIX . "category` AS c ON c.id = p.cat_id\n      LEFT JOIN  `" . PREFIX . "product_variant` AS pv ON p.id = pv.product_id";
         if (!$adminPanel) {
             $sql .= " LEFT JOIN (\n        SELECT pv.product_id, SUM( pv.count ) AS varcount\n        FROM  `" . PREFIX . "product_variant` AS pv\n        GROUP BY pv.product_id\n      ) AS temp ON p.id = temp.product_id";
         }
         $prod = new Models_Product();
         $fulltext = "";
         $sql .= " WHERE ";
         $match = " MATCH (\n      p.`title` , p.`code`, p.`description` " . $fulltextInVar . " " . $fulltext . "\n      )\n      AGAINST (\n      '" . $keyword . "'\n      IN BOOLEAN\n      MODE\n      ) ";
         DB::query("SELECT id FROM `" . PREFIX . "product_variant` LIMIT 1");
         //Если есть варианты товаров то будеи искать и в них.
         if (DB::numRows(DB::query("SELECT id FROM `" . PREFIX . "product_variant` LIMIT 1"))) {
             $fulltextInVar = ', pv.`title_variant`, pv.`code` ';
             $match = "(" . $match . " OR MATCH (pv.`title_variant`, pv.`code`)\n        AGAINST (\n        '" . $keyword . "'\n        IN BOOLEAN\n        MODE\n        )) ";
         }
         $sql .= $match;
         // Проверяем чтобы в вариантах была хотябы одна единица.
         if (!$adminPanel) {
             if (MG::getSetting('printProdNullRem') == "true") {
                 $sql .= " AND (temp.`varcount` > 0 OR temp.`varcount` < 0 OR p.count>0 OR p.count<0)";
             }
         }
         if ($onlyActive) {
             $sql .= ' AND p.`activity` = 1';
         }
     } else {
         $sql = "\n       SELECT distinct p.id, CONCAT(c.parent_url,c.url) AS category_url,\n         p.url AS product_url, p.*, pv.product_id as variant_exist, pv.id as variant_id, rate,(p.price_course + p.price_course * (IFNULL(rate,0))) as `price_course`, \n         p.currency_iso\n       FROM  `" . PREFIX . "product` AS p\n       LEFT JOIN  `" . PREFIX . "category` AS c ON c.id = p.cat_id\n       LEFT JOIN  `" . PREFIX . "product_variant` AS pv ON p.id = pv.product_id";
         if (!$adminPanel) {
             $sql .= " LEFT JOIN (\n         SELECT pv.product_id, SUM( pv.count ) AS varcount\n         FROM  `" . PREFIX . "product_variant` AS pv\n         GROUP BY pv.product_id\n       ) AS temp ON p.id = temp.product_id";
         }
         $prod = new Models_Product();
         $fulltext = "";
         //Если есть варианты товаров то будеи искать и в них.
         if (DB::numRows(DB::query("SELECT id FROM `" . PREFIX . "product_variant` LIMIT 1"))) {
             $fulltextInVar = " OR\n             pv.`title_variant` LIKE '%" . DB::quote($keyword, true) . "%'\n           OR\n             pv.`code` LIKE '%" . DB::quote($keyword, true) . "%'";
         }
         $sql .= " WHERE (\n             p.`title` LIKE '%" . DB::quote($keyword, true) . "%'\n           OR\n             p.`code` LIKE '%" . DB::quote($keyword, true) . "%'\n        " . $fulltextInVar . ')';
         // Проверяем чтобы в вариантах была хотябы одна единица.
         if (!$adminPanel) {
             if (MG::getSetting('printProdNullRem') == "true") {
                 $sql .= " AND (temp.`varcount` > 0 OR temp.`varcount` < 0 OR p.count>0 OR p.count<0)";
             }
         }
         if ($onlyActive) {
             $sql .= ' AND p.`activity` = 1';
         }
     }
     $page = URL::get("page");
     $settings = MG::get('settings');
     //if ($mode=='groupBy') {
     $sql .= ' GROUP BY p.id';
     //}
     if ($allRows) {
         $sql .= ' LIMIT 15';
     }
     $navigator = new Navigator($sql, $page, $settings['countСatalogProduct'], $linkCount = 6, $allRows);
     // Определяем класс.
     $this->products = $navigator->getRowsSql();
     // добавим к полученым товарам их свойства
     $this->products = $this->addPropertyToProduct($this->products);
     $this->pager = $navigator->getPager();
     $result = array('catalogItems' => $this->products, 'pager' => $this->pager, 'numRows' => $navigator->getNumRowsSql());
     if (count($result['catalogItems']) > 0) {
         // упорядочивание списка найденых  продуктов
         // первыми в списке будут стоять те товары, у которых полностью совпала поисковая фраза
         // затем будут слова в начале которых встретилось совпадение
         // в конце слова в середине которых встретилось совпадение
         //
         //
         $keyword = str_replace('*', '', $keyword);
         $resultTemp = $result['catalogItems'];
         $prioritet0 = array();
         $prioritet1 = array();
         $prioritet2 = array();
         foreach ($resultTemp as $key => $item) {
             $title = mb_convert_case($item['title'], MB_CASE_LOWER, "UTF-8");
             $keyword = mb_convert_case($keyword, MB_CASE_LOWER, "UTF-8");
             if (trim($title) == $keyword) {
                 $prioritet0[] = $item;
                 continue;
             }
             if (strpos($title, $keyword) === 0) {
                 $prioritet1[] = $item;
             } else {
                 $prioritet2[] = $item;
             }
         }
         $result['catalogItems'] = array_merge($prioritet0, $prioritet1, $prioritet2);
     }
     $args = func_get_args();
     return MG::createHook(__CLASS__ . "_" . __FUNCTION__, $result, $args);
 }
Beispiel #25
0
 * ------------
 */
Route::accept(array($config->manager->slug . '/(' . $post . ')', $config->manager->slug . '/(' . $post . ')/(:num)'), function ($segment = "", $offset = 1) use($config, $speak) {
    $posts = false;
    $offset = (int) $offset;
    $s = call_user_func('Get::' . $segment . 's', strtoupper(Request::get('order', 'DESC')), Request::get('filter', ""), 'txt,draft,archive');
    if ($files = Mecha::eat($s)->chunk($offset, $config->manager->per_page)->vomit()) {
        $posts = Mecha::walk($files, function ($v) use($segment) {
            return call_user_func('Get::' . $segment . 'Header', $v);
        });
    } else {
        if ($offset !== 1) {
            Shield::abort();
        }
    }
    Config::set(array('page_title' => $speak->{$segment . 's'} . $config->title_separator . $config->manager->title, 'pages' => $posts, 'offset' => $offset, 'pagination' => Navigator::extract($s, $offset, $config->manager->per_page, $config->manager->slug . '/' . $segment), 'cargo' => 'cargo.post.php'));
    Shield::lot(array('segment' => $segment))->attach('manager');
});
/**
 * Post Repairer/Igniter
 * ---------------------
 */
Route::accept(array($config->manager->slug . '/(' . $post . ')/ignite', $config->manager->slug . '/(' . $post . ')/repair/id:(:num)'), function ($segment = "", $id = false) use($config, $speak, $response) {
    $units = array('title', 'slug', 'link', 'content', 'content_type', 'description', 'post' . DS . 'author');
    foreach ($units as $k => $v) {
        Weapon::add('tab_content_1_before', function ($page, $segment) use($config, $speak, $v) {
            include __DIR__ . DS . 'unit' . DS . 'form' . DS . $v . '.php';
        }, $k + 1);
    }
    $units = array('css', 'js');
    foreach ($units as $k => $v) {
Beispiel #26
0
 */
Route::accept('/', function () use($config, $excludes) {
    Session::kill('search.query');
    Session::kill('search.results');
    $s = Get::articles();
    if ($articles = Mecha::eat($s)->chunk(1, $config->index->per_page)->vomit()) {
        $articles = Mecha::walk($articles, function ($path) use($excludes) {
            return Get::article($path, $excludes);
        });
    } else {
        $articles = false;
    }
    Filter::add('pager:url', function ($url) {
        return Filter::apply('index:url', $url);
    });
    Config::set(array('articles' => $articles, 'pagination' => Navigator::extract($s, 1, $config->index->per_page, $config->index->slug)));
    Shield::attach('page-home');
}, 110);
/**
 * Route Hook: after
 * -----------------
 */
Weapon::fire('routes_after');
/**
 * Do Routing
 * ----------
 */
Route::execute();
/**
 * 404 Page
 * --------
Beispiel #27
0
<input type="text" size="20" name="form_email_verify" value="" class="center">
<br /><br />
	<div class="equalRow">
		<input type="submit" name="submit" value="Next" class="equalCol4">
	</div>
</form>
<br /><br />
</main>
<?php 
}
/* code verification */
if (Navigator::checkStep("3ppp")) {
    $verificationcode = $_POST['form_email_verify'];
    if ($verificationcode == $_SESSION['eve_verification']) {
        $_SESSION['char_facebook'] = "0";
        Navigator::moveNext("4");
    } else {
        echo "<main style='width: 50%;'>";
        echo '<br /><br /><br /><br /><br /><br /><br /><br />';
        echo '<img src="resources/img/icon_error.png" border="0">';
        echo '<br /><br /><br /><br />';
        echo 'Verification failed...';
        echo "<div class='equalRow'>";
        echo "<a href='apply.php?step=3' class='equalCol4'>Try again</a>";
        echo "</div>";
        echo "</main>";
    }
    ?>

<?php 
}
Beispiel #28
0
<?php

if (!isset($_GET['step'])) {
    Navigator::setNext("1");
    ?>
	 
<main style="width: 60%;">
<br/>
<h1>4S APPLICATION</h1>
<p>
	Welcome to the 4S corp application process.<br/>
	Please read and agree to our corp values, before continuing:<br/> 
</p>
<div style="text-align:left; padding-left: 50px; padding-right: 50px; padding-top: 10px;">
<ol>
<li>We are not pirate corporation. 
	<ul>
	<li>Do not live in lowsec or highsec, instead focus on pvp in 0.0 space.</li>
	<li>Honor the previously agreed rules of engagement, 1vs1 must remain so.</li>
	</ul>
</li>
<li>We do NOT SCAM people!</li>
<li>We do not smack talk in local or any chat - quality humor and friendly joking is acceptable.</li>
<li>All members must respect everyone, not only people in our corporation/alliance/coalition, but even our frenemies.
	<ul>
	<li>You always represent the entire corporation and everyone in it, not just yourself.</li>
	<li>Before you talk, think how that reflects on the corporation as a whole.</li>
	<li>If you get verbally attacked by anyone, do not retaliate, let the leadership take the necessary action.</li>
	</ul>
</li>	
<li>Every member has to maintain activity levels. 
Beispiel #29
0
 public static function getListNews($count = 100)
 {
     //Получаем список новостей
     if ($_GET["page"]) {
         $page = $_GET["page"];
     }
     //если был произведен запрос другой страницы, то присваиваем переменной новый индекс
     $navigator = new Navigator("SELECT  *  FROM `mpl_news` ORDER BY `add_date` DESC", $page, $count);
     //определяем класс
     $news = $navigator->getRowsSql();
     $pagination = $navigator->getPager();
     return array('listNews' => $news, 'pagination' => $pagination);
 }
Beispiel #30
0
        $_SESSION['eve_charid'] = $_SESSION['eve_charid0'];
    } else {
        if ($primarychar == "2") {
            $_SESSION['eve_charname'] = $_SESSION['eve_charname1'];
            $_SESSION['eve_charid'] = $_SESSION['eve_charid1'];
        } else {
            if ($primarychar == "3") {
                $_SESSION['eve_charname'] = $_SESSION['eve_charname2'];
                $_SESSION['eve_charid'] = $_SESSION['eve_charid2'];
            }
        }
    }
    Navigator::moveNext("3");
}
//before selection
if (Navigator::checkStep("2")) {
    ?>

<main style="width: 70%;"> 
<br/>
<h1>4S APPLICATION</h1>
<h3>Step #2</h3>
<br/>
<p>
Please choose your main character, with which you want to apply.
</p>
<br/>
<form action="apply.php?step=2p" method="POST">
<style>
.characterBox {
	display: block;