Skip to content

Commit

Permalink
Replaced all tabs with spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Lewis authored and lewiscot committed Apr 11, 2012
1 parent f4b25f7 commit 25dd3b3
Show file tree
Hide file tree
Showing 77 changed files with 15,574 additions and 15,572 deletions.
34 changes: 17 additions & 17 deletions custom/config/configuration.php
Expand Up @@ -12,27 +12,27 @@
if ($type == "mysql") {

# ###################################################################################
# MYSQL DB SETTINGS
# ###################################################################################
# MYSQL DB SETTINGS
# ###################################################################################

sb_conf('DB_TYPE', 'mysql');
sb_conf('DB_NAME', 'sbc');
sb_conf('DB_USER', 'root');
sb_conf('DB_PASS', '');
sb_conf('DB_HOST', 'localhost');
sb_conf('DB_PORT', '3306');
sb_conf('DB_TYPE', 'mysql');
sb_conf('DB_NAME', 'sbc');
sb_conf('DB_USER', 'root');
sb_conf('DB_PASS', '');
sb_conf('DB_HOST', 'localhost');
sb_conf('DB_PORT', '3306');

}
else {

# ###################################################################################
# SQLITE DB SETTINGS
# ###################################################################################
sb_conf('DB_TYPE', 'sqlite');
sb_conf('DB_HOST', _SBC_APP_ . 'data/data.sqlite');
sb_conf('DB_NAME', 'sbc.sqlite');
sb_conf('DB_USER', 'root');
sb_conf('DB_PASS', 'password');
# ###################################################################################
# SQLITE DB SETTINGS
# ###################################################################################
sb_conf('DB_TYPE', 'sqlite');
sb_conf('DB_HOST', _SBC_APP_ . 'data/data.sqlite');
sb_conf('DB_NAME', 'sbc.sqlite');
sb_conf('DB_USER', 'root');
sb_conf('DB_PASS', 'password');

}
34 changes: 17 additions & 17 deletions custom/daos/AdminaclDAO.php
Expand Up @@ -32,23 +32,23 @@ function getItem($id) {
return (new ACO($Statement->fetch(PDO::FETCH_ASSOC)));
}

function index() {
$objects = array();
$Statement = $this->query("SELECT * FROM {$this->getBeanClass()}");
if ($result = $Statement->fetchAll(PDO::FETCH_ASSOC)) {
$count = count($result);
for ($i=0; $i<$count; $i++) {
$objects[$i] = new ACO(array(
'id' => Filter::get($result[$i], 'id'),
'name' => Filter::get($result[$i], 'name'),
'users' => Filter::get($result[$i], 'users'),
'groups' => Filter::get($result[$i], 'groups'),
'acl' => Filter::get($result[$i], 'acl'),
'objtype' => 'adminacl',
'type' => 'adminacl'
));
}
}
function index() {
$objects = array();
$Statement = $this->query("SELECT * FROM {$this->getBeanClass()}");
if ($result = $Statement->fetchAll(PDO::FETCH_ASSOC)) {
$count = count($result);
for ($i=0; $i<$count; $i++) {
$objects[$i] = new ACO(array(
'id' => Filter::get($result[$i], 'id'),
'name' => Filter::get($result[$i], 'name'),
'users' => Filter::get($result[$i], 'users'),
'groups' => Filter::get($result[$i], 'groups'),
'acl' => Filter::get($result[$i], 'acl'),
'objtype' => 'adminacl',
'type' => 'adminacl'
));
}
}
return $objects;
}
}
74 changes: 37 additions & 37 deletions custom/daos/CacheDAO.php
Expand Up @@ -42,8 +42,8 @@ function __construct() {
);
}
catch (PDOException $e) {
die($e->getMessage());
}
die($e->getMessage());
}
}
}

Expand Down Expand Up @@ -81,20 +81,20 @@ function saveCache($content) {
$id = $this->itemName;
$time = time();
if (! $this->getItem($id)) {
$content = base64_encode($content);
try {
$this->query(
"INSERT INTO Cache (id, content, time) "
. " VALUES ('{$id}', '{$content}', '{$time}');"
);
}
catch (PDOException $e) {
die($e->getMessage());
}
}
else {
$result = $this->touchCache();
}
$content = base64_encode($content);
try {
$this->query(
"INSERT INTO Cache (id, content, time) "
. " VALUES ('{$id}', '{$content}', '{$time}');"
);
}
catch (PDOException $e) {
die($e->getMessage());
}
}
else {
$result = $this->touchCache();
}
return $result;
}

Expand All @@ -105,13 +105,13 @@ function saveCache($content) {
function touchCache() {
$result = false;
try {
$result = $this->query(
"UPDATE Cache SET time = '{$time}' WHERE id = '{$id}';"
);
}
catch (PDOException $e) {
die($e->getMessage());
}
$result = $this->query(
"UPDATE Cache SET time = '{$time}' WHERE id = '{$id}';"
);
}
catch (PDOException $e) {
die($e->getMessage());
}
return $result;
}

Expand All @@ -122,13 +122,13 @@ function touchCache() {
function clearItem($id) {
$result = false;
try {
$result = $this->query(
"DELETE FROM Cache WHERE id = '{$id}'"
);
}
catch (PDOException $e) {
die($e->getMessage());
}
$result = $this->query(
"DELETE FROM Cache WHERE id = '{$id}'"
);
}
catch (PDOException $e) {
die($e->getMessage());
}
return $result;
}

Expand All @@ -139,13 +139,13 @@ function clearItem($id) {
function clearAll() {
$result = false;
try {
$result = $this->query(
"DELETE FROM Cache"
);
}
catch (PDOException $e) {
die($e->getMessage());
}
$result = $this->query(
"DELETE FROM Cache"
);
}
catch (PDOException $e) {
die($e->getMessage());
}
return $result;
}
}
28 changes: 14 additions & 14 deletions custom/daos/ConfigurationDAO.php
Expand Up @@ -29,20 +29,20 @@ function __construct() {
function getConfigBean() {
$Bean = new Configuration();
if ($Statement = $this->query("SELECT * FROM {$this->getBeanClass()}")) {
if ($result = $Statement->fetchAll(PDO::FETCH_ASSOC)) {
foreach ($result as $field) {
$key = Filter::get($field, 'name');
$key = ucwords(strtolower($key));
$method = "set{$key}";
if (is_callable(array($Bean, $method))) {
$Bean->$method(Filter::get($field, 'value'));
}
}
$Bean->setName("configuration");
$Bean->setId(1);
$Bean->setType("configuration");
$Bean->setObjtype("configuration");
}
if ($result = $Statement->fetchAll(PDO::FETCH_ASSOC)) {
foreach ($result as $field) {
$key = Filter::get($field, 'name');
$key = ucwords(strtolower($key));
$method = "set{$key}";
if (is_callable(array($Bean, $method))) {
$Bean->$method(Filter::get($field, 'value'));
}
}
$Bean->setName("configuration");
$Bean->setId(1);
$Bean->setType("configuration");
$Bean->setObjtype("configuration");
}
}
return $Bean;
}
Expand Down
82 changes: 41 additions & 41 deletions custom/daos/PluginDAO.php
Expand Up @@ -121,12 +121,12 @@ function buildUpdateQuery($fields, $Bean) {
function insert($Bean) {
$result = false;
if (! $this->getItem($Bean->getId())) {
if ($info = $this->getColumns()) {
$result = $this->query(
$this->buildInsertQuery($info, $Bean)
);
}
}
if ($info = $this->getColumns()) {
$result = $this->query(
$this->buildInsertQuery($info, $Bean)
);
}
}
return $result;
}

Expand All @@ -150,27 +150,27 @@ function reorder($id, $direction) {
if ($index == 0) return false;

$Plugin1 = null;
if (isset($plugins[$index-1])) {
$Plugin1 = $plugins[$index-1];
}
$Plugin2 = null;
if (isset($plugins[$index-2])) {
$Plugin2 = $plugins[$index-2];
}
/*
When determining the order of items, it is not important
whether or not there are actually items to move the item between.
It is sufficient to guess where items would likely be. So we guess the
most likely position of items to move between. If no items are found,
then we can determine the true 'between' spot. Otherwise, we move between
2 virtual items.
*/
if (isset($plugins[$index-1])) {
$Plugin1 = $plugins[$index-1];
}
$Plugin2 = null;
if (isset($plugins[$index-2])) {
$Plugin2 = $plugins[$index-2];
}
/*
When determining the order of items, it is not important
whether or not there are actually items to move the item between.
It is sufficient to guess where items would likely be. So we guess the
most likely position of items to move between. If no items are found,
then we can determine the true 'between' spot. Otherwise, we move between
2 virtual items.
*/
// $index1 defaults to one ordinal lower than
// the item being moved down
// the item being moved down
$index1 = $ordinal - 1;

// $index2 defaults to one position lower than $index1
Expand All @@ -185,18 +185,18 @@ function reorder($id, $direction) {
if ($index == $count-1) return false;

$Plugin1 = null;
if (isset($plugins[$index+1])) {
$Plugin1 = $plugins[$index+1];
}
$Plugin2 = null;
if (isset($plugins[$index+2])) {
$Plugin2 = $plugins[$index+2];
}
// $index1 defaults to one ordinal higher than
// the item being moved down
if (isset($plugins[$index+1])) {
$Plugin1 = $plugins[$index+1];
}
$Plugin2 = null;
if (isset($plugins[$index+2])) {
$Plugin2 = $plugins[$index+2];
}
// $index1 defaults to one ordinal higher than
// the item being moved down
$index1 = $ordinal + 1;

// $index2 defaults to one position higher than $index1
Expand All @@ -205,9 +205,9 @@ function reorder($id, $direction) {
}

if ($Plugin1 && $Plugin2) {
$index1 = $Plugin1->getOrdinal();
$index2 = $Plugin2->getOrdinal();
}
$index1 = $Plugin1->getOrdinal();
$index2 = $Plugin2->getOrdinal();
}
$Plugin->setOrdinal(($index1 + $index2)/2);
$result = $this->update($Plugin);
}
Expand Down
30 changes: 15 additions & 15 deletions custom/daos/SkinDAO.php
Expand Up @@ -32,27 +32,27 @@ function __construct() {
function setActiveSkin($id) {
$result = false;
if ($Skin = $this->getItem($id)) {
$result = $this->query(
"UPDATE {$this->getBeanClass()} SET published = 0 WHERE published <> 0"
);
if ($result) {
$result = $this->query(
"UPDATE {$this->getBeanClass()} SET published = 1 WHERE id = '{$id}'"
);
}
}
$result = $this->query(
"UPDATE {$this->getBeanClass()} SET published = 0 WHERE published <> 0"
);
if ($result) {
$result = $this->query(
"UPDATE {$this->getBeanClass()} SET published = 1 WHERE id = '{$id}'"
);
}
}
return $result;
}

function insert($Bean) {
$result = false;
if (! $this->getItem($Bean->getId())) {
if ($info = $this->getColumns()) {
$result = $this->exec(
$this->buildInsertQuery($info, $Bean)
);
}
}
if ($info = $this->getColumns()) {
$result = $this->exec(
$this->buildInsertQuery($info, $Bean)
);
}
}
return $result;
}

Expand Down

0 comments on commit 25dd3b3

Please sign in to comment.