From: <re...@us...> - 2007-09-21 10:01:30
|
Revision: 566 http://sciret.svn.sourceforge.net/sciret/?rev=566&view=rev Author: reinerj Date: 2007-09-21 03:01:29 -0700 (Fri, 21 Sep 2007) Log Message: ----------- some files was missing Added Paths: ----------- trunk/actions/ArticleToPdf.php trunk/actions/HideCategory.php trunk/actions/ShowCategory.php trunk/docs/sciret-install-OpenBSD-EN-images.html trunk/fckeditor/editor/_source/internals/fckundo.js trunk/fckeditor/editor/filemanager/connectors/ trunk/fckeditor/editor/filemanager/connectors/php/ trunk/fckeditor/editor/filemanager/connectors/php/basexml.php trunk/fckeditor/editor/filemanager/connectors/php/commands.php trunk/fckeditor/editor/filemanager/connectors/php/config.php trunk/fckeditor/editor/filemanager/connectors/php/connector.php trunk/fckeditor/editor/filemanager/connectors/php/io.php trunk/fckeditor/editor/filemanager/connectors/php/upload.php trunk/fckeditor/editor/filemanager/connectors/php/util.php trunk/fckeditor/editor/filemanager/connectors/test.html trunk/fckeditor/editor/filemanager/connectors/uploadtest.html trunk/fckeditor/editor/plugins/dragresizetable/ trunk/fckeditor/editor/plugins/dragresizetable/fckplugin.js trunk/images/file_pdf.gif trunk/images/question.png trunk/setup/upgrade_1.2.0.sql Added: trunk/actions/ArticleToPdf.php =================================================================== --- trunk/actions/ArticleToPdf.php (rev 0) +++ trunk/actions/ArticleToPdf.php 2007-09-21 10:01:29 UTC (rev 566) @@ -0,0 +1,44 @@ +<?php + +require_once 'actions/Action.php'; +require_once 'models/Article.php'; +require_once 'tcpdf/tcpdf.php'; + +class ArticleToPdf extends Action { + + function dispatch() { + + $article = new Article($_GET['artId']); + if (!$article->getId()) { + die($this->user->lang('Error: article does not exist')); + } + if ($this->user->isAnonymous() && !$article->isPublished()) { + die($this->user->lang('Error: this article hasn\'t yet been published')); + } + + $name = $this->user->lang('article_').$article->getId(); + + set_time_limit(0); + + $pdf = new TCPDF('P', 'mm', 'A4', true); + $pdf->setHeaderFont(Array('freeserif', '', 10)); + $pdf->setFooterFont(Array('freeserif', '', 8)); + $pdf->AliasNbPages(); + $pdf->AddPage(); + $pdf->writeHTML($article->getContent(), true, 0); + $output = $pdf->Output($name, 'S'); + + if (ob_get_contents()) ob_end_clean(); + header("Content-type: application/octet-stream"); + header("Content-Disposition: attachment; filename=\"".$name.".pdf\""); + header("Content-Length: ".strlen($output)); + // work-around IE bug when using SSL + header("Pragma: public"); + header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); + header("Expires: 0"); + echo $output; + exit; + } +} + +?> Added: trunk/actions/HideCategory.php =================================================================== --- trunk/actions/HideCategory.php (rev 0) +++ trunk/actions/HideCategory.php 2007-09-21 10:01:29 UTC (rev 566) @@ -0,0 +1,23 @@ +<?php + +require 'actions/Action.php'; + +class HideCategory extends Action { + + function dispatch() { + $hideCategories = $this->user->getPreference('hiddenCategories'); + if (!$hideCategories) { + $hideCategories = array(); + } else { + $hideCategories = explode(',', $hideCategories); + } + $hideCategories[] = (int)$_GET['catId']; + $this->user->setPreference('hiddenCategories', implode(',', $hideCategories)); + $this->user->save(); + + $_SESSION['message'] = $this->user->lang('Category won\'t be shown in the future'); + Library::redirect(Library::getLink(array('view' => 'EditCategories'))); + } +} + +?> Added: trunk/actions/ShowCategory.php =================================================================== --- trunk/actions/ShowCategory.php (rev 0) +++ trunk/actions/ShowCategory.php 2007-09-21 10:01:29 UTC (rev 566) @@ -0,0 +1,31 @@ +<?php + +require 'actions/Action.php'; + +class ShowCategory extends Action { + + function dispatch() { + $hideCategories = $this->user->getPreference('hiddenCategories'); + if (!$hideCategories) { + $hideCategories = array(); + } else { + $hideCategories = explode(',', $hideCategories); + } + + $newHideCategories = array(); + foreach ($hideCategories as $catId) { + if ($catId == $_GET['catId']) { + continue; + } + $newHideCategories[] = $catId; + } + + $this->user->setPreference('hiddenCategories', implode(',', $newHideCategories)); + $this->user->save(); + + $_SESSION['message'] = $this->user->lang('Category will be shown in the future'); + Library::redirect(Library::getLink(array('view' => 'EditCategories'))); + } +} + +?> Added: trunk/docs/sciret-install-OpenBSD-EN-images.html =================================================================== --- trunk/docs/sciret-install-OpenBSD-EN-images.html (rev 0) +++ trunk/docs/sciret-install-OpenBSD-EN-images.html 2007-09-21 10:01:29 UTC (rev 566) @@ -0,0 +1,1215 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" + "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<meta name="generator" content="AsciiDoc 8.2.1" /> +<style type="text/css"> +/* Debug borders */ +p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 { +/* + border: 1px solid red; +*/ +} + +body { + margin: 1em 5% 1em 5%; +} + +a { + color: blue; + text-decoration: underline; +} +a:visited { + color: fuchsia; +} + +em { + font-style: italic; +} + +strong { + font-weight: bold; +} + +tt { + color: navy; +} + +h1, h2, h3, h4, h5, h6 { + color: #527bbd; + font-family: sans-serif; + margin-top: 1.2em; + margin-bottom: 0.5em; + line-height: 1.3; +} + +h1 { + border-bottom: 2px solid silver; +} +h2 { + border-bottom: 2px solid silver; + padding-top: 0.5em; +} + +div.sectionbody { + font-family: serif; + margin-left: 0; +} + +hr { + border: 1px solid silver; +} + +p { + margin-top: 0.5em; + margin-bottom: 0.5em; +} + +pre { + padding: 0; + margin: 0; +} + +span#author { + color: #527bbd; + font-family: sans-serif; + font-weight: bold; + font-size: 1.1em; +} +span#email { +} +span#revision { + font-family: sans-serif; +} + +div#footer { + font-family: sans-serif; + font-size: small; + border-top: 2px solid silver; + padding-top: 0.5em; + margin-top: 4.0em; +} +div#footer-text { + float: left; + padding-bottom: 0.5em; +} +div#footer-badges { + float: right; + padding-bottom: 0.5em; +} + +div#preamble, +div.tableblock, div.imageblock, div.exampleblock, div.verseblock, +div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, +div.admonitionblock { + margin-right: 10%; + margin-top: 1.5em; + margin-bottom: 1.5em; +} +div.admonitionblock { + margin-top: 2.5em; + margin-bottom: 2.5em; +} + +div.content { /* Block element content. */ + padding: 0; +} + +/* Block element titles. */ +div.title, caption.title { + font-family: sans-serif; + font-weight: bold; + text-align: left; + margin-top: 1.0em; + margin-bottom: 0.5em; +} +div.title + * { + margin-top: 0; +} + +td div.title:first-child { + margin-top: 0.0em; +} +div.content div.title:first-child { + margin-top: 0.0em; +} +div.content + div.title { + margin-top: 0.0em; +} + +div.sidebarblock > div.content { + background: #ffffee; + border: 1px solid silver; + padding: 0.5em; +} + +div.listingblock { + margin-right: 0%; +} +div.listingblock > div.content { + border: 1px solid silver; + background: #f4f4f4; + padding: 0.5em; +} + +div.quoteblock > div.content { + padding-left: 2.0em; +} + +div.attribution { + text-align: right; +} +div.verseblock + div.attribution { + text-align: left; +} + +div.admonitionblock .icon { + vertical-align: top; + font-size: 1.1em; + font-weight: bold; + text-decoration: underline; + color: #527bbd; + padding-right: 0.5em; +} +div.admonitionblock td.content { + padding-left: 0.5em; + border-left: 2px solid silver; +} + +div.exampleblock > div.content { + border-left: 2px solid silver; + padding: 0.5em; +} + +div.verseblock div.content { + white-space: pre; +} + +div.imageblock div.content { padding-left: 0; } +div.imageblock img { border: 1px solid silver; } +span.image img { border-style: none; } + +dl { + margin-top: 0.8em; + margin-bottom: 0.8em; +} +dt { + margin-top: 0.5em; + margin-bottom: 0; + font-style: italic; +} +dd > *:first-child { + margin-top: 0; +} + +ul, ol { + list-style-position: outside; +} +ol.olist2 { + list-style-type: lower-alpha; +} + +div.tableblock > table { + border: 3px solid #527bbd; +} +thead { + font-family: sans-serif; + font-weight: bold; +} +tfoot { + font-weight: bold; +} + +div.hlist { + margin-top: 0.8em; + margin-bottom: 0.8em; +} +div.hlist td { + padding-bottom: 5px; +} +td.hlist1 { + vertical-align: top; + font-style: italic; + padding-right: 0.8em; +} +td.hlist2 { + vertical-align: top; +} + +@media print { + div#footer-badges { display: none; } +} + +div#toctitle { + color: #527bbd; + font-family: sans-serif; + font-size: 1.1em; + font-weight: bold; + margin-top: 1.0em; + margin-bottom: 0.1em; +} + +div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 { + margin-top: 0; + margin-bottom: 0; +} +div.toclevel2 { + margin-left: 2em; + font-size: 0.9em; +} +div.toclevel3 { + margin-left: 4em; + font-size: 0.9em; +} +div.toclevel4 { + margin-left: 6em; + font-size: 0.9em; +} +/* Workarounds for IE6's broken and incomplete CSS2. */ + +div.sidebar-content { + background: #ffffee; + border: 1px solid silver; + padding: 0.5em; +} +div.sidebar-title, div.image-title { + font-family: sans-serif; + font-weight: bold; + margin-top: 0.0em; + margin-bottom: 0.5em; +} + +div.listingblock div.content { + border: 1px solid silver; + background: #f4f4f4; + padding: 0.5em; +} + +div.quoteblock-content { + padding-left: 2.0em; +} + +div.exampleblock-content { + border-left: 2px solid silver; + padding-left: 0.5em; +} + +/* IE6 sets dynamically generated links as visited. */ +div#toc a:visited { color: blue; } +</style> +<title>Howto install Sciret on OpenBSD</title> +</head> +<body> +<div id="header"> +<h1>Howto install Sciret on OpenBSD</h1> +<span id="author">v1.1.3, Mai 2007</span><br /> +Reiner Jung <rj...@th...> +</div> +<h2>1. Introduction</h2> +<div class="sectionbody"> +<p><strong>Sciret</strong></p> +<p>Sciret is an advanced knowledge based system written in PHP. The software self is platform independent and should run on every platform where PHP is supported. In the further development, Sciret will be extended to a full enterprise knowledge and information storage system.</p> +<p>Sciret was developed as a internal project from <a href="http://www.the-gang.net">TheGang</a>, a Open Source consulting and strategy company. After many month of internal usage, the decision was taken to release the code as an Open Source Project on <a href="http://www.sf.net">Sourceforge</a>. We hope that Sciret will also fulfill the requirements of other users and companies.</p> +<p><strong>OpenBSD</strong></p> +<p><a href="http://www.openbsd.org">OpenBSD</a> is a Unix-like computer operating system descended from Berkeley Software Distribution (BSD), a Unix derivative developed at the University of California, Berkeley. It was forked from NetBSD by project leader Theo de Raadt in late 1995. The project is widely known for the developers insistence on open source code and quality documentation; uncompromising position on software licensing; and focus on security and code correctness. The project is coordinated from de Raadt's home in Calgary, Alberta, Canada. Its logo and mascot is Puffy, a blowfish.</p> +<p>OpenBSD includes a number of security features absent or optional in other operating systems and has a tradition of developers auditing the source code for software bugs and security problems. The project maintains strict policies on licensing and prefers the open source BSD licence and its variants in the past this has led to a comprehensive licence audit and moves to remove or replace code under licences found less acceptable.</p> +<p>OpenBSD is developed by volunteers. The project funds development and releases by selling <a href="http://openbsd.org/items.html">CDs</a> and <a href="http://openbsd.org/tshirts.html">T-shirts</a>, as well as <a href="http://openbsd.org/donations.html">donations</a> from organizations and individuals. These finances ensure that OpenBSD will continue to exist, and will remain <a href="http://openbsd.org/policy.html">free</a> for everyone to use and reuse as they see fit.</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/important.png" alt="Important" /> +</td> +<td class="content">Some of the information of this document are not related to your Sciret version. Please read also the release announcements for your version!</td> +</tr></table> +</div> +</div> +<h2>2. Requirements</h2> +<div class="sectionbody"> +<p>To install Sciret, you need a couple of things enabled or installed</p> +<div class="hlist"><table> +<tr> +<td class="hlist1"> +<strong>Operation system</strong> +</td> +<td class="hlist2"> +<a href="http://www.OpenBSD.org">OpenBSD</a> +</td> +</tr> +<tr> +<td class="hlist1"> +<strong>Web Server</strong> +</td> +<td class="hlist2"> +<a href="http://httpd.apache.org">OpenBSD Apache Web Server</a> included in the core OS from OpenBSD +</td> +</tr> +<tr> +<td class="hlist1"> +<strong>PHP</strong> +</td> +<td class="hlist2"> +<a href="http://www.php.net/">PHP</a> version 5.x +</td> +</tr> +<tr> +<td class="hlist1"> +<strong>MySQL</strong> +</td> +<td class="hlist2"> +<a href="http://mysql.com/">MySQL database</a> +</td> +</tr> +</table></div> +</div> +<h2>3. Install the Operation System, the required packages and the configuration of the system</h2> +<div class="sectionbody"> +<p>We will not explain here how to install OpenBSD as OpenBSD is mostly self-explained. Information howto install OpenBSD you can found on the OpenBSD project web site. A typical installation from OpenBSD is done in less then 10 minutes when you follow the excellent <a href="http://www.openbsd.org/faq/faq4.html">instructions</a>.</p> +<p>After the base system in installed, you need to configure several parts to run Sciret.</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/tip.png" alt="Tip" /> +</td> +<td class="content"> +<div class="title">Prepare to install OpenBSD packages</div> +<p>You can install the additional packages over HTTP or FTP. Please add as root user +the follow information to the file <strong>.profile</strong></p> +<div class="literalblock"> +<div class="content"> +<pre><tt># vi /root/.profile</tt></pre> +</div></div> +<div class="literalblock"> +<div class="content"> +<pre><tt># export PKG_PATH="ftp://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/"</tt></pre> +</div></div> +<p>You must logout and login from the Shell to activate the environment variables</p> +</td> +</tr></table> +</div> +<p>Now you can begin to install the additional packages, which are not part of your core +OpenBSD system. The PHP packages from OpenBSD are patched with +<a href="http://www.hardened-php.net/suhosin.127.html">Suhosin</a> for better security.</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/important.png" alt="Important" /> +</td> +<td class="content"> +<div class="title">Install the required packages</div> +<p>Install the MySQL server with</p> +<div class="literalblock"> +<div class="content"> +<pre><tt># pkg_add -v -i mysql-server</tt></pre> +</div></div> +<p>Install the PHP package</p> +<div class="literalblock"> +<div class="content"> +<pre><tt># pkg_add -v -i php5-core</tt></pre> +</div></div> +<p>Copy the php.ini file</p> +<div class="literalblock"> +<div class="content"> +<pre><tt># cp /usr/local/share/examples/php5/php.ini-recommended /var/www/conf/php.ini</tt></pre> +</div></div> +<p>Edit the php.ini file</p> +<div class="literalblock"> +<div class="content"> +<pre><tt># vi /var/www/conf/php.ini</tt></pre> +</div></div> +<p>And change the value from</p> +<div class="literalblock"> +<div class="content"> +<pre><tt>short_open_tag = off</tt></pre> +</div></div> +<p>to</p> +<div class="literalblock"> +<div class="content"> +<pre><tt>short_open_tag = on</tt></pre> +</div></div> +<p>And activate the PHP package</p> +<div class="literalblock"> +<div class="content"> +<pre><tt># /usr/local/sbin/phpxs -s</tt></pre> +</div></div> +<p>And install and activate the follow packages also</p> +<div class="literalblock"> +<div class="content"> +<pre><tt># pkg_add -v -i php5-mysql</tt></pre> +</div></div> +<div class="literalblock"> +<div class="content"> +<pre><tt># /usr/local/sbin/phpxs -a mysql</tt></pre> +</div></div> +<div class="literalblock"> +<div class="content"> +<pre><tt># pkg_add -v -i php5-mcrypt</tt></pre> +</div></div> +<div class="literalblock"> +<div class="content"> +<pre><tt># /usr/local/sbin/phpxs -a mcrypt</tt></pre> +</div></div> +<div class="literalblock"> +<div class="content"> +<pre><tt># pkg_add -v -i php5-mhash</tt></pre> +</div></div> +<div class="literalblock"> +<div class="content"> +<pre><tt># /usr/local/sbin/phpxs -a mhash</tt></pre> +</div></div> +<div class="literalblock"> +<div class="content"> +<pre><tt># pkg_add -v -i php5-imap</tt></pre> +</div></div> +<div class="literalblock"> +<div class="content"> +<pre><tt># /usr/local/sbin/phpxs -a imap/</tt></pre> +</div></div> +</td> +</tr></table> +</div> +<p>After the packages are installed, you need to prepare the OpenBSD Apache to support PHP +and you need to create the /tmp directory for Sciret. The /tmp directory is required as +the OpenBSD Apache runs in a Chroot environment.</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/important.png" alt="Important" /> +</td> +<td class="content"> +<div class="title">Configure OpenBSD Apache web server</div> +<p>To enable parsing of PHP scripts, add the following to /var/www/conf/httpd.conf:</p> +<div class="literalblock"> +<div class="content"> +<pre><tt>AddType application/x-httpd-php .php</tt></pre> +</div></div> +<p>and add index.php to your DirectoryIndex that it looks like</p> +<div class="literalblock"> +<div class="content"> +<pre><tt>DirectoryIndex index.html index.php</tt></pre> +</div></div> +<p>Now you need to create the /tmp directory for Apache with the follow commands</p> +<div class="literalblock"> +<div class="content"> +<pre><tt># mkdir /var/www/tmp +# chown www /var/www/tmp</tt></pre> +</div></div> +<p>The base configuration from the Apache server is finished. Now you need to activate +the webserver that he start on system start. Please change in the file <strong>/etc/rc.conf</strong> +the value from</p> +<div class="literalblock"> +<div class="content"> +<pre><tt>http_flags=NO</tt></pre> +</div></div> +<p>to</p> +<div class="literalblock"> +<div class="content"> +<pre><tt>http_flags=""</tt></pre> +</div></div> +</td> +</tr></table> +</div> +<p>PHP and the Apache web server are up and running and the first part of your installation +was successful finished. You can test now that there was no error in the configuration +until now.</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/tip.png" alt="Tip" /> +</td> +<td class="content"> +<div class="title">Test the PHP and Apache functionality</div> +<p>Create the following file</p> +<div class="literalblock"> +<div class="content"> +<pre><tt># vi /var/www/htdocs/info.php</tt></pre> +</div></div> +<p>and add to this file the follow line</p> +<div class="literalblock"> +<div class="content"> +<pre><tt><? +phpinfo(); +?></tt></pre> +</div></div> +<p>Now start your apache web server from the command line with the command</p> +<div class="literalblock"> +<div class="content"> +<pre><tt># apachectl start</tt></pre> +</div></div> +<p>and point your browser to the follow addess</p> +<div class="literalblock"> +<div class="content"> +<pre><tt>http://your-server-ip-address/info.php</tt></pre> +</div></div> +<p>When you see the PHP information, your web server and the PHP installation are working +and you can go to the next step. Please <strong>delete</strong> the info.php file before you continue.</p> +<div class="literalblock"> +<div class="content"> +<pre><tt># rm /var/www/htdocs/info.php</tt></pre> +</div></div> +</td> +</tr></table> +</div> +<p>Now you need to prepare your MySQL server that he start at system start and you need to +install the default database for your MySQL server.</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/important.png" alt="Important" /> +</td> +<td class="content"> +<div class="title">Configuration of your MySQL server</div> +<p>To enable MySQL to start at boot enter the following line in /etc/rc.conf.local:</p> +<div class="literalblock"> +<div class="content"> +<pre><tt>mysql=YES</tt></pre> +</div></div> +<p>Then enter the following lines into your /etc/rc.local <strong>after</strong> the line</p> +<div class="literalblock"> +<div class="content"> +<pre><tt># Add your local startup actions here</tt></pre> +</div></div> +<p>and <strong>before</strong> the line</p> +<div class="literalblock"> +<div class="content"> +<pre><tt>echo ´.´</tt></pre> +</div></div> +<div class="literalblock"> +<div class="content"> +<pre><tt>if [ X"${mysql}" == X"YES" -a -x /usr/local/bin/mysqld_safe ]; then + echo -n " mysqld"; /usr/local/bin/mysqld_safe --user=_mysql --log --open-files-limit=256 & + for i in 1 2 3 4 5 6; do + if [ -S /var/run/mysql/mysql.sock ]; then + break + else + sleep 1 + echo -n "." + fi + done + # + # Apache chroot Settings + mkdir -p /var/www/var/run/mysql + sleep 2 + ln -f /var/run/mysql/mysql.sock /var/www/var/run/mysql/mysql.sock +fi</tt></pre> +</div></div> +<p>You must add this line exactly as they are written here. Otherwise your chrooted Apache will not be +able to connect to the MySQL Database server!</p> +</td> +</tr></table> +</div> +<p>The basic installation from your OpenBSD system and the required servers are configured and you can +start now to install Sciret. Sciret will be available in the OpenBSD ports tree, so you can install +Sciret without pain. Before you can install Sciret, you need to prepare your database first. Please +follow the instructions below.</p> +</div> +<h2>4. Database</h2> +<div class="sectionbody"> +<p>Sciret requires a database. At the moment Sciret support only MySQL as database. +There are several ways to create a database and several tools</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/tip.png" alt="Tip" /> +</td> +<td class="content"> +<div class="title">MySQL Administration</div> +<p>phpMyAdmin: Web based administration tool for MySQL is as a package available in +the OpenBSD ports tree. You can install the package like the other packages with +the command</p> +<div class="literalblock"> +<div class="content"> +<pre><tt>pkg_add -v -i phpMyAdmin.</tt></pre> +</div></div> +<p>For more information about phpMyAdmin you can visit the project page.</p> +<p><a href="http://www.phpmyadmin.net">http://www.phpmyadmin.net/</a></p> +<p>MySQL Administrator is a other tool, provided by MySQL AB and this tool is also +available as package from the ports tree (mysql-administrator).</p> +<p><a href="http://www.mysql.com/products/tools/administrator">http://www.mysql.com/products/tools/administrator/</a></p> +</td> +</tr></table> +</div> +</div> +<h2>5. Disabling and configuring Services</h2> +<div class="sectionbody"> +<p>OpenBSD does come with a few unnecessary services enabled by default, which you don't need when you run Sciret. Turn these services off. This is completely optional and you must do so according to your own needs.</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/tip.png" alt="Tip" /> +</td> +<td class="content"> +<div class="title">Disable unnecessary service</div> +<p>Edit the following file</p> +<div class="literalblock"> +<div class="content"> +<pre><tt># vi /etc/inetd.conf</tt></pre> +</div></div> +<p>and comment out the following line:</p> +<div class="literalblock"> +<div class="content"> +<pre><tt>#ident stream tcp nowait _identd /usr/libexec/identd identd -el +#ident stream tcp6 nowait _identd /usr/libexec/identd identd -el +#daytime stream tcp nowait root internal +#daytime stream tcp6 nowait root internal +#time stream tcp nowait root internal +#time stream tcp6 nowait root internal</tt></pre> +</div></div> +</td> +</tr></table> +</div> +</div> +<h2>6. Install Sciret from scratch</h2> +<div class="sectionbody"> +<p>When you install Sciret the first time, you should follow the instructions in this manual.</p> +<h3>6.1. Create your database and a user which can connect to the DB</h3> +<p>This example shows how to create a database under OpenBSD from the command line. +With the graphical tools the steps are the same as described here.</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/warning.png" alt="Warning" /> +</td> +<td class="content">Many people run their applications under the MySQL Root account. <strong>Never</strong> use the database Root account as a user for your application. Create instead a dedicated user only for the application.</td> +</tr></table> +</div> +<div class="literalblock"> +<div class="title">Create the database</div> +<div class="content"> +<pre><tt> # mysqladmin –u your-mysqladmin-user –p create sciret-db-name + Enter password:</tt></pre> +</div></div> +<div class="literalblock"> +<div class="title">Create the Sciret DB user and give him DB access rights</div> +<div class="content"> +<pre><tt> # mysql –u your-mysqladmin-user –p + Enter password: + + mysql> grant all on sciret.* to sciret-db-user@localhost identified by “password”;</tt></pre> +</div></div> +<h3>6.2. Install Sciret sources on your web server</h3> +<p>You can <a href="http://sourceforge.net/project/showfiles.php?group_id=181327">download the Sciret sources</a> from the Project page or you can install the package as OpenBSD user from the OpenBSD ports tree direct from the command line. When you want have a preview to upcoming versions of Sciret, You can download the test releases or checkout directly from SVN.</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/tip.png" alt="Tip" /> +</td> +<td class="content"> +<div class="title">The preferred installation from Sciret on OpenBSD</div> +<p>You should use to install Sciret the packages available from OpenBSD. To install Sciret run the +follow command.</p> +<div class="literalblock"> +<div class="content"> +<pre><tt># pkd_add -v -i sciret</tt></pre> +</div></div> +</td> +</tr></table> +</div> +<p>When you have downloaded the Sources from <a href="http://www.sf.net">SourceForge</a>, you must unpack the sources in your web server root.</p> +<div class="literalblock"> +<div class="title">Install the sources</div> +<div class="content"> +<pre><tt> # cd /var/www/htdocs + + # tar xzvf sciret-rcx-x.x.x.tar.gz</tt></pre> +</div></div> +<p>After the sources from Sciret are installed on your server. You must change the permissions that your web server can read the files. For the <strong>upload</strong> directory you must give also write permissions to the web server user.</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/tip.png" alt="Tip" /> +</td> +<td class="content"> +<div class="title">Under which user your Apache is running?</div> +<p>The OpenBSD apache runs under the user <strong>www</strong>.</p> +</td> +</tr></table> +</div> +<div class="literalblock"> +<div class="title">Change the access rights to your web server user</div> +<div class="content"> +<pre><tt> # cd /var/www/htdocs + + # chown -R root:www sciret + + # find sciret -type d -exec chmod 550 {} \; + + # find sciret -type f -exec chmod 440 {} \; + + # find sciret/uploads -type d -exec chmod 770 {} \; + + # chmod 660 sciret/config.php</tt></pre> +</div></div> +<p>Now you must set the <strong>$Config[<em>UserFilesPath</em>]</strong> variable to the path (relative to the web server root dir) where +you want to store image uploads.</p> +<div class="literalblock"> +<div class="title">Edit the follow files:</div> +<div class="content"> +<pre><tt> # vi fckeditor/editor/filemanager/browser/default/connectors/php/config.php + + // Path to user files relative to the document root. + $Config['UserFilesPath'] = '/sciret/uploads/editor' ; + + # vi fckeditor/editor/filemanager/upload/php/config.php + + // Path to uploaded files relative to the document root. + $Config['UserFilesPath'] = '/sciret/uploads/editor' ;</tt></pre> +</div></div> +<h3>6.3. Finish the Sciret installation</h3> +<p>After you configured the web server and all permissions are set, you can go to finish the installation. To finalize the Sciret setup, please point your browser to your web server Sciret URL and follow the instructions.</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/note.png" alt="Note" /> +</td> +<td class="content"> +<div class="title">Finalize the installation</div> +<p>Point your browser to the URL or your Sciret installation to finalize the installation</p> +<p>http://www.servername.xx/index.php</p> +</td> +</tr></table> +</div> +<h3>6.4. Remove write access to the config file</h3> +<p>After successful installation from Sciret, you can remove the write access to the config.php from your web server user.</p> +<div class="literalblock"> +<div class="title">Change the access rights from the config.php back</div> +<div class="content"> +<pre><tt> # chmod 440 sciret/config.php</tt></pre> +</div></div> +<h3>6.5. Login to Sciret the first time</h3> +<p>When you finished your installation, you can login to Sciret the first time. Please take care to change the default password after your first login!</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/important.png" alt="Important" /> +</td> +<td class="content"> +<div class="title">Default login password</div> +<p>username = admin</p> +<p>password = admin</p> +</td> +</tr></table> +</div> +<h3>6.6. Secure your Sciret access with a web server certificate</h3> +<p>To protect your privacy, you can use a server certificate when you connect to your Sciret installation. With a certificate you can connect to your web server with an encrypted connection (using https instead of http). Without an https connection, other people can sniff your password or other personal information.</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/tip.png" alt="Tip" /> +</td> +<td class="content"> +<div class="title">Self-signed server certificates.</div> +<div class="literalblock"> +<div class="content"> +<pre><tt>You can self-sign the certificate which you will create.</tt></pre> +</div></div> +<p><strong>Use a non-Profit Certificate Authority.</strong></p> +<p><a href="http://www.cacert.org/">CAcert</a></p> +<p><strong>Use a commercial Certificate Authority.</strong></p> +<p><a href="http://www.rapidssl.com/">RapidSSL</a></p> +<p><a href="http://www.geotrust.com/">GeoTrust</a></p> +<p><a href="http://www.thawte.com">Thawte</a></p> +</td> +</tr></table> +</div> +<h4>6.6.1. Use CAcert as Certificate Authority</h4> +<p>We will here explain the steps, which you need to register and create your certificate with CAcert. The reason for CAcert is not that it is better then the other authorities, the reason is that it is free of charge.</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/note.png" alt="Note" /> +</td> +<td class="content"> +<div class="title">The CAcert homepage</div><a href="https://www.cacert.org/">https://www.cacert.org</a></td> +</tr></table> +</div> +<ol> +<li> +<p><em> +What to do first +</em></p> +<p> +First you must create an account at CAcert. For the account enrolment you must fill out the <a href="https://www.cacert.org/index.php?id=1">form</a>. When you have done this, you will receive a Email with more instructions. +</p> +</li> +<li> +<p><em> +Register your domain at CAcert +</em></p> +<p> +After you have created your account, register your domain at CAcert for which you want sign a certificate. When you have already more then 50 assurance points, then you can register your organization. To register your organization, you must send to su...@ca... some scanned copy(ies) of Certificate of Incorporation etc. +</p> +</li> +<li> +<p><em> +Creating your certificate signing request +</em></p> +<p> +On your Sciret server, you must create a server key and a certificate-signing request for your web server. +</p> +</li> +<li> +<p><em> +Sign the Certificate Signing Request +</em></p> +<p> +You Certificate Signing Request you can now sign on the CAcert website. Please follow the instruction on the site. +</p> +</li> +<li> +<p><em> +Install the certificate on your server +</em></p> +<p> +After your certificate is signed, install the Certificate on your server to protect your Sciret installation. +</p> +</li> +</ol> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/tip.png" alt="Tip" /> +</td> +<td class="content"> +<div class="title">How create the certificates</div> +<p>Create you server certificate</p> +<div class="literalblock"> +<div class="content"> +<pre><tt># /usr/sbin/openssl genrsa 1024 > /etc/ssl/private/server.key</tt></pre> +</div></div> +<p>Create your Certificate Signing Request (CSR)</p> +<div class="literalblock"> +<div class="content"> +<pre><tt># usr/sbin/openssl req -new -key /etc/ssl/private/server.key \ + -out /etc/ssl/private/server.csr</tt></pre> +</div></div> +</td> +</tr></table> +</div> +<p>Now your Sciret installation is basically protected again sniffing your password. There are other possibilities to protect your server and install it in a secure way. This will be targeted in a separate document in the future.</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/note.png" alt="Note" /> +</td> +<td class="content"> +<div class="title">Comercial Certificate Vendors</div>The certificate creation process is similar for a commercial vendor.</td> +</tr></table> +</div> +</div> +<h2>7. Patch your Sciret installation</h2> +<div class="sectionbody"> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/important.png" alt="Important" /> +</td> +<td class="content">You can only patch the latest Sciret release. When you are not running the latest Sciret release, you need to upgrade your installation.</td> +</tr></table> +</div> +<p>Sometimes your Sciret installation needs to be patched to fix a bug. For small bug fixes you can download only the new file to patch you Sciret installation instead to download a new package.</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/note.png" alt="Note" /> +</td> +<td class="content"> +<div class="title">Apply the patch</div> +<p>Download the patch from the Sciret SourceForge project page</p> +<p><a href="https://sourceforge.net/project/showfiles.php?group_id=181327">https://sourceforge.net/project/showfiles.php?group_id=181327</a></p> +<p>Overwrite the existing file with the new file</p> +</td> +</tr></table> +</div> +</div> +<h2>8. Upgrade the Sciret language package</h2> +<div class="sectionbody"> +<p>The Sciret project deliver a separate language package. With this package you can update you stable Sciret installation with additional translation. The reason for the separate package is that some translations are started or committed after a stable release from Sciret is released. To install the Sciret language package, please follow the instructions</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/tip.png" alt="Tip" /> +</td> +<td class="content"> +<div class="title">Install the language package</div> +<p>Download the package from the SourceForge project page</p> +<div class="literalblock"> +<div class="content"> +<pre><tt>http://sourceforge.net/project/showfiles.php?group_id=181327&package_id=231283</tt></pre> +</div></div> +<p>and unpack the package it the folder</p> +<div class="literalblock"> +<div class="content"> +<pre><tt># cd /var/www/htdocs/sciret/languages</tt></pre> +</div></div> +<p>On OpenBSD with</p> +<div class="literalblock"> +<div class="content"> +<pre><tt># tar xzvf language-update-x.x.x.tar.gz</tt></pre> +</div></div> +</td> +</tr></table> +</div> +</div> +<h2>9. Install aditional icon sets on Sciret</h2> +<div class="sectionbody"> +<p>The Sciret project deliver several icon sets. With these packages you can installation and other icons set as Sciret ship it by default. To install the Sciret icon set package, please follow the instructions</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/tip.png" alt="Tip" /> +</td> +<td class="content"> +<div class="title">Install a alternative icon set</div> +<p>Download the package from the SourceForge project page</p> +<div class="literalblock"> +<div class="content"> +<pre><tt>http://sourceforge.net/project/showfiles.php?group_id=181327&package_id=231283</tt></pre> +</div></div> +<p>make a backup of your standard icon set</p> +<div class="literalblock"> +<div class="content"> +<pre><tt># cd /var/www/htdocs/sciret/uploads/icons</tt></pre> +</div></div> +<div class="literalblock"> +<div class="content"> +<pre><tt># tar czvf a-name-for-your-backup.tar.gz *</tt></pre> +</div></div> +<div class="literalblock"> +<div class="content"> +<pre><tt># mv a-name-for-your-backup.tar.gz /root/</tt></pre> +</div></div> +<div class="literalblock"> +<div class="content"> +<pre><tt># rm -rf *</tt></pre> +</div></div> +<p>and unpack the new icon set in the same folder</p> +<div class="literalblock"> +<div class="content"> +<pre><tt># tar xzvf name-of-the-new-icon-set.tar.gz</tt></pre> +</div></div> +</td> +</tr></table> +</div> +</div> +<h2>10. Upgrade Sciret</h2> +<div class="sectionbody"> +<p>With the release from Sciret 1.1.0, Sciret offer a full automatic upgrade to the next release. The automatic upgrade work only from the last stable release but not from a SVN version of Sciret.</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/important.png" alt="Important" /> +</td> +<td class="content">Before you start any upgrade from Sciret, please <strong>make a backup</strong> from your Sciret database and your Sciret installation!</td> +</tr></table> +</div> +<h3>10.1. Backup your Sciret installation</h3> +<p>We will describe here a simple backup from Sciret. Please consider that on your platform, the backup procedure can be different.</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/warning.png" alt="Warning" /> +</td> +<td class="content"> +<div class="title">Stop the web server</div> +<p>Before you start to make any backups, you should first stop +the web server.</p> +<div class="literalblock"> +<div class="content"> +<pre><tt># apachectl stop</tt></pre> +</div></div> +</td> +</tr></table> +</div> +<div class="literalblock"> +<div class="title">Backup the database and the Sciret web server root</div> +<div class="content"> +<pre><tt> # tar czvf sciret.tar.gz sciret + + # mv sciret.tar.gz /root/ + + # mysqldump –u your-mysqladmin-user -p --opt database > /root/database.sql</tt></pre> +</div></div> +<p>After you have backed up your installation, you can upgrade the database.</p> +<p>Now you can install the new sources from Sciret on your web server</p> +<div class="literalblock"> +<div class="title">Upgrade Sciret</div> +<div class="content"> +<pre><tt> # cp sciret/config.php /root/ + + # pkg_add -u -i -v sciret + + # cp /root/config.php sciret/</tt></pre> +</div></div> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/note.png" alt="Note" /> +</td> +<td class="content"> +<div class="title">Start the web server</div> +<p>After your upgrade is done, you must start the web server again.</p> +<div class="literalblock"> +<div class="content"> +<pre><tt># apachectl start</tt></pre> +</div></div> +</td> +</tr></table> +</div> +<p>After you have update you must force a reload of your browser cache. Often a update from Sciret includes changes in the JavaScirpt engine or the CSS files.</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/tip.png" alt="Tip" /> +</td> +<td class="content"> +<div class="title">After the package upgrade</div> +<p>Point your browser to the Sciret site and follow the instruction to perform the automatic database upgrade</p> +</td> +</tr></table> +</div> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/important.png" alt="Important" /> +</td> +<td class="content"> +<div class="title">Upgrade Sciret from a SVN development version</div> +<p>Before you upgrade Sciret to the latest release, please read the release notes and the file UPGRADE.TXT. Sometimes the database schema is changed and you need to alter your database first before you can upgrade Sciret.</p> +<p>If you update the code from the svn repository the automatic upgrade won't work since +you are in a kind of "limbo version". The system will only do clean +installs and upgrade from any stable version to the next stable version. To make your +current installs work you'll have, just for this time, to manually run +the SQL that you need under /setup/upgrade_x.x.x.sql and this: +INSERT INTO configuration (field, value) VALUES(<em>version</em>, <em>x.x.x</em>);</p> +</td> +</tr></table> +</div> +</div> +<h2>11. Install the Sciret development version</h2> +<div class="sectionbody"> +<p>When you want test Sciret and submit patches to Sciret, you should use the development version from Sciret and not the stable version of Sciret. Sciret development from Subversion is not recommended for production use. You must read the Changelog before you install the development version.</p> +<h3>11.1. Checkout Sciret from Subversion</h3> +<p>You can checkout the Sciret sources direct from Subversion on the Sourceforge project page. Please consider that the development version of Sciret have no support.</p> +<div class="literalblock"> +<div class="title">SVN checkout from Sourceforge</div> +<div class="content"> +<pre><tt> # svn co https://sciret.svn.sourceforge.net/svnroot/sciret/trunk sciret</tt></pre> +</div></div> +</div> +<h2>12. Report Bugs, Submit Patches …</h2> +<div class="sectionbody"> +<p>When you found any problems with Sciret or inside this howto, please let us know what is going wrong. All problems and patches should be reported to the <a href="http://sourceforge.net/project/stats/?group_id=181327&ugn=sciret">Sciret Sourceforge Project Page</a>. There are also the mailing lists and the forums, which you can use to communicate with other users or the developers from Sciret.</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/important.png" alt="Important" /> +</td> +<td class="content"> +<div class="title">Important development addresses</div> +<p>When you report a bug about Sciret, it is important that you send us also the Version number from Sciret. The Version Number you can found in the Sciret root directory in the file VERSION</p> +<p><a href="http://sourceforge.net/tracker/?group_id=181327&atid=896759">The Sciret Bug Tracker</a></p> +<p><a href="http://sourceforge.net/tracker/?group_id=181327&atid=896762">The Sciret Feature Request Page</a></p> +<p><a href="http://sourceforge.net/tracker/?group_id=181327&atid=896761">The Sciret Patches Submitting Page</a></p> +</td> +</tr></table> +</div> +</div> +<h2>13. Other Information about Sciret</h2> +<div class="sectionbody"> +<p>When you are interested in more information about Sciret, you can also visit the Sciret homepage. Here are screenshots from Sciret published and you can play around with the Sciret demo.</p> +<div class="admonitionblock"> +<table><tr> +<td class="icon"> +<img src="./asciidoc-images/tip.png" alt="Tip" /> +</td> +<td class="content"> +<div class="title">Please visit the Sciret homepage at</div><a href="http://www.sciret.org">http://www.sciret.org</a></td> +</tr></table> +</div> +</div> +<h2>14. Contributors to Sciret development</h2> +<div class="sectionbody"> +<p>Some people are contributed to the development with patches or with translations.</p> +<h3>14.1. Patch contribution</h3> +<ul> +<li> +<p> +Nikolai Essel submitted patches to Sciret 0.9/1.1 +</p> +</li> +<li> +<p> +Rune Hammersland submitted patches to Sciret 1.1 +</p> +</li> +</ul> +<h3>14.2. Testers</h3> +<ul> +<li> +<p> +Johnny Hsieh +</p> +</li> +</ul> +<h3>14.3. Translations</h3> +<ul> +<li> +<p> +Chinese Traditional Johnny Hsieh +</p> +</li> +<li> +<p> +Dutch translation Roy de Milde +</p> +</li> +<li> +<p> +Hebrew translation from SF user Golanor +</p> +</li> +<li> +<p> +Japanese translation from SF user tm800720 +</p> +</li> +<li> +<p> +Norway translation from from Rune Hammersland +</p> +</li> +<li> +<p> +Swedish translation from Henrik Christensson +</p> +</li> +</ul> +<h3>14.4. Graphical Layout</h3> +<ul> +<li> +<p> +The Sciret Logo and the New Sciret Layout is done by Nunu Pinheiro +</p> +</li> +</ul> +<h3>14.5. Packager</h3> +<ul> +<li> +<p> +OpenBSD Felix Kronlage +</p> +</li> +</ul> +</div> +<h2>15. License of this documentation</h2> +<div class="sectionbody"> +<p>This work is licensed under a <a href="http://creativecommons.org/licenses/by-sa/2.5/">Creative Commons Attribution-Share Alike 2.5 License</a>.</p> +</div> +<div id="footer"> +<div id="footer-text"> +Last updated 28-Jul-2007 10:11:41 CEST +</div> +</div> +</body> +</html> Added: trunk/fckeditor/editor/_source/internals/fckundo.js =================================================================== --- trunk/fckeditor/editor/_source/internals/fckundo.js (rev 0) +++ trunk/fckeditor/editor/_source/internals/fckundo.js 2007-09-21 10:01:29 UTC (rev 566) @@ -0,0 +1,180 @@ +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * Gecko specific implementation for the Undo/Redo system. + */ + +var FCKUndo = new Object() ; + +FCKUndo.SavedData = new Array() ; +FCKUndo.CurrentIndex = -1 ; +FCKUndo.TypesCount = 0 ; +FCKUndo.Changed = false ; // Is the document changed in respect to its initial image? +FCKUndo.MaxTypes = 25 ; +FCKUndo.Typing = false ; + +FCKUndo._GetBookmark = function() +{ + if ( FCKBrowserInfo.IsIE ) + { + var selection = FCK.EditorDocument.selection ; + if ( selection.type == 'Text' ) + return selection.createRange().getBookmark() ; + else + return null ; + } + else + { + var range = new FCKDomRange( FCK.EditorWindow ) ; + range.MoveToSelection() ; + return range.CreateBookmark2() ; + } +} + +FCKUndo._SelectBookmark = function( bookmark ) +{ + if ( ! bookmark ) + return ; + if ( FCKBrowserInfo.IsIE ) + { + var range = FCK.EditorDocument.selection.createRange() ; + range.moveToBookmark( bookmark ) ; + range.select() ; + } + else + { + var range = new FCKDomRange( FCK.EditorWindow ) ; + if ( bookmark instanceof Object ) + { + range.MoveToBookmark2( bookmark ) ; + try + { + // this does not always succeed, there are still some tricky cases where it fails + // e.g. add a special character at end of document, undo, redo -> error + range.Select() ; + } + catch ( e ) + { + // if select restore fails, put the caret at the end of the document + range.MoveToPosition( FCK.EditorDocument.body, 4 ) ; + range.Select() ; + } + } + } +} + +FCKUndo.SaveUndoStep = function() +{ + if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG ) + return ; + + // Assume the editor content is changed when SaveUndoStep() is called after the first time. + // This also enables the undo button in toolbar. + if ( this.SavedData.length ) + this.Changed = true ; + + // Get the HTML content. + var sHtml = FCK.EditorDocument.body.innerHTML ; + + // Shrink the array to the current level. + this.SavedData = this.SavedData.slice( 0, this.CurrentIndex + 1 ) ; + + // Cancel operation if the new step is identical to the previous one. + if ( this.CurrentIndex > 0 && sHtml == this.SavedData[ this.CurrentIndex ][0] ) + return ; + // Save the selection and caret position in the first undo level for the first change. + else if ( this.CurrentIndex == 0 && this.SavedData.length && sHtml == this.SavedData[0][0] ) + { + this.SavedData[0][1] = this._GetBookmark() ; + return ; + } + + // If we reach the Maximun number of undo levels, we must remove the first + // entry of the list shifting all elements. + if ( this.CurrentIndex + 1 >= FCKConfig.MaxUndoLevels ) + this.SavedData.shift() ; + else + this.CurrentIndex++ ; + + // Save the new level in front of the actual position. + this.SavedData[ this.CurrentIndex ] = [ sHtml, this._GetBookmark() ] ; + + FCK.Events.FireEvent( "OnSelectionChange" ) ; +} + +FCKUndo.CheckUndoState = function() +{ + return ( this.Changed || this.CurrentIndex > 0 ) ; +} + +FCKUndo.CheckRedoState = function() +{ + return ( this.CurrentIndex < ( this.SavedData.length - 1 ) ) ; +} + +FCKUndo.Undo = function() +{ + if ( this.CheckUndoState() ) + { + // If it is the first step. + if ( this.CurrentIndex == ( this.SavedData.length - 1 ) ) + { + // Save the actual state for a possible "Redo" call. + this.SaveUndoStep() ; + } + + // Go a step back. + this._ApplyUndoLevel( --this.CurrentIndex ) ; + + FCK.Events.FireEvent( "OnSelectionChange" ) ; + } +} + +FCKUndo.Redo = function() +{ + if ( this.CheckRedoState() ) + { + // Go a step forward. + this._ApplyUndoLevel( ++this.CurrentIndex ) ; + + FCK.Events.FireEvent( "OnSelectionChange" ) ; + } +} + +FCKUndo._ApplyUndoLevel = function( level ) +{ + var oData = this.SavedData[ level ] ; + + if ( !oData ) + return ; + + // Update the editor contents with that step data. + if ( FCKBrowserInfo.IsIE ) + FCK.SetInnerHtml( oData[0] ) ; + else + FCK.EditorDocument.body.innerHTML = oData[0] ; + + // Restore the selection + this._SelectBookmark( oData[1] ) ; + + this.TypesCount = 0 ; + this.Changed = false ; + this.Typing = false ; +} Added: trunk/fckeditor/editor/filemanager/connectors/php/basexml.php =================================================================== --- trunk/fckeditor/editor/filemanager/connectors/php/basexml.php (rev 0) +++ trunk/fckeditor/editor/filemanager/connectors/php/basexml.php 2007-09-21 10:01:29 UTC (rev 566) @@ -0,0 +1,93 @@ +<?php +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * These functions define the base of the XML response sent by the PHP + * connector. + */ + +function SetXmlHeaders() +{ + ob_end_clean() ; + + // Prevent the browser from caching the result. + // Date in the past + header('Expires: Mon, 26 Jul 1997 05:00:00 GMT') ; + // always modified + header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT') ; + // HTTP/1.1 + header('Cache-Control: no-store, no-cache, must-revalidate') ; + header('Cache-Control: post-check=0, pre-check=0', false) ; + // HTTP/1.0 + header('Pragma: no-cache') ; + + // Set the response format. + header( 'Content-Type: text/xml; charset=utf-8' ) ; +} + +function CreateXmlHeader( $command, $resourceType, $currentFolder ) +{ + SetXmlHeaders() ; + + // Create the XML document header. + echo '<?xml version="1.0" encoding="utf-8" ?>' ; + + // Create the main "Connector" node. + echo '<Connector command="' . $command . '" resourceType="' . $resourceType . '">' ; + + // Add the current folder node. + echo '<CurrentFolder path="' . ConvertToXmlAttribute( $currentFolder ) . '" url="' . ConvertToXmlAttribute( GetUrlFromPath( $resourceType, $currentFolder, $command ) ) . '" />' ; + + $GLOBALS['HeaderSent'] = true ; +} + +function CreateXmlFooter() +{ + echo '</Connector>' ; +} + +function SendError( $number, $text ) +{ + if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] ) + { + SendErrorNode( $number, $text ) ; + CreateXmlFooter() ; + } + else + { + SetXmlHeaders() ; + + // Create the XML document header + echo '<?xml version="1.0" encoding="utf-8" ?>' ; + + echo '<Connector>' ; + + SendErrorNode( $number, $text ) ; + + echo '</Connector>' ; + } + exit ; +} + +function SendErrorNode( $number, $text ) +{ + echo '<Error number="' . $number . '" text="' . htmlspecialchars( $text ) . '" />' ; +} +?> \ No newline at end of file Added: trunk/fckeditor/editor/filemanager/connectors/php/commands.php =================================================================== --- trunk/fckeditor/editor/filemanager/connectors/php/commands.php (rev 0) +++ trunk/fckeditor/editor/filemanager/connectors/php/commands.php 2007-09-21 10:01:29 UTC (rev 566) @@ -0,0 +1,219 @@ +<?php +/* + * FCKeditor - The text editor for Internet - http://www.fckeditor.net + * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * + * == BEGIN LICENSE == + * + * Licensed under the terms of any of the following licenses at your + * choice: + * + * - GNU General Public License Version 2 or later (the "GPL") + * http://www.gnu.org/licenses/gpl.html + * + * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") + * http://www.gnu.org/licenses/lgpl.html + * + * - Mozilla Public License Version 1.1 or later (the "MPL") + * http://www.mozilla.org/MPL/MPL-1.1.html + * + * == END LICENSE == + * + * This is the File Manager Connector for PHP. + */ + +function GetFolders( $resourceType, $currentFolder ) +{ + // Map the virtual path to the local server path. + $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFolders' ) ; + + // Array that will hold the folders names. + $aFolders = array() ; + + $oCurrentFolder = opendir( $sServerDir ) ; + + while ( $sFile = readdir( $oCurrentFolder ) ) + { + if ( $sFile != '.' && $sFile != '..' && is_dir( $sServerDir . $sFile ) ) + $aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ; + } + + closedir( $oCurrentFolder ) ; + + // Open the "Folders" node. + echo "<Folders>" ; + + natcasesort( $aFolders ) ; + foreach ( $aFolders as $sFolder ) + echo $sFolder ; + + // Close the "Folders" node. + echo "</Folders>" ; +} + +function GetFoldersAndFiles( $resourceType, $currentFolder ) +{ + // Map the virtual path to the local server path. + $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFoldersAndFiles' ) ; + + // Arrays that will hold the folders and files names. + $aFolders = array() ; + $aFiles = array() ; + + $oCurrentFolder = opendir( $sServerDir ) ; + + while ( $sFile = readdir( $oCurrentFolder ) ) + { + if ( $sFile != '.' && $sFile != '..' ) + { + if ( is_dir( $sServerDir . $sFile ) ) + $aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ; + else + { + $iFileSize = filesize( $sServerDir . $sFile ) ; + if ( $iFileSize > 0 ) + { + $iFileSize = round( $iFileSize / 1024 ) ; + if ( $iFileSize < 1 ) $iFileSize = 1 ; + } + + $aFiles[] = '<File name="' . ConvertToXmlAttribute( $sFile ) . '" size="' . $iFileSize . '" />' ; + } + } + } + + // Send the folders + natcasesort( $aFolders ) ; + echo '<Folders>' ; + + foreach ( $aFolders as $sFolder ) + echo $sFolder ; + + echo '</Folders>' ; + + // Send the files + natcasesort( $aFiles ) ; + echo '<Files>' ; + + foreach ( $aFiles as $sFiles ) + echo $sFiles ; + + echo '</Files>' ; +} + +function CreateFolder( $resourceType, $currentFolder ) +{ + $sErrorNumber = '0' ; + $sErrorMsg = '' ; + + if ( isset( $_GET['NewFolderName'] ) ) + { + $sNewFolderName = $_GET['NewFolderName'] ; + $sNewFolderName = SanitizeFolderName( $sNewFolderName ) ; + + if ( strpos( $sNewFolderName, '..' ) !== FALSE ) + $sErrorNumber = '102' ; // Invalid folder name. + else + { + // Map the virtual path to the local server path of the current folder. + $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'CreateFolder' ) ; + + if ( is_writable( $sServerDir ) ) + { + $sServerDir .= $sNewFolderName ; + + $sErrorMsg = CreateServerFolder( $sServerDir ) ; + + switch ( $sErrorMsg ) + { + case '' : + $sErrorNumber = '0' ; + break ; + case 'Invalid argument' : + case 'No such file or directory' : + $sErrorNumber = '102' ; // Path too long. + break ; + default : + $sErrorNumber = '110' ; + break ; + } + } + else + $sErrorNumber = '103' ; + } + } + else + $sErrorNumber = '102' ; + + // Create the "Error" node. + echo '<Error number="' . $sErrorNumber . '" originalDescription="' . ConvertToXmlAttribute( $sErrorMsg ) . '" />' ; +} + +function FileUpload( $resourceType, $currentFolder, $sCommand ) +{ + $sErrorNumber = '0' ; + $sFileName = '' ; + + if ( isset( $_FILES['NewFile'] ) && !is_null( $_FILES['NewFile']['tmp_name'] ) ) + { + global $Config ; + + $oFile = $_FILES['NewFile'] ; + + // Map the virtual path to the local server path. + $sServerDir = ServerMapFolder( $resourceType, $currentFolder, $sCommand ) ; + + // Get the uploaded file name. + $sFileName = $oFile['name'] ; + $sFileName = SanitizeFileName( $sFileName ) ; + + $sOriginalFileName = $sFileName ; + + // Get the extension. + $sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ; + $sExtension = strtolower( $sExtension ) ; + + // Check if it is an allowed extension. + if ( IsAllowedExt( $sExtension, $resourceType ) ) + { + $iCounter = 0 ; + + while ( true ) + { + $sFilePath = $sServerDir . $sFileName ; + + if ( is_file( $sFilePath ) ) + { + $iCounter++ ; + $sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ; + $sErrorNumber = '201' ; + } + else + { + move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ; + + if ( is_file( $sFilePath ) ) + { + $oldumask = umask(0) ; + chmod( $sFilePath, 0777 ) ; + umask( $oldumask ) ; + } + + break ; + } + } + } + else + $sErrorNumber = '202' ; + } + else + $sErrorNumber = '202' ; + + + $sFileUrl = CombinePaths( GetResourceTypePath( $resourceType, $sCommand ) , $sFileName ) ; + + SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName ) ; + + exit ; +} +?... [truncated message content] |