当前位置: 首页>>代码示例>>PHP>>正文


PHP Hook::CallHooks方法代码示例

本文整理汇总了PHP中Hook::CallHooks方法的典型用法代码示例。如果您正苦于以下问题:PHP Hook::CallHooks方法的具体用法?PHP Hook::CallHooks怎么用?PHP Hook::CallHooks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Hook的用法示例。


在下文中一共展示了Hook::CallHooks方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: shutdown

 public function shutdown()
 {
     global $gEnv;
     if ($this->state != Ampoliros::STATE_SETUP) {
         import('com.solarix.ampoliros.util.Hook');
         $reg = Registry::instance();
         $hook = new Hook($reg->getEntry('amp.root.db'), 'ampoliros', 'instance');
         switch ($hook->CallHooks('shutdown', $null, '')) {
             case Hook::RESULT_ABORT:
                 $this->abort('Shutdown aborted');
                 break;
         }
     }
     switch ($this->state) {
         case Ampoliros::STATE_DEBUG:
             if (is_object($gEnv['runtime']['debug']['loadtime'])) {
                 $gEnv['runtime']['debug']['loadtime']->Mark('end');
                 if (function_exists('memory_get_usage')) {
                     $gEnv['runtime']['debug']['memoryusage'] = memory_get_usage();
                 }
                 import('com.solarix.ampoliros.io.log.Logger');
                 $log = new Logger($gEnv['root']['log']);
                 $log->LogEvent('ampoliros', 'Profiler total time: ' . $gEnv['runtime']['debug']['loadtime']->GetTotalTime(), LOGGER_DEBUG);
                 if ($fh = @fopen(TMP_PATH . 'pids/' . $this->pid, 'w')) {
                     $defined_functions = get_defined_functions();
                     @fwrite($fh, serialize(array('gEnv' => $gEnv, 'classes' => get_declared_classes(), 'functions' => $defined_functions['user'], 'extensions' => get_loaded_extensions(), 'includedfiles' => get_included_files())));
                     @fclose($fh);
                 }
             }
             break;
     }
     if ($this->state != Ampoliros::STATE_DEBUG and file_exists(TMP_PATH . 'pids/' . $this->pid)) {
         @unlink(TMP_PATH . 'pids/' . $this->pid);
     }
     $carthag = Carthag::instance();
     $carthag->halt();
 }
开发者ID:alexpagnoni,项目名称:ampoliros,代码行数:37,代码来源:Ampoliros.php

示例2: removeGroup

 public function removeGroup($deleteuserstoo)
 {
     $result = false;
     import('com.solarix.ampoliros.util.Hook');
     $hook = new Hook($this->mrAmpDb, 'ampoliros', 'site.group.remove');
     if ($hook->CallHooks('calltime', $this, array('siteserial' => $this->siteserial, 'groupid' => $this->groupid)) == HOOK_RESULT_OK) {
         if ($this->groupid != 0) {
             if ($this->mrSiteDb->Execute('DELETE FROM groups ' . 'WHERE id=' . (int) $this->groupid)) {
                 // Check if we must delete users in this group
                 if ($deleteuserstoo == true) {
                     $usersquery =& $this->mrAmpDb->Execute('SELECT id ' . 'FROM users ' . 'WHERE siteid=' . (int) $this->siteserial . ' AND groupid=' . (int) $this->groupid);
                     $numusers = $usersquery->NumRows();
                     if ($numusers > 0) {
                         // Remove users in this group
                         while (!$usersquery->eof) {
                             $usdata = $usersquery->Fields();
                             Carthag::import('com.solarix.ampoliros.site.user.User');
                             $tmpuser = new user($this->mrAmpDb, $this->siteserial, $usdata['id']);
                             $tmpuser->removeuser();
                             $usersquery->MoveNext();
                             //delete $tmpuser;
                         }
                     }
                 } else {
                     $this->mrAmpDb->Execute("UPDATE users SET groupid = '0' WHERE groupid=" . (int) $this->groupid . ' AND siteid =' . $this->siteserial);
                 }
                 if ($hook->CallHooks('groupremoved', $this, array('siteserial' => $this->siteserial, 'groupid' => $this->groupid)) != HOOK_RESULT_OK) {
                     $result = false;
                 }
                 $this->groupid = 0;
             }
         } else {
             import('com.solarix.ampoliros.io.log.Logger');
             $log = new Logger(AMP_LOG);
             $log->LogEvent('ampoliros.users_library.group_class.removegroup', "Attempted to call a member of an object that doesn't refer to any group", LOGGER_ERROR);
         }
     }
     return $result;
 }
开发者ID:alexpagnoni,项目名称:ampoliros,代码行数:39,代码来源:Group.php

示例3: removeUser

 public function removeUser()
 {
     import('com.solarix.ampoliros.util.Hook');
     $hook = new Hook($this->mrAmpDb, 'ampoliros', 'site.user.remove');
     if ($hook->CallHooks('calltime', $this, array('siteserial' => $this->siteserial, 'userid' => $this->userid)) == HOOK_RESULT_OK) {
         if ($this->userid != 0) {
             $result = $this->mrAmpDb->Execute('DELETE FROM users ' . 'WHERE siteid=' . (int) $this->siteserial . ' ' . 'AND id=' . (int) $this->userid);
             // Remove user dir
             $site_query =& $GLOBALS['gEnv']['root']['db']->Execute('SELECT siteid ' . 'FROM sites ' . 'WHERE id=' . (int) $this->siteserial);
             OpenLibrary('misc.library');
             if (SITESTUFF_PATH . $site_query->Fields('siteid') . '/users/' . $this->username != SITESTUFF_PATH . $site_query->Fields('siteid') . '/users/') {
                 RecRemoveDir(SITESTUFF_PATH . $site_query->Fields('siteid') . '/users/' . $this->username, 0755);
             }
             // Remove cached items
             Carthag::import('com.solarix.ampoliros.datatransfer.cache.CacheGarbageCollector');
             $cache_gc = new CacheGarbageCollector();
             $cache_gc->RemoveUserItems((int) $this->userid);
             //$this->htp->remuser( $this->username );
             if ($hook->CallHooks('userremoved', $this, array('siteserial' => $this->siteserial, 'userid' => $this->userid)) != HOOK_RESULT_OK) {
                 $result = false;
             }
             $this->userid = 0;
         }
     }
     return $result;
 }
开发者ID:alexpagnoni,项目名称:ampoliros,代码行数:26,代码来源:User.php

示例4: Disable

 function Disable($siteid)
 {
     $result = FALSE;
     import('com.solarix.ampoliros.util.Hook');
     $hook = new Hook($this->ampdb, 'ampoliros', 'module.disable');
     if ($hook->CallHooks('calltime', $this, array('siteserial' => $siteid, 'modserial' => $this->serial)) == HOOK_RESULT_OK) {
         if ($this->serial) {
             // Checks if the module exists in modules table
             //
             $modquery =& $this->ampdb->Execute('SELECT * FROM modules WHERE id=' . (int) $this->serial);
             if ($modquery->NumRows() == 1) {
                 $moddata = $modquery->Fields();
                 if ($moddata['onlyextension'] != $this->ampdb->fmttrue) {
                     // Checks if the structure file still exists
                     //
                     if (file_exists(MODULE_PATH . $moddata['modid'] . '/' . Module::STRUCTURE_FILE)) {
                         $this->modname = $moddata['modid'];
                         $sitequery = $this->ampdb->Execute('SELECT * FROM sites WHERE id=' . $this->ampdb->Format_Text((int) $siteid));
                         $sitedata = $sitequery->Fields();
                         $args['dbtype'] = $sitedata['sitedbtype'];
                         $args['dbname'] = $sitedata['sitedbname'];
                         $args['dbhost'] = $sitedata['sitedbhost'];
                         $args['dbport'] = $sitedata['sitedbport'];
                         $args['dbuser'] = $sitedata['sitedbuser'];
                         $args['dbpass'] = $sitedata['sitedbpassword'];
                         $args['dblog'] = $sitedata['sitedblog'];
                         import('com.solarix.ampoliros.db.DBLayerFactory');
                         $db_fact = new DBLayerFactory();
                         $this->sitedb = $db_fact->NewDBLayer($args);
                         $this->sitedb->Connect($args);
                         // Dependencies check
                         //
                         $this->unmetdeps = array();
                         $this->unmetsuggs = array();
                         $moddeps = new ModuleDep($this->ampdb);
                         $pendingdeps = $moddeps->CheckSiteDependingModules($this->modname, $sitedata['siteid'], FALSE);
                         $modenabled = $moddeps->IsEnabled($this->modname, $sitedata['siteid']);
                         // If dependencies are ok, go on
                         //
                         if ($pendingdeps == FALSE and $modenabled == TRUE) {
                             $result = $this->HandleStructure(MODULE_PATH . $moddata['modid'] . '/' . Module::STRUCTURE_FILE, Module::INSTALL_MODE_DISABLE, MODULE_PATH . $moddata['modid'] . '/', $siteid);
                             $modquery = $this->ampdb->Execute('SELECT id FROM modules WHERE modid=' . $this->ampdb->Format_Text($this->modname));
                             $this->ampdb->Execute('DELETE FROM activemodules WHERE moduleid=' . (int) $this->serial . ' AND siteid=' . $this->ampdb->Format_Text($siteid));
                             $this->ampdb->Execute('DELETE FROM disabledsubmodules WHERE moduleid=' . (int) $this->serial . ' AND siteid=' . (int) $siteid);
                             if ($GLOBALS['gEnv']['core']['config']->Value('ALERT_ON_MODULE_SITE_OPERATION') == '1') {
                                 Carthag::import('com.solarix.ampoliros.security.SecurityLayer');
                                 $amp_security = new SecurityLayer();
                                 $amp_security->SendAlert('Module ' . $moddata['modid'] . ' has been disabled from site ' . $sitedata['siteid']);
                                 unset($amp_security);
                             }
                             if ($hook->CallHooks('moduledisabled', $this, array('siteserial' => $siteid, 'modserial' => $this->serial)) != HOOK_RESULT_OK) {
                                 $result = false;
                             }
                         } else {
                             if ($modenabled == FALSE) {
                             } else {
                                 $this->unmetdeps = $pendingdeps;
                             }
                         }
                         //if ( $result == TRUE ) $this->mLog->LogEvent( 'Ampoliros', 'Uninstalled module '.$this->modname, LOGGER_NOTICE );
                         $sitequery->Free();
                     } else {
                         import('com.solarix.ampoliros.io.log.Logger');
                         $log = new Logger(AMP_LOG);
                         $log->LogEvent('ampoliros.modules_library.modules_class.disable', 'Structure file ' . MODULE_PATH . $moddata['modid'] . '/' . Module::STRUCTURE_FILE . ' for module ' . $moddata['modid'] . ' was not found', LOGGER_ERROR);
                     }
                 } else {
                     import('com.solarix.ampoliros.io.log.Logger');
                     $log = new Logger(AMP_LOG);
                     $log->LogEvent('ampoliros.modules_library.modules_class.disable', 'Tried to disable module ' . $moddata['modid'] . ', but it is an extension only module', LOGGER_ERROR);
                 }
             } else {
                 import('com.solarix.ampoliros.io.log.Logger');
                 $log = new Logger(AMP_LOG);
                 $log->LogEvent('ampoliros.modules_library.modules_class.disable', 'A module with serial ' . $this->serial . ' was not found in modules table', LOGGER_ERROR);
             }
             $modquery->Free();
         } else {
             import('com.solarix.ampoliros.io.log.Logger');
             $log = new Logger(AMP_LOG);
             $log->LogEvent('ampoliros.modules_library.modules_class.disable', 'Empty module serial', LOGGER_ERROR);
         }
     }
     return $result;
 }
开发者ID:alexpagnoni,项目名称:ampoliros,代码行数:85,代码来源:Module.php

示例5: Rename

 function Rename($profileName)
 {
     $result = false;
     $hook = new Hook($this->mAmpDb, 'ampoliros', 'xmlrpcprofile.rename');
     if ($hook->CallHooks('calltime', $this, array('name' => $profileName)) == HOOK_RESULT_OK) {
         if ($this->mAmpDb) {
             if ($this->mProfileId) {
                 if (strlen($profileName)) {
                     // Removes the profile
                     //
                     $result = $this->mAmpDb->Execute('UPDATE xmlrpcprofiles ' . 'SET profilename=' . $this->mAmpDb->Format_Text($profileName) . ' ' . 'WHERE id=' . (int) $this->mProfileId);
                     $hook->CallHooks('profilerenamed', $this, array('name' => $profileName));
                 } else {
                     $this->mLog->LogEvent('ampoliros.xmlrpc_library.xmlrpcprofile_class.rename', 'Empty new profile name', LOGGER_ERROR);
                 }
             } else {
                 $this->mLog->LogEvent('ampoliros.xmlrpc_library.xmlrpcprofile_class.rename', 'Object not assigned to a profile', LOGGER_ERROR);
             }
         } else {
             $this->mLog->LogEvent('ampoliros.xmlrpc_library.xmlrpcprofile_class.rename', 'Invalid Ampoliros database handler', LOGGER_ERROR);
         }
     }
     return $result;
 }
开发者ID:alexpagnoni,项目名称:ampoliros,代码行数:24,代码来源:XmlRpcProfile.php

示例6: Update

 function Update($name, $host = 'localhost', $port = '80', $cgi = '', $username = '', $password = '', $proxy = '', $proxyPort = '')
 {
     $result = false;
     $hook = new Hook($this->mrAmpDb, 'ampoliros', 'xmlrpcaccount.update');
     if ($hook->CallHooks('calltime', $this, array('name' => $name, 'host' => $host, 'port' => $port, 'cgi' => $cgi, 'username' => $username, 'password' => $password)) == HOOK_RESULT_OK) {
         if ($this->mId) {
             if (strlen($name)) {
                 $result =& $this->mrAmpDb->Execute('UPDATE xmlrpcaccounts ' . 'SET ' . 'name=' . $this->mrAmpDb->Format_Text($name) . ',' . 'host=' . $this->mrAmpDb->Format_Text($host) . ',' . 'cgi=' . $this->mrAmpDb->Format_Text($cgi) . ',' . 'port=' . $this->mrAmpDb->Format_Text($port) . ',' . 'username=' . $this->mrAmpDb->Format_Text($username) . ',' . 'password=' . $this->mrAmpDb->Format_Text($password) . ',' . 'proxy=' . $this->mrAmpDb->Format_Text($proxy) . ',' . 'proxyport=' . $this->mrAmpDb->Format_Text($proxyPort) . ' ' . 'WHERE id=' . (int) $this->mId);
                 if ($result) {
                     if ($hook->CallHooks('accountudpated', $this, array('name' => $name, 'host' => $host, 'port' => $port, 'cgi' => $cgi, 'username' => $username, 'password' => $password, 'id' => $this->mId)) != HOOK_RESULT_OK) {
                         $result = false;
                     }
                 } else {
                     $result = AMPOLIROS_XMLRPCACCOUNT_UPDATE_UNABLE_TO_UPDATE_ACCOUNT;
                 }
             } else {
                 $result = AMPOLIROS_XMLRPCACCOUNT_UPDATE_EMPTY_ACCOUNT_NAME;
             }
         } else {
             $result = AMPOLIROS_XMLRPCACCOUNT_REMOVE_EMPTY_ACCOUNT_ID;
         }
     }
     return $result;
 }
开发者ID:alexpagnoni,项目名称:ampoliros,代码行数:24,代码来源:XmlRpcAccount.php

示例7: disableModule

 public function disableModule($modid)
 {
     $result = false;
     $hook = new Hook($this->ampdb, 'ampoliros', 'site.module.disable');
     if ($hook->CallHooks('calltime', $this, array('siteserial' => $this->siteserial, 'modid' => $modid)) == HOOK_RESULT_OK) {
         if (!empty($this->sitedb) and !empty($modid) and $this->IsModuleEnabled($modid)) {
             OpenLibrary('modulesbase.library');
             $modquery =& $this->ampdb->Execute('SELECT modid ' . 'FROM modules ' . 'WHERE id=' . (int) $modid);
             $tmpmod = new Module($this->ampdb, $modid);
             if ($tmpmod->Disable($this->siteserial)) {
                 if ($hook->CallHooks('moduledisabled', $this, array('siteserial' => $this->siteserial, 'modid' => $modid)) == HOOK_RESULT_OK) {
                     $result = true;
                 }
                 import('com.solarix.ampoliros.io.log.Logger');
                 $log = new Logger(AMP_LOG);
                 $log->LogEvent($this->siteid, 'Disabled module ' . $modquery->Fields('modid'), LOGGER_NOTICE);
                 $this->sitelog->LogEvent($this->siteid, 'Disabled module ' . $modquery->Fields('modid'), LOGGER_NOTICE);
             }
             $this->unmetdeps = $tmpmod->GetLastActionUnmetDeps();
         }
     }
     return $result;
 }
开发者ID:alexpagnoni,项目名称:ampoliros,代码行数:23,代码来源:Site.php


注:本文中的Hook::CallHooks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。