<?php /** * Copyright (c) 2011, Robin Appelman <*****@*****.**> * 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_Util::checkAdminUser(); OC_Util::addStyle("settings", "settings"); OC_Util::addScript("settings", "admin"); OC_Util::addScript("settings", "log"); OC_App::setActiveNavigationEntry("admin"); $tmpl = new OC_Template('settings', 'admin', 'user'); $forms = OC_App::getForms('admin'); $entries = OC_Log_Owncloud::getEntries(3); function compareEntries($a, $b) { return $b->time - $a->time; } usort($entries, 'compareEntries'); $tmpl->assign('loglevel', OC_Config::getValue("loglevel", 2)); $tmpl->assign('entries', $entries); $tmpl->assign('forms', array()); foreach ($forms as $form) { $tmpl->append('forms', $form); } $tmpl->printPage();
/** * @brief Proceeds the template * @returns content * * This function proceeds the template. If $this->renderas is set, it will * will produce a full page. */ public function fetchPage() { $data = $this->_fetch(); if ($this->renderas) { // Decide which page we show if ($this->renderas == "user") { $page = new OC_Template("core", "layout.user"); $page->assign('searchurl', OC_Helper::linkTo('search', 'index.php')); if (array_search(OC_APP::getCurrentApp(), array('settings', 'admin', 'help')) !== false) { $page->assign('bodyid', 'body-settings'); } else { $page->assign('bodyid', 'body-user'); } // Add navigation entry $page->assign("navigation", OC_App::getNavigation()); $page->assign("settingsnavigation", OC_App::getSettingsNavigation()); } else { $page = new OC_Template("core", "layout.guest"); } // Add the css and js files foreach (OC_Util::$scripts as $script) { if (is_file(OC::$SERVERROOT . "/apps/{$script}.js")) { $page->append("jsfiles", OC::$WEBROOT . "/apps/{$script}.js"); } elseif (is_file(OC::$SERVERROOT . "/{$script}.js")) { $page->append("jsfiles", OC::$WEBROOT . "/{$script}.js"); } else { $page->append("jsfiles", OC::$WEBROOT . "/core/{$script}.js"); } } foreach (OC_Util::$styles as $style) { if (is_file(OC::$SERVERROOT . "/apps/{$style}.css")) { $page->append("cssfiles", OC::$WEBROOT . "/apps/{$style}.css"); } elseif (is_file(OC::$SERVERROOT . "/{$style}.css")) { $page->append("cssfiles", OC::$WEBROOT . "/{$style}.css"); } else { $page->append("cssfiles", OC::$WEBROOT . "/core/{$style}.css"); } } // Add custom headers $page->assign('headers', $this->headers); foreach (OC_Util::$headers as $header) { $page->append('headers', $header); } // Add css files and js files $page->assign("content", $data); return $page->fetchPage(); } else { return $data; } }
private function printSongs($songs, $artistName = false, $albumName = false) { header('Content-Type: text/xml'); $tmpl = new \OC_Template('media', 'ampache/songs'); foreach ($songs as $song) { $songData = array(); if ($artistName) { $songData['artist_name'] = xmlentities($artistName); } else { $songData['artist_name'] = xmlentities($this->collection->getArtistName($song['song_artist'])); } if ($albumName) { $songData['album_name'] = xmlentities($albumName); } else { $songData['album_name'] = xmlentities($this->collection->getAlbumName($song['song_album'])); } $songData['id'] = $song['song_id']; $songData['name'] = xmlentities($song['song_name']); $songData['artist'] = $song['song_artist']; $songData['album'] = $song['song_album']; $songData['length'] = $song['song_length']; $songData['track'] = $song['song_track']; $songData['size'] = $song['song_size']; $url = \OCP\Util::linkToRemote('ampache') . 'server/xml.server.php/?action=play&song=' . $songData['id'] . '&auth=' . $_GET['auth']; $songData['url'] = xmlentities($url); $tmpl->append('songs', $songData); } $tmpl->printPage(); }
/** * @brief Proceeds the template * @returns content * * This function proceeds the template. If $this->renderas is set, it * will produce a full page. */ public function fetchPage() { $data = $this->_fetch(); if ($this->renderas) { // Decide which page we show if ($this->renderas == "user") { $page = new OC_Template("core", "layout.user"); $page->assign('searchurl', OC_Helper::linkTo('search', 'index.php')); if (array_search(OC_APP::getCurrentApp(), array('settings', 'admin', 'help')) !== false) { $page->assign('bodyid', 'body-settings'); } else { $page->assign('bodyid', 'body-user'); } // Add navigation entry $navigation = OC_App::getNavigation(); $page->assign("navigation", $navigation); $page->assign("settingsnavigation", OC_App::getSettingsNavigation()); foreach ($navigation as $entry) { if ($entry['active']) { $page->assign('application', $entry['name']); break; } } } else { $page = new OC_Template("core", "layout.guest"); } // Read the selected theme from the config file $theme = OC_Config::getValue("theme"); // Read the detected formfactor and use the right file name. $fext = $this->getFormFactorExtension(); // Add the core js files or the js files provided by the selected theme foreach (OC_Util::$scripts as $script) { // Is it in 3rd party? if ($page->appendIfExist('jsfiles', OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $script . '.js')) { // Is it in apps and overwritten by the theme? } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/apps/{$script}{$fext}.js")) { } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/apps/{$script}.js")) { // Is it part of an app? } elseif ($page->appendIfExist('jsfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/{$script}{$fext}.js")) { } elseif ($page->appendIfExist('jsfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/{$script}.js")) { // Is it in the owncloud root but overwritten by the theme? } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/{$script}{$fext}.js")) { } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/{$script}.js")) { // Is it in the owncloud root ? } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "{$script}{$fext}.js")) { } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "{$script}.js")) { // Is in core but overwritten by a theme? } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/core/{$script}{$fext}.js")) { } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/core/{$script}.js")) { // Is it in core? } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/{$script}{$fext}.js")) { } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/{$script}.js")) { } else { echo 'js file not found: script:' . $script . ' formfactor:' . $fext . ' webroot:' . OC::$WEBROOT . ' serverroot:' . OC::$SERVERROOT; die; } } // Add the css files foreach (OC_Util::$styles as $style) { // is it in 3rdparty? if ($page->appendIfExist('cssfiles', OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $style . '.css')) { // or in apps? } elseif ($page->appendIfExist('cssfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/{$style}{$fext}.css")) { } elseif ($page->appendIfExist('cssfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/{$style}.css")) { // or in the owncloud root? } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "{$style}{$fext}.css")) { } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "{$style}.css")) { // or in core ? } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/{$style}{$fext}.css")) { } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/{$style}.css")) { } else { echo 'css file not found: style:' . $script . ' formfactor:' . $fext . ' webroot:' . OC::$WEBROOT . ' serverroot:' . OC::$SERVERROOT; die; } } // Add the theme css files. you can override the default values here if (!empty($theme)) { foreach (OC_Util::$styles as $style) { if ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/apps/{$style}{$fext}.css")) { } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/apps/{$style}.css")) { } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/{$style}{$fext}.css")) { } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/{$style}.css")) { } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/core/{$style}{$fext}.css")) { } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/core/{$style}.css")) { } } } // Add custom headers $page->assign('headers', $this->headers); foreach (OC_Util::$headers as $header) { $page->append('headers', $header); } // Add css files and js files $page->assign("content", $data); return $page->fetchPage(); } else { return $data; } }