Thread: [Phpcms-plugins-cvs] onlineEditor4phpCMS/include class.ext_editor.php,1.13,1.14 class.image.php,1.5,
Brought to you by:
mjahn
From: Martin J. <mj...@us...> - 2004-07-02 17:41:35
|
Update of /cvsroot/phpcms-plugins/onlineEditor4phpCMS/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26107/include Modified Files: class.ext_editor.php class.image.php class.phpcmsMenu.php Log Message: general update Index: class.ext_editor.php =================================================================== RCS file: /cvsroot/phpcms-plugins/onlineEditor4phpCMS/include/class.ext_editor.php,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- class.ext_editor.php 21 May 2004 21:13:02 -0000 1.13 +++ class.ext_editor.php 2 Jul 2004 17:41:25 -0000 1.14 @@ -36,7 +36,7 @@ include_once (dirname(__FILE__).'/class.utilities.php'); include_once (dirname(__FILE__).'/pclzip/pclzip-trace.lib.php'); include_once (dirname(__FILE__).'/htmlcleaner.php'); -include_once ('XML/Unserializer.php'); +include_once ('XML/Tree.php'); include_once ('HTTP/Upload.php'); // causes PHP to report all errors @@ -81,13 +81,14 @@ * this function combines the different mehtods of this class into a the application **/ function start () { - $this->__parseFormData (); - // check and parse configfile if (!$this->__parseConfigfile()) { $this->savefile = false; $this->showeditor = false; } + + $this->__parseFormData (); + $metadata = false;; if ($this->__parseProjectFile() && $this->__parseMenufile()) { $metadata = true; @@ -96,15 +97,13 @@ $this->__processEditor (); if ($this->showeditor) { - // load the editor templatefile into $this->EDITOR - $tpl = $this->CONF['editor']['templatefile']; + $tpl = $this->CONF['config']['templatefile']; if (substr($tpl, 0, 1) == '/') { $tpl = realpath($this->docroot.$tpl); } else { $tpl = realpath($this->basedir.'/'.$tpl); } - // parse the editor-template-file $this->EDITOR = new cTemplate(); $this->EDITOR->load($tpl); @@ -114,12 +113,10 @@ if ($metadata) { echo $this->__displayEditor(); } else { - //Header ('Location: '.$EDITOR->editfile); - echo 'Eigentlich Abbruch<br />'; + Header ('Location: '.$this->editfile); } } else { - //Header ('Location: '.$EDITOR->editfile); - echo 'Keine Anzeige<br />'; + Header ('Location: '.$this->editfile); } } @@ -131,6 +128,7 @@ util::magicQuotesRemove($_COOKIE); // consider which action i have to do + if (DEBUG) echo '<p>$EDITOR->action[type] = '.$this->action['type'].'</p>'; switch ($this->action['type']) { // delete the chosen contentfile case 'del': @@ -185,7 +183,7 @@ if (!file_exists($newfilename)) { return false; } - @chmod ($newfilename, decoct($this->CONF['editor']['chmod'])); + @chmod ($newfilename, decoct($this->CONF['config']['chmod'])); // check for menudata of new contentfile if (isset($_POST['input-newmenu']) && isset($_POST['input-newmenu-position'])) { @@ -251,11 +249,16 @@ // default action default: // check for URI-paramters - if (isset($_GET['editfile'])) { - $this->__load($_GET['editfile']); - $this->showeditor = true; - $this->savefile = false; + if (isset ($_GET ['editfile'])) { + $openfile = $_GET ['editfile']; + } elseif (isset ($_POST ['editfile'])) { + $openfile = $_POST['editfile']; + } else { + $this->showeditor = true; + break; } + $this->__load($openfile); + $this->showeditor = true; break; } } @@ -266,7 +269,7 @@ **/ function __displayEditor() { // set common output data and predefine some fields - $this->EDITOR->setFieldValue ('USER.NAME', $this->USER->getProperty('handle')); + $this->EDITOR->setFieldValue ('USER.NAME', '');//$this->USER->getProperty('handle')); $this->EDITOR->setFieldValue ('FILE.NAME', 'keine Datei offen'); $this->EDITOR->setFieldValue ('FILE.SIZE', ''); $this->EDITOR->setFieldValue ('FILE.CTIME', ''); @@ -370,7 +373,7 @@ $this->EDITOR->setFieldValue ('INPUT.ID', $fieldname); $this->EDITOR->setFieldValue ('INPUT.VALUE', $buffer); $o = ''; - foreach ($this->CONF['script'] as $script) { + foreach ($this->CONF['scriptlist'] as $script) { $this->EDITOR->setFieldValue ('SCRIPT.NAME', $script['name']); $this->EDITOR->setFieldValue ('SCRIPT.TITLE', $script['title']); $this->EDITOR->setFieldValue ('SCRIPT.PATH', $script['path']); @@ -436,9 +439,9 @@ $contentselector = $this->EDITOR->getFieldValue ('EDITOR.CONTENTSELECTOR'); $contentselector .= $this->EDITOR->process('EDITOR.CONTENTSELECTOR.TPL'); $this->EDITOR->setFieldValue ('EDITOR.CONTENTSELECTOR', $contentselector); - $this->EDITOR->setFieldValue ('WYSIWYG.PATH', $this->CONF['wysiwyg']['path']); - $this->EDITOR->setFieldValue ('EDITOR.WYSIWYG.PRE', $this->EDITOR->getFieldValue('WYSIWYG.PRE.'.$this->CONF['wysiwyg']['tpl'])); - $this->EDITOR->setFieldValue ('WYSIWYG.INPUT', $this->EDITOR->getFieldValue('WYSIWYG.INPUT.'.$this->CONF['wysiwyg']['tpl'])); + $this->EDITOR->setFieldValue ('WYSIWYG.PATH', $this->CONF['editor']['path']); + $this->EDITOR->setFieldValue ('EDITOR.WYSIWYG.PRE', $this->EDITOR->getFieldValue('WYSIWYG.PRE.'.$this->CONF['editor']['tpl'])); + $this->EDITOR->setFieldValue ('WYSIWYG.INPUT', $this->EDITOR->getFieldValue('WYSIWYG.INPUT.'.$this->CONF['editor']['tpl'])); return $this->EDITOR->process('EDITOR.INPUTWYSIWYG'); break; @@ -454,7 +457,7 @@ **/ function __processFile($x) { // get temporary name for contentfile - $tempname = tempnam ($this->docroot.$this->CONF['editor']['tempdir'], 'editor'); + $tempname = tempnam ($this->docroot.$this->CONF['config']['tempdir'], 'editor'); // save content in temporary file $this->__saveFile($x, $tempname); $this->__backupFile ($this->editfile) ; @@ -493,25 +496,27 @@ } // not a file - if (!is_file($this->docroot.$this->CONF['imagebox']['imgpath'].'/'.$file)) { + if (!is_file($this->docroot.$this->CONF ['imagebox']['imgpath'].'/'.$file)) { continue; } // not a supported imagetype - if (!in_array (strtolower (substr ($file, strrpos ($file, '.') + 1)), $this->CONF['imagebox']['filter']['ext'])) { + if (!in_array (strtolower (substr ($file, strrpos ($file, '.') + 1)), $this->CONF ['imagebox']['filter'])) { + echo '1'; continue; } // check for thumbnail file - if (!file_exists($this->docroot.$this->CONF['imagebox']['thumbpath'].'/'.$file)) { - $IMG = new cImage($this->docroot.$this->CONF['imagebox']['imgpath'].'/'.$file); + if (!file_exists($this->docroot.$this->CONF ['imagebox']['thumbpath'].'/'.$file)) { + $IMG = new cImage($this->docroot.$this->CONF ['imagebox']['imgpath'].'/'.$file); if ($IMG->ok == false) { unset ($IMG); + echo '2'; continue; } $IMG->__resizeMaxLength($this->CONF['imagebox']['preview']['width'] > $this->CONF['imagebox']['preview']['height'] ? $this->CONF['imagebox']['preview']['width'] : $this->CONF['imagebox']['preview']['height']); $IMG->fileImage($this->docroot.$this->CONF['imagebox']['thumbpath'].'/'.$file); - @chmod ($this->docroot.$this->CONF['imagebox']['thumbpath'].'/'.$file, octdec($this->CONF['editor']['chmod'])); + @chmod ($this->docroot.$this->CONF['imagebox']['thumbpath'].'/'.$file, octdec($this->CONF['config']['chmod'])); unset ($IMG); } @@ -646,9 +651,44 @@ } // parse configfile into array - $conf = &new XML_Unserializer(); - $conf->unserialize($this->configfile, true); - $this->CONF = $conf->getUnserializedData(); + $conf = new XML_Tree ($this->configfile, true); + $data =& $conf->getTreeFromFile (); + + foreach ($data->children as $element) { + switch ($element->name) { + case 'imagebox': + $this->CONF ['imagebox'] = $element->attributes; + foreach ($element->children as $imgboxdata) { + if ($imgboxdata->name == 'preview') { + $this->CONF ['imagebox']['preview'] = $imgboxdata->attributes; + } + + if ($imgboxdata->name == 'filter') { + $this->CONF ['imagebox']['filter'] = array (); + foreach ($imgboxdata->children as $filter) { + $this->CONF ['imagebox']['filter'][] = $filter->content; + } + } + + } + break; + case 'script': + $this->CONF['scriptlist'][] = $element->attributes; + break; + case 'config': + $this->CONF['config'][$element->attributes ['id']] = $element->attributes ['value']; + break; + default: + $this->CONF[$element->name][$element->attributes ['id']] = $element->attributes; + break; + + } + } + if (DEBUG) { + echo '<!--'; + print_r($this->CONF); + echo '-->'; + } return true; } @@ -656,15 +696,12 @@ * check for uploaded files **/ function __parseUploadFile () { - global - $HTTP_POST_FILES, - $HTTP_SERVER_VARS; // initialize upload-object $upload = new HTTP_Upload('de'); // get upload-data - $file = $upload->getFiles('editform'); + $file = $upload->getFiles('input-upload'); // save error-message if (PEAR::isError($file)) { Index: class.image.php =================================================================== RCS file: /cvsroot/phpcms-plugins/onlineEditor4phpCMS/include/class.image.php,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- class.image.php 21 May 2004 21:13:02 -0000 1.5 +++ class.image.php 2 Jul 2004 17:41:25 -0000 1.6 @@ -338,6 +338,7 @@ function __getSupportedImageTypes() { $types = array ('jpeg', 'png', 'gif', 'wbmp', 'swf'); + $support = array (); foreach ($types as $type) { if (function_exists('image'.$type)) { $support[] = $type; Index: class.phpcmsMenu.php =================================================================== RCS file: /cvsroot/phpcms-plugins/onlineEditor4phpCMS/include/class.phpcmsMenu.php,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- class.phpcmsMenu.php 21 May 2004 21:13:02 -0000 1.8 +++ class.phpcmsMenu.php 2 Jul 2004 17:41:25 -0000 1.9 @@ -200,9 +200,6 @@ $temp = $this->menuclasses; sort ($temp); $this->root = $temp[0]; - echo '<!--'; - print_r($this->menu); - echo '-->'; // complete building of menu-structure $this->menu = $this->__recurseMenu($this->root); } |