From 7035c0417ce2aef3577d9f5477e912595dcdb4a8 Mon Sep 17 00:00:00 2001 From: Jakob Sack Date: Sat, 16 Apr 2011 23:02:54 +0200 Subject: [PATCH 1/2] Get Hot New Fixes (TM) --- docs/owncloud.sql | 1 - lib/User/database.php | 2 +- lib/database.php | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/owncloud.sql b/docs/owncloud.sql index 75812ad3c7..78fa42979b 100644 --- a/docs/owncloud.sql +++ b/docs/owncloud.sql @@ -165,7 +165,6 @@ CREATE TABLE IF NOT EXISTS `properties` ( CREATE TABLE IF NOT EXISTS `users` ( `uid` varchar(64) COLLATE utf8_unicode_ci NOT NULL, - `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`uid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; diff --git a/lib/User/database.php b/lib/User/database.php index d521cc23c4..f0b68cf17d 100644 --- a/lib/User/database.php +++ b/lib/User/database.php @@ -71,7 +71,7 @@ class OC_USER_DATABASE extends OC_USER_BACKEND { * @param string $password The password of the user */ public static function login( $username, $password ){ - $query = OC_DB::prepare( "SELECT `uid`, `name` FROM `*PREFIX*users` WHERE `uid` = ? AND `password` = ?" ); + $query = OC_DB::prepare( "SELECT `uid` FROM `*PREFIX*users` WHERE `uid` = ? AND `password` = ?" ); $result = $query->execute( array( $username, sha1( $password ))); if( $result->numRows() > 0 ){ diff --git a/lib/database.php b/lib/database.php index dc4bf75649..b620009bf5 100644 --- a/lib/database.php +++ b/lib/database.php @@ -152,7 +152,7 @@ class OC_DB { // Die if we have an error (error means: bad query, not 0 results!) if( PEAR::isError($result)) { $entry = 'DB Error: "'.$result->getMessage().'"
'; - $entry .= 'Offending command was: '.$cmd.'
'; + $entry .= 'Offending command was: '.$query.'
'; error_log( $entry ); die( $entry ); } From fc63882fe2bcbacd1ec880c9f689da3a334c51cb Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Sat, 16 Apr 2011 23:07:18 +0200 Subject: [PATCH 2/2] more layout fixes --- admin/apps.php | 8 ++++--- admin/css/apps.css | 42 +++++++++++++++++++++++++++++++++ admin/templates/apps.php | 6 ++--- lib/ocsclient.php | 51 +++++++++++++++++++++++++++++++++------- 4 files changed, 92 insertions(+), 15 deletions(-) create mode 100644 admin/css/apps.css diff --git a/admin/apps.php b/admin/apps.php index b433fe0875..bff3089dc5 100644 --- a/admin/apps.php +++ b/admin/apps.php @@ -29,8 +29,7 @@ if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' } // Load the files we need -//OC_UTIL::addStyle( "", "files" ); -//OC_UTIL::addScript( "", "files" ); +OC_UTIL::addStyle( "admin", "apps" ); if(isset($_GET['id'])) $id=$_GET['id']; else $id=0; @@ -41,7 +40,9 @@ $categories=OC_OCSCLIENT::getCategories(); if($id==0) { if($cat==0){ - $apps=OC_OCSCLIENT::getApplications($categories); + $numcats=array(); + foreach($categories as $key=>$value) $numcats[]=$key; + $apps=OC_OCSCLIENT::getApplications($numcats); }else{ $apps=OC_OCSCLIENT::getApplications($cat); } @@ -59,6 +60,7 @@ if($id==0) { $app=OC_OCSCLIENT::getApplication($id); $tmpl = new OC_TEMPLATE( "admin", "app", "admin" ); + $tmpl->assign( "categories", $categories ); $tmpl->assign( "app", $app ); $tmpl->printPage(); unset($tmpl); diff --git a/admin/css/apps.css b/admin/css/apps.css new file mode 100644 index 0000000000..68bd9cf63d --- /dev/null +++ b/admin/css/apps.css @@ -0,0 +1,42 @@ +/* APPS TABLE */ + +table td.date +{ + width: 5em; + padding: 0.5em 1em; + text-align: right; +} + +.preview +{ + padding: 3px; + text-align: left; +} + +table td.date +{ + width: 11em; + color: #555555; +} + +table td.selection, table th.selection, table td.fileaction +{ + width: 2em; + text-align: center; +} + +table td.name a +{ + padding: 6px; + text-decoration: none; + color: #555555; +} + +.type +{ + padding: 6px; + text-decoration: none; + color: #888888; + font-size: 0.8em; +} + diff --git a/admin/templates/apps.php b/admin/templates/apps.php index 2f58477581..36a7cd5302 100644 --- a/admin/templates/apps.php +++ b/admin/templates/apps.php @@ -12,16 +12,14 @@ Name Modified - - "") { echo(''); } ?> - + "") { echo(''); } ?> + " title="">
'.$app['typename'].''); ?> - + diff --git a/lib/ocsclient.php b/lib/ocsclient.php index d9ce11d537..921bd5489a 100644 --- a/lib/ocsclient.php +++ b/lib/ocsclient.php @@ -37,16 +37,13 @@ class OC_OCSCLIENT{ public static function getCategories(){ $url='http://api.opendesktop.org/v1/content/categories'; - $cats=array(); $xml=file_get_contents($url); $data=simplexml_load_string($xml); $tmp=$data->data->category; + $cats=array(); for($i = 0; $i < count($tmp); $i++) { - $cat=array(); - $cat['id']=$tmp[$i]->id; - $cat['name']=$tmp[$i]->name; - $cats[]=$cat; + $cats[$i]=$tmp[$i]->name; } return $cats; } @@ -58,8 +55,12 @@ class OC_OCSCLIENT{ * This function returns a list of all the applications on the OCS server */ public static function getApplications($categories){ - $categoriesstring=implode('x',$categories); - $url='http://api.opendesktop.org/v1/content/data?categories='.$ocscategories['ids'].'&sortmode=new&page=0&pagesize=10'; + if(is_array($categories)) { + $categoriesstring=implode('x',$categories); + }else{ + $categoriesstring=$categories; + } + $url='http://api.opendesktop.org/v1/content/data?categories='.urlencode($categoriesstring).'&sortmode=new&page=0&pagesize=10'; $apps=array(); $xml=file_get_contents($url); @@ -70,7 +71,8 @@ class OC_OCSCLIENT{ $app=array(); $app['id']=$tmp[$i]->id; $app['name']=$tmp[$i]->name; - $app['type']=$tmp[$i]->type; + $app['type']=$tmp[$i]->typeid; + $app['typename']=$tmp[$i]->typename; $app['personid']=$tmp[$i]->personid; $app['detailpage']=$tmp[$i]->detailpage; $app['preview']=$tmp[$i]->smallpreviewpic1; @@ -82,5 +84,38 @@ class OC_OCSCLIENT{ return $apps; } + + /** + * @brief Get an the applications from the OCS server + * @returns array with application data + * + * This function returns an applications from the OCS server + */ + public static function getApplication($id){ + $url='http://api.opendesktop.org/v1/content/data/'.urlencode($id); + + $xml=file_get_contents($url); + $data=simplexml_load_string($xml); + + $tmp=$data->data->content; + $app=array(); + $app['id']=$tmp->id; + $app['name']=$tmp->name; + $app['type']=$tmp->typeid; + $app['typename']=$tmp->typename; + $app['personid']=$tmp->personid; + $app['detailpage']=$tmp->detailpage; + $app['preview1']=$tmp->smallpreviewpic1; + $app['preview2']=$tmp->smallpreviewpic2; + $app['preview3']=$tmp->smallpreviewpic3; + $app['changed']=strtotime($tmp->changed); + $app['description']=$tmp->description; + + return $app; + } + + + + } ?>