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 31b59d46fb3ef0a120c1d9ad0fc35e65016ccc7b (commit)
via 4e2c20d3bf5c32ae12529fb73c45a3522cafedbb (commit)
via efab6e5e855dde27afca0f4d1480e5ea090d5d7e (commit)
via b6a248d9e028ccff6e34dbf4130aed84d50e1355 (commit)
via 37d5da8c5fcb24b8903c5d912e494a349d6ddddb (commit)
via dac3eb560e559d7a5fd3f5b6db73bb4f3e13b6dd (commit)
via bacb508b934df994d3c6090dc73b8b88e530c197 (commit)
via 63bd585f28ecd53760bda6a89111e03c07df05aa (commit)
from d8ae62b53971e4e59359059f22754f2beefff373 (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 31b59d46fb3ef0a120c1d9ad0fc35e65016ccc7b
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Feb 16 23:46:11 2011 +0300
Игнорим .idea (phpstorm)
diff --git a/.gitignore b/.gitignore
index b0da8fc..29bd83c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
-/var/tmp/doc
\ No newline at end of file
+/var/tmp/doc
+.idea
\ No newline at end of file
commit 4e2c20d3bf5c32ae12529fb73c45a3522cafedbb
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Feb 16 15:11:21 2011 +0300
Условие если не нашли
diff --git a/QFW/Init.php b/QFW/Init.php
index e27b0ea..1a5e0eb 100644
--- a/QFW/Init.php
+++ b/QFW/Init.php
@@ -171,7 +171,7 @@ class QFW
$msg."\n\n".
$info['query']."\n";
$trace = debug_backtrace();
- while(1)
+ while(count($trace))
{
$t = $trace[0];
if (!isset($t['file']) || $t['file']!=$file || $t['line']!=$line || $t['function'] == '__call')
commit efab6e5e855dde27afca0f4d1480e5ea090d5d7e
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Feb 16 15:08:29 2011 +0300
Теперь ошибки базы данных отправляются в нотифер если он установлен
diff --git a/QFW/Init.php b/QFW/Init.php
index 7b2023d..e27b0ea 100644
--- a/QFW/Init.php
+++ b/QFW/Init.php
@@ -126,6 +126,8 @@ class QFW
/** @var Debug_ErrorHook_Listener Обработчик ошибок */
static private $ErrorHook = false;
+ /** @var Debug_ErrorHook_INotifier Сообщение об ошибке */
+ static private $Notifer = false;
/**
* Инициализация обработчика ошибок из конфига
@@ -153,7 +155,34 @@ class QFW
$i = new Debug_ErrorHook_RemoveDupsWrapper($i,
TMPPATH.'/errors', $handler['RemoveDups']);
}
- self::$ErrorHook->addNotifier($i);
+ self::$Notifer = $i;
+ self::$ErrorHook->addNotifier(self::$Notifer);
+ self::$db->setErrorHandler(array(get_class(), 'dbErrorHandler'));
+ }
+
+ static public function dbErrorHandler($msg, $info)
+ {
+ // Если использовалась @, ничего не делать.
+ if (!error_reporting()) return;
+ // В лог подробную информацию об ошибке.
+ list($file, $line) = explode(' line ', $info['context']);
+ $msg = str_replace(' at '.$info['context'], ' of query', $msg);
+ $text = "SQL Error\n\n".
+ $msg."\n\n".
+ $info['query']."\n";
+ $trace = debug_backtrace();
+ while(1)
+ {
+ $t = $trace[0];
+ if (!isset($t['file']) || $t['file']!=$file || $t['line']!=$line || $t['function'] == '__call')
+ {
+ array_shift($trace);
+ continue;
+ }
+ break;
+ }
+ self::$Notifer->notify($info['code'], $text, $file, $line, $trace);
+ exit();
}
/**
commit b6a248d9e028ccff6e34dbf4130aed84d50e1355
Author: Ivan Borzenkov <iva...@li...>
Date: Thu Feb 10 14:09:39 2011 +0300
Сайтмап - поддержка gzip и флаг использования _index.xml
diff --git a/lib/Sitemap.php b/lib/Sitemap.php
index 55d5def..d2cf104 100644
--- a/lib/Sitemap.php
+++ b/lib/Sitemap.php
@@ -5,121 +5,133 @@
*/
class Sitemap
{
- /**
- * Класс для генерации sitemap
- *
- * @param string $dir DOC_ROOT сайта
- * @param string $prefix Префикс урла
- * @param string $suffix Суффикс файла
- */
- public function __construct($dir, $prefix, $suffix='')
- {
- $this->dir = $dir;
- $this->curFileNum = 0;
- $this->prefix = $prefix;
- $this->suffix = $suffix;
- $this->head.="\n";
- $this->data = $this->head;
- $this->realsize = 10*1024*1024 - mb_strlen($this->head) - mb_strlen($this->foot);
- //$this->realsize = 400 - mb_strlen($this->head) - mb_strlen($this->foot);
- $this->last_len = $this->realsize;
- $this->last_urls = 50000;
- }
+ /**
+ * Класс для генерации sitemap
+ *
+ * @param string $dir DOC_ROOT сайта
+ * @param string $prefix Префикс урла
+ * @param string $name Имя файла
+ * @param string $gzip Использовать gzip
+ */
+ public function __construct($dir, $prefix, $name = 'sitemap', $gzip = false)
+ {
+ $this->dir = $dir;
+ $this->curFileNum = 0;
+ $this->prefix = $prefix;
+ $this->name = $name;
+ $this->gzip = $gzip;
+ $this->head.="\n";
+ $this->data = $this->head;
+ $this->realsize = 10*1024*1024 - mb_strlen($this->head) - mb_strlen($this->foot);
+ //$this->realsize = 400 - mb_strlen($this->head) - mb_strlen($this->foot);
+ $this->last_len = $this->realsize;
+ $this->last_urls = 50000;
+ }
- /**
- * Добавить путь
- *
- * @param string $url Урл
- * @param array $extra Дополнительные поля
- */
- public function add($url, $extra = array())
- {
- if ($this->last_urls == 0)
- $this->nextFile();
+ /**
+ * Добавить путь
+ *
+ * @param string $url Урл
+ * @param array $extra Дополнительные поля
+ */
+ public function add($url, $p, $extra = array())
+ {
+ if ($this->last_urls == 0)
+ $this->nextFile();
- $text = '<url><loc>'.$this->prefix.$url.'</loc>';
- foreach($extra as $tag=>$value)
- $text.='<'.$tag.'>'.$value.'</'.$tag.'>';
- $text.='</url>'."\n";
- $len = mb_strlen($text);
+ $text = '<url><loc>'.$this->prefix.$url.'</loc>';
+ foreach($extra as $tag=>$value)
+ $text.='<'.$tag.'>'.$value.'</'.$tag.'>';
+ $text.='</url>'."\n";
+ $len = mb_strlen($text);
- if ($this->last_len < $len)
- $this->nextFile();
- $this->last_len-=$len;
+ if ($this->last_len < $len)
+ $this->nextFile();
+ $this->last_len-=$len;
- $this->data.=$text;
- }
+ $this->data.=$text;
+ }
- /**
- * Закончить генерацию
- */
- public function end()
- {
- //Файл был не один - генерим индекс
- if ($this->curFileNum)
- {
- $this->curFileNum++;
- file_put_contents($this->dir.'/sitemap'.$this->suffix.$this->curFileNum.'.xml', $this->data.$this->foot);
+ /**
+ * Закончить генерацию
+ *
+ * @return bool Был ли создан индекс фаил?
+ */
+ public function end()
+ {
+ //Файл был не один - генерим индекс
+ if ($this->curFileNum)
+ {
+ if ($this->last_urls != 50000)
+ { //если у нас еще есть урлы для записи
+ $this->curFileNum++;
+ file_put_contents(($this->gzip ? 'compress.zlib://' : '').
+ $this->dir.'/'.$this->name.$this->curFileNum.'.'.($this->gzip ? 'gz' : 'xml'), $this->data.$this->foot);
+ }
- $index= '<?xml version="1.0" encoding="UTF-8"?>'."\n".
-'<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";
- for($i=1; $i<=$this->curFileNum; $i++)
- {
- $index.= "\t<sitemap>\n";
- $index.= "<loc>".$this->prefix.'/sitemap'.$this->suffix.$i.'.xml'."</loc>";
- $index.= "<lastmod>".(date(DATE_W3C))."</lastmod>";
- $index.= "</sitemap>";
- }
- $index.= '</sitemapindex>';
- file_put_contents($this->dir.'/sitemap'.$this->suffix.'_index.xml', $index);
- }
- else
- file_put_contents($this->dir.'/sitemap'.$this->suffix.'.xml', $this->data.$this->foot);
- //восстанавливаем значения
- $this->data = $this->head;
- $this->last_len = $this->realsize;
- $this->last_urls = 50000;
- $this->curFileNum = 0;
- }
+ $index= '<?xml version="1.0" encoding="UTF-8"?>'."\n".
+ '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";
+ for($i=1; $i<=$this->curFileNum; $i++)
+ {
+ $index.= "\t<sitemap>\n";
+ $index.= "<loc>".$this->prefix.'/'.$this->name.$i.'.'.($this->gzip ? 'gz' : 'xml')."</loc>";
+ $index.= "<lastmod>".(date(DATE_W3C))."</lastmod>";
+ $index.= "</sitemap>";
+ }
+ $index.= '</sitemapindex>';
+ file_put_contents($this->dir.'/'.$this->name.'_index.xml', $index);
+ }
+ else
+ file_put_contents(($this->gzip ? 'compress.zlib://' : '').
+ $this->dir.'/'.$this->name.'.'.($this->gzip ? 'gz' : 'xml'), $this->data.$this->foot);
+ $index = (bool)$this->curFileNum;
+ //восстанавливаем значения
+ $this->data = $this->head;
+ $this->last_len = $this->realsize;
+ $this->last_urls = 50000;
+ $this->curFileNum = 0;
+ return $index;
+ }
- /**
- * Переключаемся на следующий файл
- */
- private function nextFile()
- {
- $this->curFileNum++;
- file_put_contents($this->dir.'/sitemap'.$this->suffix.$this->curFileNum.'.xml', $this->data.$this->foot);
- //восстанавливаем значения
- $this->data = $this->head;
- $this->last_len = $this->realsize;
- $this->last_urls = 50000;
- }
+ /**
+ * Переключаемся на следующий файл
+ */
+ private function nextFile()
+ {
+ $this->curFileNum++;
+ file_put_contents(($this->gzip ? 'compress.zlib://' : '').
+ $this->dir.'/'.$this->name.$this->curFileNum.'.'.($this->gzip ? 'gz' : 'xml'), $this->data.$this->foot);
+ //восстанавливаем значения
+ $this->data = $this->head;
+ $this->last_len = $this->realsize;
+ $this->last_urls = 50000;
+ }
- /** @var integer Текущий номер файла */
- private $curFileNum;
- /** @var string Директория */
- private $dir;
-
- /** @var string Префикс урла */
- private $prefix;
- /** @var string Суффикс файла */
- private $suffix;
- /** @var string генерируемый сайтмап */
- private $data;
- /** @var integer осталось адресов */
- private $last_urls;
- /** @var integer осталось байт */
- private $last_len;
- /** @var integer Размер без шапок */
- private $realsize;
- /** @var string шапка */
- private $head = '<?xml version="1.0" encoding="UTF-8"?><urlset
- xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
- http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">';
- /** @var string футер */
- private $foot = '</urlset>';
+ /** @var integer Текущий номер файла */
+ private $curFileNum;
+ /** @var string Директория */
+ private $dir;
+ /** @var string Префикс урла */
+ private $prefix;
+ /** @var string Имя файла */
+ private $name;
+ /** @var bool использовать gzip */
+ private $gzip;
+ /** @var string генерируемый сайтмап */
+ private $data;
+ /** @var integer осталось адресов */
+ private $last_urls;
+ /** @var integer осталось байт */
+ private $last_len;
+ /** @var integer Размер без шапок */
+ private $realsize;
+ /** @var string шапка */
+ private $head = '<?xml version="1.0" encoding="UTF-8"?><urlset'."\n".
+ 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"'."\n".
+ 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'."\n".
+ 'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">';
+ /** @var string футер */
+ private $foot = '</urlset>';
}
commit 37d5da8c5fcb24b8903c5d912e494a349d6ddddb
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Feb 2 13:26:28 2011 +0300
Приоритет в сайтмапе необязательный
diff --git a/lib/Sitemap.php b/lib/Sitemap.php
index ab87baf..55d5def 100644
--- a/lib/Sitemap.php
+++ b/lib/Sitemap.php
@@ -30,16 +30,14 @@ class Sitemap
* Добавить путь
*
* @param string $url Урл
- * @param float $priority Приоритет
* @param array $extra Дополнительные поля
*/
- public function add($url, $priority, $extra = array())
+ public function add($url, $extra = array())
{
if ($this->last_urls == 0)
$this->nextFile();
- $text = '<url><loc>'.$this->prefix.$url.'</loc>'.
- '<priority>'.$priority.'</priority>';
+ $text = '<url><loc>'.$this->prefix.$url.'</loc>';
foreach($extra as $tag=>$value)
$text.='<'.$tag.'>'.$value.'</'.$tag.'>';
$text.='</url>'."\n";
commit dac3eb560e559d7a5fd3f5b6db73bb4f3e13b6dd
Author: Ivan Borzenkov <iva...@li...>
Date: Wed Feb 2 13:07:37 2011 +0300
Класс для генерации sitemap
diff --git a/lib/Sitemap.php b/lib/Sitemap.php
new file mode 100644
index 0000000..ab87baf
--- /dev/null
+++ b/lib/Sitemap.php
@@ -0,0 +1,127 @@
+<?php
+
+/**
+ * Класс для генерации sitemap
+ */
+class Sitemap
+{
+ /**
+ * Класс для генерации sitemap
+ *
+ * @param string $dir DOC_ROOT сайта
+ * @param string $prefix Префикс урла
+ * @param string $suffix Суффикс файла
+ */
+ public function __construct($dir, $prefix, $suffix='')
+ {
+ $this->dir = $dir;
+ $this->curFileNum = 0;
+ $this->prefix = $prefix;
+ $this->suffix = $suffix;
+ $this->head.="\n";
+ $this->data = $this->head;
+ $this->realsize = 10*1024*1024 - mb_strlen($this->head) - mb_strlen($this->foot);
+ //$this->realsize = 400 - mb_strlen($this->head) - mb_strlen($this->foot);
+ $this->last_len = $this->realsize;
+ $this->last_urls = 50000;
+ }
+
+ /**
+ * Добавить путь
+ *
+ * @param string $url Урл
+ * @param float $priority Приоритет
+ * @param array $extra Дополнительные поля
+ */
+ public function add($url, $priority, $extra = array())
+ {
+ if ($this->last_urls == 0)
+ $this->nextFile();
+
+ $text = '<url><loc>'.$this->prefix.$url.'</loc>'.
+ '<priority>'.$priority.'</priority>';
+ foreach($extra as $tag=>$value)
+ $text.='<'.$tag.'>'.$value.'</'.$tag.'>';
+ $text.='</url>'."\n";
+ $len = mb_strlen($text);
+
+ if ($this->last_len < $len)
+ $this->nextFile();
+ $this->last_len-=$len;
+
+ $this->data.=$text;
+ }
+
+ /**
+ * Закончить генерацию
+ */
+ public function end()
+ {
+ //Файл был не один - генерим индекс
+ if ($this->curFileNum)
+ {
+ $this->curFileNum++;
+ file_put_contents($this->dir.'/sitemap'.$this->suffix.$this->curFileNum.'.xml', $this->data.$this->foot);
+
+ $index= '<?xml version="1.0" encoding="UTF-8"?>'."\n".
+'<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";
+ for($i=1; $i<=$this->curFileNum; $i++)
+ {
+ $index.= "\t<sitemap>\n";
+ $index.= "<loc>".$this->prefix.'/sitemap'.$this->suffix.$i.'.xml'."</loc>";
+ $index.= "<lastmod>".(date(DATE_W3C))."</lastmod>";
+ $index.= "</sitemap>";
+ }
+ $index.= '</sitemapindex>';
+ file_put_contents($this->dir.'/sitemap'.$this->suffix.'_index.xml', $index);
+ }
+ else
+ file_put_contents($this->dir.'/sitemap'.$this->suffix.'.xml', $this->data.$this->foot);
+ //восстанавливаем значения
+ $this->data = $this->head;
+ $this->last_len = $this->realsize;
+ $this->last_urls = 50000;
+ $this->curFileNum = 0;
+ }
+
+ /**
+ * Переключаемся на следующий файл
+ */
+ private function nextFile()
+ {
+ $this->curFileNum++;
+ file_put_contents($this->dir.'/sitemap'.$this->suffix.$this->curFileNum.'.xml', $this->data.$this->foot);
+ //восстанавливаем значения
+ $this->data = $this->head;
+ $this->last_len = $this->realsize;
+ $this->last_urls = 50000;
+ }
+
+ /** @var integer Текущий номер файла */
+ private $curFileNum;
+ /** @var string Директория */
+ private $dir;
+
+ /** @var string Префикс урла */
+ private $prefix;
+ /** @var string Суффикс файла */
+ private $suffix;
+ /** @var string генерируемый сайтмап */
+ private $data;
+ /** @var integer осталось адресов */
+ private $last_urls;
+ /** @var integer осталось байт */
+ private $last_len;
+ /** @var integer Размер без шапок */
+ private $realsize;
+ /** @var string шапка */
+ private $head = '<?xml version="1.0" encoding="UTF-8"?><urlset
+ xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
+ http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">';
+ /** @var string футер */
+ private $foot = '</urlset>';
+
+
+}
commit bacb508b934df994d3c6090dc73b8b88e530c197
Author: Ivan Borzenkov <iva...@li...>
Date: Tue Feb 1 18:03:14 2011 +0300
Фикс джаббера
diff --git a/lib/XMPPHP/XMPP.php b/lib/XMPPHP/XMPP.php
index 3e94286..c9b7aea 100644
--- a/lib/XMPPHP/XMPP.php
+++ b/lib/XMPPHP/XMPP.php
@@ -86,7 +86,7 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream {
/**
* @var boolean
*/
- protected $use_encryption = true;
+ protected $use_encryption = false;
/**
* @var boolean
@@ -138,6 +138,11 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream {
$this->roster = new Roster();
$this->track_presence = true;
+ $transports = stream_get_transports();
+ $transports = array_flip($transports);
+ if (isset($transports['sslv2']) || isset($transports['sslv3']))
+ $this->use_encryption = true;
+
$this->stream_start = '<stream:stream to="' . $server . '" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0">';
$this->stream_end = '</stream:stream>';
$this->default_ns = 'jabber:client';
commit 63bd585f28ecd53760bda6a89111e03c07df05aa
Author: Ivan Borzenkov <iva...@li...>
Date: Fri Jan 28 19:09:01 2011 +0300
Новое определение модуля
diff --git a/QFW/QuickFW/Autoload.php b/QFW/QuickFW/Autoload.php
index ea5200c..9ede401 100644
--- a/QFW/QuickFW/Autoload.php
+++ b/QFW/QuickFW/Autoload.php
@@ -37,11 +37,11 @@ class Autoload
{
$file =
strtolower(mb_substr($class, 0, $pos)).
- '/controllers/'.
+ '/'.QuickFW_Router::CONTROLLERS_DIR.'/'.
ucfirst(mb_substr($class, $pos+1));
}
else
- $file = QFW::$router->cModule.'/controllers/'.$class;
+ $file = QFW::$router->cModule.'/'.QuickFW_Router::CONTROLLERS_DIR.'/'.$class;
require APPPATH.'/'.$file.'.php';
return true;
}
diff --git a/QFW/QuickFW/Router.php b/QFW/QuickFW/Router.php
index de70c54..4ad2f98 100644
--- a/QFW/QuickFW/Router.php
+++ b/QFW/QuickFW/Router.php
@@ -16,6 +16,11 @@ class QuickFW_Router
*/
const PATH_SEPARATOR = '/';
+ /**
+ * @var string Папка контроллеров в модуле
+ */
+ const CONTROLLERS_DIR = 'controllers';
+
protected $classes=array();
protected $baseDir;
@@ -440,7 +445,7 @@ SREG;
$path = $this->baseDir.'/'.$MCA['Module'];
QFW::$view->setScriptPath($path.'/templates');
$class = ucfirst($MCA['Controller']).'Controller';
- $fullname = $path . '/controllers/' . strtr($class,'_','/') . '.php';
+ $fullname = $path . '/' . self::CONTROLLERS_DIR . '/' .strtr($class,'_','/') . '.php';
require_once($fullname);
$class_key=$MCA['Module'].'|'.$MCA['Controller'];
if (!isset($this->classes[$class_key]))
@@ -455,7 +460,7 @@ SREG;
$MCA = array();
//Определяем модуль
- if (isset($data[0]) && (is_dir($this->baseDir . '/' . $data[0])))
+ if (isset($data[0]) && (is_dir($this->baseDir . '/' . $data[0] . '/' . self::CONTROLLERS_DIR . '/')))
$MCA['Module'] = array_shift($data);
else
$MCA['Module'] = $type=='Block' ? $this->curModule : $this->defM;
@@ -469,7 +474,7 @@ SREG;
$cname = isset($data[0]) ? $data[0] : ($type=='Block' ? $this->curController : $this->defC);
$class = ucfirst($cname).'Controller';
- $fullname = $path . '/controllers/' . strtr($class,'_','/') . '.php';
+ $fullname = $path . '/' . self::CONTROLLERS_DIR . '/' . strtr($class,'_','/') . '.php';
if (is_file($fullname))
array_shift($data);
@@ -477,7 +482,7 @@ SREG;
{
$cname = $type=='Block' ? $this->curController : $this->defC;
$class = ucfirst($cname).'Controller';
- $fullname = $path . '/controllers/' . $class . '.php';
+ $fullname = $path . '/' . self::CONTROLLERS_DIR . '/' . $class . '.php';
if (!is_file($fullname))
{
$MCA['Error']="не найден файл \t\t\t".$fullname."\nФайл не найден, твою дивизию...";
diff --git a/doc/asciidoc/mvc.txt b/doc/asciidoc/mvc.txt
index 16f5f78..5190b8a 100644
--- a/doc/asciidoc/mvc.txt
+++ b/doc/asciidoc/mvc.txt
@@ -4,13 +4,15 @@ MVC и преобразование адресов в контроллеры
Рассмотрим разбор URI при запросе:
По умолчанию разделителем компонентов является +/+, однако помимо него можно указать произвольный символ.
-Это бывает полезно в случае, если сайт пишется не с нуля, а используются шаблоны с относительной адресацией и весь сайт находится на одном уровне, тем самым можно использовать старые шаблоны, пока адреса не изменятся.
+Это бывает полезно в случае, если сайт пишется не с нуля, а используются шаблоны с относительной адресацией и весь сайт находится на одном уровне,
+тем самым можно использовать старые шаблоны, пока адреса не изменятся.
При разборе адреса он разбивается на компоненты и они анализируются по очереди. Рассмотрим компоненты адреса:
module/controller/action/p1/p2/p3
- * Первым идет модуль - в папке +application+ ищется папка с именем модуля, если же ее нет, то выбирается модуль по умолчанию (+default+).
+ * Первым идет модуль - в папке +application+ ищется папка с именем модуля, содержащая папку +controllers+ (+QuickFW_Router::CONTROLLERS_DIR+),
+ если же ее нет, то выбирается модуль по умолчанию (+default+).
* Контроллер - в текущем модуле в папке +controllers+ проверяется наличие файла +NameСontroller+, если его нет, то используется файл +IndexСontroller+.
* После подключения файла контроллера проверяется наличие класса +NameСontroller+, а если его нет, то проверяется его наличие в пространстве имен с именем модуля.
* Если класс не найден, а файл существует, то выводится сообщение об ошибке.
@@ -22,6 +24,8 @@ MVC и преобразование адресов в контроллеры
отправлены на действие по умолчанию (+default/index/index+), однако есть опция +$config[\'QFW'][\'auto404']+, и если она установлена,
то на все запросы пришедшие на действие по умолчанию кромя запроса к корню будет выдана страница 404.
+Если в папке, находящейся в +application+ нету папки +controllers+, то она не считается модулем.
+
Несколько примеров.
.Разбор обычного URI вызванного через http
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 3 +-
QFW/Init.php | 31 ++++++++++-
QFW/QuickFW/Autoload.php | 4 +-
QFW/QuickFW/Router.php | 13 +++-
doc/asciidoc/mvc.txt | 8 ++-
lib/Sitemap.php | 137 ++++++++++++++++++++++++++++++++++++++++++++++
lib/XMPPHP/XMPP.php | 7 ++-
7 files changed, 192 insertions(+), 11 deletions(-)
create mode 100644 lib/Sitemap.php
hooks/post-receive
--
quickfw
|