예제 #1
0
 function search($query)
 {
     $addressbooks = OC_Contacts_Addressbook::all(OCP\USER::getUser(), 1);
     // 		if(count($calendars)==0 || !OCP\App::isEnabled('contacts')){
     // 			//return false;
     // 		}
     // NOTE: Does the following do anything
     $results = array();
     $searchquery = array();
     if (substr_count($query, ' ') > 0) {
         $searchquery = explode(' ', $query);
     } else {
         $searchquery[] = $query;
     }
     $l = new OC_l10n('contacts');
     foreach ($addressbooks as $addressbook) {
         $vcards = OC_Contacts_VCard::all($addressbook['id']);
         foreach ($vcards as $vcard) {
             if (substr_count(strtolower($vcard['fullname']), strtolower($query)) > 0) {
                 $link = OCP\Util::linkTo('contacts', 'index.php') . '?id=' . urlencode($vcard['id']);
                 $results[] = new OC_Search_Result($vcard['fullname'], '', $link, $l->t('Contact'));
                 //$name,$text,$link,$type
             }
         }
     }
     return $results;
 }
예제 #2
0
 public function search($query)
 {
     $unescape = function ($value) {
         return strtr($value, array('\\,' => ',', '\\;' => ';'));
     };
     $searchresults = array();
     $results = \OCP\Contacts::search($query, array('N', 'FN', 'EMAIL', 'NICKNAME', 'ORG'));
     $l = new \OC_l10n('contacts');
     foreach ($results as $result) {
         $link = \OCP\Util::linkToRoute('contacts_index') . '#' . $result['id'];
         $props = array();
         $display = isset($result['FN']) && $result['FN'] ? $result['FN'] : null;
         foreach (array('EMAIL', 'NICKNAME', 'ORG') as $searchvar) {
             if (isset($result[$searchvar]) && $result[$searchvar]) {
                 if (is_array($result[$searchvar])) {
                     $result[$searchvar] = array_filter($result[$searchvar]);
                 }
                 $prop = is_array($result[$searchvar]) ? implode(',', $result[$searchvar]) : $result[$searchvar];
                 $props[] = $prop;
                 $display = $display ?: $result[$searchvar];
             }
         }
         $props = array_map($unescape, $props);
         $searchresults[] = new \OC_Search_Result($display, implode(', ', $props), $link, (string) $l->t('Contact'), null);
         //$name,$text,$link,$type
     }
     return $searchresults;
 }
예제 #3
0
/**
 * Copyright (c) 2011 Marvin Thomas Rabe <*****@*****.**>
 * Copyright (c) 2011 Arthur Schiwon <*****@*****.**>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
function bookmarklet()
{
    $l = new OC_l10n('bookmarks');
    $blet = "javascript:(function(){var a=window,b=document,c=encodeURIComponent,e=c(document.title),d=a.open('";
    $blet .= OCP\Util::linkToAbsolute('bookmarks', 'addBm.php');
    $blet .= "?output=popup&url='+c(b.location)+'&title='+e,'bkmk_popup','left='+((a.screenX||a.screenLeft)+10)+',top='+((a.screenY||a.screenTop)+10)+',height=400px,width=550px,resizable=1,alwaysRaised=1');a.setTimeout(function(){d.focus()},300);})();";
    $help_msg = $l->t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage quickly:');
    return '<div class="bkm_hint">' . $help_msg . '</div><br /><a class="button bookmarklet" href="' . $blet . '">' . $l->t('Add to ownCloud') . '</a>';
}
예제 #4
0
 function search($query)
 {
     $calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), true);
     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 = OC_Calendar_App::getTimezone();
     $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;
 }
예제 #5
0
 function search($query)
 {
     $results = array();
     if (substr_count($query, ' ') > 0) {
         $search_words = explode(' ', $query);
     } else {
         $search_words = $query;
     }
     $db = \OC::$server->getDb();
     $user = \OCP\User::getUser();
     $bookmarks = Bookmarks::findBookmarks($user, $db, 0, 'id', $search_words, false);
     $l = new \OC_l10n('bookmarks');
     //resulttype can't be localized, javascript relies on that type
     foreach ($bookmarks as $bookmark) {
         $results[] = new \OC_Search_Result($bookmark['title'], $bookmark['title'], $bookmark['url'], (string) $l->t('Bookm.'));
     }
     return $results;
 }
예제 #6
0
 function search($query)
 {
     $l = OC_L10N::get('bookmarks');
     $results = array();
     $search_words = array();
     if (substr_count($query, ' ') > 0) {
         $search_words = explode(' ', $query);
     } else {
         $search_words = $query;
     }
     $bookmarks = OC_Bookmarks_Bookmarks::searchBookmarks($search_words);
     $l = new OC_l10n('bookmarks');
     //resulttype can't be localized, javascript relies on that type
     foreach ($bookmarks as $bookmark) {
         $results[] = new OC_Search_Result($bookmark['title'], $bookmark['title'], $bookmark['url'], (string) $l->t('Bookm.'), null);
     }
     return $results;
 }
예제 #7
0
 function search($query)
 {
     if (!OCP\App::isEnabled('news')) {
         return array();
     }
     $feedMapper = new OCA\News\FeedMapper(OCP\USER::getUser());
     $results = array();
     if ($feedMapper->feedCount() > 0) {
         $allFeeds = $feedMapper->findAll();
         $l = new OC_l10n('news');
         foreach ($allFeeds as $feed) {
             if (substr_count(strtolower($feed['title']), strtolower($query)) > 0) {
                 $link = OCP\Util::linkTo('news', 'index.php') . '?feedid=' . urlencode($feed['id']);
                 $results[] = new OC_Search_Result($feed['title'], '', $link, (string) $l->t('News'));
             }
         }
     }
     return $results;
 }
예제 #8
0
 function search($query)
 {
     $addressbooks = OC_Contacts_Addressbook::all(OCP\USER::getUser(), 1);
     if (count($addressbooks) == 0 || !OCP\App::isEnabled('contacts')) {
         return array();
     }
     $results = array();
     $l = new OC_l10n('contacts');
     foreach ($addressbooks as $addressbook) {
         $vcards = OC_Contacts_VCard::all($addressbook['id']);
         foreach ($vcards as $vcard) {
             if (substr_count(strtolower($vcard['fullname']), strtolower($query)) > 0) {
                 $link = OCP\Util::linkTo('contacts', 'index.php') . '&id=' . urlencode($vcard['id']);
                 $results[] = new OC_Search_Result($vcard['fullname'], '', $link, (string) $l->t('Contact'));
                 //$name,$text,$link,$type
             }
         }
     }
     return $results;
 }
예제 #9
0
 function search($query)
 {
     $unescape = function ($value) {
         return strtr($value, array('\\,' => ',', '\\;' => ';'));
     };
     $app = new App();
     $searchresults = array();
     $results = \OCP\Contacts::search($query, array('N', 'FN', 'EMAIL', 'NICKNAME', 'ORG'));
     $l = new \OC_l10n('contacts');
     foreach ($results as $result) {
         $link = \OCP\Util::linkToRoute('contacts_index') . '#' . $result['id'];
         $props = array();
         foreach (array('EMAIL', 'NICKNAME', 'ORG') as $searchvar) {
             if (isset($result[$searchvar]) && count($result[$searchvar]) > 0 && strlen($result[$searchvar][0]) > 3) {
                 $props = array_merge($props, $result[$searchvar]);
             }
         }
         $props = array_map($unescape, $props);
         $searchresults[] = new \OC_Search_Result($result['FN'], implode(', ', $props), $link, (string) $l->t('Contact'));
         //$name,$text,$link,$type
     }
     return $searchresults;
 }
예제 #10
0
 /**
  * Constructor
  *
  * @param array $data
  * @return \OCA\Calendar\Search\Event
  */
 public function __construct(array $data = null)
 {
     // set default properties
     $this->id = $data['id'];
     $this->name = $data['summary'];
     $this->link = \OCP\Util::linkTo('calendar', 'index.php') . '?showevent=' . urlencode($data['id']);
     // do calendar-specific setup
     $l = new \OC_l10n('calendar');
     $calendar_data = \Sabre\VObject\Reader::read($data['calendardata']);
     $vevent = $calendar_data->VEVENT;
     // get start time
     $dtstart = $vevent->DTSTART;
     $start_dt = $dtstart->getDateTime();
     $start_dt->setTimezone($this->getUserTimezone());
     $this->start_time = $start_dt->format('r');
     // get end time
     $dtend = \OC_Calendar_Object::getDTEndFromVEvent($vevent);
     $end_dt = $dtend->getDateTime();
     $end_dt->setTimezone($this->getUserTimezone());
     $this->end_time = $end_dt->format('r');
     // create text description
     if (!$dtstart->hasTime()) {
         $end_dt->modify('-1 sec');
         if ($start_dt->format('d.m.Y') != $end_dt->format('d.m.Y')) {
             $this->text = $l->t('Date') . ': ' . $start_dt->format('d.m.Y') . ' - ' . $end_dt->format('d.m.Y');
         } else {
             $this->text = $l->t('Date') . ': ' . $start_dt->format('d.m.Y');
         }
     } else {
         $this->text = $l->t('Date') . ': ' . $start_dt->format('d.m.y H:i') . ' - ' . $end_dt->format('d.m.y H:i');
     }
     // set last modified time
     $this->modified = date('r', $data['lastmodified']);
     // set repeating property
     $this->repeating = (bool) $data['repeating'];
 }
예제 #11
0
<?php

// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
OCP\JSON::checkAppEnabled('bookmarks');
$l = new OC_l10n('bookmarks');
if (empty($_FILES)) {
    OCP\Util::writeLog('bookmarks', "No file provided for import", \OCP\Util::WARN);
    $error[] = $l->t('No file provided for import');
} elseif (isset($_FILES['bm_import'])) {
    $file = $_FILES['bm_import']['tmp_name'];
    if ($_FILES['bm_import']['type'] == 'text/html') {
        $error = OC_Bookmarks_Bookmarks::importFile($file);
        if (empty($errors)) {
            OCP\JSON::success();
            //force charset as not set by OC_JSON
            header('Content-Type: application/json; charset=utf-8');
            exit;
        }
    } else {
        $error[] = $l->t('Unsupported file type for import');
    }
}
OC_JSON::error(array('data' => $error));
//force charset as not set by OC_JSON
header('Content-Type: application/json; charset=utf-8');
exit;
예제 #12
0
<?php

require_once \OC_App::getAppPath('news') . '/lib/feedtypes.php';
$l = new OC_l10n('news');
$feed = isset($_['feed']) ? $_['feed'] : null;
$feedTitle = $feed->getTitle();
$feedId = $feed->getId();
$unreadItemsCount = isset($_['unreadItemsCount']) ? $_['unreadItemsCount'] : null;
$favicon = $feed->getFavicon();
if ($favicon == null) {
    $favicon = OCP\Util::imagePath('core', 'actions/public.svg');
}
$lastViewedFeedId = isset($_['lastViewedFeedId']) ? $_['lastViewedFeedId'] : null;
$lastViewedFeedType = isset($_['lastViewedFeedType']) ? $_['lastViewedFeedType'] : null;
if ($lastViewedFeedType == OCA\News\FeedType::FEED && $lastViewedFeedId == $feedId) {
    $activeClass = 'active';
} else {
    $activeClass = '';
}
echo '<li class="feed ' . $activeClass . '" data-id="' . $feedId . '">';
echo '<a style="background-image: url(' . $favicon . ');" href="#" class="title">' . $feedTitle . '</a>';
echo '<span class="unread_items_counter">' . $unreadItemsCount . '</span>';
echo '<span class="buttons">';
echo '<button class="svg action feeds_delete" title="' . $l->t('Delete feed') . '"></button>';
echo '<button class="svg action feeds_markread" title="' . $l->t('Mark all read') . '"></button>';
echo '</span>';
echo '</li>';
예제 #13
0
<?php

/**
* ownCloud - News app
*
* @author Alessandro Cosentino
* Copyright (c) 2012 - Alessandro Cosentino <*****@*****.**>
* 
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file
* 
*/
OC::$CLASSPATH['OCA\\News\\StatusFlag'] = 'apps/news/lib/item.php';
OC::$CLASSPATH['OCA\\News\\Item'] = 'apps/news/lib/item.php';
OC::$CLASSPATH['OCA\\News\\Collection'] = 'apps/news/lib/collection.php';
OC::$CLASSPATH['OCA\\News\\Feed'] = 'apps/news/lib/feed.php';
OC::$CLASSPATH['OCA\\News\\Folder'] = 'apps/news/lib/folder.php';
OC::$CLASSPATH['OCA\\News\\FeedMapper'] = 'apps/news/lib/feedmapper.php';
OC::$CLASSPATH['OCA\\News\\ItemMapper'] = 'apps/news/lib/itemmapper.php';
OC::$CLASSPATH['OCA\\News\\FolderMapper'] = 'apps/news/lib/foldermapper.php';
OC::$CLASSPATH['OCA\\News\\Utils'] = 'apps/news/lib/utils.php';
OC::$CLASSPATH['OCA\\News\\Backgroundjob'] = 'apps/news/lib/backgroundjob.php';
OCP\Backgroundjob::addRegularTask('OCA\\News\\Backgroundjob', 'run');
$l = new OC_l10n('news');
OCP\App::addNavigationEntry(array('id' => 'news', 'order' => 74, 'href' => OC_Helper::linkTo('news', 'index.php'), 'icon' => OC_Helper::imagePath('news', 'icon.svg'), 'name' => $l->t('News')));
 /**
  @NoAdminRequired
 * 
 * @return \OCP\AppFramework\Http\JSONResponse
 */
 public function importBookmark()
 {
     $l = new \OC_l10n('bookmarks');
     $full_input = $this->request->getUploadedFile("bm_import");
     if (empty($full_input)) {
         \OCP\Util::writeLog('bookmarks', "No file provided for import", \OCP\Util::WARN);
         $error = array();
         $error[] = $l->t('No file provided for import');
     } else {
         $error = array();
         $file = $full_input['tmp_name'];
         if ($full_input['type'] == 'text/html') {
             $error = Bookmarks::importFile($this->userId, $this->db, $file);
             if (empty($error)) {
                 return new JSONResponse(array('status' => 'success'));
             }
         } else {
             $error[] = $l->t('Unsupported file type for import');
         }
     }
     return new JSONResponse(array('status' => 'error', 'data' => $error));
 }
예제 #15
0
<?php

/**
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
$l = new OC_l10n('collaboration');
OC::$CLASSPATH['OC_Collaboration_Project'] = 'collaboration/lib/projects.php';
OC::$CLASSPATH['OC_Collaboration_Post'] = 'collaboration/lib/posts.php';
OC::$CLASSPATH['OC_Collaboration_Time'] = 'collaboration/lib/time.php';
OC::$CLASSPATH['OC_Collaboration_Comment'] = 'collaboration/lib/comments.php';
OC::$CLASSPATH['OC_Collaboration_Task'] = 'collaboration/lib/tasks.php';
OC::$CLASSPATH['OC_Collaboration_Mail'] = 'collaboration/lib/mail_templates.php';
OC::$CLASSPATH['OC_Collaboration_Hooks'] = 'collaboration/lib/hooks.php';
OC::$CLASSPATH['OC_Collaboration_Skillset'] = 'collaboration/lib/skillset.php';
OC::$CLASSPATH['OC_Collaboration_Report'] = 'collaboration/lib/reports.php';
OC::$CLASSPATH['OC_Collaboration_Calendar'] = 'collaboration/lib/calendar_support.php';
OC_Hook::connect('OC_User', 'post_deleteUser', 'OC_Collaboration_Hooks', 'notifyUserDeletion');
OC_Hook::connect('OCP\\Share', 'post_shared', 'OC_Collaboration_Hooks', 'notifyFileShare');
$gid = "Collaboration Admin";
if (!OC_Group::groupExists($gid)) {
    OC_Group::createGroup($gid);
}
\OCP\App::addNavigationEntry(array('id' => 'collaboration', 'order' => 0, 'href' => \OCP\Util::linkToRoute('collaboration_route', array('rel_path' => '')), 'icon' => \OCP\Util::imagePath('collaboration', 'collaboration.svg'), 'name' => $l->t('Collaboration')));
* License as published by the Free Software Foundation; either 
* 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 Lesser General Public 
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
* 
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
OCP\JSON::checkAppEnabled('collaboration');
$l = new OC_l10n('collaboration');
if (isset($_POST['start']) && isset($_POST['count']) && isset($_POST['project']) && isset($_POST['status']) && isset($_POST['assigned_to']) && isset($_POST['assigned_by'])) {
    if ($_POST['project'] != '' && !OC_Collaboration_Project::isMemberWorkingOnProjectByTitle(OC_User::getUser(), $_POST['project'])) {
        throw new Exception(OC_User::getUser() . ' is trying to access project ' . $_POST['project']);
        OC_JSON::error();
        exit;
    }
    $args = array('assigned_to' => $_POST['assigned_to'] == true ? OC_User::getUser() : NULL, 'assigned_by' => $_POST['assigned_by'] == true ? OC_User::getUser() : NULL, 'project' => $_POST['project'] == '' ? NULL : $_POST['project'], 'status' => $_POST['status'] == '' ? NULL : $_POST['status']);
    $tasks = OC_Collaboration_Task::readTasks($args, $_POST['start'], $_POST['count']);
    $text = '';
    foreach ($tasks as $each) {
        if (!isset($each['tid']) || $each['tid'] == '') {
            break;
        }
        $datetime = OC_Collaboration_Time::convertDBTimeToUITime($each['ending_time']);
        $text .= '<div class="unit">
예제 #17
0
<?php

OCP\App::checkAppEnabled('bookmarks');
$l = new OC_l10n('bookmarks');
if (isset($_FILES['bm_import'])) {
    $error = array();
    $file = $_FILES['bm_import']['tmp_name'];
    if ($_FILES['bm_import']['type'] == 'text/html') {
        $error = OC_Bookmarks_Bookmarks::importFile($file);
        if (empty($errors)) {
            OCP\JSON::success();
            //force charset as not set by OC_JSON
            header('Content-Type: application/json; charset=utf-8');
            exit;
        }
    } else {
        $error[] = $l->t('Unsupported file type for import');
    }
}
OC_JSON::error(array('data' => $error));
//force charset as not set by OC_JSON
header('Content-Type: application/json; charset=utf-8');
exit;
예제 #18
0
<?php

/**
* Copyright (c) 2011 Marvin Thomas Rabe <*****@*****.**>
* Copyright (c) 2011 Arthur Schiwon <*****@*****.**>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
OC::$CLASSPATH['OC_Bookmarks_Bookmarks'] = 'apps/bookmarks/lib/bookmarks.php';
OC::$CLASSPATH['OC_Search_Provider_Bookmarks'] = 'apps/bookmarks/lib/search.php';
OCP\App::register(array('order' => 70, 'id' => 'bookmark', 'name' => 'Bookmarks'));
$l = new OC_l10n('bookmarks');
OCP\App::addNavigationEntry(array('id' => 'bookmarks_index', 'order' => 70, 'href' => OCP\Util::linkTo('bookmarks', 'index.php'), 'icon' => OCP\Util::imagePath('bookmarks', 'bookmarks.png'), 'name' => $l->t('Bookmarks')));
OCP\App::registerPersonal('bookmarks', 'settings');
OCP\Util::addscript('bookmarks', 'bookmarksearch');
OC_Search::registerProvider('OC_Search_Provider_Bookmarks');
예제 #19
0
<?php

require_once \OC_App::getAppPath('news') . '/lib/feedtypes.php';
$l = new OC_l10n('news');
$folder = isset($_['folder']) ? $_['folder'] : null;
$folderId = $folder->getId();
$folderName = $folder->getName();
if ($folder->getOpened()) {
    $openedClass = 'open';
} else {
    $openedClass = 'collapsed';
}
$lastViewedFeedId = isset($_['lastViewedFeedId']) ? $_['lastViewedFeedId'] : null;
$lastViewedFeedType = isset($_['lastViewedFeedType']) ? $_['lastViewedFeedType'] : null;
if ($lastViewedFeedType == OCA\News\FeedType::FOLDER && $lastViewedFeedId == $folderId) {
    $activeClass = 'active';
} else {
    $activeClass = '';
}
echo '<li class="folder ' . $openedClass . ' ' . $activeClass . ' all_read" data-id="' . $folderId . '">';
echo '<button class="collapsable_trigger" title="' . $l->t('Collapse') . '"></button>';
echo '<a href="#" class="title">' . htmlspecialchars($folderName, ENT_QUOTES, 'UTF-8') . '</a>';
echo '<span class="unread_items_counter"></span>';
echo '<span class="buttons">';
echo '<button class="svg action feeds_delete" title="' . $l->t('Delete folder') . '"></button>';
echo '<button class="svg action feeds_edit" title="' . $l->t('Rename folder') . '"></button>';
echo '<button class="svg action feeds_markread" title="' . $l->t('Mark all read') . '"></button>';
echo '</span>';
echo '<ul data-id="' . $folderId . '">';