}
// 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__);
elseif ($none === true) $OUT = ' <option value="0">{--SELECT_NONE--}</option>';
while ($content = SQL_FETCHARRAY($result)) {
- $OUT .= ' <option value="' . bigintval($content['userid']) . '"';
+ $OUT .= '<option value="' . bigintval($content['userid']) . '"';
if ($def == $content['userid']) $OUT .= ' selected="selected"';
$OUT .= '>' . $content['surname'] . ' ' . $content['family'] . ' (' . bigintval($content['userid']) . ')</option>';
} // END - while
loadTemplate('admin_member_selection_box', false, $content);
} else {
// Return content in selection frame
- return '<select class="admin_select" name="' . $field . '" size="1">' . $OUT . '</select>';
+ return '<select class="admin_select" name="' . handleFieldWithBraces($field) . '" size="1">' . $OUT . '</select>';
}
}
$what = "`what` != ''";
if ($mode == 'action') $what = "(`what`='' OR `what` IS NULL) AND `action` !='login'";
- $result = SQL_QUERY_ESC("SELECT %s, `title` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$what." ORDER BY `sort` ASC",
+ $result = SQL_QUERY_ESC("SELECT `%s` AS `menu`, `title` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$what." ORDER BY `sort` ASC",
array($mode), __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Load menu as selection
- $OUT = "<select name=\"".$mode."_menu";
- if ((!empty($defid)) || ($defid == '0')) $OUT .= "[".$defid."]";
- $OUT .= "\" size=\"1\" class=\"admin_select\">
- <option value=\"\">{--SELECT_NONE--}</option>\n";
- // @TODO Try to rewrite this to $content = SQL_FETCHARRAY(). Please look some lines above for the dynamic query
- while (list($menu, $title) = SQL_FETCHROW($result)) {
- $OUT .= " <option value=\"".$menu."\"";
- if ((!empty($default)) && ($default == $menu)) $OUT .= ' selected="selected"';
- $OUT .= ">".$title."</option>\n";
+ $OUT = '<select name="' . $mode . '_menu';
+ if ((!empty($defid)) || ($defid == '0')) $OUT .= '[' . $defid . ']';
+ $OUT .= '" size="1" class="admin_select">
+ <option value="">{--SELECT_NONE--}</option>';
+ // Load all entries
+ while ($content = SQL_FETCHARRAY($result)) {
+ $OUT .= '<option value="' . $content['menu'] . '"';
+ if ((!empty($default)) && ($default == $content['menu'])) $OUT .= ' selected="selected"';
+ $OUT .= '>' . $content['title'] . '</option>';
} // END - while
// Free memory
SQL_FREERESULT($result);
- $OUT .= "</select>\n";
+
+ // Add closing select-tag
+ $OUT .= '</select>';
} else {
// No menus???
$OUT = getMessage('ADMIN_PROBLEM_NO_MENU');
$menuArray = getArrayFromDirectory(sprintf("inc/modules/%s/", $menu), '', false, false);
// Init the selection box
- $OUT = "<select name=\"".$name."\" class=\"admin_select\" size=\"1\">
- <option value=\"\">{--IS_TOP_MENU--}</option>\n";
+ $OUT = '<select name="' . $name . '" class="admin_select" size="1"><option value="">{--IS_TOP_MENU--}</option>';
// 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);
// Is that part different from the overview?
if ($part != 'overview') {
- $OUT .= " <option value=\"".$part."\"";
+ $OUT .= '<option value="' . $part . '"';
if ($part == $default) $OUT .= ' selected="selected"';
- $OUT .= ">".$part."</option>\n";
+ $OUT .= '>' . $part . '</option>';
} // END - if
} // END - if
} // END - if
} // END - foreach
// Close selection box
- $OUT .= "</select>\n";
+ $OUT .= '</select>';
// Return contents
return $OUT;
// 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 . '<br />';
+ 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 . '<br />';
$content[$key] = handleExtraValues($filterFunctions[$idx], $value, $extraValues[$idx]);
} // END - foreach
// Then list it
$OUT .= loadTemplate(sprintf("admin_%s_%s_row",
- $listType,
- $table
- ), true, $content
+ $listType,
+ $table
+ ), true, $content
);
// Switch color
$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
// 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 {
// Add entry
$content[$key] = $entries[$id];
}
- } // END - if
+ } else {
+ // Skipped entry
+ logDebugMessage(__FUNCTION__, __LINE__, 'Skipped: ' . $key);
+ }
} // END - foreach
// Finish SQL statement
// 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!
'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')) {
postRequestParameter('id'),
'surfbar_urls',
array('id', 'userid', 'url', 'registered'),
- array('bigintval', 'generateUserProfileLink', 'FRAMETESTER', ''),
+ array('bigintval', 'generateUserProfileLink', 'generateFrametesterUrl', ''),
array('', '', '', '')
);
$show = false;
postRequestParameter('id'),
'surfbar_urls',
array('id', 'userid', 'url', 'registered', 'status'),
- array('bigintval', 'generateUserProfileLink', 'FRAMETESTER', '', 'translateSurfbarUrlStatus'),
+ array('bigintval', 'generateUserProfileLink', 'generateFrametesterUrl', '', 'translateSurfbarUrlStatus'),
array('', '', '', '', '')
);
$show = false;
postRequestParameter('id'),
'surfbar_urls',
array('id', 'userid', 'url', 'registered', 'status'),
- array('bigintval', 'generateUserProfileLink', 'FRAMETESTER', '', 'translateSurfbarUrlStatus'),
+ array('bigintval', 'generateUserProfileLink', 'generateFrametesterUrl', '', 'translateSurfbarUrlStatus'),
array('', '', '', '', '')
);
$show = false;