/** * Used to setup all core event on system installation. * * @ignore * @return void */ public static function SetupCoreEvents() { $modulename = 'Core'; Events::CreateEvent($modulename, 'LoginPost'); Events::CreateEvent($modulename, 'LogoutPost'); Events::CreateEvent($modulename, 'AddUserPre'); Events::CreateEvent($modulename, 'AddUserPost'); Events::CreateEvent($modulename, 'EditUserPre'); Events::CreateEvent($modulename, 'EditUserPost'); Events::CreateEvent($modulename, 'DeleteUserPre'); Events::CreateEvent($modulename, 'DeleteUserPost'); Events::CreateEvent($modulename, 'AddGroupPre'); Events::CreateEvent($modulename, 'AddGroupPost'); Events::CreateEvent($modulename, 'EditGroupPre'); Events::CreateEvent($modulename, 'EditGroupPost'); Events::CreateEvent($modulename, 'DeleteGroupPre'); Events::CreateEvent($modulename, 'DeleteGroupPost'); Events::CreateEvent($modulename, 'AddStylesheetPre'); Events::CreateEvent($modulename, 'AddStylesheetPost'); Events::CreateEvent($modulename, 'EditStylesheetPre'); Events::CreateEvent($modulename, 'EditStylesheetPost'); Events::CreateEvent($modulename, 'DeleteStylesheetPre'); Events::CreateEvent($modulename, 'DeleteStylesheetPost'); Events::CreateEvent($modulename, 'AddTemplatePre'); Events::CreateEvent($modulename, 'AddTemplatePost'); Events::CreateEvent($modulename, 'EditTemplatePre'); Events::CreateEvent($modulename, 'EditTemplatePost'); Events::CreateEvent($modulename, 'DeleteTemplatePre'); Events::CreateEvent($modulename, 'DeleteTemplatePost'); Events::CreateEvent($modulename, 'TemplatePreCompile'); Events::CreateEvent($modulename, 'TemplatePostCompile'); Events::CreateEvent($modulename, 'AddGlobalContentPre'); Events::CreateEvent($modulename, 'AddGlobalContentPost'); Events::CreateEvent($modulename, 'EditGlobalContentPre'); Events::CreateEvent($modulename, 'EditGlobalContentPost'); Events::CreateEvent($modulename, 'DeleteGlobalContentPre'); Events::CreateEvent($modulename, 'DeleteGlobalContentPost'); Events::CreateEvent($modulename, 'GlobalContentPreCompile'); Events::CreateEvent($modulename, 'GlobalContentPostCompile'); Events::CreateEvent($modulename, 'ContentEditPre'); Events::CreateEvent($modulename, 'ContentEditPost'); Events::CreateEvent($modulename, 'ContentDeletePre'); Events::CreateEvent($modulename, 'ContentDeletePost'); Events::CreateEvent($modulename, 'AddUserDefinedTagPre'); Events::CreateEvent($modulename, 'AddUserDefinedTagPost'); Events::CreateEvent($modulename, 'EditUserDefinedTagPre'); Events::CreateEvent($modulename, 'EditUserDefinedTagPost'); Events::CreateEvent($modulename, 'DeleteUserDefinedTagPre'); Events::CreateEvent($modulename, 'DeleteUserDefinedTagPost'); Events::CreateEvent($modulename, 'ModuleInstalled'); Events::CreateEvent($modulename, 'ModuleUninstalled'); Events::CreateEvent($modulename, 'ModuleUpgraded'); Events::CreateEvent($modulename, 'ContentStylesheet'); Events::CreateEvent($modulename, 'ContentPreCompile'); Events::CreateEvent($modulename, 'ContentPostCompile'); Events::CreateEvent($modulename, 'ContentPostRender'); Events::CreateEvent($modulename, 'SmartyPreCompile'); Events::CreateEvent($modulename, 'SmartyPostCompile'); Events::CreateEvent($modulename, 'ChangeGroupAssignPre'); Events::CreateEvent($modulename, 'ChangeGroupAssignPost'); }
/** * Inform the system about a new event that can be generated * * @final * @param string The name of the event * @returns nothing */ public final function CreateEvent($eventname) { Events::CreateEvent($this->GetName(), $eventname); }
function CreateEvent($inputs) { include "Events.php"; $event = new Events(); $event->CreateEvent($inputs[0]); }
// move all the handlers $q = "UPDATE " . cms_db_prefix() . "event_handlers SET event_id = ? WHERE event_id = ?"; $db->Execute($q, array($id, $event['event_id'])); // then delete the event $q = "DELETE FROM " . cms_db_prefix() . "events WHERE event_id = ?"; $db->Execute($q, array($event['event_id'])); } else { $core_events[] = $event; } } } } echo '[done]</p>'; echo '<p>Creating ChangeGroupAssign events...'; Events::CreateEvent('Core', 'ChangeGroupAssignPre'); Events::CreateEvent('Core', 'ChangeGroupAssignPost'); echo '[done]</p>'; echo '<p>Updating schema version... '; $query = 'UPDATE ' . cms_db_prefix() . 'version SET version = 26'; $db->Execute($query); echo '[done]</p>'; function find_event($arr, $name) { foreach ($arr as $event) { if ($event['event_name'] == $name) { return $event['event_id']; } } return false; } # vim:ts=4 sw=4 noet