1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-01 13:24:10 +01:00

ported getUser

This commit is contained in:
Frank Karlitschek 2012-05-01 18:50:31 +02:00
parent 26930d0d83
commit a3dc9e8b2a
17 changed files with 21 additions and 21 deletions

View File

@ -31,7 +31,7 @@ if(is_null($categories)) {
debug(print_r($categories, true));
$addressbooks = OC_Contacts_Addressbook::all(OC_User::getUser());
$addressbooks = OC_Contacts_Addressbook::all(OCP\USER::getUser());
if(count($addressbooks) == 0) {
bailOut(OC_Contacts_App::$l10n->t('No address books found.'));
}

View File

@ -23,7 +23,7 @@ function debug($msg) {
OCP\Util::writeLog('contacts','ajax/categories/rescan.php: '.$msg, OCP\Util::DEBUG);
}
$addressbooks = OC_Contacts_Addressbook::all(OC_User::getUser());
$addressbooks = OC_Contacts_Addressbook::all(OCP\USER::getUser());
if(count($addressbooks) == 0) {
bailOut(OC_Contacts_App::$l10n->t('No address books found.'));
}

2
ajax/contacts.php Normal file → Executable file
View File

@ -10,7 +10,7 @@
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$ids = OC_Contacts_Addressbook::activeIds(OC_User::getUser());
$ids = OC_Contacts_Addressbook::activeIds(OCP\USER::getUser());
$contacts = OC_Contacts_VCard::all($ids);
$tmpl = new OC_TEMPLATE("contacts", "part.contacts");
$tmpl->assign('contacts', $contacts);

View File

@ -12,7 +12,7 @@
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$userid = OC_User::getUser();
$userid = OCP\USER::getUser();
$name = trim(strip_tags($_POST['name']));
if(!$name) {
OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Cannot add addressbook with an empty name.'))));

View File

@ -33,7 +33,7 @@ if($id) {
$tmpl->assign('name',$name);
$tmpl->assign('id',$id);
} else {
$addressbooks = OC_Contacts_Addressbook::active(OC_User::getUser());
$addressbooks = OC_Contacts_Addressbook::active(OCP\USER::getUser());
$tmpl->assign('addressbooks', $addressbooks);
}
$tmpl->printpage();

View File

@ -30,7 +30,7 @@ if(!$file) {
}
error_log('File: '.$file);
if(isset($_POST['method']) && $_POST['method'] == 'new'){
$id = OC_Contacts_Addressbook::add(OC_User::getUser(), $_POST['addressbookname']);
$id = OC_Contacts_Addressbook::add(OCP\USER::getUser(), $_POST['addressbookname']);
OC_Contacts_Addressbook::setActive($id, 1);
}else{
$id = $_POST['id'];

4
index.php Normal file → Executable file
View File

@ -13,10 +13,10 @@ OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('contacts');
// Get active address books. This creates a default one if none exists.
$ids = OC_Contacts_Addressbook::activeIds(OC_User::getUser());
$ids = OC_Contacts_Addressbook::activeIds(OCP\USER::getUser());
$contacts = OC_Contacts_VCard::all($ids);
$addressbooks = OC_Contacts_Addressbook::active(OC_User::getUser());
$addressbooks = OC_Contacts_Addressbook::active(OCP\USER::getUser());
// Load the files we need
OC_App::setActiveNavigationEntry( 'contacts_index' );

View File

@ -166,7 +166,7 @@ class OC_Contacts_Addressbook{
*/
public static function activeIds($uid = null){
if(is_null($uid)){
$uid = OC_User::getUser();
$uid = OCP\USER::getUser();
}
$prefbooks = OC_Preferences::getValue($uid,'contacts','openaddressbooks',null);
if(!$prefbooks){
@ -235,7 +235,7 @@ class OC_Contacts_Addressbook{
$openaddressbooks = self::cleanArray($openaddressbooks, false);
sort($openaddressbooks, SORT_NUMERIC);
// FIXME: I alway end up with a ';' prepending when imploding the array..?
OC_Preferences::setValue(OC_User::getUser(),'contacts','openaddressbooks',implode(';', $openaddressbooks));
OC_Preferences::setValue(OCP\USER::getUser(),'contacts','openaddressbooks',implode(';', $openaddressbooks));
return true;
}

View File

@ -17,13 +17,13 @@ class OC_Contacts_App {
public static function getAddressbook($id) {
$addressbook = OC_Contacts_Addressbook::find( $id );
if( $addressbook === false || $addressbook['userid'] != OC_User::getUser()) {
if( $addressbook === false || $addressbook['userid'] != OCP\USER::getUser()) {
if ($addressbook === false) {
OCP\Util::writeLog('contacts', 'Addressbook not found: '. $id, OCP\Util::ERROR);
OC_JSON::error(array('data' => array( 'message' => self::$l10n->t('Addressbook not found.'))));
}
else {
OCP\Util::writeLog('contacts', 'Addressbook('.$id.') is not from '.OC_User::getUser(), OCP\Util::ERROR);
OCP\Util::writeLog('contacts', 'Addressbook('.$id.') is not from '.OCP\USER::getUser(), OCP\Util::ERROR);
OC_JSON::error(array('data' => array( 'message' => self::$l10n->t('This is not your addressbook.'))));
}
exit();
@ -145,7 +145,7 @@ class OC_Contacts_App {
*/
public static function scanCategories($vccontacts = null) {
if (is_null($vccontacts)) {
$vcaddressbooks = OC_Contacts_Addressbook::all(OC_User::getUser());
$vcaddressbooks = OC_Contacts_Addressbook::all(OCP\USER::getUser());
if(count($vcaddressbooks) > 0) {
$vcaddressbookids = array();
foreach($vcaddressbooks as $vcaddressbook) {

2
lib/hooks.php Normal file → Executable file
View File

@ -41,7 +41,7 @@ class OC_Contacts_Hooks{
static public function getCalenderSources($parameters) {
$base_url = OC_Helper::linkTo('calendar', 'ajax/events.php').'?calendar_id=';
foreach(OC_Contacts_Addressbook::all(OC_User::getUser()) as $addressbook) {
foreach(OC_Contacts_Addressbook::all(OCP\USER::getUser()) as $addressbook) {
$parameters['sources'][] =
array(
'url' => $base_url.'birthday_'. $addressbook['id'],

2
lib/search.php Normal file → Executable file
View File

@ -1,7 +1,7 @@
<?php
class OC_Search_Provider_Contacts extends OC_Search_Provider{
function search($query){
$addressbooks = OC_Contacts_Addressbook::all(OC_User::getUser(), 1);
$addressbooks = OC_Contacts_Addressbook::all(OCP\USER::getUser(), 1);
// if(count($calendars)==0 || !OC_App::isEnabled('contacts')){
// //return false;
// }

2
templates/index.php Normal file → Executable file
View File

@ -1,7 +1,7 @@
<script type='text/javascript'>
var totalurl = '<?php echo OC_Helper::linkToAbsolute('contacts', 'carddav.php'); ?>/addressbooks';
var categories = <?php echo json_encode($_['categories']); ?>;
var lang = '<?php echo OC_Preferences::getValue(OC_User::getUser(), 'core', 'lang', 'en'); ?>';
var lang = '<?php echo OC_Preferences::getValue(OCP\USER::getUser(), 'core', 'lang', 'en'); ?>';
</script>
<!-- div id="controls">
<form>

2
templates/part.chooseaddressbook.php Normal file → Executable file
View File

@ -1,7 +1,7 @@
<div id="chooseaddressbook_dialog" title="<?php echo $l->t("Configure Address Books"); ?>">
<table width="100%" style="border: 0;">
<?php
$option_addressbooks = OC_Contacts_Addressbook::all(OC_User::getUser());
$option_addressbooks = OC_Contacts_Addressbook::all(OCP\USER::getUser());
for($i = 0; $i < count($option_addressbooks); $i++){
echo "<tr>";
$tmpl = new OC_Template('contacts', 'part.chooseaddressbook.rowfields');

2
templates/part.chooseaddressbook.rowfields.php Normal file → Executable file
View File

@ -2,4 +2,4 @@
// FIXME: Make this readable.
echo "<td width=\"20px\"><input id=\"active_" . $_['addressbook']["id"] . "\" type=\"checkbox\" onClick=\"Contacts.UI.Addressbooks.activation(this, " . $_['addressbook']["id"] . ")\"" . (OC_Contacts_Addressbook::isActive($_['addressbook']["id"]) ? ' checked="checked"' : '') . "></td>";
echo "<td><label for=\"active_" . $_['addressbook']["id"] . "\">" . htmlspecialchars($_['addressbook']["displayname"]) . "</label></td>";
echo "<td width=\"20px\"><a href=\"#\" onclick=\"Contacts.UI.showCardDAVUrl('" . OC_User::getUser() . "', '" . rawurlencode($_['addressbook']["uri"]) . "');\" title=\"" . $l->t("CardDav Link") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/public.svg\"></a></td><td width=\"20px\"><a href=\"export.php?bookid=" . $_['addressbook']["id"] . "\" title=\"" . $l->t("Download") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/download.svg\"></a></td><td width=\"20px\"><a href=\"#\" title=\"" . $l->t("Edit") . "\" class=\"action\" onclick=\"Contacts.UI.Addressbooks.editAddressbook(this, " . $_['addressbook']["id"] . ");\"><img class=\"svg action\" src=\"../../core/img/actions/rename.svg\"></a></td><td width=\"20px\"><a href=\"#\" onclick=\"Contacts.UI.Addressbooks.deleteAddressbook(this, '" . $_['addressbook']["id"] . "');\" title=\"" . $l->t("Delete") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/delete.svg\"></a></td>";
echo "<td width=\"20px\"><a href=\"#\" onclick=\"Contacts.UI.showCardDAVUrl('" . OCP\USER::getUser() . "', '" . rawurlencode($_['addressbook']["uri"]) . "');\" title=\"" . $l->t("CardDav Link") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/public.svg\"></a></td><td width=\"20px\"><a href=\"export.php?bookid=" . $_['addressbook']["id"] . "\" title=\"" . $l->t("Download") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/download.svg\"></a></td><td width=\"20px\"><a href=\"#\" title=\"" . $l->t("Edit") . "\" class=\"action\" onclick=\"Contacts.UI.Addressbooks.editAddressbook(this, " . $_['addressbook']["id"] . ");\"><img class=\"svg action\" src=\"../../core/img/actions/rename.svg\"></a></td><td width=\"20px\"><a href=\"#\" onclick=\"Contacts.UI.Addressbooks.deleteAddressbook(this, '" . $_['addressbook']["id"] . "');\" title=\"" . $l->t("Delete") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/delete.svg\"></a></td>";

2
templates/part.import.php Normal file → Executable file
View File

@ -6,7 +6,7 @@
<p style="text-align:center;"><b><?php echo $l->t('Please choose the addressbook'); ?></b>
<select style="width:100%;" id="contacts" name="contacts">
<?php
$contacts_options = OC_Contacts_Addressbook::all(OC_User::getUser());
$contacts_options = OC_Contacts_Addressbook::all(OCP\USER::getUser());
$contacts_options[] = array('id'=>'newaddressbook', 'displayname'=>$l->t('create a new addressbook'));
echo html_select_options($contacts_options, $contacts_options[0]['id'], array('value'=>'id', 'label'=>'displayname'));
?>

2
templates/part.importaddressbook.php Normal file → Executable file
View File

@ -13,7 +13,7 @@
<td>
<select id="book" name="book" class="float">
<?php
$contacts_options = OC_Contacts_Addressbook::all(OC_User::getUser());
$contacts_options = OC_Contacts_Addressbook::all(OCP\USER::getUser());
echo html_select_options($contacts_options, $contacts_options[0]['id'], array('value'=>'id', 'label'=>'displayname'));
?>
</select>

2
templates/settings.php Normal file → Executable file
View File

@ -6,7 +6,7 @@
<dt><?php echo $l->t('Primary address (Kontact et al)'); ?></dt>
<dd><code><?php echo OC_Helper::linkToAbsolute('contacts', 'carddav.php'); ?>/</code></dd>
<dt><?php echo $l->t('iOS/OS X'); ?></dt>
<dd><code><?php echo OC_Helper::linkToAbsolute('contacts', 'carddav.php'); ?>/principals/<?php echo OC_User::getUser(); ?></code>/</dd>
<dd><code><?php echo OC_Helper::linkToAbsolute('contacts', 'carddav.php'); ?>/principals/<?php echo OCP\USER::getUser(); ?></code>/</dd>
</dl>
Powered by <a href="http://geonames.org/" target="_blank">geonames.org webservice</a>
</fieldset>