fix unused variables

This commit is contained in:
Robin Appelman 2012-07-20 17:51:50 +02:00
parent 0e111e1a17
commit 48306a3c4f
16 changed files with 28 additions and 47 deletions

View File

@ -27,7 +27,6 @@
* upgrading and removing apps. * upgrading and removing apps.
*/ */
class OC_App{ class OC_App{
static private $init = false;
static private $activeapp = ''; static private $activeapp = '';
static private $navigation = array(); static private $navigation = array();
static private $settingsForms = array(); static private $settingsForms = array();

View File

@ -33,8 +33,6 @@ class OC_DB {
static private $MDB2=false; static private $MDB2=false;
static private $PDO=false; static private $PDO=false;
static private $schema=false; static private $schema=false;
static private $affected=0;
static private $result=false;
static private $inTransaction=false; static private $inTransaction=false;
static private $prefix=null; static private $prefix=null;
static private $type=null; static private $type=null;
@ -222,7 +220,7 @@ class OC_DB {
echo( '<b>can not connect to database, using '.$type.'. ('.self::$MDB2->getUserInfo().')</center>'); echo( '<b>can not connect to database, using '.$type.'. ('.self::$MDB2->getUserInfo().')</center>');
OC_Log::write('core',self::$MDB2->getUserInfo(),OC_Log::FATAL); OC_Log::write('core',self::$MDB2->getUserInfo(),OC_Log::FATAL);
OC_Log::write('core',self::$MDB2->getMessage(),OC_Log::FATAL); OC_Log::write('core',self::$MDB2->getMessage(),OC_Log::FATAL);
die( $error ); die();
} }
// We always, really always want associative arrays // We always, really always want associative arrays
@ -519,8 +517,9 @@ class OC_DB {
// Delete our temporary file // Delete our temporary file
unlink( $file2 ); unlink( $file2 );
foreach($definition['tables'] as $name=>$table){ $tables=array_keys($definition['tables']);
self::dropTable($name); foreach($tables as $table){
self::dropTable($table);
} }
} }

View File

@ -24,7 +24,7 @@
* Provde a common interface to all different storage options * Provde a common interface to all different storage options
*/ */
abstract class OC_Filestorage{ abstract class OC_Filestorage{
public function __construct($parameters){} abstract public function __construct($parameters);
abstract public function mkdir($path); abstract public function mkdir($path);
abstract public function rmdir($path); abstract public function rmdir($path);
abstract public function opendir($path); abstract public function opendir($path);

View File

@ -46,9 +46,10 @@
class OC_Filesystem{ class OC_Filesystem{
static private $storages=array(); static private $storages=array();
static private $mounts=array(); static private $mounts=array();
static private $storageTypes=array();
public static $loaded=false; public static $loaded=false;
private $fakeRoot=''; /**
* @var OC_Filestorage $defaultInstance
*/
static private $defaultInstance; static private $defaultInstance;
@ -155,7 +156,8 @@ class OC_Filesystem{
} }
$path=str_replace('//', '/',$path); $path=str_replace('//', '/',$path);
$foundMountPoint=''; $foundMountPoint='';
foreach(OC_Filesystem::$mounts as $mountpoint=>$storage){ $mountPoints=array_keys(OC_Filesystem::$mounts);
foreach($mountPoints as $mountpoint){
if($mountpoint==$path){ if($mountpoint==$path){
return $mountpoint; return $mountpoint;
} }
@ -260,10 +262,7 @@ class OC_Filesystem{
* tear down the filesystem, removing all storage providers * tear down the filesystem, removing all storage providers
*/ */
static public function tearDown(){ static public function tearDown(){
foreach(self::$storages as $mountpoint=>$storage){ self::$storages=array();
unset(self::$storages[$mountpoint]);
}
$fakeRoot='';
} }
/** /**
@ -287,7 +286,7 @@ class OC_Filesystem{
* @return bool * @return bool
*/ */
static public function chroot($fakeRoot){ static public function chroot($fakeRoot){
return self::$defaultInstance->chroot($path); return self::$defaultInstance->chroot($fakeRoot);
} }
/** /**
@ -485,7 +484,7 @@ class OC_Filesystem{
* @return bool * @return bool
*/ */
static public function hasUpdated($path,$time){ static public function hasUpdated($path,$time){
return self::$defaultInstance->hasUpdated($path); return self::$defaultInstance->hasUpdated($path,$time);
} }
} }

View File

@ -393,7 +393,7 @@ class OC_FilesystemView {
return $this->basicOperation('getMimeType',$path); return $this->basicOperation('getMimeType',$path);
} }
public function hash($type,$path){ public function hash($type,$path){
return $this->basicOperation('hash',$path,array('read')); return $this->basicOperation('hash',$path,array('read'),$type);
} }
public function free_space($path='/'){ public function free_space($path='/'){

View File

@ -676,10 +676,10 @@ class OC_Helper {
*/ */
public static function mb_str_replace($search, $replace, $subject, $encoding = 'UTF-8', &$count = null) { public static function mb_str_replace($search, $replace, $subject, $encoding = 'UTF-8', &$count = null) {
$offset = -1; $offset = -1;
$length = mb_strlen($search, 'UTF-8'); $length = mb_strlen($search, $encoding);
while(($i = mb_strrpos($subject, $search, $offset, 'UTF-8'))) { while(($i = mb_strrpos($subject, $search, $offset, $encoding))) {
$subject = OC_Helper::mb_substr_replace($subject, $replace, $i, $length); $subject = OC_Helper::mb_substr_replace($subject, $replace, $i, $length);
$offset = $i - mb_strlen($subject, 'UTF-8') - 1; $offset = $i - mb_strlen($subject, $encoding) - 1;
$count++; $count++;
} }
return $subject; return $subject;

View File

@ -24,8 +24,8 @@
//From user comments at http://dk2.php.net/manual/en/function.exif-imagetype.php //From user comments at http://dk2.php.net/manual/en/function.exif-imagetype.php
if ( ! function_exists( 'exif_imagetype' ) ) { if ( ! function_exists( 'exif_imagetype' ) ) {
function exif_imagetype ( $filename ) { function exif_imagetype ( $filename ) {
if ( ( list($width, $height, $type, $attr) = getimagesize( $filename ) ) !== false ) { if ( ( $info = getimagesize( $filename ) ) !== false ) {
return $type; return $info[2];
} }
return false; return false;
} }
@ -364,7 +364,7 @@ class OC_Image {
public function load($imageref) { public function load($imageref) {
if(is_resource($imageref)) { if(is_resource($imageref)) {
if(get_resource_type($imageref) == 'gd') { if(get_resource_type($imageref) == 'gd') {
$this->resource = $res; $this->resource = $imageref;
return $this->resource; return $this->resource;
} elseif(in_array(get_resource_type($imageref), array('file','stream'))) { } elseif(in_array(get_resource_type($imageref), array('file','stream'))) {
return $this->loadFromFileHandle($imageref); return $this->loadFromFileHandle($imageref);
@ -650,9 +650,6 @@ class OC_Image {
OC_Log::write('core',__METHOD__.'(): No image loaded', OC_Log::ERROR); OC_Log::write('core',__METHOD__.'(): No image loaded', OC_Log::ERROR);
return false; return false;
} }
$width_orig=imageSX($this->resource);
$height_orig=imageSY($this->resource);
//OC_Log::write('core',__METHOD__.'(): Original size: '.$width_orig.'x'.$height_orig, OC_Log::DEBUG);
$process = imagecreatetruecolor($w, $h); $process = imagecreatetruecolor($w, $h);
if ($process == false) { if ($process == false) {
OC_Log::write('core',__METHOD__.'(): Error creating true color image',OC_Log::ERROR); OC_Log::write('core',__METHOD__.'(): Error creating true color image',OC_Log::ERROR);

View File

@ -91,7 +91,7 @@ class OC_Migrate{
if( self::$exporttype == 'user' ){ if( self::$exporttype == 'user' ){
// Check user exists // Check user exists
if( !is_null($uid) ){ if( !is_null($uid) ){
$db = new OC_User_Database; $db = new OC_User_Database;
if( !$db->userExists( $uid ) ){ if( !$db->userExists( $uid ) ){
OC_Log::write('migration', 'User: '.$uid.' is not in the database and so cannot be exported.', OC_Log::ERROR); OC_Log::write('migration', 'User: '.$uid.' is not in the database and so cannot be exported.', OC_Log::ERROR);
return json_encode( array( 'success' => false ) ); return json_encode( array( 'success' => false ) );

View File

@ -88,7 +88,6 @@ class OC_OCS {
$method='get'; $method='get';
}elseif($_SERVER['REQUEST_METHOD'] == 'PUT') { }elseif($_SERVER['REQUEST_METHOD'] == 'PUT') {
$method='put'; $method='put';
parse_str(file_get_contents("php://input"),$put_vars);
}elseif($_SERVER['REQUEST_METHOD'] == 'POST') { }elseif($_SERVER['REQUEST_METHOD'] == 'POST') {
$method='post'; $method='post';
}else{ }else{
@ -356,9 +355,6 @@ class OC_OCS {
* @return string xml/json * @return string xml/json
*/ */
private static function apiConfig($format) { private static function apiConfig($format) {
$user=OC_OCS::checkpassword(false);
$url=substr(OCP\Util::getServerHost().$_SERVER['SCRIPT_NAME'],0,-11).'';
$xml['version']='1.5'; $xml['version']='1.5';
$xml['website']='ownCloud'; $xml['website']='ownCloud';
$xml['host']=OCP\Util::getServerHost(); $xml['host']=OCP\Util::getServerHost();
@ -416,7 +412,7 @@ class OC_OCS {
*/ */
private static function activityPut($format,$message) { private static function activityPut($format,$message) {
// not implemented in ownCloud // not implemented in ownCloud
$user=OC_OCS::checkpassword(); OC_OCS::checkpassword();
echo(OC_OCS::generatexml($format,'ok',100,'')); echo(OC_OCS::generatexml($format,'ok',100,''));
} }

View File

@ -71,7 +71,7 @@ class OC_OCSClient{
$tmp=$data->data; $tmp=$data->data;
$cats=array(); $cats=array();
foreach($tmp->category as $key=>$value) { foreach($tmp->category as $value) {
$id= (int) $value->id; $id= (int) $value->id;
$name= (string) $value->name; $name= (string) $value->name;

View File

@ -165,7 +165,7 @@ class OC_Preferences{
public static function deleteKey( $user, $app, $key ){ public static function deleteKey( $user, $app, $key ){
// No need for more comments // No need for more comments
$query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE userid = ? AND appid = ? AND configkey = ?' ); $query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE userid = ? AND appid = ? AND configkey = ?' );
$result = $query->execute( array( $user, $app, $key )); $query->execute( array( $user, $app, $key ));
return true; return true;
} }
@ -181,7 +181,7 @@ class OC_Preferences{
public static function deleteApp( $user, $app ){ public static function deleteApp( $user, $app ){
// No need for more comments // No need for more comments
$query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE userid = ? AND appid = ?' ); $query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE userid = ? AND appid = ?' );
$result = $query->execute( array( $user, $app )); $query->execute( array( $user, $app ));
return true; return true;
} }
@ -196,7 +196,7 @@ class OC_Preferences{
public static function deleteUser( $user ){ public static function deleteUser( $user ){
// No need for more comments // No need for more comments
$query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE userid = ?' ); $query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE userid = ?' );
$result = $query->execute( array( $user )); $query->execute( array( $user ));
return true; return true;
} }
@ -211,7 +211,7 @@ class OC_Preferences{
public static function deleteAppFromAllUsers( $app ){ public static function deleteAppFromAllUsers( $app ){
// No need for more comments // No need for more comments
$query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE appid = ?' ); $query = OC_DB::prepare( 'DELETE FROM *PREFIX*preferences WHERE appid = ?' );
$result = $query->execute( array( $app )); $query->execute( array( $app ));
return true; return true;
} }

View File

@ -102,7 +102,6 @@ class OC_Setup {
} }
else { else {
$oldUser=OC_Config::getValue('dbuser', false); $oldUser=OC_Config::getValue('dbuser', false);
$oldPassword=OC_Config::getValue('dbpassword', false);
$query="SELECT user FROM mysql.user WHERE user='$dbuser'"; //this should be enough to check for admin rights in mysql $query="SELECT user FROM mysql.user WHERE user='$dbuser'"; //this should be enough to check for admin rights in mysql
if(mysql_query($query, $connection)) { if(mysql_query($query, $connection)) {

View File

@ -1,6 +1,4 @@
<?php <?php
global $FAKEDIRS;
$FAKEDIRS=array();
class OC_FakeDirStream{ class OC_FakeDirStream{
public static $dirs=array(); public static $dirs=array();
@ -8,8 +6,6 @@ class OC_FakeDirStream{
private $index; private $index;
public function dir_opendir($path,$options){ public function dir_opendir($path,$options){
global $FAKEDIRS;
$url=parse_url($path);
$this->name=substr($path,strlen('fakedir://')); $this->name=substr($path,strlen('fakedir://'));
$this->index=0; $this->index=0;
if(!isset(self::$dirs[$this->name])){ if(!isset(self::$dirs[$this->name])){
@ -161,7 +157,6 @@ class OC_StaticStreamWrapper {
public function stream_write($data) { public function stream_write($data) {
if (!$this->writable) return 0; if (!$this->writable) return 0;
$size = strlen($data); $size = strlen($data);
$len = strlen(self::$data[$this->path]);
if ($this->stream_eof()) { if ($this->stream_eof()) {
self::$data[$this->path] .= $data; self::$data[$this->path] .= $data;
} else { } else {

View File

@ -82,7 +82,6 @@ function relative_modified_date($timestamp) {
$diffhours = round($diffminutes/60); $diffhours = round($diffminutes/60);
$diffdays = round($diffhours/24); $diffdays = round($diffhours/24);
$diffmonths = round($diffdays/31); $diffmonths = round($diffdays/31);
$diffyears = round($diffdays/365);
if($timediff < 60) { return $l->t('seconds ago'); } if($timediff < 60) { return $l->t('seconds ago'); }
else if($timediff < 120) { return $l->t('1 minute ago'); } else if($timediff < 120) { return $l->t('1 minute ago'); }

View File

@ -123,7 +123,7 @@ class OC_TemplateLayout extends OC_Template {
elseif(self::appendIfExist($files, $apps_dir['path'], $apps_dir['url'], "$style.css")) { $append =true; break; } elseif(self::appendIfExist($files, $apps_dir['path'], $apps_dir['url'], "$style.css")) { $append =true; break; }
} }
if(! $append) { if(! $append) {
echo('css file not found: style:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT); echo('css file not found: style:'.$style.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
die(); die();
} }
} }

View File

@ -189,8 +189,6 @@ class OC_Util {
if(!(is_callable('sqlite_open') or class_exists('SQLite3')) and !is_callable('mysql_connect') and !is_callable('pg_connect')){ if(!(is_callable('sqlite_open') or class_exists('SQLite3')) and !is_callable('mysql_connect') and !is_callable('pg_connect')){
$errors[]=array('error'=>'No database drivers (sqlite, mysql, or postgresql) installed.<br/>','hint'=>'');//TODO: sane hint $errors[]=array('error'=>'No database drivers (sqlite, mysql, or postgresql) installed.<br/>','hint'=>'');//TODO: sane hint
} }
$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
$CONFIG_DBNAME = OC_Config::getValue( "dbname", "owncloud" );
//common hint for all file permissons error messages //common hint for all file permissons error messages
$permissionsHint="Permissions can usually be fixed by giving the webserver write access to the ownCloud directory"; $permissionsHint="Permissions can usually be fixed by giving the webserver write access to the ownCloud directory";