From: Roland Häder Date: Wed, 31 Mar 2010 18:07:20 +0000 (+0000) Subject: Several fixes/improvements, new function introduced: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9e3656b7346cd7ba24f241f2e0378b9e4675acd3;p=mailer.git Several fixes/improvements, new function introduced: - New function handleFieldWithBraces() introduced which helps correcting the value of 'name' attribute - Several template fixes --- diff --git a/inc/functions.php b/inc/functions.php index 0187e2c818..320c774ce8 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -3948,6 +3948,28 @@ function fixNullEmptyToDashes ($str, $num) { return $return; } +// Handles the braces [] of a field (e.g. value of 'name' attribute) +function handleFieldWithBraces ($field) { + // Are there braces [] at the end? + if (substr($field, -2, 2) == '[]') { + // Try to find one and replace it. I do it this way to allow easy + // extending of this code. + foreach (array('admin_list_builder_id_value') as $key) { + // Is the cache entry set? + if (isset($GLOBALS[$key])) { + // Insert it + $field = str_replace('[]', '[' . $GLOBALS[$key] . ']', $field); + + // And abort + break; + } // END - if + } // END - foreach + } // END - if + + // Return it + return $field; +} + ////////////////////////////////////////////////// // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS // ////////////////////////////////////////////////// @@ -3987,3 +4009,4 @@ if (!function_exists('http_build_query')) { // [EOF] ?> + diff --git a/inc/language/surfbar_de.php b/inc/language/surfbar_de.php index 4643733a1a..85e92f5562 100644 --- a/inc/language/surfbar_de.php +++ b/inc/language/surfbar_de.php @@ -123,7 +123,7 @@ addMessages(array( 'ADMIN_SURFBAR_URL' => "Gebuchte URL", // Admin titles - 'ADMIN_UNLOCK_SURFBAR_URLS_TITLE' => "Surfbar - URLs freihschalten/ablehnen", + 'ADMIN_SURFBAR_UNLOCK_URLS_TITLE' => "Surfbar - URLs freihschalten/ablehnen", 'ADMIN_SURFBAR_LIST_URLS_TITLE' => "Surfbar - URLs aufisten", 'ADMIN_SURFBAR_DELETE_URLS_TITLE' => "Surfbar - URLs entfernen", 'ADMIN_SURFBAR_EDIT_URLS_TITLE' => "Surfbar - URLs editieren", diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 914622a461..3a053f1026 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -394,7 +394,7 @@ ORDER BY } // Create member selection box -function addMemberSelectionBox ($def=0, $add_all=false, $return=false, $none=false, $field='userid') { +function addMemberSelectionBox ($def = 0, $add_all = false, $return = false, $none = false, $field = 'userid') { // Output selection form with all confirmed user accounts listed $result = SQL_QUERY("SELECT `userid`, `surname`, `family` FROM `{?_MYSQL_PREFIX?}_user_data` ORDER BY `userid` ASC", __FUNCTION__, __LINE__); @@ -406,7 +406,7 @@ function addMemberSelectionBox ($def=0, $add_all=false, $return=false, $none=fal elseif ($none === true) $OUT = ' '; while ($content = SQL_FETCHARRAY($result)) { - $OUT .= ' '; + // Load all entries + while ($content = SQL_FETCHARRAY($result)) { + $OUT .= ''; // Walk through all files foreach ($menuArray as $file) { // Is this a PHP script? - if ((!isDirectory($file)) && (strpos($file, "".$type.'-') > -1) && (strpos($file, '.php') > 0)) { + if ((!isDirectory($file)) && (strpos($file, '' . $type . '-') > -1) && (strpos($file, '.php') > 0)) { // Then test if the file is readable $test = sprintf("inc/modules/%s/%s", $menu, $file); @@ -598,16 +599,16 @@ function adminAddMenuSelectionBox ($menu, $type, $name, $default = '') { // Is that part different from the overview? if ($part != 'overview') { - $OUT .= " '; } // END - if } // END - if } // END - if } // END - foreach // Close selection box - $OUT .= "\n"; + $OUT .= ''; // Return contents return $OUT; @@ -781,10 +782,18 @@ function adminListBuilder ($listType, $IDs, $table, $columns, $filterFunctions, // Do we have a userid? if ($key == 'userid') { // Add it again as raw id - $content['userid'] = bigintval($value); + $content['userid_raw'] = bigintval($value); + } // END - if + + // If the key matches the idColumn variable, we need to temporary remember it + //* DEBUG: */ print 'key=' . $key . ',idColumn=' . $idColumn . ',value=' . $value . '
'; + if ($key == $idColumn) { + // Found, so remember it + $GLOBALS['admin_list_builder_id_value'] = $value; } // END - if // Handle the call in external function + //* DEBUG: */ print 'key=' . $key . ',fucntion=' . $filterFunctions[$idx] . ',value=' . $value . '
'; $content[$key] = handleExtraValues($filterFunctions[$idx], $value, $extraValues[$idx]); } // END - foreach @@ -793,9 +802,9 @@ function adminListBuilder ($listType, $IDs, $table, $columns, $filterFunctions, // Then list it $OUT .= loadTemplate(sprintf("admin_%s_%s_row", - $listType, - $table - ), true, $content + $listType, + $table + ), true, $content ); // Switch color @@ -824,7 +833,7 @@ function adminBuilderStatusHandler ($mode, $IDs, $table, $columns, $filterFuncti $sql = sprintf("UPDATE `{?_MYSQL_PREFIX?}_%s` SET", SQL_ESCAPE($table)); // Load data of entry - $result = SQL_QUERY_ESC("SELECT * FROM `{?_MYSQL_PREFIX?}_%s` WHERE %s=%s LIMIT 1", + $result = SQL_QUERY_ESC("SELECT * FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`=%s LIMIT 1", array($table, $idColumn, $id), __FUNCTION__, __LINE__); // Fetch the data @@ -858,10 +867,13 @@ function adminBuilderStatusHandler ($mode, $IDs, $table, $columns, $filterFuncti // Add other columns as well foreach (postRequestArray() as $key => $entries) { + // Debug message + logDebugMessage(__FUNCTION__, __LINE__, 'Found entry: ' . $key); + // Skip id, raw userid and 'do_$mode' - if (!in_array($key, array($idColumn, 'userid_raw', ('do_'.$mode)))) { + if (!in_array($key, array($idColumn, 'userid_raw', ('do_' . $mode)))) { // Are there brackets () at the end? - if (substr($entries[$id], -2, 2) == "()") { + if (substr($entries[$id], -2, 2) == '()') { // Direct SQL command found $sql .= sprintf(" %s=%s,", SQL_ESCAPE($key), SQL_ESCAPE($entries[$id])); } else { @@ -871,7 +883,10 @@ function adminBuilderStatusHandler ($mode, $IDs, $table, $columns, $filterFuncti // Add entry $content[$key] = $entries[$id]; } - } // END - if + } else { + // Skipped entry + logDebugMessage(__FUNCTION__, __LINE__, 'Skipped: ' . $key); + } } // END - foreach // Finish SQL statement @@ -983,8 +998,8 @@ function adminEditEntriesConfirm ($IDs, $table, $columns=array(), $filterFunctio // Then add this value $sql .= sprintf(" `%s`='%s',", - SQL_ESCAPE($key), - SQL_ESCAPE($entries[$id]) + SQL_ESCAPE($key), + SQL_ESCAPE($entries[$id]) ); } elseif (($key != $idColumn) && (!is_array($entries))) { // Add normal entries as well! diff --git a/inc/modules/admin/what-list_surfbar_urls.php b/inc/modules/admin/what-list_surfbar_urls.php index be0ad38097..e9964c13cc 100644 --- a/inc/modules/admin/what-list_surfbar_urls.php +++ b/inc/modules/admin/what-list_surfbar_urls.php @@ -65,7 +65,7 @@ if (isPostRequestParameterSet('edit')) { 'surfbar_urls', array('id', 'userid', 'url'), array('bigintval', 'addMemberSelectionBox', ''), - array('', array(false, true, true), '') + array('', array(false, true, true, 'userid[]'), '') ); $show = false; } elseif (isPostRequestParameterSet('do_edit')) { @@ -84,7 +84,7 @@ if (isPostRequestParameterSet('edit')) { postRequestParameter('id'), 'surfbar_urls', array('id', 'userid', 'url', 'registered'), - array('bigintval', 'generateUserProfileLink', 'FRAMETESTER', ''), + array('bigintval', 'generateUserProfileLink', 'generateFrametesterUrl', ''), array('', '', '', '') ); $show = false; @@ -97,7 +97,7 @@ if (isPostRequestParameterSet('edit')) { postRequestParameter('id'), 'surfbar_urls', array('id', 'userid', 'url', 'registered', 'status'), - array('bigintval', 'generateUserProfileLink', 'FRAMETESTER', '', 'translateSurfbarUrlStatus'), + array('bigintval', 'generateUserProfileLink', 'generateFrametesterUrl', '', 'translateSurfbarUrlStatus'), array('', '', '', '', '') ); $show = false; @@ -118,7 +118,7 @@ if (isPostRequestParameterSet('edit')) { postRequestParameter('id'), 'surfbar_urls', array('id', 'userid', 'url', 'registered', 'status'), - array('bigintval', 'generateUserProfileLink', 'FRAMETESTER', '', 'translateSurfbarUrlStatus'), + array('bigintval', 'generateUserProfileLink', 'generateFrametesterUrl', '', 'translateSurfbarUrlStatus'), array('', '', '', '', '') ); $show = false; diff --git a/templates/de/html/admin/admin_del_surfbar_urls_row.tpl b/templates/de/html/admin/admin_del_surfbar_urls_row.tpl index b57971971d..0c73084c25 100644 --- a/templates/de/html/admin/admin_del_surfbar_urls_row.tpl +++ b/templates/de/html/admin/admin_del_surfbar_urls_row.tpl @@ -1,7 +1,7 @@ - + $content[userid] diff --git a/templates/de/html/admin/admin_edit_surfbar_urls_row.tpl b/templates/de/html/admin/admin_edit_surfbar_urls_row.tpl index 2ce82c812b..41b5ff8b83 100644 --- a/templates/de/html/admin/admin_edit_surfbar_urls_row.tpl +++ b/templates/de/html/admin/admin_edit_surfbar_urls_row.tpl @@ -1,7 +1,7 @@ - + $content[userid] diff --git a/templates/de/html/admin/admin_list_surfbar_urls_row.tpl b/templates/de/html/admin/admin_list_surfbar_urls_row.tpl index 36471a6f06..f1ebeca359 100644 --- a/templates/de/html/admin/admin_list_surfbar_urls_row.tpl +++ b/templates/de/html/admin/admin_list_surfbar_urls_row.tpl @@ -12,13 +12,13 @@ $content[views_total] - $content[url_status] + $content[status] - $content[url_registered] + $content[registered] - $content[url_last_locked] + $content[last_locked] $content[lock_reason] diff --git a/templates/de/html/admin/admin_lock_surfbar_urls_row.tpl b/templates/de/html/admin/admin_lock_surfbar_urls_row.tpl index bff0efabd9..5e1afc10ee 100644 --- a/templates/de/html/admin/admin_lock_surfbar_urls_row.tpl +++ b/templates/de/html/admin/admin_lock_surfbar_urls_row.tpl @@ -1,7 +1,7 @@ - + $content[userid] @@ -9,10 +9,10 @@ {--ADMIN_TEST_URL--} - $content[url_status] + $content[status] - $content[url_registered] + $content[registered] Bitte angeben:
diff --git a/templates/de/html/admin/admin_undelete_surfbar_urls_row.tpl b/templates/de/html/admin/admin_undelete_surfbar_urls_row.tpl index 7ad3ab5ab5..1770775ee0 100644 --- a/templates/de/html/admin/admin_undelete_surfbar_urls_row.tpl +++ b/templates/de/html/admin/admin_undelete_surfbar_urls_row.tpl @@ -1,16 +1,16 @@ - + $content[userid] {--ADMIN_TEST_URL--} - $content[url_status] + $content[status] - $content[url_registered] + $content[registered] diff --git a/templates/de/html/admin/admin_unlock_surfbar_urls.tpl b/templates/de/html/admin/admin_unlock_surfbar_urls.tpl index 0666656170..e21e87b4e9 100644 --- a/templates/de/html/admin/admin_unlock_surfbar_urls.tpl +++ b/templates/de/html/admin/admin_unlock_surfbar_urls.tpl @@ -3,7 +3,7 @@
- {--ADMIN_UNLOCK_SURFBAR_URLS_TITLE--} + {--ADMIN_SURFBAR_UNLOCK_URLS_TITLE--}