Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Updated session and database plugs. Debug isn't enabled by default an…
Browse files Browse the repository at this point in the history
…ymore.
  • Loading branch information
VxMxPx committed May 3, 2012
1 parent 966a142 commit 00941a8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 19 deletions.
4 changes: 2 additions & 2 deletions bugless/config/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@
# Plugs settings.
'plug' => array
(
'auto_load' => array('debug'),
'auto_load' => array(),

# Which plugs do we want to use in our application.
'enabled' => array('html', 'jquery', 'form', 'database', 'session', 'validate', 'mail', 'debug'),
'enabled' => array('html', 'jquery', 'form', 'database', 'session', 'validate', 'mail'),
),

# Cookies settings.
Expand Down
26 changes: 16 additions & 10 deletions bugless/system/plugs/database/database_result.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,24 @@ public function count()
*/
public function asArray($index=false)
{
if ($index === false) {
if (!is_array($this->Fetched)) {
$this->Fetched = $this->PDOStatement->fetchAll(PDO::FETCH_ASSOC);
if (is_object($this->PDOStatement)) {
if ($index === false) {
if (!is_array($this->Fetched)) {
$this->Fetched = $this->PDOStatement->fetchAll(PDO::FETCH_ASSOC);
}
return $this->Fetched;
}
elseif ($index === true) {
return $this->PDOStatement->fetch(PDO::FETCH_ASSOC);
}
elseif (is_integer($index)) {
$Fetched = $this->asArray(false);
return isset($Fetched[$index]) ? $Fetched[$index] : false;
}
return $this->Fetched;
}
elseif ($index === true) {
return $this->PDOStatement->fetch(PDO::FETCH_ASSOC);
}
elseif (is_integer($index)) {
$Fetched = $this->asArray(false);
return isset($Fetched[$index]) ? $Fetched[$index] : false;
else {
Log::Add('PDOStatement isn\'t object, returning empty array!', 'WAR');
return array();
}
}
//-
Expand Down
10 changes: 3 additions & 7 deletions bugless/system/plugs/session/drivers/db.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,8 @@ public static function _create($Config)

foreach ($Config['defaults'] as $DefUser)
{
$User['id'] = null;
$User['uname'] = $DefUser['uname'];
$User['password'] = vString::Hash($DefUser['password'], false, true);
$User['active'] = true;

cDatabase::Create($User, $Config['db']['users_table']);
$DefUser['password'] = vString::Hash($DefUser['password'], false, true);
cDatabase::Create($DefUser, $Config['db']['users_table']);
}

return true;
Expand Down Expand Up @@ -232,7 +228,7 @@ private function userSet($user, $password=false)

if ($password) {
if ($User['password'] !== vString::Hash($password, $User['password'], true)) {
Log::Add('INF', "Invalid password entered for: `{$username}`.", __LINE__, __FILE__);
Log::Add('INF', "Invalid password entered for: `{$user}`.", __LINE__, __FILE__);
return false;
}
}
Expand Down
2 changes: 2 additions & 0 deletions bugless/system/plugs/session/session_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@
(
array(
# root@domain.tld / root
'id' => null,
'uname' => 'root@domain.tld',
'password' => 'root',
'active' => true,
),
),

Expand Down

0 comments on commit 00941a8

Please sign in to comment.