private function postAuthenticate($u, $p) { $this->justProcessed = true; $sql = "SELECT u.ID, u.username, u.email, u.admin, u.banned, u.active, u.name, (SELECT GROUP_CONCAT( g.name SEPARATOR '-groupsep-' ) FROM groups g, group_memberships gm WHERE g.ID = gm.group AND gm.user = u.ID ) AS groupmemberships FROM users u WHERE u.username='******' AND u.password_hash='{$p}'"; //echo $sql; PHPEcommerceFrameworkRegistry::getObject('db')->executeQuery($sql); if (PHPEcommerceFrameworkRegistry::getObject('db')->numRows() == 1) { $userData = PHPEcommerceFrameworkRegistry::getObject('db')->getRows(); if ($userData['active'] == 0) { $this->loggedIn = false; $this->loginFailureReason = 'inactive'; $this->active = false; } elseif ($userData['banned'] != 0) { $this->loggedIn = false; $this->loginFailureReason = 'banned'; $this->banned = false; } else { $this->loggedIn = true; $this->userID = $userData['ID']; $this->admin = $userData['admin'] == 1 ? true : false; $_SESSION['phpecomf_auth_session_uid'] = $userData['ID']; $groups = explode('-groupsep-', $userData['groupmemberships']); $this->groups = $groups; } } else { $this->loggedIn = false; $this->loginFailureReason = 'invalidcredentials'; } }
/** * Replace content on the page with data from the cache * @param String $tag the tag defining the area of content * @param int $cacheId the datas ID in the data cache * @return void */ private function replaceDataTags($tag, $cacheId) { $blockOld = $this->page->getBlock($tag); $block = ''; $tags = PHPEcommerceFrameworkRegistry::getObject('db')->dataFromCache($cacheId); foreach ($tags as $key => $tagsdata) { $blockNew = $blockOld; foreach ($tagsdata as $taga => $data) { $blockNew = str_replace("{" . $taga . "}", $data, $blockNew); } $block .= $blockNew; } $pageContent = $this->page->getContent(); $newContent = str_replace('<!-- START ' . $tag . ' -->' . $blockOld . '<!-- END ' . $tag . ' -->', $block, $pageContent); $this->page->setContent($newContent); }
/** * Replace content on the page with data from the cache * @param String $tag the tag defining the area of content * @param int $cacheId the datas ID in the data cache * @return void */ private function replaceDataTags($tag, $cacheId) { $block = $this->page->getBlock($tag); $blockOld = $block; while ($tags = PHPEcommerceFrameworkRegistry::getObject('db')->dataFromCache($cacheId)) { foreach ($tags as $tag => $data) { $blockNew = $blockOld; $blockNew = str_replace("{" . $tag . "}", $data, $blockNew); } $block .= $blockNew; } $pageContent = $this->page->getContent(); $newContent = str_replace($blockOld, $block, $pageContent); $this->page->setContent($newContent); }