mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-07-31 02:10:37 +02:00
Monstra Library: basic core improvments
This commit is contained in:
@@ -8,4 +8,4 @@
|
||||
<plugin_version>1.0.0</plugin_version>
|
||||
<plugin_author>Awilum</plugin_author>
|
||||
<plugin_author_uri>http://monstra.org/</plugin_author_uri>
|
||||
</root>
|
||||
</root>
|
||||
|
@@ -1,81 +1,81 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'system' => array(
|
||||
'System' => 'System',
|
||||
'Published a new version of the :monstra' => 'Veröffentlicht eine neue Version von dem :monstra',
|
||||
'Sitemap created' => 'Sitemap wurde erstellt',
|
||||
'Create sitemap' => 'Erstelle Sitemap',
|
||||
'on' => 'An',
|
||||
'off'=> 'Aus',
|
||||
'Site url' => 'Seiten-URL',
|
||||
'Maintenance Mode' => 'Wartungsmodus',
|
||||
'Maintenance Mode On' => 'Wartungsmodus An',
|
||||
'Maintenance Mode Off' => 'Wartungsmodus Aus',
|
||||
'Site settings' => 'Seiteneinstellungen',
|
||||
'System settings' => 'Systemeinstellungen',
|
||||
'Site name' => 'Seiten-Name',
|
||||
'Site description' => 'Seiten-Beschreibung',
|
||||
'Site keywords' => 'Seiten-Schlagwörter',
|
||||
'Site slogan' => 'Seiten-Slogan',
|
||||
'Default page' => 'Standardseite',
|
||||
'Time zone' => 'Zeitzone',
|
||||
'Language' => 'Sprache',
|
||||
'Save' => 'Speichern',
|
||||
'Site' => 'Seite',
|
||||
'System version' => 'Systemversion',
|
||||
'System version ID' => 'Systemversions ID',
|
||||
'GZIP' => 'GZIP',
|
||||
'Debugging' => 'Fehlerbeseitigung',
|
||||
'Plugin API' => 'Plugin API',
|
||||
'Plugins active' => 'Plugins aktiv',
|
||||
'Actions registered' => 'Aktionen registriert',
|
||||
'Filters registered' => 'Filter registriert',
|
||||
'logout' => 'logout',
|
||||
'site' => 'seite',
|
||||
'Core' => 'Core',
|
||||
'Delete temporary files' => 'Temporäre Dateien löschen',
|
||||
'Download the latest version' => 'Lade die letzte Version herunter',
|
||||
'Powered by' => 'Powered by',
|
||||
'Administration' => 'Administration',
|
||||
'Settings' => 'Einstellungen',
|
||||
'Temporary files deleted' => 'Temporäre Dateien gelöscht',
|
||||
'Extends' => 'Erweitert',
|
||||
'View site' => 'Seite ansehen',
|
||||
'Welcome, :username' => 'Willkommen, :username',
|
||||
'Reset Password' => 'Password zurücksetzen',
|
||||
'< Back to Website' => '< Zurück zur Webseite',
|
||||
'Forgot your password? >' => 'Passwort vergessen? >',
|
||||
'Administration >' => 'Administration >',
|
||||
'Send New Password' => 'Neues Passwort zusenden',
|
||||
'This user does not exist' => 'Dieser Benutzer existiert nicht',
|
||||
'Version' => 'Version',
|
||||
|
||||
'Install script writable' => 'Installationsskript beschreibbar',
|
||||
'Install script not writable' => 'Installationsskript nicht beschreibbar',
|
||||
'Directory: <b> :dir </b> writable' => 'Ordner: <b> :dir </b> beschreibbar',
|
||||
'Directory: <b> :dir </b> not writable' => 'Ordner: <b> :dir </b> nicht beschreibbar',
|
||||
'PHP Version' => 'PHP Version',
|
||||
'Module DOM is installed' => 'Modul DOM ist installiert',
|
||||
'Module DOM is required' => 'Modul DOM ist erforderlich',
|
||||
'Module Mod Rewrite is installed' => 'Modul Mod Rewrite ist installiert',
|
||||
'Module SimpleXML is installed' => 'Modul SimpleXML ist installiert',
|
||||
'PHP 5.2 or greater is required' => 'PHP 5.2 oder höher erforderlich',
|
||||
'Apache Mod Rewrite is required' => 'Apache Mod Rewrite ist erforderlich',
|
||||
'SimpleXML module is required' => 'SimpleXML-Modul ist erforderlich',
|
||||
'Field "Site name" is empty' => 'Feld "Seiten-Name" ist leer',
|
||||
'Field "Email" is empty' => 'Feld "Email" ist leer',
|
||||
'Field "Username" is empty' => 'Feld "Benutzername" ist leer',
|
||||
'Field "Password" is empty' => 'Feld "Passwort" ist leer',
|
||||
'Field "Site url" is empty' => 'Feld "Seiten-URL" ist leer',
|
||||
'Email not valid' => 'E-Mail ist ungültig',
|
||||
'Install' => 'Installieren',
|
||||
'...Monstra says...' => '...Monstra sagt...',
|
||||
'Sitemap file writable' => 'Sitemap-Datei beschreibbar',
|
||||
'Sitemap file not writable' => 'Sitemap-Datei ist nicht beschreibbar',
|
||||
'Main .htaccess file writable' => 'Haupt .htaccess-Datei ist beschreibbar',
|
||||
'Main .htaccess file not writable' => 'Haupt .htaccess-Datei ist nicht beschreibbar',
|
||||
'Official Support Forum' => 'Official Support Forum',
|
||||
'Documentation' => 'Documentation',
|
||||
)
|
||||
);
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'system' => array(
|
||||
'System' => 'System',
|
||||
'Published a new version of the :monstra' => 'Veröffentlicht eine neue Version von dem :monstra',
|
||||
'Sitemap created' => 'Sitemap wurde erstellt',
|
||||
'Create sitemap' => 'Erstelle Sitemap',
|
||||
'on' => 'An',
|
||||
'off'=> 'Aus',
|
||||
'Site url' => 'Seiten-URL',
|
||||
'Maintenance Mode' => 'Wartungsmodus',
|
||||
'Maintenance Mode On' => 'Wartungsmodus An',
|
||||
'Maintenance Mode Off' => 'Wartungsmodus Aus',
|
||||
'Site settings' => 'Seiteneinstellungen',
|
||||
'System settings' => 'Systemeinstellungen',
|
||||
'Site name' => 'Seiten-Name',
|
||||
'Site description' => 'Seiten-Beschreibung',
|
||||
'Site keywords' => 'Seiten-Schlagwörter',
|
||||
'Site slogan' => 'Seiten-Slogan',
|
||||
'Default page' => 'Standardseite',
|
||||
'Time zone' => 'Zeitzone',
|
||||
'Language' => 'Sprache',
|
||||
'Save' => 'Speichern',
|
||||
'Site' => 'Seite',
|
||||
'System version' => 'Systemversion',
|
||||
'System version ID' => 'Systemversions ID',
|
||||
'GZIP' => 'GZIP',
|
||||
'Debugging' => 'Fehlerbeseitigung',
|
||||
'Plugin API' => 'Plugin API',
|
||||
'Plugins active' => 'Plugins aktiv',
|
||||
'Actions registered' => 'Aktionen registriert',
|
||||
'Filters registered' => 'Filter registriert',
|
||||
'logout' => 'logout',
|
||||
'site' => 'seite',
|
||||
'Core' => 'Core',
|
||||
'Delete temporary files' => 'Temporäre Dateien löschen',
|
||||
'Download the latest version' => 'Lade die letzte Version herunter',
|
||||
'Powered by' => 'Powered by',
|
||||
'Administration' => 'Administration',
|
||||
'Settings' => 'Einstellungen',
|
||||
'Temporary files deleted' => 'Temporäre Dateien gelöscht',
|
||||
'Extends' => 'Erweitert',
|
||||
'View site' => 'Seite ansehen',
|
||||
'Welcome, :username' => 'Willkommen, :username',
|
||||
'Reset Password' => 'Password zurücksetzen',
|
||||
'< Back to Website' => '< Zurück zur Webseite',
|
||||
'Forgot your password? >' => 'Passwort vergessen? >',
|
||||
'Administration >' => 'Administration >',
|
||||
'Send New Password' => 'Neues Passwort zusenden',
|
||||
'This user does not exist' => 'Dieser Benutzer existiert nicht',
|
||||
'Version' => 'Version',
|
||||
|
||||
'Install script writable' => 'Installationsskript beschreibbar',
|
||||
'Install script not writable' => 'Installationsskript nicht beschreibbar',
|
||||
'Directory: <b> :dir </b> writable' => 'Ordner: <b> :dir </b> beschreibbar',
|
||||
'Directory: <b> :dir </b> not writable' => 'Ordner: <b> :dir </b> nicht beschreibbar',
|
||||
'PHP Version' => 'PHP Version',
|
||||
'Module DOM is installed' => 'Modul DOM ist installiert',
|
||||
'Module DOM is required' => 'Modul DOM ist erforderlich',
|
||||
'Module Mod Rewrite is installed' => 'Modul Mod Rewrite ist installiert',
|
||||
'Module SimpleXML is installed' => 'Modul SimpleXML ist installiert',
|
||||
'PHP 5.2 or greater is required' => 'PHP 5.2 oder höher erforderlich',
|
||||
'Apache Mod Rewrite is required' => 'Apache Mod Rewrite ist erforderlich',
|
||||
'SimpleXML module is required' => 'SimpleXML-Modul ist erforderlich',
|
||||
'Field "Site name" is empty' => 'Feld "Seiten-Name" ist leer',
|
||||
'Field "Email" is empty' => 'Feld "Email" ist leer',
|
||||
'Field "Username" is empty' => 'Feld "Benutzername" ist leer',
|
||||
'Field "Password" is empty' => 'Feld "Passwort" ist leer',
|
||||
'Field "Site url" is empty' => 'Feld "Seiten-URL" ist leer',
|
||||
'Email not valid' => 'E-Mail ist ungültig',
|
||||
'Install' => 'Installieren',
|
||||
'...Monstra says...' => '...Monstra sagt...',
|
||||
'Sitemap file writable' => 'Sitemap-Datei beschreibbar',
|
||||
'Sitemap file not writable' => 'Sitemap-Datei ist nicht beschreibbar',
|
||||
'Main .htaccess file writable' => 'Haupt .htaccess-Datei ist beschreibbar',
|
||||
'Main .htaccess file not writable' => 'Haupt .htaccess-Datei ist nicht beschreibbar',
|
||||
'Official Support Forum' => 'Official Support Forum',
|
||||
'Documentation' => 'Documentation',
|
||||
)
|
||||
);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
return array(
|
||||
'system' => array(
|
||||
'System' => 'System',
|
||||
@@ -7,7 +7,7 @@
|
||||
'Sitemap created' => 'Sitemap created',
|
||||
'Create sitemap' => 'Create sitemap',
|
||||
'on' => 'on',
|
||||
'off'=> 'off',
|
||||
'off'=> 'off',
|
||||
'Site url' => 'Site url',
|
||||
'Maintenance Mode' => 'Maintenance Mode',
|
||||
'Maintenance Mode On' => 'Maintenance Mode On',
|
||||
@@ -22,13 +22,13 @@
|
||||
'Time zone' => 'Time zone',
|
||||
'Language' => 'Language',
|
||||
'Save' => 'Save',
|
||||
'Site' => 'Site',
|
||||
'Site' => 'Site',
|
||||
'System version' => 'System version',
|
||||
'System version ID' => 'System version ID',
|
||||
'GZIP' => 'GZIP',
|
||||
'Debugging' => 'Debugging',
|
||||
'Plugin API' => 'Plugin API',
|
||||
'Plugins active' => 'Plugins active',
|
||||
'Plugins active' => 'Plugins active',
|
||||
'Actions registered' => 'Actions registered',
|
||||
'Filters registered' => 'Filters registered',
|
||||
'logout' => 'logout',
|
||||
@@ -79,4 +79,4 @@
|
||||
'Official Support Forum' => 'Official Support Forum',
|
||||
'Documentation' => 'Documentation',
|
||||
)
|
||||
);
|
||||
);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
return array(
|
||||
'system' => array(
|
||||
'System' => 'Sistema',
|
||||
@@ -7,7 +7,7 @@
|
||||
'Sitemap created' => 'Sitemap è stata creata',
|
||||
'Create sitemap' => 'Crea sitemap',
|
||||
'on' => 'on',
|
||||
'off'=> 'off',
|
||||
'off'=> 'off',
|
||||
'Site url' => 'URL del sito',
|
||||
'Maintenance Mode' => 'Modalità manutenzione',
|
||||
'Maintenance Mode On' => 'Abilita modalità manutenzione',
|
||||
@@ -28,7 +28,7 @@
|
||||
'GZIP' => 'Compressione GZIP',
|
||||
'Debugging' => 'Debugging',
|
||||
'Plugin API' => 'Plugin API',
|
||||
'Plugins active' => 'Plugin attivi',
|
||||
'Plugins active' => 'Plugin attivi',
|
||||
'Actions registered' => 'Azioni registrati',
|
||||
'Filters registered' => 'Filtri registrati',
|
||||
'logout' => 'esci',
|
||||
@@ -51,7 +51,6 @@
|
||||
'This user does not exist' => 'Tale utente non esiste',
|
||||
'Version' => 'Versione',
|
||||
|
||||
|
||||
'Install script writable' => 'Script d’installazione è scrivibile',
|
||||
'Install script not writable' => 'Script d’installazione non è scrivibile',
|
||||
'Directory: <b> :dir </b> writable' => 'Directory <b> :dir </b> è scrivibile',
|
||||
@@ -79,4 +78,4 @@
|
||||
'Official Support Forum' => 'Official Support Forum',
|
||||
'Documentation' => 'Documentation',
|
||||
)
|
||||
);
|
||||
);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
return array(
|
||||
'system' => array(
|
||||
'System' => 'Sistema',
|
||||
@@ -7,7 +7,7 @@
|
||||
'Sitemap created' => 'Sitemap sukurtas',
|
||||
'Create sitemap' => 'Sukurti sitemap',
|
||||
'on' => 'įjungti',
|
||||
'off'=> 'išjungti',
|
||||
'off'=> 'išjungti',
|
||||
'Site url' => 'Tinklapio adresas (url)',
|
||||
'Maintenance Mode' => 'Remonto režimas',
|
||||
'Maintenance Mode On' => 'Įjungti remonto režimą',
|
||||
@@ -22,13 +22,13 @@
|
||||
'Time zone' => 'Laiko zona',
|
||||
'Language' => 'Kalba',
|
||||
'Save' => 'Išsaugoti',
|
||||
'Site' => 'Tinklapis',
|
||||
'Site' => 'Tinklapis',
|
||||
'System version' => 'Sistemos versija',
|
||||
'System version ID' => 'Sistemos versijos ID',
|
||||
'GZIP' => 'GZIP',
|
||||
'Debugging' => 'Derinimas',
|
||||
'Plugin API' => 'Įskiepių API',
|
||||
'Plugins active' => 'Aktyvūs įskiepiai',
|
||||
'Plugins active' => 'Aktyvūs įskiepiai',
|
||||
'Actions registered' => 'Veiksmai užregistruoti',
|
||||
'Filters registered' => 'Filtrai užregistruoti',
|
||||
'logout' => 'atsijungti',
|
||||
@@ -78,4 +78,4 @@
|
||||
'Official Support Forum' => 'Pagalbos forumas',
|
||||
'Documentation' => 'Dokumentacija',
|
||||
)
|
||||
);
|
||||
);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
return array(
|
||||
'system' => array(
|
||||
'System' => 'Sistema',
|
||||
@@ -7,7 +7,7 @@
|
||||
'Sitemap created' => 'Mapa do site criado',
|
||||
'Create sitemap' => 'Criar mapa do site',
|
||||
'on' => 'on',
|
||||
'off'=> 'off',
|
||||
'off'=> 'off',
|
||||
'Site url' => 'URL do site',
|
||||
'Maintenance Mode' => 'Modo de manutenção',
|
||||
'Maintenance Mode On' => 'Modo de manutenção online',
|
||||
@@ -22,7 +22,7 @@
|
||||
'Time zone' => 'Timezone padrão',
|
||||
'Language' => 'Linguagem',
|
||||
'Save' => 'Salvar',
|
||||
'Site' => 'Site',
|
||||
'Site' => 'Site',
|
||||
'System version' => 'Versão do sistema',
|
||||
'System version ID' => 'ID (longo) da versão do sistema',
|
||||
'GZIP' => 'GZIP',
|
||||
@@ -77,4 +77,4 @@
|
||||
'Official Support Forum' => 'Official Support Forum',
|
||||
'Documentation' => 'Documentation',
|
||||
)
|
||||
);
|
||||
);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
return array(
|
||||
'system' => array(
|
||||
'System' => 'Система',
|
||||
@@ -7,7 +7,7 @@
|
||||
'Sitemap created' => 'Карта сайта создана',
|
||||
'Create sitemap' => 'Создать карту сайта',
|
||||
'on' => 'включен',
|
||||
'off'=> 'выключен',
|
||||
'off'=> 'выключен',
|
||||
'Site url' => 'Адрес сайта',
|
||||
'Maintenance Mode' => 'Тех. обслуживание',
|
||||
'Maintenance Mode On' => 'Включить тех. обслуживание',
|
||||
@@ -28,7 +28,7 @@
|
||||
'GZIP' => 'Cжатие GZIP',
|
||||
'Debugging' => 'Дебаггинг',
|
||||
'Plugin API' => 'Plugin API',
|
||||
'Plugins active' => 'Подключенные плагины',
|
||||
'Plugins active' => 'Подключенные плагины',
|
||||
'Actions registered' => 'Зарегистрированные экшны',
|
||||
'Filters registered' => 'Зарегистрированные фильтры',
|
||||
'logout' => 'выход',
|
||||
@@ -79,4 +79,4 @@
|
||||
'Official Support Forum' => 'Официальный Форум Поддержки',
|
||||
'Documentation' => 'Документация',
|
||||
)
|
||||
);
|
||||
);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
return array(
|
||||
'system' => array(
|
||||
'System' => 'Система',
|
||||
@@ -7,7 +7,7 @@
|
||||
'Sitemap created' => 'Карта сайту створена',
|
||||
'Create sitemap' => 'Створити карту сайту',
|
||||
'on' => 'включено',
|
||||
'off'=> 'вимкнено',
|
||||
'off'=> 'вимкнено',
|
||||
'Site url' => 'Адреса сайту',
|
||||
'Maintenance Mode' => 'Тех. обслуговування',
|
||||
'Maintenance Mode On' => 'Включити тех. обслуговування',
|
||||
@@ -28,7 +28,7 @@
|
||||
'GZIP' => 'Стиснення GZIP',
|
||||
'Debugging' => 'Дебаггінг',
|
||||
'Plugin API' => 'Плагін API',
|
||||
'Plugins active' => 'Підключені плагіни',
|
||||
'Plugins active' => 'Підключені плагіни',
|
||||
'Actions registered' => 'Зареєстровані екшени',
|
||||
'Filters registered' => 'Зареєстровані фітри',
|
||||
'logout' => 'вихід',
|
||||
@@ -79,4 +79,4 @@
|
||||
'Official Support Forum' => 'Офіційний Форум Підтримки',
|
||||
'Documentation' => 'Документація',
|
||||
)
|
||||
);
|
||||
);
|
||||
|
@@ -1,175 +1,169 @@
|
||||
<?php
|
||||
|
||||
|
||||
// Add Monstra check action
|
||||
if (CHECK_MONSTRA_VERSION) {
|
||||
Action::add('admin_post_template', 'checkMonstraVersion', 9999);
|
||||
}
|
||||
// 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/version.php?jsoncallback=?",
|
||||
function(data){
|
||||
var current_monstra_version = "'.Core::VERSION.'";
|
||||
var stable_monstra_version = data.version;
|
||||
if (current_monstra_version < stable_monstra_version) {
|
||||
$("#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>")).'");
|
||||
}
|
||||
/**
|
||||
* Check Monstra version
|
||||
*/
|
||||
function checkMonstraVersion()
|
||||
{
|
||||
echo ('
|
||||
<script type="text/javascript">
|
||||
$.getJSON("http://monstra.org/api/version.php?jsoncallback=?",
|
||||
function(data){
|
||||
var current_monstra_version = "'.Core::VERSION.'";
|
||||
var stable_monstra_version = data.version;
|
||||
if (current_monstra_version < stable_monstra_version) {
|
||||
$("#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>
|
||||
');
|
||||
}
|
||||
|
||||
/**
|
||||
* System Admin
|
||||
*/
|
||||
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 . DS . 'system' . DS . 'languages' . DS, '.lang.php');
|
||||
foreach ($language_files as $language) {
|
||||
$parts = explode('.', $language);
|
||||
$languages_array[$parts[0]] = I18n::$locales[$parts[0]];
|
||||
}
|
||||
|
||||
// Get all pages
|
||||
$pages_array = array();
|
||||
$pages_list = $pages->select('[slug!="error404" and parent="" and status="published"]');
|
||||
foreach ($pages_list as $page) {
|
||||
$pages_array[$page['slug']] = Html::toText($page['title']);
|
||||
}
|
||||
|
||||
|
||||
// Create Sitemap
|
||||
// -------------------------------------
|
||||
if (Request::get('sitemap') == 'create') {
|
||||
|
||||
if (Security::check(Request::get('token'))) {
|
||||
|
||||
Notification::set('success', __('Sitemap created', 'system'));
|
||||
|
||||
Sitemap::create();
|
||||
|
||||
Request::redirect('index.php?id=system');
|
||||
|
||||
} else { die('csrf detected!'); }
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Delete temporary files
|
||||
// -------------------------------------
|
||||
if (Request::get('temporary_files') == 'delete') {
|
||||
|
||||
if (Security::check(Request::get('token'))) {
|
||||
|
||||
$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');
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
');
|
||||
}
|
||||
|
||||
// Set maintenance state on or off
|
||||
// -------------------------------------
|
||||
if (Request::get('maintenance')) {
|
||||
/**
|
||||
* System Admin
|
||||
*/
|
||||
class SystemAdmin extends Backend
|
||||
{
|
||||
/**
|
||||
* System plugin admin
|
||||
*/
|
||||
public static function main()
|
||||
{
|
||||
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin'))) {
|
||||
|
||||
if (Security::check(Request::get('token'))) {
|
||||
$filters = Filter::$filters;
|
||||
$plugins = Plugin::$plugins;
|
||||
$components = Plugin::$components;
|
||||
$actions = Action::$actions;
|
||||
|
||||
if ('on' == Request::get('maintenance')) {
|
||||
Option::update('maintenance_status', 'on');
|
||||
Request::redirect('index.php?id=system');
|
||||
// Get pages table
|
||||
$pages = new Table('pages');
|
||||
|
||||
// Get system timezone
|
||||
$system_timezone = Option::get('timezone');
|
||||
|
||||
// Get languages files
|
||||
$language_files = File::scan(PLUGINS_BOX . DS . 'system' . DS . 'languages' . DS, '.lang.php');
|
||||
foreach ($language_files as $language) {
|
||||
$parts = explode('.', $language);
|
||||
$languages_array[$parts[0]] = I18n::$locales[$parts[0]];
|
||||
}
|
||||
|
||||
// Get all pages
|
||||
$pages_array = array();
|
||||
$pages_list = $pages->select('[slug!="error404" and parent="" and status="published"]');
|
||||
foreach ($pages_list as $page) {
|
||||
$pages_array[$page['slug']] = Html::toText($page['title']);
|
||||
}
|
||||
|
||||
// Create Sitemap
|
||||
// -------------------------------------
|
||||
if (Request::get('sitemap') == 'create') {
|
||||
|
||||
if (Security::check(Request::get('token'))) {
|
||||
|
||||
Notification::set('success', __('Sitemap created', 'system'));
|
||||
|
||||
Sitemap::create();
|
||||
|
||||
Request::redirect('index.php?id=system');
|
||||
|
||||
} else { die('csrf detected!'); }
|
||||
|
||||
}
|
||||
|
||||
// Delete temporary files
|
||||
// -------------------------------------
|
||||
if (Request::get('temporary_files') == 'delete') {
|
||||
|
||||
if (Security::check(Request::get('token'))) {
|
||||
|
||||
$namespaces = Dir::scan(CACHE);
|
||||
if (count($namespaces) > 0) {
|
||||
foreach ($namespaces as $namespace) {
|
||||
Dir::delete(CACHE . DS . $namespace);
|
||||
}
|
||||
|
||||
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.'/';
|
||||
$files = File::scan(MINIFY, array('css','js','php'));
|
||||
if (count($files) > 0) {
|
||||
foreach ($files as $file) {
|
||||
File::delete(MINIFY . DS . $file);
|
||||
}
|
||||
}
|
||||
|
||||
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'));
|
||||
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');
|
||||
|
||||
} else { die('csrf detected!'); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Its mean that you can add your own actions for this plugin
|
||||
Action::run('admin_system_extra_actions');
|
||||
// Set maintenance state on or off
|
||||
// -------------------------------------
|
||||
if (Request::get('maintenance')) {
|
||||
|
||||
// Display view
|
||||
View::factory('box/system/views/backend/index')
|
||||
->assign('pages_array', $pages_array)
|
||||
->assign('languages_array', $languages_array)
|
||||
->display();
|
||||
if (Security::check(Request::get('token'))) {
|
||||
|
||||
} else {
|
||||
if ('on' == Request::get('maintenance')) {
|
||||
Option::update('maintenance_status', 'on');
|
||||
Request::redirect('index.php?id=system');
|
||||
}
|
||||
|
||||
Request::redirect('index.php?id=users&action=edit&user_id='.Session::get('user_id'));
|
||||
}
|
||||
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'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,43 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* System plugin
|
||||
*
|
||||
* @package Monstra
|
||||
* @subpackage Plugins
|
||||
* @author Romanenko Sergey / Awilum
|
||||
* @copyright 2012 Romanenko Sergey / Awilum
|
||||
* @version 1.0.0
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 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');
|
||||
|
||||
// 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'))) {
|
||||
|
||||
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
// 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');
|
||||
|
||||
}
|
||||
|
||||
Plugin::Admin('system', 'box');
|
||||
|
@@ -17,12 +17,12 @@
|
||||
|
||||
<h2><?php echo __('Site settings', 'system'); ?></h2>
|
||||
<br />
|
||||
<?php
|
||||
<?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' => 'input-xxlarge')). Html::br().
|
||||
Form::input('site_name', Option::get('sitename'), array('class' => 'input-xxlarge')). Html::br().
|
||||
Form::label('site_description', __('Site description', 'system')).
|
||||
Form::textarea('site_description', Option::get('description'), array('class' => 'input-xxlarge')). Html::br().
|
||||
Form::label('site_keywords', __('Site keywords', 'system')).
|
||||
@@ -43,15 +43,15 @@
|
||||
Form::label('system_timezone', __('Time zone', 'system')).
|
||||
Form::select('system_timezone', Date::timezones(), Option::get('timezone'), array('class' => 'input-xxlarge')). Html::br().
|
||||
Form::label('system_language', __('Language', 'system')).
|
||||
Form::select('system_language', $languages_array, Option::get('language'), array('class' => 'input-xlarge')). Html::br().
|
||||
Form::select('system_language', $languages_array, Option::get('language'), array('class' => 'input-xlarge')). Html::br().
|
||||
Form::label('system_admin_email', __('Email', 'system')).
|
||||
Form::input('system_admin_email', Option::get('admin_email'), array('class' => 'input-xlarge')). Html::br().
|
||||
Form::label('site_maintenance_message', __('Maintenance Mode', 'system')).
|
||||
Form::textarea('site_maintenance_message', Html::toText(Option::get('maintenance_message')), array('class' => 'input-xxlarge', 'style' => 'height:160px;')). Html::br(2)
|
||||
);
|
||||
Form::textarea('site_maintenance_message', Html::toText(Option::get('maintenance_message')), array('class' => 'input-xxlarge', 'style' => 'height:160px;')). Html::br(2)
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
<?php
|
||||
echo (
|
||||
Form::submit('edit_settings', __('Save', 'system'), array('class' => 'btn')).
|
||||
Form::close()
|
||||
@@ -60,6 +60,6 @@
|
||||
<!-- /System -->
|
||||
|
||||
<?php
|
||||
// Custom code for this plugin
|
||||
// Custom code for this plugin
|
||||
Action::run('admin_system_extra_index_template_actions');
|
||||
?>
|
||||
|
Reference in New Issue
Block a user