fix
This commit is contained in:
parent
7d35a8f3f0
commit
a09fc396d8
9 changed files with 30 additions and 32 deletions
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace ctiso;
|
||||
/**
|
||||
* Коллекция
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php
|
||||
|
||||
namespace ctiso;
|
||||
|
||||
|
|
@ -32,4 +32,4 @@ class ComponentRequest {
|
|||
function getAction() {
|
||||
return $this->r->getAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace ctiso\Controller;
|
||||
use ctiso\Shortcut,
|
||||
Exception,
|
||||
use Exception,
|
||||
ctiso\Path,
|
||||
ctiso\Url,
|
||||
ctiso\Model\Factory,
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ class Component
|
|||
|
||||
$tpl->set('common', Path::join($this->config->get('system', 'web'), '../', 'common'));
|
||||
$tpl->set('script', Path::join($this->config->get('system', 'web'), 'js'));
|
||||
$tpl->set('media', Path::join($this->config->get('system', 'templates_web'), $template));
|
||||
$tpl->set('media', Path::join($this->config->get('system', 'web'), 'templates', $template));
|
||||
|
||||
if ($default) {
|
||||
$tpl->set('site_template', $this->config->get('site', 'web') . '/templates/' . $default);
|
||||
|
|
@ -244,13 +244,13 @@ class Component
|
|||
}
|
||||
$name = $path;
|
||||
|
||||
$path = Path::join ($site->config->get('site', 'path'), 'components', $name, $name . '.php');
|
||||
$className = 'Component_' . $name;
|
||||
$path = Path::join ($site->config->get('site', 'components'), $name, $name . '.php');
|
||||
$className = 'Components\\'. ucfirst($name). '\\' . $name;
|
||||
|
||||
$component/*: Component*/ = null;
|
||||
|
||||
if (file_exists($path)) {
|
||||
require_once ($path);
|
||||
// require_once ($path);
|
||||
$component = new $className();
|
||||
|
||||
$component->viewPath = array($site->config->get('site', 'path') . '/components/' . $name . '/');
|
||||
|
|
@ -258,8 +258,6 @@ class Component
|
|||
$component->COMPONENTS_WEB = $site->config->get('site', 'web') . '/components/';
|
||||
|
||||
} else {
|
||||
$path = Path::join ($site->config->get('system', 'components'), $name, $name . '.php');
|
||||
require_once ($path);
|
||||
$component = new $className();
|
||||
|
||||
$template = $component->getTemplateName($registry);
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@ class Authorization {
|
|||
$this->group = $group;
|
||||
}
|
||||
|
||||
function isLogged() {
|
||||
static function isLogged($group = 'access') {
|
||||
// echo session_status();
|
||||
if (session_status() == PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
$hash = self::getBrowserSign();
|
||||
// Если $hash не совпадает $_SESSION['hash'] то удаляем сессию
|
||||
if (isset($_SESSION[$this->group]) && isset($_SESSION[self::SESSION_BROWSER_SIGN_KEYNAME])) {
|
||||
if (isset($_SESSION[$group]) && isset($_SESSION[self::SESSION_BROWSER_SIGN_KEYNAME])) {
|
||||
if ($hash == $_SESSION[self::SESSION_BROWSER_SIGN_KEYNAME]) {
|
||||
// UserAccess::getUserById($_SESSION ['access']); // Поиск по идентификатору
|
||||
return true;
|
||||
|
|
@ -29,12 +29,12 @@ class Authorization {
|
|||
return false;
|
||||
}
|
||||
|
||||
function enter($id) {
|
||||
static function enter($id, $group = 'access') {
|
||||
// $db->executeQuery("UPDATE visitor SET sid = '' WHERE id_visitor = " . $result->getInt('id_user'));
|
||||
// session_register("access");
|
||||
// session_register("time");
|
||||
|
||||
$_SESSION [$this->group] = $id;
|
||||
$_SESSION [$group] = $id;
|
||||
$_SESSION [self::SESSION_BROWSER_SIGN_KEYNAME] = self::getBrowserSign();
|
||||
$_SESSION ["time"] = time();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ class Functions {
|
|||
* @param mixed $a
|
||||
* @param mixed $b
|
||||
*
|
||||
* @return array[int]mixed
|
||||
* @return mixed
|
||||
*/
|
||||
static function compose($_rest) {
|
||||
$closure = new compose(func_get_args());
|
||||
|
|
@ -111,7 +111,7 @@ class Functions {
|
|||
/**
|
||||
* Карирование справа
|
||||
*
|
||||
* @return array[int]mixed
|
||||
* @return mixed
|
||||
*/
|
||||
static function rcurry($_rest) {
|
||||
$closure = new right(func_get_args ());
|
||||
|
|
@ -121,7 +121,7 @@ class Functions {
|
|||
/**
|
||||
* Карирование слева
|
||||
*
|
||||
* @return array[int]mixed
|
||||
* @return mixed
|
||||
*/
|
||||
static function lcurry($_rest) {
|
||||
$closure = new left(func_get_args ());
|
||||
|
|
@ -133,7 +133,7 @@ class Functions {
|
|||
* @param mixed $pred Условие по которому разделяется массив
|
||||
* @param array $lst
|
||||
*
|
||||
* @return array[int]mixed
|
||||
* @return mixed
|
||||
*/
|
||||
static function partition($pred, $lst) {
|
||||
$left = array ();
|
||||
|
|
@ -329,19 +329,20 @@ class Functions {
|
|||
|
||||
/**
|
||||
* Поиск элемента в массиве
|
||||
* @param function $cb сравнение с элементом массива
|
||||
* @param array $hs массив в котором ищется значение
|
||||
* @param mixed $cb сравнение с элементом массива
|
||||
* @param Array $hs массив в котором ищется значение
|
||||
*
|
||||
* @return int|string ключ найденого элемента в массиве
|
||||
*/
|
||||
static function array_usearch($cb, array $hs, $strict = false) {
|
||||
foreach($hs as $key => $value) if (call_user_func_array($cb, array($value, $key, $strict))) return $key;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Выбирает все сроки из таблицы с уникальными значениями ключа
|
||||
* @param $name Имя ключа
|
||||
* @param $table Двухмерный массив
|
||||
* @param string $name Имя ключа
|
||||
* @param Array $table Двухмерный массив
|
||||
* @example
|
||||
* key_unique_values ('name', array (array ('name' => 1), array ('name' => 2), array ('name' => 1)))
|
||||
=> array (1, 2)
|
||||
|
|
@ -359,9 +360,9 @@ class Functions {
|
|||
|
||||
/**
|
||||
* Сортировка двумерного массива по заданному ключу
|
||||
* @param $array Массив
|
||||
* @param $key Имя ключа по значению которого будет идти сравнение
|
||||
* @return Отсортированный массив
|
||||
* @param Array $array Массив
|
||||
* @param string $key Имя ключа по значению которого будет идти сравнение
|
||||
* @return Array Отсортированный массив
|
||||
*/
|
||||
static function sortOn($array, $key, $fn = 'Functions::__cmp') {
|
||||
usort ($array, Functions::rcurry($fn, $key));
|
||||
|
|
|
|||
|
|
@ -30,6 +30,11 @@ class User implements UserInterface
|
|||
return $this->name;
|
||||
}
|
||||
|
||||
function isLogged() {
|
||||
return \ctiso\Filter\Authorization::isLogged();
|
||||
}
|
||||
|
||||
|
||||
public function getUserByQuery(Statement $stmt)
|
||||
{
|
||||
$result = $stmt->executeQuery();
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace ctiso\Role;
|
||||
use ctiso\Database\Statement;
|
||||
|
||||
interface UserInterface {
|
||||
function getUserByQuery(Statement $stmt);
|
||||
function getUserByLogin($login);
|
||||
function getUserById($id);
|
||||
function getName();
|
||||
function setSID();
|
||||
function setSID($random, $result);
|
||||
}
|
||||
|
|
@ -47,11 +47,6 @@ class View
|
|||
$this->_values["suggestions"] = $this->suggestions;
|
||||
}
|
||||
|
||||
public function jGrowl($message, $args)
|
||||
{
|
||||
$this->addScriptRaw('$.jGrowl("' . $message . '", ' . json_encode($args) . ");\n", true);
|
||||
}
|
||||
|
||||
public function setGlobal($name, $args)
|
||||
{
|
||||
$this->addScriptRaw("var " . $name . " = " . json_encode($args) . ";\n", false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue