/trunk/includes/classes/OIDplusConfigInitializationException.class.php |
---|
46,7 → 46,7 |
$message = '<p>'.$message.'</p><p>Please check the file <b>userdata/baseconfig/config.inc.php</b> or run <b>setup/</b> again</p>'; |
} |
parent::__construct($message, $title); |
parent::__construct($message, $title, 500); |
} |
} |
/trunk/includes/classes/OIDplusException.class.php |
---|
34,11 → 34,18 |
protected $title = null; |
/** |
* @var int |
*/ |
protected $httpStatus = 500; |
/** |
* @param string $message |
* @param string|null $title |
* @param int $httpStatus |
*/ |
public function __construct(string $message, string $title=null) { |
public function __construct(string $message, string $title=null, int $httpStatus=500) { |
$this->title = $title; |
$this->httpStatus = $httpStatus; |
parent::__construct($message); |
} |
50,11 → 57,19 |
} |
/** |
* @return int |
*/ |
public function getHttpStatus(): int { |
return $this->httpStatus; |
} |
/** |
* @return string |
*/ |
public function getHtmlTitle(): string { |
return htmlentities($this->getTitle(), ENT_SUBSTITUTE); // ENT_SUBSTITUTE because ODBC drivers might return ANSI instead of UTF-8 stuff |
} |
/** |
* @return string |
*/ |
/trunk/includes/classes/OIDplusGui.class.php |
---|
49,6 → 49,9 |
} else { |
$out['text'] = '<p>'.$htmlmsg.'</p>'; |
} |
if (isset($_SERVER['SCRIPT_FILENAME']) && (strtolower(basename($_SERVER['SCRIPT_FILENAME'])) !== 'ajax.php')) { // don't send HTTP error codes in ajax.php, because we want a page and not a JavaScript alert box, when someone enters an invalid OID in the GoTo-Box |
if (PHP_SAPI != 'cli') @http_response_code($e instanceof OIDplusException ? $e->getHttpStatus() : 500); |
} |
if (OIDplus::baseConfig()->getValue('DEBUG')) { |
$out['text'] .= self::getExceptionTechInfo($e); |
} |
132,17 → 135,20 |
public static function html_exception_handler(\Throwable $exception) { |
// Note: This method must be static, because of its registration as Exception handler |
if (PHP_SAPI != 'cli') @http_response_code(500); |
if ($exception instanceof OIDplusException) { |
$htmlTitle = $exception->gethtmlTitle(); |
$htmlMessage = $exception->getHtmlMessage(); |
if (isset($_SERVER['SCRIPT_FILENAME']) && (strtolower(basename($_SERVER['SCRIPT_FILENAME'])) !== 'ajax.php')) { // don't send HTTP error codes in ajax.php, because we want a page and not a JavaScript alert box, when someone enters an invalid OID in the GoTo-Box |
if (PHP_SAPI != 'cli') @http_response_code($exception->getHttpStatus()); |
} |
} else { |
$htmlTitle = ''; |
//$htmlMessage = htmlentities($exception->getMessage()); |
$htmlMessage = nl2br(htmlentities(html_to_text($exception->getMessage()))); |
if (isset($_SERVER['SCRIPT_FILENAME']) && (strtolower(basename($_SERVER['SCRIPT_FILENAME'])) !== 'ajax.php')) { // don't send HTTP error codes in ajax.php, because we want a page and not a JavaScript alert box, when someone enters an invalid OID in the GoTo-Box |
if (PHP_SAPI != 'cli') @http_response_code(500); |
} |
} |
if (!$htmlTitle) { |
$htmlTitle = _L('OIDplus Error'); |
} |
/trunk/includes/classes/OIDplusHtmlException.class.php |
---|
42,7 → 42,7 |
* @param string $message |
* @param string|null $title |
*/ |
public function __construct(string $message, string $title=null) { |
public function __construct(string $message, string $title=null, int $httpStatus=500) { |
$this->htmlTitle = $title; |
if ($title) { |
$title = strip_tags($title); |
54,7 → 54,7 |
$this->htmlMessage = $message; |
$message_text = html_to_text($message); |
parent::__construct($message_text, $title_text); |
parent::__construct($message_text, $title_text, $httpStatus); |
} |
/** |
/trunk/includes/classes/OIDplusSQLException.class.php |
---|
30,7 → 30,7 |
* @param string $message |
*/ |
public function __construct(string $sql, string $message) { |
parent::__construct(_L('%1 at query "%2"',$message,$sql)); |
parent::__construct(_L('%1 at query "%2"',$message,$sql), null, 500); |
} |
} |
/trunk/plugins/viathinksoft/adminPages/010_notifications/OIDplusPageAdminNotifications.class.php |
---|
54,15 → 54,15 |
if ($ra_email == 'admin') { |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title'], 401); |
} |
} else if ($ra_email) { |
if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as the requested RA %2.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>'), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as the requested RA %2.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>'), $out['title'], 401); |
} |
} else { |
if ((OIDplus::authUtils()->raNumLoggedIn() == 0) && !OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a>.',OIDplus::gui()->link('oidplus:login')), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a>.',OIDplus::gui()->link('oidplus:login')), $out['title'], 401); |
} |
} |
/trunk/plugins/viathinksoft/adminPages/100_wellknown_oids/OIDplusPageAdminWellKnownOIDs.class.php |
---|
47,7 → 47,7 |
$out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title'], 401); |
} |
$out['text'] = '<p>'._L('Well-known OIDs are OIDs of Registration Authorities which are assigning OIDs to customers, i.e. they are most likely to be used by OIDplus users as their root OID. Well-known OIDs have the following purposes:').'<ol>'; |
/trunk/plugins/viathinksoft/adminPages/110_system_config/OIDplusPageAdminSystemConfig.class.php |
---|
34,7 → 34,7 |
public function action(string $actionID, array $params): array { |
if ($actionID == 'config_update') { |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin'))); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), null, 401); |
} |
_CheckParamExists($params, 'name'); |
84,7 → 84,7 |
$out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title'], 401); |
} |
$output = '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
/trunk/plugins/viathinksoft/adminPages/111_systeminfo/OIDplusPageAdminSysteminfo.class.php |
---|
80,7 → 80,7 |
$out['icon'] = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/php_icon.png'; |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title'], 401); |
} |
$out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:systeminfo').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back to the system information page').'</a></p>'; |
127,7 → 127,7 |
$out['icon'] = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png'; |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title'], 401); |
} |
$out['text'] = ''; |
/trunk/plugins/viathinksoft/adminPages/120_registration/OIDplusPageAdminRegistration.class.php |
---|
100,7 → 100,7 |
$out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title'], 401); |
} |
if (file_exists(__DIR__ . '/info$'.OIDplus::getCurrentLang().'.html')) { |
177,7 → 177,7 |
$out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title'], 401); |
} |
$query = self::QUERY_LIVESTATUS_V1; |
/trunk/plugins/viathinksoft/adminPages/130_create_ra/OIDplusPageAdminCreateRa.class.php |
---|
34,7 → 34,7 |
public function action(string $actionID, array $params): array { |
if ($actionID == 'create_ra') { |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin'))); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), null, 401); |
} |
_CheckParamExists($params, 'email'); |
100,7 → 100,7 |
$out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title'], 401); |
} |
$out['text'] .= '<form id="adminCreateRaFrom" action="javascript:void(0);" onsubmit="return OIDplusPageAdminCreateRa.adminCreateRaFormOnSubmit();">'; |
/trunk/plugins/viathinksoft/adminPages/400_oidinfo_export/OIDplusPageAdminOIDInfoExport.class.php |
---|
47,7 → 47,7 |
if ($actionID == 'import_xml_file') { |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin'))); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), null,401); |
} |
if (!isset($_FILES['userfile'])) { |
80,7 → 80,7 |
} |
} else if ($actionID == 'import_oidinfo_oid') { |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin'))); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), null, 401); |
} |
_CheckParamExists($params, 'oid'); |
194,7 → 194,7 |
$out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title'], 401); |
} |
$query = self::QUERY_LIST_OIDINFO_OIDS_V1; |
465,7 → 465,7 |
$out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title'], 401); |
} |
$query = self::QUERY_LIST_OIDINFO_OIDS_V1; |
601,7 → 601,7 |
$out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title'], 401); |
} |
$out['text'] = '<noscript>'; |
/trunk/plugins/viathinksoft/adminPages/400_oidinfo_export/oidinfo_export.php |
---|
20,6 → 20,7 |
use ViaThinkSoft\OIDplus\OIDplus; |
use ViaThinkSoft\OIDplus\OIDplusException; |
use ViaThinkSoft\OIDplus\OIDplusGui; |
use ViaThinkSoft\OIDplus\OIDplusHtmlException; |
use ViaThinkSoft\OIDplus\OIDplusPageAdminOIDInfoExport; |
require_once __DIR__ . '/../../../../includes/oidplus.inc.php'; |
41,8 → 42,7 |
// echo "You need to log in as administrator.\n"; |
// die(); |
} else { |
echo '<p>'._L('You need to <a %1>log in</a> as administrator.','href="'.OIDplus::webpath(null,OIDplus::PATH_RELATIVE).'?goto=oidplus%3Alogin%24admin"').'</p>'; |
die(); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.','href="'.OIDplus::webpath(null,OIDplus::PATH_RELATIVE).'?goto=oidplus%3Alogin%24admin"'), null, 401); |
} |
} |
/trunk/plugins/viathinksoft/adminPages/500_list_ras/OIDplusPageAdminListRAs.class.php |
---|
80,7 → 80,7 |
$out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title'], 401); |
} |
$out['text'] = ''; |
/trunk/plugins/viathinksoft/adminPages/600_log/OIDplusPageAdminLogEvents.class.php |
---|
46,7 → 46,7 |
$out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title'], 401); |
} |
$res = OIDplus::db()->query("select lo.id, lo.unix_ts, lo.addr, lo.event from ###log lo ". |
/trunk/plugins/viathinksoft/adminPages/700_colors/OIDplusPageAdminColors.class.php |
---|
73,7 → 73,7 |
public function action(string $actionID, array $params): array { |
if ($actionID == 'color_update') { |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin'))); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), null, 401); |
} |
_CheckParamExists($params, 'hue_shift'); |
152,7 → 152,7 |
$out['icon'] = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png'; |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title'], 401); |
} |
$out['text'] = '<br><p>'; |
/trunk/plugins/viathinksoft/adminPages/800_plugins/OIDplusPageAdminPlugins.class.php |
---|
93,7 → 93,7 |
$out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title'], 401); |
} |
if (!is_null($classname)) { |
/trunk/plugins/viathinksoft/adminPages/900_software_update/OIDplusPageAdminSoftwareUpdate.class.php |
---|
59,7 → 59,7 |
@set_time_limit(0); |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin'))); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), null, 401); |
} |
if (OIDplus::getInstallType() === 'git-wc') { |
196,7 → 196,7 |
$out['icon'] = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png'; |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title'], 401); |
} |
$out['text'] .= '<div id="update_versioninfo">'; |
/trunk/plugins/viathinksoft/adminPages/901_vnag_version_check/OIDplusPageAdminVNagVersionCheck.class.php |
---|
68,7 → 68,7 |
$out['icon'] = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png'; |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title'], 401); |
} |
if (file_exists(__DIR__ . '/tutorial$'.OIDplus::getCurrentLang().'.html')) { |
/trunk/plugins/viathinksoft/adminPages/902_systemfile_check/OIDplusPageAdminSystemFileCheck.class.php |
---|
58,7 → 58,7 |
$out['icon'] = OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png'; |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title'], 401); |
} |
$out['text'] = '<p>'._L('This tool compares the checksums of the files of your OIDplus installation with the checksums of the OIDplus original SVN version.').'<br>'; |
/trunk/plugins/viathinksoft/adminPages/910_automated_ajax_calls/OIDplusPageAdminAutomatedAJAXCalls.class.php |
---|
37,7 → 37,7 |
public function action(string $actionID, array $params): array { |
if ($actionID == 'blacklistJWT') { |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin'))); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), null, 401); |
} |
if (!OIDplus::baseConfig()->getValue('JWT_ALLOW_AJAX_ADMIN', true)) { |
69,7 → 69,7 |
$out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title'], 401); |
} |
if (!OIDplus::baseConfig()->getValue('JWT_ALLOW_AJAX_ADMIN', true)) { |
/trunk/plugins/viathinksoft/adminPages/911_rest_api/OIDplusPageAdminRestApi.class.php |
---|
37,7 → 37,7 |
public function action(string $actionID, array $params): array { |
if ($actionID == 'blacklistJWT') { |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin'))); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), null, 401); |
} |
if (!OIDplus::baseConfig()->getValue('JWT_ALLOW_REST_ADMIN', true)) { |
69,7 → 69,7 |
$out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title'], 401); |
} |
if (!OIDplus::baseConfig()->getValue('JWT_ALLOW_REST_ADMIN', true)) { |
/trunk/plugins/viathinksoft/adminPages/920_nostalgia/OIDplusPageAdminNostalgia.class.php |
---|
44,7 → 44,7 |
$out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title'], 401); |
} |
$out['text'] = '<p>'._L('Did you ever wonder what OIDplus would look like if it had been created in the era of MS-DOS, Windows 3.11, or Windows 95? Just download the ZIP files below and have a look!').'</p>'; |
/trunk/plugins/viathinksoft/adminPages/920_nostalgia/export_dos.php |
---|
37,7 → 37,7 |
} |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin'))); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), null, 401); |
} |
if (!class_exists('ZipArchive')) { |
/trunk/plugins/viathinksoft/adminPages/920_nostalgia/export_win.php |
---|
37,7 → 37,7 |
} |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin'))); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), null, 401); |
} |
if (!class_exists('ZipArchive')) { |
/trunk/plugins/viathinksoft/publicPages/000_objects/OIDplusPagePublicObjects.class.php |
---|
89,7 → 89,7 |
http_response_code(200); |
return array("status" => "OK"); |
} catch (\Exception $e) { |
http_response_code(401); // TODO: We need some kind of Exception class to know for sure that the Exception is due to missing authentication! |
http_response_code($e instanceof OIDplusException ? $e->getHttpStatus() : 500); |
return array("error" => $e->getMessage()); |
} |
} else { |
147,7 → 147,7 |
} |
// Check if permitted |
if (!$obj->userHasParentalWriteRights()) throw new OIDplusException(_L('Authentication error. Please log in as the superior RA to delete this OID.')); |
if (!$obj->userHasParentalWriteRights()) throw new OIDplusException(_L('Authentication error. Please log in as the superior RA to delete this OID.'), null, 401); |
foreach (OIDplus::getAllPlugins() as $plugin) { |
if ($plugin instanceof INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_3) { |
213,7 → 213,7 |
} |
// Check if permitted |
if (!$obj->userHasParentalWriteRights()) throw new OIDplusException(_L('Authentication error. Please log in as the superior RA to update this OID.')); |
if (!$obj->userHasParentalWriteRights()) throw new OIDplusException(_L('Authentication error. Please log in as the superior RA to update this OID.'), null, 401); |
foreach (OIDplus::getAllPlugins() as $plugin) { |
if ($plugin instanceof INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_3) { |
349,7 → 349,7 |
} |
// Check if allowed |
if (!$obj->userHasWriteRights()) throw new OIDplusException(_L('Authentication error. Please log in as the RA to update this OID.')); |
if (!$obj->userHasWriteRights()) throw new OIDplusException(_L('Authentication error. Please log in as the RA to update this OID.'), null, 401); |
foreach (OIDplus::getAllPlugins() as $plugin) { |
if ($plugin instanceof INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_3) { |
414,7 → 414,7 |
} |
} |
if (!$objParent->userHasWriteRights()) throw new OIDplusException(_L('Authentication error. Please log in as the correct RA to insert an OID at this arc.')); |
if (!$objParent->userHasWriteRights()) throw new OIDplusException(_L('Authentication error. Please log in as the correct RA to insert an OID at this arc.'), null, 401); |
// Check if the ID is valid |
_CheckParamExists($params, 'id'); |
731,7 → 731,7 |
if (isset($_SERVER['SCRIPT_FILENAME']) && (strtolower(basename($_SERVER['SCRIPT_FILENAME'])) !== 'ajax.php')) { // don't send HTTP error codes in ajax.php, because we want a page and not a JavaScript alert box, when someone enters an invalid OID in the GoTo-Box |
http_response_code(403); |
} |
throw new OIDplusHtmlException(_L('Please <a %1>log in</a> to receive information about this object.',OIDplus::gui()->link('oidplus:login')), _L('Access denied')); |
throw new OIDplusHtmlException(_L('Please <a %1>log in</a> to receive information about this object.',OIDplus::gui()->link('oidplus:login')), _L('Access denied'), 401); |
} |
// --- |
/trunk/plugins/viathinksoft/publicPages/001_ra_base/OIDplusPagePublicRaBaseUtils.class.php |
---|
46,7 → 46,7 |
$ra_logged_in = OIDplus::authUtils()->isRaLoggedIn($email); |
if (!OIDplus::authUtils()->isAdminLoggedIn() && !$ra_logged_in) { |
throw new OIDplusException(_L('Authentication error. Please log in.')); |
throw new OIDplusException(_L('Authentication error. Please log in.'), null, 401); |
} |
if ($ra_logged_in) OIDplus::authUtils()->raLogout($email); |
/trunk/plugins/viathinksoft/publicPages/095_attachments/OIDplusPagePublicAttachments.class.php |
---|
187,7 → 187,7 |
$id = $params['id']; |
$obj = OIDplusObject::parse($id); |
if (!$obj) throw new OIDplusException(_L('Invalid object "%1"',$id)); |
if (!$obj->userHasWriteRights()) throw new OIDplusException(_L('Authentication error. Please log in as admin, or as the RA of "%1" to upload an attachment.',$id)); |
if (!$obj->userHasWriteRights()) throw new OIDplusException(_L('Authentication error. Please log in as admin, or as the RA of "%1" to upload an attachment.',$id), null, 401); |
if (!OIDplus::authUtils()->isAdminLoggedIn() && !$this->raMayDelete()) { |
throw new OIDplusException(_L('The administrator has disabled deleting attachments by RAs.')); |
228,7 → 228,7 |
$id = $params['id']; |
$obj = OIDplusObject::parse($id); |
if (!$obj) throw new OIDplusException(_L('Invalid object "%1"',$id)); |
if (!$obj->userHasWriteRights()) throw new OIDplusException(_L('Authentication error. Please log in as admin, or as the RA of "%1" to upload an attachment.',$id)); |
if (!$obj->userHasWriteRights()) throw new OIDplusException(_L('Authentication error. Please log in as admin, or as the RA of "%1" to upload an attachment.',$id), null, 401); |
if (!OIDplus::authUtils()->isAdminLoggedIn() && !$this->raMayUpload()) { |
throw new OIDplusException(_L('The administrator has disabled uploading attachments by RAs.')); |
/trunk/plugins/viathinksoft/publicPages/500_resources/OIDplusPagePublicResources.class.php |
---|
240,7 → 240,7 |
if ($file != '') { |
if (!self::mayAccessResource($file)) { |
throw new OIDplusException(_L('Authentication error. Please log in.'), _L('Access denied')); |
throw new OIDplusException(_L('Authentication error. Please log in.'), _L('Access denied'), 401); |
} |
} |
/trunk/plugins/viathinksoft/raPages/092_invite/OIDplusPageRaInvite.class.php |
---|
233,7 → 233,7 |
} |
} |
if (!$ok) { |
throw new OIDplusHtmlException(_L('You may not invite this RA. Maybe you need to <a %1>log in</a> again.',OIDplus::gui()->link('oidplus:login'))); |
throw new OIDplusHtmlException(_L('You may not invite this RA. Maybe you need to <a %1>log in</a> again.',OIDplus::gui()->link('oidplus:login')), null, 401); |
} |
} |
} |
/trunk/plugins/viathinksoft/raPages/100_edit_contact_data/OIDplusPageRaEditContactData.class.php |
---|
38,7 → 38,7 |
$email = $params['email']; |
if (!OIDplus::authUtils()->isRaLoggedIn($email) && !OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusException(_L('Authentication error. Please log in as admin, or as the RA to update its data.')); |
throw new OIDplusException(_L('Authentication error. Please log in as admin, or as the RA to update its data.'), null, 401); |
} |
$res = OIDplus::db()->query("select * from ###ra where email = ?", array($email)); |
104,7 → 104,7 |
$out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as the requested RA %2.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>'), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as the requested RA %2.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>'), $out['title'], 401); |
} |
$out['text'] = '<p>'._L('Your email address: %1','<b>'.htmlentities($ra_email).'</b>').'</p>'; |
/trunk/plugins/viathinksoft/raPages/101_change_password/OIDplusPageRaChangePassword.class.php |
---|
43,7 → 43,7 |
} |
if (!OIDplus::authUtils()->isRaLoggedIn($email) && !OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusException(_L('Authentication error. Please log in as admin, or as the RA to update its data.')); |
throw new OIDplusException(_L('Authentication error. Please log in as admin, or as the RA to update its data.'), null, 401); |
} |
if (!OIDplus::authUtils()->isAdminLoggedIn()) { |
113,7 → 113,7 |
$out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as the requested RA %2.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>'), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as the requested RA %2.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>'), $out['title'], 401); |
} |
$res = OIDplus::db()->query("select * from ###ra where email = ?", array($ra_email)); |
/trunk/plugins/viathinksoft/raPages/102_change_email/OIDplusPageRaChangeEMail.class.php |
---|
50,7 → 50,7 |
} |
if (!OIDplus::authUtils()->isRaLoggedIn($old_email) && !OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusException(_L('Authentication error. Please log in as admin, or as the RA to update its email address.')); |
throw new OIDplusException(_L('Authentication error. Please log in as admin, or as the RA to update its email address.'), null, 401); |
} |
if (!OIDplus::mailUtils()->validMailAddress($new_email)) { |
228,7 → 228,7 |
$out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as the requested RA %2 or as admin.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>'), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as the requested RA %2 or as admin.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>'), $out['title'], 401); |
} |
$res = OIDplus::db()->query("select * from ###ra where email = ?", array($ra_email)); |
/trunk/plugins/viathinksoft/raPages/200_log/OIDplusPageRaLogEvents.class.php |
---|
49,7 → 49,7 |
$out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as the requested RA %2.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>'), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as the requested RA %2.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>'), $out['title'], 401); |
} |
$res = OIDplus::db()->query("select * from ###ra where email = ?", array($ra_email)); |
/trunk/plugins/viathinksoft/raPages/910_automated_ajax_calls/OIDplusPageRaAutomatedAJAXCalls.class.php |
---|
44,7 → 44,7 |
$ra_email = $params['user']; |
if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as the requested RA %2 or as admin.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>')); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as the requested RA %2 or as admin.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>'), null, 401); |
} |
$gen = OIDplusAuthContentStoreJWT::JWT_GENERATOR_AJAX; |
75,7 → 75,7 |
$out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as the requested RA %2 or as admin.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>'), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as the requested RA %2 or as admin.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>'), $out['title'], 401); |
} |
if (!OIDplus::baseConfig()->getValue('JWT_ALLOW_AJAX_USER', true)) { |
/trunk/plugins/viathinksoft/raPages/911_rest_api/OIDplusPageRaRestApi.class.php |
---|
44,7 → 44,7 |
$ra_email = $params['user']; |
if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as the requested RA %2 or as admin.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>')); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as the requested RA %2 or as admin.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>'), null, 401); |
} |
$gen = OIDplusAuthContentStoreJWT::JWT_GENERATOR_REST; |
75,7 → 75,7 |
$out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : ''; |
if (!OIDplus::authUtils()->isRaLoggedIn($ra_email) && !OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as the requested RA %2 or as admin.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>'), $out['title']); |
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as the requested RA %2 or as admin.',OIDplus::gui()->link('oidplus:login$ra$'.$ra_email),'<b>'.htmlentities($ra_email).'</b>'), $out['title'], 401); |
} |
if (!OIDplus::baseConfig()->getValue('JWT_ALLOW_REST_USER', true)) { |