only call error_log() if DEBUG is true

Signed-off-by: Florian Pritz <bluewind@xinu.at>
remotes/origin/stable
Florian Pritz 13 years ago
parent 9c550e8e9f
commit 8648e3c43c

@ -1365,7 +1365,7 @@ class XML_RPC_Message extends XML_RPC_Base
!preg_match('@^HTTP/[0-9\.]+ 10[0-9]([A-Za-z ]+)?[\r\n]+HTTP/[0-9\.]+ 200@', $data))
{
$errstr = substr($data, 0, strpos($data, "\n") - 1);
error_log('HTTP error, got response: ' . $errstr);
if(defined("DEBUG") && DEBUG) {error_log('HTTP error, got response: ' . $errstr);}
$r = new XML_RPC_Response(0, $XML_RPC_err['http_error'],
$XML_RPC_str['http_error'] . ' (' .
$errstr . ')');
@ -1396,7 +1396,7 @@ class XML_RPC_Message extends XML_RPC_Base
xml_error_string(xml_get_error_code($parser_resource)),
xml_get_current_line_number($parser_resource));
}
error_log($errstr);
if(defined("DEBUG") && DEBUG) {error_log($errstr);}
$r = new XML_RPC_Response(0, $XML_RPC_err['invalid_return'],
$XML_RPC_str['invalid_return']);
xml_parser_free($parser_resource);

@ -14,7 +14,7 @@ class OC_PublicLink{
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';
error_log( $entry );
if(defined("DEBUG") && DEBUG) {error_log( $entry );}
die( $entry );
}
$this->token=$token;

@ -29,9 +29,9 @@ $RUNTIME_NOSETUPFS=true;
require_once('../../../lib/base.php');
error_log($_GET['autoupdate']);
if(defined("DEBUG") && DEBUG) {error_log($_GET['autoupdate']);}
$autoUpdate=(isset($_GET['autoupdate']) and $_GET['autoupdate']=='true');
error_log((integer)$autoUpdate);
if(defined("DEBUG") && DEBUG) {error_log((integer)$autoUpdate);}
OC_Preferences::setValue(OC_User::getUser(),'media','autoupdate',(integer)$autoUpdate);

@ -195,7 +195,7 @@ class OC_MEDIA_AMPACHE{
$filter=isset($params['filter'])?$params['filter']:'';
$exact=isset($params['exact'])?($params['exact']=='true'):false;
$artists=OC_MEDIA_COLLECTION::getArtists($filter,$exact);
error_log('artists found: '.print_r($artists,true));
if(defined("DEBUG") && DEBUG) {error_log('artists found: '.print_r($artists,true));}
echo('<root>');
foreach($artists as $artist){
self::printArtist($artist);

@ -37,7 +37,7 @@ class OC_MEDIA{
*/
public static function loginListener($params){
if(isset($_POST['user']) and $_POST['password']){
error_log('postlogin');
if(defined("DEBUG") && DEBUG) {error_log('postlogin');}
$name=$_POST['user'];
$query=OC_DB::prepare("SELECT user_id from *PREFIX*media_users WHERE user_id LIKE ?");
$uid=$query->execute(array($name))->fetchAll();

@ -97,25 +97,25 @@ class OC_MEDIA_SCANNER{
$data=@self::$getID3->analyze($file);
getid3_lib::CopyTagsToComments($data);
if(!isset($data['comments'])){
error_log("error reading id3 tags in '$file'");
if(defined("DEBUG") && DEBUG) {error_log("error reading id3 tags in '$file'");}
return;
}
if(!isset($data['comments']['artist'])){
error_log("error reading artist tag in '$file'");
if(defined("DEBUG") && DEBUG) {error_log("error reading artist tag in '$file'");}
$artist='unknown';
}else{
$artist=stripslashes($data['comments']['artist'][0]);
$artist=utf8_encode($artist);
}
if(!isset($data['comments']['album'])){
error_log("error reading album tag in '$file'");
if(defined("DEBUG") && DEBUG) {error_log("error reading album tag in '$file'");}
$album='unknown';
}else{
$album=stripslashes($data['comments']['album'][0]);
$album=utf8_encode($album);
}
if(!isset($data['comments']['title'])){
error_log("error reading title tag in '$file'");
if(defined("DEBUG") && DEBUG) {error_log("error reading title tag in '$file'");}
$title='unknown';
}else{
$title=stripslashes($data['comments']['title'][0]);

@ -36,7 +36,7 @@ foreach($arguments as &$argument){
}
ob_clean();
if(isset($arguments['action'])){
error_log($arguments['action']);
if(defined("DEBUG") && DEBUG) {error_log($arguments['action']);}
switch($arguments['action']){
case 'url_to_song':
OC_MEDIA_AMPACHE::url_to_song($arguments);

@ -7,7 +7,7 @@ class OC_UnhostedWeb {
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';
error_log( $entry );
if(defined("DEBUG") && DEBUG) {error_log( $entry );}
die( $entry );
}
$ret = array();
@ -24,7 +24,7 @@ class OC_UnhostedWeb {
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';
error_log( $entry );
if(defined("DEBUG") && DEBUG) {error_log( $entry );}
die( $entry );
}
$ret = array();
@ -45,7 +45,7 @@ class OC_UnhostedWeb {
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';
error_log( $entry );
if(defined("DEBUG") && DEBUG) {error_log( $entry );}
die( $entry );
}
}
@ -56,7 +56,7 @@ class OC_UnhostedWeb {
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$result->getDebugInfo().'<br />';
error_log( $entry );
if(defined("DEBUG") && DEBUG) {error_log( $entry );}
die( $entry );
}
}

@ -26,14 +26,14 @@ OC_User::useBackend('openid');
//check for results from openid requests
if(isset($_GET['openid_mode']) and $_GET['openid_mode'] == 'id_res'){
error_log('openid retured');
if(defined("DEBUG") && DEBUG) {error_log('openid retured');}
$openid = new SimpleOpenID;
$openid->SetIdentity($_GET['openid_identity']);
$openid_validation_result = $openid->ValidateWithServer();
if ($openid_validation_result == true){ // OK HERE KEY IS VALID
error_log('auth sucessfull');
if(defined("DEBUG") && DEBUG) {error_log('auth sucessfull');}
$identity=$openid->GetIdentity();
error_log("auth as $identity");
if(defined("DEBUG") && DEBUG) {error_log("auth as $identity");}
$user=OC_USER_OPENID::findUserForIdentity($identity);
if($user){
$_SESSION['user_id']=$user;
@ -41,13 +41,13 @@ if(isset($_GET['openid_mode']) and $_GET['openid_mode'] == 'id_res'){
}
}else if($openid->IsError() == true){ // ON THE WAY, WE GOT SOME ERROR
$error = $openid->GetError();
error_log("ERROR CODE: " . $error['code']);
error_log("ERROR DESCRIPTION: " . $error['description']);
if(defined("DEBUG") && DEBUG) {error_log("ERROR CODE: " . $error['code']);}
if(defined("DEBUG") && DEBUG) {error_log("ERROR DESCRIPTION: " . $error['description']);}
}else{ // Signature Verification Failed
error_log("INVALID AUTHORIZATION");
if(defined("DEBUG") && DEBUG) {error_log("INVALID AUTHORIZATION");}
}
}else if (isset($_GET['openid_mode']) and $_GET['openid_mode'] == 'cancel'){ // User Canceled your Request
error_log("USER CANCELED REQUEST");
if(defined("DEBUG") && DEBUG) {error_log("USER CANCELED REQUEST");}
return false;
}

@ -1054,7 +1054,7 @@ function debug ($x, $m = null) {
$x .= "\n";
}
error_log($x . "\n", 3, $profile['logfile']);
if(defined("DEBUG") && DEBUG) {error_log($x . "\n", 3, $profile['logfile']);}
}
@ -1501,7 +1501,7 @@ function wrap_html ( $message ) {
</body>
</html>
';
error_log($html);
if(defined("DEBUG") && DEBUG) {error_log($html);}
echo $html;
exit(0);
}
@ -1653,8 +1653,8 @@ $profile['req_url'] = sprintf("%s://%s%s",
// $profile['req_url']=str_replace($incompleteId,$fullId,$profile['req_url']);
// }
// error_log('inc id: '.$fullId);
// error_log('req url: '.$profile['req_url']);
// if(defined("DEBUG") && DEBUG) {error_log('inc id: '.$fullId);}
// if(defined("DEBUG") && DEBUG) {error_log('req url: '.$profile['req_url']);}
// Set the default allowance for testing
if (! array_key_exists('allow_test', $profile))

@ -39,7 +39,7 @@ $RUNTIME_NOAPPS=false;
require_once '../../lib/base.php';
if(!OC_User::userExists($USERNAME)){
error_log($USERNAME.' doesn\'t exist');
if(defined("DEBUG") && DEBUG) {error_log($USERNAME.' doesn\'t exist');}
$USERNAME='';
}
$IDENTITY=OC_Helper::linkTo( "user_openid", "user.php", null, true ).'/'.$USERNAME;

@ -1,5 +1,7 @@
<?php
define("DEBUG", true);
$CONFIG = array(
"installed" => false,
"dbtype" => "sqlite",

@ -20,7 +20,7 @@ if($foldername == '') {
echo json_encode( array( "status" => "error", "data" => array( "message" => "Empty Foldername" )));
exit();
}
error_log('try to create ' . $foldername . ' in ' . $dir);
if(defined("DEBUG") && DEBUG) {error_log('try to create ' . $foldername . ' in ' . $dir);}
if(OC_Files::newFile($dir, $foldername, 'dir')) {
echo json_encode( array( "status" => "success", "data" => array()));
exit();

@ -55,7 +55,7 @@ elseif(OC_User::isLoggedIn()) {
// remember was checked after last login
elseif(isset($_COOKIE["oc_remember_login"]) && $_COOKIE["oc_remember_login"]) {
OC_App::loadApps();
error_log("Trying to login from cookie");
if(defined("DEBUG") && DEBUG) {error_log("Trying to login from cookie");}
// confirm credentials in cookie
if(OC_User::userExists($_COOKIE['oc_username']) &&
OC_Preferences::getValue($_COOKIE['oc_username'], "login", "token") == $_COOKIE['oc_token']) {
@ -72,7 +72,7 @@ elseif(isset($_POST["user"]) && isset($_POST['password'])) {
OC_App::loadApps();
if(OC_User::login($_POST["user"], $_POST["password"])) {
if(!empty($_POST["remember_login"])){
error_log("Setting remember login to cookie");
if(defined("DEBUG") && DEBUG) {error_log("Setting remember login to cookie");}
$token = md5($_POST["user"].time());
OC_Preferences::setValue($_POST['user'], 'login', 'token', $token);
OC_User::setMagicInCookie($_POST["user"], $token);

@ -92,8 +92,8 @@ class OC_DB {
if( PEAR::isError( self::$DBConnection )){
echo( '<b>can not connect to database, using '.$CONFIG_DBTYPE.'. ('.self::$DBConnection->getUserInfo().')</center>');
$error = self::$DBConnection->getMessage();
error_log( $error);
error_log( self::$DBConnection->getUserInfo());
if(defined("DEBUG") && DEBUG) {error_log( $error);}
if(defined("DEBUG") && DEBUG) {error_log( self::$DBConnection->getUserInfo());}
die( $error );
}
@ -129,7 +129,7 @@ class OC_DB {
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$query.'<br />';
error_log( $entry );
if(defined("DEBUG") && DEBUG) {error_log( $entry );}
die( $entry );
}
@ -155,7 +155,7 @@ class OC_DB {
if( PEAR::isError($result)) {
$entry = 'DB Error: "'.$result->getMessage().'"<br />';
$entry .= 'Offending command was: '.$query.'<br />';
error_log( $entry );
if(defined("DEBUG") && DEBUG) {error_log( $entry );}
die( $entry );
}

@ -195,7 +195,7 @@ class OC_Filestorage_Local extends OC_Filestorage{
}
private function delTree($dir) {
error_log('del'.$dir);
if(defined("DEBUG") && DEBUG) {error_log('del'.$dir);}
$dirRelative=$dir;
$dir=$this->datadir.$dir;
if (!file_exists($dir)) return true;

@ -286,7 +286,7 @@ class OC_Filesystem{
return self::basicOperation('file_get_contents',$path,array('read'));
}
static public function file_put_contents($path,$data){
error_log($data);
if(defined("DEBUG") && DEBUG) {error_log($data);}
return self::basicOperation('file_put_contents',$path,array('create','write'),$data);
}
static public function unlink($path){
@ -393,7 +393,7 @@ class OC_Filesystem{
}
}
static public function fromUploadedFile($tmpFile,$path){
error_log('upload');
if(defined("DEBUG") && DEBUG) {error_log('upload');}
if(OC_FileProxy::runPreProxies('fromUploadedFile',$tmpFile,$path) and self::canWrite($path) and $storage=self::getStorage($path)){
$run=true;
$exists=self::file_exists($path);
@ -403,7 +403,7 @@ class OC_Filesystem{
if($run){
OC_Hook::emit( 'OC_Filesystem', 'write', array( 'path' => $path, 'run' => &$run));
}
error_log('upload2');
if(defined("DEBUG") && DEBUG) {error_log('upload2');}
if($run){
$result=$storage->fromUploadedFile($tmpFile,self::getInternalPath($path));
if(!$exists){

@ -56,7 +56,7 @@ class OC_Installer{
*/
public static function installApp( $data = array()){
if(!isset($data['source'])){
error_log("No source specified when installing app");
if(defined("DEBUG") && DEBUG) {error_log("No source specified when installing app");}
return false;
}
@ -64,13 +64,13 @@ class OC_Installer{
if($data['source']=='http'){
$path=tempnam(sys_get_temp_dir(),'oc_installer_');
if(!isset($data['href'])){
error_log("No href specified when installing app from http");
if(defined("DEBUG") && DEBUG) {error_log("No href specified when installing app from http");}
return false;
}
copy($data['href'],$path);
}else{
if(!isset($data['path'])){
error_log("No path specified when installing app from local file");
if(defined("DEBUG") && DEBUG) {error_log("No path specified when installing app from local file");}
return false;
}
$path=$data['path'];
@ -85,7 +85,7 @@ class OC_Installer{
$zip->extractTo($extractDir);
$zip->close();
} else {
error_log("Failed to open archive when installing app");
if(defined("DEBUG") && DEBUG) {error_log("Failed to open archive when installing app");}
OC_Helper::rmdirr($extractDir);
if($data['source']=='http'){
unlink($path);
@ -95,7 +95,7 @@ class OC_Installer{
//load the info.xml file of the app
if(!is_file($extractDir.'/appinfo/info.xml')){
error_log("App does not provide an info.xml file");
if(defined("DEBUG") && DEBUG) {error_log("App does not provide an info.xml file");}
OC_Helper::rmdirr($extractDir);
if($data['source']=='http'){
unlink($path);
@ -107,7 +107,7 @@ class OC_Installer{
//check if an app with the same id is already installed
if(self::isInstalled( $info['id'] )){
error_log("App already installed");
if(defined("DEBUG") && DEBUG) {error_log("App already installed");}
OC_Helper::rmdirr($extractDir);
if($data['source']=='http'){
unlink($path);
@ -117,7 +117,7 @@ class OC_Installer{
//check if the destination directory already exists
if(is_dir($basedir)){
error_log("App's directory already exists");
if(defined("DEBUG") && DEBUG) {error_log("App's directory already exists");}
OC_Helper::rmdirr($extractDir);
if($data['source']=='http'){
unlink($path);
@ -131,7 +131,7 @@ class OC_Installer{
//copy the app to the correct place
if(!mkdir($basedir)){
error_log('Can\'t create app folder ('.$basedir.')');
if(defined("DEBUG") && DEBUG) {error_log('Can\'t create app folder ('.$basedir.')');}
OC_Helper::rmdirr($extractDir);
if($data['source']=='http'){
unlink($path);

@ -140,7 +140,7 @@ class OC_Preferences{
// Check if the key does exist
$query = OC_DB::prepare( 'SELECT configvalue FROM *PREFIX*preferences WHERE userid = ? AND appid = ? AND configkey = ?' );
$values=$query->execute(array($user,$app,$key))->fetchAll();
error_log(print_r($values,true));
if(defined("DEBUG") && DEBUG) {error_log(print_r($values,true));}
$exists=(count($values)>0);
if( !$exists ){

Loading…
Cancel
Save