diff --git a/oss/joomla/trunk/plugins/editors/xstandard/attachmentlibrary.php b/oss/joomla/trunk/plugins/editors/xstandard/attachmentlibrary.php new file mode 100644 index 00000000..f95ed369 --- /dev/null +++ b/oss/joomla/trunk/plugins/editors/xstandard/attachmentlibrary.php @@ -0,0 +1,322 @@ + 0 and strlen($n) > 0) { + if (substr($p, strlen($p) - 1, 1) == "/") { + $return = $p . $n; + } else { + $return = $p . "/" . $n; + } + } else { + $return = $p . $n; + } + + //make sure return is above $path + $realreturn = realpath($return); + $realpath = realpath($path); + if(strpos($realreturn, $realpath) !== 0) { + //the returned path does not start with the given path. Default to path + return $realpath; + } else { + return $realreturn; + } +} + +function xs_is_accepted_file_type($file_name) { + $pos = strrpos($file_name, "."); + $ext = ""; + if ($pos !== false) { + $ext = strtolower(substr($file_name, $pos + 1)); + } + + $accepted_file_types = explode(" ", strtolower(XS_ACCEPTED_FILE_TYPES)); + foreach ($accepted_file_types as $accepted_file_type) { + if ($accepted_file_type == $ext or $accepted_file_type == "*") { + return true; + } + } + + return false; +} + + +function xs_xhtml_escape($text) { + return str_replace(array("&", "<", ">", "\""), array("&", "<", ">", """), $text); +} + +function xs_urlencode($text) { + $parts = explode("/", $text); + $count = count($parts); + + for($i = 0; $i < $count; $i++) { + $parts[$i] = str_replace("+", "%20", urlencode($parts[$i])); + } + + return implode("/", $parts); +} + + + +//Process request +$rootFolderPath = ""; +$rootFilePath = ""; + +//Get sub-folder to browse +if (isset($_SERVER["HTTP_X_CMS_LIBRARY_PATH"])) { + if ($_SERVER["HTTP_X_CMS_LIBRARY_PATH"] == "") { + $rootFolderPath = XS_LIBRARY_FOLDER; + $rootFilePath = XS_LIBRARY_FOLDER; + } else { + $rootFolderPath = xs_build_path(XS_LIBRARY_FOLDER, $_SERVER["HTTP_X_CMS_LIBRARY_PATH"]); + $rootFilePath = xs_build_path(XS_LIBRARY_FOLDER, $_SERVER["HTTP_X_CMS_LIBRARY_PATH"]); + } +} else { + $rootFolderPath = XS_LIBRARY_FOLDER; + $rootFilePath = XS_LIBRARY_FOLDER; +} + + +$hidden_folders = explode(",", XS_HIDDEN_FOLDERS); +$hidden_files = explode(",", XS_HIDDEN_FILES); + + + +// Respond +if (get_magic_quotes_runtime() != 0) { + set_magic_quotes_runtime(0); +} + +header("Content-Type: text/xml"); +echo ""; +echo ""; + echo ""; + // Process folders + $folder_list = array(); + if (file_exists($rootFolderPath)) { + if (false !== ($handle = @opendir($rootFolderPath))) { + while (false !== ($fs_object = readdir($handle))) { + if ($fs_object != "." && $fs_object != "..") { + $found = false; + foreach($hidden_folders as $hidden_folder) { + if(strtolower($fs_object) == strtolower(trim($hidden_folder))) { + $found = true; + } + } + + if (is_dir(xs_build_path($rootFolderPath, $fs_object))) { + if ($found === false) { + $folder_list[] = $fs_object; + } + } + } + } + closedir($handle); + } + } + natcasesort($folder_list); + reset($folder_list); + foreach ($folder_list as $key => $fs_object) { + echo ""; + //Folder name + echo "" . xs_xhtml_escape($fs_object) . ""; + + //Path to parent folder + echo ""; + if (isset($_SERVER["HTTP_X_CMS_LIBRARY_PATH"])) { + if ($_SERVER["HTTP_X_CMS_LIBRARY_PATH"] != "") { + echo xs_xhtml_escape($_SERVER["HTTP_X_CMS_LIBRARY_PATH"]); + } + } + echo ""; + + //Display label + echo ""; + + //Base URL to this folder + echo ""; + $temp = $fs_object; + + if (isset($_SERVER["HTTP_X_CMS_LIBRARY_PATH"])) { + if ($_SERVER["HTTP_X_CMS_LIBRARY_PATH"] != "") { + $temp = $_SERVER["HTTP_X_CMS_LIBRARY_PATH"] . "/" . $fs_object; + } + } + + $url = xs_build_path(XS_BASE_URL, xs_urlencode($temp)) . "/"; + + echo $url; + echo ""; + + //Is folder empty (not implemented yet) + echo "false"; + + //Icon ID defined in icons.xml + echo "folder"; + + //Reserved for future use + echo ""; + + //Reserved for future use + echo "0"; + echo ""; + } + echo ""; + echo ""; + // Process files + $file_list = array(); + if (file_exists($rootFilePath)) { + if (false !== ($handle = @opendir($rootFilePath))) { + while (false !== ($fs_object = readdir($handle))) { + if ($fs_object != "." && $fs_object != "..") { + $found = false; + foreach($hidden_files as $hidden_file) { + if(strtolower($fs_object) == strtolower(trim($hidden_file))) { + $found = true; + } + } + + if (is_file(xs_build_path($rootFilePath, $fs_object))) { + if (xs_is_accepted_file_type($fs_object)) { + if ($found === false) { + $file_list[] = $fs_object; + } + } + } + } + } + closedir($handle); + } + } + natcasesort($file_list); + reset($file_list); + foreach ($file_list as $key => $fs_object) { + echo ""; + //Folder name + echo "" . xs_xhtml_escape($fs_object) . ""; + + //Path to parent folder + echo ""; + if (isset($_SERVER["HTTP_X_CMS_LIBRARY_PATH"])) { + if ($_SERVER["HTTP_X_CMS_LIBRARY_PATH"] != "") { + echo xs_xhtml_escape($_SERVER["HTTP_X_CMS_LIBRARY_PATH"]); + } + } + echo ""; + + //Display label + echo ""; + + //Icon ID defined in icons.xml + echo "document"; + + //Reserved for future use + echo ""; + + //Reserved for future use + echo "0"; + + //Attributes + echo ""; + //src attribute + echo ""; + echo "href"; + echo ""; + if (isset($_SERVER["HTTP_X_CMS_LIBRARY_PATH"])) { + if ($_SERVER["HTTP_X_CMS_LIBRARY_PATH"] == "") { + echo xs_build_path(XS_BASE_URL, xs_urlencode($fs_object)); + } else { + echo xs_build_path(xs_build_path(XS_BASE_URL, $_SERVER["HTTP_X_CMS_LIBRARY_PATH"]), xs_urlencode($fs_object)); + } + } else { + echo xs_build_path(XS_BASE_URL, xs_urlencode($fs_object)); + } + echo ""; + echo ""; + echo ""; + + //Properties + echo ""; + //File size + if (XS_GET_FILE_SIZE) { + echo ""; + echo "size"; + echo "" . filesize(xs_build_path($rootFilePath, $fs_object)) . ""; + echo ""; + } + + //Last modified date + if (XS_GET_DATE_LAST_MODIFIED) { + echo ""; + echo "date"; + echo "" . date("Y-m-d H:i:s", filemtime(xs_build_path($rootFilePath, $fs_object))) . ""; + echo ""; + } + echo ""; + echo ""; + } + echo ""; +echo ""; +?> diff --git a/oss/joomla/trunk/plugins/editors/xstandard/cms-directory-xhtml-entities.xml b/oss/joomla/trunk/plugins/editors/xstandard/cms-directory-xhtml-entities.xml new file mode 100644 index 00000000..c640c7f5 Binary files /dev/null and b/oss/joomla/trunk/plugins/editors/xstandard/cms-directory-xhtml-entities.xml differ diff --git a/oss/joomla/trunk/plugins/editors/xstandard/cms-directory-xhtml-latin1.xml b/oss/joomla/trunk/plugins/editors/xstandard/cms-directory-xhtml-latin1.xml new file mode 100644 index 00000000..a3a80bb6 Binary files /dev/null and b/oss/joomla/trunk/plugins/editors/xstandard/cms-directory-xhtml-latin1.xml differ diff --git a/oss/joomla/trunk/plugins/editors/xstandard/cms-directory-xhtml-special.xml b/oss/joomla/trunk/plugins/editors/xstandard/cms-directory-xhtml-special.xml new file mode 100644 index 00000000..67e5ee48 Binary files /dev/null and b/oss/joomla/trunk/plugins/editors/xstandard/cms-directory-xhtml-special.xml differ diff --git a/oss/joomla/trunk/plugins/editors/xstandard/cms-directory-xhtml-symbol.xml b/oss/joomla/trunk/plugins/editors/xstandard/cms-directory-xhtml-symbol.xml new file mode 100644 index 00000000..022b3b75 Binary files /dev/null and b/oss/joomla/trunk/plugins/editors/xstandard/cms-directory-xhtml-symbol.xml differ diff --git a/oss/joomla/trunk/plugins/editors/xstandard/directory.php b/oss/joomla/trunk/plugins/editors/xstandard/directory.php new file mode 100644 index 00000000..bf35d1f2 --- /dev/null +++ b/oss/joomla/trunk/plugins/editors/xstandard/directory.php @@ -0,0 +1,169 @@ +", "\""), array("&", "<", ">", """), $text); +} + +function read_from_file($path) { + return @file_get_contents($path); +} + + + +//Process request +$id = ""; +$metadata = ""; + +if (isset($_SERVER["HTTP_X_CMS_DIRECTORY_ID"])) { + $id = $_SERVER["HTTP_X_CMS_DIRECTORY_ID"]; +} + +if (isset($_SERVER["HTTP_X_CMS_DIRECTORY_METADATA"])) { + $metadata = $_SERVER["HTTP_X_CMS_DIRECTORY_METADATA"]; +} + + +// Respond +if (get_magic_quotes_runtime() != 0) { + set_magic_quotes_runtime(0); +} + +header("Content-Type: text/xml"); +echo ""; +echo ""; + echo ""; + // Process folders + if ($id == "") { + echo (""); + echo (""); + echo ("a"); + echo (""); + echo (""); + echo (""); + echo (""); + echo (""); + echo (""); + echo ("c"); + echo (""); + echo ("cms-directory-xhtml-entities.xml"); + echo (""); + echo (""); + /*echo (""); + echo (""); + echo ("d"); + echo (""); + echo (""); + echo ("flag"); + echo ("");*/ + } + /*echo (""); + echo (""); + echo ("".xs_xhtml_escape('
')."
"); + echo ("pagebreak"); + echo ("
"); + echo (""); + echo (""); + echo ("".xs_xhtml_escape('
')."
"); + echo ("readmore"); + echo ("
");*/ + echo ("
"); + echo (""); + + // Process items + if ($id == "a") + { + echo (""); + echo (""); + echo ("test"); + echo ("test"); + echo (""); + } + else if ($id == "b") + { + //This is an example of how to read XHTML from a file. + echo (""); + echo (""); + echo ("" . xs_xhtml_escape(read_from_file("cms-directory-example-product-1.txt")) . ""); + echo (""); + echo (""); + + echo (""); + echo (""); + echo ("" . xs_xhtml_escape(read_from_file("cms-directory-example-product-2.txt")) . ""); + echo (""); + echo (""); + + echo (""); + echo (""); + echo ("" . xs_xhtml_escape(read_from_file("cms-directory-example-product-3.txt")) . ""); + echo (""); + echo (""); + + echo (""); + echo (""); + echo ("" . xs_xhtml_escape(read_from_file("cms-directory-example-product-4.txt")) . ""); + echo (""); + echo (""); + } + else if ($id == "d") + { + //This is an example of how create XHTML on the fly. + echo (""); + echo (""); + echo ("<p>The current temperature in Vancouver is <temperature location="Vancouver, BC, Canada" title="Placeholder for temperature."/>.</p>"); + echo ("thermometer"); + echo (""); + echo (""); + echo (""); + echo ("<p>The current stock price for IBM is <stock symbol="IBM" exchange="NYSE" title="Placeholder for stock price." />.</p>"); + echo ("certificate"); + echo (""); + } + echo ""; +echo "
"; +?> diff --git a/oss/joomla/trunk/plugins/editors/xstandard/imagelibrary.php b/oss/joomla/trunk/plugins/editors/xstandard/imagelibrary.php new file mode 100644 index 00000000..8e3a0466 --- /dev/null +++ b/oss/joomla/trunk/plugins/editors/xstandard/imagelibrary.php @@ -0,0 +1,356 @@ + 0 and strlen($n) > 0) { + if (substr($p, strlen($p) - 1, 1) == "/") { + $return = $p . $n; + } else { + $return = $p . "/" . $n; + } + } else { + $return = $p . $n; + } + + //make sure return is above $path + $realreturn = realpath($return); + $realpath = realpath($path); + if(strpos($realreturn, $realpath) !== 0) { + //the returned path does not start with the given path. Default to path + return $realpath; + } else { + return $realreturn; + } +} + +function xs_is_accepted_file_type($file_name) { + $pos = strrpos($file_name, "."); + $ext = ""; + if ($pos !== false) { + $ext = strtolower(substr($file_name, $pos + 1)); + } + + $accepted_file_types = explode(" ", strtolower(XS_ACCEPTED_FILE_TYPES)); + foreach ($accepted_file_types as $accepted_file_type) { + if ($accepted_file_type == $ext or $accepted_file_type == "*") { + return true; + } + } + + return false; +} + + +function xs_xhtml_escape($text) { + return str_replace(array("&", "<", ">", "\""), array("&", "<", ">", """), $text); +} + +function xs_urlencode($text) { + $parts = explode("/", $text); + $count = count($parts); + + for($i = 0; $i < $count; $i++) { + $parts[$i] = str_replace("+", "%20", urlencode($parts[$i])); + } + + return implode("/", $parts); +} + + + +//Process request +$rootFolderPath = ""; +$rootFilePath = ""; + +//Get sub-folder to browse +if (isset($_SERVER["HTTP_X_CMS_LIBRARY_PATH"])) { + if ($_SERVER["HTTP_X_CMS_LIBRARY_PATH"] == "") { + $rootFolderPath = XS_LIBRARY_FOLDER; + $rootFilePath = XS_LIBRARY_FOLDER; + } else { + $rootFolderPath = xs_build_path(XS_LIBRARY_FOLDER, $_SERVER["HTTP_X_CMS_LIBRARY_PATH"]); + $rootFilePath = xs_build_path(XS_LIBRARY_FOLDER, $_SERVER["HTTP_X_CMS_LIBRARY_PATH"]); + } +} else { + $rootFolderPath = XS_LIBRARY_FOLDER; + $rootFilePath = XS_LIBRARY_FOLDER; +} + + +$hidden_folders = explode(",", XS_HIDDEN_FOLDERS); +$hidden_files = explode(",", XS_HIDDEN_FILES); + + + +// Respond +if (get_magic_quotes_runtime() != 0) { + set_magic_quotes_runtime(0); +} + +header("Content-Type: text/xml"); +echo ""; +echo ""; + echo ""; + // Process folders + $folder_list = array(); + if (file_exists($rootFolderPath)) { + if (false !== ($handle = @opendir($rootFolderPath))) { + while (false !== ($fs_object = readdir($handle))) { + if ($fs_object != "." && $fs_object != "..") { + $found = false; + foreach($hidden_folders as $hidden_folder) { + if(strtolower($fs_object) == strtolower(trim($hidden_folder))) { + $found = true; + } + } + + if (is_dir(xs_build_path($rootFolderPath, $fs_object))) { + if ($found === false) { + $folder_list[] = $fs_object; + } + } + } + } + closedir($handle); + } + } + natcasesort($folder_list); + reset($folder_list); + foreach ($folder_list as $key => $fs_object) { + echo ""; + //Folder name + echo "" . xs_xhtml_escape($fs_object) . ""; + + //Path to parent folder + echo ""; + if (isset($_SERVER["HTTP_X_CMS_LIBRARY_PATH"])) { + if ($_SERVER["HTTP_X_CMS_LIBRARY_PATH"] != "") { + echo xs_xhtml_escape($_SERVER["HTTP_X_CMS_LIBRARY_PATH"]); + } + } + echo ""; + + //Display label + echo ""; + + //Base URL to this folder + echo ""; + $temp = $fs_object; + + if (isset($_SERVER["HTTP_X_CMS_LIBRARY_PATH"])) { + if ($_SERVER["HTTP_X_CMS_LIBRARY_PATH"] != "") { + $temp = $_SERVER["HTTP_X_CMS_LIBRARY_PATH"] . "/" . $fs_object; + } + } + + $url = xs_build_path(XS_BASE_URL, xs_urlencode($temp)) . "/"; + + echo $url; + echo ""; + + //Is folder empty (not implemented yet) + echo "false"; + + //Icon ID defined in icons.xml + echo "folder"; + + //Reserved for future use + echo ""; + + //Reserved for future use + echo "0"; + echo ""; + } + echo ""; + echo ""; + // Process files + $file_list = array(); + if (file_exists($rootFilePath)) { + if (false !== ($handle = @opendir($rootFilePath))) { + while (false !== ($fs_object = readdir($handle))) { + if ($fs_object != "." && $fs_object != "..") { + $found = false; + foreach($hidden_files as $hidden_file) { + if(strtolower($fs_object) == strtolower(trim($hidden_file))) { + $found = true; + } + } + + if (is_file(xs_build_path($rootFilePath, $fs_object))) { + if (xs_is_accepted_file_type($fs_object)) { + if ($found === false) { + $file_list[] = $fs_object; + } + } + } + } + } + closedir($handle); + } + } + natcasesort($file_list); + reset($file_list); + foreach ($file_list as $key => $fs_object) { + echo ""; + //Folder name + echo "" . xs_xhtml_escape($fs_object) . ""; + + //Path to parent folder + echo ""; + if (isset($_SERVER["HTTP_X_CMS_LIBRARY_PATH"])) { + if ($_SERVER["HTTP_X_CMS_LIBRARY_PATH"] != "") { + echo xs_xhtml_escape($_SERVER["HTTP_X_CMS_LIBRARY_PATH"]); + } + } + echo ""; + + //Display label + echo ""; + + //Icon ID defined in icons.xml + echo "image"; + + //Reserved for future use + echo ""; + + //Reserved for future use + echo "0"; + + //Attributes + echo ""; + //src attribute + echo ""; + echo "src"; + echo ""; + if (isset($_SERVER["HTTP_X_CMS_LIBRARY_PATH"])) { + if ($_SERVER["HTTP_X_CMS_LIBRARY_PATH"] == "") { + echo xs_build_path(XS_BASE_URL, xs_urlencode($fs_object)); + } else { + echo xs_build_path(xs_build_path(XS_BASE_URL, $_SERVER["HTTP_X_CMS_LIBRARY_PATH"]), xs_urlencode($fs_object)); + } + } else { + echo xs_build_path(XS_BASE_URL, xs_urlencode($fs_object)); + } + echo ""; + echo ""; + + //Image dimensions + if (XS_GET_IMAGE_DIMENSIONS) { + if (false === (list($width, $height) = @getimagesize(xs_build_path($rootFilePath, $fs_object)))) { + + } else { + //Width + echo ""; + echo "width"; + echo "" . $width . ""; + echo ""; + + //Height + echo ""; + echo "height"; + echo "" . $height . ""; + echo ""; + } + + } + echo ""; + + //Properties + echo ""; + //File size + if (XS_GET_FILE_SIZE) { + echo ""; + echo "size"; + echo "" . filesize(xs_build_path($rootFilePath, $fs_object)) . ""; + echo ""; + } + + //Last modified date + if (XS_GET_DATE_LAST_MODIFIED) { + echo ""; + echo "date"; + echo "" . date("Y-m-d H:i:s", filemtime(xs_build_path($rootFilePath, $fs_object))) . ""; + echo ""; + } + + //Decorative image flag + echo ""; + echo "decorative"; + echo ""; + if (XS_DEFAULT_IMAGE_IS_DECORATIVE) { + echo "true"; + } else { + echo "false"; + } + echo ""; + echo ""; + echo ""; + echo ""; + } + echo ""; +echo ""; +?> diff --git a/oss/joomla/trunk/plugins/editors/xstandard/index.html b/oss/joomla/trunk/plugins/editors/xstandard/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/oss/joomla/trunk/plugins/editors/xstandard/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/oss/joomla/trunk/plugins/editors/xstandard/preview.xsl b/oss/joomla/trunk/plugins/editors/xstandard/preview.xsl new file mode 100644 index 00000000..0b0a95b5 Binary files /dev/null and b/oss/joomla/trunk/plugins/editors/xstandard/preview.xsl differ diff --git a/oss/joomla/trunk/plugins/editors/xstandard/xstandard.js b/oss/joomla/trunk/plugins/editors/xstandard/xstandard.js new file mode 100644 index 00000000..e90789ee --- /dev/null +++ b/oss/joomla/trunk/plugins/editors/xstandard/xstandard.js @@ -0,0 +1,49 @@ +/** + * @version $Id: xstandard.js 10714 2008-08-21 10:10:14Z eddieajau $ + * @package Joomla + * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. + * @license GNU/GPL, see LICENSE.php + * Joomla! is free software. This version may have been modified pursuant + * to the GNU General Public License, and as distributed it includes or + * is derivative of works licensed under the GNU General Public License or + * other free or open source software licenses. + * See COPYRIGHT.php for copyright notices and details. + */ + +/** + * JXStandard javascript behavior + * + * @package Joomla + * @since 1.5 + * @version 1.0 + */ +var JXStandard = new Class({ + + instances : null, + + initialize: function() + { + this.instances = $ES('object[type=application/x-xstandard]'); + + var self = this; + document.adminForm.onsubmit = function() { + self.save(); + } + }, + + save: function() + { + this.instances.each(function(instance) + { + instance.EscapeUnicode = false; + var contents = instance.value; + $(instance.className).value = contents; + }); + } +}) + +document.xstandard = null +window.addEvent('domready', function(){ + var xstandard = new JXStandard(); + document.xstandard = xstandard; +}); \ No newline at end of file