Skip to content

Commit

Permalink
Добавлены комментарии к коду
Browse files Browse the repository at this point in the history
  • Loading branch information
zombiQWERTY committed May 11, 2014
1 parent 045621a commit 2446a23
Show file tree
Hide file tree
Showing 15 changed files with 550 additions and 84 deletions.
67 changes: 65 additions & 2 deletions application/classes/config.class.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,77 @@
<?
/**
* SimpleMVC
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package SimpleMVC
* @author zombiQWERTY
* @copyright Copyright (c) 2014, zombiQWERTY
* @link http://zombiqwerty.ru/simplemvc/
* @since Version 1.0
*/

// ------------------------------------------------------------------------

/**
* Config file with default settings
*
* @package SimpleMVC
* @category Back-controller
* @author zombiQWERTY
* @link http://zombiqwerty.ru/simplemvc/
*/

class Config {


/**
* Set the index controller of your app. Can not be 'index'
* Устанавливает главный контроллер Вашего приложения. Не может быть 'index'
*/
public static $indexPage = 'main';

/**
* Set the layout of your app
* Устанавливает шаблон Вашего приложения
*/
public static $layout = 'default';



/**
* Switch on/off work with db
* Включает/выключает работу с базой данных
*/
public static $db = true;

/**
* Set the db connect host
* Устанавливает хост для соединения с базой данных
*/
public static $host = 'localhost';

/**
* Set the db connect username
* Устанавливает логин для соединения с базой данных
*/
public static $user = 'root';

/**
* Set the db connect password
* Устанавливает пароль для соединения с базой данных
*/
public static $password = 'zvezda';

/**
* Set the database for work with db
* Устанавливает таблицу для работы с базой данных
*/
public static $database = 'simpleMVC';

/**
* Set the db connect charset
* Устанавливает кодировку для соединения с базой данных
*/
public static $charset = 'utf8';

}
?>
26 changes: 26 additions & 0 deletions application/classes/database.class.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
<?
/**
* SimpleMVC
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package SimpleMVC
* @author zombiQWERTY
* @copyright Copyright (c) 2014, zombiQWERTY
* @link http://zombiqwerty.ru/simplemvc/
* @since Version 1.0
*/

// ------------------------------------------------------------------------

/**
* Config db file with default settings
*
* @package SimpleMVC
* @category Back-controller
* @author zombiQWERTY
* @link http://zombiqwerty.ru/simplemvc/
*/

class Database {

/**
* Constructor
*/
function __construct() {
$connections = array(
'development' => 'mysql://'.Config::$user.':'.Config::$password.'@'.Config::$host.'/'.Config::$database.'?charset='.Config::$charset,
Expand Down
4 changes: 2 additions & 2 deletions application/mvc/views/errors/error404.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
<h1><?=$heading?></h1>
<?=$message?>
</div>
</body>
</html>
62 changes: 0 additions & 62 deletions application/mvc/views/errors/errorDB.php

This file was deleted.

4 changes: 2 additions & 2 deletions application/mvc/views/errors/errorGeneral.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
<h1><?=$heading?></h1>
<?=$message?>
</div>
</body>
</html>
8 changes: 4 additions & 4 deletions application/mvc/views/errors/errorPhp.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<h4>A PHP Error was encountered</h4>

<p>Severity: <?php echo $severity; ?></p>
<p>Message: <?php echo $message; ?></p>
<p>Filename: <?php echo $filepath; ?></p>
<p>Line Number: <?php echo $line; ?></p>
<p>Severity: <?=$severity?></p>
<p>Message: <?=$message?></p>
<p>Filename: <?=$filepath?></p>
<p>Line Number: <?=$line?></p>

</div>
54 changes: 53 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,71 @@
<?
/**
* SimpleMVC
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package SimpleMVC
* @author zombiQWERTY
* @copyright Copyright (c) 2014, zombiQWERTY
* @link http://zombiqwerty.ru/simplemvc/
* @since Version 1.0
*/

// ------------------------------------------------------------------------

/**
* Framework Initialization File
*
* @package SimpleMVC
* @category Back-controller
* @author zombiQWERTY
* @link http://zombiqwerty.ru/simplemvc/
*/

// ------------------------------------------------------------------------

/**
* Set header charset and Moscow locale
*/
header('Content-Type: text/html; charset=utf-8');
setlocale(LC_ALL, 'Russian_Russia.65001');

// ------------------------------------------------------------------------

/**
* Define useful consts for work
*/
define('BASE_URL', 'http://'.$_SERVER['HTTP_HOST']);
define('ROOT' , $_SERVER['DOCUMENT_ROOT']);
define('APPPATH' , ROOT.'/application/');
define('SYSPATH' , ROOT.'/system/');

require_once SYSPATH.'autoload.php';
// ------------------------------------------------------------------------

/**
* require needful files
*/
require_once SYSPATH.'autoload.php';
require_once SYSPATH.'exceptionHandler.php';

// ------------------------------------------------------------------------

/**
* Set handler for native php errors
*/
set_error_handler('exceptionHandler');

// ------------------------------------------------------------------------

/**
* Disable magic quotes
*/
if (!Common::isPhp('5.3')) @set_magic_quotes_runtime(0);

// ------------------------------------------------------------------------

/**
* Initialization the application
*/
new Application();
?>
31 changes: 31 additions & 0 deletions system/autoload.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,35 @@
<?
/**
* SimpleMVC
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package SimpleMVC
* @author zombiQWERTY
* @copyright Copyright (c) 2014, zombiQWERTY
* @link http://zombiqwerty.ru/simplemvc/
* @since Version 1.0
*/

// ------------------------------------------------------------------------

/**
* Autoload classes
*
* @package SimpleMVC
* @category Back-controller
* @author zombiQWERTY
* @link http://zombiqwerty.ru/simplemvc/
*/

// ------------------------------------------------------------------------

/**
* Get classes on the go
*
* @param string
* @return class
*/
spl_autoload_register(function($class) {
$paths = array(APPPATH.'classes/', SYSPATH.'classes/', APPPATH.'libraries/');

Expand Down
35 changes: 35 additions & 0 deletions system/classes/application.class.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,41 @@
<?
/**
* SimpleMVC
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package SimpleMVC
* @author zombiQWERTY
* @copyright Copyright (c) 2014, zombiQWERTY
* @link http://zombiqwerty.ru/simplemvc/
* @since Version 1.0
*/

// ------------------------------------------------------------------------

/**
* System Initialization File
*
* Loads the base classes and executes the request.
*
* @package SimpleMVC
* @category Front-controller
* @author zombiQWERTY
* @link http://zombiqwerty.ru/simplemvc/
*/

/**
* SimpleMVC Version
*
* @var string
*/
define('SM_VERSION', '2.0.1');

class Application {

/**
* Constructor
*/
public function __construct() {
if (Config::$db) {
require_once SYSPATH.'ActiveRecord/ActiveRecord.php';
Expand Down
Loading

0 comments on commit 2446a23

Please sign in to comment.