/trunk/.idea/misc.xml |
---|
0,0 → 1,14 |
<?xml version="1.0" encoding="UTF-8"?> |
<project version="4"> |
<component name="SvnBranchConfigurationManager"> |
<option name="myConfigurationMap"> |
<map> |
<entry key="$PROJECT_DIR$"> |
<value> |
<SvnBranchConfiguration /> |
</value> |
</entry> |
</map> |
</option> |
</component> |
</project> |
/trunk/.idea/workspace.xml |
---|
8,10 → 8,34 |
</component> |
<component name="ChangeListManager"> |
<list default="true" id="df2a484b-bed2-4376-a9d2-11f38408a62e" name="Changes" comment=""> |
<change beforePath="$PROJECT_DIR$/.idea/trunk.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/trunk.iml" afterDir="false" /> |
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" /> |
<change afterPath="$PROJECT_DIR$/dev/logger/verify_maskcodes.phps" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/plugins/viathinksoft/adminPages/111_systeminfo/OIDplusPageAdminSysteminfo.class.php" beforeDir="false" afterPath="$PROJECT_DIR$/plugins/viathinksoft/adminPages/111_systeminfo/OIDplusPageAdminSysteminfo.class.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/plugins/viathinksoft/database/ado/OIDplusDatabaseConnectionADO.class.php" beforeDir="false" afterPath="$PROJECT_DIR$/plugins/viathinksoft/database/ado/OIDplusDatabaseConnectionADO.class.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/dev/test_logmasks" beforeDir="false" /> |
<change beforePath="$PROJECT_DIR$/doc/developer_notes/logger_maskcodes.md" beforeDir="false" afterPath="$PROJECT_DIR$/doc/developer_notes/logger_maskcodes.md" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/includes/classes/OIDplus.class.php" beforeDir="false" afterPath="$PROJECT_DIR$/includes/classes/OIDplus.class.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/includes/classes/OIDplusAuthUtils.class.php" beforeDir="false" afterPath="$PROJECT_DIR$/includes/classes/OIDplusAuthUtils.class.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/includes/classes/OIDplusLogger.class.php" beforeDir="false" afterPath="$PROJECT_DIR$/includes/classes/OIDplusLogger.class.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/plugins/viathinksoft/adminPages/110_system_config/OIDplusPageAdminSystemConfig.class.php" beforeDir="false" afterPath="$PROJECT_DIR$/plugins/viathinksoft/adminPages/110_system_config/OIDplusPageAdminSystemConfig.class.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/plugins/viathinksoft/adminPages/120_registration/OIDplusPageAdminRegistration.class.php" beforeDir="false" afterPath="$PROJECT_DIR$/plugins/viathinksoft/adminPages/120_registration/OIDplusPageAdminRegistration.class.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/plugins/viathinksoft/adminPages/130_create_ra/OIDplusPageAdminCreateRa.class.php" beforeDir="false" afterPath="$PROJECT_DIR$/plugins/viathinksoft/adminPages/130_create_ra/OIDplusPageAdminCreateRa.class.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/plugins/viathinksoft/adminPages/400_oidinfo_export/OIDplusPageAdminOIDInfoExport.class.php" beforeDir="false" afterPath="$PROJECT_DIR$/plugins/viathinksoft/adminPages/400_oidinfo_export/OIDplusPageAdminOIDInfoExport.class.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/plugins/viathinksoft/adminPages/700_colors/OIDplusPageAdminColors.class.php" beforeDir="false" afterPath="$PROJECT_DIR$/plugins/viathinksoft/adminPages/700_colors/OIDplusPageAdminColors.class.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/plugins/viathinksoft/language/dede/messages.xml" beforeDir="false" afterPath="$PROJECT_DIR$/plugins/viathinksoft/language/dede/messages.xml" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/plugins/viathinksoft/publicPages/000_objects/OIDplusPagePublicObjects.class.php" beforeDir="false" afterPath="$PROJECT_DIR$/plugins/viathinksoft/publicPages/000_objects/OIDplusPagePublicObjects.class.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/plugins/viathinksoft/publicPages/001_ra_base/OIDplusPagePublicRaBaseUtils.class.php" beforeDir="false" afterPath="$PROJECT_DIR$/plugins/viathinksoft/publicPages/001_ra_base/OIDplusPagePublicRaBaseUtils.class.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/plugins/viathinksoft/publicPages/090_login/OIDplusPagePublicLogin.class.php" beforeDir="false" afterPath="$PROJECT_DIR$/plugins/viathinksoft/publicPages/090_login/OIDplusPagePublicLogin.class.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/plugins/viathinksoft/publicPages/091_forgot_password/OIDplusPagePublicForgotPassword.class.php" beforeDir="false" afterPath="$PROJECT_DIR$/plugins/viathinksoft/publicPages/091_forgot_password/OIDplusPagePublicForgotPassword.class.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/plugins/viathinksoft/publicPages/095_attachments/OIDplusPagePublicAttachments.class.php" beforeDir="false" afterPath="$PROJECT_DIR$/plugins/viathinksoft/publicPages/095_attachments/OIDplusPagePublicAttachments.class.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/plugins/viathinksoft/publicPages/200_viathinksoft_freeoid/OIDplusPagePublicFreeOID.class.php" beforeDir="false" afterPath="$PROJECT_DIR$/plugins/viathinksoft/publicPages/200_viathinksoft_freeoid/OIDplusPagePublicFreeOID.class.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/plugins/viathinksoft/publicPages/500_resources/OIDplusPagePublicResources.class.php" beforeDir="false" afterPath="$PROJECT_DIR$/plugins/viathinksoft/publicPages/500_resources/OIDplusPagePublicResources.class.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/plugins/viathinksoft/publicPages/800_login_ldap/OIDplusPagePublicLoginLDAP.class.php" beforeDir="false" afterPath="$PROJECT_DIR$/plugins/viathinksoft/publicPages/800_login_ldap/OIDplusPagePublicLoginLDAP.class.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/plugins/viathinksoft/publicPages/810_login_google/oauth.php" beforeDir="false" afterPath="$PROJECT_DIR$/plugins/viathinksoft/publicPages/810_login_google/oauth.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/plugins/viathinksoft/publicPages/820_login_facebook/oauth.php" beforeDir="false" afterPath="$PROJECT_DIR$/plugins/viathinksoft/publicPages/820_login_facebook/oauth.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/plugins/viathinksoft/raPages/092_invite/OIDplusPageRaInvite.class.php" beforeDir="false" afterPath="$PROJECT_DIR$/plugins/viathinksoft/raPages/092_invite/OIDplusPageRaInvite.class.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/plugins/viathinksoft/raPages/100_edit_contact_data/OIDplusPageRaEditContactData.class.php" beforeDir="false" afterPath="$PROJECT_DIR$/plugins/viathinksoft/raPages/100_edit_contact_data/OIDplusPageRaEditContactData.class.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/plugins/viathinksoft/raPages/101_change_password/OIDplusPageRaChangePassword.class.php" beforeDir="false" afterPath="$PROJECT_DIR$/plugins/viathinksoft/raPages/101_change_password/OIDplusPageRaChangePassword.class.php" afterDir="false" /> |
<change beforePath="$PROJECT_DIR$/plugins/viathinksoft/raPages/102_change_email/OIDplusPageRaChangeEMail.class.php" beforeDir="false" afterPath="$PROJECT_DIR$/plugins/viathinksoft/raPages/102_change_email/OIDplusPageRaChangeEMail.class.php" afterDir="false" /> |
</list> |
<option name="SHOW_DIALOG" value="false" /> |
<option name="HIGHLIGHT_CONFLICTS" value="true" /> |
30,6 → 54,9 |
<executable path="composer" /> |
</execution> |
</component> |
<component name="HighlightingSettingsPerFile"> |
<setting file="file://$PROJECT_DIR$/vendor/danielmarschall/uuid_mac_utils/includes/mac_utils.inc.php" root0="FORCE_HIGHLIGHTING" root1="SKIP_INSPECTION" /> |
</component> |
<component name="MarkdownSettingsMigration"> |
<option name="stateVersion" value="1" /> |
</component> |
83,28 → 110,28 |
<option name="hideEmptyMiddlePackages" value="true" /> |
<option name="showLibraryContents" value="true" /> |
</component> |
<component name="PropertiesComponent">{ |
"keyToString": { |
"RunOnceActivity.OpenProjectViewOnStart": "true", |
"RunOnceActivity.ShowReadmeOnStart": "true", |
"WebServerToolWindowFactoryState": "false", |
"last_opened_file_path": "D:/SVN/OIDplus/trunk/setup/sql/wellknown_other_access.sql", |
"node.js.detected.package.eslint": "true", |
"node.js.detected.package.tslint": "true", |
"node.js.selected.package.eslint": "(autodetect)", |
"node.js.selected.package.tslint": "(autodetect)", |
"nodejs_package_manager_path": "npm", |
"run.code.analysis.last.selected.profile": "pProject Default", |
"settings.editor.selected.configurable": "web-ide.project.structure", |
"vue.rearranger.settings.migration": "true" |
<component name="PropertiesComponent"><![CDATA[{ |
"keyToString": { |
"RunOnceActivity.OpenProjectViewOnStart": "true", |
"RunOnceActivity.ShowReadmeOnStart": "true", |
"WebServerToolWindowFactoryState": "false", |
"last_opened_file_path": "D:/SVN/OIDplus/trunk/dev/logger/verify_maskcodes.phps", |
"node.js.detected.package.eslint": "true", |
"node.js.detected.package.tslint": "true", |
"node.js.selected.package.eslint": "(autodetect)", |
"node.js.selected.package.tslint": "(autodetect)", |
"nodejs_package_manager_path": "npm", |
"run.code.analysis.last.selected.profile": "pProject Default", |
"settings.editor.selected.configurable": "SQL Dialects", |
"vue.rearranger.settings.migration": "true" |
}, |
"keyToStringList": { |
"com.intellij.ide.scratch.LRUPopupBuilder$1/SQL Dialect": [ |
"Oracle", |
"TSQL" |
"keyToStringList": { |
"com.intellij.ide.scratch.LRUPopupBuilder$1/SQL Dialect": [ |
"Oracle", |
"TSQL" |
] |
} |
}</component> |
}]]></component> |
<component name="RecentsManager"> |
<key name="CopyFile.RECENT_KEYS"> |
<recent name="D:\SVN\OIDplus\trunk\plugins\viathinksoft\raPages\010_notifications" /> |
118,12 → 145,6 |
</key> |
</component> |
<component name="RunManager" selected="PHP Script.message_regenerate.phps"> |
<configuration name="check_log_masks.phps" type="PhpLocalRunConfigurationType" factoryName="PHP Console" temporary="true" path="$PROJECT_DIR$/dev/check_log_masks.phps"> |
<method v="2" /> |
</configuration> |
<configuration name="gs1_utils.inc.php" type="PhpLocalRunConfigurationType" factoryName="PHP Console" path="$PROJECT_DIR$/plugins/viathinksoft/objectTypes/gs1/gs1_utils.inc.php"> |
<method v="2" /> |
</configuration> |
<configuration name="index.php" type="PhpLocalRunConfigurationType" factoryName="PHP Console" temporary="true" path="$PROJECT_DIR$/index.php"> |
<method v="2" /> |
</configuration> |
130,14 → 151,18 |
<configuration name="message_regenerate.phps" type="PhpLocalRunConfigurationType" factoryName="PHP Console" temporary="true" path="$PROJECT_DIR$/dev/translation/message_regenerate.phps"> |
<method v="2" /> |
</configuration> |
<configuration name="test.php" type="PhpLocalRunConfigurationType" factoryName="PHP Console" temporary="true" path="$PROJECT_DIR$/glip/test.php"> |
<configuration name="verify_maskcodes.phps" type="PhpLocalRunConfigurationType" factoryName="PHP Console" temporary="true" path="$PROJECT_DIR$/dev/logger/verify_maskcodes.phps"> |
<method v="2" /> |
</configuration> |
<list> |
<item itemvalue="PHP Script.verify_maskcodes.phps" /> |
<item itemvalue="PHP Script.index.php" /> |
<item itemvalue="PHP Script.message_regenerate.phps" /> |
</list> |
<recent_temporary> |
<list> |
<item itemvalue="PHP Script.message_regenerate.phps" /> |
<item itemvalue="PHP Script.check_log_masks.phps" /> |
<item itemvalue="PHP Script.test.php" /> |
<item itemvalue="PHP Script.verify_maskcodes.phps" /> |
<item itemvalue="PHP Script.index.php" /> |
</list> |
</recent_temporary> |
240,6 → 265,28 |
<workItem from="1681862765014" duration="1170000" /> |
<workItem from="1681927582953" duration="14930000" /> |
<workItem from="1682024633727" duration="1284000" /> |
<workItem from="1682032227564" duration="492000" /> |
<workItem from="1682032819762" duration="88000" /> |
<workItem from="1682539677933" duration="2342000" /> |
<workItem from="1682553032943" duration="3216000" /> |
<workItem from="1682626433337" duration="6648000" /> |
<workItem from="1682635346442" duration="2132000" /> |
<workItem from="1682637958287" duration="595000" /> |
<workItem from="1682710670337" duration="2132000" /> |
<workItem from="1682712836624" duration="10702000" /> |
<workItem from="1682786314427" duration="41000" /> |
<workItem from="1682786363250" duration="7964000" /> |
<workItem from="1682802507321" duration="3363000" /> |
<workItem from="1682962458713" duration="3242000" /> |
<workItem from="1683146313089" duration="6928000" /> |
<workItem from="1683156301964" duration="44000" /> |
<workItem from="1683229207291" duration="6126000" /> |
<workItem from="1683237752724" duration="199000" /> |
<workItem from="1683396943834" duration="10827000" /> |
<workItem from="1683663551328" duration="8000" /> |
<workItem from="1683935571903" duration="1954000" /> |
<workItem from="1683999584980" duration="2824000" /> |
<workItem from="1684007063012" duration="17463000" /> |
</task> |
<servers /> |
</component> |
/trunk/dev/test_logmasks |
---|
File deleted |
Property changes: |
Deleted: svn:executable |
-* |
\ No newline at end of property |
/trunk/dev/logger/verify_maskcodes.phps |
---|
0,0 → 1,90 |
#!/usr/bin/env php |
<?php |
/* |
* OIDplus 2.0 |
* Copyright 2019 - 2023 Daniel Marschall, ViaThinkSoft |
* |
* Licensed under the Apache License, Version 2.0 (the "License"); |
* you may not use this file except in compliance with the License. |
* You may obtain a copy of the License at |
* |
* http://www.apache.org/licenses/LICENSE-2.0 |
* |
* Unless required by applicable law or agreed to in writing, software |
* distributed under the License is distributed on an "AS IS" BASIS, |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
* See the License for the specific language governing permissions and |
* limitations under the License. |
*/ |
$dir = __DIR__ . '/../../'; |
define('INSIDE_OIDPLUS',true); |
require_once $dir.'includes/classes/OIDplusBaseClass.class.php'; |
require_once $dir.'includes/classes/OIDplusLogger.class.php'; |
use ViaThinkSoft\OIDplus\OIDplusLogger; |
// --- |
$cntfiles = 0; |
$cntcodes = 0; |
$it = new RecursiveDirectoryIterator($dir); |
$it->setFlags(FilesystemIterator::SKIP_DOTS); // DOES NOT WORK! Folders with . prefix still get evaluated! |
foreach(new RecursiveIteratorIterator($it) as $file) { |
if ((strpos(str_replace('\\','/',realpath($file)),'/vendor/') !== false) && (strpos(str_replace('\\','/',realpath($file)),'/vendor/danielmarschall/') === false)) continue; // ignore third-party-code |
if (strpos(str_replace('\\','/',realpath($file)),'/dev/') !== false) continue; // ignore development utilities |
if (preg_match('@[/\\\\]\\.[^\\.]@',$file,$m)) continue; // Alternative to SKIP_DOTS |
if ($file->getExtension() == 'php') { |
$cont = file_get_contents($file); |
$cont = phpRemoveComments($cont); |
$cntfiles++; |
preg_match_all('@OIDplus::logger\(\)\->log\(\s*(["\'])([^"\']+)(["\'])@', $cont, $m); |
foreach ($m[2] as $str) { |
$cntcodes++; |
if (OIDplusLogger::parse_maskcode($str) === false) { |
$file = substr($file, strlen($dir)); |
echo "Invalid maskcode '$str' in file '$file'\n"; |
} else { |
//echo 'Valid: '.$str."\n"; |
} |
} |
} |
} |
echo "Done. Checked $cntcodes mask codes in $cntfiles files.\n"; |
# --- |
/** |
* @param string $fileStr |
* @return string |
*/ |
function phpRemoveComments(string $fileStr): string { |
// https://stackoverflow.com/questions/503871/best-way-to-automatically-remove-comments-from-php-code |
$newStr = ''; |
$commentTokens = array(T_COMMENT); |
if (defined('T_DOC_COMMENT')) $commentTokens[] = T_DOC_COMMENT; // PHP 5 |
if (defined('T_ML_COMMENT')) $commentTokens[] = T_ML_COMMENT; // PHP 4 |
$tokens = token_get_all($fileStr); |
foreach ($tokens as $token) { |
if (is_array($token)) { |
if (in_array($token[0], $commentTokens)) continue; |
$token = $token[1]; |
} |
$newStr .= $token; |
} |
return $newStr; |
} |
/trunk/doc/developer_notes/logger_maskcodes.md |
---|
1,9 → 1,8 |
OIDplus Logger Maskcodes |
======================== |
OIDplus Logger Mask Codes |
========================= |
What is a mask code? |
-------------------- |
## What is a mask code? |
A "mask code" gives information about the log event. |
It contains: |
23,20 → 22,33 |
Instead of logging into 3 logbooks separately, you would create a mask code that tells the system to put the message |
into the logbooks of person X, house A, and house B. |
Syntax rules |
------------ |
## Syntax rules |
In the code, mask codes would look like this: |
OIDplus::logger()->log("[INFO]OID(%1)", "RA of object '%1' changed from '%2' to '%3'", $oid, $old_ra, $new_ra); |
OIDplus::logger()->log("V2:[INFO]OID(%1)", "RA of object '%1' changed from '%2' to '%3'", $oid, $old_ra, $new_ra); |
As you can see, the maskcode and message can be parameterized like `sprintf()` does, |
but with the difference that `%1`, `%2`, `%3`, ..., is used instead of `%s`. |
Please note that the event message is not enclosed in `_L(...)`, because log-messages are always written in English, |
Please note that the event message is not enclosed in `_L(...)`, |
because log messages are always written in English, |
and not in the front-end language of the user. |
### Version |
A mask code begins with `V2:` |
### Components |
A mask code can have multiple components which are split into single codes using `+` or `/`, e.g. `OID(x)+RA(x)` would |
be split to `OID(x)` and `RA(x)` which would result in the message being placed in the logbook of OID x, |
and the logbook of the RA owning OID x. |
### Severity |
At the beginning of each mask code, you must define a severity, which is written in square brackets. |
Valid severities: |
- `[OK]`: Rule of thumb: YOU have done something and it was successful. |
- `[INFO]`: Rule of thumb: Someone else has done something (that affects you) and it was successful. |
44,42 → 56,80 |
- `[ERR]`: Rule of thumb: Something failed (probably someone did something) and it affects you. |
- `[CRIT]`: Rule of thumb: Something happened (probably someone did something) which is not an error, but some critical situation (e.g. hardware failure), and it affects you. |
A mask code can have multiple components which are split into single codes using `+` or `/`, e.g. `OID(x)+RA(x)` would |
be split to `OID(x)` and `RA(x)` which would result in the message being placed in the logbook of OID x, |
and the logbook of the RA owning OID x. |
If you have a mask code with multiple components, you don't have to place the severity for each component. |
You can just leave it at the beginning. For example, `[WARN]OID(x)+RA(x)` is equal to `[WARN]OID(x)+[WARN]RA(x)`. |
You can also put different severities for the components, e.g. `[INFO]OID(x)+[WARN]RA(x)` would be a info for the OID, |
but a warning for the RA. |
You can also put different severities for the components, e.g. `[INFO]OID(x)+[WARN]RA(x)` |
would be an informative message (`INFO`) for the OID, but a warning (`WARN`) for the RA. |
If you want to make the severity dependent on wheather the user is logged in or not, |
prepend `?` or `!` and use `/` as delimiter |
Example: `[?WARN/!OK]RA(x)` means: If RA "x" is not logged in, it is a warning; if it is logged in, it is an success. |
With this technique you can achive that the RA gets warned if an admin changed some of their OIDs, |
but receives an OK-Event if they did the change. |
### Online/Offline dependency |
`OID(x)` means: Save the log entry into the logbook of: Object "x". |
If you want to make the logging event dependent on whether |
the target (`A`, `RA`, `OIDRA`, `SUPOIDRA`) matches the currently |
logged-in user or not, write `[S1/S2]` where `S1` is the severity |
when the logged-in user is the target |
and `S2` is the severity when the user is not logged in or |
logged in as a user not matching the target. |
`SUPOID(x)` means: Save the log entry into the logbook of: Parent of object "x". |
With this technique, you can achieve that the RA gets warned if an admin or superior RA |
changed some of their OIDs without their knowledge, |
but receives a success message if they did the change themselves. |
`OIDRA(x)!` means: Save the log entry into the logbook of: RA of object "x". |
Example: `[OK/WARN]RA(x)+[OK/INFO]A` means that there are two log messages generated: |
- Message 1: If the currently logged-in user (performing the action) |
is RA "x", then it is a success message (`OK`) for them, |
otherwise it is a warning (`WARN`) for them, |
i.e. they get warned that someone else (admin or superior RA) |
has changed something without their knowledge. |
- Message 2: If the currently logged-in user (performing the action) |
is the administrator of the system, then it is a success message (`OK`) |
for them, otherwise it is an informative message (`INFO`) for them, |
i.e. the admin gets informed that a RA has done something. |
`OIDRA(x)?` means: Save the log entry into the logbook of: Logged in RA of object "x". If it is not logged in, nothing will be logged. |
You can use the special severity `NONE` to achieve that an event is |
not logged, so `NONE/...` means that the event is not logged |
if the currently logged-in user matches the target, |
and `.../NONE` means that the event is not logged if the user |
is not logged in or logged in as a user not matching the target. |
`SUPOIDRA(x)!` means: Save the log entry into the logbook of: RA that owns the superior object of "x". |
Example: `[OK/NONE]RA(x)+[OK/NONE]A` could be used |
to give the RA or the admin a success message (`OK`) |
for their action, but the admin won't be notified if the |
RA has changed it, and the RA won't be notified if the |
admin changed it. An Exception is if the user is logged in |
with both accounts (RA and admin) at the same time (which is |
possible with OIDplus), then two log messages would be generated. |
`SUPOIDRA(x)?` means: Save the log entry into the logbook of: Logged in RA that owns the superior object of "x". If it is not logged in, nothing will be logged. |
The severities `[NONE]` and `[NONE/NONE]` are invalid, because they are meaningless. |
`RA(x)!` means: Save the log entry into the logbook of: RA "x". |
The online/offline dependency is only possible for the types `OIDRA`, `SUPOIDRA`, `RA`, and `A`, |
but not for `OID` or `SUPOID`. |
`RA(x)?` means: Save the log entry into the logbook of: Logged in RA "x". If it is not logged in, nothing will be logged. |
### Valid types |
`A!` means: Save the log entry into the logbook of: The admin. |
Besides the severity, the component has a payload in the form `Type(Value)`. |
`A?` means: Save the log entry into the logbook of: The logged in admin. If it is not logged in, nothing will be logged. |
`OID(x)` means: Save the log entry into the logbook of object "x". |
Implementation |
============== |
`SUPOID(x)` means: Save the log entry into the logbook of the parent of object "x". |
`OIDRA(x)` means: Save the log entry into the logbook of the RA of object "x". |
`SUPOIDRA(x)` means: Save the log entry into the logbook of the RA that owns the superior object of "x". |
`RA(x)` means: Save the log entry into the logbook of the RA "x". |
`A` means: Save the log entry into the logbook of the administrator of the system. |
### Escaping |
Inside a severity block, you can escape []/\ with \ |
Inside the value, you can escape ()+\ with \ |
## Implementation |
You can find the implementation in **includes/classes/OIDplusLogger.class.php**. |
## Tests |
To check if your mask codes have the correct syntax, run the tool **dev/logger/verify_maskcodes.phps**. |
/trunk/includes/classes/OIDplus.class.php |
---|
1796,7 → 1796,7 |
$pubKey = OIDplus::getSystemPublicKey(); |
if (!verify_private_public_key($privKey, $pubKey)) { |
if ($pubKey) { |
OIDplus::logger()->log("[WARN]A!", "The private/public key-pair is broken. A new key-pair will now be generated for your system. Your System-ID will change."); |
OIDplus::logger()->log("V2:[WARN]A", "The private/public key-pair is broken. A new key-pair will now be generated for your system. Your System-ID will change."); |
} |
$pkey_config = array( |
1833,7 → 1833,7 |
OIDplus::config()->setValue('oidplus_public_key', $pubKey); |
// Log the new system ID |
OIDplus::logger()->log("[INFO]A!", "A new private/public key-pair for your system had been generated. Your SystemID is now %1", $system_id); |
OIDplus::logger()->log("V2:[INFO]A", "A new private/public key-pair for your system had been generated. Your SystemID is now %1", $system_id); |
} |
} else { |
$passphrase = self::getPrivKeyPassphrase(); |
1844,7 → 1844,7 |
$passphrase = self::getPrivKeyPassphrase(); |
if ($passphrase !== false) { |
$privKey = encrypt_private_key($privKey, $passphrase); |
OIDplus::logger()->log("[INFO]A!", "The private/public key-pair has been upgraded to an encrypted key-pair. The key is saved in %1", self::getPrivKeyPassphraseFilename()); |
OIDplus::logger()->log("V2:[INFO]A", "The private/public key-pair has been upgraded to an encrypted key-pair. The key is saved in %1", self::getPrivKeyPassphraseFilename()); |
OIDplus::config()->setValue('oidplus_private_key', $privKey); |
} |
} |
1904,7 → 1904,7 |
if (($ver_prev) && ($ver_now != $ver_prev)) { |
// TODO: Problem: When the system was updated using SVN or GIT in the console, then the IP address of the next random visitor of the website is logged! |
// Idea: Maybe we should extend the mask code with some kind of magic constant "[NO_IP]", so that no IP is logged for that event? |
OIDplus::logger()->log("[INFO]A!", "Detected system version change from '%1' to '%2'", $ver_prev, $ver_now); |
OIDplus::logger()->log("V2:[INFO]A", "Detected system version change from '%1' to '%2'", $ver_prev, $ver_now); |
// Just to be sure, recanonize objects (we don't do it at every page visit due to performance reasons) |
self::recanonizeObjects(); |
2468,7 → 2468,7 |
OIDplus::db()->query("update ###asn1id set oid = ? where oid = ?", array($idb, $ida)); |
OIDplus::db()->query("update ###iri set oid = ? where oid = ?", array($idb, $ida)); |
OIDplus::db()->query("update ###log_object set object = ? where object = ?", array($idb, $ida)); |
OIDplus::logger()->log("[INFO]A!", "Object name '%1' has been changed to '%2' during re-canonization", $ida, $idb); |
OIDplus::logger()->log("V2:[INFO]A", "Object name '%1' has been changed to '%2' during re-canonization", $ida, $idb); |
if (OIDplus::db()->transaction_supported()) OIDplus::db()->transaction_commit(); |
} catch (\Exception $e) { |
if (OIDplus::db()->transaction_supported()) OIDplus::db()->transaction_rollback(); |
/trunk/includes/classes/OIDplusAuthUtils.class.php |
---|
179,11 → 179,12 |
} |
/** |
* @param string $email |
* @param string|OIDplusRA $ra |
* @return bool |
* @throws OIDplusException |
*/ |
public function isRaLoggedIn(string $email): bool { |
public function isRaLoggedIn($ra): bool { |
$email = $ra instanceof OIDplusRA ? $ra->raEmail() : $ra; |
$acs = $this->getAuthContentStore(); |
if (is_null($acs)) return false; |
return $acs->isRaLoggedIn($email); |
224,7 → 225,7 |
$logmsg = "RA '$email' logged in"; |
if ($origin != '') $logmsg .= " via $origin"; |
if ($loginfo != '') $logmsg .= " ($loginfo)"; |
OIDplus::logger()->log("[OK]RA(%1)!", "%2", $email, $logmsg); |
OIDplus::logger()->log("V2:[OK]RA(%1)", "%2", $email, $logmsg); |
} |
/** |
239,7 → 240,7 |
if (is_null($acs)) return; |
$acs->raLogoutEx($email, $loginfo); |
OIDplus::logger()->log("[OK]RA(%1)!", "RA '%1' logged out (%2)", $email, $loginfo); |
OIDplus::logger()->log("V2:[OK]RA(%1)", "RA '%1' logged out (%2)", $email, $loginfo); |
if (($this->raNumLoggedIn() == 0) && (!$this->isAdminLoggedIn())) { |
// Nobody logged in anymore. Destroy session cookie to make GDPR people happy |
354,7 → 355,7 |
$logmsg = "Admin logged in"; |
if ($origin != '') $logmsg .= " via $origin"; |
if ($loginfo != '') $logmsg .= " ($loginfo)"; |
OIDplus::logger()->log("[OK]A!", "%1", $logmsg); |
OIDplus::logger()->log("V2:[OK]A", "%1", $logmsg); |
} |
/** |
376,7 → 377,7 |
$acs->activate(); |
} |
OIDplus::logger()->log("[OK]A!", "Admin logged out (%1)", $loginfo); |
OIDplus::logger()->log("V2:[OK]A", "Admin logged out (%1)", $loginfo); |
} |
// Authentication keys for validating arguments (e.g. sent by mail) |
/trunk/includes/classes/OIDplusLogger.class.php |
---|
26,15 → 26,30 |
class OIDplusLogger extends OIDplusBaseClass { |
/** |
* This function splits a mask code containing multiple components |
* (delimited by '+' or '/') in single components |
* It takes care that '+' and '/' inside brackets won't be used to split the codes |
* This method splits a mask code containing multiple components (delimited by '+') into single components |
* It takes care that '+' inside brackets isn't be used to split the codes |
* Also, brackets can be escaped. |
* The severity block (optional, must be standing in front of a component) |
* is handled too. Inside the severity block, you may only use '/' to split components. |
* The severity block will be implicitly repeated from the previous components if a component |
* does not feature one. |
* |
* @param string $maskcode A maskcode, e.g. [INFO]OID(2.999) |
* @return array|false An array of [$severity,$target], |
* where $severity is 'INFO' or [$online,$offline] like ['INFO','INFO'] |
* and $target is like ['A'], ['OID', '2.999'], etc. |
*/ |
public static function parse_maskcode(string $maskcode) { |
$out = array(); |
$sevs = array(); // Note: The severity block will repeat for the next components if not changed explicitly |
if (!str_starts_with($maskcode,'V2:')) { |
return false; |
} else { |
$maskcode = substr($maskcode, 3); |
} |
// Step 1: Split severities from the rest of the maskcodes |
/* |
* "[ERR]AAA(BBB)+CCC(DDD)" ==> array( |
* array(array("ERR"),"AAA(BBB)"), |
* array(array("ERR"),"CCC(DDD)") |
43,28 → 58,22 |
* array(array("INFO"),"AAA(B+BB)"), |
* array(array("WARN"),"CCC(DDD)") |
* ) |
* "[?WARN/!OK] AAA(B\)BB)+CCC(DDD)" ==> array( |
* array(array("?WARN", "!OK"),"AAA(B\)BB)"), |
* array(array("?WARN", "!OK"),"CCC(DDD)") |
* "[OK/WARN] AAA(B\)BB)+CCC(DDD)" ==> array( |
* array(array("OK", "WARN"),"AAA(B\)BB)"), |
* array(array("OK", "WARN"),"CCC(DDD)") |
* ) |
* @param string $maskcodes |
* @return array|false |
*/ |
private function split_maskcodes(string $maskcodes) { |
$out = array(); |
$sevs = array(); // Note: The severity block will repeat for the next components if not changed explicitly |
$code = ''; |
$sev = ''; |
$bracket_level = 0; |
$is_escaping = false; |
$inside_severity_block = false; |
for ($i=0; $i<strlen($maskcodes); $i++) { |
$char = $maskcodes[$i]; |
for ($i=0; $i<strlen($maskcode); $i++) { |
$char = $maskcode[$i]; |
if ($inside_severity_block) { |
// Severity block (optional) |
// e.g. [?WARN/!OK] ==> $sevs = array("?WARN", "!OK") |
// e.g. [OK/WARN] ==> $sevs = array("OK", "WARN") |
if ($char == '\\') { |
if ($is_escaping) { |
$is_escaping = false; |
146,7 → 155,7 |
} |
$code .= $char; |
} |
else if ((($char == '+') || ($char == '/')) && ($bracket_level == 0)) { |
else if (($char == '+') && ($bracket_level == 0)) { |
if ($is_escaping) { |
$is_escaping = false; |
$code .= $char; |
167,7 → 176,59 |
} |
if ($code != '') $out[] = array($sevs,$code); |
if ($inside_severity_block) return false; |
unset($sevs); |
// Step 2: Process severities (split to online/offline) |
// Allowed: ['INFO'] or ['INFO', 'INFO'] |
// Disallow: ['NONE'] and ['NONE', 'NONE'] |
foreach ($out as &$component) { |
$sev_fixed = null; |
$sevs = $component[0]; |
if (count($sevs) == 1) { |
if ($sevs[0] == 'NONE') return false; // meaningless component |
try { self::convertSeverity($sevs[0]); } catch (\Exception $e) { return false; } // just checking for valid value |
$sev_fixed = $sevs[0]; |
} else if (count($sevs) == 2) { |
$sev_online = $sevs[0]; |
$sev_offline = $sevs[1]; |
if (($sev_online == 'NONE') && ($sev_offline == 'NONE')) return false; // meaningless component |
try { self::convertSeverity($sev_online); } catch (\Exception $e) { return false; } // just checking for valid value |
try { self::convertSeverity($sev_offline); } catch (\Exception $e) { return false; } // just checking for valid value |
$sev_fixed = [$sev_online, $sev_offline]; |
} else { |
return false; |
} |
$component[0] = $sev_fixed; |
} |
// Step 3: Process target (split to type and value) |
// 'OID(2.999)' becomes ['OID', '2.999'] |
// 'A' becomes ['A'] |
foreach ($out as &$component) { |
$m = array(); |
if (preg_match('@^([^()]+)\((.+)\)$@ismU', $component[1], $m)) { |
$type = $m[1]; |
$value = $m[2]; |
$component[1] = [$type, $value]; |
} else { |
$component[1] = [$component[1]]; |
} |
} |
// Some other checks (it makes it easier to validate the maskcodes with dev tools) |
foreach ($out as list($severity,$target)) { |
if (($target[0] == 'OID') || ($target[0] == 'SUPOID')) { |
if (is_array($severity)) return false; // OID and SUPOID logger mask cannot have online/offline severity |
if (empty($target[1])) return false; /** @phpstan-ignore-line */ |
} else if (($target[0] == 'OIDRA') || ($target[0] == 'SUPOIDRA') || ($target[0] == 'RA')) { |
if (empty($target[1])) return false; |
} else if ($target[0] == 'A') { |
if (!empty($target[1])) return false; |
} else { |
return false; |
} |
} |
return $out; |
} |
187,238 → 248,232 |
} |
/** |
* @param string $maskcodes A description of the mask-codes can be found in doc/developer_notes/logger_maskcodes.md |
* @param string $maskcode A description of the mask-codes can be found in doc/developer_notes/logger_maskcodes.md |
* @param string $message The message of the event |
* @param mixed ...$sprintfArgs If used, %1..%n in $maskcodes and $message will be replaced, like _L() does. |
* @param mixed ...$sprintfArgs If used, %1..%n in $maskcode and $message will be replaced, like _L() does. |
* @return bool |
* @throws OIDplusException |
*/ |
public function log(string $maskcodes, string $message, ...$sprintfArgs): bool { |
public function log(string $maskcode, string $message, ...$sprintfArgs): bool { |
$this->reLogMissing(); // try to re-log failed requests |
$maskcodes = my_vsprintf($maskcodes, $sprintfArgs); |
$sprintfArgs_Escaped = array(); |
foreach ($sprintfArgs as $arg) { |
// Inside an severity block, e.g. INFO of [INFO], we would need to escape []/\ |
// In the value, e.g. 2.999 of OID(2.999), we would need to escape ()+\ |
// Since there seems to be no meaningful use-case for parametrized severities, we only escape the value |
$sprintfArgs_Escaped[] = str_replace(array('(',')','+','\\'), array('\\(', '\\)', '\\+', '\\\\'), $arg); |
} |
$maskcode = my_vsprintf($maskcode, $sprintfArgs_Escaped); |
$message = my_vsprintf($message, $sprintfArgs); |
if (strpos(str_replace('%%','',$maskcodes),'%') !== false) { |
if (strpos(str_replace('%%','',$maskcode),'%') !== false) { |
throw new OIDplusException(_L('Unresolved wildcards in logging maskcode')); |
} |
return $this->log_internal($maskcodes, $message, true); |
return $this->log_internal($maskcode, $message, true); |
} |
/** |
* @param string $maskcodes |
* @param string $message |
* @param bool $allow_delayed_log |
* @return bool |
* @param string $sev_name |
* @return int |
* @throws OIDplusConfigInitializationException |
* @throws OIDplusException |
*/ |
private function log_internal(string $maskcodes, string $message, bool $allow_delayed_log): bool { |
$loggerPlugins = OIDplus::getLoggerPlugins(); |
if (count($loggerPlugins) == 0) { |
// The plugin might not be initialized in OIDplus::init() |
// yet. Remember the log entries for later submission during |
// OIDplus::init(); |
if ($allow_delayed_log) $this->missing_plugin_queue[] = array($maskcodes, $message); |
return false; |
} |
private static function convertSeverity(string $sev_name): int { |
//$sev_name = strtoupper($sev_name); |
// What is a mask code? |
// A mask code gives information about the log event: |
// 1. The severity (info, warning, error) |
// 2. In which logbook(s) the event shall be placed |
// Example: |
// The event would be: |
// "Person 'X' moves from house 'A' to house 'B'" |
// This event would affect the person X and the two houses, |
// so, instead of logging into 3 logbooks separately, |
// you would create a mask code that tells the system |
// to put the message into the logbooks of person X, |
// house A, and house B. |
switch ($sev_name) { |
case 'NONE': |
// Do not log anything. Used for online/offline severity pairs |
return -1; |
$logEvent = new OIDplusLogEvent($message); |
// A mask code with multiple components is split into single codes |
// using '+' or '/', e.g. "OID(x)+RA(x)" would be split to "OID(x)" and "RA(x)" |
// which would result in the message being placed in the logbook of OID x, |
// and the logbook of the RA owning OID x. |
$maskcodes_ary = $this->split_maskcodes($maskcodes); |
if ($maskcodes_ary === false) { |
throw new OIDplusException(_L('Invalid maskcode "%1" (failed to split)',$maskcodes)); |
} |
foreach ($maskcodes_ary as list($sevs,$maskcode)) { |
// At the beginning of each mask code, you must define a severity. |
// If you have a mask code with multiple components, you don't have to place the |
// severity for each component. You can just leave it at the beginning. |
// e.g. "[WARN]OID(x)+RA(x)" is equal to "[WARN]OID(x)+[WARN]RA(x)" |
// You can also put different severities for the components: |
// e.g. "[INFO]OID(x)+[WARN]RA(x)" would be a info for the OID, but a warning for the RA. |
// If you want to make the severity dependent on wheather the user is logged in or not, |
// prepend "?" or "!" and use '/' as delimiter |
// Example: "[?WARN/!OK]RA(x)" means: If RA is not logged in, it is a warning; if it is logged in, it is an success |
$severity = 0; // default severity = none |
$severity_online = 0; |
foreach ($sevs as $sev) { |
switch (strtoupper($sev)) { |
// [OK] = Success |
// Numeric value: 1 |
// Rule of thumb: YOU have done something and it was successful |
case '?OK': |
$severity_online = 1; |
break; |
case '!OK': |
case 'OK': |
$severity = 1; |
break; |
return 1; |
// [INFO] = Informational |
// Numeric value: 2 |
// Rule of thumb: Someone else has done something (that affects you) and it was successful |
case '?INFO': |
$severity_online = 2; |
break; |
case '!INFO': |
case 'INFO': |
$severity = 2; |
break; |
return 2; |
// [WARN] = Warning |
// Numeric value: 3 |
// Rule of thumb: Something happened (probably someone did something) and it affects you |
case '?WARN': |
$severity_online = 3; |
break; |
case '!WARN': |
case 'WARN': |
$severity = 3; |
break; |
return 3; |
// [ERR] = Error |
// Numeric value: 4 |
// Rule of thumb: Something failed (probably someone did something) and it affects you |
case '?ERR': |
$severity_online = 4; |
break; |
case '!ERR': |
case 'ERR': |
$severity = 4; |
break; |
return 4; |
// [CRIT] = Critical |
// Numeric value: 5 |
// Rule of thumb: Something happened (probably someone did something) which is not an error, |
// but some critical situation (e.g. hardware failure), and it affects you |
case '?CRIT': |
$severity_online = 5; |
break; |
case '!CRIT': |
case 'CRIT': |
$severity = 5; |
break; |
return 5; |
default: |
throw new OIDplusException(_L('Invalid maskcode "%1" (Unknown severity "%2")',$maskcodes,$sev)); |
throw new OIDplusException(_L('Unknown severity "%1" in logger maskcode',$sev_name)); |
} |
} |
/** |
* @param string $maskcode |
* @param string $message |
* @param bool $allow_delayed_log |
* @return bool |
* @throws OIDplusException |
*/ |
private function log_internal(string $maskcode, string $message, bool $allow_delayed_log): bool { |
$loggerPlugins = OIDplus::getLoggerPlugins(); |
if (count($loggerPlugins) == 0) { |
// The plugin might not be initialized in OIDplus::init() |
// yet. Remember the log entries for later submission during |
// OIDplus::init(); |
if ($allow_delayed_log) $this->missing_plugin_queue[] = array($maskcode, $message); |
return false; |
} |
$logEvent = new OIDplusLogEvent($message); |
$maskcode_ary = self::parse_maskcode($maskcode); |
if ($maskcode_ary === false) { |
throw new OIDplusException(_L('Invalid maskcode "%1" (failed to parse or has invalid data)',$maskcode)); |
} |
foreach ($maskcode_ary as list($severity,$target)) { |
if ($target[0] == 'OID') { |
// OID(x) Save log entry into the logbook of: Object "x" |
$m = array(); |
if (preg_match('@^OID\((.+)\)$@ismU', $maskcode, $m)) { |
$object_id = $m[1]; |
$logEvent->addTarget(new OIDplusLogTargetObject($severity, $object_id)); |
if ($object_id == '') throw new OIDplusException(_L('OID logger mask requires OID')); |
$object_id = $target[1]; |
assert(!is_array($severity)); |
$obj = OIDplusObject::parse($object_id); |
if (!$obj) throw new OIDplusException(_L('OID logger mask: Invalid object %1',$object_id)); |
if (($severity_int = self::convertSeverity($severity)) >= 0) { |
$logEvent->addTarget(new OIDplusLogTargetObject($severity_int, $object_id)); |
} |
} |
else if ($target[0] == 'SUPOID') { |
// SUPOID(x) Save log entry into the logbook of: Parent of object "x" |
else if (preg_match('@^SUPOID\((.+)\)$@ismU', $maskcode, $m)) { |
$object_id = $m[1]; |
if ($object_id == '') throw new OIDplusException(_L('SUPOID logger mask requires OID')); |
$object_id = $target[1]; |
assert(!is_array($severity)); |
$obj = OIDplusObject::parse($object_id); |
if ($obj) { |
if (!$obj) throw new OIDplusException(_L('SUPOID logger mask: Invalid object %1',$object_id)); |
if ($objParent = $obj->getParent()) { |
$parent = $objParent->nodeId(); |
$logEvent->addTarget(new OIDplusLogTargetObject($severity, $parent)); |
if (($severity_int = self::convertSeverity($severity)) >= 0) { |
$logEvent->addTarget(new OIDplusLogTargetObject($severity_int, $parent)); |
} |
} else { |
//throw new OIDplusException(_L('%1 has no parent',$object_id)); |
} |
} else { |
throw new OIDplusException(_L('SUPOID logger mask: Invalid object %1',$object_id)); |
} |
} |
// OIDRA(x)? Save log entry into the logbook of: Logged in RA of object "x" |
// Remove or replace "?" by "!" if the entity does not need to be logged in |
else if (preg_match('@^OIDRA\((.+)\)([\?\!])$@ismU', $maskcode, $m)) { |
$object_id = $m[1]; |
$ra_need_login = $m[2] == '?'; |
if ($object_id == '') throw new OIDplusException(_L('OIDRA logger mask requires OID')); |
else if ($target[0] == 'OIDRA') { |
// OIDRA(x) Save log entry into the logbook of: Logged in RA of object "x" |
$object_id = $target[1]; |
$obj = OIDplusObject::parse($object_id); |
if ($obj) { |
if ($ra_need_login) { |
foreach (OIDplus::authUtils()->loggedInRaList() as $ra) { |
if ($obj->userHasWriteRights($ra)) $logEvent->addTarget(new OIDplusLogTargetUser($severity_online, $ra->raEmail())); |
if (!$obj) throw new OIDplusException(_L('OIDRA logger mask: Invalid object "%1"', $object_id)); |
if (!is_array($severity)) { |
$severity_online = $severity; |
$severity_offline = $severity; |
} else { |
$severity_online = $severity[0]; |
$severity_offline = $severity[1]; |
} |
} else { |
// $logEvent->addTarget(new OIDplusLogTargetUser($severity, $obj->getRa()->raEmail())); |
foreach (OIDplusRA::getAllRAs() as $ra) { |
if ($obj->userHasWriteRights($ra)) $logEvent->addTarget(new OIDplusLogTargetUser($severity, $ra->raEmail())); |
if ($obj->userHasWriteRights($ra)) { |
if (OIDplus::authUtils()->isRaLoggedIn($ra)) { |
if (($severity_online_int = self::convertSeverity($severity_online)) >= 0) { |
$logEvent->addTarget(new OIDplusLogTargetUser($severity_online_int, $ra->raEmail())); |
} |
} |
} else { |
throw new OIDplusException(_L('OIDRA logger mask: Invalid object "%1"',$object_id)); |
if (($severity_offline_int = self::convertSeverity($severity_offline)) >= 0) { |
$logEvent->addTarget(new OIDplusLogTargetUser($severity_offline_int, $ra->raEmail())); |
} |
} |
} |
} |
} |
// SUPOIDRA(x)? Save log entry into the logbook of: Logged in RA that owns the superior object of "x" |
// Remove or replace "?" by "!" if the entity does not need to be logged in |
else if (preg_match('@^SUPOIDRA\((.+)\)([\?\!])$@ismU', $maskcode, $m)) { |
$object_id = $m[1]; |
$ra_need_login = $m[2] == '?'; |
if ($object_id == '') throw new OIDplusException(_L('SUPOIDRA logger mask requires OID')); |
else if ($target[0] == 'SUPOIDRA') { |
// SUPOIDRA(x) Save log entry into the logbook of: Logged in RA that owns the superior object of "x" |
$object_id = $target[1]; |
$obj = OIDplusObject::parse($object_id); |
if ($obj) { |
if ($ra_need_login) { |
foreach (OIDplus::authUtils()->loggedInRaList() as $ra) { |
if ($obj->userHasParentalWriteRights($ra)) $logEvent->addTarget(new OIDplusLogTargetUser($severity_online, $ra->raEmail())); |
if (!$obj) throw new OIDplusException(_L('SUPOIDRA logger mask: Invalid object "%1"',$object_id)); |
if (!is_array($severity)) { |
$severity_online = $severity; |
$severity_offline = $severity; |
} else { |
$severity_online = $severity[0]; |
$severity_offline = $severity[1]; |
} |
} else { |
if ($objParent = $obj->getParent()) { |
// $logEvent->addTarget(new OIDplusLogTargetUser($severity, $objParent->getRa()->raEmail())); |
foreach (OIDplusRA::getAllRAs() as $ra) { |
if ($obj->userHasParentalWriteRights($ra)) $logEvent->addTarget(new OIDplusLogTargetUser($severity, $ra->raEmail())); |
if ($obj->userHasParentalWriteRights($ra)) { |
if (OIDplus::authUtils()->isRaLoggedIn($ra)) { |
if (($severity_online_int = self::convertSeverity($severity_online)) >= 0) { |
$logEvent->addTarget(new OIDplusLogTargetUser($severity_online_int, $ra->raEmail())); |
} |
} else { |
//throw new OIDplusException(_L('%1 has no parent, therefore also no parent RA',$object_id)); |
if (($severity_offline_int = self::convertSeverity($severity_offline)) >= 0) { |
$logEvent->addTarget(new OIDplusLogTargetUser($severity_offline_int, $ra->raEmail())); |
} |
} |
} else { |
throw new OIDplusException(_L('SUPOIDRA logger mask: Invalid object "%1"',$object_id)); |
} |
} |
} |
// RA(x)? Save log entry into the logbook of: Logged in RA "x" |
// Remove or replace "?" by "!" if the entity does not need to be logged in |
else if (preg_match('@^RA\((.*)\)([\?\!])$@ismU', $maskcode, $m)) { |
$ra_email = $m[1]; |
$ra_need_login = $m[2] == '?'; |
if (!empty($ra_email)) { |
if ($ra_need_login && OIDplus::authUtils()->isRaLoggedIn($ra_email)) { |
$logEvent->addTarget(new OIDplusLogTargetUser($severity_online, $ra_email)); |
} else if (!$ra_need_login) { |
$logEvent->addTarget(new OIDplusLogTargetUser($severity, $ra_email)); |
else if ($target[0] == 'RA') { |
// RA(x) Save log entry into the logbook of: Logged in RA "x" |
$ra_email = $target[1]; |
if (!is_array($severity)) { |
$severity_online = $severity; |
$severity_offline = $severity; |
} else { |
$severity_online = $severity[0]; |
$severity_offline = $severity[1]; |
} |
if (OIDplus::authUtils()->isRaLoggedIn($ra_email)) { |
if (($severity_online_int = self::convertSeverity($severity_online)) >= 0) { |
$logEvent->addTarget(new OIDplusLogTargetUser($severity_online_int, $ra_email)); |
} |
} else { |
if (($severity_offline_int = self::convertSeverity($severity_offline)) >= 0) { |
$logEvent->addTarget(new OIDplusLogTargetUser($severity_offline_int, $ra_email)); |
} |
} |
} |
// A? Save log entry into the logbook of: A logged in admin |
// Remove or replace "?" by "!" if the entity does not need to be logged in |
else if (preg_match('@^A([\?\!])$@imU', $maskcode, $m)) { |
$admin_need_login = $m[1] == '?'; |
if ($admin_need_login && OIDplus::authUtils()->isAdminLoggedIn()) { |
$logEvent->addTarget(new OIDplusLogTargetUser($severity_online, 'admin')); |
} else if (!$admin_need_login) { |
$logEvent->addTarget(new OIDplusLogTargetUser($severity, 'admin')); |
else if ($target[0] == 'A') { |
// A Save log entry into the logbook of: A logged in admin |
if (!is_array($severity)) { |
$severity_online = $severity; |
$severity_offline = $severity; |
} else { |
$severity_online = $severity[0]; |
$severity_offline = $severity[1]; |
} |
if (OIDplus::authUtils()->isAdminLoggedIn()) { |
if (($severity_online_int = self::convertSeverity($severity_online)) >= 0) { |
$logEvent->addTarget(new OIDplusLogTargetUser($severity_online_int, 'admin')); |
} |
} else { |
if (($severity_offline_int = self::convertSeverity($severity_offline)) >= 0) { |
$logEvent->addTarget(new OIDplusLogTargetUser($severity_offline_int, 'admin')); |
} |
} |
} |
// Unexpected |
else { |
throw new OIDplusException(_L('Unexpected logger component "%1" in mask code "%2"',$maskcode,$maskcodes)); |
throw new OIDplusException(_L('Unexpected logger component type "%1" in mask code "%2"',$target[0],$maskcode)); |
} |
} |
/trunk/plugins/viathinksoft/adminPages/110_system_config/OIDplusPageAdminSystemConfig.class.php |
---|
54,7 → 54,9 |
$old_value = OIDplus::config()->getValue($name, ''); |
OIDplus::config()->setValue($name, $value); |
OIDplus::logger()->log("[OK]A?", "Changed system config setting '%1' from '%2' to '%3'", $name, $old_value, $value); |
if ($old_value != $value) { |
OIDplus::logger()->log("V2:[OK/INFO]A", "Changed system config setting '%1' from '%2' to '%3'", $name, $old_value, $value); |
} |
return array("status" => 0); |
} else { |
/trunk/plugins/viathinksoft/adminPages/120_registration/OIDplusPageAdminRegistration.class.php |
---|
425,7 → 425,7 |
return false; // throw new OIDplusException(_L('Received error status code: %1',$json['status'])); |
} |
} else if ($json['status'] == 99/*Hash conflict*/) { |
OIDplus::logger()->log("[WARN]A!", "Removing SystemID and key pair because there is a hash conflict with another OIDplus system!"); |
OIDplus::logger()->log("V2:[WARN]A", "Removing SystemID and key pair because there is a hash conflict with another OIDplus system!"); |
// Delete the system ID since we have a conflict with the 31-bit hash! |
OIDplus::config()->setValue('oidplus_private_key', ''); |
510,7 → 510,7 |
$this->sendRegistrationQuery(); |
} catch (\Exception $e) { |
// Don't do anything, because we don't want that a failed registration query blocks the system |
OIDplus::logger()->log('[WARN]A!', 'System registration query crashed: %1', $e->getMessage()); |
OIDplus::logger()->log('V2:[WARN]A', 'System registration query crashed: %1', $e->getMessage()); |
} |
} |
} |
/trunk/plugins/viathinksoft/adminPages/130_create_ra/OIDplusPageAdminCreateRa.class.php |
---|
63,7 → 63,7 |
throw new OIDplusException(_L('Password is too short. Need at least %1 characters',$minlen)); |
} |
OIDplus::logger()->log("[INFO]RA(%1)!/A?", "RA '%1' was created by the admin, without email address verification or invitation", $email); |
OIDplus::logger()->log("V2:[INFO]RA(%1)+[OK/INFO]A", "RA '%1' was created by the admin, without email address verification or invitation", $email); |
$ra = new OIDplusRA($email); |
$ra->register_ra($password1); |
/trunk/plugins/viathinksoft/adminPages/400_oidinfo_export/OIDplusPageAdminOIDInfoExport.class.php |
---|
1133,7 → 1133,7 |
} |
// We do the logging at the end, otherwise SUPOIDRA() might not work correctly if the OIDs were not imported in order or if there were orphans |
OIDplus::logger()->log("[INFO]OID(%1)+[INFO]SUPOID(%1)+[INFO]SUPOIDRA(%1)!/[INFO]A!", "Object '%1' was automatically created by the XML import tool", $id); |
OIDplus::logger()->log("V2:[INFO]OID(%1)+[INFO]SUPOID(%1)+[INFO]SUPOIDRA(%1)+[OK/INFO]A", "Object '%1' was automatically created by the XML import tool", $id); |
} |
$count_imported_oids = count($ok_oids); |
/trunk/plugins/viathinksoft/adminPages/700_colors/OIDplusPageAdminColors.class.php |
---|
88,7 → 88,7 |
OIDplus::config()->setValue('color_invert', $params['invcolors']); |
OIDplus::config()->setValue('design', $params['theme']); |
OIDplus::logger()->log("[OK]A?", "Changed system color theme"); |
OIDplus::logger()->log("V2:[OK/INFO]A", "Changed system color theme"); |
return array("status" => 0); |
} else { |
/trunk/plugins/viathinksoft/language/dede/messages.xml |
---|
3462,22 → 3462,14 |
</message> |
<message> |
<source><![CDATA[ |
Invalid maskcode "%1" (Unknown severity "%2") |
Invalid maskcode "%1" (failed to parse or has invalid data) |
]]></source> |
<target><![CDATA[ |
Ungültiger Mask-Code "%1" (Unbekannter Schweregrad "%2") |
Ungültiger Logging-Maskcode "%1" (Fehler beim Parsen oder ungültige Inhalte) |
]]></target> |
</message> |
<message> |
<source><![CDATA[ |
Invalid maskcode "%1" (failed to split) |
]]></source> |
<target><![CDATA[ |
Ungültiger Mask-Code "%1" (Splitten fehlgeschlagen) |
]]></target> |
</message> |
<message> |
<source><![CDATA[ |
Invalid object "%1" |
]]></source> |
<target><![CDATA[ |
4446,10 → 4438,10 |
</message> |
<message> |
<source><![CDATA[ |
OID logger mask requires OID |
OID logger mask: Invalid object %1 |
]]></source> |
<target><![CDATA[ |
OID-Log-Maske benötigt OID |
OID Logger Mask: Ungültiges Objekt %1 |
]]></target> |
</message> |
<message> |
4510,14 → 4502,6 |
</message> |
<message> |
<source><![CDATA[ |
OIDRA logger mask requires OID |
]]></source> |
<target><![CDATA[ |
OIDRA-Log-Maske benötigt OID |
]]></target> |
</message> |
<message> |
<source><![CDATA[ |
OIDRA logger mask: Invalid object "%1" |
]]></source> |
<target><![CDATA[ |
6342,14 → 6326,6 |
</message> |
<message> |
<source><![CDATA[ |
SUPOID logger mask requires OID |
]]></source> |
<target><![CDATA[ |
SUPOID-Log-Maske benötigt OID |
]]></target> |
</message> |
<message> |
<source><![CDATA[ |
SUPOID logger mask: Invalid object %1 |
]]></source> |
<target><![CDATA[ |
6358,14 → 6334,6 |
</message> |
<message> |
<source><![CDATA[ |
SUPOIDRA logger mask requires OID |
]]></source> |
<target><![CDATA[ |
SUPOIDRA-Log-Maske benötigt OID |
]]></target> |
</message> |
<message> |
<source><![CDATA[ |
SUPOIDRA logger mask: Invalid object "%1" |
]]></source> |
<target><![CDATA[ |
7838,10 → 7806,10 |
</message> |
<message> |
<source><![CDATA[ |
Unexpected logger component "%1" in mask code "%2" |
Unexpected logger component type "%1" in mask code "%2" |
]]></source> |
<target><![CDATA[ |
Unerwartete Logbuch-Komponente "%1" in Mask-Code "%2" |
Unerwarteter Logger-Komponententyp "%1" in Maskcode "%2" |
]]></target> |
</message> |
<message> |
7886,6 → 7854,14 |
</message> |
<message> |
<source><![CDATA[ |
Unknown severity "%1" in logger maskcode |
]]></source> |
<target><![CDATA[ |
Unbekannter Schweregrad "%1" in Logger-Maskcode |
]]></target> |
</message> |
<message> |
<source><![CDATA[ |
Unknown update version |
]]></source> |
<target><![CDATA[ |
/trunk/plugins/viathinksoft/publicPages/000_objects/OIDplusPagePublicObjects.class.php |
---|
155,12 → 155,12 |
} |
} |
OIDplus::logger()->log("[WARN]OID(%1)+[?WARN/!OK]SUPOIDRA(%1)?/[?INFO/!OK]A?", "Object '%1' (recursively) deleted", $id); |
OIDplus::logger()->log("[CRIT]OIDRA(%1)!", "Lost ownership of object '%1' because it was deleted", $id); |
OIDplus::logger()->log("V2:[WARN]OID(%1)+[OK/WARN]SUPOIDRA(%1)+[OK/INFO]A", "Object '%1' (recursively) deleted", $id); |
OIDplus::logger()->log("V2:[CRIT]OIDRA(%1)", "Lost ownership of object '%1' because it was deleted", $id); |
if ($parentObj = $obj->getParent()) { |
$parent_oid = $parentObj->nodeId(); |
OIDplus::logger()->log("[WARN]OID(%2)", "Object '%1' (recursively) deleted", $id, $parent_oid); |
OIDplus::logger()->log("V2:[WARN]OID(%2)", "Object '%1' (recursively) deleted", $id, $parent_oid); |
} |
// Delete object |
177,7 → 177,7 |
while ($row = $res->fetch_array()) { |
$id_to_delete = $row['id']; |
OIDplus::logger()->log("[CRIT]OIDRA(%2)!", "Lost ownership of object '%2' because one of the superior objects ('%1') was recursively deleted", $id, $id_to_delete); |
OIDplus::logger()->log("V2:[CRIT]OIDRA(%2)", "Lost ownership of object '%2' because one of the superior objects ('%1') was recursively deleted", $id, $id_to_delete); |
OIDplus::db()->query("delete from ###objects where id = ?", array($id_to_delete)); |
OIDplusObject::resetObjectInformationCache(); |
} |
256,12 → 256,12 |
// Change RA recursively |
$current_ra = $obj->getRaMail() ?? ''; |
if ($new_ra != $current_ra) { |
OIDplus::logger()->log("[INFO]OID(%1)+[?INFO/!OK]SUPOIDRA(%1)?/[?INFO/!OK]A?", "RA of object '%1' changed from '%2' to '%3'", $id, $current_ra, $new_ra); |
OIDplus::logger()->log("[WARN]RA(%2)!", "Lost ownership of object '%1' due to RA transfer of superior RA / admin.", $id, $current_ra, $new_ra); |
OIDplus::logger()->log("[INFO]RA(%3)!", "Gained ownership of object '%1' due to RA transfer of superior RA / admin.", $id, $current_ra, $new_ra); |
OIDplus::logger()->log("V2:[INFO]OID(%1)+[OK/INFO]SUPOIDRA(%1)+[OK/INFO]A", "RA of object '%1' changed from '%2' to '%3'", $id, $current_ra, $new_ra); |
OIDplus::logger()->log("V2:[WARN]RA(%2)", "Lost ownership of object '%1' due to RA transfer of superior RA / admin.", $id, $current_ra, $new_ra); |
OIDplus::logger()->log("V2:[INFO]RA(%3)", "Gained ownership of object '%1' due to RA transfer of superior RA / admin.", $id, $current_ra, $new_ra); |
if ($parentObj = $obj->getParent()) { |
$parent_oid = $parentObj->nodeId(); |
OIDplus::logger()->log("[INFO]OID(%4)", "RA of object '%1' changed from '%2' to '%3'", $id, $current_ra, $new_ra, $parent_oid); |
OIDplus::logger()->log("V2:[INFO]OID(%4)", "RA of object '%1' changed from '%2' to '%3'", $id, $current_ra, $new_ra, $parent_oid); |
} |
$this->ra_change_rec($id, $current_ra, $new_ra); // Recursively change inherited RAs |
} |
268,10 → 268,10 |
} |
// Log if confidentially flag was changed |
OIDplus::logger()->log("[INFO]OID(%1)+[?INFO/!OK]SUPOIDRA(%1)?/[?INFO/!OK]A?", "Identifiers/Confidential flag of object '%1' updated", $id); // TODO: Check if they were ACTUALLY updated! |
OIDplus::logger()->log("V2:[INFO]OID(%1)+[OK/INFO]SUPOIDRA(%1)+[OK/INFO]A", "Identifiers/Confidential flag of object '%1' updated", $id); // TODO: Check if they were ACTUALLY updated! |
if ($parentObj = $obj->getParent()) { |
$parent_oid = $parentObj->nodeId(); |
OIDplus::logger()->log("[INFO]OID(%2)", "Identifiers/Confidential flag of object '%1' updated", $id, $parent_oid); // TODO: Check if they were ACTUALLY updated! |
OIDplus::logger()->log("V2:[INFO]OID(%2)", "Identifiers/Confidential flag of object '%1' updated", $id, $parent_oid); // TODO: Check if they were ACTUALLY updated! |
} |
// Replace ASN.1 IDs und IRIs |
357,7 → 357,7 |
} |
} |
OIDplus::logger()->log("[INFO]OID(%1)+[?INFO/!OK]OIDRA(%1)?/[?INFO/!OK]A?", "Title/Description of object '%1' updated", $id); |
OIDplus::logger()->log("V2:[INFO]OID(%1)+[OK/INFO]OIDRA(%1)+[OK/INFO]A", "Title/Description of object '%1' updated", $id); |
if (isset($params['title'])) { |
$title = $params['title']; |
485,12 → 485,12 |
} |
if (empty($ra_email)) { |
OIDplus::logger()->log("[INFO]OID(%2)+[INFO]OID(%1)+[?INFO/!OK]OIDRA(%2)?/[?INFO/!OK]A?", "Object '%1' created, without defined RA, superior object is '%2'", $id, $parent); |
OIDplus::logger()->log("V2:[INFO]OID(%2)+[INFO]OID(%1)+[OK/INFO]OIDRA(%2)+[OK/INFO]A", "Object '%1' created, without defined RA, superior object is '%2'", $id, $parent); |
} else { |
OIDplus::logger()->log("[INFO]OID(%2)+[INFO]OID(%1)+[?INFO/!OK]OIDRA(%2)?/[?INFO/!OK]A?", "Object '%1' created, given to RA '%3', superior object is '%2'", $id, $parent, $ra_email); |
OIDplus::logger()->log("V2:[INFO]OID(%2)+[INFO]OID(%1)+[OK/INFO]OIDRA(%2)+[OK/INFO]A", "Object '%1' created, given to RA '%3', superior object is '%2'", $id, $parent, $ra_email); |
} |
if (!empty($ra_email)) { |
OIDplus::logger()->log("[INFO]RA(%2)!", "Gained ownership of newly created object '%1'", $id, $ra_email); |
OIDplus::logger()->log("V2:[INFO]RA(%2)", "Gained ownership of newly created object '%1'", $id, $ra_email); |
} |
$confidential = isset($params['confidential']) && $params['confidential'] == 'true'; |
/trunk/plugins/viathinksoft/publicPages/001_ra_base/OIDplusPagePublicRaBaseUtils.class.php |
---|
58,7 → 58,7 |
$ra->delete(); |
$ra = null; |
OIDplus::logger()->log("[?WARN/!OK]RA(%1)!/[?INFO/!OK]A?", "RA '%1' deleted", $email); |
OIDplus::logger()->log("V2:[OK/WARN]RA(%1)+[OK/INFO]A", "RA '%1' deleted", $email); |
return array("status" => 0); |
} else { |
/trunk/plugins/viathinksoft/publicPages/090_login/OIDplusPagePublicLogin.class.php |
---|
65,9 → 65,9 |
} else { |
if (OIDplus::config()->getValue('log_failed_ra_logins', false)) { |
if ($ra->existing()) { |
OIDplus::logger()->log("[WARN]A!", "Failed login to RA account '%1' (wrong password)", $email); |
OIDplus::logger()->log("V2:[WARN]A", "Failed login to RA account '%1' (wrong password)", $email); |
} else { |
OIDplus::logger()->log("[WARN]A!", "Failed login to RA account '%1' (RA not existing)", $email); |
OIDplus::logger()->log("V2:[WARN]A", "Failed login to RA account '%1' (RA not existing)", $email); |
} |
} |
throw new OIDplusException(_L('Wrong password or user not registered')); |
99,7 → 99,7 |
return array("status" => 0); |
} else { |
if (OIDplus::config()->getValue('log_failed_admin_logins', false)) { |
OIDplus::logger()->log("[WARN]A!", "Failed login to admin account"); |
OIDplus::logger()->log("V2:[WARN]A", "Failed login to admin account"); |
} |
throw new OIDplusException(_L('Wrong password')); |
} |
/trunk/plugins/viathinksoft/publicPages/091_forgot_password/OIDplusPagePublicForgotPassword.class.php |
---|
43,7 → 43,7 |
OIDplus::getActiveCaptchaPlugin()->captchaVerify($params, 'captcha'); |
OIDplus::logger()->log("[WARN]RA(%1)!", "A new password for '%1' was requested (forgot password)", $email); |
OIDplus::logger()->log("V2:[WARN]RA(%1)", "A new password for '%1' was requested (forgot password)", $email); |
$timestamp = time(); |
$activate_url = OIDplus::webpath(null,OIDplus::PATH_ABSOLUTE_CANONICAL) . '?goto='.urlencode('oidplus:reset_password$'.$email.'$'.$timestamp.'$'.OIDplus::authUtils()->makeAuthKey('reset_password;'.$email.';'.$timestamp)); |
86,7 → 86,7 |
throw new OIDplusException(_L('Password is too short. Need at least %1 characters',$minlen)); |
} |
OIDplus::logger()->log("[INFO]RA(%1)!", "RA '%1' has reset his password (forgot passwort)", $email); |
OIDplus::logger()->log("V2:[INFO]RA(%1)", "RA '%1' has reset his password (forgot passwort)", $email); |
$ra = new OIDplusRA($email); |
$ra->change_password($password1); |
/trunk/plugins/viathinksoft/publicPages/095_attachments/OIDplusPagePublicAttachments.class.php |
---|
206,7 → 206,7 |
if (!file_exists($uploadfile)) throw new OIDplusException(_L('File does not exist')); |
@unlink($uploadfile); |
if (file_exists($uploadfile)) { |
OIDplus::logger()->log("[ERR]OID(%1)+[ERR]A!", "Attachment file '%2' could not be deleted from object '%1' (problem with permissions?)", $id, basename($uploadfile)); |
OIDplus::logger()->log("V2:[ERR]OID(%1)+[ERR]A", "Attachment file '%2' could not be deleted from object '%1' (problem with permissions?)", $id, basename($uploadfile)); |
$msg = _L('Attachment file "%1" could not be deleted from object "%2" (problem with permissions?)',basename($uploadfile),$id); |
if (OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusException($msg); |
219,7 → 219,7 |
if (is_array($ary) && (count($ary) == 0)) @rmdir($uploaddir); |
} |
OIDplus::logger()->log("[OK]OID(%1)+[?INFO/!OK]OIDRA(%1)?/[?INFO/!OK]A?", "Deleted attachment '%2' from object '%1'", $id, basename($uploadfile)); |
OIDplus::logger()->log("V2:[OK]OID(%1)+[OK/INFO]OIDRA(%1)+[OK/INFO]A", "Deleted attachment '%2' from object '%1'", $id, basename($uploadfile)); |
return array("status" => 0); |
285,7 → 285,7 |
if (!is_dir($uploaddir)) { |
@mkdir($uploaddir, 0777, true); |
if (!is_dir($uploaddir)) { |
OIDplus::logger()->log("[ERR]OID(%1)+[ERR]A!", "Upload attachment '%2' to object '%1' failed: Cannot create directory '%3' (problem with permissions?)", $id, basename($uploadfile), basename($uploaddir)); |
OIDplus::logger()->log("V2:[ERR]OID(%1)+[ERR]A", "Upload attachment '%2' to object '%1' failed: Cannot create directory '%3' (problem with permissions?)", $id, basename($uploadfile), basename($uploaddir)); |
$msg = _L('Upload attachment "%1" to object "%2" failed',basename($uploadfile),$id).': '._L('Cannot create directory "%1" (problem with permissions?)',basename($uploaddir)); |
if (OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusException($msg); |
296,7 → 296,7 |
} |
if (!@move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { |
OIDplus::logger()->log("[ERR]OID(%1)+[ERR]A!", "Upload attachment '%2' to object '%1' failed: Cannot move uploaded file into directory (problem with permissions?)", $id, basename($uploadfile)); |
OIDplus::logger()->log("V2:[ERR]OID(%1)+[ERR]A", "Upload attachment '%2' to object '%1' failed: Cannot move uploaded file into directory (problem with permissions?)", $id, basename($uploadfile)); |
$msg = _L('Upload attachment "%1" to object "%2" failed',basename($uploadfile),$id).': '._L('Cannot move uploaded file into directory (problem with permissions?)'); |
if (OIDplus::authUtils()->isAdminLoggedIn()) { |
throw new OIDplusException($msg); |
305,7 → 305,7 |
} |
} |
OIDplus::logger()->log("[OK]OID(%1)+[?INFO/!OK]OIDRA(%1)?/[?INFO/!OK]A?", "Uploaded attachment '%2' to object '%1'", $id, basename($uploadfile)); |
OIDplus::logger()->log("V2:[OK]OID(%1)+[OK/INFO]OIDRA(%1)+[OK/INFO]A", "Uploaded attachment '%2' to object '%1'", $id, basename($uploadfile)); |
return array("status" => 0); |
} else { |
514,7 → 514,7 |
if ($ary) foreach ($ary as $a) @unlink($a); |
@rmdir($uploaddir); |
if (is_dir($uploaddir)) { |
OIDplus::logger()->log("[WARN]OID(%1)+[WARN]A!", "Attachment directory '%2' could not be deleted during the deletion of the OID", $id, $uploaddir); |
OIDplus::logger()->log("V2:[WARN]OID(%1)+[WARN]A", "Attachment directory '%2' could not be deleted during the deletion of the OID", $id, $uploaddir); |
} |
} |
} |
/trunk/plugins/viathinksoft/publicPages/200_viathinksoft_freeoid/OIDplusPagePublicFreeOID.class.php |
---|
79,7 → 79,7 |
OIDplus::getActiveCaptchaPlugin()->captchaVerify($params, 'captcha'); |
$root_oid = self::getFreeRootOid(false); |
OIDplus::logger()->log("[INFO]OID(oid:%1)+RA(%2)!", "Requested a free OID for email '%2' to be placed into root '%1'", $root_oid, $email); |
OIDplus::logger()->log("V2:[INFO]OID(oid:%1)+RA(%2)", "Requested a free OID for email '%2' to be placed into root '%1'", $root_oid, $email); |
$timestamp = time(); |
$activate_url = OIDplus::webpath(null,OIDplus::PATH_ABSOLUTE_CANONICAL) . '?goto='.urlencode('oidplus:com.viathinksoft.freeoid.activate_freeoid$'.$email.'$'.$timestamp.'$'.OIDplus::authUtils()->makeAuthKey('com.viathinksoft.freeoid.activate_freeoid;'.$email.';'.$timestamp)); |
151,8 → 151,8 |
$root_oid = self::getFreeRootOid(false); |
$new_oid = OIDplusOid::parse('oid:'.$root_oid)->appendArcs($this->freeoid_max_id()+1)->nodeId(false); |
OIDplus::logger()->log("[INFO]OID(oid:%2)+OIDRA(oid:%2)!", "Child OID '%1' added automatically by '%3' (RA Name: '%4')", $new_oid, $root_oid, $email, $ra_name); |
OIDplus::logger()->log("[INFO]OID(oid:%1)+[OK]RA(%3)!", "Free OID '%1' activated (RA Name: '%4')", $new_oid, $root_oid, $email, $ra_name); |
OIDplus::logger()->log("V2:[INFO]OID(oid:%2)+OIDRA(oid:%2)", "Child OID '%1' added automatically by '%3' (RA Name: '%4')", $new_oid, $root_oid, $email, $ra_name); |
OIDplus::logger()->log("V2:[INFO]OID(oid:%1)+[OK]RA(%3)", "Free OID '%1' activated (RA Name: '%4')", $new_oid, $root_oid, $email, $ra_name); |
if ((!empty($url)) && (substr($url, 0, 4) != 'http')) $url = 'http://'.$url; |
/trunk/plugins/viathinksoft/publicPages/500_resources/OIDplusPagePublicResources.class.php |
---|
230,7 → 230,7 |
$file = str_replace(chr(0), '[NUL]', $file); |
} |
// This will not be logged anymore, because people could spam the log files otherwise |
//OIDplus::logger()->log("[WARN]A!", "LFI/RFI attack blocked (requested file '%1')", $file); |
//OIDplus::logger()->log("V2:[WARN]A", "LFI/RFI attack blocked (requested file '%1')", $file); |
throw new OIDplusException(_L('This request is invalid'), _L('Access denied')); |
} |
/trunk/plugins/viathinksoft/publicPages/800_login_ldap/OIDplusPagePublicLoginLDAP.class.php |
---|
93,7 → 93,7 |
$ra = new OIDplusRA($email); |
if (!$ra->existing()) { |
$this->registerRA($ra, $ldap_userinfo); |
OIDplus::logger()->log("[INFO]RA(%1)!", "RA '%1' was created because of successful LDAP login", $email); |
OIDplus::logger()->log("V2:[INFO]RA(%1)", "RA '%1' was created because of successful LDAP login", $email); |
} |
OIDplus::authUtils()->raLoginEx($email, $remember_me, 'LDAP'); |
162,7 → 162,7 |
if (!$ldap->login($upn, $password)) { |
if (OIDplus::config()->getValue('log_failed_ra_logins', false)) { |
OIDplus::logger()->log("[WARN]A!", "Failed login to RA account '%1' using LDAP", $upn); |
OIDplus::logger()->log("V2:[WARN]A", "Failed login to RA account '%1' using LDAP", $upn); |
} |
throw new OIDplusException(_L('Wrong password or user not registered')); |
} |
/trunk/plugins/viathinksoft/publicPages/810_login_google/oauth.php |
---|
122,7 → 122,7 |
OIDplus::db()->query("update ###ra set ra_name = ?, personal_name = ? where email = ?", array($personal_name, $personal_name, $email)); |
OIDplus::logger()->log("[INFO]RA(%1)!", "RA '%1' was created because of successful Google OAuth2 login", $email); |
OIDplus::logger()->log("V2:[INFO]RA(%1)", "RA '%1' was created because of successful Google OAuth2 login", $email); |
} |
OIDplus::authUtils()->raLoginEx($email, $remember_me=false, 'Google-OAuth2'); |
/trunk/plugins/viathinksoft/publicPages/820_login_facebook/oauth.php |
---|
100,7 → 100,7 |
OIDplus::db()->query("update ###ra set ra_name = ?, personal_name = ? where email = ?", array($personal_name, $personal_name, $email)); |
OIDplus::logger()->log("[INFO]RA(%1)!", "RA '%1' was created because of successful Facebook OAuth2 login", $email); |
OIDplus::logger()->log("V2:[INFO]RA(%1)", "RA '%1' was created because of successful Facebook OAuth2 login", $email); |
} |
OIDplus::authUtils()->raLoginEx($email, $remember_me=false, 'Facebook-OAuth2'); |
/trunk/plugins/viathinksoft/raPages/092_invite/OIDplusPageRaInvite.class.php |
---|
44,7 → 44,7 |
$this->inviteSecurityCheck($email); |
// TODO: should we also log who has invited? |
OIDplus::logger()->log("[INFO]RA(%1)!", "RA '%1' has been invited", $email); |
OIDplus::logger()->log("V2:[INFO]RA(%1)", "RA '%1' has been invited", $email); |
$timestamp = time(); |
$activate_url = OIDplus::webpath(null,OIDplus::PATH_ABSOLUTE_CANONICAL) . '?goto='.urlencode('oidplus:activate_ra$'.$email.'$'.$timestamp.'$'.OIDplus::authUtils()->makeAuthKey('activate_ra;'.$email.';'.$timestamp)); |
87,7 → 87,7 |
throw new OIDplusException(_L('Password is too short. Need at least %1 characters',$minlen)); |
} |
OIDplus::logger()->log("[OK]RA(%1)!", "RA '%1' has been registered due to invitation", $email); |
OIDplus::logger()->log("V2:[OK]RA(%1)", "RA '%1' has been registered due to invitation", $email); |
$ra = new OIDplusRA($email); |
$ra->register_ra($password1); |
/trunk/plugins/viathinksoft/raPages/100_edit_contact_data/OIDplusPageRaEditContactData.class.php |
---|
46,7 → 46,7 |
throw new OIDplusException(_L('RA does not exist')); |
} |
OIDplus::logger()->log("[?WARN/!OK]RA(%1)?/[?INFO/!OK]A?", "Changed RA '%1' contact data/details", $email); |
OIDplus::logger()->log("V2:[OK/WARN]RA(%1)+[OK/INFO]A", "Changed RA '%1' contact data/details", $email); |
if (isset($params['ra_name'])) |
OIDplus::db()->query("UPDATE ###ra SET ra_name = ? WHERE email = ?", array($params['ra_name'], $email)); |
/trunk/plugins/viathinksoft/raPages/101_change_password/OIDplusPageRaChangePassword.class.php |
---|
75,9 → 75,9 |
throw new OIDplusException(_L('Old password incorrect')); |
} |
} |
OIDplus::logger()->log("[?WARN/!OK]RA(%1)?/[?INFO/!OK]A?", "Password of RA '%1' changed", $email); |
OIDplus::logger()->log("V2:[OK/WARN]RA(%1)+[OK/INFO]A", "Password of RA '%1' changed", $email); |
} else { |
OIDplus::logger()->log("[?WARN/!OK]RA(%1)?/[?INFO/!OK]A?", "Password of RA '%1' created", $email); |
OIDplus::logger()->log("V2:[OK/WARN]RA(%1)+[OK/INFO]A", "Password of RA '%1' created", $email); |
} |
$ra->change_password($password1); |
/trunk/plugins/viathinksoft/raPages/102_change_email/OIDplusPageRaChangeEMail.class.php |
---|
74,12 → 74,12 |
// Change RA email |
$ra->change_email($new_email); |
OIDplus::logger()->log("[WARN]RA(%1)!+[INFO]RA(%2)!+[OK]A!", "Admin changed email address '%1' to '%2'", $old_email, $new_email); |
OIDplus::logger()->log("V2:[WARN]RA(%1)+[INFO]RA(%2)+[OK]A", "Admin changed email address '%1' to '%2'", $old_email, $new_email); |
// Change objects |
$res = OIDplus::db()->query("select id from ###objects where ra_email = ?", array($old_email)); |
while ($row = $res->fetch_array()) { |
OIDplus::logger()->log("[INFO]OID(%1)+SUPOID(%1)", "Admin changed email address of RA '%2' (owner of %1) to '%3'", $row['id'], $old_email, $new_email); |
OIDplus::logger()->log("V2:[INFO]OID(%1)+SUPOID(%1)", "Admin changed email address of RA '%2' (owner of %1) to '%3'", $row['id'], $old_email, $new_email); |
} |
OIDplus::db()->query("update ###objects set ra_email = ? where ra_email = ?", array($new_email, $old_email)); |
OIDplusObject::resetObjectInformationCache(); |
92,7 → 92,7 |
return array("status" => 0); |
} else { |
OIDplus::logger()->log("[INFO]RA(%1)!+RA(%2)!", "Requested email address change from '%1' to '%2'", $old_email, $new_email); |
OIDplus::logger()->log("V2:[INFO]RA(%1)+RA(%2)", "Requested email address change from '%1' to '%2'", $old_email, $new_email); |
$timestamp = time(); |
$activate_url = OIDplus::webpath(null,OIDplus::PATH_ABSOLUTE_CANONICAL) . '?goto='.urlencode('oidplus:activate_new_ra_email$'.$old_email.'$'.$new_email.'$'.$timestamp.'$'.OIDplus::authUtils()->makeAuthKey('activate_new_ra_email;'.$old_email.';'.$new_email.';'.$timestamp)); |
162,12 → 162,12 |
// Change address of RA |
$ra->change_email($new_email); |
OIDplus::logger()->log("[OK]RA(%2)!+RA(%1)!", "RA '%1' has changed their email address to '%2'", $old_email, $new_email); |
OIDplus::logger()->log("V2:[OK]RA(%2)+RA(%1)", "RA '%1' has changed their email address to '%2'", $old_email, $new_email); |
// Change objects |
$res = OIDplus::db()->query("select id from ###objects where ra_email = ?", array($old_email)); |
while ($row = $res->fetch_array()) { |
OIDplus::logger()->log("[INFO]OID(%1)+SUPOID(%1)", "RA '%2' (owner of %1) has changed their email address to '%3'", $row['id'], $old_email, $new_email); |
OIDplus::logger()->log("V2:[INFO]OID(%1)+SUPOID(%1)", "RA '%2' (owner of %1) has changed their email address to '%3'", $row['id'], $old_email, $new_email); |
} |
OIDplus::db()->query("update ###objects set ra_email = ? where ra_email = ?", array($new_email, $old_email)); |
OIDplusObject::resetObjectInformationCache(); |