aboutsummaryrefslogtreecommitdiff
path: root/ratatoeskr
diff options
context:
space:
mode:
Diffstat (limited to 'ratatoeskr')
-rw-r--r--ratatoeskr/setup/create_tables.php18
-rw-r--r--ratatoeskr/sys/models.php9
2 files changed, 13 insertions, 14 deletions
diff --git a/ratatoeskr/setup/create_tables.php b/ratatoeskr/setup/create_tables.php
index b024d51..aea5fcb 100644
--- a/ratatoeskr/setup/create_tables.php
+++ b/ratatoeskr/setup/create_tables.php
@@ -8,7 +8,7 @@ CREATE TABLE `PREFIX_acl` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`acl_json` text COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `PREFIX_articles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
@@ -19,13 +19,13 @@ CREATE TABLE `PREFIX_articles` (
`meta` text COLLATE utf8_unicode_ci NOT NULL,
`custom` text COLLATE utf8_unicode_ci NOT NULL,
`acl` int(11) NOT NULL,
- `article_img` int(11) NOT NULL,
+ `article_image` int(11) NOT NULL,
`status` int(11) NOT NULL,
`section` int(11) NOT NULL,
`timestamp` bigint(20) NOT NULL,
`allow_comments` int(11) NOT NULL,
PRIMARY KEY (`id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `PREFIX_article_tag_relations` (
`tag` int(11) NOT NULL,
@@ -45,12 +45,12 @@ CREATE TABLE `PREFIX_comments` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `PREFIX_groups` (
- `int` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(11) NOT NULL AUTO_INCREMENT,
`name` text COLLATE utf8_unicode_ci NOT NULL,
- PRIMARY KEY (`int`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-CREATE TABLE `PREFIX_group_memers` (
+CREATE TABLE `PREFIX_group_members` (
`user` int(11) NOT NULL,
`group` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
@@ -96,7 +96,7 @@ CREATE TABLE `PREFIX_sections` (
`template` text COLLATE utf8_unicode_ci NOT NULL,
`styles` text COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `PREFIX_settings_kvstorage` (
`key` text COLLATE utf8_unicode_ci NOT NULL,
@@ -133,7 +133,7 @@ CREATE TABLE `PREFIX_users` (
`fullname` text COLLATE utf8_unicode_ci NOT NULL,
`language` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SQL;
?>
diff --git a/ratatoeskr/sys/models.php b/ratatoeskr/sys/models.php
index 21147fb..38fd9fa 100644
--- a/ratatoeskr/sys/models.php
+++ b/ratatoeskr/sys/models.php
@@ -82,7 +82,7 @@ class User
*
* Parameters:
* $username - The username
- * $pwhash - SHA1-Hash of the password
+ * $pwhash - <PasswordHash> of the password
* $mail - E-Mail-address
* $fullname - The full name.
*
@@ -98,7 +98,7 @@ class User
catch(DoesNotExistError $e)
{
global $ratatoeskr_settings;
- qdb("INSERT INTO `PREFIX_users` (`username`, `pwhash`, `mail`, `username`, `language`) VALUES ('%s', '%s', '%s', '%s', '%s')",
+ qdb("INSERT INTO `PREFIX_users` (`username`, `pwhash`, `mail`, `fullname`, `language`) VALUES ('%s', '%s', '%s', '%s', '%s')",
$username, $pwhash, $mail, $fullname, $ratatoeskr_settings["default_language"]);
$obj = new self;
@@ -160,7 +160,7 @@ class User
*/
public static function by_name($username)
{
- $result = qdb("SELECT `id`, `username`, `pwhash`, `mail`, `fullname`, `language` FROM `PREFIX_users` WHERE `name` = '%s'", $username);
+ $result = qdb("SELECT `id`, `username`, `pwhash`, `mail`, `fullname`, `language` FROM `PREFIX_users` WHERE `username` = '%s'", $username);
$obj = new self;
$obj->populate_by_sqlresult($result);
@@ -287,7 +287,7 @@ class Group
{
try
{
- $obj = self::by_username($name);
+ $obj = self::by_name($name);
}
catch(DoesNotExistError $e)
{
@@ -302,7 +302,6 @@ class Group
throw new AlreadyExistsError("\"$name\" is already in database.");
}
- /* DANGER: $result must be valid! The calling function has to check this! */
private function populate_by_sqlresult($result)
{
$sqlrow = mysql_fetch_assoc($result);