diff options
author | Kevin Chabowski <kevin@kch42.de> | 2012-01-05 23:47:31 +0100 |
---|---|---|
committer | Kevin Chabowski <kevin@kch42.de> | 2012-01-05 23:47:31 +0100 |
commit | f8a7871546fcddb745ddfa708f61b6774c913f34 (patch) | |
tree | 3f52a64ce01bae9c6bd8f945cdc4e974029eb442 | |
parent | a3be4bd82d36576bbcdedf752ccbb9f35320210a (diff) | |
download | r7r-repo-f8a7871546fcddb745ddfa708f61b6774c913f34.tar.gz r7r-repo-f8a7871546fcddb745ddfa708f61b6774c913f34.tar.bz2 r7r-repo-f8a7871546fcddb745ddfa708f61b6774c913f34.zip |
Added author property to Package class.
-rw-r--r-- | r7r_repo/main.php | 2 | ||||
-rw-r--r-- | r7r_repo/models.php | 17 | ||||
-rw-r--r-- | r7r_repo/templates/src/home.html | 4 | ||||
-rw-r--r-- | r7r_repo/templates/src/master.html | 4 |
4 files changed, 17 insertions, 10 deletions
diff --git a/r7r_repo/main.php b/r7r_repo/main.php index d28cb44..6c097a8 100644 --- a/r7r_repo/main.php +++ b/r7r_repo/main.php @@ -15,6 +15,7 @@ if(!SKIP_TABLE_CREATION) $db_structure = "CREATE TABLE IF NOT EXISTS `PREFIX_packages` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` text COLLATE utf8_unicode_ci NOT NULL, + `author` text COLLATE utf8_unicode_ci NOT NULL, `lastversion` int(11) NOT NULL, `user` int(11) NOT NULL, `description` text COLLATE utf8_unicode_ci NOT NULL, @@ -121,6 +122,7 @@ $url_handlers = array( $ste->vars["latest_pkgs"] = array_map(function($pkg) { return array( "name" => $pkg->get_name(), "version" => $pkg->txtversion, + "author" => $pkg->author, "description" => $pkg->description, "last_update" => $pkg->lastversion ); }, $latest); diff --git a/r7r_repo/models.php b/r7r_repo/models.php index 1eb7caf..44f40bf 100644 --- a/r7r_repo/models.php +++ b/r7r_repo/models.php @@ -252,6 +252,7 @@ class Package extends BySQLRowEnabled $this->id = $sqlrow["id"]; $this->name = $sqlrow["name"]; $this->user = User::by_id($sqlrow["user"]); + $this->author = $sqlrow["author"]; $this->lastversion = $sqlrow["lastversion"]; $this->description = $sqlrow["description"]; $this->lastupdate = $sqlrow["lastupdate"]; @@ -272,12 +273,13 @@ class Package extends BySQLRowEnabled $obj = new self; $obj->name = $name; $obj->user = $user; + $obj->author = ""; $obj->lastupdate = time(); $obj->lastversion = 0; $obj->txtversion = ""; $obj->description = ""; - qdb("INSERT INTO `PREFIX_packages` (`name`, `user`, `lastupdate`, `lastversion`, `txtversion`, description`, `description`) VALUES ('%s', %d, UNIX_TIMESTAMP(), 0, '', '')", $name, $user->get_id()); + qdb("INSERT INTO `PREFIX_packages` (`name`, `user`, `author`, `lastupdate`, `lastversion`, `txtversion`, description`, `description`) VALUES ('%s', %d, '', UNIX_TIMESTAMP(), 0, '', '')", $name, $user->get_id()); $obj->id = mysql_insert_id(); mkdir(dirname(__FILE__) . "/../packages/" . $this->name); @@ -288,7 +290,7 @@ class Package extends BySQLRowEnabled public static function by_id($id) { - $result = qdb("SELECT `id`, `name`, `user`, `lastversion`, `description`, `lastupdate`, `txtversion` FROM `PREFIX_packages` WHERE `id` = %d", $id); + $result = qdb("SELECT `id`, `name`, `author`, `user`, `lastversion`, `description`, `lastupdate`, `txtversion` FROM `PREFIX_packages` WHERE `id` = %d", $id); $sqlrow = mysql_fetch_assoc($result); if($sqlrow === False) throw new DoesNotExistError(); @@ -297,7 +299,7 @@ class Package extends BySQLRowEnabled public static function by_name($name) { - $result = qdb("SELECT `id`, `name`, `user`, `lastversion`, `description`, `lastupdate`, `txtversion` FROM `PREFIX_packages` WHERE `name` = '%s'", $name); + $result = qdb("SELECT `id`, `name`, `author`, `user`, `lastversion`, `description`, `lastupdate`, `txtversion` FROM `PREFIX_packages` WHERE `name` = '%s'", $name); $sqlrow = mysql_fetch_assoc($result); if($sqlrow === False) throw new DoesNotExistError(); @@ -307,7 +309,7 @@ class Package extends BySQLRowEnabled public static function update_lists() { $packagelist = array(); - $result = qdb("SELECT `id`, `name`, `user`, `lastversion`, `description`, `lastupdate`, `txtversion` FROM `PREFIX_packages` WHERE 1"); + $result = qdb("SELECT `id`, `name`, `author`, `user`, `lastversion`, `description`, `lastupdate`, `txtversion` FROM `PREFIX_packages` WHERE 1"); while($sqlrow = mysql_fetch_assoc($result)) $packagelist[] = array($sqlrow["name"], $sqlrow["lastversion"], $sqlrow["description"]); file_put_contents(dirname(__FILE__) . "/../packagelist", serialize($packagelist)); @@ -316,7 +318,7 @@ class Package extends BySQLRowEnabled public static function all() { $rv = array(); - $result = qdb("SELECT `id`, `name`, `user`, `lastversion`, `description`, `lastupdate`, `txtversion` FROM `PREFIX_packages` WHERE 1"); + $result = qdb("SELECT `id`, `name`, `author`, `user`, `lastversion`, `description`, `lastupdate`, `txtversion` FROM `PREFIX_packages` WHERE 1"); while($sqlrow = mysql_fetch_assoc($result)) $rv[] = self::by_sqlrow($sqlrow); return $rv; @@ -325,7 +327,7 @@ class Package extends BySQLRowEnabled public static function latest() { $rv = array(); - $result = qdb("SELECT `id`, `name`, `user`, `lastversion`, `description`, `lastupdate`, `txtversion` FROM `PREFIX_packages` WHERE 1 ORDER BY `lastupdate` DESC LIMIT 0,15"); + $result = qdb("SELECT `id`, `name`, `author`, `user`, `lastversion`, `description`, `lastupdate`, `txtversion` FROM `PREFIX_packages` WHERE 1 ORDER BY `lastupdate` DESC LIMIT 0,15"); while($sqlrow = mysql_fetch_assoc($result)) $rv[] = self::by_sqlrow($sqlrow); return $rv; @@ -334,7 +336,7 @@ class Package extends BySQLRowEnabled public static function search($search) { $rv = array(); - $result = qdb("SELECT `id`, `name`, `user`, `lastversion`, `description`, `lastupdate`, `txtversion` FROM `PREFIX_packages` WHERE `name` LIKE '%%%s%%' OR `description` LIKE '%%%s%%'", $search, $search); + $result = qdb("SELECT `id`, `name`, `author`, `user`, `lastversion`, `description`, `lastupdate`, `txtversion` FROM `PREFIX_packages` WHERE `name` LIKE '%%%s%%' OR `description` LIKE '%%%s%%'", $search, $search); while($sqlrow = mysql_fetch_assoc($result)) $rv[] = self::by_sqlrow($sqlrow); return $rv; @@ -358,6 +360,7 @@ class Package extends BySQLRowEnabled $this->lastversion = $pkg->versioncount; $this->txtversion = $pkg->versiontext; $this->description = $pkg->short_description; + $this->author = $pkg->author; $this->lastupdate = time(); $this->save(); diff --git a/r7r_repo/templates/src/home.html b/r7r_repo/templates/src/home.html index 26711d1..4206fc2 100644 --- a/r7r_repo/templates/src/home.html +++ b/r7r_repo/templates/src/home.html @@ -10,6 +10,7 @@ <th>Package Name</th> <th>Version</th> <th>Description</th> + <th>Author</th> <th>Last update</th> </tr> </thead> @@ -23,13 +24,14 @@ <td><a href="$rel_path_to_root/p/<ste:escape>$pkg[name]</ste:escape>"><ste:escape>$pkg[name]</ste:escape></a></td> <td><ste:escape>$pkg[version]</ste:escape></td> <td><ste:escape>$pkg[description]</ste:escape></td> + <td><ste:escape>$pkg[author]</ste:escape></td> <td><ste:date format="%d. %h. %Y, %H:%M:%S">$pkg[last_update]</ste:date></td> </tr> </ste:foreach> </ste:then> <ste:else> <tr> - <td style="text-align: center; font-style: italic;" colspan="4">No Packages available.</td> + <td style="text-align: center; font-style: italic;" colspan="5">No Packages available.</td> </tr> </ste:else> </ste:if> diff --git a/r7r_repo/templates/src/master.html b/r7r_repo/templates/src/master.html index 9e9b8df..78f8e0b 100644 --- a/r7r_repo/templates/src/master.html +++ b/r7r_repo/templates/src/master.html @@ -34,7 +34,7 @@ ?{$repo[public]|<ste:menu_elem name="upload" path="/upload">Upload Package</ste:menu_elem>|} </ste:else> </ste:if> - <ste:menu_elem name="my_plugins" path="/my_plugins">My Plugins</ste:menu_elem> + <ste:menu_elem name="my_packages" path="/my_packages">My Plugins</ste:menu_elem> <ste:menu_elem name="account" path="/account">My Account</ste:menu_elem> <ste:menu_elem name="logout" path="/logout">Logout</ste:menu_elem> </ste:then> @@ -45,6 +45,7 @@ </ul> <div id="contentwrapper"> <div id="metabar"> + <ste:block name="additional_metabar_modules" /> <div class="metabar_module"> <h2>Repository Base URL</h2> <input type="text" readonly="readonly" value="<ste:escape>$repo[baseurl]</ste:escape>" /> @@ -79,7 +80,6 @@ </ste:else> </ste:if> </div> - <ste:block name="additional_metabar_modules" /> </div> <div id="content"> <ste:block name="content" /> |