This commit is contained in:
Thomas Tanghus 2012-06-06 00:26:21 +02:00
parent 624f8ae36d
commit 68670bcc66
12 changed files with 2 additions and 88 deletions

View file

@ -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);

View file

@ -20,9 +20,6 @@
*
*/
// Init owncloud
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');

View file

@ -19,8 +19,6 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// 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();

View file

@ -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);

View file

@ -20,9 +20,6 @@
*
*/
// Init owncloud
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');

View file

@ -25,9 +25,6 @@ function bailOut($msg) {
exit();
}
// Init owncloud
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');

View file

@ -20,9 +20,6 @@
*
*/
// Init owncloud
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');

View file

@ -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('', '', '', '', '');

View file

@ -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');

View file

@ -19,24 +19,17 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// 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;

View file

@ -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.'));

View file

@ -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.'));