0) { // Then we need to lookup the login name by getting the admin hash $adminHash = getAdminHash($adminId); // If this is fine, we can continue if ($adminHash != '-1') { // Get admin id and set it as current setCurrentAdminId($adminId); // Now, we need to encode the password in the same way the one is encoded in database $testHash = generateHash($adminPassword, $adminHash); // If they both match, the login data is valid if ($testHash == $adminHash) { // All fine $ret = 'done'; } else { // Set status $ret = 'pass'; } } // END - if } // END - if // Prepare data array $data = array( 'id' => $adminId, 'login' => $adminLogin, 'plain_pass' => $adminPassword, 'pass_hash' => $adminHash ); // Run a special filter runFilterChain('do_admin_login_' . $ret, $data); // Return status return $ret; } // Only be executed on cookie checking function ifAdminCookiesAreValid ($adminLogin, $passHash) { // First of all, no admin login is found $ret = '404'; // Then we need to lookup the login name by getting the admin hash $adminHash = getAdminHash($adminLogin); // If this is fine, we can continue if ($adminHash != '-1') { // Now, we need to encode the password in the same way the one is encoded in database $testHash = encodeHashForCookie($adminHash); //* DEBUG: */ debugOutput('adminLogin=' . $adminLogin . ',passHash='.$passHash.',adminHash='.$adminHash.',testHash='.$testHash); // If they both match, the login data is valid if ($testHash == $passHash) { // All fine $ret = 'done'; } else { // Set status $ret = 'pass'; } } // END - if // Return status //* DEBUG: */ debugOutput('ret='.$ret); return $ret; } // Do an admin action function doAdminAction () { // Get default what $what = getWhat(); //* DEBUG: */ debugOutput(__LINE__.'*'.$what.'/'.getModule().'/'.getAction().'/'.getWhat().'*'); // Remove any spaces from variable if (empty($what)) { // Default admin action is the overview page $what = 'overview'; } else { // Secure it $what = secureString($what); } // Get action value $action = getActionFromModuleWhat(getModule(), $what); // Define admin login name and id number $content['login'] = getAdminLogin(getSession('admin_id')); $content['id'] = getCurrentAdminId(); // Preload templates if (isExtensionActive('admins')) { $content['welcome'] = loadTemplate('admin_welcome_admins', true, $content); } else { $content['welcome'] = loadTemplate('admin_welcome', true, $content); } $content['footer'] = loadTemplate('admin_footer' , true, $content); $content['menu'] = addAdminMenu($action, $what, true); // Tableset header loadTemplate('admin_main_header', false, $content); // Check if action/what pair is valid $result_action = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='%s' AND ( ( `what`='%s' AND `what` != 'overview' ) OR ( ( `what`='' OR `what` IS NULL ) AND ( '%s'='overview' ) ) ) LIMIT 1", array( $action, $what, $what ), __FUNCTION__, __LINE__); // Do we have an entry? if (SQL_NUMROWS($result_action) == 1) { // Is valid but does the inlcude file exists? $inc = sprintf("inc/modules/admin/action-%s.php", $action); if ((isIncludeReadable($inc)) && (isMenuActionValid('admin', $action, $what)) && ($GLOBALS['acl_allow'] === true)) { // Ok, we finally load the admin action module loadInclude($inc); } elseif ($GLOBALS['acl_allow'] === false) { // Access denied loadTemplate('admin_menu_failed', false, getMaskedMessage('ADMIN_ACCESS_DENIED', $what)); } else { // Include file not found! :-( loadTemplate('admin_menu_failed', false, getMaskedMessage('ADMIN_ACTION_404', $action)); } } else { // Invalid action/what pair found! loadTemplate('admin_menu_failed', false, getMaskedMessage('ADMIN_ACTION_INVALID', $action . '/' . $what)); } // Free memory SQL_FREERESULT($result_action); // Tableset footer loadTemplate('admin_main_footer', false, $content); } // Adds an admin menu function addAdminMenu ($action, $what, $return=false) { // Init variables $SUB = false; $OUT = ''; // Menu descriptions $GLOBALS['menu']['description'] = array(); $GLOBALS['menu']['title'] = array(); // Build main menu $result_main = SQL_QUERY("SELECT `action`, `title`, `descr` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort` ASC, `id` DESC", __FUNCTION__, __LINE__); // Do we have entries? if (SQL_NUMROWS($result_main) > 0) { $OUT .= ''; } // Is there a cache instance again? // Return or output content? if ($return === true) { return $OUT; } else { outputHtml($OUT); } } // Create member selection box 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__); // Default output $OUT = ''; // USe this only for adding points (e.g. adding refs really makes no sence ;-) ) if ($add_all === true) $OUT = ' '; elseif ($none === true) $OUT = ' '; while ($content = SQL_FETCHARRAY($result)) { $OUT .= '