Browse Source

No newline at end of file #0

git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@106 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
master
aterekhov 15 years ago
parent
commit
4d493cc579
  1. 2
      classes/Action.class.php
  2. 2
      classes/Cache.class.php
  3. 2
      classes/DBConnector.class.php
  4. 10
      classes/Decorator.class.php
  5. 10
      classes/DynamicPageException.class.php
  6. 2
      classes/Env.class.php
  7. 6
      classes/Format.class.php
  8. 12
      classes/Load.class.php
  9. 2
      classes/MJException.class.php
  10. 26
      classes/Mailer.class.php
  11. 2
      classes/Model.class.php
  12. 8
      classes/PageController.class.php
  13. 26
      classes/Pager.class.php
  14. 2
      classes/Router.class.php
  15. 10
      classes/StaticPageException.class.php
  16. 2
      classes/Sublimer.class.php
  17. 2
      classes/pg_DBConnector.class.php
  18. 2
      init/init.inc.php
  19. 2
      init/sys.inc.php

2
classes/Action.class.php

@ -106,4 +106,4 @@ abstract class Action
} }
} }
} }
?>
?>

2
classes/Cache.class.php

@ -133,4 +133,4 @@ final class Cache
} }
} }
?>
?>

2
classes/DBConnector.class.php

@ -156,4 +156,4 @@ class DBConnector
return mysqli_rollback($handler); return mysqli_rollback($handler);
} }
} }
?>
?>

10
classes/Decorator.class.php

@ -1,12 +1,12 @@
<?php <?php
/** /**
* Родительский класс для всех декораторов. Содержит основной функционал.
* Родительский класс для всех декораторов. Содержит основной функционал.
* *
* @copyright NetMonsters <team@netmonsters.ru>
* @link
* @copyright NetMonsters <team@netmonsters.ru>
* @link
* @package Majestic * @package Majestic
* @subpackage Decorator * @subpackage Decorator
* @since
* @since
* @version SVN: $Id$ * @version SVN: $Id$
* @filesource $URL$ * @filesource $URL$
*/ */
@ -59,4 +59,4 @@ abstract class Decorator
*/ */
abstract function exec(); abstract function exec();
} }
?>
?>

10
classes/DynamicPageException.class.php

@ -1,16 +1,16 @@
<?php <?php
/** /**
* Эксепшен для выводя результата работы класса
* Эксепшен для выводя результата работы класса
* *
* @copyright NetMonsters <team@netmonsters.ru>
* @link
* @copyright NetMonsters <team@netmonsters.ru>
* @link
* @package Majestic * @package Majestic
* @subpackage Core * @subpackage Core
* @since
* @since
* @version SVN: $Id$ * @version SVN: $Id$
* @filesource $URL$ * @filesource $URL$
*/ */
class DynamicPageException extends Exception class DynamicPageException extends Exception
{} {}
?>
?>

2
classes/Env.class.php

@ -88,4 +88,4 @@ final class Env
return $param ? $res[$param] : $res; return $param ? $res[$param] : $res;
} }
} }
?>
?>

6
classes/Format.class.php

@ -191,7 +191,7 @@ class Format
} }
return ''; return '';
} }
/** /**
* Байты в мегабайты * Байты в мегабайты
* @param int $bytes * @param int $bytes
@ -202,7 +202,7 @@ class Format
$mb = number_format((int) $bytes / 1024 / 1024, 2, '.', ''); $mb = number_format((int) $bytes / 1024 / 1024, 2, '.', '');
return preg_replace("/(\.?)0+$/", "", $mb) . 'МБ'; return preg_replace("/(\.?)0+$/", "", $mb) . 'МБ';
} }
/** /**
* Байты в килобайты * Байты в килобайты
* @param int $bytes * @param int $bytes
@ -219,4 +219,4 @@ class Format
* Оффсет с учетом летнего/зимнего времени * Оффсет с учетом летнего/зимнего времени
*/ */
Format::setTimezoneOffset(date('Z') - ((date('I') ? 60*60 : 0 ))); Format::setTimezoneOffset(date('Z') - ((date('I') ? 60*60 : 0 )));
?>
?>

12
classes/Load.class.php

@ -1,12 +1,12 @@
<?php <?php
/** /**
*
* *
* @copyright NetMonsters <team@netmonsters.ru>
* @link
*
* @copyright NetMonsters <team@netmonsters.ru>
* @link
* @package Majestic * @package Majestic
* @subpackage Load * @subpackage Load
* @since
* @since
* @version SVN: $Id$ * @version SVN: $Id$
* @filesource $URL$ * @filesource $URL$
*/ */
@ -21,7 +21,7 @@ class Load
if (isset(self::$models[$model_name])) { if (isset(self::$models[$model_name])) {
return self::$models[$model_name]; return self::$models[$model_name];
} }
$class_name = $model_name.MODEL_POSTFIX; $class_name = $model_name.MODEL_POSTFIX;
return self::$models[$model_name] = new $class_name; return self::$models[$model_name] = new $class_name;
} }
@ -42,4 +42,4 @@ class Load
return self::$router ? self::$router : self::$router = new Router; return self::$router ? self::$router : self::$router = new Router;
} }
} }
?>
?>

2
classes/MJException.class.php

@ -63,4 +63,4 @@ class MJException extends Exception
return $return . '</table>'; return $return . '</table>';
} }
} }
?>
?>

26
classes/Mailer.class.php

@ -1,12 +1,12 @@
<?php <?php
/** /**
* Класс для отправки почты * Класс для отправки почты
*
* @copyright NetMonsters <team@netmonsters.ru>
*
* @copyright NetMonsters <team@netmonsters.ru>
* @link http://netmonsters.ru * @link http://netmonsters.ru
* @package Core * @package Core
* @subpackage mail * @subpackage mail
* @since
* @since
* @version SVN: $Id$ * @version SVN: $Id$
* @filesource $URL$ * @filesource $URL$
*/ */
@ -18,16 +18,16 @@ class Mailer
public $templater; public $templater;
public $headers; public $headers;
protected $host; protected $host;
function __construct($host, $template = null)
function __construct($host, $template = null)
{ {
if ($template !== null) { if ($template !== null) {
$this->templater = Load::templater(ACTION_TPL_PATH . '/' . $this->template_dir); $this->templater = Load::templater(ACTION_TPL_PATH . '/' . $this->template_dir);
$this->template = $template; $this->template = $template;
} }
$this->host = $host; $this->host = $host;
$this->headers .= 'From: robot@' . $this->host . "\r\n"; $this->headers .= 'From: robot@' . $this->host . "\r\n";
$this->headers .= 'Date: '. date('r') ."\r\n"; $this->headers .= 'Date: '. date('r') ."\r\n";
$this->headers .= "Return-Path: robot@". $this->host ."\r\n"; $this->headers .= "Return-Path: robot@". $this->host ."\r\n";
@ -43,7 +43,7 @@ class Mailer
/** /**
* Отправляет письма * Отправляет письма
*
*
* @param mixed $mail * @param mixed $mail
* @param mixed $subject * @param mixed $subject
* @param mixed $data * @param mixed $data
@ -51,19 +51,19 @@ class Mailer
function send ($mail, $subject, $data) function send ($mail, $subject, $data)
{ {
$this->headers .= "To: ".$mail."\r\n"; $this->headers .= "To: ".$mail."\r\n";
foreach ($data as $key => $val) { foreach ($data as $key => $val) {
$this->templater->assign($key, $val); $this->templater->assign($key, $val);
} }
$message = $this->templater->fetch($this->template.'.tpl'); $message = $this->templater->fetch($this->template.'.tpl');
$encoded_subject = '=?UTF-8?B?' . base64_encode($subject) . "?=\r\n"; $encoded_subject = '=?UTF-8?B?' . base64_encode($subject) . "?=\r\n";
return mail($mail, $subject, $message, $this->headers); return mail($mail, $subject, $message, $this->headers);
} }
/** /**
* Отправка письма с непосредственным указанием контента * Отправка письма с непосредственным указанием контента
*
*
* @param string $email * @param string $email
* @param string $subject * @param string $subject
* @param string $content * @param string $content
@ -75,4 +75,4 @@ class Mailer
return mail($email, $encoded_subject, $content, $this->headers); return mail($email, $encoded_subject, $content, $this->headers);
} }
} }
?>
?>

2
classes/Model.class.php

@ -250,4 +250,4 @@ class ModelInsertResult extends ModelChangeResult
return $this->id; return $this->id;
} }
} }
?>
?>

8
classes/PageController.class.php

@ -12,16 +12,16 @@
*/ */
class PageController class PageController
{ {
/** /**
* Действия на инициализацию. * Действия на инициализацию.
*
*
*/ */
protected function init() {} protected function init() {}
/** /**
* Действия после разбора роута. * Действия после разбора роута.
*
*
*/ */
protected function onDispatch() {} protected function onDispatch() {}
@ -57,4 +57,4 @@ class PageController
} }
} }
} }
?>
?>

26
classes/Pager.class.php

@ -13,55 +13,55 @@
class Pager extends Action class Pager extends Action
{
{
public $template_dir = '.'; public $template_dir = '.';
protected $current_page = 1; protected $current_page = 1;
protected $max_page_num; protected $max_page_num;
protected $num_rows; protected $num_rows;
protected $limit; protected $limit;
protected $start_offset = 0; protected $start_offset = 0;
protected $count = 0; protected $count = 0;
public function __construct($count, $current_page = 1, $records_limit = 20) public function __construct($count, $current_page = 1, $records_limit = 20)
{ {
parent::__construct(); parent::__construct();
$this->count = $count; $this->count = $count;
$this->limit = $records_limit; $this->limit = $records_limit;
$this->max_page_num = ceil($this->count/$this->limit); $this->max_page_num = ceil($this->count/$this->limit);
$this->current_page = ((int)$current_page <= $this->max_page_num && (int)$current_page > 0) ? (int)$current_page : 1; $this->current_page = ((int)$current_page <= $this->max_page_num && (int)$current_page > 0) ? (int)$current_page : 1;
$this->start_offset = $this->limit * ($this->current_page - 1); $this->start_offset = $this->limit * ($this->current_page - 1);
$this->num_rows = ($this->limit + $this->start_offset) <= $this->count ? ($this->limit + $this->start_offset) : $this->count; $this->num_rows = ($this->limit + $this->start_offset) <= $this->count ? ($this->limit + $this->start_offset) : $this->count;
} }
/** /**
* Возвращает текущую страницу * Возвращает текущую страницу
*
*
* @return int * @return int
*/ */
public function getPage() public function getPage()
{ {
return $this->current_page; return $this->current_page;
} }
public function startOffset() public function startOffset()
{ {
return $this->start_offset; return $this->start_offset;
} }
public function limit() public function limit()
{ {
return $this->limit; return $this->limit;
} }
public function setNumRows($num_rows) public function setNumRows($num_rows)
{ {
$this->num_rows = $num_rows; $this->num_rows = $num_rows;
} }
function init() function init()
{ {
$this->template = "Pager"; $this->template = "Pager";
@ -75,4 +75,4 @@ class Pager extends Action
$this->templater->assign('count', $this->count); $this->templater->assign('count', $this->count);
} }
} }
?>
?>

2
classes/Router.class.php

@ -128,4 +128,4 @@ final class Route
return true; return true;
} }
} }
?>
?>

10
classes/StaticPageException.class.php

@ -1,13 +1,13 @@
<?php <?php
/** /**
* Эксепшен для вывода статических шаблонов
* Эксепшен для вывода статических шаблонов
* *
* @copyright NetMonsters <team@netmonsters.ru>
* @link
* @copyright NetMonsters <team@netmonsters.ru>
* @link
* @package Majestic * @package Majestic
* @subpackage Core * @subpackage Core
* @since
* @since
* @version SVN: $Id$ * @version SVN: $Id$
* @filesource $URL$ * @filesource $URL$
*/ */
@ -15,4 +15,4 @@ class StaticPageException extends Exception
{ {
} }
?>
?>

2
classes/Sublimer.class.php

@ -172,4 +172,4 @@ final class Sublimer
} }
?>
?>

2
classes/pg_DBConnector.class.php

@ -107,4 +107,4 @@ class DBConnector
throw new MJException('Rollback disabled for postgreSQL Connector' ,1); throw new MJException('Rollback disabled for postgreSQL Connector' ,1);
} }
} }
?>
?>

2
init/init.inc.php

@ -25,4 +25,4 @@ require(CONFIG_PATH.'/routers.inc.php');
define('E_404', 404); define('E_404', 404);
define('E_403', 403); define('E_403', 403);
?>
?>

2
init/sys.inc.php

@ -97,4 +97,4 @@ function __autoload($name)
require(LIB_PATH.'/'.$name.'.lib.php'); require(LIB_PATH.'/'.$name.'.lib.php');
} }
} }
?>
?>
Loading…
Cancel
Save