/** * Generic delete handler for an object. * * @return array|boolean The Object Data. */ public function delete() { if ($this->hasID()) { if (!$this->deletePreProcess()) { return false; } $res = DBUtil::deleteObjectById($this->_objType, $this->_objData[$this->_objField], $this->_objField); if ($res) { $this->deletePostProcess(); return $this->_objData; } } return false; }
/** * Generic delete handler for an object. * * @return array|boolean The Object Data. */ public function delete() { if (!$this->deletePreProcess()) { return false; } $res = true; foreach ($this->_objData as $k => $v) { $res = $res && DBUtil::deleteObjectById($this->_objType, $v[$this->_objField], $this->_objField); } if ($res) { $this->deletePostProcess(); return $this->_objData; } return false; }
public function delmodule($args) { $this->throwForbiddenUnless(SecurityUtil::checkPermission('Scribite::', '::', ACCESS_ADMIN), LogUtil::getErrorMsgPermission()); // Argument check if (!isset($args['mid'])) { return LogUtil::registerError($this->__('Error! Could not do what you wanted. Please check your input.')); } // check for existing module if (!DBUtil::deleteObjectById('scribite', $args['mid'], 'mid')) { return LogUtil::registerError($this->__('Configuration not updated')); } return true; }
public function upgrade($oldversion) { switch ($oldversion) { case '1.0': // no changes made // no changes made case '1.1': // delete old paths $this->delVar('xinha_path'); $this->delVar('tinymce_path'); // set new path $this->setVar('editors_path', 'javascript/scribite_editors'); case '1.2': if (!DBUtil::createTable('scribite')) { return false; } // create the default data for the module scribite_defaultdata(); // del old module vars $this->delVar('editor'); $this->delVar('editor_activemodules'); case '1.21': // create new values $this->setVar('openwysiwyg_barmode', 'full'); $this->setVar('openwysiwyg_width', '400'); $this->setVar('openwysiwyg_height', '300'); $this->setVar('xinha_statusbar', 1); case '1.3': // create new values $this->setVar('openwysiwyg_barmode', 'full'); $this->setVar('openwysiwyg_width', '400'); $this->setVar('openwysiwyg_height', '300'); $this->setVar('xinha_statusbar', 1); case '2.0': // create new values $this->setVar('DefaultEditor', '-'); $this->setVar('nicedit_fullpanel', 1); // fill some vars with defaults if (!$this->getVar('xinha_converturls')) { $this->setVar('xinha_converturls', 1); } if (!$this->getVar('xinha_showloading')) { $this->setVar('xinha_showloading', 1); } if (!$this->getVar('xinha_activeplugins')) { $this->setVar('xinha_activeplugins', 'a:2:{i:0;s:7:"GetHtml";i:1;s:12:"SmartReplace";}'); } if (!$this->getVar('tinymce_activeplugins')) { $this->setVar('tinymce_activeplugins', ''); } if (!$this->getVar('fckeditor_autolang')) { $this->setVar('fckeditor_autolang', 1); } //create new module vars for crpCalendar $item = array('modname' => 'crpCalendar', 'modfuncs' => 'a:2:{i:0;s:3:"new";i:1;s:6:"modify";}', 'modareas' => 'a:1:{i:0;s:22:"crpcalendar_event_text";}', 'modeditor' => '-'); if (!DBUtil::insertObject($item, 'scribite', false, 'mid')) { LogUtil::registerError($this->__('Error! Could not update module configuration.')); return '2.0'; } case '2.1': //create new module vars for Content $record = array(array('modname' => 'content', 'modfuncs' => 'a:1:{i:0;s:5:"dummy";}', 'modareas' => 'a:1:{i:0;s:5:"dummy";}', 'modeditor' => '-')); DBUtil::insertObjectArray($record, 'scribite', 'mid'); case '2.2': //create new module vars for Blocks #14 $record = array(array('modname' => 'Blocks', 'modfuncs' => 'a:1:{i:0;s:6:"modify";}', 'modareas' => 'a:1:{i:0;s:14:"blocks_content";}', 'modeditor' => '-')); DBUtil::insertObjectArray($record, 'scribite', 'mid'); // check for Zikula 1.1.x version if (Zikula_Core::VERSION_NUM < '1.1.0') { LogUtil::registerError($this->__('This version from scribite! only works with Zikula 1.1.x and higher. Please upgrade your Zikula version or use scribite! version 2.x .')); return '2.2'; } // create systeminit hook - new in Zikula 1.1.0 if (!ModUtil::registerHook('zikula', 'systeminit', 'GUI', 'scribite', 'user', 'run')) { LogUtil::registerError($this->__('Error creating Hook!')); return '2.2'; } ModUtil::apiFunc('Modules', 'admin', 'enablehooks', array('callermodname' => 'zikula', 'hookmodname' => 'scribite')); LogUtil::registerStatus($this->__('<strong>scribite!</strong> was activated as core hook. You can check settings <a href="index.php?module=Modules&type=admin&func=hooks&id=0">here</a>!<br />The template plugin from previous versions of scribite! can be removed from templates.')); case '3.0': //create new module vars for Newsletter and Web_Links $record = array(array('modname' => 'Newsletter', 'modfuncs' => 'a:1:{i:0;s:11:"add_message";}', 'modareas' => 'a:1:{i:0;s:7:"message";}', 'modeditor' => '-'), array('modname' => 'crpVideo', 'modfuncs' => 'a:2:{i:0;s:3:"new";i:1;s:6:"modify";}', 'modareas' => 'a:1:{i:0;s:13:"video_content";}', 'modeditor' => '-'), array('modname' => 'Web_Links', 'modfuncs' => 'a:3:{i:0;s:8:"linkview";i:1;s:7:"addlink";i:2;s:17:"modifylinkrequest";}', 'modareas' => 'a:1:{i:0;s:11:"description";}', 'modeditor' => '-')); DBUtil::insertObjectArray($record, 'scribite', 'mid'); // set vars for YUI Rich Text Editor if (!$this->getVar('yui_type')) { $this->setVar('yui_type', 'Simple'); } if (!$this->getVar('yui_width')) { $this->setVar('yui_width', 'auto'); } if (!$this->getVar('yui_height')) { $this->setVar('yui_height', '300'); } if (!$this->getVar('yui_dombar')) { $this->setVar('yui_dombar', true); } if (!$this->getVar('yui_animate')) { $this->setVar('yui_animate', true); } if (!$this->getVar('yui_collapse')) { $this->setVar('yui_collapse', true); } case '3.1': // modify Profile module $originalconfig = ModUtil::apiFunc('Scribite', 'user', 'getModuleConfig', array('modulename' => "Profile")); $newconfig = array('mid' => $originalconfig['mid'], 'modulename' => 'Profile', 'modfuncs' => "modify", 'modareas' => "prop_signature,prop_extrainfo,prop_yinterests", 'modeditor' => $originalconfig['modeditor']); $modupdate = ModUtil::apiFunc('Scribite', 'admin', 'editmodule', $newconfig); case '3.2': // set new editors folder $this->setVar('editors_path', 'modules/scribite/pnincludes'); LogUtil::registerStatus($this->__('<strong>Caution!</strong><br />All editors have moved to /modules/scribite/pnincludes in preparation for upcoming features of Zikula. Please check all your settings!<br />If you have adapted files from editors you have to check them too.<br /><br /><strong>Dropped support for FCKeditor and TinyMCE</strong><br />For security reasons these editors will not be supported anymore. Please change editors to an other editor.')); case '4.0': case '4.1': case '4.2': $this->setVar('nicedit_xhtml', 1); case '4.2.1': if (!$this->getVar('ckeditor_language')) { $this->setVar('ckeditor_language', 'en'); } if (!$this->getVar('ckeditor_barmode')) { $this->setVar('ckeditor_barmode', 'Full'); } if (!$this->getVar('ckeditor_width')) { $this->setVar('ckeditor_width', '"70%"'); } if (!$this->getVar('ckeditor_height')) { $this->setVar('ckeditor_height', '400'); } case '4.2.2': // this renames the table and the columns per new z1.3.0 standards $this->renameColumns(); EventUtil::registerPersistentModuleHandler('Scribite', 'core.postinit', array('Scribite_Listeners', 'coreinit')); $this->setVar('editors_path', 'modules/Scribite/includes'); LogUtil::registerStatus($this->__('<strong>Caution!</strong><br />All editors have moved to /modules/Scribite/includes.<br />If you have adapted files from editors you have to check them too.')); case '4.2.3': //set vars for markitup if (!$this->getVar('markitup_width')) { $this->setVar('markitup_width', '650px'); } if (!$this->getVar('markitup_height')) { $this->setVar('markitup_height', '400px'); } // remove fckeditor (was deprecated in 4.1) $this->delVar('fckeditor_language'); $this->delVar('fckeditor_barmode'); $this->delVar('fckeditor_width'); $this->delVar('fckeditor_height'); $this->delVar('fckeditor_autolang'); // update module assignments to correct removed and deprecated editors $dbtable = DBUtil::getTables(); $columns = $dbtable['scribite_column']; $sql = "UPDATE `{$dbtable['scribite']}` SET `{$columns['modeditor']}`='-' WHERE `{$columns['modeditor']}`='fckeditor' OR `{$columns['modeditor']}`='tinymce' OR `{$columns['modeditor']}`='openwysiwyg'"; DBUtil::executeSQL($sql); // reset modules $this->resetModuleConfig('News'); $this->resetModuleConfig('Pages'); $this->resetModuleConfig('ContentExpress'); $this->resetModuleConfig('Mediashare'); // correct possible serialized data corruption if (!DataUtil::is_serialized($this->getVar('xinha_activeplugins'))) { $this->delVar('xinha_activeplugins'); } // relocate xinha styles $this->setVar('xinha_style', 'modules/Scribite/style/xinha/editor.css'); // remove content settings DBUtil::deleteObjectById('scribite', 'content', 'modname'); case '4.3.0': /* reimplement TinyMCE */ // future updates // notice - remove openwysiwyg vars @>4.3.0 } return true; }