summaryrefslogtreecommitdiffstats
path: root/code/pages.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'code/pages.inc.php')
-rw-r--r--code/pages.inc.php96
1 files changed, 48 insertions, 48 deletions
diff --git a/code/pages.inc.php b/code/pages.inc.php
index e1bfd9b..d2a0009 100644
--- a/code/pages.inc.php
+++ b/code/pages.inc.php
@@ -48,15 +48,15 @@
}
function GetName($id) {
- $res = $GLOBALS['db']->Execute('SELECT name FROM pages WHERE id = ?', $id);
-
- return $res->fields[0];
+ $res = $GLOBALS['db']->Execute('SELECT name FROM pages WHERE id = ?', $id);
+
+ return $res->fields[0];
}
function GetType($id) {
- $res = $GLOBALS['db']->Execute('SELECT type FROM pages WHERE id = ?', $id);
-
- return $res->fields[0];
+ $res = $GLOBALS['db']->Execute('SELECT type FROM pages WHERE id = ?', $id);
+
+ return $res->fields[0];
}
function Exists($page, $type = null) {
@@ -75,66 +75,66 @@
}
function Add($name, $handler, $type) {
- if($this->Exists($name, $type)) return 0;
-
- $GLOBALS['db']->Execute('INSERT INTO pages (name, handler, access, data, type) VALUES (?, ?, 0, "", ?)',
- array($name, $handler, $type));
-
- return $GLOBALS['db']->Insert_ID();
+ if($this->Exists($name, $type)) return 0;
+
+ $GLOBALS['db']->Execute('INSERT INTO pages (name, handler, access, data, type) VALUES (?, ?, 0, "", ?)',
+ array($name, $handler, $type));
+
+ return $GLOBALS['db']->Insert_ID();
}
function Edit($page, $data, $type = null) {
- $string = '';
-
- foreach($data as $key => $val)
- $string .= urlencode($key) . '=' . urlencode($val) . '&';
+ $string = '';
+
+ foreach($data as $key => $val)
+ $string .= urlencode($key) . '=' . urlencode($val) . '&';
if($type) $GLOBALS['db']->Execute('UPDATE pages SET data = ? WHERE name = ? AND type = ?',
array(substr($string, 0, -1), $page, $type));
else $GLOBALS['db']->Execute('UPDATE pages SET data = ? WHERE id = ?',
- array(substr($string, 0, -1), $page));
+ array(substr($string, 0, -1), $page));
return ($GLOBALS['db']->Affected_Rows() > 0);
}
function Rename($page, $new_name, $type = null) {
- if($type) {
- if($this->Exists($new_name, $type)) return;
-
- $GLOBALS['db']->Execute('UPDATE pages SET name = ? WHERE name = ? AND type = ?', array($new_name, $page, $type));
- }
- else {
- if($this->Exists($new_name, $this->GetType($type))) return;
-
- $GLOBALS['db']->Execute('UPDATE pages SET name = ? WHERE id = ?', array($new_name, $page));
- }
-
- return ($GLOBALS['db']->Affected_Rows() > 0);
+ if($type) {
+ if($this->Exists($new_name, $type)) return;
+
+ $GLOBALS['db']->Execute('UPDATE pages SET name = ? WHERE name = ? AND type = ?', array($new_name, $page, $type));
+ }
+ else {
+ if($this->Exists($new_name, $this->GetType($type))) return;
+
+ $GLOBALS['db']->Execute('UPDATE pages SET name = ? WHERE id = ?', array($new_name, $page));
+ }
+
+ return ($GLOBALS['db']->Affected_Rows() > 0);
}
function Copy($page, $new_name, $type = null) {
- if($type) {
- if($this->Exists($new_name, $type)) return 0;
-
- $res = $GLOBALS['db']->Execute('SELECT * FROM pages WHERE name = ? AND type = ?', array($page, $type));
- }
- else {
- if($this->Exists($new_name, $this->GetType($type))) return 0;
-
- $res = $GLOBALS['db']->Execute('SELECT handler, data, type FROM pages WHERE id = ?', $page);
- }
-
- $GLOBALS['db']->Execute('INSERT INTO pages (name, handler, access, data, type) VALUES (?, ?, 0, ?, ?)',
- array($new_name, $res->fields[0], $res->fields[1], $res->fields[2]));
-
- return $GLOBALS['db']->Insert_ID();
+ if($type) {
+ if($this->Exists($new_name, $type)) return 0;
+
+ $res = $GLOBALS['db']->Execute('SELECT * FROM pages WHERE name = ? AND type = ?', array($page, $type));
+ }
+ else {
+ if($this->Exists($new_name, $this->GetType($type))) return 0;
+
+ $res = $GLOBALS['db']->Execute('SELECT handler, data, type FROM pages WHERE id = ?', $page);
+ }
+
+ $GLOBALS['db']->Execute('INSERT INTO pages (name, handler, access, data, type) VALUES (?, ?, 0, ?, ?)',
+ array($new_name, $res->fields[0], $res->fields[1], $res->fields[2]));
+
+ return $GLOBALS['db']->Insert_ID();
}
function Delete($page, $type = null) {
- if($type) $GLOBALS['db']->Execute('DELETE FROM pages WHERE name = ? AND type = ?', array($page, $type));
- else $GLOBALS['db']->Execute('DELETE FROM pages WHERE id = ?', $page);
-
- return ($GLOBALS['db']->Affected_Rows() > 0);
+ if($type) $GLOBALS['db']->Execute('DELETE FROM pages WHERE name = ? AND type = ?', array($page, $type));
+ else $GLOBALS['db']->Execute('DELETE FROM pages WHERE id = ?', $page);
+
+ return ($GLOBALS['db']->Affected_Rows() > 0);
}
}