oreolek
/
onemove
Archived
1
0
Fork 0

Костяк оформления.

This commit is contained in:
Alexander Yakovlev 2011-06-27 17:22:08 +07:00
parent c43ba59151
commit a0877cde9f
18 changed files with 258 additions and 9 deletions

21
.htaccess Normal file
View 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]

View File

@ -22,7 +22,7 @@ else
* @see http://kohanaframework.org/guide/using.configuration
* @see http://php.net/timezones
*/
date_default_timezone_set('America/Chicago');
date_default_timezone_set('Asia/Novosibirsk');
/**
* Set the default locale.
@ -30,7 +30,7 @@ date_default_timezone_set('America/Chicago');
* @see http://kohanaframework.org/guide/using.configuration
* @see http://php.net/setlocale
*/
setlocale(LC_ALL, 'en_US.utf-8');
setlocale(LC_ALL, 'ru_RU.utf-8');
/**
* Enable the Kohana auto-loader.
@ -53,7 +53,7 @@ ini_set('unserialize_callback_func', 'spl_autoload_call');
/**
* Set the default language
*/
I18n::lang('en-us');
I18n::lang('ru');
/**
* 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
*/
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.
*/
Kohana::modules(array(
// 'auth' => MODPATH.'auth', // Basic authentication
'auth' => MODPATH.'auth', // Basic authentication
// 'cache' => MODPATH.'cache', // Caching with multiple backends
// 'codebench' => MODPATH.'codebench', // Benchmarking tool
// 'database' => MODPATH.'database', // Database access
'database' => MODPATH.'database', // Database access
// 'image' => MODPATH.'image', // Image manipulation
// 'orm' => MODPATH.'orm', // Object Relationship Mapping
'orm' => MODPATH.'orm', // Object Relationship Mapping
// 'unittest' => MODPATH.'unittest', // Unit testing
// 'userguide' => MODPATH.'userguide', // User guide and API documentation
));
@ -113,6 +115,6 @@ Kohana::modules(array(
*/
Route::set('default', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'controller' => 'welcome',
'action' => 'index',
'controller' => 'login',
'action' => 'view',
));

View 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('');}
}

View 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('');}
}

View 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 = "Неверный логин или пароль.";
}
}
}

View 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 = "Ошибка выхода пользователя.";
}
}

View 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('');}
}

View 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',
),
);

View File

@ -0,0 +1,6 @@
<?php defined('SYSPATH') OR die('No direct access allowed.');
return array(
'this_year' => "2011",
'title' => "Конкурс быстрого программирования «Поихаил!»"
);

View 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,
),
);

View 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() ?>

View File

@ -0,0 +1,5 @@
</div>
<div id="footer">Наши конкурсы -- самые быстрые конкурсы! Не доверяйте подделкам!<!--<?php echo $years ?>--></div>
</div>
</body>
</html>

View 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">

View 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() ?>

View 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>

View File

@ -0,0 +1 @@
<li><?php echo HTML::anchor('users', 'Пользователи'); ?></li>

View File

45
assets/css/main.css Normal file
View 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;
}