From: Thomas Tanghus Date: Tue, 5 Jun 2012 22:26:21 +0000 (+0200) Subject: Cleanup. X-Git-Tag: v4.5.0beta1~74^2~424^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=68670bcc66603540e39c055b8fe8c6a75055b5b0;p=nextcloud-server.git Cleanup. --- diff --git a/apps/contacts/ajax/addcontact.php b/apps/contacts/ajax/addcontact.php index ee451098f1d..af9b2bbcc0e 100644 --- a/apps/contacts/ajax/addcontact.php +++ b/apps/contacts/ajax/addcontact.php @@ -20,25 +20,10 @@ * */ -// Init owncloud - -function bailOut($msg) { - OCP\JSON::error(array('data' => array('message' => $msg))); - OCP\Util::writeLog('contacts','ajax/addcontact.php: '.$msg, OCP\Util::DEBUG); - exit(); -} -function debug($msg) { - OCP\Util::writeLog('contacts','ajax/addcontact.php: '.$msg, OCP\Util::DEBUG); -} - // Check if we are a user OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('contacts'); -foreach ($_POST as $key=>$element) { - debug('_POST: '.$key.'=>'.$element); -} - $aid = isset($_POST['aid'])?$_POST['aid']:null; if(!$aid) { $aid = min(OC_Contacts_Addressbook::activeIds()); // first active addressbook. @@ -54,7 +39,7 @@ $vcard->setUID(); $vcard->setString('FN',$fn); $vcard->setString('N',$n); -$id = OC_Contacts_VCard::add($aid,$vcard, null, $isnew); +$id = OC_Contacts_VCard::add($aid, $vcard, null, $isnew); if(!$id) { OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('There was an error adding the contact.')))); OCP\Util::writeLog('contacts','ajax/addcontact.php: Recieved non-positive ID on adding card: '.$id, OCP\Util::ERROR); diff --git a/apps/contacts/ajax/addproperty.php b/apps/contacts/ajax/addproperty.php index bf23df67585..4668c0d3a65 100644 --- a/apps/contacts/ajax/addproperty.php +++ b/apps/contacts/ajax/addproperty.php @@ -20,9 +20,6 @@ * */ -// Init owncloud - - // Check if we are a user OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('contacts'); diff --git a/apps/contacts/ajax/contactdetails.php b/apps/contacts/ajax/contactdetails.php index 657dc5d586c..a6ca10f9c94 100644 --- a/apps/contacts/ajax/contactdetails.php +++ b/apps/contacts/ajax/contactdetails.php @@ -19,8 +19,6 @@ * License along with this library. If not, see . * */ - -// Init owncloud function bailOut($msg) { OCP\JSON::error(array('data' => array('message' => $msg))); @@ -42,18 +40,6 @@ if(is_null($vcard)) { } $details = OC_Contacts_VCard::structureContact($vcard); -// Some Google exported files have no FN field. -/*if(!isset($details['FN'])) { - $fn = ''; - if(isset($details['N'])) { - $details['FN'] = array(implode(' ', $details['N'][0]['value'])); - } elseif(isset($details['EMAIL'])) { - $details['FN'] = array('value' => $details['EMAIL'][0]['value']); - } else { - $details['FN'] = array('value' => OC_Contacts_App::$l10n->t('Unknown')); - } -}*/ - // Make up for not supporting the 'N' field in earlier version. if(!isset($details['N'])) { $details['N'] = array(); diff --git a/apps/contacts/ajax/cropphoto.php b/apps/contacts/ajax/cropphoto.php index 63c9eb8f2d3..caba7c8c4ef 100644 --- a/apps/contacts/ajax/cropphoto.php +++ b/apps/contacts/ajax/cropphoto.php @@ -20,16 +20,12 @@ * */ -// Init owncloud - - // Check if we are a user OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('contacts'); $tmpkey = $_GET['tmpkey']; $id = $_GET['id']; -//OCP\Util::writeLog('contacts','ajax/cropphoto.php: tmpkey: '.$tmpkey.', exists: '.file_exists($tmp_path), OCP\Util::DEBUG); $tmpl = new OCP\Template("contacts", "part.cropphoto"); $tmpl->assign('tmpkey', $tmpkey); $tmpl->assign('id', $id); diff --git a/apps/contacts/ajax/deletebook.php b/apps/contacts/ajax/deletebook.php index bcf6aa44329..fe582daa00f 100644 --- a/apps/contacts/ajax/deletebook.php +++ b/apps/contacts/ajax/deletebook.php @@ -20,9 +20,6 @@ * */ -// Init owncloud - - // Check if we are a user OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('contacts'); diff --git a/apps/contacts/ajax/deletecard.php b/apps/contacts/ajax/deletecard.php index 46fd8252d47..6414fda93cb 100644 --- a/apps/contacts/ajax/deletecard.php +++ b/apps/contacts/ajax/deletecard.php @@ -25,9 +25,6 @@ function bailOut($msg) { exit(); } -// Init owncloud - - // Check if we are a user OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('contacts'); diff --git a/apps/contacts/ajax/deleteproperty.php b/apps/contacts/ajax/deleteproperty.php index 9bb1208cdd1..b0746d18a79 100644 --- a/apps/contacts/ajax/deleteproperty.php +++ b/apps/contacts/ajax/deleteproperty.php @@ -20,9 +20,6 @@ * */ -// Init owncloud - - // Check if we are a user OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('contacts'); diff --git a/apps/contacts/ajax/editname.php b/apps/contacts/ajax/editname.php index 9ba280ae542..d06d416b7ed 100644 --- a/apps/contacts/ajax/editname.php +++ b/apps/contacts/ajax/editname.php @@ -14,14 +14,11 @@ function bailOut($msg) { OCP\Util::writeLog('contacts','ajax/editname.php: '.$msg, OCP\Util::DEBUG); exit(); } -function debug($msg) { - OCP\Util::writeLog('contacts','ajax/editname.php: '.$msg, OCP\Util::DEBUG); -} $tmpl = new OCP\Template("contacts", "part.edit_name_dialog"); $id = isset($_GET['id'])?$_GET['id']:''; -debug('id: '.$id); + if($id) { $vcard = OC_Contacts_App::getContactVCard($id); $name = array('', '', '', '', ''); diff --git a/apps/contacts/ajax/loadcard.php b/apps/contacts/ajax/loadcard.php index 4e6f2206fef..fbb831f4a12 100644 --- a/apps/contacts/ajax/loadcard.php +++ b/apps/contacts/ajax/loadcard.php @@ -20,20 +20,6 @@ * */ -// Init owncloud - -function bailOut($msg) { - OCP\JSON::error(array('data' => array('message' => $msg))); - OCP\Util::writeLog('contacts','ajax/loadcard.php: '.$msg, OCP\Util::DEBUG); - exit(); -} -function debug($msg) { - OCP\Util::writeLog('contacts','ajax/loadcard.php: '.$msg, OCP\Util::DEBUG); -} -// foreach ($_POST as $key=>$element) { -// debug('_POST: '.$key.'=>'.$element); -// } - // Check if we are a user OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('contacts'); diff --git a/apps/contacts/ajax/loadphoto.php b/apps/contacts/ajax/loadphoto.php index ef429e82891..eac7ca7d02f 100644 --- a/apps/contacts/ajax/loadphoto.php +++ b/apps/contacts/ajax/loadphoto.php @@ -19,24 +19,17 @@ * License along with this library. If not, see . * */ -// Init owncloud // Check if we are a user OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('contacts'); -// foreach ($_POST as $key=>$element) { -// OCP\Util::writeLog('contacts','ajax/savecrop.php: '.$key.'=>'.$element, OCP\Util::DEBUG); -// } - function bailOut($msg) { OCP\JSON::error(array('data' => array('message' => $msg))); OCP\Util::writeLog('contacts','ajax/loadphoto.php: '.$msg, OCP\Util::DEBUG); exit(); } -$image = null; - $id = isset($_GET['id']) ? $_GET['id'] : ''; $refresh = isset($_GET['refresh']) ? true : false; diff --git a/apps/contacts/ajax/saveproperty.php b/apps/contacts/ajax/saveproperty.php index 6509ac21f28..8409ffe47f2 100644 --- a/apps/contacts/ajax/saveproperty.php +++ b/apps/contacts/ajax/saveproperty.php @@ -20,9 +20,6 @@ * */ -// Init owncloud - - // Check if we are a user OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('contacts'); @@ -35,21 +32,12 @@ function bailOut($msg) { function debug($msg) { OCP\Util::writeLog('contacts','ajax/saveproperty.php: '.$msg, OCP\Util::DEBUG); } -// foreach ($_POST as $key=>$element) { -// debug('_POST: '.$key.'=>'.print_r($element, true)); -// } $id = isset($_POST['id'])?$_POST['id']:null; $name = isset($_POST['name'])?$_POST['name']:null; $value = isset($_POST['value'])?$_POST['value']:null; $parameters = isset($_POST['parameters'])?$_POST['parameters']:null; $checksum = isset($_POST['checksum'])?$_POST['checksum']:null; -// if(!is_null($parameters)) { -// debug('parameters: '.count($parameters)); -// foreach($parameters as $key=>$val ) { -// debug('parameter: '.$key.'=>'.implode('/',$val)); -// } -// } if(!$name) { bailOut(OC_Contacts_App::$l10n->t('element name is not set.')); diff --git a/apps/contacts/ajax/uploadimport.php b/apps/contacts/ajax/uploadimport.php index b11f380fa8a..463ca161e56 100644 --- a/apps/contacts/ajax/uploadimport.php +++ b/apps/contacts/ajax/uploadimport.php @@ -28,9 +28,6 @@ function bailOut($msg) { OCP\Util::writeLog('contacts','ajax/uploadimport.php: '.$msg, OCP\Util::ERROR); exit(); } -function debug($msg) { - OCP\Util::writeLog('contacts','ajax/uploadimport.php: '.$msg, OCP\Util::DEBUG); -} $view = OCP\Files::getStorage('contacts'); $tmpfile = md5(rand()); @@ -39,7 +36,6 @@ $tmpfile = md5(rand()); $fn = (isset($_SERVER['HTTP_X_FILE_NAME']) ? $_SERVER['HTTP_X_FILE_NAME'] : false); if($fn) { if($view->file_put_contents('/'.$tmpfile, file_get_contents('php://input'))) { - debug($fn.' uploaded'); OCP\JSON::success(array('data' => array('path'=>'', 'file'=>$tmpfile))); exit(); } else { @@ -70,7 +66,6 @@ $file=$_FILES['importfile']; $tmpfname = tempnam(get_temp_dir(), "occOrig"); if(file_exists($file['tmp_name'])) { if($view->file_put_contents('/'.$tmpfile, file_get_contents($file['tmp_name']))) { - debug($fn.' uploaded'); OCP\JSON::success(array('data' => array('path'=>'', 'file'=>$tmpfile))); } else { bailOut(OC_Contacts_App::$l10n->t('Error uploading contacts to storage.'));