Костяк оформления.
This commit is contained in:
parent
c43ba59151
commit
a0877cde9f
21
.htaccess
Normal file
21
.htaccess
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# Turn on URL rewriting
|
||||||
|
RewriteEngine On
|
||||||
|
|
||||||
|
# Installation directory
|
||||||
|
RewriteBase /
|
||||||
|
|
||||||
|
# Protect hidden files from being viewed
|
||||||
|
<Files .*>
|
||||||
|
Order Deny,Allow
|
||||||
|
Deny From All
|
||||||
|
</Files>
|
||||||
|
|
||||||
|
# Protect application and system files from being viewed
|
||||||
|
RewriteRule ^(?:application|modules|system)\b - [F,L]
|
||||||
|
|
||||||
|
# Allow any files or directories that exist to be displayed directly
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
|
||||||
|
# Rewrite all other URLs to index.php/URL
|
||||||
|
RewriteRule .* index.php/$0 [PT]
|
|
@ -22,7 +22,7 @@ else
|
||||||
* @see http://kohanaframework.org/guide/using.configuration
|
* @see http://kohanaframework.org/guide/using.configuration
|
||||||
* @see http://php.net/timezones
|
* @see http://php.net/timezones
|
||||||
*/
|
*/
|
||||||
date_default_timezone_set('America/Chicago');
|
date_default_timezone_set('Asia/Novosibirsk');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the default locale.
|
* Set the default locale.
|
||||||
|
@ -30,7 +30,7 @@ date_default_timezone_set('America/Chicago');
|
||||||
* @see http://kohanaframework.org/guide/using.configuration
|
* @see http://kohanaframework.org/guide/using.configuration
|
||||||
* @see http://php.net/setlocale
|
* @see http://php.net/setlocale
|
||||||
*/
|
*/
|
||||||
setlocale(LC_ALL, 'en_US.utf-8');
|
setlocale(LC_ALL, 'ru_RU.utf-8');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable the Kohana auto-loader.
|
* Enable the Kohana auto-loader.
|
||||||
|
@ -53,7 +53,7 @@ ini_set('unserialize_callback_func', 'spl_autoload_call');
|
||||||
/**
|
/**
|
||||||
* Set the default language
|
* Set the default language
|
||||||
*/
|
*/
|
||||||
I18n::lang('en-us');
|
I18n::lang('ru');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
|
* Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
|
||||||
|
@ -80,7 +80,9 @@ if (isset($_SERVER['KOHANA_ENV']))
|
||||||
* - boolean caching enable or disable internal caching FALSE
|
* - boolean caching enable or disable internal caching FALSE
|
||||||
*/
|
*/
|
||||||
Kohana::init(array(
|
Kohana::init(array(
|
||||||
'base_url' => '/',
|
'base_url' => '/',
|
||||||
|
'index_file' => FALSE,
|
||||||
|
'errors' => TRUE
|
||||||
));
|
));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,12 +99,12 @@ Kohana::$config->attach(new Config_File);
|
||||||
* Enable modules. Modules are referenced by a relative or absolute path.
|
* Enable modules. Modules are referenced by a relative or absolute path.
|
||||||
*/
|
*/
|
||||||
Kohana::modules(array(
|
Kohana::modules(array(
|
||||||
// 'auth' => MODPATH.'auth', // Basic authentication
|
'auth' => MODPATH.'auth', // Basic authentication
|
||||||
// 'cache' => MODPATH.'cache', // Caching with multiple backends
|
// 'cache' => MODPATH.'cache', // Caching with multiple backends
|
||||||
// 'codebench' => MODPATH.'codebench', // Benchmarking tool
|
// 'codebench' => MODPATH.'codebench', // Benchmarking tool
|
||||||
// 'database' => MODPATH.'database', // Database access
|
'database' => MODPATH.'database', // Database access
|
||||||
// 'image' => MODPATH.'image', // Image manipulation
|
// 'image' => MODPATH.'image', // Image manipulation
|
||||||
// 'orm' => MODPATH.'orm', // Object Relationship Mapping
|
'orm' => MODPATH.'orm', // Object Relationship Mapping
|
||||||
// 'unittest' => MODPATH.'unittest', // Unit testing
|
// 'unittest' => MODPATH.'unittest', // Unit testing
|
||||||
// 'userguide' => MODPATH.'userguide', // User guide and API documentation
|
// 'userguide' => MODPATH.'userguide', // User guide and API documentation
|
||||||
));
|
));
|
||||||
|
@ -113,6 +115,6 @@ Kohana::modules(array(
|
||||||
*/
|
*/
|
||||||
Route::set('default', '(<controller>(/<action>(/<id>)))')
|
Route::set('default', '(<controller>(/<action>(/<id>)))')
|
||||||
->defaults(array(
|
->defaults(array(
|
||||||
'controller' => 'welcome',
|
'controller' => 'login',
|
||||||
'action' => 'index',
|
'action' => 'view',
|
||||||
));
|
));
|
||||||
|
|
10
application/classes/controller/footer.php
Normal file
10
application/classes/controller/footer.php
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?php defined('SYSPATH') or die('No direct script access.');
|
||||||
|
|
||||||
|
class Controller_Footer extends Controller_Template {
|
||||||
|
public $template = 'footer';
|
||||||
|
public function action_standard() {
|
||||||
|
$this->template->years = Kohana::config('common.this_year');
|
||||||
|
if (date('Y') > Kohana::config('common.this_year')) $this->template->years = Kohana::config('common.this_year') . date('-Y');
|
||||||
|
}
|
||||||
|
public function action_view(){$this->request->redirect('');}
|
||||||
|
}
|
27
application/classes/controller/header.php
Normal file
27
application/classes/controller/header.php
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<?php defined('SYSPATH') or die('No direct script access.');
|
||||||
|
|
||||||
|
class Controller_Header extends Controller_Template {
|
||||||
|
public $template = 'header';
|
||||||
|
public function action_standard() {
|
||||||
|
$this->template->title = $this->request->post('title');
|
||||||
|
$styles = $this->request->post('styles');
|
||||||
|
$scripts = $this->request->post('scripts');
|
||||||
|
$temp = "";
|
||||||
|
if (is_array($styles)){
|
||||||
|
foreach($styles as $style=>$media):
|
||||||
|
if ($media != 'screen' and $media != 'print'){
|
||||||
|
$style=$media;
|
||||||
|
$media="screen";
|
||||||
|
}
|
||||||
|
$temp .= '<link rel="stylesheet" type="text/css" media="'. $media .'" href="'.URL::site('assets/css/'.$style).'">'."\n";
|
||||||
|
endforeach;
|
||||||
|
$this->template->styles = $temp;
|
||||||
|
}
|
||||||
|
else $this->template->styles = '<link rel="stylesheet" type="text/css" media="screen" href="'.URL::site('assets/css/'.$styles)."\">\n";
|
||||||
|
if (is_array($scripts)) foreach($scripts as $script):
|
||||||
|
$temp .= '<script type="text/javascript" charset="utf-8" src="'.URL::site('assets/javascript/'.$script).'"></script>'."\n";
|
||||||
|
endforeach;
|
||||||
|
$this->template->scripts = $temp;
|
||||||
|
}
|
||||||
|
public function action_view(){$this->request->redirect('');}
|
||||||
|
}
|
20
application/classes/controller/login.php
Normal file
20
application/classes/controller/login.php
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<?php defined('SYSPATH') or die('No direct script access.');
|
||||||
|
|
||||||
|
class Controller_Login extends Controller_Template {
|
||||||
|
public $template = 'login';
|
||||||
|
public function action_view() {
|
||||||
|
if(Auth::instance()->logged_in()){
|
||||||
|
if (Auth::instance()->logged_in(array('admin')) === FALSE) return $this->request->redirect('events/view');
|
||||||
|
return $this->request->redirect('overview/view');
|
||||||
|
}
|
||||||
|
if ($_POST){
|
||||||
|
$user = ORM::factory('user');
|
||||||
|
$status = Auth::instance()->login($_POST['login'], $_POST['password']);
|
||||||
|
if ($status){
|
||||||
|
if (Auth::instance()->logged_in(array('admin')) === FALSE) return $this->request->redirect('events/view');
|
||||||
|
return $this->request->redirect('overview/view');
|
||||||
|
}
|
||||||
|
else $this->template->error = "Неверный логин или пароль.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
8
application/classes/controller/logout.php
Normal file
8
application/classes/controller/logout.php
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?php defined('SYSPATH') or die('No direct script access.');
|
||||||
|
|
||||||
|
class Controller_Logout extends Controller {
|
||||||
|
public function action_view() {
|
||||||
|
if (Auth::instance()->logout()) return $this->request->redirect('login');
|
||||||
|
else $this->template->error = "Ошибка выхода пользователя.";
|
||||||
|
}
|
||||||
|
}
|
19
application/classes/controller/navigation.php
Normal file
19
application/classes/controller/navigation.php
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<?php defined('SYSPATH') or die('No direct script access.');
|
||||||
|
|
||||||
|
class Controller_Navigation extends Controller_Template {
|
||||||
|
public $template = 'navigation/actions';
|
||||||
|
public function action_actions() {
|
||||||
|
$this->template = new View('navigation/actions');
|
||||||
|
$this->template->login_or_logout = HTML::anchor('login', 'Вход');
|
||||||
|
if (Auth::instance()->logged_in()){
|
||||||
|
$this->template->login_or_logout = HTML::anchor('logout', 'Выход');
|
||||||
|
}
|
||||||
|
if (Auth::instance()->logged_in('admin')){
|
||||||
|
$this->template->admin_actions = View::factory('navigation/admin')->render();
|
||||||
|
}
|
||||||
|
if (Auth::instance()->logged_in('user') or Auth::instance()->logged_in('superuser') or Auth::instance()->logged_in('admin')){
|
||||||
|
$user_actions = View::factory('navigation/user')->render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function action_view(){$this->request->redirect('');}
|
||||||
|
}
|
16
application/config/auth.php
Normal file
16
application/config/auth.php
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||||
|
|
||||||
|
return array(
|
||||||
|
|
||||||
|
'driver' => 'ORM',
|
||||||
|
'hash_method' => 'sha256',
|
||||||
|
'hash_key' => "3wj88uew hello uwri88 dshnber riweuri",
|
||||||
|
'lifetime' => 1209600,
|
||||||
|
'session_key' => 'auth_user',
|
||||||
|
|
||||||
|
// Username/password combinations for the Auth File driver
|
||||||
|
'users' => array(
|
||||||
|
// 'admin' => 'b3154acf3a344170077d11bdb5fff31532f679a1919e716a02',
|
||||||
|
),
|
||||||
|
|
||||||
|
);
|
6
application/config/common.php
Normal file
6
application/config/common.php
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?php defined('SYSPATH') OR die('No direct access allowed.');
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'this_year' => "2011",
|
||||||
|
'title' => "Конкурс быстрого программирования «Поихаил!»"
|
||||||
|
);
|
31
application/config/database.php
Normal file
31
application/config/database.php
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||||
|
|
||||||
|
return array
|
||||||
|
(
|
||||||
|
'default' => array
|
||||||
|
(
|
||||||
|
'type' => 'mysql',
|
||||||
|
'connection' => array(
|
||||||
|
/**
|
||||||
|
* The following options are available for MySQL:
|
||||||
|
*
|
||||||
|
* string hostname server hostname, or socket
|
||||||
|
* string database database name
|
||||||
|
* string username database username
|
||||||
|
* string password database password
|
||||||
|
* boolean persistent use persistent connections?
|
||||||
|
*
|
||||||
|
* Ports and sockets may be appended to the hostname.
|
||||||
|
*/
|
||||||
|
'hostname' => 'localhost',
|
||||||
|
'database' => 'nemove',
|
||||||
|
'username' => 'dandelion',
|
||||||
|
'password' => '',
|
||||||
|
'persistent' => FALSE,
|
||||||
|
),
|
||||||
|
'table_prefix' => '',
|
||||||
|
'charset' => 'utf8',
|
||||||
|
'caching' => FALSE,
|
||||||
|
'profiling' => TRUE,
|
||||||
|
),
|
||||||
|
);
|
4
application/views/error.php
Normal file
4
application/views/error.php
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<?php echo Request::factory('header/standard')->post('title',$title)->post('styles','main.css')->execute() ?>
|
||||||
|
<h1><?php echo $title?></h1>
|
||||||
|
<p><?php echo $description?></p>
|
||||||
|
<?php echo Request::factory('footer/standard')->execute() ?>
|
5
application/views/footer.php
Normal file
5
application/views/footer.php
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
</div>
|
||||||
|
<div id="footer">Наши конкурсы -- самые быстрые конкурсы! Не доверяйте подделкам!<!--<?php echo $years ?>--></div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
17
application/views/header.php
Normal file
17
application/views/header.php
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title><?php echo $title ?></title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<?php echo $styles ?>
|
||||||
|
<?php echo $scripts ?>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="main_container">
|
||||||
|
<div id="header">
|
||||||
|
<h1><?php echo Kohana::config('common.title')?></h1>
|
||||||
|
</div>
|
||||||
|
<div id="menu">
|
||||||
|
<?php echo Request::factory('navigation/actions')->execute() ?>
|
||||||
|
</div>
|
||||||
|
<div id="column_text">
|
12
application/views/login.php
Normal file
12
application/views/login.php
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?php echo Request::factory('header/standard')->post('title',"Вход в систему")->post('styles','main.css')->execute() ?>
|
||||||
|
|
||||||
|
<div id="error"><?php if(!empty($error)) echo $error;?></div>
|
||||||
|
<div id="message"><?php if(!empty($message)) echo $message;?></div>
|
||||||
|
<p>Введите логин и пароль для получения доступа к разделу.</p>
|
||||||
|
<?php echo form::open('login') ?>
|
||||||
|
<p><?php echo form::label('login','Логин: '); echo form::input('login','') ?></p>
|
||||||
|
<p><?php echo form::label('password','Пароль: '); echo form::password('password','') ?></p>
|
||||||
|
<p><?php echo form::submit('submit','Отправить') ?>
|
||||||
|
</p>
|
||||||
|
<?php echo form::close() ?>
|
||||||
|
<?php echo Request::factory('footer/standard')->execute() ?>
|
5
application/views/navigation/actions.php
Normal file
5
application/views/navigation/actions.php
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<ul>
|
||||||
|
<?php if (isset($admin_actions)) echo $admin_actions;?>
|
||||||
|
<?php if (isset($user_actions)) echo $user_actions; ?>
|
||||||
|
<li><?php echo $login_or_logout; ?></li>
|
||||||
|
</ul>
|
1
application/views/navigation/admin.php
Normal file
1
application/views/navigation/admin.php
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<li><?php echo HTML::anchor('users', 'Пользователи'); ?></li>
|
0
application/views/navigation/user.php
Normal file
0
application/views/navigation/user.php
Normal file
45
assets/css/main.css
Normal file
45
assets/css/main.css
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
body{
|
||||||
|
margin: 20px;
|
||||||
|
padding: 0;
|
||||||
|
font-family: "FreeSans", "Arial", sans-serif;
|
||||||
|
color: #000000;
|
||||||
|
background: #ffffff;
|
||||||
|
}
|
||||||
|
h1, h2, h3, h4, h5, h6{
|
||||||
|
margin: 0 0 1em;
|
||||||
|
line-height: 1.1;
|
||||||
|
}
|
||||||
|
#header h1{
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
p { margin: 0 0 1em; }
|
||||||
|
img { border: none; }
|
||||||
|
#main_container{
|
||||||
|
clear:left;
|
||||||
|
margin: 1em 5%;
|
||||||
|
}
|
||||||
|
#header{
|
||||||
|
text-align: center;
|
||||||
|
border-bottom: 1px solid #333;
|
||||||
|
}
|
||||||
|
#menu{
|
||||||
|
float: right;
|
||||||
|
width: 160px;
|
||||||
|
margin-right: 10px;
|
||||||
|
padding-top: 1em;
|
||||||
|
}
|
||||||
|
#column_text{
|
||||||
|
padding-top: 1em;
|
||||||
|
margin: 0 200px 0 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer{
|
||||||
|
clear: both;
|
||||||
|
margin-top: 1em;
|
||||||
|
text-align: right;
|
||||||
|
border-top: 1px solid #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden{
|
||||||
|
display: none;
|
||||||
|
}
|
Reference in a new issue