quickfw-git Mailing List for QuickFramework (Page 4)
Brought to you by:
ivan1986,
seriousdron
You can subscribe to this list here.
2010 |
Jan
|
Feb
|
Mar
(9) |
Apr
(25) |
May
(22) |
Jun
(22) |
Jul
(15) |
Aug
(16) |
Sep
(4) |
Oct
(9) |
Nov
(9) |
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
(5) |
Feb
(3) |
Mar
(2) |
Apr
(11) |
May
(2) |
Jun
(2) |
Jul
(1) |
Aug
(3) |
Sep
|
Oct
(2) |
Nov
|
Dec
|
From: Ivan1986 <iva...@us...> - 2010-07-28 11:25:31
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via f1fb8f6edc5300930e14606b77bba0e99c7e6ceb (commit) from ff70b3123c63ba33ffb77b0b6730e6994fcdc422 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f1fb8f6edc5300930e14606b77bba0e99c7e6ceb Author: Ivan1986 <iva...@li...> Date: Wed Jul 28 14:42:13 2010 +0400 Доработка скафолдинга diff --git a/lib/Modules/Scafold/ScafoldController.php b/lib/Modules/Scafold/ScafoldController.php index f7c5d7c..f1c9cc2 100644 --- a/lib/Modules/Scafold/ScafoldController.php +++ b/lib/Modules/Scafold/ScafoldController.php @@ -35,6 +35,8 @@ abstract class ScafoldController extends Controller protected $actions = array(); /** @var array Эта таблица зависимая - данные о родительской */ protected $parentData = false; + /** @var array ссылка на сессию таблицы */ + protected $sess = array(); /** @var array Массив методов */ private $methods; @@ -94,6 +96,12 @@ abstract class ScafoldController extends Controller public function __construct() { QFW::$view->P->addCSS('buildin/scafold.css'); + $this->session(); + //Создаем сессию для таблицы и ссылаемся на нее + if (!isset($_SESSION['scafold'][$this->table])) + $_SESSION['scafold'][$this->table] = array(); + $this->sess = &$_SESSION['scafold'][$this->table]; + $this->setup = true; parent::__construct(); $this->methods = array_flip(get_class_methods($this)); @@ -117,10 +125,22 @@ abstract class ScafoldController extends Controller 'fields' => $this->fields, 'actions' => $this->actions, 'table' => str_replace('?_', '', $this->table), + 'session' => $this->sess, )); } /** + * Востанавливает данные сессии по умолчанию + * + * @param integer $page страница + */ + public function clearAction() + { + $this->sess = array(); + QFW::$router->redirect(Url::C()); + } + + /** * Вывод страницы таблицы * * @param integer $page страница @@ -139,22 +159,21 @@ abstract class ScafoldController extends Controller $parent = QFW::$db->selectCol('SELECT ?# AS ARRAY_KEY, ?# FROM ?# ?s', $this->parentData['key'], $this->parentData['field'], $this->parentData['table'], $this->parentData['other']); - $this->session(); if (isset($_POST['parent'])) { - $_SESSION['scafold'][$this->table]['parent'] = $_POST['parent']; + $this->sess['parent'] = $_POST['parent']; QFW::$router->redirect(Url::A()); } - if (empty($_SESSION['scafold'][$this->table]['parent'])) - $_SESSION['scafold'][$this->table]['parent'] = count($parent) ? key($parent) : 0; + if (empty($this->sess['parent'])) + $this->sess['parent'] = count($parent) ? key($parent) : 0; QFW::$view->assign('parent', QFW::$view->assign('parent', array( 'list' => $parent, - 'current' => $_SESSION['scafold'][$this->table]['parent'], + 'current' => $this->sess['parent'], ))->fetch('scafold/parent.html')); $parentWhere = QFW::$db->subquery('AND ?#=?', array($this->table => $this->parentData['colum']), - $_SESSION['scafold'][$this->table]['parent']); + $this->sess['parent']); } $filter = $this->filterGen(); @@ -233,10 +252,10 @@ abstract class ScafoldController extends Controller $this->table, $data, $this->primaryKey, $id); //редирект назад - if (!empty($_SESSION['scafold']['return'])) + if (!empty($this->sess['return'])) { - $url = $_SESSION['scafold']['return']; - unset($_SESSION['scafold']['return']); + $url = $this->sess['return']; + unset($this->sess['return']); QFW::$router->redirect($url); } else @@ -246,7 +265,7 @@ abstract class ScafoldController extends Controller } if (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], 'index')) - $_SESSION['scafold']['return'] = $_SERVER['HTTP_REFERER']; + $this->sess['return'] = $_SERVER['HTTP_REFERER']; if ($id == -1) { @@ -310,15 +329,14 @@ abstract class ScafoldController extends Controller */ public function filterAction() { - $this->session(); if (!empty($_POST['clear'])) { - $_SESSION['scafold'][$this->table]['filter'] = array(); + $this->sess['filter'] = array(); QFW::$router->redirect(Url::C('index'), true); } if (empty($_POST['filter']) || empty($_POST['apply'])) QFW::$router->redirect(Url::C('index'), true); - $_SESSION['scafold'][$this->table]['filter'] = $_POST['filter']; + $this->sess['filter'] = $_POST['filter']; QFW::$router->redirect(Url::C('index'), true); } @@ -331,26 +349,7 @@ abstract class ScafoldController extends Controller */ public function sortAction($field='', $dir='') { - $this->session(); - //такого поля нету - if (!isset($this->fields[$field])) - QFW::$router->redirect(Url::C('index'), true); - //если сортировки в этой таблице еще нет - if (!isset($_SESSION['scafold'][$this->table]['sort'])) - $_SESSION['scafold'][$this->table]['sort'] = array( - 'field' => '', - 'direction' => '', - ); - //ссылка на сортировку этой таблицы - $sort =&$_SESSION['scafold'][$this->table]['sort']; - //если не указана, то ASC или сменить ASC на DESC - if ($dir != 'ASC' && $dir != 'DESC') - $dir = ($sort['field'] == $field && $sort['direction'] == 'ASC') - ? 'DESC' : 'ASC'; - $sort = array( - 'field' => $field, - 'direction' => $dir, - ); + $this->setSort($field, $dir); QFW::$router->redirect(Url::C('index'), true); } @@ -562,14 +561,13 @@ abstract class ScafoldController extends Controller { if (!$field->filter) continue; - $this->session(); - $data = !empty($_SESSION['scafold'][$this->table]['filter'][$name]) ? - $_SESSION['scafold'][$this->table]['filter'][$name] : false; + $data = !empty($this->sess['filter'][$name]) ? + $this->sess['filter'][$name] : false; $form[$name] = $field->filterForm($data); if ($data === false) continue; - $where[$name] = $field->filterWhere($_SESSION['scafold'][$this->table]['filter'][$name]); + $where[$name] = $field->filterWhere($this->sess['filter'][$name]); } if (count($where) == 0) return array( @@ -585,15 +583,46 @@ abstract class ScafoldController extends Controller } /** + * Устанавливает порядок сортировки + * + * @param string $field Имя поля + * @param string $dir Направление сортировки (ASC|DESC|) - пустое - сменить + * @return bool Удачно или нет + */ + public function setSort($field='', $dir='') + { + //такого поля нету + if (!isset($this->fields[$field])) + return false; + //если сортировки в этой таблице еще нет + if (!isset($this->sess['sort'])) + $this->sess['sort'] = array( + 'field' => '', + 'direction' => '', + ); + //если не указана, то ASC или сменить ASC на DESC + if ($dir != 'ASC' && $dir != 'DESC') + $dir = ($this->sess['sort']['field'] == $field && + $this->sess['sort']['direction'] == 'ASC') + ? 'DESC' : 'ASC'; + $this->sess['sort'] = array( + 'field' => $field, + 'direction' => $dir, + ); + return true; + + } + + /** * Генерирует сортировку * * @return DbSimple_SubQuery Подзапрос сортировки */ private function getSort() { - if (!isset($_SESSION['scafold'][$this->table]['sort'])) + if (!isset($this->sess['sort'])) return DBSIMPLE_SKIP; - $order = $_SESSION['scafold'][$this->table]['sort']; + $order = $this->sess['sort']; QFW::$view->assign('order', $order); return QFW::$db->subquery('order by ?# '.$order['direction'], array($this->table => $order['field'])); ----------------------------------------------------------------------- Summary of changes: lib/Modules/Scafold/ScafoldController.php | 107 ++++++++++++++++++----------- 1 files changed, 68 insertions(+), 39 deletions(-) hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-07-28 10:43:02
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via ff70b3123c63ba33ffb77b0b6730e6994fcdc422 (commit) via 8b2496a812fea9b27f2fa37239a17aebf901b0b6 (commit) via 687a6098124aef1893f8c300ab2a07cb624aab0c (commit) from c76ef3976ed14e1066d09a25d4b64bd6a4494a21 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ff70b3123c63ba33ffb77b0b6730e6994fcdc422 Author: Ivan1986 <iva...@li...> Date: Wed Jul 28 14:42:13 2010 +0400 * Добавлен параметр направления сортировки (скафолдинг) diff --git a/lib/Modules/Scafold/ScafoldController.php b/lib/Modules/Scafold/ScafoldController.php index d444e11..f7c5d7c 100644 --- a/lib/Modules/Scafold/ScafoldController.php +++ b/lib/Modules/Scafold/ScafoldController.php @@ -327,26 +327,30 @@ abstract class ScafoldController extends Controller * Устанавливает порядок сортировки * * @param string $field Имя поля + * @param string $dir Направление сортировки (ASC|DESC|) */ - public function sortAction($field='') + public function sortAction($field='', $dir='') { $this->session(); //такого поля нету if (!isset($this->fields[$field])) QFW::$router->redirect(Url::C('index'), true); - if (isset($_SESSION['scafold'][$this->table]['sort']) && - $_SESSION['scafold'][$this->table]['sort']['field'] == $field) - $r = array( - 'field' => $field, - 'direction' => $_SESSION['scafold'][$this->table]['sort']['direction'] == 'ASC' ? - 'DESC' : 'ASC', - ); - else - $r = array( - 'field' => $field, - 'direction' => 'ASC', + //если сортировки в этой таблице еще нет + if (!isset($_SESSION['scafold'][$this->table]['sort'])) + $_SESSION['scafold'][$this->table]['sort'] = array( + 'field' => '', + 'direction' => '', ); - $_SESSION['scafold'][$this->table]['sort'] = $r; + //ссылка на сортировку этой таблицы + $sort =&$_SESSION['scafold'][$this->table]['sort']; + //если не указана, то ASC или сменить ASC на DESC + if ($dir != 'ASC' && $dir != 'DESC') + $dir = ($sort['field'] == $field && $sort['direction'] == 'ASC') + ? 'DESC' : 'ASC'; + $sort = array( + 'field' => $field, + 'direction' => $dir, + ); QFW::$router->redirect(Url::C('index'), true); } commit 8b2496a812fea9b27f2fa37239a17aebf901b0b6 Author: Ivan1986 <iva...@li...> Date: Wed Jul 28 14:41:46 2010 +0400 * Новый простой пагинатор diff --git a/application/helper/templates/pager/pager3.html b/application/helper/templates/pager/pager3.html new file mode 100644 index 0000000..5ee3968 --- /dev/null +++ b/application/helper/templates/pager/pager3.html @@ -0,0 +1,11 @@ +<!-- Pageslist --> +<div class="pageslist"> + <?php for($page=1;$page<=$pager['all'];$page++) {?> + <?php if ($page==$pager['c']) {?> + <b><?php echo $page?></b> + <?php } else {?> + <a href="<?php echo str_replace('$',$page,$pager['url'])?>"><?php echo $page?></a> + <?php } ?> + <?php } ?> +</div> +<!-- /Pageslist --> commit 687a6098124aef1893f8c300ab2a07cb624aab0c Author: Ivan1986 <iva...@li...> Date: Fri Jul 23 15:55:04 2010 +0400 Исправлена ошибка в memcached diff --git a/QFW/Cacher/Memcached.php b/QFW/Cacher/Memcached.php index 3f8112b..fd964ba 100644 --- a/QFW/Cacher/Memcached.php +++ b/QFW/Cacher/Memcached.php @@ -45,7 +45,7 @@ class Cacher_Memcached implements Zend_Cache_Backend_Interface public function getStats() { - return $this->mc->getExtendedStats(); + return $this->mc->getStats(); } public function remove($id) ----------------------------------------------------------------------- Summary of changes: QFW/Cacher/Memcached.php | 2 +- application/helper/templates/pager/pager3.html | 11 ++++++++ lib/Modules/Scafold/ScafoldController.php | 30 +++++++++++++---------- 3 files changed, 29 insertions(+), 14 deletions(-) create mode 100644 application/helper/templates/pager/pager3.html hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-07-20 05:46:08
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via c76ef3976ed14e1066d09a25d4b64bd6a4494a21 (commit) via 94a5ec25bf3b31e9f1bcf6283580dd8fb693ebcf (commit) from 927b01ad27928b6657163caa81dcdc723aea1900 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c76ef3976ed14e1066d09a25d4b64bd6a4494a21 Author: Ivan1986 <iva...@li...> Date: Mon Jul 19 10:53:27 2010 +0400 Релиз в bz2 diff --git a/release.sh b/release.sh index 86286b5..d3398bb 100755 --- a/release.sh +++ b/release.sh @@ -1,5 +1,5 @@ #!/bin/sh -#DESC Скрипт создания релиза, первый параметр - имя релиза (например QuickFWv0.7b => QuickFWv0.7b.tar.gz) +#DESC Скрипт создания релиза, первый параметр - имя релиза (например QuickFWv1.5 => QuickFWv1.5.tar.bz2) test -z "$1" && echo "usage release.sh <releaseName>" && exit 1 @@ -20,7 +20,12 @@ rm -rf addons rm -f release.sh rm -f .gitignore +#cd doc/asciidoc +#make quickfw.pdf +#mv quickfw.pdf ../ +#cd ../.. + cd .. -rm -f $1.tar.gz -tar -czf $1.tar.gz $1 +rm -f $1.tar.bz2 +tar -cjf $1.tar.bz2 $1 rm -rf $1 commit 94a5ec25bf3b31e9f1bcf6283580dd8fb693ebcf Author: Ivan1986 <iva...@li...> Date: Mon Jul 19 10:49:07 2010 +0400 Поправил доку - а то вылезает за страницу diff --git a/doc/asciidoc/helpers.txt b/doc/asciidoc/helpers.txt index 73eced0..40aa6ba 100644 --- a/doc/asciidoc/helpers.txt +++ b/doc/asciidoc/helpers.txt @@ -18,4 +18,4 @@ +Url::A+:: Url относительно экшена -Для переинициализации есть функция +Url::Init+, которая перечитывает массив +QFW::$config[\'redirection']+. +Настройки хранятся в +QFW::$config[\'redirection']+, перечитать можно с помощью функции +Url::Init()+. ----------------------------------------------------------------------- Summary of changes: doc/asciidoc/helpers.txt | 2 +- release.sh | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-07-19 07:03:45
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The tag, 1.6 has been created at c76ef3976ed14e1066d09a25d4b64bd6a4494a21 (commit) - Log ----------------------------------------------------------------- commit c76ef3976ed14e1066d09a25d4b64bd6a4494a21 Author: Ivan1986 <iva...@li...> Date: Mon Jul 19 10:53:27 2010 +0400 Релиз в bz2 ----------------------------------------------------------------------- hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-07-16 13:00:29
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via 927b01ad27928b6657163caa81dcdc723aea1900 (commit) from 3cbfe4cb084f2e62b605ffafe3defc5bf3205c93 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 927b01ad27928b6657163caa81dcdc723aea1900 Author: Ivan1986 <iva...@li...> Date: Fri Jul 16 16:59:43 2010 +0400 Путь к метаформам в скафолдинге diff --git a/lib/Modules/Scafold/ScafoldController.php b/lib/Modules/Scafold/ScafoldController.php index 494ba9e..d444e11 100644 --- a/lib/Modules/Scafold/ScafoldController.php +++ b/lib/Modules/Scafold/ScafoldController.php @@ -172,7 +172,7 @@ abstract class ScafoldController extends Controller if (count($filter['form'])) { - require_once LIBPATH.'/MetaForm/FormPersister.php'; + require_once LIBPATH.'/HTML/FormPersister.php'; ob_start(array(new HTML_FormPersister(), 'process')); QFW::$view->assign('filter', $filter['form']); } @@ -194,7 +194,7 @@ abstract class ScafoldController extends Controller public function editAction($id=-1) { //инициализация FormPersister - require_once LIBPATH.'/MetaForm/FormPersister.php'; + require_once LIBPATH.'/HTML/FormPersister.php'; ob_start(array(new HTML_FormPersister(), 'process')); $errors = array(); ----------------------------------------------------------------------- Summary of changes: lib/Modules/Scafold/ScafoldController.php | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-07-16 12:18:19
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via 3cbfe4cb084f2e62b605ffafe3defc5bf3205c93 (commit) from a117522122e16aab3209c698a5a4a5430eba2acf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3cbfe4cb084f2e62b605ffafe3defc5bf3205c93 Author: Ivan1986 <iva...@li...> Date: Fri Jul 16 16:17:14 2010 +0400 Убрал бит выполнения diff --git a/lib/Language.php b/lib/Language.php old mode 100755 new mode 100644 diff --git a/lib/True_validation.php b/lib/True_validation.php old mode 100755 new mode 100644 diff --git a/lib/XMPPHP/Exception.php b/lib/XMPPHP/Exception.php old mode 100755 new mode 100644 ----------------------------------------------------------------------- Summary of changes: 0 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 lib/Language.php mode change 100755 => 100644 lib/True_validation.php mode change 100755 => 100644 lib/XMPPHP/Exception.php hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-07-16 12:05:27
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via a117522122e16aab3209c698a5a4a5430eba2acf (commit) from 132b644d399bc4915e0b208795f7ab02b7423b8c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a117522122e16aab3209c698a5a4a5430eba2acf Author: Ivan1986 <iva...@li...> Date: Fri Jul 16 16:04:40 2010 +0400 Добавил эскейп в утилиты diff --git a/lib/utils.php b/lib/utils.php index 1248a4c..b6bce92 100644 --- a/lib/utils.php +++ b/lib/utils.php @@ -313,4 +313,12 @@ function preg($pattern, $subject, $all = true) return $m; } +/** + * Функции ескейпинга в нужной кодировке + * + * @param string $s Исходная строка + * @return string htmlspecialchars($s, ENT_QUOTES, $encoding) + */ +function esc($s) { return htmlspecialchars($s, ENT_QUOTES, QFW::$config['host']['encoding']); } + ?> ----------------------------------------------------------------------- Summary of changes: lib/utils.php | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-07-13 10:49:22
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via 132b644d399bc4915e0b208795f7ab02b7423b8c (commit) from 83ad45eda87333cfdf171a858cb7aae331126392 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 132b644d399bc4915e0b208795f7ab02b7423b8c Author: Ivan1986 <iva...@li...> Date: Tue Jul 13 14:48:15 2010 +0400 В качестве реврайта можно указать указатель на функцию diff --git a/QFW/QuickFW/Router.php b/QFW/QuickFW/Router.php index bf0e1e6..acecdb0 100644 --- a/QFW/QuickFW/Router.php +++ b/QFW/QuickFW/Router.php @@ -309,15 +309,7 @@ class QuickFW_Router */ public function backrewrite($uri) { - if (!QFW::$config['redirection']['useRewrite']) - return $uri; - if ($this->backrewrite == false) - { - $backrewrite = array(); - require APPPATH . '/rewrite.php'; - $this->backrewrite = $backrewrite; - } - return preg_replace(array_keys($this->backrewrite), array_values($this->backrewrite), $uri); + return $this->rewr($uri, 'backrewrite'); } /** @@ -329,15 +321,37 @@ class QuickFW_Router */ protected function rewrite($uri) { + return $this->rewr($uri, 'rewrite'); + } + + /** + * Реализация преобразования адресов + * + * @internal + * @param string $url Uri для реврайта + * @param string $type тип преобразования + * @return string преобразованный Uri + */ + private function rewr($uri, $type) + { if (!QFW::$config['redirection']['useRewrite']) return $uri; - if ($this->rewrite == false) + if ($this->$type == false) { $rewrite = array(); - require APPPATH . '/rewrite.php'; + $backrewrite = array(); + require_once APPPATH . '/rewrite.php'; $this->rewrite = $rewrite; + $this->backrewrite = $backrewrite; + } + if (is_array($this->$type)) + return preg_replace(array_keys($this->$type), array_values($this->$type), $uri); + elseif (is_callable($this->$type)) + { + $f = $this->$type; + return $f($uri); } - return preg_replace(array_keys($this->rewrite), array_values($this->rewrite), $uri); + return $uri; } /** ----------------------------------------------------------------------- Summary of changes: QFW/QuickFW/Router.php | 38 ++++++++++++++++++++++++++------------ 1 files changed, 26 insertions(+), 12 deletions(-) hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-07-13 09:14:23
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via 83ad45eda87333cfdf171a858cb7aae331126392 (commit) from cf4a4f1b4d446b549bb9164a9afc4cade868c061 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 83ad45eda87333cfdf171a858cb7aae331126392 Author: Ivan1986 <iva...@li...> Date: Tue Jul 13 13:13:43 2010 +0400 Возможен нотайс для неверного номера формы diff --git a/lib/Curl.php b/lib/Curl.php index 0684956..f6dcbbe 100644 --- a/lib/Curl.php +++ b/lib/Curl.php @@ -282,7 +282,7 @@ class CurlResponse } $forms[$k]['fields'] = $fields; } - return $num===false ? $forms : $forms[$num]; + return $num===false ? $forms : isset($forms[$num]) ? $forms[$num] : false; } /** ----------------------------------------------------------------------- Summary of changes: lib/Curl.php | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-07-12 12:12:57
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via cf4a4f1b4d446b549bb9164a9afc4cade868c061 (commit) from 85dc4b121b68972ea2661ffa181268cdf1f44510 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit cf4a4f1b4d446b549bb9164a9afc4cade868c061 Author: Ivan1986 <iva...@li...> Date: Mon Jul 12 16:12:27 2010 +0400 Возможный нотайс в 404 diff --git a/QFW/QuickFW/Router.php b/QFW/QuickFW/Router.php index 2d4b511..bf0e1e6 100644 --- a/QFW/QuickFW/Router.php +++ b/QFW/QuickFW/Router.php @@ -221,7 +221,7 @@ class QuickFW_Router /*if (substr(PHP_SAPI, 0, 3) == 'cgi') header ('Status: 404 Not Found'); else*/ - header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); + header((empty($_SERVER['SERVER_PROTOCOL']) ? 'HTTP/1.1 ' : $_SERVER['SERVER_PROTOCOL']).' 404 Not Found'); if (!is_file(QFW::$view->getScriptPath().'/404.html')) QFW::$view->setScriptPath(APPPATH.'/default/templates/'); die(QFW::$view->render('404.html')); ----------------------------------------------------------------------- Summary of changes: QFW/QuickFW/Router.php | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-07-12 11:54:31
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via 85dc4b121b68972ea2661ffa181268cdf1f44510 (commit) from 05c5b029943576e1c42048c50e4fb404e7229f35 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 85dc4b121b68972ea2661ffa181268cdf1f44510 Author: Ivan1986 <iva...@li...> Date: Mon Jul 12 15:53:31 2010 +0400 Дополнение доки и упорядочевание примеров diff --git a/doc/Examples.txt b/doc/Examples/True_validation.txt similarity index 100% rename from doc/Examples.txt rename to doc/Examples/True_validation.txt diff --git a/doc/asciidoc/directory.txt b/doc/asciidoc/directory.txt index ca8ee59..16c5704 100644 --- a/doc/asciidoc/directory.txt +++ b/doc/asciidoc/directory.txt @@ -36,6 +36,10 @@ Всякая документация asciidoc;; *То, что вы сейчас читаете* :) + Examples;; + Примеры использования библиотек + plainPHP.xml;; + Подсветка синтаксиса PlainPHP для Kate *lib*:: Папка с различными дополнительными библиотеками *Не готово* ----------------------------------------------------------------------- Summary of changes: doc/{Examples.txt => Examples/True_validation.txt} | 0 doc/asciidoc/directory.txt | 4 ++++ 2 files changed, 4 insertions(+), 0 deletions(-) rename doc/{Examples.txt => Examples/True_validation.txt} (100%) hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-07-12 11:09:56
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via 05c5b029943576e1c42048c50e4fb404e7229f35 (commit) via 5bdcff0e0cf23a0a282bab84fc6ac0abeca33cad (commit) via a8b089cfa2bc8970c4a313292d4619873bd515a4 (commit) via 303799b5b75a464df8f341f4e9e6b6dfa2cc0002 (commit) from 1cd640bfeecb15c185847348752dcaea762d08db (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 05c5b029943576e1c42048c50e4fb404e7229f35 Author: Ivan1986 <iva...@li...> Date: Mon Jul 12 15:06:26 2010 +0400 Функциии инициализации бибилиотек в QFW diff --git a/QFW/Init.php b/QFW/Init.php index 1d831e3..be198cb 100644 --- a/QFW/Init.php +++ b/QFW/Init.php @@ -93,11 +93,8 @@ class QFW { //Включаем обработку фатальных ошибок, если в конфиге указано if (!empty(self::$config['error'])) - { - require_once QFWPATH.'/QuickFW/Error.php'; foreach(self::$config['error'] as $handler) - QFW_Error::addFromConfig($handler); - } + self::ErrorFromConfig($handler); //автолоад if (!empty(self::$config['QFW']['autoload'])) @@ -117,6 +114,63 @@ class QFW self::$view->mainTemplate = ''; } } + + /** + * Вспомогательные функции инициализации библиотек + */ + + /** @var Debug_ErrorHook_Listener Обработчик ошибок */ + static private $ErrorHook = false; + + /** + * Инициализация обработчика ошибок из конфига + * + * @param array $handler информация об обработчике ошибок + */ + static private function ErrorFromConfig($handler) + { + require_once LIBPATH.'/Debug/ErrorHook/Listener.php'; + if (!self::$ErrorHook) + self::$ErrorHook = new Debug_ErrorHook_Listener();; + + $name = ucfirst($handler['name']); + require_once LIBPATH.'/Debug/ErrorHook/'.$name.'Notifier.php'; + //пока так, потом возможно придется переделать + if ($name == 'Mail') + { + $i = new Debug_ErrorHook_MailNotifier( + $handler['options']['to'], $handler['options']['whatToSend'], + $handler['options']['subjPrefix'], $handler['options']['charset']); + } + else + { + $class = 'Debug_ErrorHook_'.$name.'Notifier'; + $i = new $class($handler['options']['whatToSend']); + } + if ($handler['RemoveDups']) + { + require_once LIBPATH.'/Debug/ErrorHook/RemoveDupsWrapper.php'; + $i = new Debug_ErrorHook_RemoveDupsWrapper($i, + TMPPATH.'/errors', $handler['RemoveDups']); + } + self::$ErrorHook->addNotifier($i); + } + + /** + * Создание класса джаббера из конфига + * + * @return XMPPHP_XMPP класс jabbera + */ + static public function JabberFromConfig() + { + require_once LIBPATH.'/XMPPHP/XMPP.php'; + new XMPPHP_XMPP( + QFW::$config['jabber']['host'], QFW::$config['jabber']['port'], + QFW::$config['jabber']['user'], QFW::$config['jabber']['pass'], + QFW::$config['jabber']['resource'], QFW::$config['jabber']['server'], + !QFW::$config['QFW']['release'], XMPPHP_Log::LEVEL_INFO); + } + } QFW::Init(); diff --git a/QFW/QuickFW/Error.php b/QFW/QuickFW/Error.php deleted file mode 100644 index e8a440a..0000000 --- a/QFW/QuickFW/Error.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php - -require_once LIBPATH.'/Debug/ErrorHook/Listener.php'; - -class QFW_Error extends Debug_ErrorHook_Listener -{ - private static $Instance; - - /** - * Добавляет обработчик из конфига - * - * @param array $handler данные из конфига - */ - public static function addFromConfig($handler) - { - if (!self::$Instance) - self::$Instance = new self();; - - $name = ucfirst($handler['name']); - require_once LIBPATH.'/Debug/ErrorHook/'.$name.'Notifier.php'; - //пока так, потом возможно придется переделать - if ($name == 'Mail') - { - $i = new Debug_ErrorHook_MailNotifier( - $handler['options']['to'], $handler['options']['whatToSend'], - $handler['options']['subjPrefix'], $handler['options']['charset']); - } - else - { - $class = 'Debug_ErrorHook_'.$name.'Notifier'; - $i = new $class($handler['options']['whatToSend']); - } - if ($handler['RemoveDups']) - { - require_once LIBPATH.'/Debug/ErrorHook/RemoveDupsWrapper.php'; - $i = new Debug_ErrorHook_RemoveDupsWrapper($i, - TMPPATH.'/errors', $handler['RemoveDups']); - } - self::$Instance->addNotifier($i); - - } -} - -?> \ No newline at end of file diff --git a/lib/Log.php b/lib/Log.php index ee110fb..a5dcfb0 100644 --- a/lib/Log.php +++ b/lib/Log.php @@ -50,11 +50,7 @@ class Log error_log('Jabber не настроен '); else { - require_once LIBPATH.'/jabber/XMPPHP/XMPP.php'; - $J = new XMPPHP_XMPP(QFW::$config['jabber']['host'], QFW::$config['jabber']['port'], - QFW::$config['jabber']['user'], QFW::$config['jabber']['pass'], - QFW::$config['jabber']['resource'], QFW::$config['jabber']['server'], - !QFW::$config['QFW']['release'], XMPPHP_Log::LEVEL_ERROR); + $J = QFW::JabberFromConfig(); $J->connect(); $J->processUntil('session_start',10); $J->presence(); diff --git a/lib/Log52.php b/lib/Log52.php index 8429474..4f28952 100644 --- a/lib/Log52.php +++ b/lib/Log52.php @@ -55,11 +55,7 @@ class Log error_log('Jabber не настроен '); else { - require_once LIBPATH.'/jabber/XMPPHP/XMPP.php'; - $J = new XMPPHP_XMPP(QFW::$config['jabber']['host'], QFW::$config['jabber']['port'], - QFW::$config['jabber']['user'], QFW::$config['jabber']['pass'], - QFW::$config['jabber']['resource'], QFW::$config['jabber']['server'], - !QFW::$config['QFW']['release'], XMPPHP_Log::LEVEL_ERROR); + $J = QFW::JabberFromConfig(); $J->connect(); $J->processUntil('session_start',10); $J->presence(); commit 5bdcff0e0cf23a0a282bab84fc6ac0abeca33cad Author: Ivan1986 <iva...@li...> Date: Mon Jul 12 15:05:08 2010 +0400 Перенес библиотеку jabbera diff --git a/lib/jabber/cli_longrun_example.php b/doc/Examples/jabber/cli_longrun_example.php similarity index 100% rename from lib/jabber/cli_longrun_example.php rename to doc/Examples/jabber/cli_longrun_example.php diff --git a/lib/jabber/cli_longrun_example_bosh.php b/doc/Examples/jabber/cli_longrun_example_bosh.php similarity index 100% rename from lib/jabber/cli_longrun_example_bosh.php rename to doc/Examples/jabber/cli_longrun_example_bosh.php diff --git a/lib/jabber/sendmessage_example.php b/doc/Examples/jabber/sendmessage_example.php similarity index 100% rename from lib/jabber/sendmessage_example.php rename to doc/Examples/jabber/sendmessage_example.php diff --git a/lib/jabber/webclient_example.php b/doc/Examples/jabber/webclient_example.php similarity index 100% rename from lib/jabber/webclient_example.php rename to doc/Examples/jabber/webclient_example.php diff --git a/lib/jabber/XMPPHP/BOSH.php b/lib/XMPPHP/BOSH.php similarity index 100% rename from lib/jabber/XMPPHP/BOSH.php rename to lib/XMPPHP/BOSH.php diff --git a/lib/jabber/XMPPHP/Exception.php b/lib/XMPPHP/Exception.php similarity index 100% rename from lib/jabber/XMPPHP/Exception.php rename to lib/XMPPHP/Exception.php diff --git a/lib/jabber/XMPPHP/Log.php b/lib/XMPPHP/Log.php similarity index 100% rename from lib/jabber/XMPPHP/Log.php rename to lib/XMPPHP/Log.php diff --git a/lib/jabber/XMPPHP/Roster.php b/lib/XMPPHP/Roster.php similarity index 100% rename from lib/jabber/XMPPHP/Roster.php rename to lib/XMPPHP/Roster.php diff --git a/lib/jabber/XMPPHP/XMLObj.php b/lib/XMPPHP/XMLObj.php similarity index 100% rename from lib/jabber/XMPPHP/XMLObj.php rename to lib/XMPPHP/XMLObj.php diff --git a/lib/jabber/XMPPHP/XMLStream.php b/lib/XMPPHP/XMLStream.php similarity index 100% rename from lib/jabber/XMPPHP/XMLStream.php rename to lib/XMPPHP/XMLStream.php diff --git a/lib/jabber/XMPPHP/XMPP.php b/lib/XMPPHP/XMPP.php similarity index 100% rename from lib/jabber/XMPPHP/XMPP.php rename to lib/XMPPHP/XMPP.php diff --git a/lib/jabber/XMPPHP/XMPP_Old.php b/lib/XMPPHP/XMPP_Old.php similarity index 100% rename from lib/jabber/XMPPHP/XMPP_Old.php rename to lib/XMPPHP/XMPP_Old.php diff --git a/lib/jabber/jabber.php b/lib/jabber/jabber.php deleted file mode 100644 index 3c331f6..0000000 --- a/lib/jabber/jabber.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -require_once 'XMPPHP/XMPP.php'; - -QFW::$libs['jabber'] = new XMPPHP_XMPP( - QFW::$config['jabber']['host'], QFW::$config['jabber']['port'], - QFW::$config['jabber']['user'], QFW::$config['jabber']['pass'], - QFW::$config['jabber']['resource'], QFW::$config['jabber']['server'], - !QFW::$config['QFW']['release'], XMPPHP_Log::LEVEL_INFO); - -?> \ No newline at end of file commit a8b089cfa2bc8970c4a313292d4619873bd515a4 Author: Ivan1986 <iva...@li...> Date: Mon Jul 12 14:33:32 2010 +0400 Перенес метаформы diff --git a/application/default/controllers/IndexController.php b/application/default/controllers/IndexController.php index f26e242..75cc6dd 100644 --- a/application/default/controllers/IndexController.php +++ b/application/default/controllers/IndexController.php @@ -12,9 +12,9 @@ class IndexController extends QuickFW_Auth public function indexAction() { /*print_r($_POST); - require_once LIBPATH.'/MetaForm/MetaFormAction.php'; - require_once LIBPATH.'/MetaForm/MetaForm.php'; - require_once LIBPATH.'/MetaForm/FormPersister.php'; + require_once LIBPATH.'/HTML/MetaFormAction.php'; + require_once LIBPATH.'/HTML/MetaForm.php'; + require_once LIBPATH.'/HTML/FormPersister.php'; $SemiParser = new HTML_SemiParser(); ob_start(array(&$SemiParser, 'process')); diff --git a/lib/MetaForm/FormPersister.php b/lib/HTML/FormPersister.php similarity index 100% rename from lib/MetaForm/FormPersister.php rename to lib/HTML/FormPersister.php diff --git a/lib/MetaForm/MetaForm.php b/lib/HTML/MetaForm.php similarity index 100% rename from lib/MetaForm/MetaForm.php rename to lib/HTML/MetaForm.php diff --git a/lib/MetaForm/MetaFormAction.php b/lib/HTML/MetaFormAction.php similarity index 100% rename from lib/MetaForm/MetaFormAction.php rename to lib/HTML/MetaFormAction.php diff --git a/lib/MetaForm/SemiParser.php b/lib/HTML/SemiParser.php similarity index 100% rename from lib/MetaForm/SemiParser.php rename to lib/HTML/SemiParser.php commit 303799b5b75a464df8f341f4e9e6b6dfa2cc0002 Author: Ivan1986 <iva...@li...> Date: Mon Jul 12 14:23:58 2010 +0400 Переименован и перемещен обработчик ошибок diff --git a/QFW/Init.php b/QFW/Init.php index c1b108c..1d831e3 100644 --- a/QFW/Init.php +++ b/QFW/Init.php @@ -96,7 +96,7 @@ class QFW { require_once QFWPATH.'/QuickFW/Error.php'; foreach(self::$config['error'] as $handler) - QFW_Listener::addFromConfig($handler); + QFW_Error::addFromConfig($handler); } //автолоад diff --git a/QFW/QuickFW/Error.php b/QFW/QuickFW/Error.php index d25e409..e8a440a 100644 --- a/QFW/QuickFW/Error.php +++ b/QFW/QuickFW/Error.php @@ -1,8 +1,8 @@ <?php -require_once LIBPATH.'/ErrorHook/Listener.php'; +require_once LIBPATH.'/Debug/ErrorHook/Listener.php'; -class QFW_Listener extends Debug_ErrorHook_Listener +class QFW_Error extends Debug_ErrorHook_Listener { private static $Instance; @@ -17,7 +17,7 @@ class QFW_Listener extends Debug_ErrorHook_Listener self::$Instance = new self();; $name = ucfirst($handler['name']); - require_once LIBPATH.'/ErrorHook/'.$name.'Notifier.php'; + require_once LIBPATH.'/Debug/ErrorHook/'.$name.'Notifier.php'; //пока так, потом возможно придется переделать if ($name == 'Mail') { @@ -32,7 +32,7 @@ class QFW_Listener extends Debug_ErrorHook_Listener } if ($handler['RemoveDups']) { - require_once LIBPATH.'/ErrorHook/RemoveDupsWrapper.php'; + require_once LIBPATH.'/Debug/ErrorHook/RemoveDupsWrapper.php'; $i = new Debug_ErrorHook_RemoveDupsWrapper($i, TMPPATH.'/errors', $handler['RemoveDups']); } diff --git a/lib/ErrorHook/Catcher.php b/lib/Debug/ErrorHook/Catcher.php similarity index 100% rename from lib/ErrorHook/Catcher.php rename to lib/Debug/ErrorHook/Catcher.php diff --git a/lib/ErrorHook/INotifier.php b/lib/Debug/ErrorHook/INotifier.php similarity index 100% rename from lib/ErrorHook/INotifier.php rename to lib/Debug/ErrorHook/INotifier.php diff --git a/lib/ErrorHook/Listener.php b/lib/Debug/ErrorHook/Listener.php similarity index 100% rename from lib/ErrorHook/Listener.php rename to lib/Debug/ErrorHook/Listener.php diff --git a/lib/ErrorHook/MailNotifier.php b/lib/Debug/ErrorHook/MailNotifier.php similarity index 100% rename from lib/ErrorHook/MailNotifier.php rename to lib/Debug/ErrorHook/MailNotifier.php diff --git a/lib/ErrorHook/RemoveDupsWrapper.php b/lib/Debug/ErrorHook/RemoveDupsWrapper.php similarity index 100% rename from lib/ErrorHook/RemoveDupsWrapper.php rename to lib/Debug/ErrorHook/RemoveDupsWrapper.php diff --git a/lib/ErrorHook/TextNotifier.php b/lib/Debug/ErrorHook/TextNotifier.php similarity index 100% rename from lib/ErrorHook/TextNotifier.php rename to lib/Debug/ErrorHook/TextNotifier.php diff --git a/lib/ErrorHook/Util.php b/lib/Debug/ErrorHook/Util.php similarity index 100% rename from lib/ErrorHook/Util.php rename to lib/Debug/ErrorHook/Util.php ----------------------------------------------------------------------- Summary of changes: QFW/Init.php | 62 ++++++++++++++++++- QFW/QuickFW/Error.php | 44 -------------- .../default/controllers/IndexController.php | 6 +- .../Examples}/jabber/cli_longrun_example.php | 0 .../Examples}/jabber/cli_longrun_example_bosh.php | 0 .../Examples}/jabber/sendmessage_example.php | 0 {lib => doc/Examples}/jabber/webclient_example.php | 0 lib/{ => Debug}/ErrorHook/Catcher.php | 0 lib/{ => Debug}/ErrorHook/INotifier.php | 0 lib/{ => Debug}/ErrorHook/Listener.php | 0 lib/{ => Debug}/ErrorHook/MailNotifier.php | 0 lib/{ => Debug}/ErrorHook/RemoveDupsWrapper.php | 0 lib/{ => Debug}/ErrorHook/TextNotifier.php | 0 lib/{ => Debug}/ErrorHook/Util.php | 0 lib/{MetaForm => HTML}/FormPersister.php | 0 lib/{MetaForm => HTML}/MetaForm.php | 0 lib/{MetaForm => HTML}/MetaFormAction.php | 0 lib/{MetaForm => HTML}/SemiParser.php | 0 lib/Log.php | 6 +-- lib/Log52.php | 6 +-- lib/{jabber => }/XMPPHP/BOSH.php | 0 lib/{jabber => }/XMPPHP/Exception.php | 0 lib/{jabber => }/XMPPHP/Log.php | 0 lib/{jabber => }/XMPPHP/Roster.php | 0 lib/{jabber => }/XMPPHP/XMLObj.php | 0 lib/{jabber => }/XMPPHP/XMLStream.php | 0 lib/{jabber => }/XMPPHP/XMPP.php | 0 lib/{jabber => }/XMPPHP/XMPP_Old.php | 0 lib/jabber/jabber.php | 11 ---- 29 files changed, 63 insertions(+), 72 deletions(-) delete mode 100644 QFW/QuickFW/Error.php rename {lib => doc/Examples}/jabber/cli_longrun_example.php (100%) rename {lib => doc/Examples}/jabber/cli_longrun_example_bosh.php (100%) rename {lib => doc/Examples}/jabber/sendmessage_example.php (100%) rename {lib => doc/Examples}/jabber/webclient_example.php (100%) rename lib/{ => Debug}/ErrorHook/Catcher.php (100%) rename lib/{ => Debug}/ErrorHook/INotifier.php (100%) rename lib/{ => Debug}/ErrorHook/Listener.php (100%) rename lib/{ => Debug}/ErrorHook/MailNotifier.php (100%) rename lib/{ => Debug}/ErrorHook/RemoveDupsWrapper.php (100%) rename lib/{ => Debug}/ErrorHook/TextNotifier.php (100%) rename lib/{ => Debug}/ErrorHook/Util.php (100%) rename lib/{MetaForm => HTML}/FormPersister.php (100%) rename lib/{MetaForm => HTML}/MetaForm.php (100%) rename lib/{MetaForm => HTML}/MetaFormAction.php (100%) rename lib/{MetaForm => HTML}/SemiParser.php (100%) rename lib/{jabber => }/XMPPHP/BOSH.php (100%) rename lib/{jabber => }/XMPPHP/Exception.php (100%) rename lib/{jabber => }/XMPPHP/Log.php (100%) rename lib/{jabber => }/XMPPHP/Roster.php (100%) rename lib/{jabber => }/XMPPHP/XMLObj.php (100%) rename lib/{jabber => }/XMPPHP/XMLStream.php (100%) rename lib/{jabber => }/XMPPHP/XMPP.php (100%) rename lib/{jabber => }/XMPPHP/XMPP_Old.php (100%) delete mode 100644 lib/jabber/jabber.php hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-07-12 08:19:18
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via 1cd640bfeecb15c185847348752dcaea762d08db (commit) via 7f292725e75d27ce690d7c23eb0cd25bb0b17273 (commit) via f45e026c6c313b732ecb6ed65e7a54fbe7973e58 (commit) via 40f11e9d585641fd79e00a8e84468d921dff2d20 (commit) from 22c10fa7e34341162144117de8caef8e0fbafcb0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1cd640bfeecb15c185847348752dcaea762d08db Author: TeXHaPb <st...@in...> Date: Fri Jul 9 00:16:30 2010 +0400 Возвращена на фиг нужная TrueValidation" This reverts commit 544d5db1fa7a0a5f7fddfc263748667985345b65. diff --git a/lib/Language.php b/lib/Language.php new file mode 100755 index 0000000..e2aaf43 --- /dev/null +++ b/lib/Language.php @@ -0,0 +1,122 @@ +<?php +/** + * CodeIgniter + * + * An open source application development framework for PHP 4.3.2 or newer + * + * @package CodeIgniter + * @author Rick Ellis + * @copyright Copyright (c) 2006, EllisLab, Inc. + * @license http://www.codeignitor.com/user_guide/license.html + * @link http://www.codeigniter.com + * @since Version 1.0 + * @filesource + */ + +// ------------------------------------------------------------------------ + +/** + * Language Class + * + * @package CodeIgniter + * @subpackage Libraries + * @category Language + * @author Rick Ellis + * @link http://www.codeigniter.com/user_guide/libraries/language.html + */ +class Language { + + var $language = array(); + var $is_loaded = array(); + + /** + * Constructor + * + * @access public + */ + function __construct() + { + + } + + // -------------------------------------------------------------------- + + /** + * Load a language file + * + * @access public + * @param mixed the name of the language file to be loaded. Can be an array + * @param string the language (english, etc.) + * @return void + */ + function load($langfile = '', $idiom = '', $return = FALSE) + { + global $config; + $langfile = $langfile.'_lang.php'; + + if (in_array($langfile, $this->is_loaded, TRUE)) + { + return; + } + + if ($idiom == '') + { + $deft_lang = $config['host']['lang']; + $idiom = is_null($deft_lang) ? 'en_EN' : $deft_lang; + } + + // Determine where the language file is and load it + if (file_exists(APPPATH.'/language/'.$idiom.'/'.$langfile)) + { + include(APPPATH.'/language/'.$idiom.'/'.$langfile); + } + else + { + if (file_exists(LIBPATH.'/language/'.$idiom.'/'.$langfile)) + { + include(LIBPATH.'/language/'.$idiom.'/'.$langfile); + } + else + { +//!!! show_error('Unable to load the requested language file: language/'.$langfile); + } + } + + + if ( ! isset($lang)) + { +//!!! log_message('error', 'Language file contains no data: language/'.$idiom.'/'.$langfile); + return; + } + + if ($return == TRUE) + { + return $lang; + } + + $this->is_loaded[] = $langfile; + $this->language = array_merge($this->language, $lang); + unset($lang); + +//!!! log_message('debug', 'Language file loaded: language/'.$idiom.'/'.$langfile); + return TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Fetch a single line of text from the language array + * + * @access public + * @param string the language line + * @return string + */ + function line($line = '') + { + return ($line == '' OR ! isset($this->language[$line])) ? FALSE : $this->language[$line]; + } + +} +// END Language Class +QFW::$libs['lang'] = new Language(); +?> \ No newline at end of file diff --git a/lib/True_validation.php b/lib/True_validation.php new file mode 100755 index 0000000..4989b5d --- /dev/null +++ b/lib/True_validation.php @@ -0,0 +1,471 @@ +<?php + +class True_Validation { + + var $_rules = array(); //Правила для проверки + var $_data = array(); //Данные для проверки. + var $_fields = array(); //Заголовки полей + var $_errors = array(); //Массив ошибок + var $_error_messages = array();//Собственные сообщения об ошибках + + function True_Validation() { + $this->init(); + require_once(LIBPATH.'/Language.php'); + } + + function init() { + $this->_rules = array(); + $this->_data = array(); + $this->_fields = array(); + } + + function set_data($data = '') { + if ($data == '') { + return FALSE; + } else { + $this->_data = $data; + } + } + + function set_rules($rules = '') { + if ($rules == '') { + return; + } + + foreach ($rules as $key => $val) { + $this->_rules[$key] = $val; + } + } + + function set_fields($data = '', $field = '') { + if ($data == '') { + if (count($this->_fields) == 0) { + return FALSE; + } + } else { + if ( ! is_array($data)) { + $data = array($data => $field); + } + + if (count($data) > 0) { + $this->_fields = $data; + } + } + } + + function set_message($lang, $val = '') { + if ( ! is_array($lang)) + { + $lang = array($lang => $val); + } + + $this->_error_messages = array_merge($this->_error_messages, $lang); + } + + function add_error($field, $error) { + $this->_errors[$field][] = $error; + } + + // -------------------------------------------------------------------- + + /** + * Run the Validator + * + * This function does all the work. + * + * @access public + * @return bool + */ + function run($clean_errors = TRUE) { + if ($clean_errors) { + $this->_errors = array(); + } + + // Do we even have any data to process? Mm? + if (count($this->_data) == 0 OR count($this->_rules) == 0) { + return FALSE; + } + + // Load the language file containing error messages + QFW::$libs['lang']->load('true_validation'); + + // Cycle through the rules and test for errors + foreach ($this->_rules as $field => $rules) { + //Explode out the rules! + $ex = explode('|', $rules); + + /* + * Are we dealing with an "isset" rule? + * + * Before going further, we'll see if one of the rules + * is to check whether the item is set (typically this + * applies only to checkboxes). If so, we'll + * test for it here since there's not reason to go + * further + */ + if ( ! isset($this->_data[$field])) { + if (in_array('isset', $ex, TRUE) OR in_array('required', $ex)) { + if ( ! isset($this->_error_messages['isset'])) { + if (FALSE === ($line = QFW::$libs['lang']->line('isset'))) { + $line = 'The field was not set'; + } + } else { + $line = $this->_error_messages['isset']; + } + + $mfield = ( ! isset($this->_fields[$field])) ? $field : $this->_fields[$field]; + $this->add_error($field, sprintf($line, $mfield)); + } + + continue; + } + + /* + * Set the current field + * + * The various prepping functions need to know the + * current field name so they can do this: + * + * $this->data[$this->_current_field] == 'bla bla'; + * + $this->_current_field = $field;*/ + + // Cycle through the rules! + foreach ($ex As $rule) { + // Strip the parameter (if exists) from the rule + // Rules can contain a parameter: max_length[5] + $param = FALSE; + if (preg_match("/(.*?)\[(.*?)\]/", $rule, $match)) { + $rule = $match[1]; + $param = $match[2]; + } + + // Call the function that corresponds to the rule + if ( ! method_exists($this, $rule)) { + /* + * Run the native PHP function if called for + * + * If our own wrapper function doesn't exist we see + * if a native PHP function does. Users can use + * any native PHP function call that has one param. + */ + if (function_exists($rule)) { + $this->_data[$field] = $rule($this->_data[$field]); +// $this->$field = $this->data[$field]; + } + + continue; + } + + $result = $this->$rule($this->_data[$field], $param); + + // Did the rule test negatively? If so, grab the error. + if ($result === FALSE) { + if ( ! isset($this->_error_messages[$rule])) { + if (FALSE === ($line = QFW::$libs['lang']->line($rule))) { + $line = 'Unable to access an error message corresponding to your field name.'; + } + } else { + $line = $this->_error_messages[$rule]; + } + + // Build the error message + $mfield = ( ! isset($this->_fields[$field])) ? $field : $this->_fields[$field]; + $mparam = ( ! isset($this->_fields[$param])) ? $param : $this->_fields[$param]; + // Add the error to the error array + $this->add_error($field, sprintf($line, $mfield, $mparam)); + + continue 2; + } + } + + } + + $total_errors = count($this->_errors); + + /* + * Recompile the class variables + * + * If any prepping functions were called the $this->data data + * might now be different then the corresponding class + * variables so we'll set them anew. + */ + if ($total_errors > 0) { + $this->_safe_form_data = TRUE; + } + +//!!! $this->set_fields(); + + // Did we end up with any errors? + if ($total_errors == 0) { + return TRUE; + } + return FALSE; + } + + // -------------------------------------------------------------------- + + /** + * Required + * + * @access public + * @param string + * @return bool + */ + function required($str) + { + if ( ! is_array($str)) + { + return (trim($str) == '') ? FALSE : TRUE; + } + else + { + return ( ! empty($str)); + } + } + + function reqpwd($str, $val) + { + if ( ! is_array($str)) + { + return ($str == '') ? FALSE : TRUE; + } + else + { + return ( ! empty($str)); + } + } + + // -------------------------------------------------------------------- + + /** + * Match one field to another + * + * @access public + * @param string + * @return bool + */ + function matches($str, $field) + { + if ( ! isset($this->_data[$field])) + { + return FALSE; + } + + return ($str !== $this->_data[$field]) ? FALSE : TRUE; + } + + function noeq($str, $val) + { + return ($str=== $val) ? FALSE : TRUE; + } + + function pwd($str, $val) + { + return ($str!== $val) ? FALSE : TRUE; + } + // -------------------------------------------------------------------- + + /** + * Minimum Length + * + * @access public + * @param string + * @return bool + */ + function min_length($str, $val) + { + if (preg_match("/[^0-9]/", $val)) + { + return FALSE; + } + + return (mb_strlen($str,QFW::$config['host']['encoding']) < $val) ? FALSE : TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Max Length + * + * @access public + * @param string + * @return bool + */ + function max_length($str, $val) + { + if (preg_match("/[^0-9]/", $val)) + { + return FALSE; + } + + return (mb_strlen($str,QFW::$config['host']['encoding']) > $val) ? FALSE : TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Exact Length + * + * @access public + * @param string + * @return bool + */ + function exact_length($str, $val) + { + if (preg_match("/[^0-9]/", $val)) + { + return FALSE; + } + + return (mb_strlen($str,QFW::$config['host']['encoding']) != $val) ? FALSE : TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Valid Email + * + * @access public + * @param string + * @return bool + */ + function valid_email($str) + { + if (strlen($str)>255) + return FALSE; + if (strpos($str,'@')>64) + return FALSE; + return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Validate IP Address + * + * @access public + * @param string + * @return string + */ + function valid_ip($ip) + { + return true;//!!!!!$this->CI->valid_ip($ip); + } + + // -------------------------------------------------------------------- + + /** + * Alpha + * + * @access public + * @param string + * @return bool + */ + function alpha($str) + { + return ( ! preg_match("/^([a-z])+$/i", $str)) ? FALSE : TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Alpha-numeric + * + * @access public + * @param string + * @return bool + */ + function alpha_numeric($str) + { + return ( ! preg_match("/^([a-z0-9])+$/i", $str)) ? FALSE : TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Alpha-numeric with underscores and dashes + * + * @access public + * @param string + * @return bool + */ + function alpha_dash($str) + { + return ( ! preg_match("/^([-a-z0-9_-])+$/i", $str)) ? FALSE : TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Numeric + * + * @access public + * @param int + * @return bool + */ + function numeric($str) + { + //return ( ! ereg("^[0-9\.]+$", $str)) ? FALSE : TRUE; + return ( ! preg_match("/^[0-9\.]+$/", $str)) ? FALSE : TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Is Numeric + * + * @access public + * @param string + * @return bool + */ + function is_numeric($str) + { + return ( ! is_numeric($str)) ? FALSE : TRUE; + } + + // -------------------------------------------------------------------- + + /** + * Login + * + * @access public + * @param string + * @return bool + */ + function login($str) + { + return ( ! preg_match("/^[a-z][0-9a-z_]*$/", $str)) ? FALSE : TRUE; + } + + + // -------------------------------------------------------------------- + + /** + * Passport login (can include @ and domain after it) + * + * @access public + * @param string + * @return bool + */ + function passport_login($str) + { + return ( ! preg_match("/^[0-9a-z_\-][0-9a-z_\-\.]+(@([0-9a-z][0-9a-z\-]*[0-9a-z]\.)+[0-9a-z]{2,6})?$/i", $str)) ? FALSE : TRUE; + } + + function valid_url($str) { + return ( !preg_match('/\b((ht|f)tp):(\/\/)([a-z0-9.:@*()~#\]\[_?=&\/\\-])+/', $str)) ? FALSE : TRUE; + } + + function range($str, $val) { + $val = explode('-', $val); + if ((count($val)!==2) || preg_match("/[^0-9]/", $val[0]) || preg_match("/[^0-9]/", $val[1])) { + return FALSE; + } + return (($tmp = intval($str) < $val[0]) || ($tmp > $val[1])) ? FALSE : TRUE; + } + +} +// END Validation Class +QFW::$libs['true_validation'] = new True_Validation(); +?> \ No newline at end of file diff --git a/lib/language/ru_RU/true_validation_lang.php b/lib/language/ru_RU/true_validation_lang.php new file mode 100644 index 0000000..1cf8c86 --- /dev/null +++ b/lib/language/ru_RU/true_validation_lang.php @@ -0,0 +1,22 @@ +<?php + +$lang['required'] = "Поле %s необходимо заполнить."; +$lang['isset'] = "Поле %s должно иметь значение."; +$lang['valid_email'] = "Поле %s должно содержать правильный e-mail."; +$lang['valid_url'] = "Поле %s должно содержать правильный URL."; +$lang['min_length'] = "Поле %s должно содержать не менее %s знаков."; +$lang['max_length'] = "Поле %s должно содержать не более %s знаков."; +$lang['exact_length'] = "Поле %s должно содержать ровно %s знаков."; +$lang['alpha'] = "Поле %s может содержать только буквы."; +$lang['alpha_numeric'] = "Поле %s может содержать только буквы и цифры."; +$lang['alpha_dash'] = "Поле %s может содержать только буквы, цифры, заки подчеркивания и тире."; +$lang['numeric'] = "Поле %s должно содержать число."; +$lang['matches'] = "Поле %s должно совпадать с полем %s."; +$lang['login'] = "Поле %s должно начинаться обязательно с буквы (a-z). Разрешено использовать только символы английского алфавита (a-z), цифры (0-9) и символы подчеркивания '_'."; +$lang['passport_login'] = "Поле %s должно начинаться обязательно с буквы (a-z). Разрешено использовать только символы английского алфавита (a-z), цифры (0-9) и символы подчеркивания '_'. При использовании системы \"Паспорт\" после логина должен идти символ '@' и домен проекта на котором вы уже зарегистрированы"; +$lang['range'] = "Поле %s должно находиться в диапазоне %s."; +$lang['pwd'] = "Неверно введено значение поля %s."; +$lang['noeq'] = "Значение поля %s совпадает со старым."; +$lang['reqpwd'] = "Поле %s необходимо заполнить."; + +?> \ No newline at end of file commit 7f292725e75d27ce690d7c23eb0cd25bb0b17273 Author: TeXHaPb <st...@in...> Date: Thu Jul 8 23:45:11 2010 +0400 Правка документации по наследованию diff --git a/doc/asciidoc/templates.txt b/doc/asciidoc/templates.txt index 49eb74c..b0c20d0 100644 --- a/doc/asciidoc/templates.txt +++ b/doc/asciidoc/templates.txt @@ -129,13 +129,13 @@ class Helper Главный шаблон - parent.html [source, php] --------------------------------------------------------------------- -parent +parent text 1 <?php $this->bl('ttt') ?> -12345 +parent block ttt <?php $this->end() ?> -qazxsw +parent text 2 <?php $this->bl('zzz') ?> -12345 +parent block zzz <?php $this->end() ?> --------------------------------------------------------------------- Наследуемый шаблон child.html @@ -143,20 +143,29 @@ qazxsw --------------------------------------------------------------------- <?php $this->extend('parent.html') ?> <?php $this->bl('ttt') ?> -67890 +child block ttt <?php $this->end() ?> -111111111 +child text 1 <?php $this->end() ?> +child text 2 --------------------------------------------------------------------- -Результат: +Результат (при использовани parent.html): +--------------------------------------------------------------------- +parent text 1 +parent block ttt +parent text 2 +parent block zzz +--------------------------------------------------------------------- +Результат (при использовани child.html): --------------------------------------------------------------------- -parent -67890 -qazxsw -12345 +parent text 1 +child block ttt +parent text 2 +parent block zzz +child text 2 --------------------------------------------------------------------- ===================================================================== -В наследуемых шаблонах то, что находится в extend но не в bl игнорируется. +Т.о. в наследуемых шаблонах можно переопределять блоки, а то, что находится в extend но не в bl игнорируется. Кроме того можно добавлять текст и новые блоки до и после шаблона, -Наследование шаблона основано на применении функции к блоку. +Наследование по сути является вставкой в указанное место "родительского" шаблона с заменой указанных блоков. commit f45e026c6c313b732ecb6ed65e7a54fbe7973e58 Author: TeXHaPb <st...@in...> Date: Thu Jul 8 23:44:23 2010 +0400 Правка описания Error.php diff --git a/doc/asciidoc/directory.txt b/doc/asciidoc/directory.txt index 772f610..ca8ee59 100644 --- a/doc/asciidoc/directory.txt +++ b/doc/asciidoc/directory.txt @@ -52,7 +52,7 @@ Cache.php::: Интерфейс загрузки кешеров Error.php::: - Очень сырой обработчик ошибок :) + Обертка для DkLab ErrorHook Plugs.php::: Плагины к шаблонизаторам Router.php::: commit 40f11e9d585641fd79e00a8e84468d921dff2d20 Author: TeXHaPb <st...@in...> Date: Thu Jul 8 23:39:19 2010 +0400 Документация по кешу diff --git a/doc/asciidoc/cache.txt b/doc/asciidoc/cache.txt index dabbac6..e8d6a0b 100644 --- a/doc/asciidoc/cache.txt +++ b/doc/asciidoc/cache.txt @@ -29,14 +29,20 @@ Berkeley DB С файлом может параллельно работать много процессов - блокировки не требуется. +Есть два класса для работы с BDB: +Первый работает как простое хранилище ключ-значение +Второй учитывает время жизни. + Кешер имеет единственную опцию - файл, в котором хранится кеш - по умолчанию tmp/cache.db4 MemCache ^^^^^^^^ -не готово +Общий интерфейс для хранении в MemCache, есть два класса: +Memcache - использует стандартный класс Memecache +Memcached - использует библиотеку libmemcached XCache ^^^^^^ -не готово +Общий интерфейс для хранении в кеше XCache, аналогично можно написать для APC и eAccelerator, но пока не требовалось ----------------------------------------------------------------------- Summary of changes: doc/asciidoc/cache.txt | 10 +- doc/asciidoc/directory.txt | 2 +- doc/asciidoc/templates.txt | 35 ++- lib/Language.php | 122 +++++++ lib/True_validation.php | 471 +++++++++++++++++++++++++++ lib/language/ru_RU/true_validation_lang.php | 22 ++ 6 files changed, 646 insertions(+), 16 deletions(-) create mode 100755 lib/Language.php create mode 100755 lib/True_validation.php create mode 100644 lib/language/ru_RU/true_validation_lang.php hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-07-02 09:07:34
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via 22c10fa7e34341162144117de8caef8e0fbafcb0 (commit) from 491adedf0aefcbc70c4250f9db0dde6d07cc8772 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 22c10fa7e34341162144117de8caef8e0fbafcb0 Author: Ivan1986 <iva...@li...> Date: Fri Jul 2 13:07:03 2010 +0400 Обновлен xmpphp diff --git a/lib/jabber/XMPPHP/XMLStream.php b/lib/jabber/XMPPHP/XMLStream.php index d818881..5a25943 100644 --- a/lib/jabber/XMPPHP/XMLStream.php +++ b/lib/jabber/XMPPHP/XMLStream.php @@ -396,7 +396,7 @@ class XMPPHP_XMLStream { ); $stop = substr($buff, -strlen($start) - 3); - if ($start == '?xml') { + if ($start == '?xml' || substr($start,-6) == 'stream' ) { //starting with an xml tag. this means a stream is being // opened, which is not much of data, so no fear it's // not complete diff --git a/lib/jabber/XMPPHP/XMPP.php b/lib/jabber/XMPPHP/XMPP.php index eed8f69..3e94286 100644 --- a/lib/jabber/XMPPHP/XMPP.php +++ b/lib/jabber/XMPPHP/XMPP.php @@ -133,7 +133,7 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream { $this->resource = $resource; if(!$server) $server = $host; $this->server = $server; - $this->basejid = $this->user . '@' . $this->host; + $this->basejid = $this->user . '@' . $this->server; $this->roster = new Roster(); $this->track_presence = true; @@ -161,7 +161,7 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream { public function useEncryption($useEncryption = true) { $this->use_encryption = $useEncryption; } - + /** * Turn on auto-authorization of subscription requests. * @@ -471,6 +471,8 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream { * Roster iq handler * Gets all packets matching XPath "iq/{jabber:iq:roster}query' * + * Implements RFC3921, 7.4. "Adding a Roster Item" + * * @param string $xml */ protected function roster_iq_handler($xml) { @@ -498,7 +500,7 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream { } } if ($xml->attrs['type'] == 'set') { - $this->send("<iq type=\"reply\" id=\"{$xml->attrs['id']}\" to=\"{$xml->attrs['from']}\" />"); + $this->send("<iq type=\"result\" id=\"{$xml->attrs['id']}\" to=\"{$xml->attrs['from']}\" />"); } } ----------------------------------------------------------------------- Summary of changes: lib/jabber/XMPPHP/XMLStream.php | 2 +- lib/jabber/XMPPHP/XMPP.php | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-07-01 07:19:31
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via 491adedf0aefcbc70c4250f9db0dde6d07cc8772 (commit) from c2c198d04eb089c31550a6a4b711fb95d6c25851 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 491adedf0aefcbc70c4250f9db0dde6d07cc8772 Author: Ivan1986 <iva...@li...> Date: Thu Jul 1 11:18:42 2010 +0400 When you assign $this->DbSimple_Postgresql_USE_NATIVE_PHOLDERS = false manually for PostgreSQL, apostrophs were quoted incorrectly. diff --git a/lib/DbSimple/Postgresql.php b/lib/DbSimple/Postgresql.php index 5b2ed1f..785e8a5 100644 --- a/lib/DbSimple/Postgresql.php +++ b/lib/DbSimple/Postgresql.php @@ -58,7 +58,7 @@ class DbSimple_Postgresql extends DbSimple_Generic_Database function _performEscape($s, $isIdent=false) { if (!$isIdent) - return "'" . str_replace("'", "''", $s) . "'"; + return "E'" . pg_escape_string($this->link, $s) . "'"; else return '"' . str_replace('"', '_', $s) . '"'; } @@ -216,7 +216,7 @@ class DbSimple_Postgresql extends DbSimple_Generic_Database function _setDbError($query) { - return $this->_setLastError(null, pg_last_error($this->link), $query); + return $this->_setLastError(null, $this->link? pg_last_error($this->link) : (is_array($query)? "Connection is not established" : $query), $query); } function _getVersion() ----------------------------------------------------------------------- Summary of changes: lib/DbSimple/Postgresql.php | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-06-30 14:11:28
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via c2c198d04eb089c31550a6a4b711fb95d6c25851 (commit) from eb873926560f1f28840e97f3de9151cfc7d29824 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c2c198d04eb089c31550a6a4b711fb95d6c25851 Author: Ivan1986 <iva...@li...> Date: Wed Jun 30 18:10:37 2010 +0400 Cache::get не требует указание кешера в конфиге - понимает стандартные diff --git a/QFW/QuickFW/Cache.php b/QFW/QuickFW/Cache.php index 3b38942..3fe6f81 100644 --- a/QFW/QuickFW/Cache.php +++ b/QFW/QuickFW/Cache.php @@ -113,7 +113,7 @@ class Cache /** * Фабрика кешеров * - * @param string $name тип кешера + * @param string $name кешер - из массива или стандартный * @param string $namespace пространство имен * @return Zend_Cache_Backend_Interface кешер */ @@ -125,12 +125,15 @@ class Cache $c = self::$cachers['__'.$name]; else { - if (!isset(QFW::$config['cache'][$name])) - throw new Exception('Не найдены парамерты кеша '.$name); - $data = QFW::$config['cache'][$name]; - $backend=ucfirst($data['module']); + if (isset(QFW::$config['cache'][$name])) + { + $data = QFW::$config['cache'][$name]; + $backend = ucfirst($data['module']); + } + else + $backend = $name; $cl='Cacher_'.$backend; - require_once(QFWPATH.'/Cacher/'.$backend.'.php'); + require_once QFWPATH.'/Cacher/'.$backend.'.php'; $c=new $cl; $c->setDirectives( (isset($data['options']) && is_array($data['options'])) ----------------------------------------------------------------------- Summary of changes: QFW/QuickFW/Cache.php | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-06-30 13:51:21
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via eb873926560f1f28840e97f3de9151cfc7d29824 (commit) via 353796aa4d12f7bc3417377da875ab2832a51e07 (commit) via 0a7654972190807d46ccf236554f922b64c1e99c (commit) from 544d5db1fa7a0a5f7fddfc263748667985345b65 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit eb873926560f1f28840e97f3de9151cfc7d29824 Author: Ivan1986 <iva...@li...> Date: Wed Jun 30 17:50:03 2010 +0400 Правки тестов diff --git a/tests/DbSimple/DbSimpleTest.php b/tests/DbSimple/DbSimpleTest.php index c754d5f..9b37f8b 100644 --- a/tests/DbSimple/DbSimpleTest.php +++ b/tests/DbSimple/DbSimpleTest.php @@ -6,7 +6,7 @@ class DbSimpleTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->db = new QuickFW_AutoDbSimple(DSN); + $this->db = new DbSimple_Connect(DSN); $this->db->setErrorHandler(false, false); } diff --git a/tests/DbSimple/DbSimpleTests.php b/tests/DbSimple/DbSimpleTests.php index ba42124..bf8a9db 100644 --- a/tests/DbSimple/DbSimpleTests.php +++ b/tests/DbSimple/DbSimpleTests.php @@ -16,7 +16,7 @@ class DbSimpleTests $suite->addTestFile($base.'/DbSimpleTest.php'); $suite->addTestFile($base.'/MysqlTest.php'); $suite->addTestFile($base.'/MypdoTest.php'); - $suite->addTestFile($base.'/PgsqlTest.php'); + //$suite->addTestFile($base.'/PgsqlTest.php'); return $suite; } diff --git a/tests/DbSimple/MypdoTest.php b/tests/DbSimple/MypdoTest.php index cea66cc..4dfda1f 100644 --- a/tests/DbSimple/MypdoTest.php +++ b/tests/DbSimple/MypdoTest.php @@ -8,7 +8,7 @@ class MypdoTest extends GenericDbSimpleTestClass { protected function setUp() { - $this->db = new QuickFW_AutoDbSimple(DSNMYPDO); + $this->db = new DbSimple_Connect(DSNMYPDO); $this->db->setErrorHandler(false, false); } diff --git a/tests/DbSimple/MysqlTest.php b/tests/DbSimple/MysqlTest.php index ecec3fb..49d965b 100644 --- a/tests/DbSimple/MysqlTest.php +++ b/tests/DbSimple/MysqlTest.php @@ -8,7 +8,7 @@ class MysqlTest extends GenericDbSimpleTestClass { protected function setUp() { - $this->db = new QuickFW_AutoDbSimple(DSNMY); + $this->db = new DbSimple_Connect(DSNMY); $this->db->setErrorHandler(false, false); } diff --git a/tests/DbSimple/PgsqlTest.php b/tests/DbSimple/PgsqlTest.php index 2e6bf70..cbf31f9 100644 --- a/tests/DbSimple/PgsqlTest.php +++ b/tests/DbSimple/PgsqlTest.php @@ -7,7 +7,7 @@ class PgsqlTest extends PHPUnit_Framework_TestCase protected $pg; protected function setUp() { - $this->pg = new QuickFW_AutoDbSimple(DSNPG); + $this->pg = new DbSimple_Connect(DSNPG); $this->pg->setErrorHandler(false, false); } diff --git a/tests/QFW/QFWTest.php b/tests/QFW/QFWTest.php index 8b0c04b..5e8b459 100644 --- a/tests/QFW/QFWTest.php +++ b/tests/QFW/QFWTest.php @@ -5,9 +5,7 @@ class QFWTest extends PHPUnit_Framework_TestCase public function testInitTime() { global $InitTime; - //Вообще должно выдавать меньше 0.05 но из-за - //включенного дебага и отладки недотягивает - //$this->assertLessThanOrEqual(0.05,$InitTime); + $this->assertLessThanOrEqual(0.01, $InitTime); unset($GLOBALS['InitTime']); } @@ -27,7 +25,7 @@ class QFWTest extends PHPUnit_Framework_TestCase array('ddd/bbb/fff', 'ddd/bbb/fff'), array('ddd/eee/ccc', 'ddd/eee'), array('ddd/eee/fff', 'ddd/eee/fff'), - array('aaa/bbb', 'bbb'), + array('aaa/bbb', ''), array('aaa/eee', 'eee'), array('ddd/bbb', 'ddd/bbb'), array('ddd/eee', 'ddd/eee'), @@ -41,7 +39,7 @@ class QFWTest extends PHPUnit_Framework_TestCase array('eee/fff', 'eee/fff'), array('aaa', ''), array('ddd', 'ddd'), - array('bbb', 'bbb'), + array('bbb', ''), array('eee', 'eee'), array('ccc', ''), array('fff', 'fff'), @@ -53,7 +51,7 @@ class QFWTest extends PHPUnit_Framework_TestCase * * Тестирование delDef */ - public function testDdef($in,$out) + public function testDdef($in, $out) { QFW::Init(); QFW::$config['default']['module'] = 'aaa'; diff --git a/tests/QFWTests.php b/tests/QFWTests.php index 79027ea..2a355af 100644 --- a/tests/QFWTests.php +++ b/tests/QFWTests.php @@ -10,7 +10,7 @@ $_SERVER['HTTP_HOST'] = 'test'; $InitTime = microtime(true); - require (QFWPATH.'/Init.php'); + require_once (QFWPATH.'/Init.php'); $InitTime = microtime(true) - $InitTime; chdir(dirname(__FILE__)); @@ -23,7 +23,7 @@ $suite->addTestFile('DbSimple/DbSimpleTests.php'); $suite->addTestFile('Cache/CacheTest.php'); - $suite->addTestFile('Smarty/SmartyTest.php'); + //$suite->addTestFile('Smarty/SmartyTest.php'); $suite->addTestFile('QFW/FrameworkTests.php'); return $suite; diff --git a/tests/testapp/default.php b/tests/testapp/default.php index 15c5adc..071719b 100644 --- a/tests/testapp/default.php +++ b/tests/testapp/default.php @@ -1,3 +1,6 @@ <?php +$config['host']['encoding'] = ''; + + ?> \ No newline at end of file commit 353796aa4d12f7bc3417377da875ab2832a51e07 Author: Ivan1986 <iva...@li...> Date: Wed Jun 30 17:49:37 2010 +0400 requeire заменил на requere_once diff --git a/QFW/Init.php b/QFW/Init.php index 3078def..c1b108c 100644 --- a/QFW/Init.php +++ b/QFW/Init.php @@ -56,32 +56,32 @@ class QFW { self::$config = self::config(); - require QFWPATH.'/QuickFW/Cache.php'; - require QFWPATH.'/QuickFW/Plugs.php'; + require_once QFWPATH.'/QuickFW/Cache.php'; + require_once QFWPATH.'/QuickFW/Plugs.php'; //выставляем заголовок с нужной кодировкой if (!empty(self::$config['host']['encoding'])) header("Content-Type: text/html; charset=".self::$config['host']['encoding']); //Инициализируем класс базы данных - require LIBPATH.'/DbSimple/Connect.php'; + require_once LIBPATH.'/DbSimple/Connect.php'; self::$db = new DbSimple_Connect(self::$config['database']); //Подключаем шаблонизатор $templ = ucfirst(self::$config['templater']['name']); $class = 'Templater_'.$templ; - require QFWPATH.'/Templater/'.$templ.'.php'; + require_once QFWPATH.'/Templater/'.$templ.'.php'; self::$view = new $class(APPPATH, isset(self::$config['templater']['def_tpl']) ? self::$config['templater']['def_tpl'] : ''); //подключаем модули и библиотеки self::modules(); - require QFWPATH.'/QuickFW/Router.php'; + require_once QFWPATH.'/QuickFW/Router.php'; self::$router = new QuickFW_Router(APPPATH); //хелпер для урлов (зависит от QuickFW_Router) - require QFWPATH.'/QuickFW/Url.php'; + require_once QFWPATH.'/QuickFW/Url.php'; Url::Init(); } @@ -102,7 +102,7 @@ class QFW //автолоад if (!empty(self::$config['QFW']['autoload'])) { - require QFWPATH.'/QuickFW/Autoload.php'; + require_once QFWPATH.'/QuickFW/Autoload.php'; Autoload::Init(self::$config['QFW']['autoload']); } commit 0a7654972190807d46ccf236554f922b64c1e99c Author: Ivan1986 <iva...@li...> Date: Wed Jun 30 17:48:39 2010 +0400 Варнинг - call_user_func_array - второй параметр был строкой diff --git a/lib/DbSimple/Generic.php b/lib/DbSimple/Generic.php index 8a4e388..5345d55 100644 --- a/lib/DbSimple/Generic.php +++ b/lib/DbSimple/Generic.php @@ -448,7 +448,7 @@ abstract class DbSimple_Generic_Database extends DbSimple_Generic_LastError $dummy = null; // There is no need in query, cos' needle in $this->attributes['CACHE'] $this->_transformQuery($dummy, 'UNIQ_KEY'); - $uniq_key = call_user_func_array(array(&$this, 'select'), $dummy); + $uniq_key = call_user_func_array(array(&$this, 'select'), array($dummy)); $uniq_key = md5(serialize($uniq_key)); } // Check TTL? ----------------------------------------------------------------------- Summary of changes: QFW/Init.php | 14 +++++++------- lib/DbSimple/Generic.php | 2 +- tests/DbSimple/DbSimpleTest.php | 2 +- tests/DbSimple/DbSimpleTests.php | 2 +- tests/DbSimple/MypdoTest.php | 2 +- tests/DbSimple/MysqlTest.php | 2 +- tests/DbSimple/PgsqlTest.php | 2 +- tests/QFW/QFWTest.php | 10 ++++------ tests/QFWTests.php | 4 ++-- tests/testapp/default.php | 3 +++ 10 files changed, 22 insertions(+), 21 deletions(-) hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-06-25 06:44:06
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via 544d5db1fa7a0a5f7fddfc263748667985345b65 (commit) from 279ece5220bf321c2ce9cd9ef59972fea183ef06 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 544d5db1fa7a0a5f7fddfc263748667985345b65 Author: Ivan1986 <iva...@li...> Date: Fri Jun 25 10:24:33 2010 +0400 Удалена нафиг не нужная TrueValidation diff --git a/lib/Language.php b/lib/Language.php deleted file mode 100755 index e2aaf43..0000000 --- a/lib/Language.php +++ /dev/null @@ -1,122 +0,0 @@ -<?php -/** - * CodeIgniter - * - * An open source application development framework for PHP 4.3.2 or newer - * - * @package CodeIgniter - * @author Rick Ellis - * @copyright Copyright (c) 2006, EllisLab, Inc. - * @license http://www.codeignitor.com/user_guide/license.html - * @link http://www.codeigniter.com - * @since Version 1.0 - * @filesource - */ - -// ------------------------------------------------------------------------ - -/** - * Language Class - * - * @package CodeIgniter - * @subpackage Libraries - * @category Language - * @author Rick Ellis - * @link http://www.codeigniter.com/user_guide/libraries/language.html - */ -class Language { - - var $language = array(); - var $is_loaded = array(); - - /** - * Constructor - * - * @access public - */ - function __construct() - { - - } - - // -------------------------------------------------------------------- - - /** - * Load a language file - * - * @access public - * @param mixed the name of the language file to be loaded. Can be an array - * @param string the language (english, etc.) - * @return void - */ - function load($langfile = '', $idiom = '', $return = FALSE) - { - global $config; - $langfile = $langfile.'_lang.php'; - - if (in_array($langfile, $this->is_loaded, TRUE)) - { - return; - } - - if ($idiom == '') - { - $deft_lang = $config['host']['lang']; - $idiom = is_null($deft_lang) ? 'en_EN' : $deft_lang; - } - - // Determine where the language file is and load it - if (file_exists(APPPATH.'/language/'.$idiom.'/'.$langfile)) - { - include(APPPATH.'/language/'.$idiom.'/'.$langfile); - } - else - { - if (file_exists(LIBPATH.'/language/'.$idiom.'/'.$langfile)) - { - include(LIBPATH.'/language/'.$idiom.'/'.$langfile); - } - else - { -//!!! show_error('Unable to load the requested language file: language/'.$langfile); - } - } - - - if ( ! isset($lang)) - { -//!!! log_message('error', 'Language file contains no data: language/'.$idiom.'/'.$langfile); - return; - } - - if ($return == TRUE) - { - return $lang; - } - - $this->is_loaded[] = $langfile; - $this->language = array_merge($this->language, $lang); - unset($lang); - -//!!! log_message('debug', 'Language file loaded: language/'.$idiom.'/'.$langfile); - return TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Fetch a single line of text from the language array - * - * @access public - * @param string the language line - * @return string - */ - function line($line = '') - { - return ($line == '' OR ! isset($this->language[$line])) ? FALSE : $this->language[$line]; - } - -} -// END Language Class -QFW::$libs['lang'] = new Language(); -?> \ No newline at end of file diff --git a/lib/True_validation.php b/lib/True_validation.php deleted file mode 100755 index 4989b5d..0000000 --- a/lib/True_validation.php +++ /dev/null @@ -1,471 +0,0 @@ -<?php - -class True_Validation { - - var $_rules = array(); //Правила для проверки - var $_data = array(); //Данные для проверки. - var $_fields = array(); //Заголовки полей - var $_errors = array(); //Массив ошибок - var $_error_messages = array();//Собственные сообщения об ошибках - - function True_Validation() { - $this->init(); - require_once(LIBPATH.'/Language.php'); - } - - function init() { - $this->_rules = array(); - $this->_data = array(); - $this->_fields = array(); - } - - function set_data($data = '') { - if ($data == '') { - return FALSE; - } else { - $this->_data = $data; - } - } - - function set_rules($rules = '') { - if ($rules == '') { - return; - } - - foreach ($rules as $key => $val) { - $this->_rules[$key] = $val; - } - } - - function set_fields($data = '', $field = '') { - if ($data == '') { - if (count($this->_fields) == 0) { - return FALSE; - } - } else { - if ( ! is_array($data)) { - $data = array($data => $field); - } - - if (count($data) > 0) { - $this->_fields = $data; - } - } - } - - function set_message($lang, $val = '') { - if ( ! is_array($lang)) - { - $lang = array($lang => $val); - } - - $this->_error_messages = array_merge($this->_error_messages, $lang); - } - - function add_error($field, $error) { - $this->_errors[$field][] = $error; - } - - // -------------------------------------------------------------------- - - /** - * Run the Validator - * - * This function does all the work. - * - * @access public - * @return bool - */ - function run($clean_errors = TRUE) { - if ($clean_errors) { - $this->_errors = array(); - } - - // Do we even have any data to process? Mm? - if (count($this->_data) == 0 OR count($this->_rules) == 0) { - return FALSE; - } - - // Load the language file containing error messages - QFW::$libs['lang']->load('true_validation'); - - // Cycle through the rules and test for errors - foreach ($this->_rules as $field => $rules) { - //Explode out the rules! - $ex = explode('|', $rules); - - /* - * Are we dealing with an "isset" rule? - * - * Before going further, we'll see if one of the rules - * is to check whether the item is set (typically this - * applies only to checkboxes). If so, we'll - * test for it here since there's not reason to go - * further - */ - if ( ! isset($this->_data[$field])) { - if (in_array('isset', $ex, TRUE) OR in_array('required', $ex)) { - if ( ! isset($this->_error_messages['isset'])) { - if (FALSE === ($line = QFW::$libs['lang']->line('isset'))) { - $line = 'The field was not set'; - } - } else { - $line = $this->_error_messages['isset']; - } - - $mfield = ( ! isset($this->_fields[$field])) ? $field : $this->_fields[$field]; - $this->add_error($field, sprintf($line, $mfield)); - } - - continue; - } - - /* - * Set the current field - * - * The various prepping functions need to know the - * current field name so they can do this: - * - * $this->data[$this->_current_field] == 'bla bla'; - * - $this->_current_field = $field;*/ - - // Cycle through the rules! - foreach ($ex As $rule) { - // Strip the parameter (if exists) from the rule - // Rules can contain a parameter: max_length[5] - $param = FALSE; - if (preg_match("/(.*?)\[(.*?)\]/", $rule, $match)) { - $rule = $match[1]; - $param = $match[2]; - } - - // Call the function that corresponds to the rule - if ( ! method_exists($this, $rule)) { - /* - * Run the native PHP function if called for - * - * If our own wrapper function doesn't exist we see - * if a native PHP function does. Users can use - * any native PHP function call that has one param. - */ - if (function_exists($rule)) { - $this->_data[$field] = $rule($this->_data[$field]); -// $this->$field = $this->data[$field]; - } - - continue; - } - - $result = $this->$rule($this->_data[$field], $param); - - // Did the rule test negatively? If so, grab the error. - if ($result === FALSE) { - if ( ! isset($this->_error_messages[$rule])) { - if (FALSE === ($line = QFW::$libs['lang']->line($rule))) { - $line = 'Unable to access an error message corresponding to your field name.'; - } - } else { - $line = $this->_error_messages[$rule]; - } - - // Build the error message - $mfield = ( ! isset($this->_fields[$field])) ? $field : $this->_fields[$field]; - $mparam = ( ! isset($this->_fields[$param])) ? $param : $this->_fields[$param]; - // Add the error to the error array - $this->add_error($field, sprintf($line, $mfield, $mparam)); - - continue 2; - } - } - - } - - $total_errors = count($this->_errors); - - /* - * Recompile the class variables - * - * If any prepping functions were called the $this->data data - * might now be different then the corresponding class - * variables so we'll set them anew. - */ - if ($total_errors > 0) { - $this->_safe_form_data = TRUE; - } - -//!!! $this->set_fields(); - - // Did we end up with any errors? - if ($total_errors == 0) { - return TRUE; - } - return FALSE; - } - - // -------------------------------------------------------------------- - - /** - * Required - * - * @access public - * @param string - * @return bool - */ - function required($str) - { - if ( ! is_array($str)) - { - return (trim($str) == '') ? FALSE : TRUE; - } - else - { - return ( ! empty($str)); - } - } - - function reqpwd($str, $val) - { - if ( ! is_array($str)) - { - return ($str == '') ? FALSE : TRUE; - } - else - { - return ( ! empty($str)); - } - } - - // -------------------------------------------------------------------- - - /** - * Match one field to another - * - * @access public - * @param string - * @return bool - */ - function matches($str, $field) - { - if ( ! isset($this->_data[$field])) - { - return FALSE; - } - - return ($str !== $this->_data[$field]) ? FALSE : TRUE; - } - - function noeq($str, $val) - { - return ($str=== $val) ? FALSE : TRUE; - } - - function pwd($str, $val) - { - return ($str!== $val) ? FALSE : TRUE; - } - // -------------------------------------------------------------------- - - /** - * Minimum Length - * - * @access public - * @param string - * @return bool - */ - function min_length($str, $val) - { - if (preg_match("/[^0-9]/", $val)) - { - return FALSE; - } - - return (mb_strlen($str,QFW::$config['host']['encoding']) < $val) ? FALSE : TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Max Length - * - * @access public - * @param string - * @return bool - */ - function max_length($str, $val) - { - if (preg_match("/[^0-9]/", $val)) - { - return FALSE; - } - - return (mb_strlen($str,QFW::$config['host']['encoding']) > $val) ? FALSE : TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Exact Length - * - * @access public - * @param string - * @return bool - */ - function exact_length($str, $val) - { - if (preg_match("/[^0-9]/", $val)) - { - return FALSE; - } - - return (mb_strlen($str,QFW::$config['host']['encoding']) != $val) ? FALSE : TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Valid Email - * - * @access public - * @param string - * @return bool - */ - function valid_email($str) - { - if (strlen($str)>255) - return FALSE; - if (strpos($str,'@')>64) - return FALSE; - return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Validate IP Address - * - * @access public - * @param string - * @return string - */ - function valid_ip($ip) - { - return true;//!!!!!$this->CI->valid_ip($ip); - } - - // -------------------------------------------------------------------- - - /** - * Alpha - * - * @access public - * @param string - * @return bool - */ - function alpha($str) - { - return ( ! preg_match("/^([a-z])+$/i", $str)) ? FALSE : TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Alpha-numeric - * - * @access public - * @param string - * @return bool - */ - function alpha_numeric($str) - { - return ( ! preg_match("/^([a-z0-9])+$/i", $str)) ? FALSE : TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Alpha-numeric with underscores and dashes - * - * @access public - * @param string - * @return bool - */ - function alpha_dash($str) - { - return ( ! preg_match("/^([-a-z0-9_-])+$/i", $str)) ? FALSE : TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Numeric - * - * @access public - * @param int - * @return bool - */ - function numeric($str) - { - //return ( ! ereg("^[0-9\.]+$", $str)) ? FALSE : TRUE; - return ( ! preg_match("/^[0-9\.]+$/", $str)) ? FALSE : TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Is Numeric - * - * @access public - * @param string - * @return bool - */ - function is_numeric($str) - { - return ( ! is_numeric($str)) ? FALSE : TRUE; - } - - // -------------------------------------------------------------------- - - /** - * Login - * - * @access public - * @param string - * @return bool - */ - function login($str) - { - return ( ! preg_match("/^[a-z][0-9a-z_]*$/", $str)) ? FALSE : TRUE; - } - - - // -------------------------------------------------------------------- - - /** - * Passport login (can include @ and domain after it) - * - * @access public - * @param string - * @return bool - */ - function passport_login($str) - { - return ( ! preg_match("/^[0-9a-z_\-][0-9a-z_\-\.]+(@([0-9a-z][0-9a-z\-]*[0-9a-z]\.)+[0-9a-z]{2,6})?$/i", $str)) ? FALSE : TRUE; - } - - function valid_url($str) { - return ( !preg_match('/\b((ht|f)tp):(\/\/)([a-z0-9.:@*()~#\]\[_?=&\/\\-])+/', $str)) ? FALSE : TRUE; - } - - function range($str, $val) { - $val = explode('-', $val); - if ((count($val)!==2) || preg_match("/[^0-9]/", $val[0]) || preg_match("/[^0-9]/", $val[1])) { - return FALSE; - } - return (($tmp = intval($str) < $val[0]) || ($tmp > $val[1])) ? FALSE : TRUE; - } - -} -// END Validation Class -QFW::$libs['true_validation'] = new True_Validation(); -?> \ No newline at end of file diff --git a/lib/language/ru_RU/true_validation_lang.php b/lib/language/ru_RU/true_validation_lang.php deleted file mode 100644 index 1cf8c86..0000000 --- a/lib/language/ru_RU/true_validation_lang.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -$lang['required'] = "Поле %s необходимо заполнить."; -$lang['isset'] = "Поле %s должно иметь значение."; -$lang['valid_email'] = "Поле %s должно содержать правильный e-mail."; -$lang['valid_url'] = "Поле %s должно содержать правильный URL."; -$lang['min_length'] = "Поле %s должно содержать не менее %s знаков."; -$lang['max_length'] = "Поле %s должно содержать не более %s знаков."; -$lang['exact_length'] = "Поле %s должно содержать ровно %s знаков."; -$lang['alpha'] = "Поле %s может содержать только буквы."; -$lang['alpha_numeric'] = "Поле %s может содержать только буквы и цифры."; -$lang['alpha_dash'] = "Поле %s может содержать только буквы, цифры, заки подчеркивания и тире."; -$lang['numeric'] = "Поле %s должно содержать число."; -$lang['matches'] = "Поле %s должно совпадать с полем %s."; -$lang['login'] = "Поле %s должно начинаться обязательно с буквы (a-z). Разрешено использовать только символы английского алфавита (a-z), цифры (0-9) и символы подчеркивания '_'."; -$lang['passport_login'] = "Поле %s должно начинаться обязательно с буквы (a-z). Разрешено использовать только символы английского алфавита (a-z), цифры (0-9) и символы подчеркивания '_'. При использовании системы \"Паспорт\" после логина должен идти символ '@' и домен проекта на котором вы уже зарегистрированы"; -$lang['range'] = "Поле %s должно находиться в диапазоне %s."; -$lang['pwd'] = "Неверно введено значение поля %s."; -$lang['noeq'] = "Значение поля %s совпадает со старым."; -$lang['reqpwd'] = "Поле %s необходимо заполнить."; - -?> \ No newline at end of file ----------------------------------------------------------------------- Summary of changes: lib/Language.php | 122 ------- lib/True_validation.php | 471 --------------------------- lib/language/ru_RU/true_validation_lang.php | 22 -- 3 files changed, 0 insertions(+), 615 deletions(-) delete mode 100755 lib/Language.php delete mode 100755 lib/True_validation.php delete mode 100644 lib/language/ru_RU/true_validation_lang.php hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-06-25 05:11:22
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via 279ece5220bf321c2ce9cd9ef59972fea183ef06 (commit) from 2aa80315a9a5f42b977e8ea3e5e1f6df8e675b65 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 279ece5220bf321c2ce9cd9ef59972fea183ef06 Author: Ivan1986 <iva...@li...> Date: Fri Jun 25 09:10:57 2010 +0400 notice diff --git a/application/default/controllers/OidController.php b/application/default/controllers/OidController.php index e129325..eb25eea 100644 --- a/application/default/controllers/OidController.php +++ b/application/default/controllers/OidController.php @@ -12,7 +12,8 @@ class OidController extends QuickFW_Auth public function indexAction($return = false) { - var_dump($_SESSION); + if (!empty($_SESSION)) + var_dump($_SESSION); $return = $return ? $return : $_SERVER['REQUEST_URI']; if (!empty($_SESSION['openID']['error'])) { ----------------------------------------------------------------------- Summary of changes: application/default/controllers/OidController.php | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-06-25 01:05:00
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via 2aa80315a9a5f42b977e8ea3e5e1f6df8e675b65 (commit) from 6d9af60c09a44976417c83e7d9795f60746e7aa2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2aa80315a9a5f42b977e8ea3e5e1f6df8e675b65 Author: Ivan Borzenkov <iva...@li...> Date: Fri Jun 25 05:04:29 2010 +0400 Дока - авторизация через OpenID diff --git a/QFW/QuickFW/Auth.php b/QFW/QuickFW/Auth.php index 05fea50..0790576 100644 --- a/QFW/QuickFW/Auth.php +++ b/QFW/QuickFW/Auth.php @@ -31,7 +31,7 @@ class QuickFW_Auth * @param boolean|string $redir адрес редиректа при неудачном логине * @return boolean авторизован пользователь или нет */ - public function __construct($name='user',$redir=false) + public function __construct($name='user', $redir=false) { //В PHP 5.3 $_REQUEST = $_GET + $_POST по умолчанию //Так как cookie включены почти всегда, то такой порядок оптимален diff --git a/doc/asciidoc/auth.txt b/doc/asciidoc/auth.txt index f18cf59..f3a78e6 100644 --- a/doc/asciidoc/auth.txt +++ b/doc/asciidoc/auth.txt @@ -6,18 +6,18 @@ В отличие от традиционных решений в данном фреймворке сессии являются частным случаем авторизации, так как в большинстве случаев сессии используются для авторизации пользователей, то такой подход оказался оправданным. -В зависимости от значение параметра +$config[\'QFW'][\'cacheSessions']+ сессионные данные сохраняются в стандартном хранилище сессий или в кеше, указанном по умолчанию, ключами являются строки sess_<id сессии>, пустые сессии автоматически удаляются из хранилища и с помощью механизма очистки сессий также производится чистка кеша. +В зависимости от значение параметра +$config[\'QFW'][\'cacheSessions']+ сессионные данные сохраняются в стандартном хранилище сессий или в кеше, указанном по умолчанию, ключами являются строки +sess_<id сессии>+, пустые сессии автоматически удаляются из хранилища и с помощью механизма очистки сессий также производится чистка кеша. -Для того чтобы стартовать сессию не привязывая ее к конкретному пользователю нужно прямо или косвенно наследовать контроллер от класса QuickFW_Auth и для старта сессии вызвать $this->session() После вызова $this->session() с сессями можно работать через стандартный механизм - массив $_SESSION. Для уничтожения сессии нужно вызвать $this->sessionDestroy(), а для создания сесии с новым sessionID $this->sessionRestart(). +Для того чтобы стартовать сессию не привязывая ее к конкретному пользователю нужно прямо или косвенно наследовать контроллер от класса +QuickFW_Auth+ и для старта сессии вызвать +$this->session()+ После ее вызова с сессями можно работать через стандартный механизм - массив +$_SESSION+. Для уничтожения сессии нужно вызвать +$this->sessionDestroy()+, а для создания сесии с новым sessionID +$this->sessionRestart()+. -При наличие у пользователя сессионной куки сессия автоматически поднимается при вызове конструктора класса QuickFW_Auth. +При наличие у пользователя сессионной куки сессия автоматически поднимается при вызове конструктора класса +QuickFW_Auth+. Логин пользователя ~~~~~~~~~~~~~~~~~~ -Если сессия не поднята или в массиве $_SESSION нету ключа с именем, совпадающем с первым параметром конструктора, то вызывается функция checkUser(), которая может быть перегружена в наследуемом классе - если функция возвращает false, то авторизация не проходит, иначе возвращаемое значение заносится в $_SESSION[\'<name>']. +Если сессия не поднята или в массиве +$_SESSION+ нету ключа с именем, совпадающем с первым параметром конструктора, то вызывается функция +checkUser()+, которая может быть перегружена в наследуемом классе - если функция возвращает +false+, то авторизация не проходит, иначе возвращаемое значение заносится в +$_SESSION[\'<name>']+. -Конструктор класса QuickFW_Auth принимает до двух параметров и возвращает флаг: +Конструктор класса +QuickFW_Auth+ принимает до двух параметров и возвращает флаг: [source,php] --------------------------------------------- @@ -28,7 +28,12 @@ * @param boolean|string $redir адрес редиректа при неудачном логине * @return boolean авторизован пользователь или нет */ -public function __construct($name='user',$redir=false) +public function __construct($name='user', $redir=false) --------------------------------------------- -Стандартная функция checkUser() подходит для авторизации в админке - проверяет совпадение логина и пароля со значениями в конфиге ($config[\'admin'][\'login'] и $config[\'admin'][\'passw']). Если функция checkUser() вернет массив в ключем \'redirect' то после логина произойдет переход на указанный адрес или на себя в случае true. +Стандартная функция +checkUser()+ подходит для авторизации в админке - проверяет совпадение логина и пароля со значениями в конфиге (+$config[\'admin'][\'login']+ и +$config[\'admin'][\'passw']+). Если функция +checkUser()+ вернет массив в ключем +redirect+ то после логина произойдет переход на указанный адрес или на себя в случае +true+. + +Авторизация через OpenID +^^^^^^^^^^^^^^^^^^^^^^^^ + +В разработке контроллер для авторизации через OpenID - OidController - после работы в сесии данные и редиректит на указанный адрес или сам на себя - функция, генерирующая форму может быть блоком - либо присутствует $_SESSION[\'openID'][\'error'], либо $_SESSION[\'openID'][\'id'] и $_SESSION[\'openID'][\'sreg']. ----------------------------------------------------------------------- Summary of changes: QFW/QuickFW/Auth.php | 2 +- doc/asciidoc/auth.txt | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-06-25 00:56:20
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via 6d9af60c09a44976417c83e7d9795f60746e7aa2 (commit) via 72d844e4e4b8443dd125e19e78457c46bf7be478 (commit) from c3728ed49cd2993b7963d40fc39ccb2a4813bcaa (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6d9af60c09a44976417c83e7d9795f60746e7aa2 Author: Ivan Borzenkov <iva...@li...> Date: Fri Jun 25 04:54:57 2010 +0400 Описание авторизации diff --git a/doc/asciidoc/auth.txt b/doc/asciidoc/auth.txt index 5fbe094..f18cf59 100644 --- a/doc/asciidoc/auth.txt +++ b/doc/asciidoc/auth.txt @@ -6,8 +6,29 @@ В отличие от традиционных решений в данном фреймворке сессии являются частным случаем авторизации, так как в большинстве случаев сессии используются для авторизации пользователей, то такой подход оказался оправданным. -Для того чтобы стартовать сессию не привязывая ее к конкретному пользователю нужно прямо или косвенно наследовать контроллер от класса QuickFW_Auth и для старта сессии вызвать $this->session(); После вызова $this->session(); с сессями можно работать через стандартный механизм - массив $_SESSION. +В зависимости от значение параметра +$config[\'QFW'][\'cacheSessions']+ сессионные данные сохраняются в стандартном хранилище сессий или в кеше, указанном по умолчанию, ключами являются строки sess_<id сессии>, пустые сессии автоматически удаляются из хранилища и с помощью механизма очистки сессий также производится чистка кеша. + +Для того чтобы стартовать сессию не привязывая ее к конкретному пользователю нужно прямо или косвенно наследовать контроллер от класса QuickFW_Auth и для старта сессии вызвать $this->session() После вызова $this->session() с сессями можно работать через стандартный механизм - массив $_SESSION. Для уничтожения сессии нужно вызвать $this->sessionDestroy(), а для создания сесии с новым sessionID $this->sessionRestart(). При наличие у пользователя сессионной куки сессия автоматически поднимается при вызове конструктора класса QuickFW_Auth. -Сессионные данные сохраняются в кеше, указанном по умолчанию, ключами являются строки sess_<id сессии>, пустые сессии автоматически удаляются из хранилища и с помощью механизма очистки сессий также производится чистка кеша. +Логин пользователя +~~~~~~~~~~~~~~~~~~ + +Если сессия не поднята или в массиве $_SESSION нету ключа с именем, совпадающем с первым параметром конструктора, то вызывается функция checkUser(), которая может быть перегружена в наследуемом классе - если функция возвращает false, то авторизация не проходит, иначе возвращаемое значение заносится в $_SESSION[\'<name>']. + +Конструктор класса QuickFW_Auth принимает до двух параметров и возвращает флаг: + +[source,php] +--------------------------------------------- +/** + * Инициализация пользователя - авторизация или восстановление сесии + * + * @param string $name ключ в $_SESSION для хранения данных авторизации + * @param boolean|string $redir адрес редиректа при неудачном логине + * @return boolean авторизован пользователь или нет + */ +public function __construct($name='user',$redir=false) +--------------------------------------------- + +Стандартная функция checkUser() подходит для авторизации в админке - проверяет совпадение логина и пароля со значениями в конфиге ($config[\'admin'][\'login'] и $config[\'admin'][\'passw']). Если функция checkUser() вернет массив в ключем \'redirect' то после логина произойдет переход на указанный адрес или на себя в случае true. commit 72d844e4e4b8443dd125e19e78457c46bf7be478 Author: Ivan Borzenkov <iva...@li...> Date: Fri Jun 25 04:54:24 2010 +0400 Функция авторизации по умолчанию - редирект после POST diff --git a/QFW/QuickFW/Auth.php b/QFW/QuickFW/Auth.php index 26feb23..05fea50 100644 --- a/QFW/QuickFW/Auth.php +++ b/QFW/QuickFW/Auth.php @@ -146,7 +146,10 @@ class QuickFW_Auth if( (strcasecmp(QFW::$config['admin']['login'], trim($username)) == 0) && (strcasecmp(QFW::$config['admin']['passw'], trim($password)) == 0) ) - return $username; + return array( + 'user' => $username, + 'redirect' => true, + ); else return false; } ----------------------------------------------------------------------- Summary of changes: QFW/QuickFW/Auth.php | 5 ++++- doc/asciidoc/auth.txt | 25 +++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-06-24 20:22:44
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via c3728ed49cd2993b7963d40fc39ccb2a4813bcaa (commit) from 2259653f161fd3e385c2578baed5b1684c4101c3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c3728ed49cd2993b7963d40fc39ccb2a4813bcaa Author: Ivan Borzenkov <iva...@li...> Date: Fri Jun 25 00:21:50 2010 +0400 Генерация опций файлового кеша из файла diff --git a/QFW/Cacher/File.php b/QFW/Cacher/File.php index 9bc8847..1a07e4e 100644 --- a/QFW/Cacher/File.php +++ b/QFW/Cacher/File.php @@ -7,36 +7,22 @@ class Cacher_File implements Zend_Cache_Backend_Interface { protected $options = array( - 'cacheDir' => '', - 'caching' => true, - 'prefix' => 'cache_', - 'lifeTime' => 3600, - 'fileLocking' => true, - 'writeControl' => false, - 'readControl' => false, - 'fileNameProtection' => false, - 'automaticCleaningFactor' => 0, - 'hashedDirectoryLevel' => 0, - 'hashedDirectoryUmask' => 0777, + 'cacheDir' => '', //directory where to put the cache files (string), + 'caching' => true, //enable / disable caching (boolean), + 'prefix' => 'cache_', //file name prefix (string), + 'lifeTime' => 3600, //cache lifetime in seconds (int), + 'fileLocking' => true, //enable / disable fileLocking (boolean), + 'writeControl' => false, //enable / disable write control (boolean), + 'readControl' => false, //enable / disable read control (boolean), + 'fileNameProtection' => false, //enable / disable automatic file name protection (boolean), + 'automaticCleaningFactor' => 0, //distable / tune automatic cleaning process (int), + 'hashedDirectoryLevel' => 0, //level of the hashed directory system (int), + 'hashedDirectoryUmask' => 0777, //umask for hashed directory structure (int), ); /** * Constructor * - * $options is an assoc. Available options are : - * $options = array( - * 'cacheDir' => directory where to put the cache files (string), - * 'caching' => enable / disable caching (boolean), - * 'lifeTime' => cache lifetime in seconds (int), - * 'fileLocking' => enable / disable fileLocking (boolean), - * 'writeControl' => enable / disable write control (boolean), - * 'readControl' => enable / disable read control (boolean), - * 'fileNameProtection' => enable / disable automatic file name protection (boolean), - * 'automaticCleaningFactor' => distable / tune automatic cleaning process (int), - * 'hashedDirectoryLevel' => level of the hashed directory system (int), - * 'hashedDirectoryUmask' => umask for hashed directory structure (int), - * ); - * * @param array $options options * @access public */ diff --git a/doc/asciidoc/cache.txt b/doc/asciidoc/cache.txt index 8697309..dabbac6 100644 --- a/doc/asciidoc/cache.txt +++ b/doc/asciidoc/cache.txt @@ -15,20 +15,7 @@ [source, php] ------------------------------------------- -$options = array( - 'cacheDir' => '', - 'caching' => true, - 'prefix' => 'cache_', - 'lifeTime' => 3600, - 'fileLocking' => true, - 'writeControl' => false, - 'readControl' => false, - 'fileNameProtection' => true, - 'automaticSerialization' => true, - 'automaticCleaningFactor' => 0, - 'hashedDirectoryLevel' => 0, - 'hashedDirectoryUmask' => 0777, -); +sys::[cat ../../QFW/Cacher/File.php | sed '/protected $options =/,/);/!d; s/^\t//; s/^protected //'] ------------------------------------------- По умолчанию кеш хранится в папке tmp/cache, однако можно переопределить это значение. Указание другого префикса позволит хранить в одной папке несколько кешеров с различными параметрами. ----------------------------------------------------------------------- Summary of changes: QFW/Cacher/File.php | 36 +++++++++++------------------------- doc/asciidoc/cache.txt | 15 +-------------- 2 files changed, 12 insertions(+), 39 deletions(-) hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-06-24 19:55:21
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via 2259653f161fd3e385c2578baed5b1684c4101c3 (commit) via f3e6cd6fe03e1503f4076312223d8a920e2959ad (commit) from 550981f55209896288e5e7a306fe622372cf2bc7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2259653f161fd3e385c2578baed5b1684c4101c3 Author: Ivan Borzenkov <iva...@li...> Date: Thu Jun 24 23:29:18 2010 +0400 Переписан контроллер отображения документации diff --git a/application/default/controllers/DocController.php b/application/default/controllers/DocController.php index 9619978..6ce1fe4 100644 --- a/application/default/controllers/DocController.php +++ b/application/default/controllers/DocController.php @@ -14,21 +14,18 @@ class DocController exec('chmod -R 777 '.TMPPATH.'/doc'); } - public function indexAction() - { - //пока так - return $this->allAction(); - } - /** * Генерирует общую страницу с документацией */ - public function allAction() + public function indexAction() { - $file = str_replace(QFW::$router->UriPath, '', QFW::$router->Uri); - if ($file == '/') - $file = '/quickfw.html'; - $file = TMPPATH.'/doc'.$file; + $args = func_get_args(); + if (substr($_SERVER['REQUEST_URI'], -1, 1) != '/' && count($args) == 0) + QFW::$router->redirect(Url::A()); + $file = implode('/', $args); + if ($file == '') + $file = 'quickfw.html'; + $file = TMPPATH.'/doc/'.$file; //условие для стилей if (strpos($file, '.css')!==false) header('Content-Type: text/css'); commit f3e6cd6fe03e1503f4076312223d8a920e2959ad Author: Ivan Borzenkov <iva...@li...> Date: Thu Jun 24 23:21:49 2010 +0400 Правка документации diff --git a/doc/asciidoc/auth.txt b/doc/asciidoc/auth.txt index 618cdc9..5fbe094 100644 --- a/doc/asciidoc/auth.txt +++ b/doc/asciidoc/auth.txt @@ -4,8 +4,10 @@ Сесии ~~~~~ -В отличие от традиционных решений в данном фреймворке сессии являются частным случаем авторизации, так как в большинстве случаев сессии используются для авторизации пользователей, то такой подход оказался оправданным. +В отличие от традиционных решений в данном фреймворке сессии являются частным случаем авторизации, так как в большинстве случаев сессии используются для авторизации пользователей, то такой подход оказался оправданным. Для того чтобы стартовать сессию не привязывая ее к конкретному пользователю нужно прямо или косвенно наследовать контроллер от класса QuickFW_Auth и для старта сессии вызвать $this->session(); После вызова $this->session(); с сессями можно работать через стандартный механизм - массив $_SESSION. +При наличие у пользователя сессионной куки сессия автоматически поднимается при вызове конструктора класса QuickFW_Auth. + Сессионные данные сохраняются в кеше, указанном по умолчанию, ключами являются строки sess_<id сессии>, пустые сессии автоматически удаляются из хранилища и с помощью механизма очистки сессий также производится чистка кеша. diff --git a/doc/asciidoc/mvc.txt b/doc/asciidoc/mvc.txt index 916f1f2..98c04f4 100644 --- a/doc/asciidoc/mvc.txt +++ b/doc/asciidoc/mvc.txt @@ -13,10 +13,15 @@ MVC и преобразование адресов в контроллеры * Первым идет модуль - в папке +application+ ищется папка с именем модуля, если же ее нет, то выбирается модуль по умолчанию (+default+). * Контроллер - в текущем модуле в папке +controllers+ проверяется наличие файла +NameСontroller+, если его нет, то используется файл +IndexСontroller+. * После подключения файла контроллера проверяется наличие класса +NameСontroller+, а если его нет, то проверяется его наличие в пространстве имен с именем модуля. + * Если класс не найден, а файл существует, то выводится сообщение об ошибке. * В классе ищется функция +Аction(Action|Cli|Block|...)+ в зависимости от способа вызова. Если функции нет, то вызывается функция +index+ с указанным суффиксом. * Остальные компоненты передаются как параметры функции. * У контроллера по умолчанию в действие по умолчанию (+index/index+) не может быть параметров - если они есть, то выдается 404 +Получается, что ни при каких обстоятельствах нельзя получить ошибку 404 - все несуществующие страницы будут +отправлены на действие по умолчанию (+default/index/index+), однако есть опция +$config[\'QFW'][\'auto404']+, и если она установлена, +то на все запросы пришедшие на действие по умолчанию кромя запроса к корню будет выдана страница 404. + Несколько примеров. .Разбор обычного URI вызванного через http @@ -27,15 +32,15 @@ MVC и преобразование адресов в контроллеры [source,php] --------------------------------------------- -... +//... class TopicContriller { - ... + //... indexAction($number) { die($number); } - ... + //... } --------------------------------------------- Результат: @@ -52,15 +57,15 @@ class TopicContriller [source,php] --------------------------------------------- -... +//... class RegisterContriller { - ... + //... indexAction() { echo 'Регистрация'; } - ... + //... } --------------------------------------------- Результат: @@ -77,22 +82,26 @@ class RegisterContriller [source,php] --------------------------------------------- -... +//... class IndexContriller { - ... + //... indexAction($p1, $p2) { echo $p1, $p2; } - ... + //... } --------------------------------------------- -Результат: +Результат при включенной опции +$config[\'QFW'][\'auto404']+: Указаны параметры у дефолтового CA или несуществующий Контроллер или Экшен дефолтового контроллера +Результат при выключенной опции +$config[\'QFW'][\'auto404']+: + + asdfgffa + ===================================================================== .Вызов из консоли @@ -103,15 +112,15 @@ class IndexContriller [source,php] --------------------------------------------- -... +//... class CronContriller { - ... + //... parceCli() { echo 'Обработка...'; } - ... + //... } --------------------------------------------- Результат: ----------------------------------------------------------------------- Summary of changes: application/default/controllers/DocController.php | 19 +++++------ doc/asciidoc/auth.txt | 4 ++- doc/asciidoc/mvc.txt | 35 +++++++++++++-------- 3 files changed, 33 insertions(+), 25 deletions(-) hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-06-23 11:29:44
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via ad1aa1301e994cf93356b8dfaad508f5f9f65064 (commit) from c430200b547ae5480b26ea387d427a09eb17325c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ad1aa1301e994cf93356b8dfaad508f5f9f65064 Author: Ivan1986 <iva...@li...> Date: Wed Jun 23 12:40:20 2010 +0400 Доработка OpenID контроллера, ZendStore diff --git a/application/default/controllers/OidController.php b/application/default/controllers/OidController.php index 1eeee69..e129325 100644 --- a/application/default/controllers/OidController.php +++ b/application/default/controllers/OidController.php @@ -1,7 +1,7 @@ <?php require_once "Auth/OpenID/Consumer.php"; -require_once "Auth/OpenID/FileStore.php"; +require_once dirname(__FILE__)."/ZendStore.php"; require_once "Auth/OpenID/SReg.php"; require_once "Auth/OpenID/PAPE.php"; @@ -10,33 +10,32 @@ require_once QFWPATH.'/QuickFW/Auth.php'; class OidController extends QuickFW_Auth { - public function __construct() + public function indexAction($return = false) { - QFW::$view->mainTemplate=''; - $this->session(); - } - - public function indexAction($clean = false) - { - if ($clean == 1) + var_dump($_SESSION); + $return = $return ? $return : $_SERVER['REQUEST_URI']; + if (!empty($_SESSION['openID']['error'])) { - unset($_SESSION['openID']); - QFW::$router->redirect(Url::A()); - } - if (!empty($_SESSION['openID'])) - { - var_dump($_SESSION['openID']); - } - ?> + echo '<p class="error">'.$_SESSION['openID']['error'].'</p>'; + unset($_SESSION['openID']['error']); + } ?> + <form method="get" action="<?php echo Url::C('try') ?>"> +<input type="hidden" name="return" value="<?php echo QFW::$view->esc($return); ?>" /> <input type="text" name="openid_identifier" value="<?php echo QFW::$view->esc( 'http://quickfw.ib.br/openid/server.php/idpage?user=ivan') ?>" /> <input type="submit" value="Verify" /> </form> -<a href="<?php echo Url::A('1') ?>">выйти</a> +<a href="<?php echo Url::C('clean') ?>">выйти</a> <?php } + public function cleanAction() + { + unset($_SESSION['openID']); + QFW::$router->redirect(Url::C()); + } + /* array( 'fullname' => 'Full Name', 'nickname' => 'Nickname', @@ -49,8 +48,13 @@ class OidController extends QuickFW_Auth 'timezone' => 'Time Zone', ); */ + /** + * Действеи перенаправляет пользователя на сервер для авторизации + */ public function tryAction() { + $this->session(); + $_SESSION['openID']['return'] = $_REQUEST['return']; if (empty($_GET['openid_identifier'])) $this->err('Expected an OpenID URL'); $consumer = $this->getConsumer(); @@ -68,8 +72,6 @@ class OidController extends QuickFW_Auth $redirect = $auth_request->shouldSendRedirect(); $server = $this->getServer(); - $trustRoot = $server.Url::C(''); - echo $trustRoot; $query = $redirect ? $auth_request->redirectURL($server.Url::C(''), $server.Url::C('finish')) : @@ -84,8 +86,15 @@ class OidController extends QuickFW_Auth die($query); } + /** + * Сюда приходит пользователь с сервера авторизации + * + * После пользователь перенаправляется на url, + * <br>в $_SESSION['openID'] данные авторизации + */ public function finishAction() { + $this->session(); if (empty($_GET['openid_identity'])) $this->err('Expected an OpenID URL'); $consumer = $this->getConsumer(); @@ -97,29 +106,45 @@ class OidController extends QuickFW_Auth else if ($response->status == Auth_OpenID_SUCCESS) { $openid = $response->getDisplayIdentifier(); + $return = $_SESSION['openID']['return']; $sreg_resp = Auth_OpenID_SRegResponse::fromSuccessResponse($response); $sreg = $sreg_resp->contents(); - $_SESSION['openID'] = $sreg + array('id' => $openid); - QFW::$router->redirect(Url::C('index')); + $_SESSION['openID'] = array( + 'sreg' => $sreg, + 'id' => $openid, + ); + QFW::$router->redirect($return); } } + /** + * Сообщение при ошибке авторизации - в $_SESSION['openID']['error'] + * + * @param string $msg сообщение об ошибке + */ private function err($msg) { - die($msg); + $_SESSION['openID']['error'] = $msg; + QFW::$router->redirect($_SESSION['openID']['return']); } + /** + * Возвращает класс хранилища для библиотеки + * + * @return Auth_OpenID_Consumer класс хранилища + */ private function getConsumer() { - $path = TMPPATH.'/openid'; - if (!is_dir($path)) - mkdir($path); - $store = new Auth_OpenID_FileStore($path); - return new Auth_OpenID_Consumer($store); + return new Auth_OpenID_Consumer(new Auth_OpenID_ZendStore(Cache::get())); } + /** + * формирует имя сервера + * + * @return string url сервера + */ private function getServer() { return 'http://'.$_SERVER['HTTP_HOST']. diff --git a/application/default/controllers/ZendStore.php b/application/default/controllers/ZendStore.php new file mode 100644 index 0000000..628a4ab --- /dev/null +++ b/application/default/controllers/ZendStore.php @@ -0,0 +1,203 @@ +<?php + +/** + * This file supplies a memcached store backend for OpenID servers and + * consumers. + * + * PHP versions 4 and 5 + * + * LICENSE: See the COPYING file included in this distribution. + * + * @package OpenID + * @author Artemy Tregubenko <me...@ar...> + * @author Ivan Borzenkov <iva...@li...> + * @copyright 2008 JanRain, Inc. + * @copyright 2010 Ivan Borzenkov <iva...@li...> + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache + * Contributed by Open Web Technologies <http://openwebtech.ru/> + */ + +/** + * Import the interface for creating a new store class. + */ +require_once 'Auth/OpenID/Interface.php'; + +/** + * This is a Zend_Cache_Backend_Interface-based store for + * OpenID associations and nonces. + * + * Most of the methods of this class are implementation details. + * People wishing to just use this store need only pay attention to + * the constructor. + * + * @package OpenID + */ +class Auth_OpenID_ZendStore extends Auth_OpenID_OpenIDStore { + + /** + * Initializes a new {@link Auth_OpenID_ZendStore} instance. + * Just saves connection object as property. + * + * @param Zend_Cache_Backend_Interface $connection resourse + */ + function Auth_OpenID_ZendStore($connection) + { + $this->connection = $connection; + } + + /** + * Store association until its expiration time in memcached. + * Overwrites any existing association with same server_url and + * handle. Handles list of associations for every server. + */ + function storeAssociation($server_url, $association) + { + // create memcached keys for association itself + // and list of associations for this server + $associationKey = $this->associationKey($server_url, + $association->handle); + $serverKey = $this->associationServerKey($server_url); + + // get list of associations + $serverAssociations = $this->connection->load($serverKey); + + // if no such list, initialize it with empty array + if (!$serverAssociations) { + $serverAssociations = array(); + } + // and store given association key in it + $serverAssociations[$association->issued] = $associationKey; + + // save associations' keys list + $this->connection->save( + $serverAssociations, + $serverKey); + // save association itself + $this->connection->save( + $association, + $associationKey, + array(), + $association->issued + $association->lifetime); + } + + /** + * Read association from memcached. If no handle given + * and multiple associations found, returns latest issued + */ + function getAssociation($server_url, $handle = null) + { + // simple case: handle given + if ($handle !== null) { + // get association, return null if failed + $association = $this->connection->load( + $this->associationKey($server_url, $handle)); + return $association ? $association : null; + } + + // no handle given, working with list + // create key for list of associations + $serverKey = $this->associationServerKey($server_url); + + // get list of associations + $serverAssociations = $this->connection->load($serverKey); + // return null if failed or got empty list + if (!$serverAssociations) { + return null; + } + + // get key of most recently issued association + $keys = array_keys($serverAssociations); + sort($keys); + $lastKey = $serverAssociations[array_pop($keys)]; + + // get association, return null if failed + $association = $this->connection->load($lastKey); + return $association ? $association : null; + } + + /** + * Immediately delete association from memcache. + */ + function removeAssociation($server_url, $handle) + { + // create memcached keys for association itself + // and list of associations for this server + $serverKey = $this->associationServerKey($server_url); + $associationKey = $this->associationKey($server_url, + $handle); + + // get list of associations + $serverAssociations = $this->connection->load($serverKey); + // return null if failed or got empty list + if (!$serverAssociations) { + return false; + } + + // ensure that given association key exists in list + $serverAssociations = array_flip($serverAssociations); + if (!array_key_exists($associationKey, $serverAssociations)) { + return false; + } + + // remove given association key from list + unset($serverAssociations[$associationKey]); + $serverAssociations = array_flip($serverAssociations); + + // save updated list + $this->connection->save( + $serverAssociations, + $serverKey + ); + + // delete association + return $this->connection->remove($associationKey); + } + + /** + * Create nonce for server and salt, expiring after + * $Auth_OpenID_SKEW seconds. + */ + function useNonce($server_url, $timestamp, $salt) + { + global $Auth_OpenID_SKEW; + + // save one request to memcache when nonce obviously expired + if (abs($timestamp - time()) > $Auth_OpenID_SKEW) { + return false; + } + + // returns false when nonce already exists + // otherwise adds nonce + $key = 'openid_nonce_' . sha1($server_url) . '_' . sha1($salt); + if ($this->connection->test($key)) + return false; + + $this->connection->save(1, $key, array(), $Auth_OpenID_SKEW); + return true; + } + + /** + * Memcache key is prefixed with 'openid_association_' string. + */ + function associationKey($server_url, $handle = null) + { + return 'openid_association_' . sha1($server_url) . '_' . sha1($handle); + } + + /** + * Memcache key is prefixed with 'openid_association_' string. + */ + function associationServerKey($server_url) + { + return 'openid_association_server_' . sha1($server_url); + } + + /** + * Report that this storage doesn't support cleanup + */ + function supportsCleanup() + { + return false; + } +} + ----------------------------------------------------------------------- Summary of changes: application/default/controllers/OidController.php | 81 ++++++--- application/default/controllers/ZendStore.php | 203 +++++++++++++++++++++ 2 files changed, 256 insertions(+), 28 deletions(-) create mode 100644 application/default/controllers/ZendStore.php hooks/post-receive -- quickfw |
From: Ivan1986 <iva...@us...> - 2010-06-22 07:36:28
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "quickfw". The branch, master has been updated via c430200b547ae5480b26ea387d427a09eb17325c (commit) via b4c34313d3047e4e22ae7b3fb8144dbd798ba561 (commit) from c8e7843959370e2207228f2760c5552ee29b5feb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c430200b547ae5480b26ea387d427a09eb17325c Author: Ivan1986 <iva...@li...> Date: Tue Jun 22 11:35:43 2010 +0400 Контроллер для авторизации по OpenID (пока базовая реализация) diff --git a/application/default/controllers/OidController.php b/application/default/controllers/OidController.php new file mode 100644 index 0000000..1eeee69 --- /dev/null +++ b/application/default/controllers/OidController.php @@ -0,0 +1,131 @@ +<?php + +require_once "Auth/OpenID/Consumer.php"; +require_once "Auth/OpenID/FileStore.php"; +require_once "Auth/OpenID/SReg.php"; +require_once "Auth/OpenID/PAPE.php"; + +require_once QFWPATH.'/QuickFW/Auth.php'; + +class OidController extends QuickFW_Auth +{ + + public function __construct() + { + QFW::$view->mainTemplate=''; + $this->session(); + } + + public function indexAction($clean = false) + { + if ($clean == 1) + { + unset($_SESSION['openID']); + QFW::$router->redirect(Url::A()); + } + if (!empty($_SESSION['openID'])) + { + var_dump($_SESSION['openID']); + } + ?> +<form method="get" action="<?php echo Url::C('try') ?>"> +<input type="text" name="openid_identifier" value="<?php echo QFW::$view->esc( + 'http://quickfw.ib.br/openid/server.php/idpage?user=ivan') ?>" /> +<input type="submit" value="Verify" /> +</form> +<a href="<?php echo Url::A('1') ?>">выйти</a> + <?php + } + + /* array( + 'fullname' => 'Full Name', + 'nickname' => 'Nickname', + 'dob' => 'Date of Birth', + 'email' => 'E-mail Address', + 'gender' => 'Gender', + 'postcode' => 'Postal Code', + 'country' => 'Country', + 'language' => 'Language', + 'timezone' => 'Time Zone', + ); */ + + public function tryAction() + { + if (empty($_GET['openid_identifier'])) + $this->err('Expected an OpenID URL'); + $consumer = $this->getConsumer(); + $auth_request = $consumer->begin($_GET['openid_identifier']); + if (!$auth_request) + $this->err('Authentication error; not a valid OpenID'); + + $sreg_request = Auth_OpenID_SRegRequest::build( + array('nickname'), // Required + array('fullname', 'email') // Optional + ); + if ($sreg_request) + $auth_request->addExtension($sreg_request); + + $redirect = $auth_request->shouldSendRedirect(); + + $server = $this->getServer(); + $trustRoot = $server.Url::C(''); + echo $trustRoot; + + $query = $redirect ? + $auth_request->redirectURL($server.Url::C(''), $server.Url::C('finish')) : + $auth_request->htmlMarkup($server.Url::C(''), + $server.Url::C('finish'), false, array('id' => 'openid_message')); + if (Auth_OpenID::isFailure($query)) + $this->err("Could not redirect to server: " . $query->message); + + if ($redirect) + QFW::$router->redirect((string)$query); + else + die($query); + } + + public function finishAction() + { + if (empty($_GET['openid_identity'])) + $this->err('Expected an OpenID URL'); + $consumer = $this->getConsumer(); + $response = $consumer->complete($this->getServer().Url::A()); + if ($response->status == Auth_OpenID_CANCEL) + $this->err('Verification cancelled.'); + else if ($response->status == Auth_OpenID_FAILURE) + $this->err('OpenID authentication failed: ' . $response->message); + else if ($response->status == Auth_OpenID_SUCCESS) + { + $openid = $response->getDisplayIdentifier(); + + $sreg_resp = Auth_OpenID_SRegResponse::fromSuccessResponse($response); + $sreg = $sreg_resp->contents(); + + $_SESSION['openID'] = $sreg + array('id' => $openid); + QFW::$router->redirect(Url::C('index')); + } + } + + private function err($msg) + { + die($msg); + } + + private function getConsumer() + { + $path = TMPPATH.'/openid'; + if (!is_dir($path)) + mkdir($path); + $store = new Auth_OpenID_FileStore($path); + return new Auth_OpenID_Consumer($store); + } + + private function getServer() + { + return 'http://'.$_SERVER['HTTP_HOST']. + ($_SERVER['SERVER_PORT']==80?'':$_SERVER['SERVER_PORT']); + } + +} + +?> commit b4c34313d3047e4e22ae7b3fb8144dbd798ba561 Author: Ivan1986 <iva...@li...> Date: Tue Jun 22 11:35:01 2010 +0400 Недокомичен лог xmpp diff --git a/lib/jabber/XMPPHP/Log.php b/lib/jabber/XMPPHP/Log.php new file mode 100644 index 0000000..a9bce3d --- /dev/null +++ b/lib/jabber/XMPPHP/Log.php @@ -0,0 +1,119 @@ +<?php +/** + * XMPPHP: The PHP XMPP Library + * Copyright (C) 2008 Nathanael C. Fritz + * This file is part of SleekXMPP. + * + * XMPPHP is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * XMPPHP is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XMPPHP; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category xmpphp + * @package XMPPHP + * @author Nathanael C. Fritz <JID: fr...@ne...> + * @author Stephan Wentz <JID: st...@ja...> + * @author Michael Garvin <JID: ga...@ne...> + * @copyright 2008 Nathanael C. Fritz + */ + +/** + * XMPPHP Log + * + * @package XMPPHP + * @author Nathanael C. Fritz <JID: fr...@ne...> + * @author Stephan Wentz <JID: st...@ja...> + * @author Michael Garvin <JID: ga...@ne...> + * @copyright 2008 Nathanael C. Fritz + * @version $Id$ + */ +class XMPPHP_Log { + + const LEVEL_ERROR = 0; + const LEVEL_WARNING = 1; + const LEVEL_INFO = 2; + const LEVEL_DEBUG = 3; + const LEVEL_VERBOSE = 4; + + /** + * @var array + */ + protected $data = array(); + + /** + * @var array + */ + protected $names = array('ERROR', 'WARNING', 'INFO', 'DEBUG', 'VERBOSE'); + + /** + * @var integer + */ + protected $runlevel; + + /** + * @var boolean + */ + protected $printout; + + /** + * Constructor + * + * @param boolean $printout + * @param string $runlevel + */ + public function __construct($printout = false, $runlevel = self::LEVEL_INFO) { + $this->printout = (boolean)$printout; + $this->runlevel = (int)$runlevel; + } + + /** + * Add a message to the log data array + * If printout in this instance is set to true, directly output the message + * + * @param string $msg + * @param integer $runlevel + */ + public function log($msg, $runlevel = self::LEVEL_INFO) { + $time = time(); + #$this->data[] = array($this->runlevel, $msg, $time); + if($this->printout and $runlevel <= $this->runlevel) { + $this->writeLine($msg, $runlevel, $time); + } + } + + /** + * Output the complete log. + * Log will be cleared if $clear = true + * + * @param boolean $clear + * @param integer $runlevel + */ + public function printout($clear = true, $runlevel = null) { + if($runlevel === null) { + $runlevel = $this->runlevel; + } + foreach($this->data as $data) { + if($runlevel <= $data[0]) { + $this->writeLine($data[1], $runlevel, $data[2]); + } + } + if($clear) { + $this->data = array(); + } + } + + protected function writeLine($msg, $runlevel, $time) { + //echo date('Y-m-d H:i:s', $time)." [".$this->names[$runlevel]."]: ".$msg."\n"; + echo $time." [".$this->names[$runlevel]."]: ".$msg."\n"; + flush(); + } +} ----------------------------------------------------------------------- Summary of changes: application/default/controllers/OidController.php | 131 +++++++++++++++++++++ lib/jabber/XMPPHP/Log.php | 119 +++++++++++++++++++ 2 files changed, 250 insertions(+), 0 deletions(-) create mode 100644 application/default/controllers/OidController.php create mode 100644 lib/jabber/XMPPHP/Log.php hooks/post-receive -- quickfw |