= USERLEVEL_ADMIN) { return false; } // do we already have it? if (!$this->forceZipInstall && is_dir($this->cke_dir) && is_file($this->cke_dir . '/ckeditor.js')) { // this is running while getting a new Plugin version if ($this->checkUpdate()) { $this->set_config('installer', '4-'.date('Ymd-H:i:s')); // this is a faked debug notice, since falldown is extract true with case 0, 1 or 2 } else { $this->set_config('installer', '3-'.date('Ymd-H:i:s')); // this will happen, if no further extract is necessary in case of an update return; } } if (!extension_loaded('zip')) { trigger_error(' ZIP extension has not been compiled or loaded in php.', E_USER_WARNING); return; } if (is_writable($this->cke_path)) { $zip = new ZipArchive; if ($zip->open($this->cke_path . '/' . $this->cke_zipfile) === true) { $zip->extractTo($this->cke_path); $zip->close(); $this->set_config('installer', '2-'.date('Ymd-H:i:s')); // returned by string[0], which is better than substr in this case // Check to remove every old ckeditor_(*)_standard-plus.zip files foreach (glob($this->cke_path . '/*.zip') as $filename) { if($this->cke_path . '/' . $this->cke_zipfile != $filename) { @unlink($filename); $is_update = true; } } if ($is_update) { // purge removed files for upgraders to ckeditor v. 4.2 only @unlink($this->cke_path . '/ckeditor/build_config.js'); @unlink($this->cke_path . '/ckeditor/skins/moono/images/mini.png'); } } else { $this->set_config('installer', '1-'.date('Ymd-H:i:s')); return false; } } else { $this->set_config('installer', '0-'.date('Ymd-H:i:s')); // do it again, Sam return false; } // make sure the new versions are set to last_ckeditor_version and last_kcfinder_version $this->updateTableZip(); return true; } function uninstall(&$propbag) { // todo? uninstall old instances which may be in there, caused by a duplicating bug using installer fallback without right instance in 2.3.2 for one day online } function introspect(&$propbag) { global $serendipity; $propbag->add('name', PLUGIN_EVENT_CKEDITOR_NAME); $propbag->add('description', PLUGIN_EVENT_CKEDITOR_DESC); $propbag->add('stackable', false); $propbag->add('author', 'Rustam Abdullaev, Ian'); $propbag->add('version', '3.3.1'); // is CKEDITOR Series 4 (hidden) - revision .3.3 - and appended plugin revision .0 $propbag->add('copyright', 'GPL or LGPL License'); $propbag->add('requirements', array( 'serendipity' => '1.7', 'smarty' => '3.1.13', 'php' => '5.2.6' )); $propbag->add('event_hooks', array( 'frontend_footer' => true, 'backend_header' => true, 'css_backend' => true, 'external_plugin' => true, 'backend_plugins_update' => true, 'backend_media_path_exclude_directories' => true, 'backend_wysiwyg' => true, 'backend_wysiwyg_finish' => true )); $propbag->add('configuration', array('path', 'plugpath', 'codebutton', 'prettify', 'kcfinder', 'acf_off', 'toolbar_break', 'force_install')); $propbag->add('groups', array('BACKEND_EDITOR')); } function introspect_config_item($name, &$propbag) { global $serendipity; switch($name) { case 'path': $propbag->add('type', 'string'); $propbag->add('name', INSTALL_RELPATH); $propbag->add('description', PLUGIN_EVENT_CKEDITOR_OPTION_BLAHBLAH . '"plugins/serendipity_event_ckeditor/ckeditor/"'); $propbag->add('default', 'plugins/serendipity_event_ckeditor/ckeditor/'); break; case 'plugpath': $propbag->add('type', 'string'); $propbag->add('name', PLUGIN_EVENT_CKEDITOR_INSTALL_PLUGPATH); $propbag->add('description', PLUGIN_EVENT_CKEDITOR_OPTION_BLAHBLAH . '"' . $serendipity['serendipityHTTPPath'] . 'plugins/"'); $propbag->add('default', $serendipity['serendipityHTTPPath'] . 'plugins/'); break; case 'codebutton': $propbag->add('type', 'boolean'); $propbag->add('name', PLUGIN_EVENT_CKEDITOR_CODEBUTTON_OPTION); $propbag->add('description', ''); $propbag->add('default', 'false'); break; case 'prettify': $propbag->add('type', 'boolean'); $propbag->add('name', PLUGIN_EVENT_CKEDITOR_PRETTIFY_OPTION); $propbag->add('description', PLUGIN_EVENT_CKEDITOR_PRETTIFY_OPTION_BLAHBLAH); $propbag->add('default', 'false'); break; case 'kcfinder': $propbag->add('type', 'boolean'); $propbag->add('name', PLUGIN_EVENT_CKEDITOR_KCFINDER_OPTION); $propbag->add('description', PLUGIN_EVENT_CKEDITOR_KCFINDER_OPTION_BLAHBLAH); $propbag->add('default', 'false'); break; case 'acf_off': $propbag->add('type', 'boolean'); $propbag->add('name', PLUGIN_EVENT_CKEDITOR_CKEACF_OPTION); $propbag->add('description', PLUGIN_EVENT_CKEDITOR_CKEACF_OPTION_BLAHBLAH); $propbag->add('default', 'false'); break; case 'toolbar_break': $propbag->add('type', 'boolean'); $propbag->add('name', PLUGIN_EVENT_CKEDITOR_TOOLBAR_OPTION); $propbag->add('description', ''); $propbag->add('default', 'true'); break; case 'force_install': $propbag->add('type', 'boolean'); $propbag->add('name', PLUGIN_EVENT_CKEDITOR_FORCEINSTALL_OPTION); $propbag->add('description', PLUGIN_EVENT_CKEDITOR_FORCEINSTALL_OPTION_BLAHBLAH . $this->cke_zipfile); $propbag->add('default', 'false'); break; default: return false; } return true; } function generate_content(&$title) { $title = $this->title; } function example() { $s = ''; if (serendipity_db_bool($this->get_config('force_install'))) { $this->forceZipInstall = true; $this->install(); $this->forceZipInstall = false; $this->set_config('force_install', 'false'); // forceZipInstall forces to surround the checkUpdate function, thus we set config database table to keep track $this->updateTableZip(); $s .= '
Force deflate done: Please reload this page here!
'; } $installer = $this->get_config('installer'); // Can't use method return value in write context in '' with substr(), get_config() and isset() $parts = explode(':', $this->checkUpdateVersion[0]); // this is ckeditor only $s .= PLUGIN_EVENT_CKEDITOR_REVISION_TITLE; $s .= "\nCheck Plugin Update Message: NO CONFIG SET OR NO MATCH -> config_set: "last_'.$parts[0].'_version:'. $parts[1].'"
'; break; case '3': $s .= 'Installer Update Message: Check Update found false, no unpack needed. Plugin upgrade successfully done or has been triggered to be checked by an other Spartacus Plugin update!
'; break; case '2': $s .= 'Installer Message: Extracting the zip to ' . $this->cke_path . ' directory done!
'; break; case '1': $s .= ' Installer Error[1]: Extracting the zip to ' . $this->cke_path . ' directory failed!
Please extract ' . $this->cke_zipfile . ' by hand.
Installer Error[0]: Due to a writing permission error, extracting the zip to ' . $this->cke_path . ' directory failed!
Please set "/plugins" or "/plugins/serendipity_event_ckeditor" directory and files correct writing permissions and extract ' . $this->cke_zipfile . ' by hand or try again and remove(!) this plugin from your plugin list and install it again.