public static function OnMetaModelStarted() { try { $oBackupMutex = new iTopMutex('backup.' . utils::GetCurrentEnvironment()); if ($oBackupMutex->TryLock()) { $oBackupMutex->Unlock(); } else { // Not needed: the DB dump is done in a single transaction //MetaModel::GetConfig()->Set('access_mode', ACCESS_READONLY, 'itop-backup'); //MetaModel::GetConfig()->Set('access_message', ' - '.dict::S('bkp-backup-running'), 'itop-backup'); } $oRestoreMutex = new iTopMutex('restore.' . utils::GetCurrentEnvironment()); if ($oRestoreMutex->TryLock()) { $oRestoreMutex->Unlock(); } else { MetaModel::GetConfig()->Set('access_mode', ACCESS_READONLY, 'itop-backup'); MetaModel::GetConfig()->Set('access_message', ' - ' . dict::S('bkp-restore-running'), 'itop-backup'); } } catch (Exception $e) { } }
public static function OnMetaModelStarted() { try { $oBackupMutex = new iTopMutex('backup.' . utils::GetCurrentEnvironment()); if ($oBackupMutex->TryLock()) { $oBackupMutex->Unlock(); } else { // Not needed: the DB dump is done in a single transaction //MetaModel::GetConfig()->Set('access_mode', ACCESS_READONLY, 'itop-backup'); //MetaModel::GetConfig()->Set('access_message', ' - '.dict::S('bkp-backup-running'), 'itop-backup'); } $oRestoreMutex = new iTopMutex('restore.' . utils::GetCurrentEnvironment()); if ($oRestoreMutex->TryLock()) { $oRestoreMutex->Unlock(); } else { IssueLog::Info(__CLASS__ . '::' . __FUNCTION__ . ' A user is trying to use iTop while a restore is running. The requested page is in read-only mode.'); MetaModel::GetConfig()->Set('access_mode', ACCESS_READONLY, 'itop-backup'); MetaModel::GetConfig()->Set('access_message', ' - ' . dict::S('bkp-restore-running'), 'itop-backup'); } } catch (Exception $e) { IssueLog::Error(__CLASS__ . '::' . __FUNCTION__ . ' Failed to check if a backup/restore is running: ' . $e->getMessage()); } }
// /////////////////////////////////////////////////////////////////////////////// try { require_once APPROOT . '/application/startup.inc.php'; require_once APPROOT . '/application/portalwebpage.class.inc.php'; $oAppContext = new ApplicationContext(); $sOperation = utils::ReadParam('operation', ''); require_once APPROOT . '/application/loginwebpage.class.inc.php'; LoginWebPage::DoLogin(false, true); // Check user rights and prompt if needed ApplicationContext::SetUrlMakerClass('MyPortalURLMaker'); $aClasses = explode(',', MetaModel::GetConfig()->Get('portal_tickets')); $sMainClass = trim(reset($aClasses)); if (!class_exists($sMainClass)) { $oP = new WebPage(Dict::S('Portal:Title')); $oP->p(dict::Format('Portal:NoRequestMgmt', UserRights::GetUserFriendlyName())); } else { $oUserOrg = GetUserOrg(); $sCode = $oUserOrg->Get('code'); $sAlternateStylesheet = ''; if (@file_exists("./{$sCode}/portal.css")) { $sAlternateStylesheet = "{$sCode}"; } $oP = new PortalWebPage(Dict::S('Portal:Title'), $sAlternateStylesheet); $oP->EnableDisconnectButton(utils::CanLogOff()); $oP->SetWelcomeMessage(Dict::Format('Portal:WelcomeUserOrg', UserRights::GetUserFriendlyName(), $oUserOrg->GetName())); if (is_object($oUserOrg)) { switch ($sOperation) { case 'show_closed': $oP->set_title(Dict::S('Portal:ShowClosed')); DisplayMainMenu($oP);
* * @copyright Copyright (C) 2013 Combodo SARL * @license http://opensource.org/licenses/AGPL-3.0 */ require_once '../approot.inc.php'; require_once APPROOT . '/application/application.inc.php'; require_once APPROOT . '/application/itopwebpage.class.inc.php'; require_once APPROOT . '/application/startup.inc.php'; require_once APPROOT . '/application/loginwebpage.class.inc.php'; LoginWebPage::DoLogin(true); // Check user rights and prompt if needed (must be admin) // Main program // $oP = new iTopWebPage(Dict::S('Menu:NotificationsMenu+')); $oP->add('<div class="page_header" style="padding:0.5em;">'); $oP->add('<h1>' . dict::S('UI:NotificationsMenu:Title') . '</h1>'); $oP->add('</div>'); $oP->StartCollapsibleSection(Dict::S('UI:NotificationsMenu:Help'), true); $oP->add('<div style="padding: 1em; font-size:10pt;background:#E8F3CF;margin-top: 0.25em;">'); $oP->add('<img src="../images/bell.png" style="margin-top: -60px; margin-right: 10px; float: right;">'); $oP->add(Dict::S('UI:NotificationsMenu:HelpContent')); $oP->add('</div>'); $oP->add(''); $oP->add(''); $oP->EndCollapsibleSection(); $oP->add('<p> </p>'); $oP->AddTabContainer('Tabs_0'); $oP->SetCurrentTabContainer('Tabs_0'); $oP->SetCurrentTab(Dict::S('UI:NotificationsMenu:Triggers')); $oP->add('<h2>' . Dict::S('UI:NotificationsMenu:AvailableTriggers') . '</h2>'); $oFilter = new DBObjectSearch('Trigger');
} $dbname = "dict_word"; $hostname = "localhost"; $username = "******"; $password = "******"; $conn = mysql_connect($hostname, $username, $password); mysql_select_db($dbname, $conn); mysql_query("set names utf8"); $url = "http://www.test.com/"; //你放dictdemo.php的网站地址 ignore_user_abort(); set_time_limit(0); $filename = "./dict_num.txt"; include "dict.class.php"; $data = (include "word_data.php"); $dict = new dict(); if (isset($_GET["num"])) { $key = intval($_GET["num"]); $word = $data[$key]; $result = $dict->content($word); if (empty($result["symbol"]["en"])) { $result = file_put_contents("noword.txt", $word . "\n", FILE_APPEND); //有的个性的单词啥都没有 写入文件中 } else { $symbol = array2string(array_filter($result['symbol'])); $pro = array2string(array_filter($result['pro'])); $example = array2string(array_filter($result['example'])); $explain = array2string(array_filter($result['explain'])); $synonym = array2string(array_filter($result['synonym'])); $phrase = array2string(array_filter($result['phrase'])); echo "<pre>";