aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/LocalFilesEditor
diff options
context:
space:
mode:
authorpatdenice <patdenice@piwigo.org>2008-03-01 14:49:11 +0000
committerpatdenice <patdenice@piwigo.org>2008-03-01 14:49:11 +0000
commit2ef8c58d3139ec931a75185a32ede7a7663c735f (patch)
tree46dea055272d100950ecc56ff58cca554e0801e0 /plugins/LocalFilesEditor
parent732e456b3ba0c3e9ff4134e0ea815df03375918b (diff)
New: plugin LocalFiles Editor.
Corrected: $id in smarty comment style in intro.tpl git-svn-id: http://piwigo.org/svn/trunk@2235 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--plugins/LocalFilesEditor/admin.php313
-rw-r--r--plugins/LocalFilesEditor/admin.tpl37
-rw-r--r--plugins/LocalFilesEditor/index.php33
-rw-r--r--plugins/LocalFilesEditor/language/en_UK/index.php33
-rw-r--r--plugins/LocalFilesEditor/language/en_UK/plugin.lang.php47
-rw-r--r--plugins/LocalFilesEditor/language/es_ES/index.php33
-rw-r--r--plugins/LocalFilesEditor/language/es_ES/plugin.lang.php47
-rw-r--r--plugins/LocalFilesEditor/language/fr_FR/index.php33
-rw-r--r--plugins/LocalFilesEditor/language/fr_FR/plugin.lang.php47
-rw-r--r--plugins/LocalFilesEditor/language/index.php33
-rw-r--r--plugins/LocalFilesEditor/main.inc.php47
-rw-r--r--plugins/LocalFilesEditor/show_default.php56
-rw-r--r--plugins/LocalFilesEditor/show_default.tpl3
13 files changed, 762 insertions, 0 deletions
diff --git a/plugins/LocalFilesEditor/admin.php b/plugins/LocalFilesEditor/admin.php
new file mode 100644
index 000000000..551e124ee
--- /dev/null
+++ b/plugins/LocalFilesEditor/admin.php
@@ -0,0 +1,313 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file : $Id$
+// | last update : $Date$
+// | last modifier : $Author$
+// | revision : $Revision$
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
+load_language('plugin.lang', LOCALEDIT_PATH);
+$my_base_url = get_admin_plugin_menu_link(__FILE__);
+
+/**
+ * returns $code if php syntax is correct
+ * else return false
+ *
+ * @param string php code
+ */
+function eval_syntax($code)
+{
+ $code = str_replace(array('<?php', '?>'), '', $code);
+ $b = 0;
+ foreach (token_get_all($code) as $token)
+ {
+ if ('{' == $token) ++$b;
+ else if ('}' == $token) --$b;
+ }
+ if ($b) return false;
+ else
+ {
+ ob_start();
+ $eval = eval('if(0){' . $code . '}');
+ ob_end_clean();
+ if ($eval === false) return false;
+ else return '<?php' . $code . '?>';
+ }
+}
+
+
+// +-----------------------------------------------------------------------+
+// | Tabssheet
+// +-----------------------------------------------------------------------+
+if (!isset($_GET['tab']))
+ $page['tab'] = 'localconf';
+else
+ $page['tab'] = $_GET['tab'];
+
+$tabsheet = new tabsheet();
+$tabsheet->add('localconf',
+ l10n('locfiledit_onglet_localconf'),
+ $my_base_url.'&amp;tab=localconf');
+$tabsheet->add('css',
+ l10n('locfiledit_onglet_css'),
+ $my_base_url.'&amp;tab=css');
+$tabsheet->add('tpl',
+ l10n('locfiledit_onglet_tpl'),
+ $my_base_url.'&amp;tab=tpl');
+$tabsheet->add('lang',
+ l10n('locfiledit_onglet_lang'),
+ $my_base_url.'&amp;tab=lang');
+$tabsheet->add('plug',
+ l10n('locfiledit_onglet_plug'),
+ $my_base_url.'&amp;tab=plug');
+$tabsheet->select($page['tab']);
+$tabsheet->assign();
+
+
+// +-----------------------------------------------------------------------+
+// | Variables init
+// +-----------------------------------------------------------------------+
+$edited_file = '';
+$content_file = '';
+$new_file['localconf'] = "<?php\n\n".l10n('locfiledit_newfile')."\n\n\n\n\n?>";
+$new_file['css'] = l10n('locfiledit_newfile') . "\n\n";
+$new_file['lang'] = "<?php\n\n" . l10n('locfiledit_newfile') . "\n\n\n\n\n?>";
+$new_file['plug'] = "<?php\n/*
+Plugin Name: " . l10n('locfiledit_onglet_plug') . "
+Version: 1.0
+Description: " . l10n('locfiledit_onglet_plug') . "
+Plugin URI: http://www.phpwebgallery.net
+Author:
+Author URI:
+*/\n\n\n\n\n?>";
+
+// Edit selected file for CSS, template and language
+if ((isset($_POST['edit'])) and !is_numeric($_POST['file_to_edit']))
+{
+ $edited_file = $_POST['file_to_edit'];
+ $content_file = file_exists($edited_file) ?
+ file_get_contents($edited_file) : $new_file[$page['tab']];
+}
+
+
+// +-----------------------------------------------------------------------+
+// | Process tabsheet
+// +-----------------------------------------------------------------------+
+$options[] = l10n('locfiledit_choose_file');
+$selected = 0;
+
+switch ($page['tab'])
+{
+ case 'localconf':
+ $edited_file = PHPWG_ROOT_PATH . "include/config_local.inc.php";
+ $content_file = file_exists($edited_file) ?
+ file_get_contents($edited_file) : $new_file['localconf'];
+
+ $template->assign('show_default' , array(
+ array('SHOW_DEFAULT' => LOCALEDIT_PATH
+ . 'show_default.php?file=include/config_default.inc.php',
+ 'FILE' => 'config_default.inc.php')));
+ break;
+
+
+ case 'css':
+ $template_dir = PHPWG_ROOT_PATH . 'template';
+ $options[] = '----------------------';
+ $value = PHPWG_ROOT_PATH . "template-common/local-layout.css";
+ $options[$value] = 'template-common / local-layout.css';
+ if ($edited_file == $value) $selected = $value;
+
+ foreach (get_dirs($template_dir) as $pwg_template)
+ {
+ $options[] = '----------------------';
+ $value = $template_dir . '/' . $pwg_template . '/local-layout.css';
+ $options[$value] = $pwg_template . ' / local-layout.css';
+ if ($edited_file == $value) $selected = $value;
+ $options[] = '----------------------';
+ foreach (get_dirs($template_dir.'/'.$pwg_template.'/theme') as $theme)
+ {
+ $value = $template_dir.'/'.$pwg_template.'/theme/'.$theme.'/theme.css';
+ $options[$value] = $pwg_template . ' / ' . $theme . ' / theme.css';
+ if ($edited_file == $value) $selected = $value;
+ }
+ }
+ $template->assign('css_lang_tpl', array(
+ 'OPTIONS' => $options,
+ 'SELECTED' => $selected));
+ break;
+
+
+ case 'tpl':
+ $template_dir = PHPWG_ROOT_PATH . 'template';
+ foreach (get_dirs($template_dir) as $pwg_template)
+ {
+ $dir = $template_dir . '/' . $pwg_template . '/';
+ $options[] = '----------------------';
+ if (is_dir($dir) and $content = opendir($dir))
+ {
+ while ($node = readdir($content))
+ {
+ if (is_file($dir . $node)
+ and strtolower(get_extension($node)) == 'tpl'
+ and !strpos($node , '.bak.tpl'))
+ {
+ $value = $dir . $node;
+ $options[$value] = $pwg_template . ' / ' . $node;
+ if ($edited_file == $value) $selected = $value;
+ }
+ }
+ }
+ }
+ $template->assign('css_lang_tpl', array(
+ 'OPTIONS' => $options,
+ 'SELECTED' => $selected));
+ break;
+
+
+ case 'lang':
+ $options[] = '----------------------';
+ foreach (get_languages() as $language_code => $language_name)
+ {
+ $value = PHPWG_ROOT_PATH.'language/'.$language_code.'/local.lang.php';
+ if ($edited_file == $value)
+ {
+ $selected = $value;
+ $template->assign('show_default', array(
+ array('SHOW_DEFAULT' => LOCALEDIT_PATH
+ . 'show_default.php?file='
+ . 'language/'.$language_code.'/common.lang.php',
+ 'FILE' => 'common.lang.php'),
+ array('SHOW_DEFAULT' => LOCALEDIT_PATH
+ . 'show_default.php?file='
+ . 'language/'.$language_code.'/admin.lang.php',
+ 'FILE' => 'admin.lang.php')));
+ }
+ $options[$value] = $language_name;
+ }
+ $template->assign('css_lang_tpl', array(
+ 'OPTIONS' => $options,
+ 'SELECTED' => $selected));
+ break;
+
+ case 'plug':
+ $edited_file = PHPWG_PLUGINS_PATH . "PersonalPlugin/main.inc.php";
+ $content_file = file_exists($edited_file) ?
+ file_get_contents($edited_file) : $new_file['plug'];
+ break;
+}
+
+
+// +-----------------------------------------------------------------------+
+// | Load backup file
+// +-----------------------------------------------------------------------+
+if (isset($_POST['restore']) and !is_adviser())
+{
+ $edited_file = $_POST['edited_file'];
+ $content_file = file_get_contents(
+ substr_replace($edited_file , '.bak' , strrpos($edited_file ,'.') , 0));
+
+ array_push($page['infos'],
+ l10n('locfiledit_bak_loaded1'),
+ l10n('locfiledit_bak_loaded2'));
+}
+
+
+// +-----------------------------------------------------------------------+
+// | Save file
+// +-----------------------------------------------------------------------+
+if (isset($_POST['submit']) and !is_adviser())
+{
+ $edited_file = $_POST['edited_file'];
+ $content_file = stripslashes($_POST['text']);
+ if (get_extension($edited_file) == 'php')
+ {
+ $content_file = eval_syntax($content_file);
+ }
+ if ($content_file === false)
+ {
+ array_push($page['errors'], l10n('locfiledit_syntax_error'));
+ }
+ else
+ {
+ if ($page['tab'] == 'plug'
+ and !is_dir(PHPWG_PLUGINS_PATH . 'PersonalPlugin'))
+ {
+ @mkdir(PHPWG_PLUGINS_PATH . "PersonalPlugin");
+ }
+ if (file_exists($edited_file))
+ {
+ @copy($edited_file,
+ substr_replace($edited_file,
+ '.bak',
+ strrpos($edited_file , '.'),
+ 0)
+ );
+ }
+
+ if ($file = @fopen($edited_file , "w"))
+ {
+ @fwrite($file , $content_file);
+ @fclose($file);
+ array_push($page['infos'],
+ l10n('locfiledit_save_config'),
+ sprintf(l10n('locfiledit_saved_bak'),
+ substr(substr_replace($edited_file,
+ '.bak',
+ strrpos($edited_file , '.'),
+ 0),
+ 2)));
+ }
+ else
+ {
+ array_push($page['errors'], l10n('locfiledit_cant_save'));
+ }
+ }
+}
+
+
+// +-----------------------------------------------------------------------+
+// | template initialization
+// +-----------------------------------------------------------------------+
+$template->set_filenames(array(
+ 'plugin_admin_content' => dirname(__FILE__) . '/admin.tpl'));
+
+if (!empty($edited_file))
+{
+ if (!empty($page['errors']))
+ {
+ $content_file = stripslashes($_POST['text']);
+ }
+ $template->assign('zone_edit',
+ array('EDITED_FILE' => $edited_file,
+ 'CONTENT_FILE' => htmlspecialchars($content_file),
+ 'FILE_NAME' => trim($edited_file, './\\')));
+ if (file_exists(
+ substr_replace($edited_file ,'.bak',strrpos($edited_file , '.'),0)))
+ {
+ $template->assign('restore', true);
+ }
+}
+
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+
+?> \ No newline at end of file
diff --git a/plugins/LocalFilesEditor/admin.tpl b/plugins/LocalFilesEditor/admin.tpl
new file mode 100644
index 000000000..d8a228d67
--- /dev/null
+++ b/plugins/LocalFilesEditor/admin.tpl
@@ -0,0 +1,37 @@
+<div class="titrePage">
+ <h2>LocalFiles Editor</h2>
+ {$TABSHEET}
+</div>
+
+<form method="post" class="properties" action="" ENCTYPE="multipart/form-data">
+<div style="text-align:center;">
+
+{if isset ($css_lang_tpl)}
+{html_options name=file_to_edit options=$css_lang_tpl.OPTIONS selected=$css_lang_tpl.SELECTED}
+<input class="submit" type="submit" value="{'locfiledit_edit'|@translate}" name="edit" />
+<br>
+<br>
+{/if}
+
+{foreach from=$show_default item=file}
+<a href="{$file.SHOW_DEFAULT}" onclick="window.open( this.href, 'local_file', 'location=no,toolbar=no,menubar=no,status=no,resizable=yes,scrollbars=yes,fullscreen=yes' ); return false;">{'locfiledit_show_default'|@translate} "{$file.FILE}"</a>
+<br>
+{/foreach}
+
+{if isset ($zone_edit)}
+<br>
+<input type="text" style="display:none;" value="{$zone_edit.EDITED_FILE}" name="edited_file"/>
+<b>{$zone_edit.FILE_NAME}</b>
+<br>
+<textarea rows="30" name="text" style="width:90%;">{$zone_edit.CONTENT_FILE}</textarea>
+<br>{'locfiledit_save_bak'|@translate}
+<br><br>
+<input class="submit" type="submit" value="{'locfiledit_save_file'|@translate}" name="submit" {$TAG_INPUT_ENABLED}/>
+{if isset ($restore)}
+<input class="submit" type="submit" value="{'locfiledit_restore'|@translate}" name="restore" onclick="return confirm('{'locfiledit_restore_confirm'|@translate}');" {$TAG_INPUT_ENABLED}/>
+{/if}
+{/if}
+
+<br>
+</div>
+</form>
diff --git a/plugins/LocalFilesEditor/index.php b/plugins/LocalFilesEditor/index.php
new file mode 100644
index 000000000..61741e9cb
--- /dev/null
+++ b/plugins/LocalFilesEditor/index.php
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file : $Id$
+// | last update : $Date$
+// | last modifier : $Author$
+// | revision : $Revision$
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
diff --git a/plugins/LocalFilesEditor/language/en_UK/index.php b/plugins/LocalFilesEditor/language/en_UK/index.php
new file mode 100644
index 000000000..61741e9cb
--- /dev/null
+++ b/plugins/LocalFilesEditor/language/en_UK/index.php
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file : $Id$
+// | last update : $Date$
+// | last modifier : $Author$
+// | revision : $Revision$
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
diff --git a/plugins/LocalFilesEditor/language/en_UK/plugin.lang.php b/plugins/LocalFilesEditor/language/en_UK/plugin.lang.php
new file mode 100644
index 000000000..d0d3fb395
--- /dev/null
+++ b/plugins/LocalFilesEditor/language/en_UK/plugin.lang.php
@@ -0,0 +1,47 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file : $Id$
+// | last update : $Date$
+// | last modifier : $Author$
+// | revision : $Revision$
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+$lang['locfiledit_onglet_localconf'] = 'Local config';
+$lang['locfiledit_onglet_css'] = 'CSS';
+$lang['locfiledit_onglet_tpl'] = 'Templates';
+$lang['locfiledit_onglet_lang'] = 'Languages';
+$lang['locfiledit_onglet_plug'] = 'Personal Plugin';
+$lang['locfiledit_cant_save'] = 'Current file isn\'t writeable. Check if a directory "include/" is writeable (chmod).';
+$lang['locfiledit_newfile'] = "/* File is not existing and will be created by LocalFiles Editor. */";
+$lang['locfiledit_save_config'] = 'File written successfully.';
+$lang['locfiledit_show_default'] = 'Display reference file: ';
+$lang['locfiledit_save_bak'] = 'Backup copy will be created on save.';
+$lang['locfiledit_saved_bak'] = 'Backup file created (%s)';
+$lang['locfiledit_save_file'] = 'Save file';
+$lang['locfiledit_choose_file'] = 'Choose the file to be edited';
+$lang['locfiledit_edit'] = 'Edit';
+$lang['locfiledit_restore'] = 'Restore the backup file';
+$lang['locfiledit_restore_confirm'] = 'Please confirm?\nRestore won\\\'t be effective till next save.';
+$lang['locfiledit_bak_loaded1'] = 'Backup file loaded.';
+$lang['locfiledit_bak_loaded2'] = 'You must save file to restore it.';
+$lang['locfiledit_syntax_error'] = 'Syntax error! File can\'t be saved.';
+
+?> \ No newline at end of file
diff --git a/plugins/LocalFilesEditor/language/es_ES/index.php b/plugins/LocalFilesEditor/language/es_ES/index.php
new file mode 100644
index 000000000..61741e9cb
--- /dev/null
+++ b/plugins/LocalFilesEditor/language/es_ES/index.php
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file : $Id$
+// | last update : $Date$
+// | last modifier : $Author$
+// | revision : $Revision$
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
diff --git a/plugins/LocalFilesEditor/language/es_ES/plugin.lang.php b/plugins/LocalFilesEditor/language/es_ES/plugin.lang.php
new file mode 100644
index 000000000..efaeb82d0
--- /dev/null
+++ b/plugins/LocalFilesEditor/language/es_ES/plugin.lang.php
@@ -0,0 +1,47 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file : $Id$
+// | last update : $Date$
+// | last modifier : $Author$
+// | revision : $Revision$
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+$lang['locfiledit_onglet_localconf'] = 'Configuración local';
+$lang['locfiledit_onglet_css'] = 'CSS';
+$lang['locfiledit_onglet_tpl'] = 'Templates';
+$lang['locfiledit_onglet_lang'] = 'Idiomas';
+$lang['locfiledit_onglet_plug'] = 'Plugin personal';
+$lang['locfiledit_cant_save'] = 'Imposible escribir el fichero. Verifique los permisos (chmod) del expediente "include/".';
+$lang['locfiledit_newfile'] = "/* El fichero no existe y será creado en el momento del registro por LocalFiles Editor. */";
+$lang['locfiledit_save_config'] = 'El fichero ha sido registrado.';
+$lang['locfiledit_show_default'] = 'Fijar el fichero ';
+$lang['locfiledit_save_bak'] = 'Una copia de salvaguardia del fichero será creada en el momento del registro';
+$lang['locfiledit_saved_bak'] = 'Una copia de salvaguardia ha sido creada (%s)';
+$lang['locfiledit_save_file'] = 'Registrar el fichero';
+$lang['locfiledit_choose_file'] = 'Escoja un fichero que hay que editar';
+$lang['locfiledit_edit'] = 'Editar';
+$lang['locfiledit_restore'] = 'Cargar el fichero de salvaguardia';
+$lang['locfiledit_restore_confirm'] = '¿ Desea cargar el fichero de salvaguardia?\nUsted deberá luego hacer clic Registrar para restaurarlo.';
+$lang['locfiledit_bak_loaded1'] = 'Fichero cargado de salvaguardia';
+$lang['locfiledit_bak_loaded2'] = 'Usted debe registrarlo para salvaguardarlo.';
+$lang['locfiledit_syntax_error'] = '¡ Error de sintaxis! Imposible registrar el fichero.';
+
+?> \ No newline at end of file
diff --git a/plugins/LocalFilesEditor/language/fr_FR/index.php b/plugins/LocalFilesEditor/language/fr_FR/index.php
new file mode 100644
index 000000000..61741e9cb
--- /dev/null
+++ b/plugins/LocalFilesEditor/language/fr_FR/index.php
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file : $Id$
+// | last update : $Date$
+// | last modifier : $Author$
+// | revision : $Revision$
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
diff --git a/plugins/LocalFilesEditor/language/fr_FR/plugin.lang.php b/plugins/LocalFilesEditor/language/fr_FR/plugin.lang.php
new file mode 100644
index 000000000..1d4eb1714
--- /dev/null
+++ b/plugins/LocalFilesEditor/language/fr_FR/plugin.lang.php
@@ -0,0 +1,47 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file : $Id$
+// | last update : $Date$
+// | last modifier : $Author$
+// | revision : $Revision$
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+$lang['locfiledit_onglet_localconf'] = 'Configuration locale';
+$lang['locfiledit_onglet_css'] = 'CSS';
+$lang['locfiledit_onglet_tpl'] = 'Templates';
+$lang['locfiledit_onglet_lang'] = 'Langues';
+$lang['locfiledit_onglet_plug'] = 'Plugin Personnel';
+$lang['locfiledit_cant_save'] = 'Impossible d\'écrire le fichier. Vérifiez les permissions (chmod) du dossier "include/".';
+$lang['locfiledit_newfile'] = "/* Le fichier n'existe pas et sera créé lors de l'enregistrement par LocalFiles Editor. */";
+$lang['locfiledit_save_config'] = 'Le fichier a été enregistré.';
+$lang['locfiledit_show_default'] = 'Afficher le fichier ';
+$lang['locfiledit_save_bak'] = 'Une copie de sauvegarde du fichier sera créée lors de l\'enregistrement';
+$lang['locfiledit_saved_bak'] = 'Une copie de sauvegarde a été créée (%s)';
+$lang['locfiledit_save_file'] = 'Enregistrer le fichier';
+$lang['locfiledit_choose_file'] = 'Choisissez un fichier à éditer';
+$lang['locfiledit_edit'] = 'Editer';
+$lang['locfiledit_restore'] = 'Charger le fichier de sauvegarde';
+$lang['locfiledit_restore_confirm'] = 'Souaitez-vous charger le fichier de sauvegarde?\nVous devrez ensuite cliquer sur Enregistrer pour le restaurer.';
+$lang['locfiledit_bak_loaded1'] = 'Fichier de sauvegarde chargé';
+$lang['locfiledit_bak_loaded2'] = 'Vous devez l\'enregistrer pour le sauvegarder.';
+$lang['locfiledit_syntax_error'] = 'Erreur de syntaxe! Impossible d\'enregistrer le fichier.';
+
+?> \ No newline at end of file
diff --git a/plugins/LocalFilesEditor/language/index.php b/plugins/LocalFilesEditor/language/index.php
new file mode 100644
index 000000000..61741e9cb
--- /dev/null
+++ b/plugins/LocalFilesEditor/language/index.php
@@ -0,0 +1,33 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file : $Id$
+// | last update : $Date$
+// | last modifier : $Author$
+// | revision : $Revision$
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
diff --git a/plugins/LocalFilesEditor/main.inc.php b/plugins/LocalFilesEditor/main.inc.php
new file mode 100644
index 000000000..e2dad5f05
--- /dev/null
+++ b/plugins/LocalFilesEditor/main.inc.php
@@ -0,0 +1,47 @@
+<?php
+/*
+Plugin Name: LocalFiles Editor
+Version: 1.0
+Description: Edit local files from administration panel
+Plugin URI: http://www.phpwebgallery.net
+Author: PhpWebGallery team
+Author URI: http://www.phpwebgallery.net
+*/
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file : $Id$
+// | last update : $Date$
+// | last modifier : $Author$
+// | revision : $Revision$
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+define('LOCALEDIT_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
+
+function localfiles_admin_menu($menu)
+{
+ array_push($menu, array('NAME' => 'LocalFiles Editor',
+ 'URL' => get_admin_plugin_menu_link(LOCALEDIT_PATH . 'admin.php')));
+ return $menu;
+}
+
+add_event_handler('get_admin_plugin_menu_links', 'localfiles_admin_menu');
+
+?> \ No newline at end of file
diff --git a/plugins/LocalFilesEditor/show_default.php b/plugins/LocalFilesEditor/show_default.php
new file mode 100644
index 000000000..22e74630b
--- /dev/null
+++ b/plugins/LocalFilesEditor/show_default.php
@@ -0,0 +1,56 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// +-----------------------------------------------------------------------+
+// | file : $Id$
+// | last update : $Date$
+// | last modifier : $Author$
+// | revision : $Revision$
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+define('PHPWG_ROOT_PATH', '../../');
+include_once(PHPWG_ROOT_PATH . 'include/common.inc.php');
+check_status(ACCESS_ADMINISTRATOR);
+
+if (isset($_GET['file']))
+{
+ $path = $_GET['file'];
+ if (!is_admin() or (!substr_count($path, 'config_default.inc.php') and !substr_count($path, '.lang.php')))
+ {
+ die('Hacking attempt!');
+ }
+
+ $template->set_filename('show_default', dirname(__FILE__) . '/show_default.tpl');
+
+ $file = file_get_contents(PHPWG_ROOT_PATH . $path);
+
+ $template->assign(array('DEFAULT_CONTENT' => nl2br($file)));
+
+ $title = $path;
+ $page['page_banner'] = '<h1>'.str_replace('/', ' / ', $path).'</h1>';
+ $page['body_id'] = 'thePopuphelpPage';
+
+ include(PHPWG_ROOT_PATH.'include/page_header.php');
+
+ $template->pparse('show_default');
+
+ include(PHPWG_ROOT_PATH.'include/page_tail.php');
+}
+
+?> \ No newline at end of file
diff --git a/plugins/LocalFilesEditor/show_default.tpl b/plugins/LocalFilesEditor/show_default.tpl
new file mode 100644
index 000000000..c101e351a
--- /dev/null
+++ b/plugins/LocalFilesEditor/show_default.tpl
@@ -0,0 +1,3 @@
+<div id="content" style="font-family:courier;text-align:left;padding:5px;">
+{$DEFAULT_CONTENT}
+</div> <!-- content --> \ No newline at end of file