1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-08-11 15:45:07 +02:00

Add Monstra from HG Commit 683dcb70c4cc

This commit is contained in:
Awilum
2012-09-25 19:09:50 +03:00
parent d2db42b2bb
commit 4a5fea5f5b
251 changed files with 35026 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<plugin_location>plugins/box/system/system.plugin.php</plugin_location>
<plugin_status>active</plugin_status>
<plugin_priority>4</plugin_priority>
<plugin_name>System</plugin_name>
<plugin_description>Monstra System plugin</plugin_description>
<plugin_version>1.0.0</plugin_version>
<plugin_author>Awilum</plugin_author>
<plugin_author_uri>http://monstra.org/</plugin_author_uri>
</root>

View File

@@ -0,0 +1,79 @@
<?php
return array(
'system' => array(
'System' => 'System',
'Published a new version of the :monstra' => 'Published a new version of the :monstra',
'Sitemap created' => 'Sitemap created',
'Create sitemap' => 'Create sitemap',
'on' => 'on',
'off'=> 'off',
'Site url' => 'Site url',
'Maintenance Mode' => 'Maintenance Mode',
'Maintenance Mode On' => 'Maintenance Mode On',
'Maintenance Mode Off' => 'Maintenance Mode Off',
'Site settings' => 'Site settings',
'System settings' => 'System settings',
'Site name' => 'Site name',
'Site description' => 'Site description',
'Site keywords' => 'Site keywords',
'Site slogan' => 'Site slogan',
'Default page' => 'Default page',
'Time zone' => 'Time zone',
'Language' => 'Language',
'Save' => 'Save',
'Site' => 'Site',
'System version' => 'System version',
'System version ID' => 'System version ID',
'GZIP' => 'GZIP',
'Debugging' => 'Debugging',
'Plugin API' => 'Plugin API',
'Plugins active' => 'Plugins active',
'Actions registered' => 'Actions registered',
'Filters registered' => 'Filters registered',
'logout' => 'logout',
'site' => 'site',
'Core' => 'Core',
'Delete temporary files' => 'Delete temporary files',
'Download the latest version' => 'Download the latest version',
'Powered by' => 'Powered by',
'Administration' => 'Administration',
'Settings' => 'Settings',
'Temporary files deleted' => 'Temporary files deleted',
'Extends' => 'Extends',
'View site' => 'View site',
'Welcome, :username' => 'Welcome, :username',
'Reset Password' => 'Reset Password',
'< Back to Website' => '< Back to Website',
'Forgot your password? >' => 'Forgot your password? >',
'Administration >' => 'Administration >',
'Send New Password' => 'Send New Password',
'This user does not exist' => 'This user does not exist',
'Version' => 'Version',
'Install script writable' => 'Install script writable',
'Install script not writable' => 'Install script not writable',
'Directory: <b> :dir </b> writable' => 'Directory: <b> :dir </b> writable',
'Directory: <b> :dir </b> not writable' => 'Directory: <b> :dir </b> not writable',
'PHP Version' => 'PHP Version',
'Module DOM is installed' => 'Module DOM is installed',
'Module DOM is required' => 'Module DOM is required',
'Module Mod Rewrite is installed' => 'Module Mod Rewrite is installed',
'Module SimpleXML is installed' => 'Module SimpleXML is installed',
'PHP 5.2 or greater is required' => 'PHP 5.2 or greater is required',
'Apache Mod Rewrite is required' => 'Apache Mod Rewrite is required',
'SimpleXML module is required' => 'SimpleXML module is required',
'Field "Site name" is empty' => 'Field "Site name" is empty',
'Field "Email" is empty' => 'Field "Email" is empty',
'Field "Username" is empty' => 'Field "Username" is empty',
'Field "Password" is empty' => 'Field "Password" is empty',
'Field "Site url" is empty' => 'Field "Site url" is empty',
'Email not valid' => 'Email not valid',
'Install' => 'Install',
'...Monstra says...' => '...Monstra says...',
'Sitemap file writable' => 'Sitemap file writable',
'Sitemap file not writable' => 'Sitemap file not writable',
'Main .htaccess file writable' => 'Main .htaccess file writable',
'Main .htaccess file not writable' => 'Main .htaccess file not writable',
)
);

View File

@@ -0,0 +1,80 @@
<?php
return array(
'system' => array(
'System' => 'Система',
'Published a new version of the :monstra' => 'Опубликована новая версия :monstra',
'Sitemap created' => 'Карта сайта создана',
'Create sitemap' => 'Создать карту сайта',
'on' => 'включен',
'off'=> 'выключен',
'Site url' => 'Адрес сайта',
'Maintenance Mode' => 'Техническое обслуживание',
'Maintenance Mode On' => 'Поставить на тех.обслуживание',
'Maintenance Mode Off' => 'Снять с тех.обслуживания',
'Site settings' => 'Настройки сайта',
'System settings' => 'Настройки системы',
'Site name' => 'Название сайта',
'Site description' => 'Описание сайта',
'Site keywords' => 'Ключевые слова сайта',
'Site slogan' => 'Слоган сайта',
'Default page' => 'Страница по умолчанию',
'Time zone' => 'Временная зона',
'Language' => 'Язык',
'Save' => 'Сохранить',
'Site' => 'Сайт',
'System version' => 'Версия системы ID',
'System version ID' => 'Версия системы ID',
'GZIP' => 'Cжатие GZIP',
'Debugging' => 'Дебаггинг',
'Plugin API' => 'Plugin API',
'Plugins active' => 'Подключенные плагины',
'Actions registered' => 'Зарегистрированные эыкшены',
'Filters registered' => 'Скачать последнюю версию',
'logout' => 'выход',
'site' => 'Сайт',
'Core' => 'Ядро',
'Delete temporary files' => 'Удалить временные файлы',
'Download the latest version' => 'Скачать последнюю версию',
'Powered by' => 'Работает на',
'Administration' => 'Администрирование',
'Settings' => 'Настройки',
'Temporary files deleted' => 'Временные файлы удалены',
'Extends' => 'Расширения',
'View site' => 'Сайт',
'Welcome, :username' => 'Добро пожаловать, :username',
'Reset Password' => 'Сброс пароля',
'< Back to Website' => '< Обратно на сайт',
'Forgot your password? >' => 'Забыли пароль ? >',
'Administration >' => 'Администрирование >',
'Send New Password' => 'Выслать новый пароль',
'This user does not exist' => 'Нет такого пользователя',
'Version' => 'Версия',
'Install script writable' => 'Установочный скрипт доступен для записи',
'Install script not writable' => 'Установочный скрипт не доступен для записи',
'Directory: <b> :dir </b> writable' => 'Директория <b> :dir </b> доступна для записи',
'Directory: <b> :dir </b> not writable' => 'Директория <b> :dir </b> не доступна для записи',
'PHP Version' => 'Версия PHP',
'Module DOM is installed' => 'Модуль DOM установлен',
'Module DOM is required' => 'Требуется DOM модуль',
'Module Mod Rewrite is installed' => 'Модуль Mod Rewrite установлен',
'Module SimpleXML is installed' => 'Модуль SimpleXML установлен',
'PHP 5.2 or greater is required' => 'PHP 5.2 или высше',
'Apache Mod Rewrite is required' => 'Требуется Apache Mod Rewrite',
'SimpleXML module is required' => 'Требуется SimpleXML модуль',
'Field "Site name" is empty' => 'Поле "Название сайта" пустое',
'Field "Email" is empty' => 'Поле "Емейл" пустое',
'Field "Username" is empty' => 'Поле "Имя пользователя" пустое',
'Field "Password" is empty' => 'Поле "Пароль" пустое',
'Field "Site url" is empty' => 'Поле "Адрес сайта" пустое',
'Email not valid' => 'Емейл невалидный',
'Install' => 'Установить',
'...Monstra says...' => '...Monstra говорит...',
'Sitemap file writable' => 'Карта сайта доступна для записи',
'Sitemap file not writable' => 'Карта сайта не доступна для записи',
'Main .htaccess file writable' => 'Главный .htaccess файл доступен для записи',
'Main .htaccess file not writable' => 'Главный .htaccess файл не доступен для записи',
)
);

View File

@@ -0,0 +1,159 @@
<?php
// Add Monstra check action
if (CHECK_MONSTRA_VERSION) {
Action::add('admin_post_template', 'checkMonstraVersion', 9999);
}
/**
* Check Monstra version
*/
function checkMonstraVersion() {
echo ('
<script type="text/javascript">
$.getJSON("http://monstra.org/api/basic.php?jsoncallback=?",
function(data){
var current_monstra_version_id = '.MONSTRA_VERSION_ID.';
var api_monstra_version_id = data.version_id;
if (current_monstra_version_id < api_monstra_version_id) {
$("#update-monstra").addClass("alert").html("'.__("Published a new version of the :monstra", "system", array(":monstra" => "<a target='_blank' href='http://monstra.org/download'>Monstra</a>")).'");
}
}
);
</script>
');
}
class SystemAdmin extends Backend {
/**
* System plugin admin
*/
public static function main() {
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin'))) {
$filters = Filter::$filters;
$plugins = Plugin::$plugins;
$components = Plugin::$components;
$actions = Action::$actions;
// Get pages table
$pages = new Table('pages');
// Get system timezone
$system_timezone = Option::get('timezone');
// Get languages files
$language_files = File::scan('../plugins/box/system/languages/', '.lang.php');
foreach ($language_files as $language) {
$parts = explode('.', $language);
$l = $parts[0];
$languages_array[$l] = $l;
}
// Get all pages
$pages_array = array();
$pages_list = $pages->select('[slug!="error404" and parent=""]');
foreach ($pages_list as $page) {
$pages_array[$page['slug']] = Html::toText($page['title']);
}
// Create Sitemap
// -------------------------------------
if (Request::get('sitemap')) {
if ('create' == Request::get('sitemap')) {
Notification::set('success', __('Sitemap created', 'system'));
Sitemap::create();
Request::redirect('index.php?id=system');
}
}
// Delete temporary files
// -------------------------------------
if (Request::get('temporary_files')) {
if ('delete' == Request::get('temporary_files')) {
$namespaces = Dir::scan(CACHE);
if (count($namespaces) > 0) {
foreach ($namespaces as $namespace) {
Dir::delete(CACHE . DS . $namespace);
}
}
$files = File::scan(MINIFY, array('css','js','php'));
if (count($files) > 0) {
foreach ($files as $file) {
File::delete(MINIFY . DS . $file);
}
}
if (count(File::scan(MINIFY, array('css', 'js', 'php'))) == 0 && count(Dir::scan(CACHE)) == 0) {
Notification::set('success', __('Temporary files deleted', 'system'));
Request::redirect('index.php?id=system');
}
}
}
// Set maintenance state on or off
// -------------------------------------
if (Request::get('maintenance')) {
if ('on' == Request::get('maintenance')) {
Option::update('maintenance_status', 'on');
Request::redirect('index.php?id=system');
}
if ('off' == Request::get('maintenance')) {
Option::update('maintenance_status', 'off');
Request::redirect('index.php?id=system');
}
}
// Edit settings
// -------------------------------------
if (Request::post('edit_settings')) {
if (Security::check(Request::post('csrf'))) {
// Add trailing slashes
$_site_url = Request::post('system_url');
if ($_site_url[strlen($_site_url)-1] !== '/') {
$_site_url = $_site_url.'/';
}
Option::update(array('sitename' => Request::post('site_name'),
'keywords' => Request::post('site_keywords'),
'description' => Request::post('site_description'),
'slogan' => Request::post('site_slogan'),
'defaultpage' => Request::post('site_default_page'),
'siteurl' => $_site_url,
'timezone' => Request::post('system_timezone'),
'language' => Request::post('system_language'),
'maintenance_message' => Request::post('site_maintenance_message')));
Notification::set('success', __('Your changes have been saved.', 'system'));
Request::redirect('index.php?id=system');
} else { die('csrf detected!'); }
}
// Its mean that you can add your own actions for this plugin
Action::run('admin_system_extra_actions');
// Display view
View::factory('box/system/views/backend/index')
->assign('pages_array', $pages_array)
->assign('languages_array', $languages_array)
->display();
} else {
Request::redirect('index.php?id=users&action=edit&user_id='.Session::get('user_id'));
}
}
}

View File

@@ -0,0 +1,43 @@
<?php
/**
* System plugin
*
* @package Monstra
* @subpackage Plugins
* @author Romanenko Sergey / Awilum
* @copyright 2012 Romanenko Sergey / Awilum
* @version 1.0.0
*
*/
// Register plugin
Plugin::register( __FILE__,
__('System', 'system'),
__('System plugin', 'system'),
'1.0.0',
'Awilum',
'http://monstra.org/',
null,
'box');
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor'))) {
// Admin top navigation
Navigation::add(__('Welcome, :username', 'system', array(':username' => Session::get('user_login'))), 'top', 'users&action=edit&user_id='.Session::get('user_id'), 1, Navigation::TOP, false);
Navigation::add(__('View site', 'system'), 'top', Option::get('siteurl'), 2, Navigation::TOP, true);
Navigation::add(__('Logout', 'users'), 'top', '&logout=do', 3, Navigation::TOP, false);
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin'))) {
Navigation::add(__('Settings', 'system'), 'system', 'system', 1);
}
}
Plugin::Admin('system', 'box');

View File

@@ -0,0 +1,58 @@
<!-- System -->
<br />
<?php if (Notification::get('success')) Alert::success(Notification::get('success')); ?>
<?php echo Html::anchor(__('Create sitemap', 'system'), 'index.php?id=system&sitemap=create', array('class' => 'btn')).Html::nbsp(2); ?>
<?php echo Html::anchor(__('Delete temporary files', 'system'), 'index.php?id=system&temporary_files=delete', array('class' => 'btn')).Html::nbsp(2); ?>
<?php if ('off' == Option::get('maintenance_status', 'system')) { ?>
<?php echo Html::anchor(__('Maintenance Mode On', 'system'), 'index.php?id=system&maintenance=on', array('class' => 'btn')); ?>
<?php } else { ?>
<?php echo Html::anchor(__('Maintenance Mode Off', 'system'), 'index.php?id=system&maintenance=off', array('class' => 'btn btn-danger')); ?>
<?php } ?>
<?php Action::run('admin_system_extra_buttons'); ?>
<hr />
<h2><?php echo __('Site settings', 'system'); ?></h2>
<br />
<?php
echo (
Form::open().
Form::hidden('csrf', Security::token()).
Form::label('site_name', __('Site name', 'system')).
Form::input('site_name', Option::get('sitename'), array('class' => 'span7')). Html::br().
Form::label('site_description', __('Site description', 'system')).
Form::input('site_description', Option::get('description'), array('class' => 'span7')). Html::br().
Form::label('site_keywords', __('Site keywords', 'system')).
Form::input('site_keywords', Option::get('keywords'), array('class' => 'span7')). Html::br().
Form::label('site_slogan', __('Site slogan', 'system')).
Form::input('site_slogan', Option::get('slogan'), array('class' => 'span7')). Html::br().
Form::label('site_default_page', __('Default page', 'system')).
Form::select('site_default_page', $pages_array, Option::get('defaultpage'), array('class' => 'span3')). Html::br(2)
);
?>
<h2><?php echo __('System settings', 'system'); ?></h2>
<br />
<?php
echo (
Form::label('system_url', __('Site url', 'system')).
Form::input('system_url', Option::get('siteurl'), array('class' => 'span7')). Html::br().
Form::label('system_timezone', __('Time zone', 'system')).
Form::select('system_timezone', Date::timezones(), Option::get('timezone'), array('class' => 'span7')). Html::br().
Form::label('system_language', __('Language', 'system')).
Form::select('system_language', $languages_array, Option::get('language'), array('class' => 'span2')). Html::br().
Form::label('site_maintenance_message', __('Maintenance Mode', 'system')).
Form::textarea('site_maintenance_message', Html::toText(Option::get('maintenance_message')), array('style' => 'width:640px;height:160px;')). Html::br(2)
);
?>
<?php
echo (
Form::submit('edit_settings', __('Save', 'system'), array('class' => 'btn')).
Form::close()
);
?>
<!-- /System -->