aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/LocalFilesEditor/include
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/LocalFilesEditor/include')
-rw-r--r--plugins/LocalFilesEditor/include/css.inc.php150
-rw-r--r--plugins/LocalFilesEditor/include/functions.inc.php114
-rw-r--r--plugins/LocalFilesEditor/include/lang.inc.php69
-rw-r--r--plugins/LocalFilesEditor/include/localconf.inc.php26
-rw-r--r--plugins/LocalFilesEditor/include/plug.inc.php25
-rw-r--r--plugins/LocalFilesEditor/include/tpl.inc.php157
6 files changed, 0 insertions, 541 deletions
diff --git a/plugins/LocalFilesEditor/include/css.inc.php b/plugins/LocalFilesEditor/include/css.inc.php
deleted file mode 100644
index 17ea92766..000000000
--- a/plugins/LocalFilesEditor/include/css.inc.php
+++ /dev/null
@@ -1,150 +0,0 @@
-<?php
-if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
-
-include_once(PHPWG_ROOT_PATH.'admin/include/themes.class.php');
-$themes = new themes();
-
-if (isset($_POST['edit']))
-{
- $_POST['theme'] = $_POST['theme_select'];
-}
-
-if (isset($_POST['theme']) and '~common~' == $_POST['theme'])
-{
- $page['theme'] = $_POST['theme'];
- $edited_file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'css/rules.css';
-}
-else
-{
- if (isset($_GET['theme']))
- {
- $page['theme'] = $_GET['theme'];
- }
- elseif (isset($_POST['theme']))
- {
- $page['theme'] = $_POST['theme'];
- }
-
- if (!isset($page['theme']) or !in_array($page['theme'], array_keys($themes->fs_themes)))
- {
- $page['theme'] = get_default_theme();
- }
-
- $edited_file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.$page['theme'].'-rules.css';
-}
-
-$template->assign('theme', $page['theme']);
-
-if (file_exists($edited_file))
-{
- $content_file = file_get_contents($edited_file);
-}
-else
-{
- $content_file = "/* " . l10n('locfiledit_newfile') . " */\n\n";
-}
-
-$selected = 0;
-$value = '~common~';
-$file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/rules.css';
-
-$options[$value] = (file_exists($file) ? '&#x2714;' : '&#x2718;').' local / css / rules.css';
-if ($page['theme'] == $value)
-{
- $selected = $value;
-}
-
-// themes are displayed in the same order as on screen
-// [Administration > Configuration > Themes]
-
-$themes->sort_fs_themes();
-$default_theme = get_default_theme();
-$db_themes = $themes->get_db_themes();
-
-$db_theme_ids = array();
-foreach ($db_themes as $db_theme)
-{
- $db_theme_ids[] = $db_theme['id'];
-}
-
-$active_themes = array();
-$inactive_themes = array();
-
-foreach ($themes->fs_themes as $theme_id => $fs_theme)
-{
- if ($theme_id == 'default')
- {
- continue;
- }
-
- if (in_array($theme_id, $db_theme_ids))
- {
- if ($theme_id == $default_theme)
- {
- array_unshift($active_themes, $fs_theme);
- }
- else
- {
- $active_themes[] = $fs_theme;
- }
- }
- else
- {
- $inactive_themes[] = $fs_theme;
- }
-}
-
-$active_theme_options = array();
-foreach ($active_themes as $theme)
-{
- $file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.$theme['id'].'-rules.css';
-
- $label = (file_exists($file) ? '&#x2714;' : '&#x2718;').' '.$theme['name'];
-
- if ($default_theme == $theme['id'])
- {
- $label.= ' ('.l10n('default').')';
- }
-
- $active_theme_options[$theme['id']] = $label;
-
- if ($theme['id'] == $page['theme'])
- {
- $selected = $theme['id'];
- }
-}
-
-if (count($active_theme_options) > 0)
-{
- $options[l10n('Active Themes')] = $active_theme_options;
-}
-
-$inactive_theme_options = array();
-foreach ($inactive_themes as $theme)
-{
- $file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.$theme['id'].'-rules.css';
-
- $inactive_theme_options[$theme['id']] = (file_exists($file) ? '&#x2714;' : '&#x2718;').' '.$theme['name'];
-
- if ($theme['id'] == $page['theme'])
- {
- $selected = $theme['id'];
- }
-}
-
-if (count($inactive_theme_options) > 0)
-{
- $options[l10n('Inactive Themes')] = $inactive_theme_options;
-}
-
-$template->assign(
- 'css_lang_tpl',
- array(
- 'SELECT_NAME' => 'theme_select',
- 'OPTIONS' => $options,
- 'SELECTED' => $selected
- )
-);
-
-$codemirror_mode = 'text/css';
-?> \ No newline at end of file
diff --git a/plugins/LocalFilesEditor/include/functions.inc.php b/plugins/LocalFilesEditor/include/functions.inc.php
deleted file mode 100644
index 46906225d..000000000
--- a/plugins/LocalFilesEditor/include/functions.inc.php
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
-// +-----------------------------------------------------------------------+
-// | Piwigo - a PHP based photo gallery |
-// +-----------------------------------------------------------------------+
-// | Copyright(C) 2008-2014 Piwigo Team http://piwigo.org |
-// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
-// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
-// +-----------------------------------------------------------------------+
-// | 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. |
-// +-----------------------------------------------------------------------+
-
-/**
- * returns $code if php syntax is correct
- * else return false
- *
- * @param string php code
- */
-function eval_syntax($code)
-{
- $code = str_replace(array('<?php', '?>'), '', $code);
- if (function_exists('token_get_all'))
- {
- $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;
- }
- }
- return '<?php' . $code . '?>';
-}
-
-/**
- * returns true or false if $str is bool
- * returns $str if $str is integer
- * else "$str"
- *
- * @param string
- */
-function editarea_quote($value)
-{
- switch (gettype($value))
- {
- case "boolean":
- return $value ? 'true' : 'false';
- case "integer":
- return $value;
- default:
- return '"'.$value.'"';
- }
-}
-
-/**
- * returns bak file for restore
- * @param string
- */
-function get_bak_file($file)
-{
- if (get_extension($file) == 'php')
- {
- return substr_replace($file, '.bak', strrpos($file , '.'), 0);
- }
- else
- {
- return $file . '.bak';
- }
-}
-
-/**
- * returns dirs and subdirs
- * retun array
- * @param string
- */
-function get_rec_dirs($path='')
-{
- $options = array();
- if (is_dir($path))
- {
- $fh = opendir($path);
- while ($file = readdir($fh))
- {
- $pathfile = $path . '/' . $file;
- if ($file != '.' and $file != '..' and $file != '.svn' and is_dir($pathfile))
- {
- $options[$pathfile] = str_replace(array('./', '/'), array('', ' / '), $pathfile);
- $options = array_merge($options, get_rec_dirs($pathfile));
- }
- }
- closedir($fh);
- }
- return $options;
-}
-
-?> \ No newline at end of file
diff --git a/plugins/LocalFilesEditor/include/lang.inc.php b/plugins/LocalFilesEditor/include/lang.inc.php
deleted file mode 100644
index e32a26c49..000000000
--- a/plugins/LocalFilesEditor/include/lang.inc.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
-
-$languages = get_languages();
-
-if (isset($_POST['edit']))
-{
- $_POST['language'] = $_POST['language_select'];
-}
-
-if (isset($_POST['language']))
-{
- $page['language'] = $_POST['language'];
-}
-
-if (!isset($page['language']) or !in_array($page['language'], array_keys($languages)))
-{
- $page['language'] = get_default_language();
-}
-
-$template->assign('language', $page['language']);
-
-$edited_file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'language/'.$page['language'].'.lang.php';;
-
-if (file_exists($edited_file))
-{
- $content_file = file_get_contents($edited_file);
-}
-else
-{
- $content_file = "<?php\n\n/* ".l10n('locfiledit_newfile')." */\n\n\n\n\n?>";
-}
-
-$selected = 0;
-foreach (get_languages() as $language_code => $language_name)
-{
- $file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'language/'.$language_code.'.lang.php';
-
- $options[$language_code] = (file_exists($file) ? '&#x2714;' : '&#x2718;').' '.$language_name;
-
- if ($page['language'] == $language_code)
- {
- $selected = $language_code;
- $template->assign('show_default', array(
- array(
- 'URL' => LOCALEDIT_PATH.'show_default.php?file=language/'.$language_code.'/common.lang.php',
- 'FILE' => 'common.lang.php'
- ),
- array(
- 'URL' => LOCALEDIT_PATH.'show_default.php?file=language/'.$language_code.'/admin.lang.php',
- 'FILE' => 'admin.lang.php'
- )
- )
- );
- }
-}
-
-$template->assign(
- 'css_lang_tpl',
- array(
- 'SELECT_NAME' => 'language_select',
- 'OPTIONS' => $options,
- 'SELECTED' => $selected
- )
- );
-
-$codemirror_mode = 'application/x-httpd-php';
-
-?> \ No newline at end of file
diff --git a/plugins/LocalFilesEditor/include/localconf.inc.php b/plugins/LocalFilesEditor/include/localconf.inc.php
deleted file mode 100644
index b801db236..000000000
--- a/plugins/LocalFilesEditor/include/localconf.inc.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
-
-$edited_file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . "config/config.inc.php";
-
-if (file_exists($edited_file))
-{
- $content_file = file_get_contents($edited_file);
-}
-else
-{
- $content_file = "<?php\n\n/* ".l10n('locfiledit_newfile')." */\n\n\n\n\n?>";
-}
-
-$template->assign('show_default', array(
- array(
- 'URL' => LOCALEDIT_PATH.'show_default.php?file=include/config_default.inc.php',
- 'FILE' => 'config_default.inc.php'
- )
- )
-);
-
-$codemirror_mode = 'application/x-httpd-php';
-
-?> \ No newline at end of file
diff --git a/plugins/LocalFilesEditor/include/plug.inc.php b/plugins/LocalFilesEditor/include/plug.inc.php
deleted file mode 100644
index 55c4b2dde..000000000
--- a/plugins/LocalFilesEditor/include/plug.inc.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
-
-$edited_file = PHPWG_PLUGINS_PATH . "PersonalPlugin/main.inc.php";
-
-if (file_exists($edited_file))
-{
- $content_file = file_get_contents($edited_file);
-}
-else
-{
- $content_file = "<?php\n/*
-Plugin Name: " . l10n('locfiledit_onglet_plug') . "
-Version: 1.0
-Description: " . l10n('locfiledit_onglet_plug') . "
-Plugin URI: http://piwigo.org
-Author:
-Author URI:
-*/\n\n\n\n\n?>";
-}
-
-$codemirror_mode = 'application/x-httpd-php';
-
-?> \ No newline at end of file
diff --git a/plugins/LocalFilesEditor/include/tpl.inc.php b/plugins/LocalFilesEditor/include/tpl.inc.php
deleted file mode 100644
index c1079a8e7..000000000
--- a/plugins/LocalFilesEditor/include/tpl.inc.php
+++ /dev/null
@@ -1,157 +0,0 @@
-<?php
-if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
-
-$edited_file = '';
-
-if (isset($_POST['edit']))
-{
- $_POST['template'] = $_POST['file_to_edit'];
-}
-
-if (!empty($_POST['template']))
-{
- if (preg_match('#\.\./#', $_POST['template']))
- {
- die('Hacking attempt! template extension must be in template-extension directory');
- }
-
- if (!preg_match('#\.tpl$#', $_POST['template']))
- {
- die('Hacking attempt! template extension must be a *.tpl file');
- }
-
- $template->assign('template', $_POST['template']);
-
- $edited_file = './template-extension/'.$_POST['template'];
-}
-
-$content_file = '';
-if (file_exists($edited_file))
-{
- $content_file = file_get_contents($edited_file);
-}
-
-$newfile_page = isset($_GET['newfile']);
-
-// Edit new tpl file
-if (isset($_POST['create_tpl']))
-{
- $filename = $_POST['tpl_name'];
- if (empty($filename))
- {
- $page['errors'][] = l10n('locfiledit_empty_filename');
- }
- if (get_extension($filename) != 'tpl')
- {
- $filename .= '.tpl';
- }
- if (!preg_match('/^[a-zA-Z0-9-_.]+$/', $filename))
- {
- $page['errors'][] = l10n('locfiledit_filename_error');
- }
- if (is_numeric($_POST['tpl_model']) and $_POST['tpl_model'] != '0')
- {
- $page['errors'][] = l10n('locfiledit_model_error');
- }
- if (file_exists($_POST['tpl_parent'] . '/' . $filename))
- {
- $page['errors'][] = l10n('locfiledit_file_already_exists');
- }
- if (!empty($page['errors']))
- {
- $newfile_page = true;
- }
- else
- {
- $template->assign('template', $filename);
- $edited_file = $_POST['tpl_parent'] . '/' . $filename;
- $content_file = ($_POST['tpl_model'] == '0') ? '' : file_get_contents($_POST['tpl_model']);
- }
-}
-
-if ($newfile_page)
-{
- $filename = isset($_POST['tpl_name']) ? $_POST['tpl_name'] : '';
- $selected['model'] = isset($_POST['tpl_model']) ? $_POST['tpl_model'] : '0';
- $selected['parent'] = isset($_POST['tpl_parent']) ? $_POST['tpl_parent'] : PHPWG_ROOT_PATH . 'template-extension';
-
- // Parent directories list
- $options['parent'] = array(PHPWG_ROOT_PATH . 'template-extension' => 'template-extension');
- $options['parent'] = array_merge($options['parent'], get_rec_dirs(PHPWG_ROOT_PATH . 'template-extension'));
-
- $options['model'][] = l10n('locfiledit_empty_page');
- $options['model'][] = '----------------------';
- $i = 0;
- foreach (get_extents() as $pwg_template)
- {
- $value = PHPWG_ROOT_PATH . 'template-extension/' . $pwg_template;
- $options['model'][$value] = 'template-extension / ' . str_replace('/', ' / ', $pwg_template);
- $i++;
- }
- foreach (get_dirs($conf['themes_dir']) as $theme_id)
- {
- if ($i)
- {
- $options['model'][] = '----------------------';
- $i = 0;
- }
- $dir = $conf['themes_dir'] . '/' . $theme_id . '/template/';
- if (is_dir($dir) and $content = opendir($dir))
- {
- while ($node = readdir($content))
- {
- if (is_file($dir.$node) and get_extension($node) == 'tpl')
- {
- $value = $dir . $node;
- $options['model'][$value] = $theme_id . ' / ' . $node;
- $i++;
- }
- }
- }
- }
- if (end($options['model']) == '----------------------')
- {
- array_pop($options['model']);
- }
- // Assign variables to template
- $template->assign('create_tpl', array(
- 'NEW_FILE_NAME' => $filename,
- 'MODEL_OPTIONS' => $options['model'],
- 'MODEL_SELECTED' => $selected['model'],
- 'PARENT_OPTIONS' => $options['parent'],
- 'PARENT_SELECTED' => $selected['parent']
- )
- );
-}
-else
-{
- // List existing template extensions
- $selected = 0;
- $options[] = l10n('locfiledit_choose_file');
- $options[] = '----------------------';
- foreach (get_extents() as $pwg_template)
- {
- $value = $pwg_template;
- $options[$value] = str_replace('/', ' / ', $pwg_template);
- if ($edited_file == $value) $selected = $value;
- }
- if ($selected == 0 and !empty($edited_file))
- {
- $options[$edited_file] = str_replace(array('./template-extension/', '/'), array('', ' / '), $edited_file);
- $selected = $edited_file;
- }
- $template->assign(
- 'css_lang_tpl',
- array(
- 'SELECT_NAME' => 'file_to_edit',
- 'OPTIONS' => $options,
- 'SELECTED' => $selected,
- 'NEW_FILE_URL' => $my_base_url.'-tpl&amp;newfile',
- 'NEW_FILE_CLASS' => empty($edited_file) ? '' : 'top_right'
- )
- );
-}
-
-$codemirror_mode = 'text/html';
-
-?> \ No newline at end of file