var iScroll = Math.floor(\$('#new_config')[0].scrollHeight * ({$iLine} - 20) / {$iTotalLines}); \$('#new_config').scrollTop(iScroll); EOF ); $sMessage = Dict::Format('config-parse-error', $sMessage, $sLine); throw new Exception($sMessage); } else { // Note: sNoise is an html output, but so far it was ok for me (e.g. showing the entire call stack) throw new Exception('Syntax error in configuration file: <tt>' . $sNoise . '</tt>'); } } } ///////////////////////////////////////////////////////////////////// // Main program // LoginWebPage::DoLogin(true); // Check user rights and prompt if needed (must be admin) //$sOperation = utils::ReadParam('operation', 'menu'); //$oAppContext = new ApplicationContext(); $oP = new iTopWebPage(Dict::S('config-edit-title')); $oP->set_base(utils::GetAbsoluteUrlAppRoot() . 'pages/'); try { $sOperation = utils::ReadParam('operation', ''); $oP->add("<h1>" . Dict::S('config-edit-title') . "</h1>"); if (MetaModel::GetConfig()->Get('demo_mode')) { $oP->add("<div class=\"header_message message_info\">Sorry, iTop is in <b>demonstration mode</b>: the configuration file cannot be edited.</div>"); } else { $oP->add_style(<<<EOF textarea { \t-webkit-box-sizing: border-box; \t-moz-box-sizing: border-box;
public static function SetLoginFailedMessage($sMessage) { self::$m_sLoginFailedMessage = $sMessage; }
// along with iTop. If not, see <http://www.gnu.org/licenses/> /** * Handles various ajax requests * * @copyright Copyright (C) 2010-2012 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/webpage.class.inc.php'; require_once APPROOT . '/application/ajaxwebpage.class.inc.php'; try { require_once APPROOT . '/application/startup.inc.php'; // require_once(APPROOT.'/application/user.preferences.class.inc.php'); require_once APPROOT . '/application/loginwebpage.class.inc.php'; LoginWebPage::DoLogin(false, true); // Check user rights and prompt if needed $oPage = new ajax_page(""); $oPage->no_cache(); $sOperation = utils::ReadParam('operation', ''); switch ($sOperation) { case 'add': $aResult = array('error' => '', 'att_id' => 0, 'preview' => 'false', 'msg' => ''); $sObjClass = stripslashes(utils::ReadParam('obj_class', '', false, 'class')); $sTempId = utils::ReadParam('temp_id', ''); if (empty($sObjClass)) { $aResult['error'] = "Missing argument 'obj_class'"; } elseif (empty($sTempId)) { $aResult['error'] = "Missing argument 'temp_id'"; } else { try {
ReportErrorAndUsage("Invalid OQL query: '{$sExpression}'.\n" . $e->getMessage()); } catch (OQLException $e) { ReportErrorAndExit("Invalid OQL query: '{$sExpression}'.\n" . $e->getMessage()); } catch (Exception $e) { ReportErrorAndExit($e->getMessage()); } exit; } ///////////////////////////////////////////////////////////////////////////// // // Web Server mode // ///////////////////////////////////////////////////////////////////////////// try { require_once APPROOT . '/application/loginwebpage.class.inc.php'; LoginWebPage::DoLogin(); // Check user rights and prompt if needed ApplicationContext::SetUrlMakerClass('iTopStandardURLMaker'); // Main parameters $sExpression = utils::ReadParam('expression', null, true, 'raw_data'); $sQueryId = utils::ReadParam('query', null, true, 'raw_data'); $sFormat = utils::ReadParam('format', null, true); $sFileName = utils::ReadParam('filename', '', true, 'string'); $bInteractive = utils::ReadParam('interactive', false); $sMode = utils::ReadParam('mode', ''); if ($bInteractive) { InteractiveShell($sExpression, $sQueryId, $sFormat, $sFileName, $sMode); } else { $oExporter = CheckParameters($sExpression, $sQueryId, $sFormat); $sMimeType = $oExporter->GetMimeType(); if ($sMimeType == 'text/html') {
if ($bPortal) { $sUrl .= 'portal/'; } else { $sUrl .= 'pages/UI.php'; } if (isset($_SESSION['auth_user'])) { $sAuthUser = $_SESSION['auth_user']; UserRights::Login($sAuthUser); // Set the user's language } $sLoginMode = isset($_SESSION['login_mode']) ? $_SESSION['login_mode'] : ''; LoginWebPage::ResetSession(); switch ($sLoginMode) { case 'cas': $sCASLogoutUrl = MetaModel::GetConfig()->Get('cas_logout_redirect_service'); if (empty($sCASLogoutUrl)) { $sCASLogoutUrl = $sUrl; } utils::InitCASClient(); phpCAS::logoutWithRedirectService($sCASLogoutUrl); // Redirects to the CAS logout page break; } $oPage = LoginWebPage::NewLoginWebPage(); $oPage->no_cache(); $oPage->DisplayLoginHeader(); $oPage->add("<div id=\"login\">\n"); $oPage->add("<h1>" . Dict::S('UI:LogOff:ThankYou') . "</h1>\n"); $oPage->add("<p><a href=\"{$sUrl}\">" . Dict::S('UI:LogOff:ClickHereToLoginAgain') . "</a></p>"); $oPage->add("</div>\n"); $oPage->output();
// along with iTop. If not, see <http://www.gnu.org/licenses/> /** * Handles various ajax requests * * @copyright Copyright (C) 2010-2012 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/webpage.class.inc.php'; require_once APPROOT . '/application/ajaxwebpage.class.inc.php'; try { require_once APPROOT . '/application/startup.inc.php'; // require_once(APPROOT.'/application/user.preferences.class.inc.php'); require_once APPROOT . '/application/loginwebpage.class.inc.php'; LoginWebPage::DoLoginEx(null, false); $oPage = new ajax_page(""); $oPage->no_cache(); $sOperation = utils::ReadParam('operation', ''); switch ($sOperation) { case 'add': $aResult = array('error' => '', 'att_id' => 0, 'preview' => 'false', 'msg' => ''); $sObjClass = stripslashes(utils::ReadParam('obj_class', '', false, 'class')); $sTempId = utils::ReadParam('temp_id', ''); if (empty($sObjClass)) { $aResult['error'] = "Missing argument 'obj_class'"; } elseif (empty($sTempId)) { $aResult['error'] = "Missing argument 'temp_id'"; } else { try { $oDoc = utils::ReadPostedDocument('file');
{ $this->operations[] = array('verb' => $sVerb, 'description' => $sDescription, 'extension' => $sServiceProviderClass); } } //////////////////////////////////////////////////////////////////////////////// // // Main // $oP = new ajax_page('rest'); $sVersion = utils::ReadParam('version', null, false, 'raw_data'); $sOperation = utils::ReadParam('operation', null); $sJsonString = utils::ReadParam('json_data', null, false, 'raw_data'); $sProvider = ''; try { utils::UseParamFile(); $iRet = LoginWebPage::DoLogin(false, false, LoginWebPage::EXIT_RETURN); // Starting with iTop 2.2.0 portal users are no longer allowed to access the REST/JSON API if ($iRet != LoginWebPage::EXIT_CODE_OK) { switch ($iRet) { case LoginWebPage::EXIT_CODE_MISSINGLOGIN: throw new Exception("Missing parameter 'auth_user'", RestResult::MISSING_AUTH_USER); break; case LoginWebPage::EXIT_CODE_MISSINGPASSWORD: throw new Exception("Missing parameter 'auth_pwd'", RestResult::MISSING_AUTH_PWD); break; case LoginWebPage::EXIT_CODE_WRONGCREDENTIALS: throw new Exception("Invalid login", RestResult::UNAUTHORIZED); break; case LoginWebPage::EXIT_CODE_PORTALUSERNOTAUTHORIZED: throw new Exception("Portal user is not allowed", RestResult::UNAUTHORIZED); break;
* * Main user interface page, starts here * * ***********************************************************************************/ try { require_once '../approot.inc.php'; require_once APPROOT . '/application/application.inc.php'; require_once APPROOT . '/application/itopwebpage.class.inc.php'; require_once APPROOT . '/application/wizardhelper.class.inc.php'; require_once APPROOT . '/application/startup.inc.php'; $operation = utils::ReadParam('operation', ''); $oKPI = new ExecutionKPI(); $oKPI->ComputeAndReport('Data model loaded'); $oKPI = new ExecutionKPI(); require_once APPROOT . '/application/loginwebpage.class.inc.php'; $sLoginMessage = LoginWebPage::DoLogin(); // Check user rights and prompt if needed $oAppContext = new ApplicationContext(); $oKPI->ComputeAndReport('User login'); $oP = new iTopWebPage(Dict::S('UI:WelcomeToITop')); $oP->SetMessage($sLoginMessage); // All the following actions use advanced forms that require more javascript to be loaded switch ($operation) { case 'new': // Form to create a new object // Form to create a new object case 'modify': // Form to modify an object // Form to modify an object case 'apply_new': // Creation of a new object