From: Roland Häder Date: Mon, 11 Jul 2011 09:25:56 +0000 (+0000) Subject: Extension ext-surfbar continued, fixes: X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=commitdiff_plain;h=d6417790061e18fc1a9770ff93bb4e9d106b2f6e Extension ext-surfbar continued, fixes: - Menu point 'list_surfbar_urls' is now fully generated from XML meta data templates - Fixes in various places - TODOs.txt updated --- diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index e75e4b1000..ffe0330d6b 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -98,6 +98,8 @@ ./inc/mails/doubler_mails.php:53:// @TODO Can this be rewritten to a filter? ./inc/module-functions.php:267: // @TODO Nothing helped??? ./inc/module-functions.php:308: // @TODO Rewrite this to a filter +./inc/modules/admin/admin-inc.php:1159: // @TODO WHERE is not yet supported +./inc/modules/admin/admin-inc.php:1213: // @TODO If we can rewrite the EL sub-system to support more than one parameter, this call_user_func_array() can be avoided ./inc/modules/admin/admin-inc.php:171: // @TODO This and the next getCurrentAdminId() call might be moved into the templates? ./inc/modules/admin/admin-inc.php:242: // @TODO This can be rewritten into a filter ./inc/modules/admin/admin-inc.php:274: // @TODO Rewrite this to $content = SQL_FETCHARRAY() @@ -187,16 +189,16 @@ ./inc/mysql-manager.php:44:// @TODO Can we cache this? ./inc/purge/purge-inact.php:55: // @TODO Rewrite these if() blocks to a filter ./inc/revision-functions.php:169:// @TODO This function does also set and get in 'cache_array' -./inc/template-functions.php:1058: // @TODO Deprecate this thing -./inc/template-functions.php:1069: // @TODO Deprecate this thing -./inc/template-functions.php:1162: // @TODO This can be easily moved out after the merge from EL branch to this is complete -./inc/template-functions.php:1195: // @TODO Add a little more infos here -./inc/template-functions.php:1506:// @TODO Lame description for this function -./inc/template-functions.php:1528: // @TODO Move this in a filter +./inc/template-functions.php:1063: // @TODO Deprecate this thing +./inc/template-functions.php:1074: // @TODO Deprecate this thing +./inc/template-functions.php:1167: // @TODO This can be easily moved out after the merge from EL branch to this is complete +./inc/template-functions.php:1200: // @TODO Add a little more infos here +./inc/template-functions.php:1511:// @TODO Lame description for this function +./inc/template-functions.php:1533: // @TODO Move this in a filter ./inc/template-functions.php:189: * @TODO On some pages this is buggy -./inc/template-functions.php:265: // @TODO Remove this sanity-check if all is fine -./inc/template-functions.php:586:// @TODO $simple/$constants are deprecated -./inc/template-functions.php:612: // @TODO Do only use $content and deprecate $GLOBALS and $DATA in templates +./inc/template-functions.php:266: // @TODO Remove this sanity-check if all is fine +./inc/template-functions.php:591:// @TODO $simple/$constants are deprecated +./inc/template-functions.php:617: // @TODO Do only use $content and deprecate $GLOBALS and $DATA in templates ./inc/wrapper-functions.php:130:// @TODO Implement $compress ./inc/wrapper-functions.php:137:// @TODO Implement $decompress ./inc/wrapper-functions.php:514:// @TODO Do some more sanity check here diff --git a/inc/callback-functions.php b/inc/callback-functions.php index 98f19e24b2..59c06e66ec 100644 --- a/inc/callback-functions.php +++ b/inc/callback-functions.php @@ -42,14 +42,15 @@ if (!defined('__SECURITY')) { // Handles the XML node 'admin-entry-meta-data' function doXmlAdminEntryMetaData ($resource, $attributes) { - /* - * This node has no attributes by default so it remains just with this - * comment. - */ + // There should be no attributes + if (count($attributes) > 0) { + // Please don't add any attributes to foo-list nodes + debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes)); + } // END - if } -// Handles the XML node 'admin-callback-function' -function doXmlAdminCallbackFunction ($resource, $attributes) { +// Handles the XML node 'callback-function' +function doXmlCallbackFunction ($resource, $attributes) { // There are two attributes, by default if (count($attributes) != 2) { // Not the right count @@ -95,13 +96,14 @@ function doXmlPostDataIdentifyIndex ($resource, $attributes) { } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { // Not valid/verifyable debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']); - } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction'])) { - // doXmlAdminCallbackFunction is missing - debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node admin-callback-function not included around this node. Please fix your XML.'); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.'); } // Add the POST data index for 'id' - $GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction']['id_index'] = $attributes['VALUE']; + addXmlValueToCallbackAttributes('id_index', $attributes); + //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['id_index'] = $attributes['VALUE']; } // Handles the XML node 'database-table' @@ -125,13 +127,14 @@ function doXmlDatabaseTable ($resource, $attributes) { } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { // Not valid/verifyable debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']); - } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction'])) { - // doXmlAdminCallbackFunction is missing - debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node admin-callback-function not included around this node. Please fix your XML.'); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.'); } - // Add the database's name - $GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction']['database_table'] = $attributes['VALUE']; + // Add the entry to the list + addXmlValueToCallbackAttributes('database_table', $attributes); + //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['database_table'] = $attributes['VALUE']; } // Handles the XML node 'database-column-list' @@ -143,7 +146,7 @@ function doXmlDatabaseColumnList ($resource, $attributes) { } // END - if // Add an empty list - $GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction']['column_list'] = array(); + $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_list'] = array(); } // Handles the XML node 'database-column-list-entry' @@ -167,9 +170,9 @@ function doXmlDatabaseColumnListEntry ($resource, $attributes) { } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { // Not valid/verifyable debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']); - } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction']['column_list'])) { - // doXmlAdminCallbackFunction is missing - debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node admin-callback-function/database-column-list not included around this node. Please fix your XML.'); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_list'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/database-column-list not included around this node. Please fix your XML.'); } // Add the entry to the list @@ -185,7 +188,7 @@ function doXmlCallbackFunctionList ($resource, $attributes) { } // END - if // Add an empty list - $GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction']['callback_list'] = array(); + $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['callback_list'] = array(); } // Handles the XML node 'callback-function-list-entry' @@ -209,9 +212,9 @@ function doXmlCallbackFunctionListEntry ($resource, $attributes) { } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { // Not valid/verifyable debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']); - } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction']['callback_list'])) { - // doXmlAdminCallbackFunction is missing - debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node admin-callback-function/callback-function-list not included around this node. Please fix your XML.'); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['callback_list'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/callback-function-list not included around this node. Please fix your XML.'); } // Add the entry to the list @@ -227,7 +230,7 @@ function doXmlExtraParameterList ($resource, $attributes) { } // END - if // Add an empty list - $GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction']['extra_list'] = array(); + $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list'] = array(); } // Handles the XML node 'extra-parameter-list-entry' @@ -251,9 +254,9 @@ function doXmlExtraParameterListEntry ($resource, $attributes) { } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { // Not valid/verifyable debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']); - } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction']['extra_list'])) { - // doXmlAdminCallbackFunction is missing - debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node admin-callback-function/extra-parameter-list not included around this node. Please fix your XML.'); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list not included around this node. Please fix your XML.'); } // Add the entry to the list @@ -266,7 +269,7 @@ function doXmlExtraParameterMemberList ($resource, $attributes) { if (count($attributes) > 0) { // Please don't add any attributes to foo-list nodes debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes)); - } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction']['extra_list']['member_list'])) { + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['member_list'])) { // This list should be created already debug_report_bug(__FUNCTION__, __LINE__, 'member_list should be already created.'); } @@ -293,9 +296,9 @@ function doXmlExtraParameterMemberListEntry ($resource, $attributes) { } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { // Not valid/verifyable debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']); - } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction']['extra_list']['member_list'])) { - // doXmlAdminCallbackFunction is missing - debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node admin-callback-function/extra-parameter-list/member-list not included around this node. Please fix your XML.'); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_list']['member_list'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/member-list not included around this node. Please fix your XML.'); } // Add the entry to the list @@ -323,13 +326,13 @@ function doXmlStatusChangeColumn ($resource, $attributes) { } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { // Not valid/verifyable debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']); - } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction'])) { - // doXmlAdminCallbackFunction is missing - debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node admin-callback-function not included around this node. Please fix your XML.'); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.'); } // Add the entry to the list - $GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction']['status_list'][$attributes['VALUE']] = array(); + $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'][$attributes['VALUE']] = array(); } // Handles the XML node 'status-change-list' @@ -338,9 +341,9 @@ function doXmlStatusChangeList ($resource, $attributes) { if (count($attributes) > 0) { // Please don't add any attributes to foo-list nodes debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes)); - } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction']['status_list'])) { - // doXmlAdminCallbackFunction is missing - debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node admin-callback-function/status-list not included around this node. Please fix your XML.'); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/status-list not included around this node. Please fix your XML.'); } } @@ -368,9 +371,9 @@ function doXmlStatusChangeListEntry ($resource, $attributes) { } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { // Not valid/verifyable debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']); - } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction']['status_list'])) { - // doXmlAdminCallbackFunction is missing - debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node admin-callback-function/extra-parameter-list/member-list not included around this node. Please fix your XML.'); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['status_list'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/extra-parameter-list/member-list not included around this node. Please fix your XML.'); } // Add the entry to the list @@ -398,13 +401,14 @@ function doXmlEnableModifyEntries ($resource, $attributes) { } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { // Not valid/verifyable debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']); - } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction'])) { - // doXmlAdminCallbackFunction is missing - debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node admin-callback-function not included around this node. Please fix your XML.'); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.'); } - // Add the entry to the array - $GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction']['enable_modify_entries'] = convertStringToBoolean($attributes['VALUE']); + // Add the entry to the list + addXmlValueToCallbackAttributes('enable_modify_entries', $attributes); + //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['enable_modify_entries'] = convertStringToBoolean($attributes['VALUE']); } // Handles the XML node 'table-id-column' @@ -428,13 +432,14 @@ function doXmlTableIdColumn ($resource, $attributes) { } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { // Not valid/verifyable debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']); - } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction'])) { - // doXmlAdminCallbackFunction is missing - debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node admin-callback-function not included around this node. Please fix your XML.'); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.'); } // Add the entry to the array - $GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction']['table_id_column'] = $attributes['VALUE']; + addXmlValueToCallbackAttributes('table_id_column', $attributes); + //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['table_id_column'] = $attributes['VALUE']; } // Handles the XML node 'table-userid-column' @@ -458,13 +463,14 @@ function doXmlTableUseridColumn ($resource, $attributes) { } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { // Not valid/verifyable debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']); - } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction'])) { - // doXmlAdminCallbackFunction is missing - debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node admin-callback-function not included around this node. Please fix your XML.'); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.'); } // Add the entry to the array - $GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction']['table_userid_column'] = $attributes['VALUE']; + addXmlValueToCallbackAttributes('table_userid_column', $attributes); + //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['table_userid_column'] = $attributes['VALUE']; } // Handles the XML node 'raw-userid-column-key' @@ -488,18 +494,386 @@ function doXmlRawUseridColumnKey ($resource, $attributes) { } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { // Not valid/verifyable debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. TYPE=' . $attributes['TYPE'] . ',VALUE=' . $attributes['VALUE']); - } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction'])) { - // doXmlAdminCallbackFunction is missing - debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node admin-callback-function not included around this node. Please fix your XML.'); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.'); + } + + // Add the entry to the array + addXmlValueToCallbackAttributes('raw_userid_column_key', $attributes); + //$GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['raw_userid_column_key'] = $attributes['VALUE']; +} + +//----------------------------------------------------------------------------- +// Call-back functions for listing of data in admin area +//----------------------------------------------------------------------------- + +// Handles the XML node 'admin-list-data' +function doXmlAdminListData ($resource, $attributes) { + // There should be no attributes + if (count($attributes) > 0) { + // Please don't add any attributes to foo-list nodes + debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes)); + } // END - if +} + +// Handles the XML node 'data-tables' +function doXmlDataTables ($resource, $attributes) { + // There should be no attributes + if (count($attributes) > 0) { + // Please don't add any attributes to foo-list nodes + debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes, got ' . count($attributes)); + } // END - if +} + +// Handles the XML node 'data-table' +function doXmlDataTable ($resource, $attributes) { + // There are three attributes, by default + if (count($attributes) != 3) { + // Not the right count + debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes)); + } elseif (!isset($attributes['VALUE'])) { + // 'VALUE' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.'); + } elseif (!isset($attributes['TYPE'])) { + // 'TYPE' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.'); + } elseif (!isInvalidXmlType($attributes['TYPE'])) { + // No valid type + debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']); + } elseif (!isset($attributes['ALIAS'])) { + // 'ALIAS' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute ALIAS not found.'); + } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { + // Not valid/verifyable + debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']); + } elseif ((trim($attributes['ALIAS']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['ALIAS']))) { + // Not valid/verifyable + debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. ALIAS=' . $attributes['ALIAS']); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.'); + } + + // Add the entry to the array + addXmlValueToCallbackAttributes('data_table', $attributes); +} + +// Handles the XML node 'select-data-from-list' +function doXmlSelectDataFromList ($resource, $attributes) { + // There should be no attributes + if (count($attributes) > 0) { + // Please don't add any attributes to foo-list nodes + debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes)); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.'); + } + + // Add an empty list + $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'] = array(); +} + +// Handles the XML node 'select-data-from-list-entry' +function doXmlSelectDataFromListEntry ($resource, $attributes) { + // There are five attributes, by default + if (count($attributes) != 5) { + // Not the right count + debug_report_bug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes)); + } elseif (!isset($attributes['VALUE'])) { + // 'VALUE' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.'); + } elseif (!isset($attributes['TYPE'])) { + // 'TYPE' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.'); + } elseif (!isInvalidXmlType($attributes['TYPE'])) { + // No valid type + debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']); + } elseif (!isset($attributes['ALIAS'])) { + // 'ALIAS' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute ALIAS not found.'); + } elseif (!isset($attributes['FUNCTION'])) { + // 'FUNCTION' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute FUNCTION not found.'); + } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { + // 'VALUE' not valid/verifyable + debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']); + } elseif ((trim($attributes['ALIAS']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['ALIAS']))) { + // 'ALIAS' not valid/verifyable + debug_report_bug(__FUNCTION__, __LINE__, 'Attribute ALIAS does not validate. ALIAS=' . $attributes['ALIAS']); + } elseif ((trim($attributes['FUNCTION']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['FUNCTION']))) { + // 'FUNCTION' not valid/verifyable + debug_report_bug(__FUNCTION__, __LINE__, 'Attribute FUNCTION does not validate. FUNCTION=' . $attributes['FUNCTION']); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/select-data-from-list not included around this node. Please fix your XML.'); + } + + // Add the entry to the array + addXmlValueToCallbackAttributes('data_column_list', $attributes); +} + +// Handles the XML node 'where-select-from-list' +function doXmlWhereSelectFromList ($resource, $attributes) { + // There should be no attributes + if (count($attributes) > 0) { + // Please don't add any attributes to foo-list nodes + debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes)); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.'); + } + + // Add an empty list + $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['where_select_list'] = array(); +} + +// Handles the XML node 'order-by-list' +function doXmlOrderByList ($resource, $attributes) { + // There should be no attributes + if (count($attributes) > 0) { + // Please don't add any attributes to foo-list nodes + debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes)); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.'); + } + + // Add an empty list + $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['order_by_list'] = array(); +} + +// Handles the XML node 'order-by-list-entry' +function doXmlOrderByListEntry ($resource, $attributes) { + // There are four attributes, by default + if (count($attributes) != 4) { + // Not the right count + debug_report_bug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes)); + } elseif (!isset($attributes['ORDER'])) { + // 'ORDER' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute ORDER not found.'); + } elseif (!isset($attributes['TYPE'])) { + // 'TYPE' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.'); + } elseif (!isInvalidXmlType($attributes['TYPE'])) { + // No valid type + debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']); + } elseif (!isset($attributes['TABLE'])) { + // 'TABLE' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TABLE not found.'); + } elseif (!isset($attributes['VALUE'])) { + // 'VALUE' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.'); + } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['ORDER'])) { + // 'ORDER' not valid/verifyable + debug_report_bug(__FUNCTION__, __LINE__, 'Attribute ORDER does not validate. ORDER=' . $attributes['ORDER']); + } elseif ((trim($attributes['TABLE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['TABLE']))) { + // 'TABLE' not valid/verifyable + debug_report_bug(__FUNCTION__, __LINE__, 'Attribute TABLE does not validate. TABLE=' . $attributes['TABLE']); + } elseif ((trim($attributes['VALUE']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE']))) { + // 'VALUE' not valid/verifyable + debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_column_list'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-column-list not included around this node. Please fix your XML.'); + } + + // Add the entry to the array + addXmlValueToCallbackAttributes('order_by_list', $attributes); +} + +// Handles the XML node 'list-template' +function doXmlListTemplate ($resource, $attributes) { + // There are two attributes, by default + if (count($attributes) != 2) { + // Not the right count + debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes)); + } elseif (!isset($attributes['VALUE'])) { + // 'VALUE' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.'); + } elseif (!isset($attributes['TYPE'])) { + // 'TYPE' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.'); + } elseif (!isInvalidXmlType($attributes['TYPE'])) { + // No valid type + debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']); + } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { + // Not valid/verifyable + debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.'); } // Add the entry to the array - $GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction']['raw_userid_column_key'] = $attributes['VALUE']; + addXmlValueToCallbackAttributes('list_template', $attributes); +} + +// Handles the XML node 'list-row-template' +function doXmlListRowTemplate ($resource, $attributes) { + // There are two attributes, by default + if (count($attributes) != 2) { + // Not the right count + debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes)); + } elseif (!isset($attributes['VALUE'])) { + // 'VALUE' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.'); + } elseif (!isset($attributes['TYPE'])) { + // 'TYPE' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.'); + } elseif (!isInvalidXmlType($attributes['TYPE'])) { + // No valid type + debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']); + } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { + // Not valid/verifyable + debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.'); + } + + // Add the entry to the array + addXmlValueToCallbackAttributes('list_row_template', $attributes); +} + +// Handles the XML node 'column-callback-list' +function doXmlColumnCallbackList ($resource, $attributes) { + // There should be no attributes + if (count($attributes) > 0) { + // Please don't add any attributes to foo-list nodes + debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes)); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['data_table'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/data-table not included around this node. Please fix your XML.'); + } + + // Add an empty list + $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'] = array(); } -// ---------------------------------------------------------------------------- -// XML type validation -// ---------------------------------------------------------------------------- +// Handles the XML node 'column-callback-list-entry' +function doXmlColumnCallbackListEntry ($resource, $attributes) { + // There should be no attributes + if (count($attributes) > 0) { + // Please don't add any attributes to foo-list nodes + debug_report_bug(__FUNCTION__, __LINE__, 'Expected 0 attributes because this is a foo-list node, got ' . count($attributes)); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/column-callback not included around this node. Please fix your XML.'); + } +} + +// Handles the XML node 'column-callback-data' +function doXmlColumnCallbackData ($resource, $attributes) { + // There are three attributes, by default + if (count($attributes) != 3) { + // Not the right count + debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes)); + } elseif (!isset($attributes['VALUE'])) { + // 'VALUE' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.'); + } elseif (!isset($attributes['TYPE'])) { + // 'TYPE' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.'); + } elseif (!isset($attributes['CALLBACK'])) { + // 'CALLBACK' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute CALLBACK not found.'); + } elseif (!isInvalidXmlType($attributes['TYPE'])) { + // No valid type + debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']); + } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { + // Not valid/verifyable + debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.'); + } elseif ((trim($attributes['CALLBACK']) != '') && (!isXmlValueValid($attributes['TYPE'], $attributes['CALLBACK']))) { + // 'CALLBACK' not valid/verifyable + debug_report_bug(__FUNCTION__, __LINE__, 'Attribute CALLBACK does not validate. CALLBACK=' . $attributes['CALLBACK']); + } + + // Add the entry to the array + addXmlValueToCallbackAttributes('column_callback_list', $attributes); +} + +// Handles the XML node 'callback-extra-parameter-list' +function doXmlCallbackExtraParameterList ($resource, $attributes) { + // There should be no attributes + if (count($attributes) > 0) { + // Please don't add any attributes to foo-list nodes + debug_report_bug(__FUNCTION__, __LINE__, 'Expected 1 attributes because this is a named foo-list node, got ' . count($attributes)); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_callback_list'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/column-callback-list not included around this node. Please fix your XML.'); + } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'])) { + // Abort silently here, no one wants to kill this array + return; + } + + // Add an empty list + $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'] = array(); +} + +// Handles the XML node 'callback-extra-parameter-list-entry' +function doXmlCallbackExtraParameterListEntry ($resource, $attributes) { + // There are three attributes, by default + if (count($attributes) != 3) { + // Not the right count + debug_report_bug(__FUNCTION__, __LINE__, 'Expected 5 attributes, got ' . count($attributes)); + } elseif (!isset($attributes['COLUMN'])) { + // 'COLUMN' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute COLUMN not found.'); + } elseif (!isset($attributes['TYPE'])) { + // 'TYPE' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.'); + } elseif (!isInvalidXmlType($attributes['TYPE'])) { + // No valid type + debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']); + } elseif (!isset($attributes['VALUE'])) { + // 'VALUE' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.'); + } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { + // 'VALUE' not valid/verifyable + debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['__EXTRA_PARAMETER'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function/__EXTRA_PARAMETER not included around this node. Please fix your XML.'); + } + + // Add the entry to the array + addXmlValueToCallbackAttributes('__EXTRA_PARAMETER', $attributes); +} + +// Handles the XML node 'no-entry-found-message' +function doXmlNoEntryFoundMessage ($resource, $attributes) { + // There are two attributes, by default + if (count($attributes) != 2) { + // Not the right count + debug_report_bug(__FUNCTION__, __LINE__, 'Expected 3 attributes, got ' . count($attributes)); + } elseif (!isset($attributes['VALUE'])) { + // 'VALUE' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute VALUE not found.'); + } elseif (!isset($attributes['TYPE'])) { + // 'TYPE' not found + debug_report_bug(__FUNCTION__, __LINE__, 'Required attribute TYPE not found.'); + } elseif (!isInvalidXmlType($attributes['TYPE'])) { + // No valid type + debug_report_bug(__FUNCTION__, __LINE__, 'TYPE is not valid, got: ' . $attributes['TYPE']); + } elseif (!isXmlValueValid($attributes['TYPE'], $attributes['VALUE'])) { + // Not valid/verifyable + debug_report_bug(__FUNCTION__, __LINE__, 'Attribute VALUE does not validate. VALUE=' . $attributes['VALUE']); + } elseif (!isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'])) { + // doXmlCallbackFunction is missing + debug_report_bug(__FUNCTION__, __LINE__, 'Required XML node callback-function not included around this node. Please fix your XML.'); + } + + // Add the entry to the array + addXmlValueToCallbackAttributes('no_entry_message_id', $attributes); +} + +//----------------------------------------------------------------------------- +// XML type validation +//----------------------------------------------------------------------------- // Checks for string without any added extra data function isXmlTypeString ($value) { @@ -522,60 +896,103 @@ function isXmlTypeBool ($value) { return (($value == 'true') || ($value == 'false')); } -// ---------------------------------------------------------------------------- +// Check for integer type +function isXmlTypeInt ($value) { + // Trim value + $value = trim($value); + + // This value is always a string + return (bigintval($value) == $value); +} + +//----------------------------------------------------------------------------- // Private XML functions -// ---------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // Adds given attribut to element function addXmlValueToCallbackAttributes ($element, $attributes, $extraKey = '', $key = '') { + // What do we need to add? + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',key=' . $key . ' - ENTERED!'); if ($attributes['TYPE'] == 'array') { // Another nested array - /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=ARRAY, element=' . $element); - $GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction'][$element][$attributes['VALUE'] . '_list'] = array(); + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'TYPE=ARRAY, element=' . $element); + $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['VALUE'] . '_list'] = array(); } elseif (!empty($extraKey)) { // Is it bool? - if ($attributes['TYPE'] == 'bool') { + if (($attributes['TYPE'] == 'bool') && (isset($attributes['VALUE']))) { // Then convert VALUE $attributes['VALUE'] = convertStringToBoolean($attributes['VALUE']); } // END - if // Sub-array (one level only) - /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE='.$attributes['TYPE'].',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE']); + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'] . ' - ANALYSING...'); if (trim($attributes['NAME']) == '') { // Numerical index - /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE='.$attributes['TYPE'].',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NUMERICAL!'); - $GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction'][$element][$extraKey][] = $attributes['VALUE']; + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'].',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NUMERICAL!'); + $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][] = $attributes['VALUE']; } elseif (!empty($key)) { // Use from $key - /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE='.$attributes['TYPE'].',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - KEY! (key=' . $attributes[$key] . ')'); - $GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction'][$element][$extraKey][$attributes[$key]] = $attributes['VALUE']; + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'].',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - KEY! (key=' . $attributes[$key] . ')'); + $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][$attributes[$key]] = $attributes['VALUE']; } else { // Use from NAME - /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE='.$attributes['TYPE'].',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME! (name=' . $attributes['NAME'] . ')'); - $GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction'][$element][$extraKey][$attributes['NAME']] = $attributes['VALUE']; + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'].',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME! (NAME=' . $attributes['NAME'] . ')'); + $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$extraKey][$attributes['NAME']] = $attributes['VALUE']; } - } elseif (trim($attributes['NAME']) == '') { + } elseif ((isset($attributes['FUNCTION'])) && (isset($attributes['ALIAS']))) { + /* + * ALIAS and FUNCTION detected? This may happen with SQL queries + * like: UNIX_TIMESTAMP(`foo_timestamp`) AS `foo_timestamp` + */ + // Init array + $array = array( + 'column' => trim($attributes['VALUE']), + 'alias' => trim($attributes['ALIAS']), + 'function' => trim($attributes['FUNCTION']), + 'table' => trim($attributes['TABLE']) + ); + + // Add the entry + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'].',ALIAS[' . gettype($attributes['ALIAS']) . ']=' . $attributes['ALIAS'] . ',FUNCTION[' . gettype($attributes['FUNCTION']) . ']=' . $attributes['FUNCTION'] . ' - FUNCTION! (VALUE=' . $attributes['VALUE'] . ')'); + $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][] = $array; + } elseif (isset($attributes['CALLBACK'])) { + // CALLBACK/VALUE detected + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'].',CALLBACK[' . gettype($attributes['CALLBACK']) . ']=' . $attributes['CALLBACK'] . ' - CALLBACK! (VALUE=' . $attributes['VALUE'] . ')'); + $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['VALUE']] = $attributes['CALLBACK']; + } elseif (isset($attributes['ORDER'])) { + // ORDER/TABLE detected + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',TYPE=' . $attributes['TYPE'].',ORDER[' . gettype($attributes['ORDER']) . ']=' . $attributes['ORDER'] . ' - ORDER! (VALUE=' . $attributes['VALUE'] . ')'); + $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['ORDER']][$attributes['TABLE']] = $attributes['VALUE']; + } elseif (isset($attributes['COLUMN'])) { + // COLUMN/VALUE detected + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ',COLUMN[' . gettype($attributes['COLUMN']) . ']=' . $attributes['COLUMN'] . ' - COLUMN!'); + $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['COLUMN']][] = $attributes['VALUE']; + } elseif ((!isset($attributes['NAME'])) || (trim($attributes['NAME']) == '')) { // Numerical index - /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE']); - $GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction'][$element][] = $attributes['VALUE']; - } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction'][$element][$attributes['NAME']])) { + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NUMERICAL!'); + $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][] = $attributes['VALUE']; + } elseif (isset($GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']])) { // Already created - debug_report_bug(__FUNCTION__, __LINE__, 'NAME=' . $attributes['NAME'] . ' already addded to ' . $element . '.'); + debug_report_bug(__FUNCTION__, __LINE__, 'NAME=' . $attributes['NAME'] . ' already addded to ' . $element . ' attributes=
' . print_r($attributes, true) . '
'); } else { // Use from NAME - /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',NAME=' . $attributes['NAME'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE']); - $GLOBALS['__XML_ARGUMENTS']['doXmlAdminCallbackFunction'][$element][$attributes['NAME']] = $attributes['VALUE']; + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',NAME=' . $attributes['NAME'] . ',VALUE[' . gettype($attributes['VALUE']) . ']=' . $attributes['VALUE'] . ' - NAME!'); + $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction'][$element][$attributes['NAME']] = $attributes['VALUE']; } + /* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'element=' . $element . ',extraKey=' . $extraKey . ',key=' . $key . ' - EXIT!'); } -// ---------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // Execute call-back functions -// ---------------------------------------------------------------------------- - -// Execute function for doXmlAdminCallbackFunction() -function doXmlAdminCallbackFunctionExecute ($function, $args) { - // Prepare 'id_index' - $args['id_index'] = postRequestParameter($args['id_index']); +//----------------------------------------------------------------------------- + +// Execute function for doXmlCallbackFunction() +function doXmlCallbackFunctionExecute ($function, $args) { + // Is 'id_index' set and form sent? + if ((isset($args['id_index'])) && (isFormSent())) { + // Prepare 'id_index' + $args['id_index'] = postRequestParameter($args['id_index']); + } // END - if // Just call it //* DEBUG: */ die('
'.print_r($args, true).'
'); diff --git a/inc/config-functions.php b/inc/config-functions.php index 6a89335d85..e045b45ca6 100644 --- a/inc/config-functions.php +++ b/inc/config-functions.php @@ -274,6 +274,8 @@ function updateOldConfigFile () { function updateConfiguration ($entries, $values, $updateMode='', $config = '0') { // Do not update config in CSS mode if ((isCssOutputMode()) || (isRawOutputMode()) || (isInstallationPhase())) { + // This logger line may be very noisy + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Not updating configuration. entries[]=' . gettype($entries) . ',values[]=' . gettype($values) . ',updateMode=' . $updateMode . ',config=' . $config . ',isCssOutputMode()=' . intval(isCssOutputMode()) . ',isRawOutputMode()=' . intval(isRawOutputMode()) . 'isInstallationPhase()=' . intval(isInstallationPhase())); return; } // END - if @@ -350,7 +352,7 @@ function updateConfiguration ($entries, $values, $updateMode='', $config = '0') // Filter for loading configuration function FILTER_LOAD_CONFIGURATION ($no = '0') { - // Is the value null, fix it :( + // Is the value null, it comes from the 'init' filter chain if (is_null($no)) { $no = '0'; } // END - if diff --git a/inc/daily/daily_profile.php b/inc/daily/daily_profile.php index 8d83be5500..b32f46c805 100644 --- a/inc/daily/daily_profile.php +++ b/inc/daily/daily_profile.php @@ -53,7 +53,10 @@ if (!defined('__SECURITY')) { if ((isSendProfileUpdateEnabled()) && (getProfileUpdate() > 0) && (getResendProfileUpdate() > 0)) { // Load personal data $result = SQL_QUERY("SELECT - `userid`, `email`, `last_update`, `joined` + `userid`, + `email`, + `last_update`, + `joined` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE @@ -76,14 +79,14 @@ ORDER BY // We need to send-out notifications... while ($content = SQL_FETCHARRAY($result)) { // Translate timestamp - $content['joined'] = generateDateTime($content['joined'], 0); + $content['joined'] = generateDateTime($content['joined'], '0'); if (round($content['last_update']) == '0') { // Has never changed his accont $content['last_update'] = '{--MEMBER_PROFILE_NEVER_CHANGED--}'; } else { // Has changed his account - $content['last_update'] = generateDateTime($content['last_update'], 0); + $content['last_update'] = generateDateTime($content['last_update'], '0'); } // Load email template and send mail away diff --git a/inc/filter-functions.php b/inc/filter-functions.php index 22a2d5231f..44e4cb04cf 100644 --- a/inc/filter-functions.php +++ b/inc/filter-functions.php @@ -120,9 +120,9 @@ ORDER BY registerFilter('pre_page_header', 'LOAD_PAGE_HEADER'); // Page headers - post-filter (normally, you don't want to register here) - // ------------------- LAST FILTER FOR THIS CHAIN! ------------------------ + //-------------------- LAST FILTER FOR THIS CHAIN! ------------------------ registerFilter('post_page_header', 'FINISH_PAGE_HEADER'); - // ------------------- LAST FILTER FOR THIS CHAIN! ------------------------ + //-------------------- LAST FILTER FOR THIS CHAIN! ------------------------ // 'You are here' navigation - post filter registerFilter('post_youhere_line', 'CALL_HANDLER_LOGIN_FAILTURES'); diff --git a/inc/language/de.php b/inc/language/de.php index 2c84b6274f..a5d7e6530e 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -1162,7 +1162,7 @@ addMessages(array( 'ADMIN_CONFIG_GUEST_STATS_INACTIVE_NOTE' => "Deaktiviert die Gast-Statistiken komplett.", // XML related strings - 'XML_TEMPLATE_404' => "XML-Template %s "XML-Template %s nicht gefunden.", // Admin actions - submit buttons 'ADMIN_ACTION_EDIT_SUBMIT' => "Bearbeiten", diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index c1987fb465..62de1cab37 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -640,9 +640,9 @@ function getAdminLastFailure ($adminId) { return $data['last_failure']; } -// --------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // Wrapper functions -// --------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // Wrapper function to check wether expert setting warning is enabled function isAdminsExpertWarningEnabled () { diff --git a/inc/libs/beg_functions.php b/inc/libs/beg_functions.php index b3622839f1..953a5ff901 100644 --- a/inc/libs/beg_functions.php +++ b/inc/libs/beg_functions.php @@ -67,9 +67,9 @@ function addPointsBeg ($userid, $points) { return $added; } -// ---------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // Wrapper functions for ext-beg -// ---------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // "Getter" for beg_new_member_notify function getBegNewMemberNotify () { diff --git a/inc/libs/doubler_functions.php b/inc/libs/doubler_functions.php index fab47f84f7..94148e21bc 100644 --- a/inc/libs/doubler_functions.php +++ b/inc/libs/doubler_functions.php @@ -148,9 +148,9 @@ function getDoublerTotalPointsLeft() { return $points; } -// ---------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // Wrapper functions for ext-doubler -// ---------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // "Getter" for doubler_userid function getDoublerUserid () { diff --git a/inc/libs/order_functions.php b/inc/libs/order_functions.php index 7a6fb06c42..ea1ddaef25 100644 --- a/inc/libs/order_functions.php +++ b/inc/libs/order_functions.php @@ -65,9 +65,9 @@ function addOrderSelectionOptions ($default) { return $OUT; } -// ---------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // Wrapper functions for configuration entries -// ---------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // Getter for 'order_multi_page' config entry function getOrderMultiPage () { diff --git a/inc/libs/profile_functions.php b/inc/libs/profile_functions.php index 8cf8af7d50..97b197f1a9 100644 --- a/inc/libs/profile_functions.php +++ b/inc/libs/profile_functions.php @@ -40,9 +40,9 @@ if (!defined('__SECURITY')) { die(); } // END - if -// ---------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // Wrapper functions -// ---------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // Getter for profile_update function getProfileUpdate () { diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index 6e10e276e1..b3aea55d43 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -40,9 +40,9 @@ if (!defined('__SECURITY')) { die(); } // END - if -// ----------------------------------------------------------------------------- +//------------------------------------------------------------------------------ // Admin functions -// ----------------------------------------------------------------------------- +//------------------------------------------------------------------------------ // // Admin has added an URL with given user id and so on function SURFBAR_ADMIN_ADD_URL ($url, $limit, $reload) { @@ -153,9 +153,9 @@ function SURFBAR_ADMIN_REJECT_URL_IDS ($IDs) { } // -// ----------------------------------------------------------------------------- +//------------------------------------------------------------------------------ // Member functions -// ----------------------------------------------------------------------------- +//------------------------------------------------------------------------------ // // Member has added an URL function SURFBAR_MEMBER_ADD_URL ($url, $limit) { @@ -286,9 +286,9 @@ function SURFBAR_VALIDATE_MEMBER_ACTION_STATUS ($action, $status) { } // -// ----------------------------------------------------------------------------- +//------------------------------------------------------------------------------ // Member actions -// ----------------------------------------------------------------------------- +//------------------------------------------------------------------------------ // // Retreat a booked URL function SURFBAR_MEMBER_RETREAT_ACTION ($urlData) { @@ -439,9 +439,9 @@ function SURFBAR_MEMBER_EXECUTE_DELETE_ACTION ($urlData) { return true; } // -// ----------------------------------------------------------------------------- +//------------------------------------------------------------------------------ // Self-maintenance functions -// ----------------------------------------------------------------------------- +//------------------------------------------------------------------------------ // // Main function function SURFBAR_HANDLE_SELF_MAINTENANCE () { @@ -499,9 +499,9 @@ function SURFBAR_HANDLE_LOW_POINTS () { } // -// ----------------------------------------------------------------------------- +//------------------------------------------------------------------------------ // Generic functions -// ----------------------------------------------------------------------------- +//------------------------------------------------------------------------------ // // Looks up by an URL @@ -1772,9 +1772,9 @@ LIMIT 1", return $nextId; } -// ---------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // Wrapper function -// ---------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // "Getter" for surfbar_dynamic_percent function getSurfbarDynamicPercent () { @@ -1836,10 +1836,10 @@ function getSurfbarPaymentModel () { return $GLOBALS[__FUNCTION__]; } -// ----------------------------------------------------------------------------- +//------------------------------------------------------------------------------ // PLEASE DO NOT ADD ANY OTHER FUNCTIONS BELOW THIS LINE IF THEY DON'T "WRAP" // THE $GLOBALS['surfbar_cache'] ARRAY! -// ----------------------------------------------------------------------------- +//------------------------------------------------------------------------------ // Initializes the surfbar function SURFBAR_INIT () { diff --git a/inc/libs/transfer_functions.php b/inc/libs/transfer_functions.php index ea23ae765c..b3ddbd646b 100644 --- a/inc/libs/transfer_functions.php +++ b/inc/libs/transfer_functions.php @@ -80,9 +80,9 @@ function autoPurgeTransfers ($max, $age) { } // END - if } -// --------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // Wrapper functions -// --------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // Wrapper function for transfer_code function getTransferCode () { diff --git a/inc/libs/wernis_functions.php b/inc/libs/wernis_functions.php index db99fbdfb4..fb8c57c709 100644 --- a/inc/libs/wernis_functions.php +++ b/inc/libs/wernis_functions.php @@ -400,9 +400,9 @@ function WERNIS_ADD_WITHDRAW_FEE ($points) { return $points; } -// --------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // Wrapper functions -// --------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // Wrapper function for 'wernis_refid' function getWernisRefid () { diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 02f1531ce4..db9353b4ef 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -1115,6 +1115,120 @@ function adminUndeleteEntriesConfirm ($IDs, $table, $columns=array(), $filterFun } // END - if } +// List all given rows (callback function from XML) +function adminListEntries ($tableTemplate, $rowTemplate, $tableName, $columns, $whereColumns, $orderByColumns, $callbackColumns, $extraParameters, $noEntryMessageId) { + // Verify that tableName and columns are not empty + if (count($tableName) != 1) { + // No tableName specified + debug_report_bug(__FUNCTION__, __LINE__, 'tableName is not given. Please fix your XML. tableTemplate=' . $tableTemplate . ',rowTemplate=' . $rowTemplate); + } elseif (count($columns) == 0) { + // No columns specified + debug_report_bug(__FUNCTION__, __LINE__, 'columns is not given. Please fix your XML. tableTemplate=' . $tableTemplate . ',rowTemplate=' . $rowTemplate . ',tableName[0]=' . $tableName[0]); + } + + // This is the minimum query, so at least columns and tableName must have entries + $SQL = 'SELECT '; + foreach ($columns as $columnArray) { + // Init SQL part + $sqlPart = ''; + // Do we have a table/alias + if (!empty($columnArray['table'])) { + // Pre-add it + $sqlPart .= $columnArray['table'] . '.'; + } // END - if + + // Add column + $sqlPart .= '`' . $columnArray['column'] . '`'; + + // Is a function and alias set? + if ((!empty($columnArray['function'])) && (!empty($columnArray['alias']))) { + // Add both + $sqlPart = $columnArray['function'] . '(' . $sqlPart . ') AS `' . $columnArray['alias'] . '`'; + } // END - if + + // Add finished SQL part to the query + $SQL .= $sqlPart . ','; + } // END - foreach + + // Remove last commata and add FROM statement + $SQL = substr($SQL, 0, -1) . ' FROM `{?_MYSQL_PREFIX?}_' . $tableName[0] . '`'; + + // Do we have entries from whereColumns to add? + if (count($whereColumns) > 0) { + // Then add these as well + // @TODO WHERE is not yet supported + debug_report_bug(__FUNCTION__, __LINE__, 'Unfinished area, please report your XML to the forums or bug tracker. tableTemplate=' . $tableTemplate . ',rowTemplate=' . $rowTemplate . ',tableName[0]=' . $tableName[0]); + } // END - if + + // Do we have entries from orderByColumns to add? + if (count($orderByColumns) > 0) { + // Add them as well + $SQL .= ' ORDER BY '; + foreach ($orderByColumns as $orderByColumn=>$array) { + // Get keys (table/alias) and values (sorting itself) + $table = trim(implode('', array_keys($array))); + $sorting = trim(implode('', array_keys($array))); + + // table/alias can be omitted + if (!empty($table)) { + // table/alias is given + $SQL .= $table . '.'; + } // END - if + + // Add order-by column + $SQL .= '`' . $orderByColumn . '` ' . $sorting . ','; + } // END - foreach + + // Remove last column + $SQL = substr($SQL, 0, -1); + } // END - if + + // Now handle all over to the inner function which will execute the listing + doAdminListEntries($SQL, $tableTemplate, $rowTemplate, $callbackColumns, $extraParameters, $noEntryMessageId); +} + +// Do the listing of entries +function doAdminListEntries($SQL, $tableTemplate, $rowTemplate, $callbackColumns, $extraParameters, $noEntryMessageId) { + // Run the SQL query + $result = SQL_QUERY($SQL, __FUNCTION__, __LINE__); + + // Do we have some URLs left? + if (!SQL_HASZERONUMS($result)) { + // List all URLs + $OUT = ''; + while ($content = SQL_FETCHARRAY($result)) { + // "Translate" content + foreach ($callbackColumns as $column=>$callbackFunction) { + // Fill the callback arguments + $args = array($content[$column]); + + // Do we have more to add? + if (isset($extraParameters[$column])) { + // Add them as well + merge_array($args, $extraParameters[$column]); + } // END - if + + // Call the callback-function + //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'callbackFunction=' . $callbackFunction . ',args=
'.print_r($args, true).'
'); + // @TODO If we can rewrite the EL sub-system to support more than one parameter, this call_user_func_array() can be avoided + $content[$column] = call_user_func_array($callbackFunction, $args); + } // END - foreach + + // Load row template + $OUT .= loadTemplate(trim($rowTemplate[0]), true, $content); + } // END - while + + // Load main template + loadTemplate(trim($tableTemplate[0]), false, $OUT); + } else { + // No URLs in surfbar + displayMessage('{--' .$noEntryMessageId . '--}'); + } + + // Free result + SQL_FREERESULT($result); +} + // Checks proxy settins by fetching check-updates3.php from www.mxchange.org function adminTestProxySettings ($settingsArray) { // Set temporary the new settings diff --git a/inc/modules/admin/what-list_surfbar_urls.php b/inc/modules/admin/what-list_surfbar_urls.php index aed7a27ba6..ad6c741db3 100644 --- a/inc/modules/admin/what-list_surfbar_urls.php +++ b/inc/modules/admin/what-list_surfbar_urls.php @@ -101,42 +101,7 @@ if ($show === false) { } // END - if // List all URLs -$result = SQL_QUERY("SELECT - `url_id`, - `url_userid`, - `url`, - `url_views_total`, - `url_status`, - UNIX_TIMESTAMP(`url_registered`) AS `url_registered`, - UNIX_TIMESTAMP(`url_last_locked`) AS `url_last_locked`, - `url_lock_reason` -FROM - `{?_MYSQL_PREFIX?}_surfbar_urls` -ORDER BY - `url_id` ASC", __FILE__, __LINE__); - -// Do we have some URLs left? -if (!SQL_HASZERONUMS($result)) { - // List all URLs - $OUT = ''; - while ($content = SQL_FETCHARRAY($result)) { - // "Translate" content - $content['url_registered'] = generateDateTime($content['url_registered'], '2'); - $content['url_last_locked'] = generateDateTime($content['url_last_locked'], '2'); - - // Load row template - $OUT .= loadTemplate('admin_list_surfbar_urls_row', true, $content); - } // END - while - - // Load main template - loadTemplate('admin_list_surfbar_urls', false, $OUT); -} else { - // No URLs in surfbar - displayMessage('{--ADMIN_SURFBAR_NO_URLS_FOUND--}'); -} - -// Free result -SQL_FREERESULT($result); +showEntriesByXmlCallback('admin_list_surfbar_urls'); // [EOF] ?> diff --git a/inc/template-functions.php b/inc/template-functions.php index da8d167066..611d1b107d 100644 --- a/inc/template-functions.php +++ b/inc/template-functions.php @@ -262,8 +262,13 @@ function outputRawCode ($htmlCode) { // Load a template file and return it's content (only it's name; do not use ' or ") function loadTemplate ($template, $return = false, $content = array(), $compileCode = true) { - // @TODO Remove this sanity-check if all is fine - if (!is_bool($return)) debug_report_bug(__FUNCTION__, __LINE__, 'return is not bool (' . gettype($return) . ')'); + if (!is_bool($return)) { + // @TODO Remove this sanity-check if all is fine + debug_report_bug(__FUNCTION__, __LINE__, 'return[] is not bool (' . gettype($return) . ')'); + } elseif (!is_string($template)) { + // $template has to be string + debug_report_bug(__FUNCTION__, __LINE__, 'template[] is not string (' . gettype($template) . ')'); + } // Set current template $GLOBALS['current_template'] = $template; diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 564ee853e3..a89c49a676 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -2537,6 +2537,26 @@ function convertCommaToDotInPostDataArray ($postEntries) { } // END - foreach } +/** + * Parses a string into a US formated float variable, taken from user comments + * from PHP documentation website. + * + * @param $floatString A string holding a float expression + * @return $float Corresponding float variable + * @author chrisgeorgakopouloscom + * @link http://de.php.net/manual/en/function.floatval.php#92563 + */ +function parseFloat ($floatString){ + $LocaleInfo = localeconv(); + $floatString = str_replace($LocaleInfo['mon_thousands_sep'] , '', $floatString); + $floatString = str_replace($LocaleInfo['mon_decimal_point'] , '.', $floatString); + return floatval($floatString); +} + +//----------------------------------------------------------------------------- +// Configuration wrapper +//----------------------------------------------------------------------------- + // Getter for 'check_double_email' function getCheckDoubleEmail () { // Is the cache entry set? @@ -2549,7 +2569,7 @@ function getCheckDoubleEmail () { return $GLOBALS[__FUNCTION__]; } -// Checks wether 'check_double_email' is "YES" +// Checks wether 'check_double_email' is 'Y' function isCheckDoubleEmailEnabled () { // Is the cache entry set? if (!isset($GLOBALS[__FUNCTION__])) { diff --git a/inc/xml-functions.php b/inc/xml-functions.php index 04550bc6da..8958bdb157 100644 --- a/inc/xml-functions.php +++ b/inc/xml-functions.php @@ -63,6 +63,13 @@ function showEntriesByXmlCallback ($template) { // Read it $templateContent = readFromFile($FQFN); + // Init main arrays + $GLOBALS['__XML_CALLBACKS'] = array( + 'callbacks' => array(), + 'functions' => array() + ); + $GLOBALS['__XML_ARGUMENTS'] = array(); + // Handle it over to the parser parseXmlData($templateContent); @@ -117,6 +124,15 @@ function doCallXmlCallbackFunction () { if ((isset($GLOBALS['__XML_CALLBACKS']['functions'][$callback])) && (isset($GLOBALS['__XML_ARGUMENTS'][$callback]))) { // Run all function callbacks foreach ($GLOBALS['__XML_CALLBACKS']['functions'][$callback] as $function) { + // Trim all function names + $function = trim($function); + + // If the function is empty, simply skip to the (maybe) next one + if (empty($function)) { + // Skip this + continue; + } // END - if + // Now construct the call-back function's name with 'Execute' at the end $callbackName = $callback . 'Execute'; @@ -135,9 +151,9 @@ function doCallXmlCallbackFunction () { } // END - foreach } -// ---------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // Call-back functions for XML parser -// ---------------------------------------------------------------------------- +//----------------------------------------------------------------------------- // Starts an element function startXmlElement ($resource, $element, $attributes) { @@ -178,7 +194,7 @@ function isInvalidXmlType ($type) { $type = strtolower(trim($type)); // Is it found? - return (in_array($type, array('string', 'array', 'bool'))); + return (in_array($type, array('string', 'array', 'bool', 'int'))); } // Checks if given value is valid/verifyable diff --git a/templates/de/html/admin/admin_surfbar_url_stats_row.tpl b/templates/de/html/admin/admin_surfbar_url_stats_row.tpl index 9548a6346f..1a1215a3b7 100644 --- a/templates/de/html/admin/admin_surfbar_url_stats_row.tpl +++ b/templates/de/html/admin/admin_surfbar_url_stats_row.tpl @@ -1,5 +1,5 @@ - [{%pipe,generateUserProfileLink=$content[url_userid]%}] + {%pipe,generateUserProfileLink=$content[stats_userid]%} {%pipe,translateComma=$content[total_visits]%} $content[last_surfed] diff --git a/templates/xml/admin/admin_delete_do_surfbar_urls.xml b/templates/xml/admin/admin_delete_do_surfbar_urls.xml index 6a53141ec2..4ecd4e3c8c 100644 --- a/templates/xml/admin/admin_delete_do_surfbar_urls.xml +++ b/templates/xml/admin/admin_delete_do_surfbar_urls.xml @@ -30,7 +30,7 @@ MA 02110-1301 USA Call-back function which should all following parameter handled over to. This will always be type of string but we like homogene XMLs. //--> - + diff --git a/templates/xml/admin/admin_delete_show_surfbar_urls.xml b/templates/xml/admin/admin_delete_show_surfbar_urls.xml index 6e324806bd..3d70110a6e 100644 --- a/templates/xml/admin/admin_delete_show_surfbar_urls.xml +++ b/templates/xml/admin/admin_delete_show_surfbar_urls.xml @@ -30,7 +30,7 @@ MA 02110-1301 USA Call-back function which should all following parameter handled over to. This will always be type of string but we like homogene XMLs. //--> - + diff --git a/templates/xml/admin/admin_edit_do_surfbar_urls.xml b/templates/xml/admin/admin_edit_do_surfbar_urls.xml index 92ecc82f38..daa5e51005 100644 --- a/templates/xml/admin/admin_edit_do_surfbar_urls.xml +++ b/templates/xml/admin/admin_edit_do_surfbar_urls.xml @@ -30,7 +30,7 @@ MA 02110-1301 USA Call-back function which should all following parameter handled over to. This will always be type of string but we like homogene XMLs. //--> - + diff --git a/templates/xml/admin/admin_edit_show_surfbar_urls.xml b/templates/xml/admin/admin_edit_show_surfbar_urls.xml index 7ab4786f24..7afa2acc67 100644 --- a/templates/xml/admin/admin_edit_show_surfbar_urls.xml +++ b/templates/xml/admin/admin_edit_show_surfbar_urls.xml @@ -30,7 +30,7 @@ MA 02110-1301 USA Call-back function which should all following parameter handled over to. This will always be type of string but we like homogene XMLs. //--> - + diff --git a/templates/xml/admin/admin_list_surfbar_urls.xml b/templates/xml/admin/admin_list_surfbar_urls.xml new file mode 100644 index 0000000000..03391becf7 --- /dev/null +++ b/templates/xml/admin/admin_list_surfbar_urls.xml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/templates/xml/admin/admin_lock_do_surfbar_urls.xml b/templates/xml/admin/admin_lock_do_surfbar_urls.xml index 49efcddd98..1951a9b7f4 100644 --- a/templates/xml/admin/admin_lock_do_surfbar_urls.xml +++ b/templates/xml/admin/admin_lock_do_surfbar_urls.xml @@ -30,7 +30,7 @@ MA 02110-1301 USA Call-back function which should all following parameter handled over to. This will always be type of string but we like homogene XMLs. //--> - + diff --git a/templates/xml/admin/admin_lock_show_surfbar_urls.xml b/templates/xml/admin/admin_lock_show_surfbar_urls.xml index 7494f786bd..870748fc1d 100644 --- a/templates/xml/admin/admin_lock_show_surfbar_urls.xml +++ b/templates/xml/admin/admin_lock_show_surfbar_urls.xml @@ -30,7 +30,7 @@ MA 02110-1301 USA Call-back function which should all following parameter handled over to. This will always be type of string but we like homogene XMLs. //--> - + diff --git a/templates/xml/admin/admin_undelete_do_surfbar_urls.xml b/templates/xml/admin/admin_undelete_do_surfbar_urls.xml index 0fdb6b68dc..7910f59f19 100644 --- a/templates/xml/admin/admin_undelete_do_surfbar_urls.xml +++ b/templates/xml/admin/admin_undelete_do_surfbar_urls.xml @@ -30,7 +30,7 @@ MA 02110-1301 USA Call-back function which should all following parameter handled over to. This will always be type of string but we like homogene XMLs. //--> - + diff --git a/templates/xml/admin/admin_undelete_show_surfbar_urls.xml b/templates/xml/admin/admin_undelete_show_surfbar_urls.xml index 91ba50462e..2b80c606f2 100644 --- a/templates/xml/admin/admin_undelete_show_surfbar_urls.xml +++ b/templates/xml/admin/admin_undelete_show_surfbar_urls.xml @@ -30,7 +30,7 @@ MA 02110-1301 USA Call-back function which should all following parameter handled over to. This will always be type of string but we like homogene XMLs. //--> - + diff --git a/templates/xml/admin_data_template.xml b/templates/xml/admin_data_template.xml index c517d7ac23..6fc9904e62 100644 --- a/templates/xml/admin_data_template.xml +++ b/templates/xml/admin_data_template.xml @@ -33,7 +33,7 @@ MA 02110-1301 USA to. This will always be type of string but we like homogene XMLs. Keep 'name' empty for numerical array indexes (array keys). //--> - + diff --git a/templates/xml/admin_list_data_template.xml b/templates/xml/admin_list_data_template.xml new file mode 100644 index 0000000000..e47c537c8f --- /dev/null +++ b/templates/xml/admin_list_data_template.xml @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +