<?php /** * Copyright (c) 2011 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. */ require_once '../../../lib/base.php'; OC_JSON::checkLoggedIn(); $firstdayofweek = OC_Preferences::getValue(OC_User::getUser(), 'calendar', 'firstdayofweek', "1"); OC_JSON::encodedPrint(array("firstdayofweek" => $firstdayofweek));
echo ' externalapp'; } ?> " href="?appid=<?php echo $app['id']; ?> "><?php echo htmlentities($app['name']); ?> </a> <script type="application/javascript"> appData_<?php echo $app['id']; ?> =<?php OC_JSON::encodedPrint($app, false); ?> ; </script> <?php if (!$app['internal']) { echo '<small class="externalapp list">3rd party</small>'; } ?> </li> <?php } ?> </ul> <div id="rightcontent"> <div class="appinfo">
/** * @brief Encode and print $data in JSON format * @param array $data The data to use * @param string $setContentType the optional content type */ public static function encodedPrint($data, $setContentType = true) { return \OC_JSON::encodedPrint($data, $setContentType); }
$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)); $year = $start_dt->format('Y'); $month = $start_dt->format('n') - 1; // return is 0 based $day = $start_dt->format('j'); $hour = $start_dt->format('G'); if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE) { $hour = 'allday'; } $return_event = array(); foreach (array('id', 'calendarid', 'objecttype', 'repeating') as $prop) { $return_event[$prop] = $event[$prop]; } $return_event['startdate'] = explode('|', $start_dt->format('Y|m|d|H|i')); $return_event['enddate'] = explode('|', $end_dt->format('Y|m|d|H|i')); $return_event['description'] = $event['summary']; if ($hour == 'allday') { $return_event['allday'] = true; } if (isset($return[$year][$month][$day][$hour])) { $return[$year][$month][$day][$hour][] = $return_event; } else { $return[$year][$month][$day][$hour] = array(1 => $return_event); } } OC_JSON::encodedPrint($return);
require_once '../../../lib/base.php'; OC_JSON::checkAppEnabled('files_sharing'); require_once '../lib_share.php'; $userDirectory = "/" . OC_User::getUser() . "/files"; $source = $userDirectory . $_GET['source']; $path = $source; if ($users = OC_Share::getMySharedItem($source)) { for ($i = 0; $i < count($users); $i++) { if ($users[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) { $users[$i]['token'] = OC_Share::getTokenFromSource($source); } } } $source = dirname($source); while ($source != "" && $source != "/" && $source != "." && $source != $userDirectory) { if ($values = OC_Share::getMySharedItem($source)) { $values = array_values($values); $parentUsers = array(); for ($i = 0; $i < count($values); $i++) { if ($values[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) { $values[$i]['token'] = OC_Share::getTokenFromSource($source) . "&path=" . substr($path, strlen($source)); } $parentUsers[basename($source) . "-" . $i] = $values[$i]; } $users = array_merge($users, $parentUsers); } $source = dirname($source); } if (!empty($users)) { OC_JSON::encodedPrint($users); }
<?php /** * ownCloud - Internal Bookmarks plugin * * @author Xavier Beurois * @copyright 2012 Xavier Beurois www.djazz-lab.net * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * 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/>. * */ require_once '../../../lib/base.php'; OC_JSON::checkAppEnabled('internal_bookmarks'); $c = $_POST['c']; $k = OC_IntBks::getItemByTarget($c); if (count($k) > 0) { OC_JSON::encodedPrint($k); }
* 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/>. * */ $RUNTIME_NOAPPS = TRUE; //no apps, yet require_once '../../lib/base.php'; if (!OC_User::isLoggedIn()) { if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="ownCloud Server"'); header('HTTP/1.0 401 Unauthorized'); echo 'Valid credentials must be supplied'; exit; } else { if (!OC_User::checkPassword($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) { exit; } } } $groups = array(); foreach (OC_Group::getGroups() as $i) { // Do some more work here soon $groups[] = array("groupname" => $i); } OC_JSON::encodedPrint($groups);
* @copyright 2011 Hans Bakker hansmbakker+kde@gmail.com * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * 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 Affero General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. * */ $RUNTIME_NOAPPS = TRUE; //no apps, yet require_once '../../lib/base.php'; if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="ownCloud Server"'); header('HTTP/1.0 401 Unauthorized'); echo 'Valid credentials must be supplied'; exit; } else { if (OC_User::checkPassword($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) { OC_JSON::encodedPrint(array("username" => $_SERVER["PHP_AUTH_USER"], "user_valid" => "true")); } else { OC_JSON::encodedPrint(array("username" => $_SERVER["PHP_AUTH_USER"], "user_valid" => "false")); } }
<?php /** * Copyright (c) 2011 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. */ require_once '../../../lib/base.php'; OC_JSON::checkLoggedIn(); $timeformat = OC_Preferences::getValue(OC_User::getUser(), 'calendar', 'timeformat', "24"); OC_JSON::encodedPrint(array("timeformat" => $timeformat)); ?>
* * @author Xavier Beurois * @copyright 2012 Xavier Beurois www.djazz-lab.net * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * 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/>. * */ require_once '../../../lib/base.php'; OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('storage_charts'); $l = new OC_L10N('storage_charts', OC_L10N::findLanguage(array('en', 'fr'))); // Update and save the new configuration if (is_numeric($_POST['s']) && in_array($_POST['k'], array('hu_size', 'hu_size_hus'))) { OC_DLStCharts::setUConfValue($_POST['k'], $_POST['s']); if (strcmp($_POST['k'], 'hu_size') == 0) { OC_JSON::encodedPrint(array('r' => OC_DLStChartsLoader::loadChart('clines_usse', $l))); } else { OC_JSON::encodedPrint(array('r' => OC_DLStChartsLoader::loadChart('chisto_us', $l))); } }
} else { $base = dirname($query); } $query = substr($query, strlen($base)); if ($base != '/') { $query = substr($query, 1); } $queryLen = strlen($query); $query = strtolower($query); // echo "$base - $query"; $files = array(); if (OC_Filesystem::file_exists($base) and OC_Filesystem::is_dir($base)) { $dh = OC_Filesystem::opendir($base); if ($dh) { if (substr($base, -1, 1) != '/') { $base = $base . '/'; } while (($file = readdir($dh)) !== false) { if ($file != "." && $file != "..") { if (substr(strtolower($file), 0, $queryLen) == $query) { $item = $base . $file; if (!$dirOnly or OC_Filesystem::is_dir($item)) { $files[] = (object) array('id' => $item, 'label' => $item, 'name' => $item); } } } } } } OC_JSON::encodedPrint($files);
/** * ownCloud - Compress plugin * * @author Xavier Beurois * @copyright 2012 Xavier Beurois www.djazz-lab.net * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * 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/>. * */ $app_id = 'compress'; require_once '../../../lib/base.php'; OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('compress'); OC::$CLASSPATH['OC_Compress'] = 'apps/' . $app_id . '/lib/' . $_POST['a'] . '.class.php'; if (OC_Compress::compressTarget($_POST['f'])) { OC_JSON::encodedPrint(array('r' => TRUE)); } else { OC_JSON::encodedPrint(array('r' => FALSE)); }
// calc an offset of 24 hours $offset = 3600 * 24; // calc the string in GMT not localtime and add the offset $expire = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT"; //output the HTTP header header($expire); header('Cache-Control: max-age=3600, must-revalidate'); header('Pragma: public'); header('Accept-Ranges: bytes'); header('Content-Length: ' . OC_Filesystem::filesize($arguments['path'])); $gmt_mtime = gmdate('D, d M Y H:i:s', OC_Filesystem::filemtime($arguments['path'])) . ' GMT'; header("Last-Modified: " . $gmt_mtime); OC_Filesystem::readfile($arguments['path']); exit; case 'find_music': OC_JSON::encodedPrint(findMusic()); exit; } } function findMusic($path = '') { $music = array(); $dh = OC_Filesystem::opendir($path); if ($dh) { while ($filename = readdir($dh)) { if ($filename[0] != '.') { $file = $path . '/' . $filename; if (OC_Filesystem::is_dir($file)) { $music = array_merge($music, findMusic($file)); } else { if (OC_MEDIA_SCANNER::isMusic($filename)) {
<?php /** * ownCloud * * @author Robin Appelman * @copyright 2010 Robin Appelman icewind1991@gmail.com * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * 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 Affero General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. * */ // Check if we are a user OC_JSON::checkLoggedIn(); $query = isset($_GET['query']) ? $_GET['query'] : ''; if ($query) { $result = \OC::$server->getSearch()->search($query); OC_JSON::encodedPrint($result); } else { echo 'false'; }
/** * respond to a call * @param OC_OCS_Result $result * @param string $format the format xml|json */ public static function respond($result, $format = 'xml') { // Send 401 headers if unauthorised if ($result->getStatusCode() === self::RESPOND_UNAUTHORISED) { header('WWW-Authenticate: Basic realm="Authorisation Required"'); header('HTTP/1.0 401 Unauthorized'); } $response = array('ocs' => array('meta' => $result->getMeta(), 'data' => $result->getData())); if ($format == 'json') { OC_JSON::encodedPrint($response); } else { if ($format == 'xml') { header('Content-type: text/xml; charset=UTF-8'); $writer = new XMLWriter(); $writer->openMemory(); $writer->setIndent(true); $writer->startDocument(); self::toXML($response, $writer); $writer->endDocument(); echo $writer->outputMemory(true); } } }
<?php /** * Copyright (c) 2011 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. */ require_once '../../../lib/base.php'; OC_JSON::checkLoggedIn(); $duration = OC_Preferences::getValue(OC_User::getUser(), 'calendar', 'duration', "60"); OC_JSON::encodedPrint(array("duration" => $duration)); ?>
* 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/>. * */ require_once '../../../lib/base.php'; OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('storage_charts'); if (in_array($_POST['k'], array('hu_size', 'sc_sort', 'hu_size_hus'))) { switch ($_POST['o']) { case 'set': $i = NULL; if (is_array($_POST['i'])) { $i = serialize($_POST['i']); } elseif (is_numeric($_POST['i'])) { $i = $_POST['i']; } OC_DLStCharts::setUConfValue($_POST['k'], $i); break; case 'get': $v = OC_DLStCharts::getUConfValue($_POST['k']); OC_JSON::encodedPrint(array('r' => $v['uc_val'])); break; } }