public function getNews() { if (!$this->itembusinesslayer) { $this->getNewsapi(); } $lastId = OCP\Config::getUserValue($this->user, "ocDashboard", "ocDashboard_newsreader_lastItemId", 0); $items = $this->itembusinesslayer->findAllNew(0, \OCA\News\Db\FeedType::SUBSCRIPTIONS, 0, false, $this->user); $items = array_reverse($items); $newsitemfound = false; $itemcount = 0; foreach ($items as $item) { $itemdata = $item->toAPI(); $itemcount++; // if the last newsitem was the las showen item => this is the next if ($newsitemfound) { OCP\Config::setUserValue($this->user, "ocDashboard", "ocDashboard_newsreader_lastItemId", $itemdata['id']); $itemdata["count"] = count($items); $itemdata["actual"] = $itemcount; return $itemdata; } // if newsitem is the last one if ($itemdata['id'] == $lastId) { $newsitemfound = true; } } if (reset($items)) { $itemdata = reset($items)->toAPI(); OCP\Config::setUserValue($this->user, "ocDashboard", "ocDashboard_newsreader_lastItemId", $itemdata['id']); $itemdata["count"] = count($items); $itemdata["actual"] = 1; return $itemdata; } else { return null; } }
private function deleteOldItems($act) { $oldestAccepted = time() - OCP\Config::getUserValue($this->user, "ocDashboard", "ocDashboard_activity_maxAge", 1) * 60 * 60; foreach ($act as $k => $v) { if ($act[$k]['timestamp'] < $oldestAccepted) { unset($act[$k]); } } return $act; }
function search($query) { $calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), 1); if (count($calendars) == 0 || !OCP\App::isEnabled('calendar')) { //return false; } $results = array(); $searchquery = array(); if (substr_count($query, ' ') > 0) { $searchquery = explode(' ', $query); } else { $searchquery[] = $query; } $user_timezone = OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get()); $l = new OC_l10n('calendar'); foreach ($calendars as $calendar) { $objects = OC_Calendar_Object::all($calendar['id']); foreach ($objects as $object) { if ($object['objecttype'] != 'VEVENT') { continue; } if (substr_count(strtolower($object['summary']), strtolower($query)) > 0) { $calendardata = OC_VObject::parse($object['calendardata']); $vevent = $calendardata->VEVENT; $dtstart = $vevent->DTSTART; $dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent); $start_dt = $dtstart->getDateTime(); $start_dt->setTimezone(new DateTimeZone($user_timezone)); $end_dt = $dtend->getDateTime(); $end_dt->setTimezone(new DateTimeZone($user_timezone)); if ($dtstart->getDateType() == Sabre_VObject_Property_DateTime::DATE) { $end_dt->modify('-1 sec'); if ($start_dt->format('d.m.Y') != $end_dt->format('d.m.Y')) { $info = $l->t('Date') . ': ' . $start_dt->format('d.m.Y') . ' - ' . $end_dt->format('d.m.Y'); } else { $info = $l->t('Date') . ': ' . $start_dt->format('d.m.Y'); } } else { $info = $l->t('Date') . ': ' . $start_dt->format('d.m.y H:i') . ' - ' . $end_dt->format('d.m.y H:i'); } $link = OCP\Util::linkTo('calendar', 'index.php') . '?showevent=' . urlencode($object['id']); $results[] = new OC_Search_Result($object['summary'], $info, $link, (string) $l->t('Cal.')); //$name,$text,$link,$type } } } return $results; }
function index() { $fileIds = OCA\Search_Lucene\Indexer::getUnindexed(); $eventSource = new OC_EventSource(); $eventSource->send('count', count($fileIds)); $skippedDirs = explode(';', OCP\Config::getUserValue(OCP\User::getUser(), 'search_lucene', 'skipped_dirs', '.git;.svn;.CVS;.bzr')); $query = OC_DB::prepare('INSERT INTO `*PREFIX*lucene_status` VALUES (?,?)'); foreach ($fileIds as $id) { $skipped = false; try { //before we start mark the file as error so we know there was a problem when the php execution dies $result = $query->execute(array($id, 'E')); $path = OC\Files\Filesystem::getPath($id); $eventSource->send('indexing', $path); //clean jobs for indexed file $param = json_encode(array('path' => $path, 'user' => OCP\User::getUser())); $cleanjobquery = OC_DB::prepare('DELETE FROM `*PREFIX*queuedtasks` WHERE `app`=? AND `parameters`=?'); $cleanjobquery->execute(array('search_lucene', $param)); foreach ($skippedDirs as $skippedDir) { if (strpos($path, '/' . $skippedDir . '/') !== false || strrpos($path, '/' . $skippedDir) === strlen($path) - (strlen($skippedDir) + 1)) { $result = $query->execute(array($id, 'S')); $skipped = true; break; } } if (!$skipped) { if (OCA\Search_Lucene\Indexer::indexFile($path, OCP\User::getUser())) { $result = $query->execute(array($id, 'I')); } } if (!$result) { OC_JSON::error(array('message' => 'Could not index file.')); $eventSource->send('error', $path); } } catch (PDOException $e) { //sqlite might report database locked errors when stock filescan is in progress //this also catches db locked exception that might come up when using sqlite \OCP\Util::writeLog('search_lucene', $e->getMessage() . ' Trace:\\n' . $e->getTraceAsString(), \OCP\Util::ERROR); OC_JSON::error(array('message' => 'Could not index file.')); $eventSource->send('error', $e->getMessage()); //try to mark the file as new to let it reindex $query->execute(array($id, 'N')); // Add UI to trigger rescan of files with status 'E'rror? } } $eventSource->send('done', ''); $eventSource->close(); }
function index() { if (isset($_GET['fileid'])) { $fileIds = array($_GET['fileid']); } else { $fileIds = OCA\Search_Lucene\Indexer::getUnindexed(); } $eventSource = new OC_EventSource(); $eventSource->send('count', count($fileIds)); $skippedDirs = explode(';', OCP\Config::getUserValue(OCP\User::getUser(), 'search_lucene', 'skipped_dirs', '.git;.svn;.CVS;.bzr')); foreach ($fileIds as $id) { $skipped = false; $fileStatus = OCA\Search_Lucene\Status::fromFileId($id); try { //before we start mark the file as error so we know there was a problem when the php execution dies $fileStatus->markError(); $path = OC\Files\Filesystem::getPath($id); $eventSource->send('indexing', $path); foreach ($skippedDirs as $skippedDir) { if (strpos($path, '/' . $skippedDir . '/') !== false || strrpos($path, '/' . $skippedDir) === strlen($path) - (strlen($skippedDir) + 1)) { $result = $fileStatus->markSkipped(); $skipped = true; break; } } if (!$skipped) { if (OCA\Search_Lucene\Indexer::indexFile($path, OCP\User::getUser())) { $result = $fileStatus->markIndexed(); } } if (!$result) { OCP\JSON::error(array('message' => 'Could not index file.')); $eventSource->send('error', $path); } } catch (Exception $e) { //sqlite might report database locked errors when stock filescan is in progress //this also catches db locked exception that might come up when using sqlite \OCP\Util::writeLog('search_lucene', $e->getMessage() . ' Trace:\\n' . $e->getTraceAsString(), \OCP\Util::ERROR); OCP\JSON::error(array('message' => 'Could not index file.')); $eventSource->send('error', $e->getMessage()); //try to mark the file as new to let it reindex $fileStatus->markNew(); // Add UI to trigger rescan of files with status 'E'rror? } } $eventSource->send('done', ''); $eventSource->close(); }
private function getBookmarks() { $filters = OCP\Config::getUserValue($this->user, "ocDashboard", "ocDashboard_bookmarks_tags", ""); // default value doesnt work if empty if (empty($filters)) { $filters = $this->getDefaultValue("tags"); } $filters = explode(',', $filters); $params = array(OCP\USER::getUser()); $sql = "SELECT *, (SELECT GROUP_CONCAT(`tag`) from `*PREFIX*bookmarks_tags` WHERE `bookmark_id` = `b`.`id`) as `tags`\n\t\t\t\tFROM `*PREFIX*bookmarks` `b`\n\t\t\t\tWHERE `user_id` = ? "; // filter clause $sql .= " AND\texists (SELECT `id` FROM `*PREFIX*bookmarks_tags`\n\t\t\t`t2` WHERE `t2`.`bookmark_id` = `b`.`id` AND ( `tag` = ? " . str_repeat(' OR `tag` = ? ', count($filters) - 1) . " ) ) "; $params = array_merge($params, $filters); $sql .= " ORDER BY lastmodified DESC "; $query = OCP\DB::prepare($sql); $results = $query->execute($params)->fetchAll(); $this->bookmarks = $results; }
private function getNewMails() { $user = OCP\Config::getUserValue($this->user, "ocDashboard", "ocDashboard_mailcheck_user", ""); $host = OCP\Config::getUserValue($this->user, "ocDashboard", "ocDashboard_mailcheck_server", ""); $pass = OCP\Config::getUserValue($this->user, "ocDashboard", "ocDashboard_mailcheck_password", ""); $port = OCP\Config::getUserValue($this->user, "ocDashboard", "ocDashboard_mailcheck_port", $this->getDefaultValue("port")); //$folder = OCP\Config::getUserValue($this->user, "ocDashboard", "ocDashboard_mailcheck_folder",$this->getDefaultValue("folder")); $security = OCP\Config::getUserValue($this->user, "ocDashboard", "ocDashboard_mailcheck_ssl") == 'yes' ? "ssl" : "none"; $protocol = OCP\Config::getUserValue($this->user, "ocDashboard", "ocDashboard_mailcheck_protocol", $this->getDefaultValue("protocol")); if ($host != "" && $user != "" && $pass != "") { // connect to mailbox $connString = "{" . $host . ":" . $port . "/" . $protocol . ($security != "none" ? "/" . $security . "/novalidate-cert" : "") . "}"; //\OCP\Util::writeLog("ocDashboard",$connString,\OCP\Util::DEBUG); $mailbox = imap_open($connString, $user, $pass); if ($mailbox) { //$mails = array_reverse(imap_fetch_overview($mailbox,"1:*", FT_UID)); // fetch a overview about mails $index = ""; $unseen = imap_search($mailbox, 'UNSEEN'); // fetch only unseen mails... much faster if ($unseen) { foreach ($unseen as $umail) { $index .= $umail . ","; } } $mails = array_reverse(imap_fetch_overview($mailbox, "{$index}")); imap_close($mailbox); foreach ($mails as $mail) { if ($mail->seen == 0 && $mail->deleted == 0) { $this->newMails[] = $mail; } } } else { \OCP\Util::writeLog("ocDashboard", $connString, \OCP\Util::ERROR); $this->error = "Connection error. <br />Are the settings correct?"; } } else { $this->errorMsg = "Missing settings."; } }
private function getXml() { $code = ""; $code = OCP\Config::getUserValue($this->user, "ocDashboard", "ocDashboard_weather_city"); if (!isset($code) || $code == "" || !is_numeric($code)) { $this->errorMsg = "The city code is not valid."; return false; } else { $unit = OCP\Config::getUserValue($this->user, "ocDashboard", "ocDashboard_weather_unit", $this->getDefaultValue('unit')); $url = $this->cityUrl; $url = str_replace("###unit###", $unit, $url); $url = str_replace("###code###", $code, $url); $con = @file_get_contents($url); if ($con != "" && strlen($con) > 500) { $this->xml = new SimpleXMLElement($con); return true; } else { OCP\Util::writeLog('ocDashboard', "Weather coul not load: " . $url, \OCP\Util::WARN); $this->errorMsg = "The city code is not valid."; return false; } } }
// Sanity checks OCP\JSON::callCheck ( ); OCP\JSON::checkLoggedIn ( ); OCP\JSON::checkAppEnabled ( 'shorty' ); try { // first remove any entries already marked as 'deleted' $query = OCP\DB::prepare ( OC_Shorty_Query::URL_REMOVE ); $result = $query->execute(array(':user'=>OCP\User::getUser())); // now comes the real list selection // define ('PAGE_SIZE', 100); // $p_offset = OC_Shorty_Type::req_argument ( 'page', OC_Shorty_Type::INTEGER, FALSE) * PAGE_SIZE; // pre-sort list according to user preferences $p_sort = OC_Shorty_Type::$SORTING[OCP\Config::getUserValue(OCP\User::getUser(),'shorty','list-sort-code','cd')]; $param = array ( ':user' => OCP\User::getUser ( ), ':sort' => $p_sort, // ':offset' => $p_offset, // ':limit' => PAGE_SIZE, ); $query = OCP\DB::prepare ( OC_Shorty_Query::URL_LIST ); $result = $query->execute($param); $reply = $result->fetchAll(); foreach (array_keys($reply) as $key) { if (isset($reply[$key]['id'])) { // enhance all entries with the relay url $reply[$key]['relay']=OC_Shorty_Tools::relayUrl ( $reply[$key]['id'] ); // make sure there is _any_ favicon contained, otherwise layout in MS-IE browser is broken...
<?php OCP\Util::addStyle('tattoo', 'settings'); // die($_POST['tattooWallpaper']); if (isset($_POST['tattooSetWallpaper']) && isset($_POST['tattooWallpaper'])) { OCP\Config::setUserValue(OCP\User::getUser(), 'tattoo', 'wallpaper', $_POST['tattooWallpaper']); OCP\Config::setUserValue(OCP\User::getUser(), 'tattoo', 'lastModified', gmdate('D, d M Y H:i:s') . ' GMT'); } $wallpaper = OCP\Config::getUserValue(OCP\User::getUser(), 'tattoo', 'wallpaper', 'none'); $tmpl = new OCP\Template('tattoo', 'settings'); $tmpl->assign('tattooSelectedWallpaper', $wallpaper); return $tmpl->fetchPage();
$categories = OC_Calendar_App::getCategoryOptions(); //Fix currentview for fullcalendar if (OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "oneweekview") { OCP\Config::setUserValue(OCP\USER::getUser(), "calendar", "currentview", "agendaWeek"); } if (OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "onemonthview") { OCP\Config::setUserValue(OCP\USER::getUser(), "calendar", "currentview", "month"); } if (OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "listview") { OCP\Config::setUserValue(OCP\USER::getUser(), "calendar", "currentview", "list"); } OCP\Util::addscript('3rdparty/fullcalendar', 'fullcalendar'); OCP\Util::addStyle('3rdparty/fullcalendar', 'fullcalendar'); OCP\Util::addscript('3rdparty/timepicker', 'jquery.ui.timepicker'); OCP\Util::addStyle('3rdparty/timepicker', 'jquery.ui.timepicker'); if (OCP\Config::getUserValue(OCP\USER::getUser(), "calendar", "timezone") == null || OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezonedetection') == 'true') { OCP\Util::addscript('calendar', 'geo'); } OCP\Util::addscript('calendar', 'calendar'); OCP\Util::addStyle('calendar', 'style'); OCP\Util::addscript('', 'jquery.multiselect'); OCP\Util::addStyle('', 'jquery.multiselect'); OCP\Util::addscript('contacts', 'jquery.multi-autocomplete'); OCP\Util::addscript('', 'oc-vcategories'); OCP\App::setActiveNavigationEntry('calendar_index'); $tmpl = new OCP\Template('calendar', 'calendar', 'user'); $tmpl->assign('eventSources', $eventSources); $tmpl->assign('categories', $categories); if (array_key_exists('showevent', $_GET)) { $tmpl->assign('showevent', $_GET['showevent']); }
OCP\Config::setUserValue(OCP\User::getUser(), 'fluxx_compensator', $_POST['key'], $value); // return success OCP\JSON::success(array('value' => $value)); break; case 'GET': // check if a valid key has been specified if (!array_key_exists('key', $_GET)) { throw new Exception("Missing key in ajax method."); } if (!array_key_exists($_GET['key'], $validPreferences)) { throw new Exception("Unknown key in ajax method."); } // check for a valid default value if (!array_key_exists('value', $_GET)) { throw new Exception("Missing value in ajax method."); } if (!$validPreferences[$_GET['key']]['validate']($_GET['value'])) { throw new Exception("Unknown type of value in ajax method."); } // retrieve value from database, normalize and return it $value = OCP\Config::getUserValue(OCP\User::getUser(), 'fluxx_compensator', $_GET['key']); $value = $validPreferences[$_GET['key']]['normalize']($value, $_GET['value']); OCP\JSON::success(array('value' => $value)); break; default: throw new Exception("Unexpected request method '%s'", $_SERVER['REQUEST_METHOD']); } // switch } catch (Exception $e) { OCP\JSON::error($e->getMessage()); }
<li> <input class="value region tooltipped rightwards onfocus" type="text" id="adr_4" name="value[4]" value="{adr4}" placeholder="<?php p($l->t('State or province')); ?>" /> </li> <li> <input class="value country tooltipped rightwards onfocus" type="text" id="adr_6" name="value[6]" value="{adr6}" placeholder="<?php p($l->t('Country')); ?>" /> </li> </ul> <input class="value pobox" type="hidden" id="adr_0" name="value[0]" value="{adr0}" /> <input class="value extadr" type="hidden" id="adr_1" name="value[1]" value="{adr1}" /> </fieldset> </li> </div> <!-- <li data-element="adr" data-checksum="{checksum}" data-lang="<?php p(OCP\Config::getUserValue(OCP\USER::getUser(), 'core', 'lang', 'en')); ?>" class="propertycontainer"> <span class="parameters"> <input type="checkbox" id="adr_pref_{idx}" class="parameter tooltipped downwards" data-parameter="TYPE" name="parameters[TYPE][]" value="PREF" title="<?php p($l->t('Preferred')); ?>" /> <select class="type parameter" data-parameter="TYPE" name="parameters[TYPE][]"> <?php print_unescaped(OCP\html_select_options($_['imppTypes'], array())) ?> </select> </span> --> <div class="impp" type="text/template"> <li data-element="impp" data-checksum="{checksum}" class="propertycontainer"> <span class="parameters"> <input type="checkbox" id="impp_pref_{idx}" class="parameter tooltipped downwards" data-parameter="TYPE" name="parameters[TYPE][]" value="PREF" title="<?php p($l->t('Preferred')); ?>" /> <select class="rtl type parameter" data-parameter="X-SERVICE-TYPE" name="parameters[X-SERVICE-TYPE]"> <?php print_unescaped(OCP\html_select_options($_['imProtocols'], array())) ?> </select>
<div id='notification'></div> <script type='text/javascript'> var totalurl = '<?php echo OCP\Util::linkToRemote('carddav'); ?> addressbooks'; var categories = <?php echo json_encode($_['categories']); ?> ; var id = '<?php echo $_['id']; ?> '; var lang = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'core', 'lang', 'en'); ?> '; </script> <div id="leftcontent"> <div class="hidden" id="statusbar"></div> <div id="contacts"> </div> <div id="uploadprogressbar"></div> <div id="bottomcontrols"> <button class="control newcontact" id="contacts_newcontact" title="<?php echo $l->t('Add Contact'); ?> "></button> <button class="control import" title="<?php echo $l->t('Import');
</dt> <dd><input type="text" style="width:95%;" readonly="readonly" value="<?php print_unescaped(OCP\Util::linkToRemote('contactsplus')); ?> principals/<?php p(OCP\USER::getUser()); ?> /" /></dd> <dt><b><?php p($l->t('iOS/OS X Support Groups (experimentel)')); ?> </b></dt> <dd> <?php $isAktiv = ''; if (OCP\Config::getUserValue(OCP\USER::getUser(), 'contactsplus', 'iossupport') == true) { $isAktiv = 'checked="checked"'; } ?> <input type="checkbox" id="toggleIosSupport" <?php print_unescaped($isAktiv); ?> /> <?php p($l->t('Activition IOS Support for Groups')); ?> </dd> </dl>
/** * @return (string) $timezone as set by user or the default timezone */ public static function getTimezone() { return OCP\Config::getUserValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get()); }
<?php /** * Copyright (c) 2011 Bart Visscher <*****@*****.**> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ $tmpl = new OCP\Template('calendar', 'settings'); $timezone = OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezone', ''); $tmpl->assign('timezone', $timezone); $tmpl->assign('timezones', DateTimeZone::listIdentifiers()); $tmpl->assign('calendars', OC_Calendar_Calendar::allCalendars(OCP\USER::getUser()), false); OCP\Util::addscript('calendar', 'settings'); $tmpl->printPage();
public static function getGalleryRoot() { return OCP\Config::getUserValue(OCP\USER::getUser(), 'gallery', 'root', ''); }
<?php /** * Copyright (c) 2012 Thomas Tanghus <*****@*****.**> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('contacts'); $catmgr = OCA\Contacts\App::getVCategories(); $categories = $catmgr->categories(OC_VCategories::FORMAT_MAP); foreach ($categories as &$category) { $ids = array(); $contacts = $catmgr->itemsForCategory($category['name'], array('tablename' => '*PREFIX*contacts_cards', 'fields' => array('id'))); foreach ($contacts as $contact) { $ids[] = $contact['id']; } $category['contacts'] = $ids; } $favorites = $catmgr->getFavorites(); OCP\JSON::success(array('data' => array('categories' => $categories, 'favorites' => $favorites, 'shared' => OCP\Share::getItemsSharedWith('addressbook', OCA\Contacts\Share_Backend_Addressbook::FORMAT_ADDRESSBOOKS), 'lastgroup' => OCP\Config::getUserValue(OCP\User::getUser(), 'contacts', 'lastgroup', 'all'), 'sortorder' => OCP\Config::getUserValue(OCP\User::getUser(), 'contacts', 'groupsort', ''))));
public static function find($owner, $name = null, $path = null, $parent = null) { $sql = 'SELECT * FROM *PREFIX*gallery_albums WHERE uid_owner = ?'; $args = array($owner); if (!is_null($name)) { $sql .= ' AND album_name = ?'; $args[] = $name; } if (!is_null($path)) { $sql .= ' AND album_path = ?'; $args[] = $path; } if (!is_null($parent)) { $sql .= ' AND parent_path = ?'; $args[] = $parent; } $order = OCP\Config::getUserValue($owner, 'gallery', 'order', 'ASC'); $sql .= ' ORDER BY album_name ' . $order; $stmt = OCP\DB::prepare($sql); return $stmt->execute($args); }
array ( 'data' => $data, 'level' => 'debug', 'message' => OC_Shorty_L10n::t("Preference '%s' saved",implode(',',array_keys($data))) ) ); break; case 'GET': // detect requested preferences foreach (array_keys($_GET) as $key) { if ( isset(OC_Shorty_Type::$PREFERENCE[$key]) ) // ignore unknown preference keys { $type = OC_Shorty_Type::$PREFERENCE[$key]; $data[$key] = OCP\Config::getUserValue( OCP\User::getUser(), 'shorty', $key); // morph value into an explicit type switch ($type) { case OC_Shorty_Type::ID: case OC_Shorty_Type::STATUS: case OC_Shorty_Type::SORTKEY: case OC_Shorty_Type::SORTVAL: case OC_Shorty_Type::JSON: case OC_Shorty_Type::STRING: case OC_Shorty_Type::URL: case OC_Shorty_Type::DATE: settype ( $data[$key], 'string' ); break; case OC_Shorty_Type::INTEGER: case OC_Shorty_Type::TIMESTAMP:
<?php /** * Copyright (c) 2011, 2012 Georg Ehrke <ownclouddev at georgswebsite dot de> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('calendar'); OCP\JSON::success(array('detection' => OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezonedetection')));
public function getWidgetData() { $lang = OCP\Config::getUserValue($this->user, "ocDashboard", "ocDashboard_search_defaultSearchEngineLanguage", "0"); $engine = OCP\Config::getUserValue($this->user, "ocDashboard", "ocDashboard_search_defaultSearchEngine", "0"); return array("lang" => $lang, "engine" => $engine, "engines" => $this->searchEngines); }
/** * ownCloud - RainLoop mail plugin * * @author RainLoop Team * @copyright 2015 RainLoop Team * * https://github.com/RainLoop/rainloop-webmail/tree/master/build/owncloud */ OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('rainloop'); OCP\JSON::callCheck(); $sEmail = ''; $sLogin = ''; if (isset($_POST['appname'], $_POST['rainloop-password'], $_POST['rainloop-email']) && 'rainloop' === $_POST['appname']) { $sUser = OCP\User::getUser(); $sPostEmail = $_POST['rainloop-email']; OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-email', $sPostEmail); $sPass = $_POST['rainloop-password']; if ('******' !== $sPass && '' !== $sPass) { include_once OC_App::getAppPath('rainloop') . '/lib/RainLoopHelper.php'; OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-password', OC_RainLoop_Helper::encodePassword($sPass, md5($sPostEmail))); } $sEmail = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-email', ''); } else { sleep(1); OC_JSON::error(array('Message' => 'Invalid argument(s)', 'Email' => $sEmail)); return false; } sleep(1); OCP\JSON::success(array('Message' => 'Saved successfully', 'Email' => $sEmail)); return true;
<?php $tmpl = new OCP\Template('user_openid', 'settings'); $identity = OCP\Config::getUserValue(OCP\USER::getUser(), 'user_openid', 'identity', ''); $tmpl->assign('identity', htmlentities($identity)); OCP\Util::addscript('user_openid', 'settings'); return $tmpl->fetchPage();
// add url taked from the session vars to anything contained in the query string $_SERVER['QUERY_STRING'] = implode('&',array_merge(array('url'=>$_SESSION['shorty-referrer']),explode('&',$_SERVER['QUERY_STRING']))); } else { // simple desktop initialization, no special actions contained OCP\Util::addScript ( 'shorty', 'list' ); } $tmpl = new OCP\Template( 'shorty', 'tmpl_index', 'user' ); // any additional actions registered via hooks that should be offered ? $tmpl->assign ( 'shorty-actions', OC_Shorty_Hooks::requestActions() ); // the (remote) base url of the qrcode generator $tmpl->assign ( 'qrcode-ref', sprintf('%s?service=%s&id=', OCP\Util::linkToAbsolute('', 'public.php'), 'shorty_qrcode') ); // available status options (required for select filter in toolbox) $shorty_status['']=sprintf('- %s -',OC_Shorty_L10n::t('all')); foreach ( OC_Shorty_Type::$STATUS as $status ) $shorty_status[$status] = OC_Shorty_L10n::t($status); $tmpl->assign ( 'shorty-status', $shorty_status ); $tmpl->assign ( 'default-status', OCP\Config::getUserValue(OCP\User::getUser(),'shorty','default-status','private') ); // any referrer we want to hand over to the browser ? if ( array_key_exists('shorty-referrer',$_SESSION) ) $tmpl->assign ( 'shorty-referrer', $_SESSION['shorty-referrer'] ); // is sending sms enabled in the personal preferences ? $tmpl->assign ( 'sms-control', OCP\Config::getUserValue(OCP\User::getUser(),'shorty','sms-control','disabled') ); // clean up session var so that a browser reload does not trigger the same action again \OC::$session->remove('shorty-referrer'); $tmpl->printPage(); } catch ( OC_Shorty_Exception $e ) { OCP\JSON::error ( array ( 'message'=>$e->getTranslation(), 'level'=>'error', 'data'=>$result ) ); } } // switch ?>
<?php // Check if we are a user OCP\JSON::checkLoggedIn(); OCP\JSON::success(array('data' => OCP\Config::getUserValue(OCP\User::getUser(), 'tattoo', 'wallpaper', 'none')));
p($l->t('Days')); ?> </option> <option value="W"><?php p($l->t('Weeks')); ?> </option> </select> <button class="deleteAlarm"><?php p($l->t("Delete")); ?> </button> <label class="alarmOptionField" style="display: none;"> <span style="width: 35%;">Url eg: uri&m=<b>$message</b>:</span> <input style="width: 60%;" class="alarmOptionField" type="text" name="" value="<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'webhookdefaulturl'); ?> " /> </label> </div> <script>var __b = $('#baseEventAlarm'); Calendar.UI.ALARMBASETPL = __b.attr('id','').prop('outerHTML'); __b.remove();</script> <button id="add_alarm"><?php p($l->t("Add reminder")); ?> </button> </div> <input id="advanced_options_button" type="button" class="submit" value="<?php p($l->t('Advanced options'));
OCP\App::checkAppEnabled('contacts'); $bookid = isset($_GET['bookid']) ? $_GET['bookid'] : null; $contactid = isset($_GET['contactid']) ? $_GET['contactid'] : null; $selectedids = isset($_GET['selectedids']) ? $_GET['selectedids'] : null; $nl = "\n"; if (!is_null($bookid)) { try { $addressbook = OCA\Contacts\Addressbook::find($bookid); } catch (Exception $e) { OCP\JSON::error(array('data' => array('message' => $e->getMessage()))); exit; } header('Content-Type: text/directory'); header('Content-Disposition: inline; filename=' . str_replace(' ', '_', $addressbook['displayname']) . '.vcf'); $start = 0; $batchsize = OCP\Config::getUserValue(OCP\User::getUser(), 'contacts', 'export_batch_size', 20); while ($cardobjects = OCA\Contacts\VCard::all($bookid, $start, $batchsize, array('carddata'))) { foreach ($cardobjects as $card) { echo $card['carddata'] . $nl; } $start += $batchsize; } } elseif (!is_null($contactid)) { try { $data = OCA\Contacts\VCard::find($contactid); } catch (Exception $e) { OCP\JSON::error(array('data' => array('message' => $e->getMessage()))); exit; } header('Content-Type: text/vcard'); header('Content-Disposition: inline; filename=' . str_replace(' ', '_', $data['fullname']) . '.vcf');
* version 3 of the License, or any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. * * You should have received a copy of the GNU Affero General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. * */ OCP\JSON::setContentTypeHeader('text/javascript'); OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('contacts'); $user = \OC::$server->getUserSession()->getUser()->getUId(); $groupsort = OCP\Config::getUserValue($user, 'contacts', 'groupsort', ''); $groupsort = explode(',', $groupsort); $tmp = array(); foreach ($groupsort as $group) { if (is_int($group)) { $tmp[] = $group; } } $groupsort = implode(',', $tmp); echo 'var contacts_groups_sortorder=[' . $groupsort . '],'; echo 'contacts_lastgroup=\'' . OCP\Config::getUserValue($user, 'contacts', 'lastgroup', 'all') . '\','; echo 'contacts_sortby=\'' . OCP\Config::getUserValue($user, 'contacts', 'sortby', 'fn') . '\','; echo 'contacts_properties_indexed = ' . (OCP\Config::getUserValue($user, 'contacts', 'contacts_properties_indexed', 'no') === 'no' ? 'false' : 'true') . ','; echo 'contacts_categories_indexed = ' . (OCP\Config::getUserValue($user, 'contacts', 'contacts_categories_indexed', 'no') === 'no' ? 'false' : 'true') . ','; echo 'lang=\'' . OCP\Config::getUserValue($user, 'core', 'lang', 'en') . '\';';