1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-08-05 04:37:51 +02:00

Monstra Library: basic core improvments

This commit is contained in:
Awilum
2013-01-04 21:08:04 +02:00
parent 7437cc6abb
commit ef12b7492e
289 changed files with 16265 additions and 17155 deletions

View File

@@ -1,74 +1,73 @@
<?php
// Add plugin navigation link
Navigation::add(__('Backups', 'backup'), 'system', 'backup', 3);
// Add plugin navigation link
Navigation::add(__('Backups', 'backup'), 'system', 'backup', 3);
/**
* Backup Admin Class
*/
class BackupAdmin extends Backend
{
/**
* Backup Admin Class
* Backup admin
*/
class BackupAdmin extends Backend {
public static function main()
{
$backups_path = ROOT . DS . 'backups';
$backups_list = array();
/**
* Backup admin
*/
public static function main() {
// Create backup
// -------------------------------------
if (Request::post('create_backup')) {
$backups_path = ROOT . DS . 'backups';
if (Security::check(Request::post('csrf'))) {
$backups_list = array();
@set_time_limit(0);
@ini_set("memory_limit", "512M");
// Create backup
// -------------------------------------
if (Request::post('create_backup')) {
$zip = Zip::factory();
if (Security::check(Request::post('csrf'))) {
@set_time_limit(0);
@ini_set("memory_limit", "512M");
// Add storage folder
$zip->readDir(STORAGE . DS, false);
$zip = Zip::factory();
// Add public folder
if (Request::post('add_public_folder')) $zip->readDir(ROOT . DS . 'public' . DS, false);
// Add storage folder
$zip->readDir(STORAGE . DS, false);
// Add plugins folder
if (Request::post('add_plugins_folder')) $zip->readDir(PLUGINS . DS, false);
// Add public folder
if (Request::post('add_public_folder')) $zip->readDir(ROOT . DS . 'public' . DS, false);
// Add plugins folder
if (Request::post('add_plugins_folder')) $zip->readDir(PLUGINS . DS, false);
$zip->archive($backups_path . DS . Date::format(time(), "Y-m-d-H-i-s").'.zip');
$zip->archive($backups_path . DS . Date::format(time(), "Y-m-d-H-i-s").'.zip');
} else { die('csrf detected!'); }
}
// Delete backup
// -------------------------------------
if (Request::get('id') == 'backup' && Request::get('delete_file')) {
if (Security::check(Request::get('token'))) {
File::delete($backups_path . DS . Request::get('delete_file'));
Request::redirect(Option::get('siteurl').'admin/index.php?id=backup');
} else { die('csrf detected!'); }
}
// Download backup
// -------------------------------------
if (Request::get('download')) {
if (Security::check(Request::get('token'))) {
File::download($backups_path . DS . Request::get('download'));
} else { die('csrf detected!'); }
}
// Get backup list
$backups_list = File::scan($backups_path, '.zip');
// Display view
View::factory('box/backup/views/backend/index')
->assign('backups_list', $backups_list)
->display();
} else { die('csrf detected!'); }
}
}
// Delete backup
// -------------------------------------
if (Request::get('id') == 'backup' && Request::get('delete_file')) {
if (Security::check(Request::get('token'))) {
File::delete($backups_path . DS . Request::get('delete_file'));
Request::redirect(Option::get('siteurl').'admin/index.php?id=backup');
} else { die('csrf detected!'); }
}
// Download backup
// -------------------------------------
if (Request::get('download')) {
if (Security::check(Request::get('token'))) {
File::download($backups_path . DS . Request::get('download'));
} else { die('csrf detected!'); }
}
// Get backup list
$backups_list = File::scan($backups_path, '.zip');
// Display view
View::factory('box/backup/views/backend/index')
->assign('backups_list', $backups_list)
->display();
}
}

View File

@@ -1,32 +1,29 @@
<?php
/**
* Backup plugin
*
* @package Monstra
* @subpackage Plugins
* @author Romanenko Sergey / Awilum
* @copyright 2012 Romanenko Sergey / Awilum
* @version 1.0.0
*
*/
/**
* Backup plugin
*
* @package Monstra
* @subpackage Plugins
* @author Romanenko Sergey / Awilum
* @copyright 2012 Romanenko Sergey / Awilum
* @version 1.0.0
*
*/
// Register plugin
Plugin::register( __FILE__,
__('Backup', 'backup'),
__('Backup manager', 'backup'),
'1.0.0',
'Awilum',
'http://monstra.org/',
null,
'box');
// Register plugin
Plugin::register( __FILE__,
__('Backup', 'backup'),
__('Backup manager', 'backup'),
'1.0.0',
'Awilum',
'http://monstra.org/',
null,
'box');
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin'))) {
// Include Backup Admin
Plugin::admin('backup', 'box');
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin'))) {
// Include Backup Admin
Plugin::admin('backup', 'box');
}
}

View File

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

View File

@@ -1,17 +1,17 @@
<?php
return array(
'backup' => array(
'Backups' => 'Backups',
'Backup date' => 'Backup Datum',
'Create backup' => 'Erstelle Backup',
'Delete' => 'Löschen',
'storage' => 'Speicher',
'public' => 'Öffentliche',
'plugins' => 'Plugins',
'Size' => 'Größe',
'Actions' => 'Aktionen',
'Delete backup: :backup' => 'Lösche Backup: :backup',
'Creating...' => 'Erstellen...',
)
);
<?php
return array(
'backup' => array(
'Backups' => 'Backups',
'Backup date' => 'Backup Datum',
'Create backup' => 'Erstelle Backup',
'Delete' => 'Löschen',
'storage' => 'Speicher',
'public' => 'Öffentliche',
'plugins' => 'Plugins',
'Size' => 'Größe',
'Actions' => 'Aktionen',
'Delete backup: :backup' => 'Lösche Backup: :backup',
'Creating...' => 'Erstellen...',
)
);

View File

@@ -2,10 +2,10 @@
return array(
'backup' => array(
'Backups' => 'Backups',
'Backups' => 'Backups',
'Backup date' => 'Backup date',
'Create backup' => 'Create backup',
'Delete' => 'Delete',
'Create backup' => 'Create backup',
'Delete' => 'Delete',
'storage' => 'storage',
'public' => 'public',
'plugins' => 'plugins',
@@ -14,4 +14,4 @@
'Delete backup: :backup' => 'Delete backup: :backup',
'Creating...' => 'Creating...',
)
);
);

View File

@@ -8,10 +8,10 @@
'Delete' => 'Elimina',
'storage' => 'dati',
'public' => 'pubblica',
'plugins' => 'plugin',
'Size' => 'Dimensione',
'plugins' => 'plugin',
'Size' => 'Dimensione',
'Actions' => 'Azioni',
'Delete backup: :backup' => 'Elimina backup: :backup',
'Creating...' => 'Creazione...',
)
);
);

View File

@@ -14,4 +14,4 @@
'Delete backup: :backup' => 'Ištrinti: :backup',
'Creating...' => 'Kuriama...',
)
);
);

View File

@@ -2,10 +2,10 @@
return array(
'backup' => array(
'Backups' => 'Backups',
'Backups' => 'Backups',
'Backup date' => 'Data do backup',
'Create backup' => 'Criar',
'Delete' => 'Deletar',
'Create backup' => 'Criar',
'Delete' => 'Deletar',
'storage' => 'storage',
'public' => 'public',
'plugins' => 'plugins',
@@ -14,4 +14,4 @@
'Delete backup: :backup' => 'Deletar o backup: :backup',
'Creating...' => 'Criando backup...',
)
);
);

View File

@@ -8,10 +8,10 @@
'Delete' => 'Удалить',
'storage' => 'данные',
'public' => 'публичная',
'plugins' => 'плагины',
'Size' => 'Размер',
'plugins' => 'плагины',
'Size' => 'Размер',
'Actions' => 'Действия',
'Delete backup: :backup' => 'Удалить бекап: :backup',
'Creating...' => 'Создание...',
)
);
);

View File

@@ -8,10 +8,10 @@
'Delete' => 'Видалити',
'storage' => 'дані',
'public' => 'публічна',
'plugins' => 'плагіни',
'Size' => 'Розмір',
'plugins' => 'плагіни',
'Size' => 'Розмір',
'Actions' => 'Дії',
'Delete backup: :backup' => 'Видалити бекап: :backup',
'Creating...' => 'Створення...',
)
);
);

View File

@@ -13,11 +13,11 @@ $().ready(function(){$('[name=create_backup]').click(function(){$(this).button('
Form::hidden('csrf', Security::token()).
Form::checkbox('add_storage_folder', null, true, array('disabled' => 'disabled')) . ' ' . __('storage', 'backup') . ' ' . Html::nbsp(2) .
Form::checkbox('add_public_folder') . ' ' . __('public', 'backup') . ' ' . Html::nbsp(2) .
Form::checkbox('add_plugins_folder') . ' ' . __('plugins', 'backup') . ' ' . Html::nbsp(2) .
Form::checkbox('add_plugins_folder') . ' ' . __('plugins', 'backup') . ' ' . Html::nbsp(2) .
Form::submit('create_backup', __('Create backup', 'backup'), array('class' => 'btn', 'data-loading-text' => __('Creating...', 'backup'))).
Form::close()
Form::close()
);
?>
?>
<!-- Backup_list -->
<table class="table table-bordered">
@@ -34,18 +34,18 @@ $().ready(function(){$('[name=create_backup]').click(function(){$(this).button('
<td>
<?php $name = strtotime(str_replace('-', '', basename($backup, '.zip'))); ?>
<?php echo Html::anchor(Date::format($name, 'F jS, Y - g:i A'), Option::get('siteurl').'admin/index.php?id=backup&download='.$backup.'&token='.Security::token()); ?>
</td>
</td>
<td><?php echo Number::byteFormat(filesize(ROOT . DS . 'backups' . DS . $backup)); ?></td>
<td>
<td>
<div class="pull-right">
<?php echo Html::anchor(__('Delete', 'backup'),
'index.php?id=backup&delete_file='.$backup.'&token='.Security::token(),
array('class' => 'btn btn-small', 'onclick' => "return confirmDelete('".__('Delete backup: :backup', 'backup', array(':backup' => Date::format($name, 'F jS, Y - g:i A')))."')"));
?>
</div>
</td>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<!-- /Backup_list -->
<!-- /Backup_list -->

View File

@@ -1,149 +1,146 @@
<?php
// Add plugin navigation link
Navigation::add(__('Blocks', 'blocks'), 'content', 'blocks', 2);
// Add plugin navigation link
Navigation::add(__('Blocks', 'blocks'), 'content', 'blocks', 2);
/**
* Blocks Admin Class
*/
class BlocksAdmin extends Backend
{
/**
* Blocks Admin Class
* Blocks admin function
*/
class BlocksAdmin extends Backend {
public static function main()
{
// Init vars
$blocks_path = STORAGE . DS . 'blocks' . DS;
$blocks_list = array();
$errors = array();
// Check for get actions
// -------------------------------------
if (Request::get('action')) {
/**
* Blocks admin function
*/
public static function main() {
// Switch actions
// -------------------------------------
switch (Request::get('action')) {
// Init vars
$blocks_path = STORAGE . DS . 'blocks' . DS;
$blocks_list = array();
$errors = array();
// Check for get actions
// -------------------------------------
if (Request::get('action')) {
// Add block
// -------------------------------------
case "add_block":
// Switch actions
// -------------------------------------
switch (Request::get('action')) {
if (Request::post('add_blocks') || Request::post('add_blocks_and_exit')) {
// Add block
// -------------------------------------
case "add_block":
if (Request::post('add_blocks') || Request::post('add_blocks_and_exit')) {
if (Security::check(Request::post('csrf'))) {
if (Security::check(Request::post('csrf'))) {
if (trim(Request::post('name')) == '') $errors['blocks_empty_name'] = __('Required field', 'blocks');
if (file_exists($blocks_path.Security::safeName(Request::post('name')).'.block.html')) $errors['blocks_exists'] = __('This block already exists', 'blocks');
if (trim(Request::post('name')) == '') $errors['blocks_empty_name'] = __('Required field', 'blocks');
if (file_exists($blocks_path.Security::safeName(Request::post('name')).'.block.html')) $errors['blocks_exists'] = __('This block already exists', 'blocks');
if (count($errors) == 0) {
// Save block
File::setContent($blocks_path.Security::safeName(Request::post('name')).'.block.html', XML::safe(Request::post('editor')));
Notification::set('success', __('Your changes to the block <i>:name</i> have been saved.', 'blocks', array(':name' => Security::safeName(Request::post('name')))));
if (count($errors) == 0) {
if (Request::post('add_blocks_and_exit')) {
Request::redirect('index.php?id=blocks');
} else {
Request::redirect('index.php?id=blocks&action=edit_block&filename='.Security::safeName(Request::post('name')));
}
// Save block
File::setContent($blocks_path.Security::safeName(Request::post('name')).'.block.html', XML::safe(Request::post('editor')));
Notification::set('success', __('Your changes to the block <i>:name</i> have been saved.', 'blocks', array(':name' => Security::safeName(Request::post('name')))));
if (Request::post('add_blocks_and_exit')) {
Request::redirect('index.php?id=blocks');
} else {
Request::redirect('index.php?id=blocks&action=edit_block&filename='.Security::safeName(Request::post('name')));
}
}
} else { die('csrf detected!'); }
}
// Save fields
if (Request::post('name')) $name = Request::post('name'); else $name = '';
if (Request::post('editor')) $content = Request::post('editor'); else $content = '';
// Display view
View::factory('box/blocks/views/backend/add')
->assign('content', $content)
->assign('name', $name)
->assign('errors', $errors)
->display();
break;
} else { die('csrf detected!'); }
}
// Edit block
// -------------------------------------
case "edit_block":
// Save current block action
if (Request::post('edit_blocks') || Request::post('edit_blocks_and_exit') ) {
// Save fields
if (Request::post('name')) $name = Request::post('name'); else $name = '';
if (Request::post('editor')) $content = Request::post('editor'); else $content = '';
if (Security::check(Request::post('csrf'))) {
// Display view
View::factory('box/blocks/views/backend/add')
->assign('content', $content)
->assign('name', $name)
->assign('errors', $errors)
->display();
break;
if (trim(Request::post('name')) == '') $errors['blocks_empty_name'] = __('Required field', 'blocks');
if ((file_exists($blocks_path.Security::safeName(Request::post('name')).'.block.html')) and (Security::safeName(Request::post('blocks_old_name')) !== Security::safeName(Request::post('name')))) $errors['blocks_exists'] = __('This block already exists', 'blocks');
// Edit block
// -------------------------------------
case "edit_block":
// Save current block action
if (Request::post('edit_blocks') || Request::post('edit_blocks_and_exit') ) {
// Save fields
if (Request::post('editor')) $content = Request::post('editor'); else $content = '';
if (count($errors) == 0) {
if (Security::check(Request::post('csrf'))) {
$block_old_filename = $blocks_path.Request::post('blocks_old_name').'.block.html';
$block_new_filename = $blocks_path.Security::safeName(Request::post('name')).'.block.html';
if ( ! empty($block_old_filename)) {
if ($block_old_filename !== $block_new_filename) {
rename($block_old_filename, $block_new_filename);
$save_filename = $block_new_filename;
} else {
$save_filename = $block_new_filename;
}
if (trim(Request::post('name')) == '') $errors['blocks_empty_name'] = __('Required field', 'blocks');
if ((file_exists($blocks_path.Security::safeName(Request::post('name')).'.block.html')) and (Security::safeName(Request::post('blocks_old_name')) !== Security::safeName(Request::post('name')))) $errors['blocks_exists'] = __('This block already exists', 'blocks');
// Save fields
if (Request::post('editor')) $content = Request::post('editor'); else $content = '';
if (count($errors) == 0) {
$block_old_filename = $blocks_path.Request::post('blocks_old_name').'.block.html';
$block_new_filename = $blocks_path.Security::safeName(Request::post('name')).'.block.html';
if ( ! empty($block_old_filename)) {
if ($block_old_filename !== $block_new_filename) {
rename($block_old_filename, $block_new_filename);
$save_filename = $block_new_filename;
} else {
$save_filename = $block_new_filename;
}
// Save block
File::setContent($save_filename, XML::safe(Request::post('editor')));
Notification::set('success', __('Your changes to the block <i>:name</i> have been saved.', 'blocks', array(':name' => basename($save_filename, '.block.html'))));
if (Request::post('edit_blocks_and_exit')) {
Request::redirect('index.php?id=blocks');
} else {
Request::redirect('index.php?id=blocks&action=edit_block&filename='.Security::safeName(Request::post('name')));
}
} else {
$save_filename = $block_new_filename;
}
} else { die('csrf detected!'); }
}
if (Request::post('name')) $name = Request::post('name'); else $name = File::name(Request::get('filename'));
if (Request::post('editor')) $content = Request::post('editor'); else $content = File::getContent($blocks_path.Request::get('filename').'.block.html');
// Save block
File::setContent($save_filename, XML::safe(Request::post('editor')));
// Display view
View::factory('box/blocks/views/backend/edit')
->assign('content', Text::toHtml($content))
->assign('name', $name)
->assign('errors', $errors)
->display();
break;
case "delete_block":
Notification::set('success', __('Your changes to the block <i>:name</i> have been saved.', 'blocks', array(':name' => basename($save_filename, '.block.html'))));
if (Security::check(Request::get('token'))) {
if (Request::post('edit_blocks_and_exit')) {
Request::redirect('index.php?id=blocks');
} else {
Request::redirect('index.php?id=blocks&action=edit_block&filename='.Security::safeName(Request::post('name')));
}
}
File::delete($blocks_path.Request::get('filename').'.block.html');
Notification::set('success', __('Block <i>:name</i> deleted', 'blocks', array(':name' => File::name(Request::get('filename')))));
Request::redirect('index.php?id=blocks');
} else { die('csrf detected!'); }
}
if (Request::post('name')) $name = Request::post('name'); else $name = File::name(Request::get('filename'));
if (Request::post('editor')) $content = Request::post('editor'); else $content = File::getContent($blocks_path.Request::get('filename').'.block.html');
} else { die('csrf detected!'); }
break;
}
} else {
// Display view
View::factory('box/blocks/views/backend/edit')
->assign('content', Text::toHtml($content))
->assign('name', $name)
->assign('errors', $errors)
->display();
break;
case "delete_block":
if (Security::check(Request::get('token'))) {
// Get blocks
$blocks_list = File::scan($blocks_path, '.block.html');
File::delete($blocks_path.Request::get('filename').'.block.html');
Notification::set('success', __('Block <i>:name</i> deleted', 'blocks', array(':name' => File::name(Request::get('filename')))));
Request::redirect('index.php?id=blocks');
// Display view
View::factory('box/blocks/views/backend/index')
->assign('blocks_list', $blocks_list)
->display();
} else { die('csrf detected!'); }
break;
}
} else {
// Get blocks
$blocks_list = File::scan($blocks_path, '.block.html');
// Display view
View::factory('box/blocks/views/backend/index')
->assign('blocks_list', $blocks_list)
->display();
}
}
}
}

View File

@@ -1,118 +1,115 @@
<?php
/**
* Blocks plugin
*
* @package Monstra
* @subpackage Plugins
* @author Romanenko Sergey / Awilum
* @copyright 2012 Romanenko Sergey / Awilum
* @version 1.0.0
*
*/
// Register plugin
Plugin::register( __FILE__,
__('Blocks', 'blocks'),
__('Blocks manager plugin', 'blocks'),
'1.0.0',
'Awilum',
'http://monstra.org/',
null,
'box');
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor'))) {
// Include Admin
Plugin::admin('blocks', 'box');
}
// Add Plugin Javascript
Javascript::add('plugins/box/blocks/js/blocks.js', 'backend');
// Add shortcode {block get="blockname"}
Shortcode::add('block', 'Block::_content');
// Add shortcode {block_inline name="blockname"}
Shortcode::add('block_inline', 'Block::_inlineBlock');
// Add shortcode {block_inline_create name="blockname"} Block content here {/block_inline_create}
Shortcode::add('block_inline_create', 'Block::_createInlineBlock');
/**
* Block Class
*/
class Block
{
/**
* Blocks plugin
*
* @package Monstra
* @subpackage Plugins
* @author Romanenko Sergey / Awilum
* @copyright 2012 Romanenko Sergey / Awilum
* @version 1.0.0
* Inline Blocks
*
* @var array
*/
public static $inline_blocks = array();
// Register plugin
Plugin::register( __FILE__,
__('Blocks', 'blocks'),
__('Blocks manager plugin', 'blocks'),
'1.0.0',
'Awilum',
'http://monstra.org/',
null,
'box');
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor'))) {
// Include Admin
Plugin::admin('blocks', 'box');
/**
* Create Inline Block
*/
public static function _createInlineBlock($attributes, $content)
{
if (isset($attributes['name'])) {
Block::$inline_blocks[Security::safeName($attributes['name'], '_', true)] = array(
'content' => (string) $content,
);
}
}
// Add Plugin Javascript
Javascript::add('plugins/box/blocks/js/blocks.js', 'backend');
// Add shortcode {block get="blockname"}
Shortcode::add('block', 'Block::_content');
// Add shortcode {block_inline name="blockname"}
Shortcode::add('block_inline', 'Block::_inlineBlock');
// Add shortcode {block_inline_create name="blockname"} Block content here {/block_inline_create}
Shortcode::add('block_inline_create', 'Block::_createInlineBlock');
/**
* Block Class
* Draw Inline Block
*/
class Block {
public static function _inlineBlock($attributes)
{
if (isset($attributes['name']) && isset(Block::$inline_blocks[$attributes['name']])) {
$content = Filter::apply('content', Text::toHtml(Block::$inline_blocks[$attributes['name']]['content']));
return $content;
} else {
return '';
}
}
/**
* Inline Blocks
*
* @var array
*/
public static $inline_blocks = array();
/**
* Get block
*
* @param string $name Block file name
*/
public static function get($name)
{
return Block::_content(array('get' => $name));
}
/**
* Returns block content for shortcode {block get="blockname"}
*
* @param array $attributes block filename
*/
public static function _content($attributes)
{
if (isset($attributes['get'])) $name = (string) $attributes['get']; else $name = '';
/**
* Create Inline Block
*/
public static function _createInlineBlock($attributes, $content) {
if (isset($attributes['name'])) {
Block::$inline_blocks[Security::safeName($attributes['name'], '_', true)] = array(
'content' => (string)$content,
);
$block_path = STORAGE . DS . 'blocks' . DS . $name . '.block.html';
if (File::exists($block_path)) {
ob_start();
include $block_path;
$block_contents = ob_get_contents();
ob_end_clean();
return Filter::apply('content', Text::toHtml($block_contents));
} else {
if (Session::exists('admin') && Session::get('admin') == true) {
return __('<b>Block <u>:name</u> is not found!</b>', 'blocks', array(':name' => $name));
}
}
/**
* Draw Inline Block
*/
public static function _inlineBlock($attributes) {
if (isset($attributes['name']) && isset(Block::$inline_blocks[$attributes['name']])) {
$content = Filter::apply('content', Text::toHtml(Block::$inline_blocks[$attributes['name']]['content']));
return $content;
} else {
return '';
}
}
/**
* Get block
*
* @param string $name Block file name
*/
public static function get($name) {
return Block::_content(array('get' => $name));
}
/**
* Returns block content for shortcode {block get="blockname"}
*
* @param array $attributes block filename
*/
public static function _content($attributes) {
if (isset($attributes['get'])) $name = (string)$attributes['get']; else $name = '';
$block_path = STORAGE . DS . 'blocks' . DS . $name . '.block.html';
if (File::exists($block_path)) {
ob_start();
include $block_path;
$block_contents = ob_get_contents();
ob_end_clean();
return Filter::apply('content', Text::toHtml($block_contents));
} else {
if (Session::exists('admin') && Session::get('admin') == true) {
return __('<b>Block <u>:name</u> is not found!</b>', 'blocks', array(':name' => $name));
}
}
}
}
}
}

View File

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

View File

@@ -1,29 +1,29 @@
<?php
return array(
'blocks' => array(
'Blocks' => 'Blöcke',
'Blocks manager' => 'Block-Manager',
'Delete' => 'Löschen',
'Edit' => 'Bearbeiten',
'Name' => 'Name',
'Create new block' => 'Erstelle einen neuen Block',
'New block' => 'Neuer Block',
'Edit block' => 'Bearbeite Block',
'Save' => 'Save',
'Save and exit' => 'Speichern und Schließen',
'Actions' => 'Aktionen',
'Required field' => 'Erforderliches Feld',
'This block already exists' => 'Dieser Block existiert bereits',
'This block does not exist' => 'Dieser Block existiert nicht',
'Delete block: :block' => 'Lösche Block: :block',
'Block content' => 'Block-Inhalt',
'Block <i>:name</i> deleted' => 'Block <i>:name</i> gelöscht',
'Your changes to the block <i>:name</i> have been saved.' => 'Deine Änderungen für den Block <i>:name</i> wurden übernommen.',
'Delete block: :block' => 'Lösche Block: :block',
'View Embed Code' => 'View Embed Code',
'Embed Code' => 'Embed Code',
'Shortcode' => 'Shortcode',
'PHP Code' => 'PHP Code',
)
);
<?php
return array(
'blocks' => array(
'Blocks' => 'Blöcke',
'Blocks manager' => 'Block-Manager',
'Delete' => 'Löschen',
'Edit' => 'Bearbeiten',
'Name' => 'Name',
'Create new block' => 'Erstelle einen neuen Block',
'New block' => 'Neuer Block',
'Edit block' => 'Bearbeite Block',
'Save' => 'Save',
'Save and exit' => 'Speichern und Schließen',
'Actions' => 'Aktionen',
'Required field' => 'Erforderliches Feld',
'This block already exists' => 'Dieser Block existiert bereits',
'This block does not exist' => 'Dieser Block existiert nicht',
'Delete block: :block' => 'Lösche Block: :block',
'Block content' => 'Block-Inhalt',
'Block <i>:name</i> deleted' => 'Block <i>:name</i> gelöscht',
'Your changes to the block <i>:name</i> have been saved.' => 'Deine Änderungen für den Block <i>:name</i> wurden übernommen.',
'Delete block: :block' => 'Lösche Block: :block',
'View Embed Code' => 'View Embed Code',
'Embed Code' => 'Embed Code',
'Shortcode' => 'Shortcode',
'PHP Code' => 'PHP Code',
)
);

View File

@@ -3,16 +3,16 @@
return array(
'blocks' => array(
'Blocks' => 'Blocks',
'Blocks manager' => 'Blocks manager',
'Blocks manager' => 'Blocks manager',
'Delete' => 'Delete',
'Edit' => 'Edit',
'Name' => 'Name',
'Create new block' => 'Create new block',
'New block' => 'New block',
'Edit block' => 'Edit block',
'Save' => 'Save',
'Save and exit' => 'Save and exit',
'Actions' => 'Actions',
'Edit block' => 'Edit block',
'Save' => 'Save',
'Save and exit' => 'Save and exit',
'Actions' => 'Actions',
'Required field' => 'Required field',
'This block already exists' => 'This block already exists',
'This block does not exist' => 'This block does not exist',
@@ -22,8 +22,8 @@
'Your changes to the block <i>:name</i> have been saved.' => 'Your changes to the block <i>:name</i> have been saved.',
'Delete block: :block' => 'Delete block: :block',
'View Embed Code' => 'View Embed Code',
'Embed Code' => 'Embed Code',
'Embed Code' => 'Embed Code',
'Shortcode' => 'Shortcode',
'PHP Code' => 'PHP Code',
)
);
);

View File

@@ -3,16 +3,16 @@
return array(
'blocks' => array(
'Blocks' => 'Blocchi',
'Blocks manager' => 'Gestione blocchi',
'Blocks manager' => 'Gestione blocchi',
'Delete' => 'Elimina',
'Edit' => 'Modifica',
'New block' => 'Nuovo blocco',
'Create new block' => 'Crea nuovo blocco',
'New block' => 'Nuovo blocco',
'Create new block' => 'Crea nuovo blocco',
'Name' => 'Nome',
'Edit block' => 'Modifica blocco',
'Save' => 'Salva',
'Save' => 'Salva',
'Actions' => 'Azioni',
'Save and exit' => 'Salva ed esci',
'Save and exit' => 'Salva ed esci',
'Required field' => 'Campo obbligatorio',
'This block already exists' => 'Tale blocco già esistente',
'This block does not exist' => 'Tale blocco non esiste',
@@ -22,8 +22,8 @@
'Your changes to the block <i>:name</i> have been saved.' => 'Le modifiche al blocco: <i>nome</ i> sono state salvate.',
'Delete block: :block' => 'Elimina blocco: :block',
'View Embed Code' => 'View Embed Code',
'Embed Code' => 'Embed Code',
'Embed Code' => 'Embed Code',
'Shortcode' => 'Shortcode',
'PHP Code' => 'PHP Code',
)
);
);

View File

@@ -12,7 +12,7 @@
'Edit block' => 'Redaguoti bloką',
'Save' => 'Išsaugoti',
'Save and exit' => 'Išsaugoti ir išeiti',
'Actions' => 'Veiksmai',
'Actions' => 'Veiksmai',
'Required field' => 'Privalomas laukas',
'This block already exists' => 'Toks blokas jau yra',
'This block does not exist' => 'Tokio bloko nėra',
@@ -22,8 +22,8 @@
'Your changes to the block <i>:name</i> have been saved.' => 'Bloko <i>:name</i> pakeitimai išsaugoti.',
'Delete block: :block' => 'Delete block: :block',
'View Embed Code' => 'View Embed Code',
'Embed Code' => 'Embed Code',
'Embed Code' => 'Embed Code',
'Shortcode' => 'Shortcode',
'PHP Code' => 'PHP Code',
)
);
);

View File

@@ -9,7 +9,7 @@
'Name' => 'Nome',
'Create new block' => 'Criar novo bloco',
'New block' => 'Novo bloco',
'Edit block' => 'Editar bloco',
'Edit block' => 'Editar bloco',
'Save' => 'Salvar',
'Save and exit' => 'Salvar e sair',
'Actions' => 'Ações',
@@ -22,8 +22,8 @@
'Your changes to the block <i>:name</i> have been saved.' => 'Suas mudanças no bloco <i>:name</i> foram salvas',
'Delete block: :block' => 'Delete block: :block',
'View Embed Code' => 'View Embed Code',
'Embed Code' => 'Embed Code',
'Embed Code' => 'Embed Code',
'Shortcode' => 'Shortcode',
'PHP Code' => 'PHP Code',
)
);
);

View File

@@ -3,16 +3,16 @@
return array(
'blocks' => array(
'Blocks' => 'Блоки',
'Blocks manager' => 'Менеджер блоков',
'Blocks manager' => 'Менеджер блоков',
'Delete' => 'Удалить',
'Edit' => 'Редактировать',
'New block' => 'Новый блок',
'Create new block' => 'Создать новый блок',
'New block' => 'Новый блок',
'Create new block' => 'Создать новый блок',
'Name' => 'Название',
'Edit block' => 'Редактирование блока',
'Save' => 'Сохранить',
'Save' => 'Сохранить',
'Actions' => 'Действия',
'Save and exit' => 'Сохранить и выйти',
'Save and exit' => 'Сохранить и выйти',
'Required field' => 'Обязательное поле',
'This block already exists' => 'Такой блок уже существует',
'This block does not exist' => 'Такого блока не существует',
@@ -22,8 +22,8 @@
'Your changes to the block <i>:name</i> have been saved.' => 'Ваши изменения к блоку <i>:name</i> были сохранены.',
'Delete block: :block' => 'Удалить блок: :block',
'View Embed Code' => 'Код для вставки',
'Embed Code' => 'Код для вставки',
'Embed Code' => 'Код для вставки',
'Shortcode' => 'Шорткод',
'PHP Code' => 'PHP код',
)
);
);

View File

@@ -3,16 +3,16 @@
return array(
'blocks' => array(
'Blocks' => 'Блоки',
'Blocks manager' => 'Менеджер блоків',
'Blocks manager' => 'Менеджер блоків',
'Delete' => 'Видалити',
'Edit' => 'Редагувати',
'New block' => 'Новий блок',
'Create new block' => 'Створити новий блок',
'New block' => 'Новий блок',
'Create new block' => 'Створити новий блок',
'Name' => 'Назва',
'Edit block' => 'Редагування блоку',
'Save' => 'Зберегти',
'Save' => 'Зберегти',
'Actions' => 'Дії',
'Save and exit' => 'Зберегти та вийти',
'Save and exit' => 'Зберегти та вийти',
'Required field' => 'Обов&prime;язкове поле',
'This block already exists' => 'Такий блок вже існує',
'This block does not exist' => 'Такого блоку не існує',
@@ -22,8 +22,8 @@
'Your changes to the block <i>:name</i> have been saved.' => 'Ваші зміни до блоку <i>:name</i> були збережені.',
'Delete block: :block' => 'Видалити блок: :block',
'View Embed Code' => 'Код для вставки',
'Embed Code' => 'Код для вставки',
'Embed Code' => 'Код для вставки',
'Shortcode' => 'Шорткод',
'PHP Code' => 'PHP код',
)
);
);

View File

@@ -5,12 +5,10 @@
<?php if (isset($errors['blocks_empty_name']) or isset($errors['blocks_exists'])) $error_class = 'error'; else $error_class = ''; ?>
<?php echo (Form::open()); ?>
<?php echo (Form::hidden('csrf', Security::token())); ?>
<?php echo (Form::label('name', __('Name', 'blocks'))); ?>
<?php echo (Form::input('name', $name, array('class' => (isset($errors['blocks_empty_name']) || isset($errors['blocks_exists'])) ? 'input-xxlarge error-field' : 'input-xxlarge'))); ?>
@@ -33,4 +31,3 @@
);
?>

View File

@@ -16,7 +16,6 @@
?>
<?php echo (Form::label('name', __('Name', 'blocks'))); ?>
<?php echo (Form::input('name', $name, array('class' => (isset($errors['blocks_empty_name']) || isset($errors['blocks_exists'])) ? 'input-xxlarge error-field' : 'input-xxlarge'))); ?>
@@ -28,7 +27,7 @@
<br /><br />
<?php
Action::run('admin_editor', array(Html::toText($content)));
echo (
@@ -37,8 +36,8 @@
Form::submit('edit_blocks', __('Save', 'blocks'), array('class' => 'btn default')). Html::nbsp().
Form::close()
);
} else {
echo '<div class="message-error">'.__('This block does not exist', 'blocks').'</div>';
}
?>
?>

View File

@@ -4,9 +4,9 @@
<?php if(Notification::get('success')) Alert::success(Notification::get('success')); ?>
<?php
echo (
echo (
Html::anchor(__('Create New Block', 'blocks'), 'index.php?id=blocks&action=add_block', array('title' => __('Create new block', 'blocks'), 'class' => 'btn default btn-small')). Html::nbsp(3)
);
);
?>
<br /><br />
@@ -31,7 +31,7 @@
<a class="btn dropdown-toggle btn-actions btn-small" data-toggle="dropdown" href="#" style="font-family:arial;"><span class="caret"></span></a>
<ul class="dropdown-menu">
<li><?php echo Html::anchor(__('View Embed Code', 'blocks'), 'javascript:;', array('title' => __('View Embed Code', 'blocks'), 'onclick' => '$.monstra.blocks.showEmbedCodes("'.basename($block, '.block.html').'");')); ?></li>
</ul>
</ul>
<?php echo Html::anchor(__('Delete', 'blocks'),
'index.php?id=blocks&action=delete_block&filename='.basename($block, '.block.html').'&token='.Security::token(),
array('class' => 'btn btn-actions btn-small btn-actions-default', 'onclick' => "return confirmDelete('".__('Delete block: :block', 'blocks', array(':block' => basename($block, '.block.html')))."')"));
@@ -60,4 +60,4 @@
<code id="phpcode"></code>
</p>
</div>
</div>
</div>

View File

@@ -1,43 +1,42 @@
<?php
/**
* Editor plugin
*
* @package Monstra
* @subpackage Plugins
* @author Romanenko Sergey / Awilum
* @copyright 2012 Romanenko Sergey / Awilum
* @version 1.0.0
*
*/
// Register plugin
Plugin::register( __FILE__,
__('Editor', 'editor'),
__('Editor plugin', 'editor'),
'1.0.0',
'Awilum',
'http://monstra.org/',
null,
'box');
// Add action
Action::add('admin_editor', 'Editor::render', 10, array());
/**
* Editor class
*/
class Editor
{
/**
* Editor plugin
*
* @package Monstra
* @subpackage Plugins
* @author Romanenko Sergey / Awilum
* @copyright 2012 Romanenko Sergey / Awilum
* @version 1.0.0
* Render editor
*
* @param string $val editor data
*/
public static function render($val = null)
{
echo ('<div id="editor_panel"></div><div><textarea id="editor_area" name="editor" style="width:100%; height:320px;">'.$val.'</textarea></div>');
}
// Register plugin
Plugin::register( __FILE__,
__('Editor', 'editor'),
__('Editor plugin', 'editor'),
'1.0.0',
'Awilum',
'http://monstra.org/',
null,
'box');
// Add action
Action::add('admin_editor', 'Editor::render', 10, array());
/**
* Editor class
*/
class Editor {
/**
* Render editor
*
* @param string $val editor data
*/
public static function render($val = null) {
echo ('<div id="editor_panel"></div><div><textarea id="editor_area" name="editor" style="width:100%; height:320px;">'.$val.'</textarea></div>');
}
}
}

View File

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

View File

@@ -1,8 +1,8 @@
<?php
return array(
'Editor' => array(
'Editor' => 'Editor',
'Editor plugin' => 'Editor Plugin',
)
);
<?php
return array(
'Editor' => array(
'Editor' => 'Editor',
'Editor plugin' => 'Editor Plugin',
)
);

View File

@@ -3,6 +3,6 @@
return array(
'Editor' => array(
'Editor' => 'Editor',
'Editor plugin' => 'Editor plugin',
'Editor plugin' => 'Editor plugin',
)
);
);

View File

@@ -3,6 +3,6 @@
return array(
'Editor' => array(
'Editor' => 'Editor',
'Editor plugin' => 'Editor plugin',
'Editor plugin' => 'Editor plugin',
)
);
);

View File

@@ -3,6 +3,6 @@
return array(
'Editor' => array(
'Editor' => 'Redaktorius',
'Editor plugin' => 'Redaktoriaus papildinys',
'Editor plugin' => 'Redaktoriaus papildinys',
)
);
);

View File

@@ -5,4 +5,4 @@
'Editor' => 'Editor',
'Editor plugin' => 'Plugin do editor',
)
);
);

View File

@@ -3,6 +3,6 @@
return array(
'Editor' => array(
'Editor' => 'Редактор',
'Editor plugin' => 'Редактор плагин',
'Editor plugin' => 'Редактор плагин',
)
);
);

View File

@@ -3,6 +3,6 @@
return array(
'Editor' => array(
'Editor' => 'Редактор',
'Editor plugin' => 'Редактор плагіну',
'Editor plugin' => 'Редактор плагіну',
)
);
);

View File

@@ -1,162 +1,163 @@
<?php
// Add plugin navigation link
Navigation::add(__('Files', 'filesmanager'), 'content', 'filesmanager', 3);
// Add plugin navigation link
Navigation::add(__('Files', 'filesmanager'), 'content', 'filesmanager', 3);
/**
* Filesmanager Admin Class
*/
class FilesmanagerAdmin extends Backend
{
/**
* Main function
*/
public static function main()
{
// Array of forbidden types
$forbidden_types = array('html', 'htm', 'js', 'jsb', 'mhtml', 'mht',
'php', 'phtml', 'php3', 'php4', 'php5', 'phps',
'shtml', 'jhtml', 'pl', 'py', 'cgi', 'sh', 'ksh', 'bsh', 'c', 'htaccess', 'htpasswd',
'exe', 'scr', 'dll', 'msi', 'vbs', 'bat', 'com', 'pif', 'cmd', 'vxd', 'cpl');
// Array of image types
$image_types = array('jpg', 'png', 'bmp', 'gif', 'tif');
// Get Site url
$site_url = Option::get('siteurl');
// Init vars
if (Request::get('path')) $path = Request::get('path'); else $path = 'uploads/';
// Add slash if not exists
if (substr($path, -1, 1) != '/') {
$path .= '/';
Request::redirect($site_url.'admin/index.php?id=filesmanager&path='.$path);
}
// Upload corectly!
if ($path == 'uploads' || $path == 'uploads//') {
$path = 'uploads/';
Request::redirect($site_url.'admin/index.php?id=filesmanager&path='.$path);
}
// Only 'uploads' folder!
if (strpos($path, 'uploads') === false) {
$path = 'uploads/';
Request::redirect($site_url.'admin/index.php?id=filesmanager&path='.$path);
}
// Set default path value if path is empty
if ($path == '') {
$path = 'uploads/';
Request::redirect($site_url.'admin/index.php?id=filesmanager&path='.$path);
}
$files_path = ROOT . DS . 'public' . DS . $path;
$files_list = array();
$current = explode('/', $path);
// Get information about current path
$_list = FilesmanagerAdmin::fdir($files_path);
$files_list = array();
// Get files
if (isset($_list['files'])) {
foreach ($_list['files'] as $files) {
$files_list[] = $files;
}
}
$dir_list = array();
// Get dirs
if (isset($_list['dirs'])) {
foreach ($_list['dirs'] as $dirs) {
if (strpos($dirs, '.') === false) $dir_list[] = $dirs;
}
}
// Delete file
// -------------------------------------
if (Request::get('id') == 'filesmanager' && Request::get('delete_file')) {
if (Security::check(Request::get('token'))) {
File::delete($files_path.Request::get('delete_file'));
Request::redirect($site_url.'admin/index.php?id=filesmanager&path='.$path);
} else { die('csrf detected!'); }
}
// Delete dir
// -------------------------------------
if (Request::get('id') == 'filesmanager' && Request::get('delete_dir')) {
if (Security::check(Request::get('token'))) {
Dir::delete($files_path.Request::get('delete_dir'));
Request::redirect($site_url.'admin/index.php?id=filesmanager&path='.$path);
} else { die('csrf detected!'); }
}
// Upload file
// -------------------------------------
if (Request::post('upload_file')) {
if (Security::check(Request::post('csrf'))) {
if ($_FILES['file']) {
if ( ! in_array(File::ext($_FILES['file']['name']), $forbidden_types)) {
move_uploaded_file($_FILES['file']['tmp_name'], $files_path.Security::safeName(basename($_FILES['file']['name'], File::ext($_FILES['file']['name'])), '-', true).'.'.File::ext($_FILES['file']['name']));
Request::redirect($site_url.'admin/index.php?id=filesmanager&path='.$path);
}
}
} else { die('csrf detected!'); }
}
// Display view
View::factory('box/filesmanager/views/backend/index')
->assign('path', $path)
->assign('current', $current)
->assign('files_list', $files_list)
->assign('dir_list', $dir_list)
->assign('forbidden_types', $forbidden_types)
->assign('image_types', $image_types)
->assign('site_url', $site_url)
->assign('files_path', $files_path)
->display();
}
/**
* Filesmanager Admin Class
* Get directories and files in current path
*/
class FilesmanagerAdmin extends Backend {
/**
* Main function
*/
public static function main() {
// Array of forbidden types
$forbidden_types = array('html', 'htm', 'js', 'jsb', 'mhtml', 'mht',
'php', 'phtml', 'php3', 'php4', 'php5', 'phps',
'shtml', 'jhtml', 'pl', 'py', 'cgi', 'sh', 'ksh', 'bsh', 'c', 'htaccess', 'htpasswd',
'exe', 'scr', 'dll', 'msi', 'vbs', 'bat', 'com', 'pif', 'cmd', 'vxd', 'cpl');
// Array of image types
$image_types = array('jpg', 'png', 'bmp', 'gif', 'tif');
// Get Site url
$site_url = Option::get('siteurl');
// Init vars
if (Request::get('path')) $path = Request::get('path'); else $path = 'uploads/';
// Add slash if not exists
if (substr($path, -1, 1) != '/') {
$path .= '/';
Request::redirect($site_url.'admin/index.php?id=filesmanager&path='.$path);
}
// Upload corectly!
if ($path == 'uploads' || $path == 'uploads//') {
$path = 'uploads/';
Request::redirect($site_url.'admin/index.php?id=filesmanager&path='.$path);
}
// Only 'uploads' folder!
if (strpos($path, 'uploads') === false) {
$path = 'uploads/';
Request::redirect($site_url.'admin/index.php?id=filesmanager&path='.$path);
}
// Set default path value if path is empty
if ($path == '') {
$path = 'uploads/';
Request::redirect($site_url.'admin/index.php?id=filesmanager&path='.$path);
}
$files_path = ROOT . DS . 'public' . DS . $path;
$files_list = array();
$current = explode('/', $path);
// Get information about current path
$_list = FilesmanagerAdmin::fdir($files_path);
$files_list = array();
// Get files
if (isset($_list['files'])) {
foreach ($_list['files'] as $files) {
$files_list[] = $files;
}
}
$dir_list = array();
// Get dirs
if (isset($_list['dirs'])) {
foreach ($_list['dirs'] as $dirs) {
if (strpos($dirs, '.') === false) $dir_list[] = $dirs;
}
}
// Delete file
// -------------------------------------
if (Request::get('id') == 'filesmanager' && Request::get('delete_file')) {
if (Security::check(Request::get('token'))) {
File::delete($files_path.Request::get('delete_file'));
Request::redirect($site_url.'admin/index.php?id=filesmanager&path='.$path);
} else { die('csrf detected!'); }
}
// Delete dir
// -------------------------------------
if (Request::get('id') == 'filesmanager' && Request::get('delete_dir')) {
if (Security::check(Request::get('token'))) {
Dir::delete($files_path.Request::get('delete_dir'));
Request::redirect($site_url.'admin/index.php?id=filesmanager&path='.$path);
} else { die('csrf detected!'); }
}
// Upload file
// -------------------------------------
if (Request::post('upload_file')) {
if (Security::check(Request::post('csrf'))) {
if ($_FILES['file']) {
if ( ! in_array(File::ext($_FILES['file']['name']), $forbidden_types)) {
move_uploaded_file($_FILES['file']['tmp_name'], $files_path.Security::safeName(basename($_FILES['file']['name'], File::ext($_FILES['file']['name'])), '-', true).'.'.File::ext($_FILES['file']['name']));
Request::redirect($site_url.'admin/index.php?id=filesmanager&path='.$path);
}
}
} else { die('csrf detected!'); }
}
// Display view
View::factory('box/filesmanager/views/backend/index')
->assign('path', $path)
->assign('current', $current)
->assign('files_list', $files_list)
->assign('dir_list', $dir_list)
->assign('forbidden_types', $forbidden_types)
->assign('image_types', $image_types)
->assign('site_url', $site_url)
->assign('files_path', $files_path)
->display();
}
/**
* Get directories and files in current path
*/
protected static function fdir($dir, $type = null) {
$files = array();
$c = 0;
$_dir = $dir;
if (is_dir($dir)) {
$dir = opendir ($dir);
while (false !== ($file = readdir($dir))) {
if (($file !=".") && ($file !="..")) {
$c++;
if (is_dir($_dir.$file)) {
$files['dirs'][$c] = $file;
} else {
$files['files'][$c] = $file;
}
protected static function fdir($dir, $type = null)
{
$files = array();
$c = 0;
$_dir = $dir;
if (is_dir($dir)) {
$dir = opendir ($dir);
while (false !== ($file = readdir($dir))) {
if (($file !=".") && ($file !="..")) {
$c++;
if (is_dir($_dir.$file)) {
$files['dirs'][$c] = $file;
} else {
$files['files'][$c] = $file;
}
}
closedir($dir);
return $files;
} else {
return false;
}
closedir($dir);
return $files;
} else {
return false;
}
}
}

View File

@@ -1,34 +1,32 @@
<?php
/**
* Files manager plugin
*
* @package Monstra
* @subpackage Plugins
* @author Romanenko Sergey / Awilum
* @copyright 2012 Romanenko Sergey / Awilum
* @version 1.0.0
*
*/
/**
* Files manager plugin
*
* @package Monstra
* @subpackage Plugins
* @author Romanenko Sergey / Awilum
* @copyright 2012 Romanenko Sergey / Awilum
* @version 1.0.0
*
*/
// Register plugin
Plugin::register( __FILE__,
__('Files manager', 'filesmanager'),
__('Files manager', 'filesmanager'),
'1.0.0',
'Awilum',
'http://monstra.org/',
null,
'box');
// Register plugin
Plugin::register( __FILE__,
__('Files manager', 'filesmanager'),
__('Files manager', 'filesmanager'),
'1.0.0',
'Awilum',
'http://monstra.org/',
null,
'box');
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor'))) {
// Include Admin
Plugin::admin('filesmanager', 'box');
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor'))) {
}
// Include Admin
Plugin::admin('filesmanager', 'box');
}
// Add Plugin Javascript
Javascript::add('plugins/box/filesmanager/js/filesmanager.js', 'backend');
// Add Plugin Javascript
Javascript::add('plugins/box/filesmanager/js/filesmanager.js', 'backend');

View File

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

View File

@@ -1,17 +1,17 @@
<?php
return array(
'filesmanager' => array(
'Files' => 'Dateien',
'Files manager' => 'Datei-Manager',
'Name' => 'Name',
'Actions' => 'Aktionen',
'Delete' => 'Löschen',
'Upload' => 'Hochladen',
'directory' => 'Ordner',
'Delete directory: :dir' => 'Lösche Ordner: :dir',
'Delete file: :file' => 'Lösche Datei: file',
'Extension' => 'Dateiendung',
'Size' => 'Größe',
)
);
<?php
return array(
'filesmanager' => array(
'Files' => 'Dateien',
'Files manager' => 'Datei-Manager',
'Name' => 'Name',
'Actions' => 'Aktionen',
'Delete' => 'Löschen',
'Upload' => 'Hochladen',
'directory' => 'Ordner',
'Delete directory: :dir' => 'Lösche Ordner: :dir',
'Delete file: :file' => 'Lösche Datei: file',
'Extension' => 'Dateiendung',
'Size' => 'Größe',
)
);

View File

@@ -4,14 +4,14 @@
'filesmanager' => array(
'Files' => 'Files',
'Files manager' => 'Files manager',
'Name' => 'Name',
'Name' => 'Name',
'Actions' => 'Actions',
'Delete' => 'Delete',
'Upload' => 'Upload',
'directory' => 'directory',
'Delete directory: :dir' => 'Delete directory: :dir',
'Delete directory: :dir' => 'Delete directory: :dir',
'Delete file: :file' => 'Delete file :file',
'Extension' => 'Extension',
'Size' => 'Size',
)
);
);

View File

@@ -3,7 +3,7 @@
return array(
'filesmanager' => array(
'Files' => 'File',
'Files manager' => 'Gestione file',
'Files manager' => 'Gestione file',
'Name' => 'Nome',
'Actions' => 'Azioni',
'Delete' => 'Elimina',
@@ -14,4 +14,4 @@
'Extension' => 'Estensione',
'Size' => 'Dimensione',
)
);
);

View File

@@ -4,14 +4,14 @@
'filesmanager' => array(
'Files' => 'Bylos',
'Files manager' => 'Bylų tvarkyklė',
'Name' => 'Pavadinimas',
'Name' => 'Pavadinimas',
'Actions' => 'Veiksmai',
'Delete' => 'Ištrinti',
'Upload' => 'Įkelti',
'directory' => 'aplankas',
'Delete directory: :dir' => 'Ištrinti aplanką: :dir',
'Delete directory: :dir' => 'Ištrinti aplanką: :dir',
'Delete file: :file' => 'Ištrinti bylą :file',
'Extension' => 'Plėtinys',
'Size' => 'Dydis',
)
);
);

View File

@@ -9,9 +9,9 @@
'Delete' => 'Deletar',
'Upload' => 'Upload',
'directory' => 'directory',
'Delete directory: :dir' => 'Deletar o diretório: :dir',
'Delete directory: :dir' => 'Deletar o diretório: :dir',
'Delete file: :file' => 'Deletar o arquivo :file',
'Extension' => 'Extensão',
'Size' => 'Tamanho',
)
);
);

View File

@@ -3,7 +3,7 @@
return array(
'filesmanager' => array(
'Files' => 'Файлы',
'Files manager' => 'Менеджер файлов',
'Files manager' => 'Менеджер файлов',
'Name' => 'Название',
'Actions' => 'Действия',
'Delete' => 'Удалить',
@@ -14,4 +14,4 @@
'Extension' => 'Расширение',
'Size' => 'Размер',
)
);
);

View File

@@ -3,7 +3,7 @@
return array(
'filesmanager' => array(
'Files' => 'Файли',
'Files manager' => 'Менеджер файлів',
'Files manager' => 'Менеджер файлів',
'Name' => 'Назва',
'Actions' => 'Дії',
'Delete' => 'Видалити',
@@ -14,4 +14,4 @@
'Extension' => 'Розширення',
'Size' => 'Розмір',
)
);
);

View File

@@ -26,12 +26,12 @@
}
$s = '';
foreach ($path_parts as $p) {
$s .= $p.'/';
if($p == $current[count($current)-2]) $active = ' class="active"'; else $active = '';
echo '<li'.$active.'><a href="index.php?id=filesmanager&path='.$s.'">'.$p.'</a> <span class="divider">/</span></li>';
}
if($p == $current[count($current)-2]) $active = ' class="active"'; else $active = '';
echo '<li'.$active.'><a href="index.php?id=filesmanager&path='.$s.'">'.$p.'</a> <span class="divider">/</span></li>';
}
?>
</ul>
<!-- /Filesmanger_path -->
@@ -47,12 +47,12 @@
</thead>
<tbody>
<?php if (isset($dir_list)) foreach ($dir_list as $dir) { ?>
<tr>
<tr>
<td>
<b><?php echo Html::anchor($dir, 'index.php?id=filesmanager&path='.$path.$dir.'/'); ?></b>
</td>
<td>
</td>
<td>
<?php echo Number::byteFormat(Dir::size(UPLOADS . DS . $dir)); ?>
@@ -66,10 +66,10 @@
<div>
</td>
</tr>
<?php } ?>
<?php } ?>
<?php if (isset($files_list)) foreach ($files_list as $file) { $ext = File::ext($file); ?>
<?php if ( ! in_array($ext, $forbidden_types)) { ?>
<tr>
<tr>
<td<?php if (isset(File::$mime_types[$ext]) && preg_match('/image/', File::$mime_types[$ext])) echo ' class="image"'?>>
<?php echo Html::anchor(File::name($file), $site_url.'public/' . $path.$file, array('target'=>'_blank'));?>
</td>
@@ -84,11 +84,11 @@
<?php echo Html::anchor(__('Delete', 'filesmanager'),
'index.php?id=filesmanager&delete_file='.$file.'&path='.$path.'&token='.Security::token(),
array('class' => 'btn btn-small', 'onclick' => "return confirmDelete('".__('Delete file: :file', 'filesmanager', array(':file' => $file))."')"));
?>
?>
</div>
</td>
</tr>
<?php } } ?>
</tr>
<?php } } ?>
</tbody>
</table>
@@ -100,4 +100,4 @@
<div class="modal-body">
<p align="center"><img /></p>
</div>
</div>
</div>

View File

@@ -6,25 +6,23 @@
/**
* Information Admin Class
*/
class InformationAdmin extends Backend {
class InformationAdmin extends Backend
{
/**
* Information main function
*/
public static function main() {
public static function main()
{
// Init vars
$php_modules = array();
// Get array with the names of all modules compiled and loaded
$php_modules = get_loaded_extensions();
// Display view
// Display view
View::factory('box/information/views/backend/index')
->assign('php_modules', $php_modules)
->display();
}
}

View File

@@ -11,21 +11,19 @@
*
*/
// Register plugin
Plugin::register( __FILE__,
Plugin::register( __FILE__,
__('Information', 'information'),
__('Information plugin', 'information'),
__('Information plugin', 'information'),
'1.0.0',
'Awilum',
'Awilum',
'http://monstra.org/',
null,
'box');
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin'))) {
// Include Information Admin
Plugin::Admin('information', 'box');
}
}

View File

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

View File

@@ -1,40 +1,40 @@
<?php
return array(
'information' => array(
'Information' => 'Informationen',
'Debuging' => 'Debugging',
'Name' => 'Name',
'Value' => 'Wert',
'Security' => 'Sicherheit',
'System' => 'System',
'on' => 'An',
'off'=> 'Aus',
'Server' => 'Server',
'PHP version' => 'PHP Version',
'SimpleXML module' => 'SimpleXML Modul',
'DOM module' => 'DOM Modul',
'Installed' => 'Installiert',
'Not Installed' => 'Nicht Installiert',
'Security check results' => 'Sicherheits-Check Ergebnisse',
'The configuration file has been found to be writable. We would advise you to remove all write permissions on defines.php on production systems.' =>
'Die Konfigurationsdatei wurde als beschreibbar entdeckt. Wir empfehlen alle Schreibrechte für defines.php auf Produktionssystemen zu entfernen.',
'The Monstra core directory (":path") and/or files underneath it has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod -R a-w :path</code>' =>
'Das Monstra-Core-Verzeichnis (":path") und/oder Dateien unterhalb des Verzeichnisses wurden als beschreibbar entdeckt. Wir empfehlen alle Schreibrechte zu entfernen. <br/>Du kannst dies auf Unix-Systemen ganz einfach mit: <code>chmod -R a-w :path</code> erledigen.',
'The Monstra .htaccess file has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod a-w :path</code>' =>
'Die Monstra .htaccess Datei wurde als beschreibbar entdeckt. Wir empfehlen alle Schreibrechte zu entfernen. <br/>Du kannst dies auf Unix-Systemen ganz einfach mit: <code>chmod a-w :path</code> erledigen.',
'The Monstra index.php file has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod a-w :path</code>' =>
'Die Monstra index.php Datei wurde als beschreibbar entdeckt. Wir empfehlen alle Schreibrechte zu entfernen. <br/>Du kannst dies auf Unix-Systemen ganz einfach mit: <code>chmod a-w :path</code> erledigen.',
'Due to the type and amount of information an error might give intruders when Core::$environment = Core::DEVELOPMENT, we strongly advise setting Core::PRODUCTION in production systems.' =>
'Aufgrund der Art und Menge der Informationen kann ein Fehler Eindringlinge ergeben wenn Core::$environment = Core::DEVELOPMENT, wir raten dringend dazu folgendermaßen Core::PRODUCTION in Produktionssystemen einzustellen.',
'Monstra version' => 'Monstra version',
'Directory Permissions' => 'Directory Berechtigungen',
'Directory' => 'Verzeichnis',
'Writable' => 'Writable',
'Unwritable' => 'Nicht beschreibbar',
'Status' => 'Status',
'PHP Built On' => 'PHP Built On',
'Web Server' => 'Web Server',
'WebServer to PHP Interface' => 'WebServer to PHP Interface',
)
);
<?php
return array(
'information' => array(
'Information' => 'Informationen',
'Debuging' => 'Debugging',
'Name' => 'Name',
'Value' => 'Wert',
'Security' => 'Sicherheit',
'System' => 'System',
'on' => 'An',
'off'=> 'Aus',
'Server' => 'Server',
'PHP version' => 'PHP Version',
'SimpleXML module' => 'SimpleXML Modul',
'DOM module' => 'DOM Modul',
'Installed' => 'Installiert',
'Not Installed' => 'Nicht Installiert',
'Security check results' => 'Sicherheits-Check Ergebnisse',
'The configuration file has been found to be writable. We would advise you to remove all write permissions on defines.php on production systems.' =>
'Die Konfigurationsdatei wurde als beschreibbar entdeckt. Wir empfehlen alle Schreibrechte für defines.php auf Produktionssystemen zu entfernen.',
'The Monstra core directory (":path") and/or files underneath it has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod -R a-w :path</code>' =>
'Das Monstra-Core-Verzeichnis (":path") und/oder Dateien unterhalb des Verzeichnisses wurden als beschreibbar entdeckt. Wir empfehlen alle Schreibrechte zu entfernen. <br/>Du kannst dies auf Unix-Systemen ganz einfach mit: <code>chmod -R a-w :path</code> erledigen.',
'The Monstra .htaccess file has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod a-w :path</code>' =>
'Die Monstra .htaccess Datei wurde als beschreibbar entdeckt. Wir empfehlen alle Schreibrechte zu entfernen. <br/>Du kannst dies auf Unix-Systemen ganz einfach mit: <code>chmod a-w :path</code> erledigen.',
'The Monstra index.php file has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod a-w :path</code>' =>
'Die Monstra index.php Datei wurde als beschreibbar entdeckt. Wir empfehlen alle Schreibrechte zu entfernen. <br/>Du kannst dies auf Unix-Systemen ganz einfach mit: <code>chmod a-w :path</code> erledigen.',
'Due to the type and amount of information an error might give intruders when Core::$environment = Core::DEVELOPMENT, we strongly advise setting Core::PRODUCTION in production systems.' =>
'Aufgrund der Art und Menge der Informationen kann ein Fehler Eindringlinge ergeben wenn Core::$environment = Core::DEVELOPMENT, wir raten dringend dazu folgendermaßen Core::PRODUCTION in Produktionssystemen einzustellen.',
'Monstra version' => 'Monstra version',
'Directory Permissions' => 'Directory Berechtigungen',
'Directory' => 'Verzeichnis',
'Writable' => 'Writable',
'Unwritable' => 'Nicht beschreibbar',
'Status' => 'Status',
'PHP Built On' => 'PHP Built On',
'Web Server' => 'Web Server',
'WebServer to PHP Interface' => 'WebServer to PHP Interface',
)
);

View File

@@ -9,7 +9,7 @@
'Security' => 'Security',
'System' => 'System',
'on' => 'on',
'off'=> 'off',
'off'=> 'off',
'Server' => 'Server',
'PHP version' => 'PHP version',
'SimpleXML module' => 'SimpleXML module',
@@ -17,9 +17,9 @@
'Installed' => 'Installed',
'Not Installed' => 'Not Installed',
'Security check results' => 'Security check results',
'The configuration file has been found to be writable. We would advise you to remove all write permissions on defines.php on production systems.' =>
'The configuration file has been found to be writable. We would advise you to remove all write permissions on defines.php on production systems.' =>
'The configuration file has been found to be writable. We would advise you to remove all write permissions on defines.php on production systems.',
'The Monstra core directory (":path") and/or files underneath it has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod -R a-w :path</code>' =>
'The Monstra core directory (":path") and/or files underneath it has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod -R a-w :path</code>' =>
'The Monstra core directory (":path") and/or files underneath it has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod -R a-w :path</code>',
'The Monstra .htaccess file has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod a-w :path</code>' =>
'The Monstra .htaccess file has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod a-w :path</code>',
@@ -37,4 +37,4 @@
'Web Server' => 'Web Server',
'WebServer to PHP Interface' => 'WebServer to PHP Interface',
)
);
);

View File

@@ -17,9 +17,9 @@
'Installed' => 'Installato',
'Not Installed' => 'Non installato',
'Security check results' => 'Risultato del controllo di sicurezza',
'The configuration file has been found to be writable. We would advise you to remove all write permissions on defines.php on production systems.' =>
'The configuration file has been found to be writable. We would advise you to remove all write permissions on defines.php on production systems.' =>
'Il file di configurazione è scrivibile. Si consiglia di rimuovere le autorizzazioni di scrittura per defines.php file sul sito funzionante.',
'The Monstra core directory (":path") and/or files underneath it has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod -R a-w :path</code>' =>
'The Monstra core directory (":path") and/or files underneath it has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod -R a-w :path</code>' =>
'Directory Monstra (":path") è scrivibile. Si consiglia di rimuovere le autorizzazioni di scrittura per la directory (":path") sul sito funzionante. <br/> È possibile eseguire questa operazione su sistemi UNIX così: <code>chmod -R a-w :path</code>',
'The Monstra .htaccess file has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod a-w :path</code>' =>
'Principale file .htaccess è scrivibile. Si consiglia di rimuovere le autorizzazioni di scrittura per il file principale .htaccess. <br/> È possibile eseguire questa operazione su sistemi UNIX così: <code>chmod -R a-w :path</code>',
@@ -37,4 +37,4 @@
'Web Server' => 'Web Server',
'WebServer to PHP Interface' => 'WebServer to PHP Interface',
)
);
);

View File

@@ -9,7 +9,7 @@
'Security' => 'Saugumas',
'System' => 'Systema',
'on' => 'Įjungta',
'off'=> 'Išjungta',
'off'=> 'Išjungta',
'Server' => 'Serveris',
'PHP version' => 'PHP versija',
'SimpleXML module' => 'SimpleXML modulis',
@@ -17,9 +17,9 @@
'Installed' => 'Įdiegta',
'Not Installed' => 'Neįdiegta',
'Security check results' => 'Saugumo patikrinimo rezultatai',
'The configuration file has been found to be writable. We would advise you to remove all write permissions on defines.php on production systems.' =>
'The configuration file has been found to be writable. We would advise you to remove all write permissions on defines.php on production systems.' =>
'Leidžiama perrašyti nustatymų bylą. Siūlome pašalinti visus rašymo leidimus sistemos bylai defines.php.',
'The Monstra core directory (":path") and/or files underneath it has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod -R a-w :path</code>' =>
'The Monstra core directory (":path") and/or files underneath it has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod -R a-w :path</code>' =>
'Monstra pagrindinį aplanką (":path") ir/arba jo bylas leidžiama perrašyti. Siūlome pašalinti visus rašymo leidimus. <br/>Tai galite padaryti Unix sistemoje su: <code>chmod -R a-w :path</code>',
'The Monstra .htaccess file has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod a-w :path</code>' =>
'Monstra .htaccess bylą galima perrašyti. Siūlome pašalinti visus rašymo leidimus. <br/>Tai galite padaryti Unix sistemoje su: <code>chmod a-w :path</code>',
@@ -37,4 +37,4 @@
'Web Server' => 'Serverio prog. įranga',
'WebServer to PHP Interface' => 'PHP naudoja šį SAPI',
)
);
);

View File

@@ -17,9 +17,9 @@
'Installed' => 'Instalado',
'Not Installed' => 'Não instalado',
'Security check results' => 'Resultados da verificação de segurança',
'The configuration file has been found to be writable. We would advise you to remove all write permissions on defines.php on production systems.' =>
'The configuration file has been found to be writable. We would advise you to remove all write permissions on defines.php on production systems.' =>
'O arquivo de configuração está com permissões de escrita. Para melhor segurança, você deve remover as permissões de escrita do arquivo defines.php em sistemas de produções.',
'The Monstra core directory (":path") and/or files underneath it has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod -R a-w :path</code>' =>
'The Monstra core directory (":path") and/or files underneath it has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod -R a-w :path</code>' =>
'O diretório núcleo do Monstra (":path") e/ou arquivos dentro do diretório estão com permissões de escrita. Para melhor segurança, você deve remover as permissões de escritas. <br/>Você pode fazer isso em sistemas UNIX com: <code>chmod -R a-w :path</code>',
'The Monstra .htaccess file has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod a-w :path</code>' =>
'O arquivo .htaccess da pasta de instalação do Monstra está com permissões de escrita. Para sua melhor segurança, você deve remover as permissões de escritas. <br/>Você pode fazer isso em sistemas UNIX com: <code>chmod a-w :path</code>',
@@ -37,4 +37,4 @@
'Web Server' => 'Web Server',
'WebServer to PHP Interface' => 'WebServer to PHP Interface',
)
);
);

View File

@@ -9,7 +9,7 @@
'Security' => 'Безопасность',
'System' => 'Система',
'on' => 'включен',
'off'=> 'выключен',
'off'=> 'выключен',
'Server' => 'Сервер',
'PHP version' => 'Версия PHP',
'SimpleXML module' => 'SimpleXML модуль',
@@ -17,9 +17,9 @@
'Installed' => 'Установлен',
'Not Installed' => 'Не установлен',
'Security check results' => 'Результаты проверки безопасности',
'The configuration file has been found to be writable. We would advise you to remove all write permissions on defines.php on production systems.' =>
'The configuration file has been found to be writable. We would advise you to remove all write permissions on defines.php on production systems.' =>
'Конфигурационный файл доступен для записи. Мы рекомендуем вам удалить права записи на файл defines.php на живом сайте.',
'The Monstra core directory (":path") and/or files underneath it has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod -R a-w :path</code>' =>
'The Monstra core directory (":path") and/or files underneath it has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod -R a-w :path</code>' =>
'Директория Monstra (":path") доступна для записи. Мы рекомендуем вам удалить права записи на директорию (":path") на живом сайте. <br/> Вы можете сделать это на UNIX системах так: <code>chmod -R a-w :path</code>',
'The Monstra .htaccess file has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod a-w :path</code>' =>
'Главный .htaccess доступен для записи. Мы рекомендуем вам удалить права записи на главный .htaccess файл. <br/> Вы можете сделать это на UNIX системах так: <code>chmod -R a-w :path</code>',
@@ -37,4 +37,4 @@
'Web Server' => 'Веб сервер',
'WebServer to PHP Interface' => 'Веб сервер для PHP интерфейса',
)
);
);

View File

@@ -9,7 +9,7 @@
'Security' => 'Безпека',
'System' => 'Система',
'on' => 'включений',
'off'=> 'вимкнено',
'off'=> 'вимкнено',
'Server' => 'Сервер',
'PHP version' => 'Версія PHP',
'SimpleXML module' => 'SimpleXML модуль',
@@ -17,9 +17,9 @@
'Installed' => 'Встановлено',
'Not Installed' => 'Не встановлено',
'Security check results' => 'Результати перевірки безпеки',
'The configuration file has been found to be writable. We would advise you to remove all write permissions on defines.php on production systems.' =>
'The configuration file has been found to be writable. We would advise you to remove all write permissions on defines.php on production systems.' =>
'Конфігураційний файл доступен для запису. Ми рекомендуємо вам видалити права запису на файл defines.php на живому сайті.',
'The Monstra core directory (":path") and/or files underneath it has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod -R a-w :path</code>' =>
'The Monstra core directory (":path") and/or files underneath it has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod -R a-w :path</code>' =>
'Директорія Monstra (":path") доступна для запису. Ми рекомендуємо вам видалити права запису на директорію (":path") на живому сайті. <br/> Ви можете зробити це на UNIX системах так: <code>chmod -R a-w :path</code>',
'The Monstra .htaccess file has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod a-w :path</code>' =>
'Головный .htaccess доступен для запису. Ми рекомендуємо вам видалити права запису на головний .htaccess файл. <br/>Ви можете зробити це на UNIX системах так: <code>chmod -R a-w :path</code>',
@@ -36,4 +36,4 @@
'PHP Built On' => 'PHP построен на',
'Web Server' => 'Веб сервер',
'WebServer to PHP Interface' => 'Веб сервер для PHP интерфейса', )
);
);

View File

@@ -4,13 +4,13 @@
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active"><a href="#system" data-toggle="tab"><?php echo __('System', 'information'); ?></a></li>
<li><a href="#server" data-toggle="tab"><?php echo __('Server', 'information'); ?></a></li>
<li><a href="#server" data-toggle="tab"><?php echo __('Server', 'information'); ?></a></li>
<li><a href="#directory-permissions" data-toggle="tab"><?php echo __('Directory Permissions', 'information'); ?></a></li>
<li><a href="#security" data-toggle="tab"><?php echo __('Security', 'information'); ?></a></li>
<li><a href="#security" data-toggle="tab"><?php echo __('Security', 'information'); ?></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="system">
<table class="table table-bordered">
@@ -25,11 +25,11 @@
<td><?php echo __('Monstra version', 'information'); ?></td>
<td><?php echo Core::VERSION; ?></td>
</tr>
<tr>
<tr>
<td><?php echo __('GZIP', 'information'); ?></td>
<td><?php if (MONSTRA_GZIP) { echo __('on', 'information'); } else { echo __('off', 'information'); } ?></td>
</tr>
<tr>
<tr>
<td><?php echo __('Debugging', 'information'); ?></td>
<td><?php if (Core::$environment == Core::DEVELOPMENT) { echo __('on', 'information'); } else { echo __('off', 'information'); } ?></td>
</tr>
@@ -48,27 +48,27 @@
</tr>
</thead>
<tbody>
<tr>
<tr>
<td><?php echo __('PHP version', 'information'); ?></td>
<td><?php echo PHP_VERSION; ?></td>
</tr>
<tr>
<tr>
<td><?php echo __('PHP Built On', 'information'); ?></td>
<td><?php echo php_uname(); ?></td>
</tr>
<tr>
<tr>
<td><?php echo __('Web Server', 'information'); ?></td>
<td><?php echo (isset($_SERVER['SERVER_SOFTWARE'])) ? $_SERVER['SERVER_SOFTWARE'] : @getenv('SERVER_SOFTWARE'); ?></td>
</tr>
<tr>
<tr>
<td><?php echo __('WebServer to PHP Interface', 'information'); ?></td>
<td><?php echo php_sapi_name(); ?></td>
</tr>
<tr>
<tr>
<td><?php echo __('SimpleXML module', 'information'); ?></td>
<td><?php if (in_array('SimpleXML', $php_modules)) { echo __('Installed', 'information'); } else { echo __('Not Installed', 'information'); } ?></td>
</tr>
<tr>
<tr>
<td><?php echo __('DOM module', 'information'); ?></td>
<td><?php if (in_array('dom', $php_modules)) { echo __('Installed', 'information'); } else { echo __('Not Installed', 'information'); } ?></td>
</tr>
@@ -132,7 +132,7 @@
</table>
</div>
<div class="tab-pane" id="security">
<?php clearstatcache(); ?>
@@ -144,33 +144,33 @@
</thead>
<tbody>
<?php if (File::writable(MONSTRA . DS)) { ?>
<tr>
<td><span class="badge badge-error" style="padding-left:5px; padding-right:5px;"><b>!</b></span> </td>
<tr>
<td><span class="badge badge-error" style="padding-left:5px; padding-right:5px;"><b>!</b></span> </td>
<td><?php echo __('The Monstra core directory (":path") and/or files underneath it has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod -R a-w :path</code>', 'information', array(':path' => MONSTRA . DS)); ?></td>
</tr>
<?php } ?>
<?php if (File::writable(ROOT . DS . '.htaccess')) { ?>
<tr>
<td><span class="badge badge-error" style="padding-left:5px; padding-right:5px;"><b>!</b></span> </td>
<tr>
<td><span class="badge badge-error" style="padding-left:5px; padding-right:5px;"><b>!</b></span> </td>
<td><?php echo __('The Monstra .htaccess file has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod a-w :path</code>', 'information', array(':path' => ROOT . DS . '.htaccess')); ?></td>
</tr>
<?php } ?>
<?php if (File::writable(ROOT . DS . 'index.php')) { ?>
<tr>
<td><span class="badge badge-error" style="padding-left:5px; padding-right:5px;"><b>!</b></span> </td>
<tr>
<td><span class="badge badge-error" style="padding-left:5px; padding-right:5px;"><b>!</b></span> </td>
<td><?php echo __('The Monstra index.php file has been found to be writable. We would advise you to remove all write permissions. <br/>You can do this on unix systems with: <code>chmod a-w :path</code>', 'information', array(':path' => ROOT . DS . 'index.php')); ?></td>
</tr>
<?php } ?>
<?php } ?>
<?php if (Core::$environment == Core::DEVELOPMENT) { ?>
<tr>
<td><span class="badge badge-warning" style="padding-left:5px; padding-right:5px;"><b>!</b></span> </td>
<td><span class="badge badge-warning" style="padding-left:5px; padding-right:5px;"><b>!</b></span> </td>
<td><?php echo __('Due to the type and amount of information an error might give intruders when Core::$environment = Core::DEVELOPMENT, we strongly advise setting Core::PRODUCTION in production systems.', 'information'); ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>

View File

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

View File

@@ -1,27 +1,27 @@
<?php
return array(
'menu' => array(
'Menu' => 'Menü',
'Menu manager' => 'Menü Manager',
'Edit' => 'Bearbeiten',
'Name' => 'Name',
'Delete' => 'Löschen',
'Order' => 'Reihenfolge',
'Actions' => 'Aktionen',
'Create new item' => 'Erstellen neuen Eintrag',
'New item' => 'Neuer Eintrag',
'Item name' => 'Eintrags Name',
'Item order' => 'Eintrags Reihenfolge',
'Item target' => 'Eintrags Ziel',
'Item link' => 'Eintrags Link',
'Item category' => 'Eintrags Kategorie',
'Save' => 'Speichern',
'Edit item' => 'Bearbeite Eintrag',
'Delete item :name' => 'Lösche Eintrag :name',
'Select page' => 'Seite auswählen',
'Category' => 'Kategorie',
'Select category' => 'Kategorie auswählen',
'Required field' => 'Pflichtfeld',
)
);
<?php
return array(
'menu' => array(
'Menu' => 'Menü',
'Menu manager' => 'Menü Manager',
'Edit' => 'Bearbeiten',
'Name' => 'Name',
'Delete' => 'Löschen',
'Order' => 'Reihenfolge',
'Actions' => 'Aktionen',
'Create new item' => 'Erstellen neuen Eintrag',
'New item' => 'Neuer Eintrag',
'Item name' => 'Eintrags Name',
'Item order' => 'Eintrags Reihenfolge',
'Item target' => 'Eintrags Ziel',
'Item link' => 'Eintrags Link',
'Item category' => 'Eintrags Kategorie',
'Save' => 'Speichern',
'Edit item' => 'Bearbeite Eintrag',
'Delete item :name' => 'Lösche Eintrag :name',
'Select page' => 'Seite auswählen',
'Category' => 'Kategorie',
'Select category' => 'Kategorie auswählen',
'Required field' => 'Pflichtfeld',
)
);

View File

@@ -2,7 +2,7 @@
return array(
'menu' => array(
'Menu' => 'Menu',
'Menu' => 'Menu',
'Menu manager' => 'Menu manager',
'Edit' => 'Edit',
'Name' => 'Name',
@@ -24,4 +24,4 @@
'Select category' => 'Select category',
'Required field' => 'Required field',
)
);
);

View File

@@ -2,7 +2,7 @@
return array(
'menu' => array(
'Menu' => 'Menu',
'Menu' => 'Menu',
'Menu manager' => 'Gestione menu',
'Edit' => 'Modifica',
'Name' => 'Nome',
@@ -12,7 +12,7 @@
'Create new item' => 'Crea nuova voce',
'New item' => 'Nuova voce',
'Item name' => 'Nome',
'Item order' => 'Ordine',
'Item order' => 'Ordine',
'Item target' => 'Target',
'Item link' => 'Collegamento',
'Item category' => 'Categoria',
@@ -24,4 +24,4 @@
'Select category' => 'Scegli categoria',
'Required field' => 'Campo obbligatorio',
)
);
);

View File

@@ -25,4 +25,4 @@
'Select category' => 'Pasirinkti kategoriją',
'Required field' => 'Privalomas laukas',
)
);
);

View File

@@ -2,7 +2,7 @@
return array(
'menu' => array(
'Menu' => 'Menu',
'Menu' => 'Menu',
'Menu manager' => 'Gerenciador do menu',
'Edit' => 'Editar',
'Name' => 'Nome',
@@ -24,4 +24,4 @@
'Select category' => 'Selecionar categoria',
'Required field' => 'Campo requerido',
)
);
);

View File

@@ -2,7 +2,7 @@
return array(
'menu' => array(
'Menu' => 'Меню',
'Menu' => 'Меню',
'Menu manager' => 'Менеджер меню',
'Edit' => 'Редактировать',
'Name' => 'Название',
@@ -12,7 +12,7 @@
'Create new item' => 'Создать новый пункт меню',
'New item' => 'Новый пункт меню',
'Item name' => 'Название',
'Item order' => 'Порядок',
'Item order' => 'Порядок',
'Item target' => 'Цель',
'Item link' => 'Ссылка',
'Item category' => 'Категория',
@@ -24,4 +24,4 @@
'Select category' => 'Выбрать категорию',
'Required field' => 'Обязательное поле',
)
);
);

View File

@@ -2,7 +2,7 @@
return array(
'menu' => array(
'Menu' => 'Меню',
'Menu' => 'Меню',
'Menu manager' => 'Менеджер меню',
'Edit' => 'Редагувати',
'Name' => 'Назва',
@@ -12,7 +12,7 @@
'Create new item' => 'Створити новий пункт меню',
'New item' => 'Новий пункт меню',
'Item name' => 'Назва',
'Item order' => 'Порядок',
'Item order' => 'Порядок',
'Item target' => 'Ціль',
'Item link' => 'Ссылка',
'Item category' => 'Категорія',
@@ -24,4 +24,4 @@
'Select category' => 'Вибрати категорію',
'Required field' => 'Обов’язкове поле',
)
);
);

View File

@@ -1,281 +1,273 @@
<?php
// Add plugin navigation link
Navigation::add(__('Menu', 'menu'), 'content', 'menu', 4);
// Add plugin navigation link
Navigation::add(__('Menu', 'menu'), 'content', 'menu', 4);
/**
* Menu Admin Class
*/
class MenuAdmin extends Backend
{
/**
* Menu table
*
* @var object
*/
public static $menu = null;
/**
* Menu Admin Class
* Main
*/
class MenuAdmin extends Backend {
public static function main()
{
// Get menu table
MenuAdmin::$menu = new Table('menu');
// Get pages table
$pages = new Table('pages');
/**
* Menu table
*
* @var object
*/
public static $menu = null;
// Create target array
$menu_item_target_array = array( '' => '',
'_blank' => '_blank',
'_parent' => '_parent',
'_top' => '_top');
// Create order array
$menu_item_order_array = range(0, 20);
/**
* Main
*/
public static function main() {
// Check for get actions
// ---------------------------------------------
if (Request::get('action')) {
// Get menu table
MenuAdmin::$menu = new Table('menu');
// Switch actions
// -----------------------------------------
switch (Request::get('action')) {
// Get pages table
$pages = new Table('pages');
// Create target array
$menu_item_target_array = array( '' => '',
'_blank' => '_blank',
'_parent' => '_parent',
'_top' => '_top');
// Create order array
$menu_item_order_array = range(0, 20);
// Check for get actions
// ---------------------------------------------
if (Request::get('action')) {
// Switch actions
// Edit menu item
// -----------------------------------------
switch (Request::get('action')) {
case "edit":
// Edit menu item
// -----------------------------------------
case "edit":
// Select item
$item = MenuAdmin::$menu->select('[id="'.Request::get('item_id').'"]', null);
// Select item
$item = MenuAdmin::$menu->select('[id="'.Request::get('item_id').'"]', null);
$menu_item_name = $item['name'];
$menu_item_link = $item['link'];
$menu_item_category = $item['category'];
$menu_item_target = $item['target'];
$menu_item_order = $item['order'];
$menu_item_name = $item['name'];
$menu_item_link = $item['link'];
$menu_item_category = $item['category'];
$menu_item_target = $item['target'];
$menu_item_order = $item['order'];
$errors = array();
$errors = array();
// Edit current menu item
if (Request::post('menu_add_item')) {
// Edit current menu item
if (Request::post('menu_add_item')) {
if (Security::check(Request::post('csrf'))) {
if (trim(Request::post('menu_item_name')) == '') {
if (Security::check(Request::post('csrf'))) {
if (Request::post('menu_item_name')) $menu_item_name = Request::post('menu_item_name'); else $menu_item_name = $item['name'];
if (Request::post('menu_item_link')) $menu_item_link = Request::post('menu_item_link'); else $menu_item_link = $item['link'];
if (Request::post('menu_item_category')) $menu_item_category = Request::post('menu_item_category'); else $menu_item_category = $item['category'];
if (Request::post('menu_item_target')) $menu_item_target = Request::post('menu_item_target'); else $menu_item_target = $item['target'];
if (Request::post('menu_item_order')) $menu_item_order = Request::post('menu_item_order'); else $menu_item_order = $item['order'];
if (trim(Request::post('menu_item_name')) == '') {
$errors['menu_item_name_empty'] = __('Required field', 'menu');
}
if (Request::post('menu_item_name')) $menu_item_name = Request::post('menu_item_name'); else $menu_item_name = $item['name'];
if (Request::post('menu_item_link')) $menu_item_link = Request::post('menu_item_link'); else $menu_item_link = $item['link'];
if (Request::post('menu_item_category')) $menu_item_category = Request::post('menu_item_category'); else $menu_item_category = $item['category'];
if (Request::post('menu_item_target')) $menu_item_target = Request::post('menu_item_target'); else $menu_item_target = $item['target'];
if (Request::post('menu_item_order')) $menu_item_order = Request::post('menu_item_order'); else $menu_item_order = $item['order'];
// Update menu item
if (count($errors) == 0) {
MenuAdmin::$menu->update(Request::get('item_id'),
array('name' => Request::post('menu_item_name'),
'link' => Request::post('menu_item_link'),
'category' => Security::safeName(Request::post('menu_item_category'), '-', true),
'target' => Request::post('menu_item_target'),
'order' => Request::post('menu_item_order')));
$errors['menu_item_name_empty'] = __('Required field', 'menu');
}
Request::redirect('index.php?id=menu');
}
// Update menu item
if (count($errors) == 0) {
MenuAdmin::$menu->update(Request::get('item_id'),
array('name' => Request::post('menu_item_name'),
'link' => Request::post('menu_item_link'),
'category' => Security::safeName(Request::post('menu_item_category'), '-', true),
'target' => Request::post('menu_item_target'),
'order' => Request::post('menu_item_order')));
} else { die('csrf detected!'); }
Request::redirect('index.php?id=menu');
}
}
} else { die('csrf detected!'); }
// Display view
View::factory('box/menu/views/backend/edit')
->assign('menu_item_name', $menu_item_name)
->assign('menu_item_link', $menu_item_link)
->assign('menu_item_category', $menu_item_category)
->assign('menu_item_target', $menu_item_target)
->assign('menu_item_order', $menu_item_order)
->assign('menu_item_target_array', $menu_item_target_array)
->assign('menu_item_order_array', $menu_item_order_array)
->assign('errors', $errors)
->assign('categories', MenuAdmin::getCategories())
->assign('pages_list', MenuAdmin::getPages())
->assign('components_list', MenuAdmin::getComponents())
->display();
break;
// Add menu item
// -----------------------------------------
case "add":
$menu_item_name = '';
$menu_item_link = '';
$menu_item_category = '';
$menu_item_target = '';
$menu_item_order = '';
$errors = array();
// Get current category
$menu_item_category = $current_category = (Request::get('category')) ? Request::get('category') : '' ;
// Add new menu item
if (Request::post('menu_add_item')) {
if (Security::check(Request::post('csrf'))) {
if (trim(Request::post('menu_item_name')) == '') {
if (Request::post('menu_item_name')) $menu_item_name = Request::post('menu_item_name'); else $menu_item_name = '';
if (Request::post('menu_item_link')) $menu_item_link = Request::post('menu_item_link'); else $menu_item_link = '';
if (Request::post('menu_item_category')) $menu_item_category = Request::post('menu_item_category'); else $menu_item_category = $current_category;
if (Request::post('menu_item_target')) $menu_item_target = Request::post('menu_item_target'); else $menu_item_target = '';
if (Request::post('menu_item_order')) $menu_item_order = Request::post('menu_item_order'); else $menu_item_order = '';
$errors['menu_item_name_empty'] = __('Required field', 'menu');
}
// Insert new menu item
if (count($errors) == 0) {
MenuAdmin::$menu->insert(array('name' => Request::post('menu_item_name'),
'link' => Request::post('menu_item_link'),
'category' => Security::safeName(Request::post('menu_item_category'), '-', true),
'target' => Request::post('menu_item_target'),
'order' => Request::post('menu_item_order')));
Request::redirect('index.php?id=menu');
}
} else { die('csrf detected!'); }
}
// Display view
View::factory('box/menu/views/backend/add')
->assign('menu_item_name', $menu_item_name)
->assign('menu_item_link', $menu_item_link)
->assign('menu_item_category', $menu_item_category)
->assign('menu_item_target', $menu_item_target)
->assign('menu_item_order', $menu_item_order)
->assign('menu_item_target_array', $menu_item_target_array)
->assign('menu_item_order_array', $menu_item_order_array)
->assign('errors', $errors)
->assign('categories', MenuAdmin::getCategories())
->assign('pages_list', MenuAdmin::getPages())
->assign('components_list', MenuAdmin::getComponents())
->display();
break;
}
} else {
// Delete menu item
if (Request::get('delete_item')) {
MenuAdmin::$menu->delete((int)Request::get('delete_item'));
}
// Display view
View::factory('box/menu/views/backend/index')
->assign('categories', MenuAdmin::getCategories())
->assign('menu', MenuAdmin::$menu)
->display();
}
}
/**
* Get categories
*/
public static function getCategories() {
$categories = array();
$_categories = MenuAdmin::$menu->select(null, 'all', null, array('category'));
foreach($_categories as $category) {
$categories[] = $category['category'];
}
return array_unique($categories);
}
/**
* Get pages
*/
protected static function getPages() {
// Init vars
$pages_array = array();
$count = 0;
// Get pages table
$pages = new Table('pages');
// Get Pages List
$pages_list = $pages->select('[slug!="error404" and status="published"]');
foreach ($pages_list as $page) {
$pages_array[$count]['title'] = Html::toText($page['title']);
$pages_array[$count]['parent'] = $page['parent'];
$pages_array[$count]['date'] = $page['date'];
$pages_array[$count]['author'] = $page['author'];
$pages_array[$count]['slug'] = ($page['slug'] == Option::get('defaultpage')) ? '' : $page['slug'] ;
if (isset($page['parent'])) {
$c_p = $page['parent'];
} else {
$c_p = '';
}
if ($c_p != '') {
$_page = $pages->select('[slug="'.$page['parent'].'"]', null);
if (isset($_page['title'])) {
$_title = $_page['title'];
} else {
$_title = '';
}
$pages_array[$count]['sort'] = $_title . ' ' . $page['title'];
// Display view
View::factory('box/menu/views/backend/edit')
->assign('menu_item_name', $menu_item_name)
->assign('menu_item_link', $menu_item_link)
->assign('menu_item_category', $menu_item_category)
->assign('menu_item_target', $menu_item_target)
->assign('menu_item_order', $menu_item_order)
->assign('menu_item_target_array', $menu_item_target_array)
->assign('menu_item_order_array', $menu_item_order_array)
->assign('errors', $errors)
->assign('categories', MenuAdmin::getCategories())
->assign('pages_list', MenuAdmin::getPages())
->assign('components_list', MenuAdmin::getComponents())
->display();
break;
// Add menu item
// -----------------------------------------
case "add":
$menu_item_name = '';
$menu_item_link = '';
$menu_item_category = '';
$menu_item_target = '';
$menu_item_order = '';
$errors = array();
// Get current category
$menu_item_category = $current_category = (Request::get('category')) ? Request::get('category') : '' ;
// Add new menu item
if (Request::post('menu_add_item')) {
if (Security::check(Request::post('csrf'))) {
if (trim(Request::post('menu_item_name')) == '') {
if (Request::post('menu_item_name')) $menu_item_name = Request::post('menu_item_name'); else $menu_item_name = '';
if (Request::post('menu_item_link')) $menu_item_link = Request::post('menu_item_link'); else $menu_item_link = '';
if (Request::post('menu_item_category')) $menu_item_category = Request::post('menu_item_category'); else $menu_item_category = $current_category;
if (Request::post('menu_item_target')) $menu_item_target = Request::post('menu_item_target'); else $menu_item_target = '';
if (Request::post('menu_item_order')) $menu_item_order = Request::post('menu_item_order'); else $menu_item_order = '';
$errors['menu_item_name_empty'] = __('Required field', 'menu');
}
// Insert new menu item
if (count($errors) == 0) {
MenuAdmin::$menu->insert(array('name' => Request::post('menu_item_name'),
'link' => Request::post('menu_item_link'),
'category' => Security::safeName(Request::post('menu_item_category'), '-', true),
'target' => Request::post('menu_item_target'),
'order' => Request::post('menu_item_order')));
Request::redirect('index.php?id=menu');
}
} else { die('csrf detected!'); }
}
// Display view
View::factory('box/menu/views/backend/add')
->assign('menu_item_name', $menu_item_name)
->assign('menu_item_link', $menu_item_link)
->assign('menu_item_category', $menu_item_category)
->assign('menu_item_target', $menu_item_target)
->assign('menu_item_order', $menu_item_order)
->assign('menu_item_target_array', $menu_item_target_array)
->assign('menu_item_order_array', $menu_item_order_array)
->assign('errors', $errors)
->assign('categories', MenuAdmin::getCategories())
->assign('pages_list', MenuAdmin::getPages())
->assign('components_list', MenuAdmin::getComponents())
->display();
break;
}
} else {
// Delete menu item
if (Request::get('delete_item')) {
MenuAdmin::$menu->delete((int) Request::get('delete_item'));
}
// Display view
View::factory('box/menu/views/backend/index')
->assign('categories', MenuAdmin::getCategories())
->assign('menu', MenuAdmin::$menu)
->display();
}
}
/**
* Get categories
*/
public static function getCategories()
{
$categories = array();
$_categories = MenuAdmin::$menu->select(null, 'all', null, array('category'));
foreach ($_categories as $category) {
$categories[] = $category['category'];
}
return array_unique($categories);
}
/**
* Get pages
*/
protected static function getPages()
{
// Init vars
$pages_array = array();
$count = 0;
// Get pages table
$pages = new Table('pages');
// Get Pages List
$pages_list = $pages->select('[slug!="error404" and status="published"]');
foreach ($pages_list as $page) {
$pages_array[$count]['title'] = Html::toText($page['title']);
$pages_array[$count]['parent'] = $page['parent'];
$pages_array[$count]['date'] = $page['date'];
$pages_array[$count]['author'] = $page['author'];
$pages_array[$count]['slug'] = ($page['slug'] == Option::get('defaultpage')) ? '' : $page['slug'] ;
if (isset($page['parent'])) {
$c_p = $page['parent'];
} else {
$c_p = '';
}
if ($c_p != '') {
$_page = $pages->select('[slug="'.$page['parent'].'"]', null);
if (isset($_page['title'])) {
$_title = $_page['title'];
} else {
$pages_array[$count]['sort'] = $page['title'];
$_title = '';
}
$_title = '';
$count++;
$pages_array[$count]['sort'] = $_title . ' ' . $page['title'];
} else {
$pages_array[$count]['sort'] = $page['title'];
}
// Sort pages
$_pages_list = Arr::subvalSort($pages_array, 'sort');
// return
return $_pages_list;
$_title = '';
$count++;
}
// Sort pages
$_pages_list = Arr::subvalSort($pages_array, 'sort');
/**
* Get components
*/
protected static function getComponents() {
// return
return $_pages_list;
}
$components = array();
if (count(Plugin::$components) > 0) {
foreach (Plugin::$components as $component) {
if ($component !== 'pages' && $component !== 'sitemap') $components[] = Text::lowercase($component);
}
/**
* Get components
*/
protected static function getComponents()
{
$components = array();
if (count(Plugin::$components) > 0) {
foreach (Plugin::$components as $component) {
if ($component !== 'pages' && $component !== 'sitemap') $components[] = Text::lowercase($component);
}
return $components;
}
}
return $components;
}
}

View File

@@ -1,63 +1,58 @@
<?php
/**
* Menu plugin
*
* @package Monstra
* @subpackage Plugins
* @author Romanenko Sergey / Awilum
* @copyright 2012 Romanenko Sergey / Awilum
* @version 1.0.0
*
*/
// Register plugin
Plugin::register( __FILE__,
__('Menu', 'menu'),
__('Menu manager', 'menu'),
'1.0.0',
'Awilum',
'http://monstra.org/',
null,
'box');
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin'))) {
// Include Admin
Plugin::admin('menu', 'box');
}
// Add Plugin Javascript
Javascript::add('plugins/box/menu/js/menu.js', 'backend');
/**
* Menu Class
*/
class Menu
{
/**
* Menu plugin
*
* @package Monstra
* @subpackage Plugins
* @author Romanenko Sergey / Awilum
* @copyright 2012 Romanenko Sergey / Awilum
* @version 1.0.0
* Get menu
*
* @param string $category Category name
*/
public static function get($category = '')
{
// Get menu table
$menu = new Table('menu');
// Display view
View::factory('box/menu/views/frontend/index')
->assign('items', $menu->select('[category="'.$category.'"]', 'all', null, array('id', 'name', 'link', 'target', 'order', 'category'), 'order', 'ASC'))
->assign('uri', Uri::segments())
->assign('defpage', Option::get('defaultpage'))
->display();
// Register plugin
Plugin::register( __FILE__,
__('Menu', 'menu'),
__('Menu manager', 'menu'),
'1.0.0',
'Awilum',
'http://monstra.org/',
null,
'box');
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin'))) {
// Include Admin
Plugin::admin('menu', 'box');
}
// Add Plugin Javascript
Javascript::add('plugins/box/menu/js/menu.js', 'backend');
/**
* Menu Class
*/
class Menu {
/**
* Get menu
*
* @param string $category Category name
*/
public static function get($category = '') {
// Get menu table
$menu = new Table('menu');
// Display view
View::factory('box/menu/views/frontend/index')
->assign('items', $menu->select('[category="'.$category.'"]', 'all', null, array('id', 'name', 'link', 'target', 'order', 'category'), 'order', 'ASC'))
->assign('uri', Uri::segments())
->assign('defpage', Option::get('defaultpage'))
->display();
}
}
}

View File

@@ -7,10 +7,10 @@
<?php if (isset($errors['menu_item_name_empty'])) $error_class = ' error'; else $error_class = ''; ?>
<a href="javascript:;" style="text-decoration:none; color:#333; border-bottom:1px dashed #333;" data-toggle="modal" onclick="$('#selectPageModal').modal('show').width(270);" ><?php echo __('Select page', 'menu'); ?></a> /
<a href="javascript:;" style="text-decoration:none; color:#333; border-bottom:1px dashed #333;" data-toggle="modal" onclick="$('#selectPageModal').modal('show').width(270);" ><?php echo __('Select page', 'menu'); ?></a> /
<a href="javascript:;" style="text-decoration:none; color:#333; border-bottom:1px dashed #333;" data-toggle="modal" onclick="$('#selectCategoryModal').modal('show').width(270);" ><?php echo __('Select category', 'menu'); ?></a><br /><br />
<?php
<?php
echo Form::label('menu_item_name', __('Item name', 'menu'));
echo Form::input('menu_item_name', $menu_item_name, array('class' => (isset($errors['menu_item_name_empty']) || isset($errors['menu_item_name_empty'])) ? 'input-xlarge error-field' : 'input-xlarge'));
@@ -33,17 +33,17 @@
Html::br().
Form::label('menu_item_target', __('Item target', 'menu')).
Form::select('menu_item_target', $menu_item_target_array, $menu_item_target, array('class' => 'input-xlarge'))
);
);
echo (
Html::br().
Form::label('menu_item_order', __('Item order', 'menu')).
Form::select('menu_item_order', $menu_item_order_array, $menu_item_order, array('class' => 'input-xlarge'))
);
);
echo (
Html::br(2).
Form::submit('menu_add_item', __('Save', 'menu'), array('class' => 'btn')).
Form::submit('menu_add_item', __('Save', 'menu'), array('class' => 'btn')).
Form::close()
);
?>
@@ -56,10 +56,10 @@
<div class="modal-body">
<p>
<ul class="unstyled">
<?php if (count($pages_list) > 0) foreach($pages_list as $page) { ?>
<?php if (count($pages_list) > 0) foreach ($pages_list as $page) { ?>
<li><?php echo (!empty($page['parent'])) ? Html::nbsp().Html::arrow('right').Html::nbsp(2) : '' ; ?><a href="javascript:;" onclick="$.monstra.menu.selectPage('<?php echo (empty($page['parent'])) ? $page['slug'] : $page['parent'].'/'.$page['slug'] ; ?>', '<?php echo $page['title']; ?>');"><?php echo $page['title']; ?></a></li>
<?php } ?>
<?php if (count($components_list) > 0) foreach($components_list as $component) { ?>
<?php if (count($components_list) > 0) foreach ($components_list as $component) { ?>
<li><a href="javascript:;" onclick="$.monstra.menu.selectPage('<?php echo $component; ?>', '<?php echo __(ucfirst($component), $component); ?>');"><?php echo __(ucfirst($component), $component); ?></a></li>
<?php } ?>
</ul>
@@ -75,10 +75,10 @@
<div class="modal-body">
<p>
<ul class="unstyled">
<?php if (count($categories) > 0) foreach($categories as $category) { ?>
<?php if (count($categories) > 0) foreach ($categories as $category) { ?>
<li><a href="javascript:;" onclick="$.monstra.menu.selectCategory('<?php echo $category; ?>');"><?php echo $category; ?></a></li>
<?php } ?>
</ul>
</p>
</div>
</div>
</div>

View File

@@ -7,10 +7,10 @@
<?php if (isset($errors['menu_item_name_empty'])) $error_class = ' error'; else $error_class = ''; ?>
<a href="javascript:;" style="text-decoration:none; color:#333; border-bottom:1px dashed #333;" data-toggle="modal" onclick="$('#selectPageModal').modal('show').width(270);" ><?php echo __('Select page', 'menu'); ?></a> /
<a href="javascript:;" style="text-decoration:none; color:#333; border-bottom:1px dashed #333;" data-toggle="modal" onclick="$('#selectPageModal').modal('show').width(270);" ><?php echo __('Select page', 'menu'); ?></a> /
<a href="javascript:;" style="text-decoration:none; color:#333; border-bottom:1px dashed #333;" data-toggle="modal" onclick="$('#selectCategoryModal').modal('show').width(270);" ><?php echo __('Select category', 'menu'); ?></a><br /><br />
<?php
<?php
echo Form::label('menu_item_name', __('Item name', 'menu'));
echo Form::input('menu_item_name', $menu_item_name, array('class' => (isset($errors['menu_item_name_empty']) || isset($errors['menu_item_name_empty'])) ? 'input-xlarge error-field' : 'input-xlarge'));
@@ -33,17 +33,17 @@
Html::br().
Form::label('menu_item_target', __('Item target', 'menu')).
Form::select('menu_item_target', $menu_item_target_array, $menu_item_target, array('class' => 'input-xlarge'))
);
);
echo (
Html::br().
Form::label('menu_item_order', __('Item order', 'menu')).
Form::select('menu_item_order', $menu_item_order_array, $menu_item_order, array('class' => 'input-xlarge'))
);
);
echo (
Html::br(2).
Form::submit('menu_add_item', __('Save', 'menu'), array('class' => 'btn')).
Form::submit('menu_add_item', __('Save', 'menu'), array('class' => 'btn')).
Form::close()
);
?>
@@ -56,10 +56,10 @@
<div class="modal-body">
<p>
<ul class="unstyled">
<?php if (count($pages_list) > 0) foreach($pages_list as $page) { ?>
<?php if (count($pages_list) > 0) foreach ($pages_list as $page) { ?>
<li><?php echo (!empty($page['parent'])) ? Html::nbsp().Html::arrow('right').Html::nbsp(2) : '' ; ?><a href="javascript:;" onclick="$.monstra.menu.selectPage('<?php echo (empty($page['parent'])) ? $page['slug'] : $page['parent'].'/'.$page['slug'] ; ?>', '<?php echo $page['title']; ?>');"><?php echo $page['title']; ?></a></li>
<?php } ?>
<?php if (count($components_list) > 0) foreach($components_list as $component) { ?>
<?php if (count($components_list) > 0) foreach ($components_list as $component) { ?>
<li><a href="javascript:;" onclick="$.monstra.menu.selectPage('<?php echo $component; ?>', '<?php echo __(ucfirst($component), $component); ?>');"><?php echo __(ucfirst($component), $component); ?></a></li>
<?php } ?>
</ul>
@@ -67,7 +67,6 @@
</div>
</div>
<div class="modal hide" id="selectCategoryModal">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
@@ -76,10 +75,10 @@
<div class="modal-body">
<p>
<ul class="unstyled">
<?php if (count($categories) > 0) foreach($categories as $category) { ?>
<?php if (count($categories) > 0) foreach ($categories as $category) { ?>
<li><a href="javascript:;" onclick="$.monstra.menu.selectCategory('<?php echo $category; ?>');"><?php echo $category; ?></a></li>
<?php } ?>
</ul>
</p>
</div>
</div>
</div>

View File

@@ -2,18 +2,16 @@
<br />
<?php if ($menu->count() == 0) { ?>
<h3><?php echo __('Category', 'menu'); ?>: <?php echo 'default'; ?></h3>
<h3><?php echo __('Category', 'menu'); ?>: <?php echo 'default'; ?></h3>
<br />
<?php
echo (
Html::anchor(__('Create New Item', 'menu'), 'index.php?id=menu&action=add', array('title' => __('Create New Item', 'menu'), 'class' => 'btn btn-small'))
);
Html::anchor(__('Create New Item', 'menu'), 'index.php?id=menu&action=add', array('title' => __('Create New Item', 'menu'), 'class' => 'btn btn-small'))
);
?>
<br /><br />
<?php } ?>
<?php
foreach ($categories as $category) {
@@ -25,15 +23,14 @@
?>
<h3><?php echo __('Category', 'menu'); ?>: <?php echo ($category == '') ? 'default' : $category; ?></h3>
<br />
<br />
<?php
echo (
Html::anchor(__('Create New Item', 'menu'), 'index.php?id=menu&action=add'.$category_to_add , array('title' => __('Create New Item', 'menu'), 'class' => 'btn btn-small'))
);
Html::anchor(__('Create New Item', 'menu'), 'index.php?id=menu&action=add'.$category_to_add , array('title' => __('Create New Item', 'menu'), 'class' => 'btn btn-small'))
);
?>
<br /><br />
<table class="table table-bordered">
<thead>
<tr>
@@ -75,6 +72,6 @@
</tr>
<?php } ?>
</tbody>
</table>
</table>
<br />
<?php } ?>
<?php } ?>

View File

@@ -1,5 +1,5 @@
<?php
$anchor_active = '';
$li_active = '';
$target = '';
@@ -49,4 +49,4 @@
$li_active = '';
$target = '';
}
}
}

View File

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

View File

@@ -1,54 +1,54 @@
<?php
return array(
'pages' => array(
'Pages' => 'Seiten',
'Pages manager' => 'Seiten Manager',
'Content' => 'Inhalt',
'Create New Page' => 'Neue Seite erstellen',
'New Page' => 'Neue Seite',
'Edit Page' => 'Seite bearbeiten',
'Date' => 'Datum',
'Clone' => 'Klonen',
'Edit' => 'Bearbeiten',
'Delete' => 'Löschen',
'Delete page: :page' => 'Lösche Seite: :page',
'Title' => 'Titel',
'Name' => 'Name',
'Author' => 'Author',
'Name (slug)' => 'Name (slug)',
'Description' => 'Beschreibung',
'Keywords' => 'Schlagwörter',
'Parent' => 'Übergeordnete',
'Template' => 'Vorlage',
'Year' => 'Jahr',
'Day' => 'Tag',
'Month' => 'Monat',
'Hour' => 'Stunde',
'Minute' => 'Minute',
'Second' => 'Sekunde',
'This field should not be empty' => 'Dieses Feld darf nicht leer sein',
'This page already exists' => 'Diese Seite existiert bereits',
'Extra' => 'Extra',
'Save' => 'Speichern',
'Save and Exit' => 'Speichern und Beenden',
'Your changes to the page <i>:page</i> have been saved.' => 'Deine Änderungen an der Seite <i> :page </i> wurden gespeichert.',
'The page <i>:page</i> cloned.' => 'Die Seite <i>:page</i> wurde gekloned.',
'Status' => 'Status',
'Actions' => 'Aktionen',
'Add' => 'Hinzufügen',
'Published' => 'Veröffentlicht',
'Draft' => 'Entwurf',
'Published on' => 'Veröffentlicht am',
'Edit 404 Page' => 'Bearbeite 404-Fehler Seite',
'Page <i>:page</i> deleted' => 'Seite <i>:page</i> wurde gelöscht',
'Search Engines Robots' => 'Suchmaschinen-Roboter',
'Page' => 'Seite',
'Metadata' => 'Metadata',
'Settings' => 'Einstellungen',
'Required field' => 'Pflichtfeld',
'Access' => 'Zugriff',
'Public' => 'Öffentlichkeit',
'Registered' => 'Eingetragen',
)
);
<?php
return array(
'pages' => array(
'Pages' => 'Seiten',
'Pages manager' => 'Seiten Manager',
'Content' => 'Inhalt',
'Create New Page' => 'Neue Seite erstellen',
'New Page' => 'Neue Seite',
'Edit Page' => 'Seite bearbeiten',
'Date' => 'Datum',
'Clone' => 'Klonen',
'Edit' => 'Bearbeiten',
'Delete' => 'Löschen',
'Delete page: :page' => 'Lösche Seite: :page',
'Title' => 'Titel',
'Name' => 'Name',
'Author' => 'Author',
'Name (slug)' => 'Name (slug)',
'Description' => 'Beschreibung',
'Keywords' => 'Schlagwörter',
'Parent' => 'Übergeordnete',
'Template' => 'Vorlage',
'Year' => 'Jahr',
'Day' => 'Tag',
'Month' => 'Monat',
'Hour' => 'Stunde',
'Minute' => 'Minute',
'Second' => 'Sekunde',
'This field should not be empty' => 'Dieses Feld darf nicht leer sein',
'This page already exists' => 'Diese Seite existiert bereits',
'Extra' => 'Extra',
'Save' => 'Speichern',
'Save and Exit' => 'Speichern und Beenden',
'Your changes to the page <i>:page</i> have been saved.' => 'Deine Änderungen an der Seite <i> :page </i> wurden gespeichert.',
'The page <i>:page</i> cloned.' => 'Die Seite <i>:page</i> wurde gekloned.',
'Status' => 'Status',
'Actions' => 'Aktionen',
'Add' => 'Hinzufügen',
'Published' => 'Veröffentlicht',
'Draft' => 'Entwurf',
'Published on' => 'Veröffentlicht am',
'Edit 404 Page' => 'Bearbeite 404-Fehler Seite',
'Page <i>:page</i> deleted' => 'Seite <i>:page</i> wurde gelöscht',
'Search Engines Robots' => 'Suchmaschinen-Roboter',
'Page' => 'Seite',
'Metadata' => 'Metadata',
'Settings' => 'Einstellungen',
'Required field' => 'Pflichtfeld',
'Access' => 'Zugriff',
'Public' => 'Öffentlichkeit',
'Registered' => 'Eingetragen',
)
);

View File

@@ -2,15 +2,15 @@
return array(
'pages' => array(
'Pages' => 'Pages',
'Pages manager' => 'Pages manager',
'Pages' => 'Pages',
'Pages manager' => 'Pages manager',
'Content' => 'Content',
'Create New Page' => 'Create New Page',
'New Page' => 'New Page',
'Edit Page' => 'Edit Page',
'Edit Page' => 'Edit Page',
'Date' => 'Date',
'Clone' => 'Clone',
'Edit' => 'Edit',
'Edit' => 'Edit',
'Delete' => 'Delete',
'Delete page: :page' => 'Delete page: :page',
'Title' => 'Title',
@@ -51,4 +51,4 @@
'Public' => 'Public',
'Registered' => 'Registered',
)
);
);

View File

@@ -4,13 +4,13 @@
'pages' => array(
'Pages' => 'Pagine',
'Pages manager' => 'Gestione pagine',
'Content' => 'Contenuto',
'Content' => 'Contenuto',
'Create New Page' => 'Crea Nuova Pagina',
'New Page' => 'Nuova Pagina',
'Edit Page' => 'Modifica Pagina',
'Edit Page' => 'Modifica Pagina',
'Date' => 'Data',
'Clone' => 'Clona',
'Edit' => 'Modifica',
'Edit' => 'Modifica',
'Delete' => 'Elimina',
'Delete page: :page' => 'Elimina pagina: :page',
'Title' => 'Titolo',
@@ -51,4 +51,4 @@
'Public' => 'Pubblico',
'Registered' => 'Registrato',
),
);
);

View File

@@ -7,10 +7,10 @@
'Content' => 'Turinys',
'Create New page' => 'Sukurti Naują Puslapį',
'New Page' => 'Naujas Puslapis',
'Edit Page' => 'Redaguoti Puslapį',
'Edit Page' => 'Redaguoti Puslapį',
'Date' => 'Data',
'Clone' => 'Klonuoti',
'Edit' => 'Redaguoti',
'Edit' => 'Redaguoti',
'Delete' => 'Ištrinti',
'Delete page: :page' => 'Ištrinti puslapį :page',
'Title' => 'Antraštė',
@@ -51,4 +51,4 @@
'Public' => 'Viešas',
'Registered' => 'Registruotas',
)
);
);

View File

@@ -7,10 +7,10 @@
'Content' => 'Conteúdo',
'Create new page' => 'Criar nova página',
'New page' => 'Nova página',
'Edit page' => 'Editar página',
'Edit page' => 'Editar página',
'Date' => 'Data',
'Clone' => 'Clonar',
'Edit' => 'Editar',
'Edit' => 'Editar',
'Delete' => 'Deletar',
'Delete page: :page' => 'Deletar a página: :page',
'Title' => 'Título',
@@ -51,4 +51,4 @@
'Public' => 'Público',
'Registered' => 'Registrado',
)
);
);

View File

@@ -4,13 +4,13 @@
'pages' => array(
'Pages' => 'Страницы',
'Pages manager' => 'Менеджер страниц',
'Content' => 'Контент',
'Content' => 'Контент',
'Create New Page' => 'Создать новую страницу',
'New Page' => 'Новая страница',
'Edit Page' => 'Редактирование страницы',
'Edit Page' => 'Редактирование страницы',
'Date' => 'Дата',
'Clone' => 'Клонировать',
'Edit' => 'Редактировать',
'Edit' => 'Редактировать',
'Delete' => 'Удалить',
'Delete page: :page' => 'Удалить страницу: :page',
'Title' => 'Заголовок',
@@ -51,4 +51,4 @@
'Public' => 'Публичный',
'Registered' => 'Зарегистрированным',
),
);
);

View File

@@ -4,13 +4,13 @@
'pages' => array(
'Pages' => 'Сторінки',
'Pages manager' => 'Менеджер сторінок',
'Content' => 'Контент',
'Content' => 'Контент',
'Create New Page' => 'Створити нову сторінку',
'New Page' => 'Нова сторінка',
'Edit Page' => 'Редагування сторінки',
'Edit Page' => 'Редагування сторінки',
'Date' => 'Дата',
'Clone' => 'Клонувати',
'Edit' => 'Редагувати',
'Edit' => 'Редагувати',
'Delete' => 'Видалити',
'Delete page: :page' => 'Видалити сторінку: :page',
'Title' => 'Заголовок',
@@ -51,4 +51,4 @@
'Public' => 'Публічний',
'Registered' => 'Зареєстрованим',
),
);
);

File diff suppressed because it is too large Load Diff

View File

@@ -1,206 +1,195 @@
<?php
/**
* Pages plugin
*
* @package Monstra
* @subpackage Plugins
* @author Romanenko Sergey / Awilum
* @copyright 2012 Romanenko Sergey / Awilum
* @version 1.0.0
*
*/
// Register plugin
Plugin::register( __FILE__,
__('Pages' , 'pages'),
__('Pages manager', 'pages'),
'1.0.0',
'Awilum',
'http://monstra.org/',
'pages',
'box');
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor'))) {
// Include Admin
Plugin::Admin('pages', 'box');
}
// Add Plugin Javascript
Javascript::add('plugins/box/pages/js/pages.js', 'backend');
/**
* Pages Class
*/
class Pages extends Frontend
{
/**
* Pages plugin
*
* @package Monstra
* @subpackage Plugins
* @author Romanenko Sergey / Awilum
* @copyright 2012 Romanenko Sergey / Awilum
* @version 1.0.0
* Current page data
*
* @var object
*/
public static $page = null;
/**
* Pages tables
*
* @var object
*/
public static $pages = null;
// Register plugin
Plugin::register( __FILE__,
__('Pages' , 'pages'),
__('Pages manager', 'pages'),
'1.0.0',
'Awilum',
'http://monstra.org/',
'pages',
'box');
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor'))) {
// Include Admin
Plugin::Admin('pages', 'box');
/**
* Requested page
*
* @var string
*/
public static $requested_page = null;
/**
* Main function
*/
public static function main()
{
Pages::$pages = new Table('pages');
Pages::$page = Pages::pageLoader();
}
/**
* Page loader
*
* @param boolean $return_data data
* @return array
*/
public static function pageLoader($return_data = true)
{
$requested_page = Pages::lowLoader(Uri::segments());
Pages::$requested_page = $requested_page;
// Add Plugin Javascript
Javascript::add('plugins/box/pages/js/pages.js', 'backend');
return Pages::$pages->select('[slug="'.$requested_page.'"]', null);
}
/**
* Pages Class
* Load current page
*
* @global string $defpage default page
* @param array $data uri
* @return string
*/
class Pages extends Frontend {
public static function lowLoader($data)
{
$defpage = Option::get('defaultpage');
// If data count 2 then it has Parent/Child
if (count($data) >= 2) {
/**
* Current page data
*
* @var object
*/
public static $page = null;
// If exists parent file
if (count(Pages::$pages->select('[slug="'.$data[0].'"]')) !== 0) {
// Get child file and get parent page name
$child_page = Pages::$pages->select('[slug="'.$data[1].'"]', null);
/**
* Pages tables
*
* @var object
*/
public static $pages = null;
/**
* Requested page
*
* @var string
*/
public static $requested_page = null;
/**
* Main function
*/
public static function main() {
Pages::$pages = new Table('pages');
Pages::$page = Pages::pageLoader();
}
/**
* Page loader
*
* @param boolean $return_data data
* @return array
*/
public static function pageLoader($return_data = true) {
$requested_page = Pages::lowLoader(Uri::segments());
Pages::$requested_page = $requested_page;
return Pages::$pages->select('[slug="'.$requested_page.'"]', null);
}
/**
* Load current page
*
* @global string $defpage default page
* @param array $data uri
* @return string
*/
public static function lowLoader($data) {
$defpage = Option::get('defaultpage');
// If data count 2 then it has Parent/Child
if (count($data) >= 2) {
// If exists parent file
if (count(Pages::$pages->select('[slug="'.$data[0].'"]')) !== 0) {
// Get child file and get parent page name
$child_page = Pages::$pages->select('[slug="'.$data[1].'"]', null);
// If child page parent is not empty then get his parent
if (count($child_page) == 0) {
$c_p = '';
// If child page parent is not empty then get his parent
if (count($child_page) == 0) {
$c_p = '';
} else {
if ($child_page['parent'] != '') {
$c_p = $child_page['parent'];
} else {
if ($child_page['parent'] != '') {
$c_p = $child_page['parent'];
} else {
$c_p = '';
}
$c_p = '';
}
}
// Hack For old Monstra
$child_page['access'] = (isset($child_page['access'])) ? $child_page['access'] : 'public' ;
// Check is child_parent -> request parent
if ($c_p == $data[0]) {
if (count($data) < 3) { // Checking only for the parent and one child, the remaining issue 404
if ((($child_page['status'] == 'published') or
(Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor')))) and
($child_page['access'] == 'public')) {
// Hack For old Monstra
$child_page['access'] = (isset($child_page['access'])) ? $child_page['access'] : 'public' ;
$id = $data[1];
// Check is child_parent -> request parent
if ($c_p == $data[0]) {
} elseif (($child_page['access'] == 'registered') and
(Session::exists('user_id')) and
($child_page['status'] == 'published')) {
$id = $data[1];
if (count($data) < 3) { // Checking only for the parent and one child, the remaining issue 404
if ((($child_page['status'] == 'published') or
(Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor')))) and
($child_page['access'] == 'public')) {
$id = $data[1];
} elseif (($child_page['access'] == 'registered') and
(Session::exists('user_id')) and
($child_page['status'] == 'published')) {
$id = $data[1];
} else {
$id = 'error404';
Response::status(404);
}
} else {
$id = 'error404';
$id = 'error404';
Response::status(404);
}
} else {
$id = 'error404';
Response::status(404);
}
} else {
$id = 'error404';
Response::status(404);
}
} else {
$id = 'error404';
Response::status(404);
}
} else { // Only parent page come
if(empty($data[0])) {
$id = $defpage;
} else { // Only parent page come
if (empty($data[0])) {
} else {
$id = $defpage;
// Get current page
$current_page = Pages::$pages->select('[slug="'.$data[0].'"]', null);
// Hack For old Monstra
$current_page['access'] = (isset($current_page['access'])) ? $current_page['access'] : 'public' ;
} else {
if (count($current_page) != 0) {
if ( ! empty($current_page['parent'])) {
$c_p = $current_page['parent'];
} else {
$c_p = '';
}
// Get current page
$current_page = Pages::$pages->select('[slug="'.$data[0].'"]', null);
// Hack For old Monstra
$current_page['access'] = (isset($current_page['access'])) ? $current_page['access'] : 'public' ;
if (count($current_page) != 0) {
if ( ! empty($current_page['parent'])) {
$c_p = $current_page['parent'];
} else {
$c_p = '';
}
} else {
$c_p = '';
}
// Check if this page has parent
if ($c_p !== '') {
// Check if this page has parent
if ($c_p !== '') {
if ($c_p == $data[0]) {
if (count(Pages::$pages->select('[slug="'.$data[0].'"]', null)) != 0) {
if ($c_p == $data[0]) {
if (count(Pages::$pages->select('[slug="'.$data[0].'"]', null)) != 0) {
if ((($current_page['status'] == 'published') or
(Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor')))) and
($current_page['access'] == 'public')) {
if ((($current_page['status'] == 'published') or
(Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor')))) and
($current_page['access'] == 'public')) {
$id = $data[0];
$id = $data[0];
} elseif (($current_page['access'] == 'registered') and
(Session::exists('user_id')) and
($current_page['status'] == 'published')) {
$id = $data[0];
} elseif (($current_page['access'] == 'registered') and
(Session::exists('user_id')) and
($current_page['status'] == 'published')) {
$id = $data[0];
} else {
$id = 'error404';
Response::status(404);
}
} else {
$id = 'error404';
Response::status(404);
@@ -210,284 +199,285 @@
Response::status(404);
}
} else {
$id = 'error404';
Response::status(404);
}
} else {
if (count(Pages::$pages->select('[slug="'.$data[0].'"]', null)) != 0) {
if ((($current_page['status'] == 'published') or
(Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor')))) and
($current_page['access'] == 'public')) {
if (count(Pages::$pages->select('[slug="'.$data[0].'"]', null)) != 0) {
if ((($current_page['status'] == 'published') or
(Session::exists('user_role') && in_array(Session::get('user_role'), array('admin', 'editor')))) and
($current_page['access'] == 'public')) {
$id = $data[0];
$id = $data[0];
} elseif (($current_page['access'] == 'registered') and
(Session::exists('user_id')) and
($current_page['status'] == 'published')) {
} elseif (($current_page['access'] == 'registered') and
(Session::exists('user_id')) and
($current_page['status'] == 'published')) {
$id = $data[0];
$id = $data[0];
} else {
$id = 'error404';
Response::status(404);
}
} else {
$id = 'error404';
Response::status(404);
}
} else {
$id = 'error404';
Response::status(404);
}
}
}
// Return page name/id to load
return $id;
}
// Return page name/id to load
return $id;
}
/**
* Get pages template
*
* @return string
*/
public static function template() {
if (Pages::$page['template'] == '') return 'index'; else return Pages::$page['template'];
}
/**
* Get pages template
*
* @return string
*/
public static function template()
{
if (Pages::$page['template'] == '') return 'index'; else return Pages::$page['template'];
}
/**
* Get pages contents
*
* @return string
*/
public static function content($slug = '')
{
if ( ! empty($slug)) {
/**
* Get pages contents
*
* @return string
*/
public static function content($slug = '') {
$page = Table::factory('pages')->select('[slug="'.$slug.'"]', null);
if ( ! empty($slug)) {
if ( ! empty($page)) {
$page = Table::factory('pages')->select('[slug="'.$slug.'"]', null);
$content = Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . $page['id'] . '.page.txt'));
if ( ! empty($page)) {
$content = Filter::apply('content', $content);
$content = Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . $page['id'] . '.page.txt'));
$content = Filter::apply('content', $content);
return $content;
} else {
return '';
}
return $content;
} else {
return Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . Pages::$page['id'] . '.page.txt'));
return '';
}
}
/**
* Get pages title
*
* <code>
* echo Page::title();
* </code>
*
* @return string
*/
public static function title() {
return Pages::$page['title'];
}
/**
* Get pages Description
*
* <code>
* echo Page::description();
* </code>
*
* @return string
*/
public static function description() {
return Pages::$page['description'];
}
/**
* Get pages Keywords
*
* <code>
* echo Page::keywords();
* </code>
*
* @return string
*/
public static function keywords() {
return Pages::$page['keywords'];
} else {
return Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . Pages::$page['id'] . '.page.txt'));
}
}
/**
* Get pages title
*
* <code>
* echo Page::title();
* </code>
*
* @return string
*/
public static function title()
{
return Pages::$page['title'];
}
/**
* Add new shortcodes {page_author} {page_slug} {page_url} {page_date} {page_content}
* Get pages Description
*
* <code>
* echo Page::description();
* </code>
*
* @return string
*/
Shortcode::add('page_author', 'Page::author');
Shortcode::add('page_slug', 'Page::slug');
Shortcode::add('page_url', 'Page::url');
Shortcode::add('page_content', 'Page::_content');
Shortcode::add('page_date', 'Page::_date');
public static function description()
{
return Pages::$page['description'];
}
/**
* Page class
* Get pages Keywords
*
* <code>
* echo Page::keywords();
* </code>
*
* @return string
*/
class Page extends Pages {
public static function keywords()
{
return Pages::$page['keywords'];
}
}
/**
* Get date of current page
*
* <code>
* echo Page::date();
* </code>
*
* @param string $format Date format
* @return string
*/
public static function date($format = 'Y-m-d') {
return Date::format(Pages::$page['date'], $format);
}
/**
* Add new shortcodes {page_author} {page_slug} {page_url} {page_date} {page_content}
*/
Shortcode::add('page_author', 'Page::author');
Shortcode::add('page_slug', 'Page::slug');
Shortcode::add('page_url', 'Page::url');
Shortcode::add('page_content', 'Page::_content');
Shortcode::add('page_date', 'Page::_date');
/**
* Page class
*/
class Page extends Pages
{
/**
* Get date of current page
*
* <code>
* echo Page::date();
* </code>
*
* @param string $format Date format
* @return string
*/
public static function date($format = 'Y-m-d')
{
return Date::format(Pages::$page['date'], $format);
}
/**
* Get author of current page
*
* <code>
* echo Page::author();
* </code>
*
* @return string
*/
public static function author() {
return Pages::$page['author'];
}
/**
* Get author of current page
*
* <code>
* echo Page::author();
* </code>
*
* @return string
*/
public static function author()
{
return Pages::$page['author'];
}
/**
* Get children pages for a specific parent page
*
* <code>
* $pages = Page::children('page');
* </code>
*
* @param string $parent Parent page
* @return array
*/
public static function children($parent)
{
return Pages::$pages->select('[parent="'.(string) $parent.'"]', 'all');
}
/**
* Get children pages for a specific parent page
*
* <code>
* $pages = Page::children('page');
* </code>
*
* @param string $parent Parent page
* @return array
*/
public static function children($parent) {
return Pages::$pages->select('[parent="'.(string)$parent.'"]', 'all');
}
/**
* Get the available children pages for requested page.
*
* <code>
* echo Page::available();
* </code>
*
*/
public static function available()
{
$pages = Pages::$pages->select('[parent="'.Pages::$requested_page.'"]', 'all');
// Display view
View::factory('box/pages/views/frontend/available_pages')
->assign('pages', $pages)
->display();
}
/**
* Get page breadcrumbs
*
* <code>
* echo Page::breadcrumbs();
* </code>
*
*/
public static function breadcrumbs()
{
$current_page = Pages::$requested_page;
$parent_page = '';
if ($current_page !== 'error404') {
$page = Pages::$pages->select('[slug="'.$current_page.'"]', null);
if (trim($page['parent']) !== '') {
$parent = true;
$parent_page = Pages::$pages->select('[slug="'.$page['parent'].'"]', null);
} else {
$parent = false;
}
/**
* Get the available children pages for requested page.
*
* <code>
* echo Page::available();
* </code>
*
*/
public static function available() {
$pages = Pages::$pages->select('[parent="'.Pages::$requested_page.'"]', 'all');
// Display view
View::factory('box/pages/views/frontend/available_pages')
->assign('pages', $pages)
View::factory('box/pages/views/frontend/breadcrumbs')
->assign('current_page', $current_page)
->assign('page', $page)
->assign('parent', $parent)
->assign('parent_page', $parent_page)
->display();
}
}
/**
* Get page breadcrumbs
*
* <code>
* echo Page::breadcrumbs();
* </code>
*
*/
public static function breadcrumbs() {
$current_page = Pages::$requested_page;
$parent_page = '';
if ($current_page !== 'error404') {
$page = Pages::$pages->select('[slug="'.$current_page.'"]', null);
if (trim($page['parent']) !== '') {
$parent = true;
$parent_page = Pages::$pages->select('[slug="'.$page['parent'].'"]', null);
} else {
$parent = false;
}
// Display view
View::factory('box/pages/views/frontend/breadcrumbs')
->assign('current_page', $current_page)
->assign('page', $page)
->assign('parent', $parent)
->assign('parent_page', $parent_page)
->display();
}
}
/**
* Get page url
*
* <code>
* echo Page::url();
* </code>
*
*/
public static function url()
{
return Option::get('siteurl').Pages::$page['slug'];
}
/**
* Get page slug
*
* <code>
* echo Page::slug();
* </code>
*
*/
public static function slug()
{
return Pages::$page['slug'];
}
/**
* Get page url
*
* <code>
* echo Page::url();
* </code>
*
*/
public static function url() {
return Option::get('siteurl').Pages::$page['slug'];
/**
* Get page meta robots
*
* <code>
* echo Page::robots();
* </code>
*
*/
public static function robots()
{
if (Pages::$page !== null) {
$_index = (isset(Pages::$page['robots_index'])) ? Pages::$page['robots_index'] : '';
$_follow = (isset(Pages::$page['robots_follow'])) ? Pages::$page['robots_follow'] : '';
$robots = ( ! empty($_index) && ! empty($_follow)) ? $_index.', '.$_follow : '';
} else {
$robots = '';
}
return $robots;
}
/**
* Get page slug
*
* <code>
* echo Page::slug();
* </code>
*
*/
public static function slug() {
return Pages::$page['slug'];
}
public static function _date($attributes)
{
return Page::date((isset($attributes['format'])) ? $attributes['format'] : 'Y-m-d');
}
public static function _content($attributes)
{
return Page::content((isset($attributes['name']) ? $attributes['name'] : ''));
}
/**
* Get page meta robots
*
* <code>
* echo Page::robots();
* </code>
*
*/
public static function robots() {
if (Pages::$page !== null) {
$_index = (isset(Pages::$page['robots_index'])) ? Pages::$page['robots_index'] : '';
$_follow = (isset(Pages::$page['robots_follow'])) ? Pages::$page['robots_follow'] : '';
$robots = ( ! empty($_index) && ! empty($_follow)) ? $_index.', '.$_follow : '';
} else {
$robots = '';
}
return $robots;
}
public static function _date($attributes) {
return Page::date((isset($attributes['format'])) ? $attributes['format'] : 'Y-m-d');
}
public static function _content($attributes) {
return Page::content((isset($attributes['name']) ? $attributes['name'] : ''));
}
}
}

View File

@@ -3,7 +3,7 @@
<?php if (Notification::get('success')) Alert::success(Notification::get('success')); ?>
<?php
<?php
echo (
Form::open().
Form::hidden('csrf', Security::token())
@@ -15,7 +15,7 @@
<li <?php if (Notification::get('metadata')) { ?>class="active"<?php } ?>><a href="#metadata" data-toggle="tab"><?php echo __('Metadata', 'pages'); ?></a></li>
<li <?php if (Notification::get('settings')) { ?>class="active"<?php } ?>><a href="#settings" data-toggle="tab"><?php echo __('Settings', 'pages'); ?></a></li>
</ul>
<div class="tab-content tab-page">
<div class="tab-pane <?php if (Notification::get('page')) { ?>active<?php } ?>" id="page">
<?php
@@ -25,16 +25,16 @@
);
if (isset($errors['pages_empty_title'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_empty_title'].'</span>';
echo (
echo (
Html::br(2).
Form::label('page_name', __('Name (slug)', 'pages')).
Form::label('page_name', __('Name (slug)', 'pages')).
Form::input('page_name', $post_name, array('class' => (isset($errors['pages_empty_name'])) ? 'input-xxlarge error-field' : 'input-xxlarge'))
);
if (isset($errors['pages_exists'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_exists'].'</span>';
if (isset($errors['pages_empty_name'])) echo Html::nbsp(3).'<span style="color:red">'.$errors['pages_empty_name'].'</span>';
?>
</div>
<div class="tab-pane <?php if (Notification::get('metadata')) { ?>active<?php } ?>" id="metadata">
<?php
@@ -43,14 +43,14 @@
Form::input('page_keywords', $post_keywords, array('class' => 'input-xxlarge')).
Html::br(2).
Form::label('page_description', __('Description', 'pages')).
Form::textarea('page_description', $post_description, array('class' => 'input-xxlarge'))
Form::textarea('page_description', $post_description, array('class' => 'input-xxlarge'))
);
?>
<?php
echo (
Html::br(2).
Form::label('robots', __('Search Engines Robots', 'pages')).
<?php
echo (
Html::br(2).
Form::label('robots', __('Search Engines Robots', 'pages')).
'no Index'.Html::nbsp().Form::checkbox('robots_index', 'index', $post_robots_index).Html::nbsp(2).
'no Follow'.Html::nbsp().Form::checkbox('robots_follow', 'follow', $post_robots_follow)
);
@@ -59,34 +59,34 @@
<div class="tab-pane <?php if (Notification::get('settings')) { ?>active<?php } ?>" id="settings">
<div class="row-fluid">
<div class="span3">
<?php
<?php
echo (
Form::label('pages', __('Parent', 'pages')).
Form::select('pages', $pages_array, $parent_page)
Form::select('pages', $pages_array, $parent_page)
);
?>
</div>
</div>
<div class="span3">
<?php
echo (
Form::label('templates', __('Template', 'pages')).
Form::select('templates', $templates_array, $post_template)
);
?>
</div>
<div class="span3">
<?php
echo (
Form::label('status', __('Status', 'pages')).
Form::select('status', $status_array, $post_status)
);
?>
</div>
<div class="span3">
<?php
<?php
echo (
Form::label('status', __('Status', 'pages')).
Form::select('status', $status_array, $post_status)
);
?>
</div>
<div class="span3">
<?php
echo (
Form::label('access', __('Access', 'pages')).
Form::select('access', $access_array, $post_access)
Form::select('access', $access_array, $post_access)
);
?>
</div>

View File

@@ -3,7 +3,7 @@
<?php if (Notification::get('success')) Alert::success(Notification::get('success')); ?>
<?php
<?php
echo (
Form::open().
Form::hidden('csrf', Security::token()).
@@ -18,7 +18,7 @@
<li <?php if (Notification::get('metadata')) { ?>class="active"<?php } ?>><a href="#metadata" data-toggle="tab"><?php echo __('Metadata', 'pages'); ?></a></li>
<li <?php if (Notification::get('settings')) { ?>class="active"<?php } ?>><a href="#settings" data-toggle="tab"><?php echo __('Settings', 'pages'); ?></a></li>
</ul>
<div class="tab-content tab-page">
<div class="tab-pane <?php if (Notification::get('page')) { ?>active<?php } ?>" id="page">
<?php
@@ -30,7 +30,7 @@
if (Request::get('name') !== 'error404') {
echo (
Html::br(2).
Html::br(2).
Form::label('page_name', __('Name (slug)', 'pages'))
);
}
@@ -49,19 +49,18 @@
</div>
<div class="tab-pane <?php if (Notification::get('metadata')) { ?>active<?php } ?>" id="metadata">
<?php
echo (
Form::label('page_keywords', __('Keywords', 'pages')).
Form::input('page_keywords', $keywords_to_edit, array('class' => 'input-xxlarge')).
Html::br(2).
Form::label('page_description', __('Description', 'pages')).
Form::textarea('page_description', $description_to_edit, array('class' => 'input-xxlarge'))
Form::textarea('page_description', $description_to_edit, array('class' => 'input-xxlarge'))
);
echo (
Html::br(2).
Form::label('robots', __('Search Engines Robots', 'pages')).
echo (
Html::br(2).
Form::label('robots', __('Search Engines Robots', 'pages')).
'no Index'.Html::nbsp().Form::checkbox('robots_index', 'index', $post_robots_index).Html::nbsp(2).
'no Follow'.Html::nbsp().Form::checkbox('robots_follow', 'follow', $post_robots_follow)
);
@@ -75,7 +74,7 @@
} else {
?>
<div class="span3">
<?php
<?php
echo (
Form::label('pages', __('Parent', 'pages')).
Form::select('pages', $pages_array, $parent_page)
@@ -92,16 +91,16 @@
echo (
Form::label('templates', __('Template', 'pages')).
Form::select('templates', $templates_array, $template)
);
);
?>
</div>
<?php
<?php
if (Request::get('name') == 'error404') {
echo Form::hidden('status', $status);
} else {
?>
<div class="span3">
<?php
<?php
echo (
Form::label('status', __('Status', 'pages')).
Form::select('status', $status_array, $status)
@@ -109,13 +108,13 @@
?>
</div>
<?php } ?>
<?php
<?php
if (Request::get('name') == 'error404') {
echo Form::hidden('access', $access);
} else {
?>
<div class="span3">
<?php
<?php
echo (
Form::label('access', __('Access', 'pages')).
Form::select('access', $access_array, $access)
@@ -127,7 +126,6 @@
</div>
</div>
<br /><br />
<?php Action::run('admin_editor', array(Html::toText($to_edit))); ?>

View File

@@ -4,10 +4,10 @@
<?php if (Notification::get('success')) Alert::success(Notification::get('success')); ?>
<?php
echo (
echo (
Html::anchor(__('Create New Page', 'pages'), 'index.php?id=pages&action=add_page', array('title' => __('Create New Page', 'pages'), 'class' => 'btn btn-small')). Html::nbsp(3).
Html::anchor(__('Edit 404 Page', 'pages'), 'index.php?id=pages&action=edit_page&name=error404', array('title' => __('Create New Page', 'pages'), 'class' => 'btn btn-small'))
);
Html::anchor(__('Edit 404 Page', 'pages'), 'index.php?id=pages&action=edit_page&name=error404', array('title' => __('Create New Page', 'pages'), 'class' => 'btn btn-small'))
);
?>
<br /><br />
@@ -26,33 +26,33 @@
</thead>
<tbody>
<?php
if (count($pages) != 0) {
if (count($pages) != 0) {
foreach ($pages as $page) {
if ($page['parent'] != '') { $dash = Html::arrow('right').'&nbsp;&nbsp;'; } else { $dash = ""; }
?>
<?php if ($page['slug'] != 'error404') { ?>
<?php
$expand = PagesAdmin::$pages->select('[slug="'.(string)$page['parent'].'"]', null);
$expand = PagesAdmin::$pages->select('[slug="'.(string) $page['parent'].'"]', null);
if ($page['parent'] !== '' && isset($expand['expand']) && $expand['expand'] == '1') { $visibility = 'style="display:none;"'; } else { $visibility = ''; }
?>
<tr <?php echo $visibility; ?> <?php if(trim($page['parent']) !== '') {?> rel="children_<?php echo $page['parent']; ?>" <?php } ?>>
<td>
<?php
if (count(PagesAdmin::$pages->select('[parent="'.(string)$page['slug'].'"]', 'all')) > 0) {
<tr <?php echo $visibility; ?> <?php if (trim($page['parent']) !== '') {?> rel="children_<?php echo $page['parent']; ?>" <?php } ?>>
<td>
<?php
if (count(PagesAdmin::$pages->select('[parent="'.(string) $page['slug'].'"]', 'all')) > 0) {
if (isset($page['expand']) && $page['expand'] == '1') {
echo '<a href="javascript:;" class="btn-expand parent" token="'.Security::token().'" rel="'.$page['slug'].'">+</a>';
} else {
echo '<a href="javascript:;" class="btn-expand parent" token="'.Security::token().'" rel="'.$page['slug'].'">-</a>';
}
}
?>
</td>
?>
</td>
<td>
<?php
$_parent = (trim($page['parent']) == '') ? '' : $page['parent'];
$parent = (trim($page['parent']) == '') ? '' : $page['parent'].'/';
echo (trim($page['parent']) == '') ? '' : '&nbsp;';
echo $dash.Html::anchor(Html::toText($page['title']), $site_url.$parent.$page['slug'], array('target' => '_blank', 'rel' => 'children_'.$_parent));
echo $dash.Html::anchor(Html::toText($page['title']), $site_url.$parent.$page['slug'], array('target' => '_blank', 'rel' => 'children_'.$_parent));
?>
</td>
<td class="hidden-phone">
@@ -67,7 +67,7 @@
<td class="hidden-phone">
<?php echo Date::format($page['date'], "j.n.Y"); ?>
</td>
<td>
<td>
<div class="pull-right">
<div class="btn-group">
<?php echo Html::anchor(__('Edit', 'pages'), 'index.php?id=pages&action=edit_page&name='.$page['slug'], array('class' => 'btn btn-small')); ?>
@@ -77,19 +77,19 @@
<li><a href="index.php?id=pages&action=add_page&parent_page=<?php echo $page['slug']; ?>" title="<?php echo __('Create New Page', 'pages'); ?>"><?php echo __('Add', 'pages'); ?></a></li>
<?php } ?>
<li><?php echo Html::anchor(__('Clone', 'pages'), 'index.php?id=pages&action=clone_page&name='.$page['slug'].'&token='.Security::token(), array('title' => __('Clone', 'pages'))); ?></li>
</ul>
</ul>
<?php echo Html::anchor(__('Delete', 'pages'),
'index.php?id=pages&action=delete_page&name='.$page['slug'].'&token='.Security::token(),
array('class' => 'btn btn-actions btn-small btn-actions-default', 'onclick' => "return confirmDelete('".__("Delete page: :page", 'pages', array(':page' => Html::toText($page['title'])))."')"));
?>
</div>
</div>
</div>
</div>
</td>
</tr>
</tr>
<?php } ?>
<?php
}
}
}
?>
</tbody>

View File

@@ -1,5 +1,5 @@
<ul>
<?php foreach ($pages as $page) { ?>
<li><a href="<?php echo $page['parent'].'/'.$page['slug']; ?>"><?php echo $page['title']; ?></a></li>
<li><a href="<?php echo $page['parent'].'/'.$page['slug']; ?>"><?php echo $page['title']; ?></a></li>
<?php } ?>
</ul>
</ul>

View File

@@ -2,4 +2,4 @@
<a href="<?php echo Site::url().$page['parent']; ?>"><?php echo $parent_page['title']; ?></a>&nbsp;<span>&rarr;</span>&nbsp;<a href="<?php echo Site::url().$page['parent'].'/'.$page['slug']; ?>"><?php echo $page['title']; ?></a>
<?php } else { ?>
<a href="<?php echo Site::url().$page['slug']; ?>"><?php echo $page['title']; ?></a>
<?php } ?>
<?php }

View File

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

View File

@@ -1,20 +1,20 @@
<?php
return array(
'plugins' => array(
'Plugins' => 'Plugins',
'Name' => 'Name',
'Actions' => 'Aktionen',
'Description' => 'Beschreibung',
'Installed' => 'Installiert',
'Install New' => 'Installiere Neue',
'Delete' => 'Löschen',
'Delete plugin :plugin' => 'Lösche Plugin :plugin',
'This plugins does not exist' => 'Diese Plugins existiert nicht',
'Version' => 'Version',
'Author' => 'Author',
'Get More Plugins' => 'Hole Weitere Plugins',
'Install' => 'Installieren',
'Uninstall' => 'Deinstallieren',
)
);
<?php
return array(
'plugins' => array(
'Plugins' => 'Plugins',
'Name' => 'Name',
'Actions' => 'Aktionen',
'Description' => 'Beschreibung',
'Installed' => 'Installiert',
'Install New' => 'Installiere Neue',
'Delete' => 'Löschen',
'Delete plugin :plugin' => 'Lösche Plugin :plugin',
'This plugins does not exist' => 'Diese Plugins existiert nicht',
'Version' => 'Version',
'Author' => 'Author',
'Get More Plugins' => 'Hole Weitere Plugins',
'Install' => 'Installieren',
'Uninstall' => 'Deinstallieren',
)
);

View File

@@ -1,5 +1,5 @@
<?php
return array(
'plugins' => array(
'Plugins' => 'Plugins',
@@ -17,4 +17,4 @@
'Install' => 'Install',
'Uninstall' => 'Uninstall',
)
);
);

View File

@@ -1,5 +1,5 @@
<?php
return array(
'plugins' => array(
'Plugins' => 'Plugin',
@@ -17,4 +17,4 @@
'Install' => 'Installa',
'Uninstall' => 'Disinstalla',
)
);
);

View File

@@ -1,5 +1,5 @@
<?php
return array(
'plugins' => array(
'Plugins' => 'Papildiniai',
@@ -17,4 +17,4 @@
'Install' => 'Įdiegti',
'Uninstall' => 'Išdiegti',
)
);
);

View File

@@ -1,5 +1,5 @@
<?php
return array(
'plugins' => array(
'Plugins' => 'Plugins',
@@ -17,4 +17,4 @@
'Install' => 'Instalar',
'Uninstall' => 'Desinstalar',
)
);
);

View File

@@ -1,5 +1,5 @@
<?php
return array(
'plugins' => array(
'Plugins' => 'Плагины',
@@ -17,4 +17,4 @@
'Install' => 'Установить',
'Uninstall' => 'Удалить',
)
);
);

View File

@@ -1,5 +1,5 @@
<?php
return array(
'plugins' => array(
'Plugins' => 'Плагіни',
@@ -17,4 +17,4 @@
'Install' => 'Установити',
'Uninstall' => 'Видалити',
)
);
);

View File

@@ -1,151 +1,148 @@
<?php
// Add plugin navigation link
Navigation::add(__('Plugins', 'plugins'), 'extends', 'plugins', 1);
// Add plugin navigation link
Navigation::add(__('Plugins', 'plugins'), 'extends', 'plugins', 1);
/**
* Plugins Admin
*/
class PluginsAdmin extends Backend
{
/**
* Plugins Admin
* Plugins admin
*/
class PluginsAdmin extends Backend {
public static function main()
{
// Get siteurl
$site_url = Option::get('siteurl');
/**
* Plugins admin
*/
public static function main() {
// Get installed plugin from $plugins array
$installed_plugins = Plugin::$plugins;
// Get siteurl
$site_url = Option::get('siteurl');
// Get installed plugin from $plugins array
$installed_plugins = Plugin::$plugins;
// Get installed users plugins
$_users_plugins = array();
foreach (Plugin::$plugins as $plugin) {
if ($plugin['privilege'] !== 'box') $_users_plugins[] = $plugin['id'];
}
// Get installed users plugins
$_users_plugins = array();
foreach (Plugin::$plugins as $plugin) {
if ($plugin['privilege'] !== 'box') $_users_plugins[] = $plugin['id'];
}
// Get plugins table
$plugins = new Table('plugins');
// Get plugins table
$plugins = new Table('plugins');
// Delete plugin
// -------------------------------------
if (Request::get('delete_plugin')) {
// Delete plugin
// -------------------------------------
if (Request::get('delete_plugin')) {
if (Security::check(Request::get('token'))) {
if (Security::check(Request::get('token'))) {
// Nobody cant remove box plugins
if ($installed_plugins[Text::lowercase(str_replace("Plugin", "", Request::get('delete_plugin')))]['privilege'] !== 'box') {
// Run plugin uninstaller file
$plugin_name = Request::get('delete_plugin');
if (File::exists(PLUGINS . DS . $plugin_name . DS .'install' . DS . $plugin_name . '.uninstall.php')) {
include PLUGINS . DS . $plugin_name . DS . 'install' . DS . $plugin_name . '.uninstall.php';
}
// Cleanup minify
if (count($files = File::scan(MINIFY, array('css', 'js', 'php'))) > 0) foreach ($files as $file) File::delete(MINIFY . DS . $file);
// Nobody cant remove box plugins
if ($installed_plugins[Text::lowercase(str_replace("Plugin", "", Request::get('delete_plugin')))]['privilege'] !== 'box') {
// Clean i18n cache
Cache::clean('i18n');
// Delete plugin form plugins table
$plugins->deleteWhere('[name="'.Request::get('delete_plugin').'"]');
// Redirect
Request::redirect('index.php?id=plugins');
}
// Run plugin uninstaller file
$plugin_name = Request::get('delete_plugin');
if (File::exists(PLUGINS . DS . $plugin_name . DS .'install' . DS . $plugin_name . '.uninstall.php')) {
include PLUGINS . DS . $plugin_name . DS . 'install' . DS . $plugin_name . '.uninstall.php';
}
} else { die('csrf detected!'); }
}
// Install new plugin
// -------------------------------------
if (Request::get('install')) {
if (Security::check(Request::get('token'))) {
// Load plugin install xml file
$plugin_xml = XML::loadFile(PLUGINS . DS . basename(Text::lowercase(Request::get('install')), '.manifest.xml') . DS . 'install' . DS . Request::get('install'));
// Add plugin to plugins table
$plugins->insert(array('name' => basename(Request::get('install'), '.manifest.xml'),
'location' => (string)$plugin_xml->plugin_location,
'status' => (string)$plugin_xml->plugin_status,
'priority' => (int)$plugin_xml->plugin_priority));
// Cleanup minify
// Cleanup minify
if (count($files = File::scan(MINIFY, array('css', 'js', 'php'))) > 0) foreach ($files as $file) File::delete(MINIFY . DS . $file);
// Clean i18n cache
Cache::clean('i18n');
// Run plugin installer file
$plugin_name = str_replace(array("Plugin", ".manifest.xml"), "", Request::get('install'));
if (File::exists(PLUGINS . DS .basename(Text::lowercase(Request::get('install')), '.manifest.xml') . DS . 'install' . DS . $plugin_name . '.install.php')) {
include PLUGINS . DS . basename(Text::lowercase(Request::get('install')), '.manifest.xml') . DS . 'install' . DS . $plugin_name . '.install.php';
}
Request::redirect('index.php?id=plugins');
Cache::clean('i18n');
} else { die('csrf detected!'); }
}
// Delete plugin form plugins table
$plugins->deleteWhere('[name="'.Request::get('delete_plugin').'"]');
// Delete plugin from server
// -------------------------------------
if (Request::get('delete_plugin_from_server')) {
if (Security::check(Request::get('token'))) {
Dir::delete(PLUGINS . DS . basename(Request::get('delete_plugin_from_server'), '.manifest.xml'));
// Redirect
Request::redirect('index.php?id=plugins');
}
} else { die('csrf detected!'); }
}
// Installed plugins
$plugins_installed = array();
// New plugins
$plugins_new = array();
// Plugins to install
$plugins_to_intall = array();
// Scan plugins directory for .manifest.xml
$plugins_new = File::scan(PLUGINS, '.manifest.xml');
// Get installed plugins from plugins table
$plugins_installed = $plugins->select(null, 'all', null, array('location', 'priority'), 'priority', 'ASC');
// Update $plugins_installed array. extract plugins names
foreach ($plugins_installed as $plg) {
$_plg[] = basename($plg['location'], 'plugin.php').'manifest.xml';
}
// Diff
$plugins_to_install = array_diff($plugins_new, $_plg);
// Create array of plugins to install
$count = 0;
foreach ($plugins_to_install as $plugin) {
$plg_path = PLUGINS . DS . Text::lowercase(basename($plugin, '.manifest.xml')) . DS . 'install' . DS . $plugin;
if (file_exists($plg_path)) {
$plugins_to_intall[$count]['path'] = $plg_path;
$plugins_to_intall[$count]['plugin'] = $plugin;
$count++;
}
}
// Draw template
View::factory('box/plugins/views/backend/index')
->assign('installed_plugins', $installed_plugins)
->assign('plugins_to_intall', $plugins_to_intall)
->assign('_users_plugins', $_users_plugins)
->display();
} else { die('csrf detected!'); }
}
}
// Install new plugin
// -------------------------------------
if (Request::get('install')) {
if (Security::check(Request::get('token'))) {
// Load plugin install xml file
$plugin_xml = XML::loadFile(PLUGINS . DS . basename(Text::lowercase(Request::get('install')), '.manifest.xml') . DS . 'install' . DS . Request::get('install'));
// Add plugin to plugins table
$plugins->insert(array('name' => basename(Request::get('install'), '.manifest.xml'),
'location' => (string) $plugin_xml->plugin_location,
'status' => (string) $plugin_xml->plugin_status,
'priority' => (int) $plugin_xml->plugin_priority));
// Cleanup minify
if (count($files = File::scan(MINIFY, array('css', 'js', 'php'))) > 0) foreach ($files as $file) File::delete(MINIFY . DS . $file);
// Clean i18n cache
Cache::clean('i18n');
// Run plugin installer file
$plugin_name = str_replace(array("Plugin", ".manifest.xml"), "", Request::get('install'));
if (File::exists(PLUGINS . DS .basename(Text::lowercase(Request::get('install')), '.manifest.xml') . DS . 'install' . DS . $plugin_name . '.install.php')) {
include PLUGINS . DS . basename(Text::lowercase(Request::get('install')), '.manifest.xml') . DS . 'install' . DS . $plugin_name . '.install.php';
}
Request::redirect('index.php?id=plugins');
} else { die('csrf detected!'); }
}
// Delete plugin from server
// -------------------------------------
if (Request::get('delete_plugin_from_server')) {
if (Security::check(Request::get('token'))) {
Dir::delete(PLUGINS . DS . basename(Request::get('delete_plugin_from_server'), '.manifest.xml'));
Request::redirect('index.php?id=plugins');
} else { die('csrf detected!'); }
}
// Installed plugins
$plugins_installed = array();
// New plugins
$plugins_new = array();
// Plugins to install
$plugins_to_intall = array();
// Scan plugins directory for .manifest.xml
$plugins_new = File::scan(PLUGINS, '.manifest.xml');
// Get installed plugins from plugins table
$plugins_installed = $plugins->select(null, 'all', null, array('location', 'priority'), 'priority', 'ASC');
// Update $plugins_installed array. extract plugins names
foreach ($plugins_installed as $plg) {
$_plg[] = basename($plg['location'], 'plugin.php').'manifest.xml';
}
// Diff
$plugins_to_install = array_diff($plugins_new, $_plg);
// Create array of plugins to install
$count = 0;
foreach ($plugins_to_install as $plugin) {
$plg_path = PLUGINS . DS . Text::lowercase(basename($plugin, '.manifest.xml')) . DS . 'install' . DS . $plugin;
if (file_exists($plg_path)) {
$plugins_to_intall[$count]['path'] = $plg_path;
$plugins_to_intall[$count]['plugin'] = $plugin;
$count++;
}
}
// Draw template
View::factory('box/plugins/views/backend/index')
->assign('installed_plugins', $installed_plugins)
->assign('plugins_to_intall', $plugins_to_intall)
->assign('_users_plugins', $_users_plugins)
->display();
}
}

View File

@@ -1,31 +1,29 @@
<?php
/**
* Plugins manger plugin
*
* @package Monstra
* @subpackage Plugins
* @author Romanenko Sergey / Awilum
* @copyright 2012 Romanenko Sergey / Awilum
* @version 1.0.0
*
*/
/**
* Plugins manger plugin
*
* @package Monstra
* @subpackage Plugins
* @author Romanenko Sergey / Awilum
* @copyright 2012 Romanenko Sergey / Awilum
* @version 1.0.0
*
*/
// Register plugin
Plugin::register( __FILE__,
__('Plugins', 'plugins'),
__('Plugins manager', 'plugins'),
'1.0.0',
'Awilum',
'http://monstra.org/',
null,
'box');
// Register plugin
Plugin::register( __FILE__,
__('Plugins', 'plugins'),
__('Plugins manager', 'plugins'),
'1.0.0',
'Awilum',
'http://monstra.org/',
null,
'box');
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin'))) {
if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin'))) {
// Include Admin
Plugin::admin('plugins', 'box');
}
// Include Admin
Plugin::admin('plugins', 'box');
}

View File

@@ -6,14 +6,14 @@
<!-- Plugins_tabs -->
<ul class="nav nav-tabs">
<li class="active"><a href="#installed" data-toggle="tab"><?php echo __('Installed', 'plugins'); ?></a></li>
<li><a href="#installnew" data-toggle="tab"><?php echo __('Install New', 'plugins'); ?> <?php if(count($plugins_to_intall) > 0) { ?><span class="badge"><?php echo count($plugins_to_intall); ?></span><?php } ?></a></li>
<li><a href="#installnew" data-toggle="tab"><?php echo __('Install New', 'plugins'); ?> <?php if (count($plugins_to_intall) > 0) { ?><span class="badge"><?php echo count($plugins_to_intall); ?></span><?php } ?></a></li>
<li><a href="http://monstra.org" target="_blank"><?php echo __('Get More Plugins', 'plugins'); ?></a></li>
</ul>
<!-- /Plugins_tabs -->
<div class="tab-content">
<div class="tab-pane active" id="installed">
<div class="tab-pane active" id="installed">
<table class="table table-bordered">
<thead>
<tr>
@@ -26,7 +26,7 @@
</thead>
<tbody>
<?php foreach ($installed_plugins as $plugin) { if ($plugin['privilege'] !== 'box') { ?>
<tr>
<tr>
<td>
<?php echo $plugin['title']; ?>
</td>
@@ -35,7 +35,7 @@
</td>
<td>
<a target="_blank" href="<?php echo $plugin['author_uri']; ?>"><?php echo $plugin['author']; ?></a>
</td>
</td>
<td>
<?php echo $plugin['version']; ?>
</td>
@@ -50,11 +50,10 @@
</tr>
<?php } } ?>
</tbody>
</table>
</table>
</div>
<div class="tab-pane" id="installnew">
<div class="tab-pane" id="installnew">
<table class="table table-bordered">
<thead>
<tr>
@@ -66,9 +65,9 @@
</tr>
</thead>
<tbody>
<?php foreach ($plugins_to_intall as $plug) { $plugin_xml = XML::loadFile($plug['path']); ?>
<tr>
<tr>
<td>
<?php echo $plugin_xml->plugin_name; ?>
</td>
@@ -93,10 +92,10 @@
</tr>
<?php } ?>
</tbody>
</table>
</table>
</div>
<!-- /Plugins_to_install_list -->
</div>
</div>
</div>

View File

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

View File

@@ -1,7 +1,7 @@
<?php
return array(
'sitemap' => array(
'Sitemap' => 'Sitemap',
)
);
<?php
return array(
'sitemap' => array(
'Sitemap' => 'Sitemap',
)
);

View File

@@ -1,7 +1,7 @@
<?php
return array(
'sitemap' => array(
'Sitemap' => 'Sitemap',
)
);
);

View File

@@ -1,7 +1,7 @@
<?php
return array(
'sitemap' => array(
'Sitemap' => 'Sitemap',
)
);
);

View File

@@ -1,7 +1,7 @@
<?php
return array(
'sitemap' => array(
'Sitemap' => 'Sitemap',
)
);
);

Some files were not shown because too many files have changed in this diff Show More