Skip to content

Commit

Permalink
Query logged user only once. Also fixed wrong name of variable used i…
Browse files Browse the repository at this point in the history
…n loop.
  • Loading branch information
rainerborene committed Dec 22, 2010
1 parent daac46f commit deb4164
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions symphony/lib/core/class.symphony.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@ public function logout(){
* @see core.Cookie#expire()
*/
public function isLoggedIn(){
// Ensures that we're in the real world.. Also reduces three queries from database
if (is_null(self::$_instance)) return;

if ($this->Author) return true;

$username = self::$Database->cleanValue($this->Cookie->get('username'));
Expand Down
2 changes: 1 addition & 1 deletion symphony/lib/toolkit/class.author.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public function verifyToken($token){
*/
public function loadAuthor($id){
if(!is_object(Symphony::Database()) || !is_numeric($id)) return false;

$row = Symphony::Database()->fetchRow(0, "SELECT * FROM `tbl_authors` WHERE `id` = '$id' LIMIT 1");

if(!is_array($row) || empty($row)) return false;
Expand Down
3 changes: 2 additions & 1 deletion symphony/lib/toolkit/class.authormanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,9 @@ public static function fetchByUsername($username){

$author = new Author;

foreach($rec as $field => $val)
foreach($records as $field => $val) {
$author->set($field, $val);
}

return $author;
}
Expand Down

0 comments on commit deb4164

Please sign in to comment.