$file = basename($FQFN);
// Init variables
- $LINK_ADD = '';
+ $linkAdd = '';
$OUT = '';
$ADD = '';
$prefix = '';
$type = 'what';
$search = $file;
$modCheck = getModule();
- $ADD = '';
} else {
// Other
$type = 'menu';
$search = $file;
$modCheck = getModule();
- $ADD = '';
}
// Begin the navigation line
$GLOBALS['nav_depth'] = '0';
// Run the pre-filter chain
- $ret = runFilterChain('pre_youhere_line', array('access_level' => $accessLevel, 'type' => $type, 'search' => $search, 'prefix' => $prefix, 'link_add' => $LINK_ADD, 'content' => '', 'add' => $ADD));
+ $ret = runFilterChain('pre_youhere_line', array('access_level' => $accessLevel, 'type' => $type, 'search' => $search, 'prefix' => $prefix, 'link_add' => $linkAdd, 'content' => '', 'add' => $ADD));
// Add pre-content
$prefix = $ret['content'];
// Add default content
- $prefix .= '<div class="you_are_here">{--YOU_ARE_HERE--} <strong><a class="you_are_here" href="{%url=modules.php?module=' . getModule() . $LINK_ADD . '%}">Home</a></strong>';
+ $prefix .= '<div class="you_are_here">{--YOU_ARE_HERE--} <strong><a class="you_are_here" href="{%url=modules.php?module=' . getModule() . $linkAdd . '%}">Home</a></strong>';
} elseif ($return === false) {
// Count depth
$GLOBALS['nav_depth']++;
}
+ // Add arrow
$prefix .= ' -> ';
// We need to remove .php and the end
$search = substr($search, 0, -4);
} // END - if
+ // Is ext-sql_patches installed?
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isExtensionInstalledAndNewer()=' . intval(isExtensionInstalledAndNewer('sql_patches', '0.2.3')) . ',youre_here=' . getConfig('youre_here') . ',isAdmin()=' . intval(isAdmin()) . ',modCheck=' . $modCheck);
if (((isExtensionInstalledAndNewer('sql_patches', '0.2.3')) && (getConfig('youre_here') == 'Y')) || ((isAdmin()) && ($modCheck == 'admin'))) {
// Output HTML code
- $OUT = $prefix . '<strong><a class="you_are_here" href="{%url=modules.php?module=' . $modCheck . '&' . $type . '=' . $search . $LINK_ADD . '%}">' . getTitleFromMenu($accessLevel, $search, $type, $ADD) . '</a></strong>';
+ $OUT = $prefix . '<strong><a class="you_are_here" href="{%url=modules.php?module=' . $modCheck . '&' . $type . '=' . $search . $linkAdd . '%}">' . getTitleFromMenu($accessLevel, $search, $type, $ADD) . '</a></strong>';
// Can we close the you-are-here navigation?
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'type=' . $type . 'getWhat()=' . getWhat());
- if (($type == 'what') || (($type == 'action') && ((!isWhatSet()) || (getWhat() == 'welcome')))) {
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'type=' . $type . ',getWhat()=' . getWhat() . ',accessLevel=' . $accessLevel . ',isWhatSet()=' . intval(isWhatSet()));
+ if (($type == 'what') || (($type == 'action') && ((!isWhatSet()) || (($accessLevel == 'admin') && (getWhat() == 'welcome'))))) {
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'type=' . $type);
// Add closing div and br-tag
$GLOBALS['nav_depth'] = '0';
// Run the post-filter chain
- $ret = runFilterChain('post_youhere_line', array('access_level' => $accessLevel, 'type' => $type, 'search' => $search, 'prefix' => $prefix, 'link_add' => $LINK_ADD, 'content' => $OUT, 'add' => $ADD));
+ $ret = runFilterChain('post_youhere_line', array('access_level' => $accessLevel, 'type' => $type, 'search' => $search, 'prefix' => $prefix, 'link_add' => $linkAdd, 'content' => $OUT, 'add' => $ADD));
// Get content from filter back
$OUT = $ret['content'];
// Load SQL data and add the menu to the output stream...
$result_main = SQL_QUERY_ESC("SELECT
- `title`,`what`,`action`,`visible`,`locked`
+ `title`,
+ `what`,
+ `action`,
+ `visible`,
+ `locked`
FROM
`{?_MYSQL_PREFIX?}_%s_menu`
WHERE
`action`='%s' AND
`what` != '' AND
`what` IS NOT NULL
- ".$ADD."
+ " . $ADD . "
ORDER BY
`sort` ASC",
- array($mode, $content['action']), __FUNCTION__, __LINE__);
+ array(
+ $mode,
+ $content['action']
+ ), __FUNCTION__, __LINE__);
// Do we have some entries?
if (!SQL_HASZERONUMS($result_sub)) {
// Init user data array
initUserData();
- // Fix "deleted" cookies first
+ // Fix "deleted" cookies
fixDeletedCookies(array('userid', 'u_hash'));
// Are cookies set and can the member data be loaded?
// Secure userid
$value = bigintval($value);
- // Set it here
- setCurrentUserId($value);
-
// Don't look for invalid userids...
if (!isValidUserId($value)) {
// Invalid, so abort here
$found = false;
// Extra SQL statements
- $ADD = runFilterChain('convert_user_data_columns', '');
+ $ADD = runFilterChain('convert_user_data_columns', ' ');
// Query for the user
$result = SQL_QUERY_ESC("SELECT *" . $ADD . " FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `%s`='%s' LIMIT 1",
- array($column, $value), __FUNCTION__, __LINE__);
+ array(
+ $column,
+ $value
+ ), __FUNCTION__, __LINE__);
// Do we have a record?
if (SQL_NUMROWS($result) == 1) {
}
// Generates an option list from various parameters
-function generateOptions ($table, $id, $name, $default = '', $special = '', $whereStatement = '', $disabled = array(), $callback = '') {
+function generateOptions ($table, $key, $value, $default = '', $extra = '', $whereStatement = '', $disabled = array(), $callback = '') {
$ret = '';
if ($table == '/ARRAY/') {
// Selection from array
- if ((is_array($id)) && (is_array($name)) && ((count($id)) == (count($name)) || (!empty($callback)))) {
+ if ((is_array($key)) && (is_array($value)) && ((count($key)) == (count($value)) || (!empty($callback)))) {
// Both are arrays
- foreach ($id as $idx => $value) {
- $ret .= '<option value="' . $value . '"';
- if ($default == $value) {
+ foreach ($key as $idx => $optionValue) {
+ $ret .= '<option value="' . $optionValue . '"';
+ if ($default == $optionValue) {
// Selected by default
$ret .= ' selected="selected"';
- } elseif (isset($disabled[$value])) {
+ } elseif (isset($disabled[$optionValue])) {
// Disabled!
$ret .= ' disabled="disabled"';
}
// Is the call-back function set?
if (!empty($callback)) {
// Call it
- $name[$idx] = call_user_func_array($callback, array($id[$idx]));
+ $value[$idx] = call_user_func_array($callback, array($key[$idx]));
} // END - if
// Finish option tag
- $ret .= '>' . $name[$idx] . '</option>';
+ $ret .= '>' . $value[$idx] . '</option>';
} // END - foreach
} else {
// Problem in request
- reportBug(__FUNCTION__, __LINE__, 'Not all are arrays: id[' . count($id) . ']=' . gettype($id) . ',name[' . count($name) . ']=' . gettype($name) . ',callback=' . $callback);
+ reportBug(__FUNCTION__, __LINE__, 'Not all are arrays: key[' . count($key) . ']=' . gettype($key) . ',value[' . count($value) . ']=' . gettype($value) . ',callback=' . $callback);
}
} else {
- // Data from database
- $SPEC = ',`' . $id . '`';
- if (!empty($special)) {
- $SPEC = ',`' . $special . '` AS `special`';
+ ///////////////////////
+ // Data from database /
+ ///////////////////////
+
+ // Init extra column (if requested)
+ $extraColumn = '';
+ if (!empty($extra)) {
+ $extraColumn = ',`' . $extra . '` AS `extra`';
} // END - if
- // Query the database
- $result = SQL_QUERY_ESC("SELECT `%s` AS `id`,`%s` AS `name`".$SPEC." FROM `{?_MYSQL_PREFIX?}_%s` ".$whereStatement." ORDER BY `%s` ASC",
+ // Run SQL query
+ $result = SQL_QUERY_ESC("SELECT `%s` AS `key`,`%s` AS `value`" . $extraColumn . " FROM `{?_MYSQL_PREFIX?}_%s` " . $whereStatement . " ORDER BY `%s` ASC",
array(
- $id,
- $name,
+ $key,
+ $value,
$table,
- $name
+ $value
), __FUNCTION__, __LINE__);
// Do we have rows?
if (!SQL_HASZERONUMS($result)) {
// Found data so add them as OPTION lines
while ($content = SQL_FETCHARRAY($result)) {
- // Is special set?
- if (!isset($content['special'])) {
+ // Is extra set?
+ if (!isset($content['extra'])) {
// Set it to empty
- $content['special'] = '';
+ $content['extra'] = '';
} // END - if
- $ret .= '<option value="' . $content['id'] . '"';
+ $ret .= '<option value="' . $content['key'] . '"';
- if ($default == $content['id']) {
+ if ($default == $content['key']) {
// Selected by default
$ret .= ' selected="selected"';
- } elseif (isset($disabled[$content['id']])) {
+ } elseif (isset($disabled[$content['key']])) {
// Disabled!
$ret .= ' disabled="disabled"';
}
// Add it, if set
- if (!empty($content['special'])) {
- $content['special'] = ' (' . $content['special'] . ')';
+ if (!empty($content['extra'])) {
+ $content['extra'] = ' (' . $content['extra'] . ')';
} // END - if
// Is the call-back function set?
if (!empty($callback)) {
// Call it
- $content['name'] = call_user_func_array($callback, array($content['name']));
+ $content['value'] = call_user_func_array($callback, array($content['value']));
} // END - if
// Finish option list
- $ret .= '>' . $content['name'] . $content['special'] . '</option>';
+ $ret .= '>' . $content['value'] . $content['extra'] . '</option>';
} // END - while
} else {
// No data found
$add = '';
// Is the extension equal or newer 0.8.9?
- if ((getExtensionMode() == 'register') || (getExtensionMode() == 'update') || (isExtensionInstalledAndNewer('sql_patches', '0.8.9'))) {
+ if (((isInstallationPhase()) && ((getExtensionMode() == 'register') || (getExtensionMode() == 'update'))) || (isExtensionInstalledAndNewer('sql_patches', '0.8.9'))) {
// Then add provider
$add = " AND `account_provider`='EXTENSION'";
} // END - if
// Is the 'subject' there?
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ifSqlTableExists(points_data)=' . ifSqlTableExists('points_data') . ',getExtensionMode()=' . getExtensionMode() . ',add=' . $add);
if (((!ifSqlTableExists('points_data')) && ((getExtensionMode() == 'register') || (getExtensionMode() == 'update'))) || (countSumTotalData($subject, 'points_data', 'id', 'subject', true, $add) == 0)) {
- // Not found so add an SQL query
+ // Not found so:
+ if ((isset($GLOBALS['previous_extension'][getCurrentExtensionName()])) && (!ifSqlTableExists('points_data'))) {
+ $dummy = $GLOBALS['previous_extension'][getCurrentExtensionName()];
+ reportBug(__FUNCTION__, __LINE__, 'previous_extension[' . gettype($dummy) . ']=' . $dummy . ',getCurrentExtensionName()=' . getCurrentExtensionName() . ' - Under development, please report this!');
+ } // END - if
+
+ // ... add an SQL query
addExtensionSql(sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_points_data` (`subject`,`column_name`,`locked_mode`,`payment_method`) VALUES ('%s','%s','%s','%s')",
$subject,
$columnName,