/** * @param string $script */ public function doFind($script) { $theme_dir = 'themes/' . $this->theme . '/'; if (strpos($script, '3rdparty') === 0 && $this->appendIfExist($this->thirdpartyroot, $script . '.js')) { return; } if (strpos($script, '/l10n/') !== false) { // For language files we try to load them all, so themes can overwrite // single l10n strings without having to translate all of them. $found = 0; $found += $this->appendIfExist($this->serverroot, 'core/' . $script . '.js'); $found += $this->appendIfExist($this->serverroot, $theme_dir . 'core/' . $script . '.js'); $found += $this->appendIfExist($this->serverroot, $script . '.js'); $found += $this->appendIfExist($this->serverroot, $theme_dir . $script . '.js'); $found += $this->appendIfExist($this->serverroot, $theme_dir . 'apps/' . $script . '.js'); if ($found) { return; } } else { if ($this->appendIfExist($this->serverroot, $theme_dir . 'apps/' . $script . '.js') || $this->appendIfExist($this->serverroot, $theme_dir . $script . '.js') || $this->appendIfExist($this->serverroot, $script . '.js') || $this->appendIfExist($this->serverroot, $theme_dir . 'core/' . $script . '.js') || $this->appendIfExist($this->serverroot, 'core/' . $script . '.js')) { return; } } $app = substr($script, 0, strpos($script, '/')); $script = substr($script, strpos($script, '/') + 1); $app_path = \OC_App::getAppPath($app); $app_url = \OC_App::getAppWebPath($app); // missing translations files fill be ignored if (strpos($script, 'l10n/') === 0) { $this->appendIfExist($app_path, $script . '.js', $app_url); return; } $this->append($app_path, $script . '.js', $app_url); }
/** * @PublicPage * @NoCSRFRequired * * @return TemplateResponse */ public function generateFileURL($file) { $url = sha1($file . mt_rand()); $app_path = \OC_App::getAppPath("libreonline"); $tmp_path = $app_path . '/tmp'; //FIXME: We should use owncloud api here. copy("/var/www/owncloud/data/" . $this->userId . "/files{$file}", "{$tmp_path}/{$url}"); $uri = \OC_App::getAppWebPath('libreonline') . "/tmp/{$url}"; return $uri; }
/** * @param string $style */ public function doFind($style) { if (strpos($style, '3rdparty') === 0 && $this->appendIfExist($this->thirdpartyroot, $style . '.css') || $this->appendIfExist($this->serverroot, $style . '.css') || $this->appendIfExist($this->serverroot, 'core/' . $style . '.css')) { return; } $app = substr($style, 0, strpos($style, '/')); $style = substr($style, strpos($style, '/') + 1); $app_path = \OC_App::getAppPath($app); $app_url = \OC_App::getAppWebPath($app); $this->append($app_path, $style . '.css', $app_url); }
/** * @PublicPage * @NoCSRFRequired * * @return TemplateResponse */ public function generateFileURL($file) { $url = sha1($file . mt_rand()); $app_path = \OC_App::getAppPath("libreonline"); $tmp_path = $app_path . '/tmp'; $config = \OC::$server->getConfig(); $datadirectory = $config->getSystemValue('datadirectory', false); copy("{$datadirectory}/" . $this->userId . "/files{$file}", "{$tmp_path}/{$url}"); $uri = \OC_App::getAppWebPath('libreonline') . "/tmp/{$url}"; return $uri; }
public function doFind($style) { if (strpos($style, '3rdparty') === 0 && $this->appendIfExist($this->thirdpartyroot, $style . '.css') || $this->appendIfExist($this->serverroot, $style . $this->form_factor . '.css') || $this->appendIfExist($this->serverroot, $style . '.css') || $this->appendIfExist($this->serverroot, 'core/' . $style . $this->form_factor . '.css') || $this->appendIfExist($this->serverroot, 'core/' . $style . '.css')) { return; } $app = substr($style, 0, strpos($style, '/')); $style = substr($style, strpos($style, '/') + 1); $app_path = \OC_App::getAppPath($app); $app_url = \OC_App::getAppWebPath($app); if ($this->appendIfExist($app_path, $style . $this->form_factor . '.css', $app_url) || $this->appendIfExist($app_path, $style . '.css', $app_url)) { return; } throw new \Exception('css file not found: style:' . $style); }
public function doFind($script) { $theme_dir = 'themes/' . $this->theme . '/'; if (strpos($script, '3rdparty') === 0 && $this->appendIfExist($this->thirdpartyroot, $script . '.js') || $this->appendIfExist($this->serverroot, $theme_dir . 'apps/' . $script . $this->form_factor . '.js') || $this->appendIfExist($this->serverroot, $theme_dir . 'apps/' . $script . '.js') || $this->appendIfExist($this->serverroot, $theme_dir . $script . $this->form_factor . '.js') || $this->appendIfExist($this->serverroot, $theme_dir . $script . '.js') || $this->appendIfExist($this->serverroot, $script . $this->form_factor . '.js') || $this->appendIfExist($this->serverroot, $script . '.js') || $this->appendIfExist($this->serverroot, $theme_dir . 'core/' . $script . $this->form_factor . '.js') || $this->appendIfExist($this->serverroot, $theme_dir . 'core/' . $script . '.js') || $this->appendIfExist($this->serverroot, 'core/' . $script . $this->form_factor . '.js') || $this->appendIfExist($this->serverroot, 'core/' . $script . '.js')) { return; } $app = substr($script, 0, strpos($script, '/')); $script = substr($script, strpos($script, '/') + 1); $app_path = \OC_App::getAppPath($app); $app_url = \OC_App::getAppWebPath($app); if ($this->appendIfExist($app_path, $script . $this->form_factor . '.js', $app_url) || $this->appendIfExist($app_path, $script . '.js', $app_url)) { return; } throw new \Exception('js file not found: script:' . $script); }
/** * @param string $script */ public function doFind($script) { $theme_dir = 'themes/' . $this->theme . '/'; if (strpos($script, '3rdparty') === 0 && $this->appendIfExist($this->thirdpartyroot, $script . '.js') || $this->appendIfExist($this->serverroot, $theme_dir . 'apps/' . $script . '.js') || $this->appendIfExist($this->serverroot, $theme_dir . $script . '.js') || $this->appendIfExist($this->serverroot, $script . '.js') || $this->appendIfExist($this->serverroot, $theme_dir . 'core/' . $script . '.js') || $this->appendIfExist($this->serverroot, 'core/' . $script . '.js')) { return; } $app = substr($script, 0, strpos($script, '/')); $script = substr($script, strpos($script, '/') + 1); $app_path = \OC_App::getAppPath($app); $app_url = \OC_App::getAppWebPath($app); // missing translations files fill be ignored if (strpos($script, 'l10n/') === 0) { $this->appendIfExist($app_path, $script . '.js', $app_url); return; } $this->append($app_path, $script . '.js', $app_url); }
<?php /** * Copyright (c) 2011 Jakob Sack <*****@*****.**> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ OCP\App::checkAppEnabled('calendar'); if (substr(OCP\Util::getRequestUri(), 0, strlen(OC_App::getAppWebPath('calendar') . '/caldav.php')) == OC_App::getAppWebPath('calendar') . '/caldav.php') { $baseuri = OC_App::getAppWebPath('calendar') . '/caldav.php'; } // only need authentication apps $RUNTIME_APPTYPES = array('authentication'); OC_App::loadApps($RUNTIME_APPTYPES); // Backends $authBackend = new OC_Connector_Sabre_Auth(); $principalBackend = new OC_Connector_Sabre_Principal(); $caldavBackend = new OC_Connector_Sabre_CalDAV(); $requestBackend = new OC_Connector_Sabre_Request(); // Root nodes $Sabre_CalDAV_Principal_Collection = new Sabre_CalDAV_Principal_Collection($principalBackend); $Sabre_CalDAV_Principal_Collection->disableListing = true; // Disable listening $calendarRoot = new OC_Connector_Sabre_CalDAV_CalendarRoot($principalBackend, $caldavBackend); $calendarRoot->disableListing = true; // Disable listening $nodes = array($Sabre_CalDAV_Principal_Collection, $calendarRoot); // Fire up server $server = new Sabre_DAV_Server($nodes); $server->httpRequest = $requestBackend;
* 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/>. * */ OCP\App::checkAppEnabled('contacts'); if (substr(OCP\Util::getRequestUri(), 0, strlen(OC_App::getAppWebPath('contacts') . '/carddav.php')) === OC_App::getAppWebPath('contacts') . '/carddav.php') { $baseuri = OC_App::getAppWebPath('contacts') . '/carddav.php'; } // only need authentication apps $RUNTIME_APPTYPES = array('authentication'); OC_App::loadApps($RUNTIME_APPTYPES); // Backends $authBackend = new OC_Connector_Sabre_Auth(); $principalBackend = new OC_Connector_Sabre_Principal(); $addressbookbackends = array(); $addressbookbackends[] = new OCA\Contacts\Backend\Database(\OCP\User::getUser()); $carddavBackend = new OCA\Contacts\CardDAV\Backend(array('local', 'shared')); $requestBackend = new OC_Connector_Sabre_Request(); // Root nodes $principalCollection = new Sabre_CalDAV_Principal_Collection($principalBackend); $principalCollection->disableListing = true; // Disable listing
/** * @brief Creates path to an image * @param string $app app * @param string $image image name * @return string the url * * Returns the path to the image. */ public static function imagePath( $app, $image ) { // Read the selected theme from the config file $theme=OC_Config::getValue( "theme" ); // Check if the app is in the app folder if( file_exists( OC::$SERVERROOT."/themes/$theme/apps/$app/img/$image" )) { return OC::$WEBROOT."/themes/$theme/apps/$app/img/$image"; }elseif( file_exists(OC_App::getAppPath($app)."/img/$image" )) { return OC_App::getAppWebPath($app)."/img/$image"; }elseif( !empty( $app ) and file_exists( OC::$SERVERROOT."/themes/$theme/$app/img/$image" )) { return OC::$WEBROOT."/themes/$theme/$app/img/$image"; }elseif( !empty( $app ) and file_exists( OC::$SERVERROOT."/$app/img/$image" )) { return OC::$WEBROOT."/$app/img/$image"; }elseif( file_exists( OC::$SERVERROOT."/themes/$theme/core/img/$image" )) { return OC::$WEBROOT."/themes/$theme/core/img/$image"; }elseif( file_exists( OC::$SERVERROOT."/core/img/$image" )) { return OC::$WEBROOT."/core/img/$image"; }else{ echo('image not found: image:'.$image.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT); die(); } }
private function getsourcepdf(array $data) { ini_set('memory_limit', '1024M'); if (!is_dir(dirname(__DIR__) . '/tmp')) { mkdir(dirname(__DIR__) . '/tmp'); } chmod(dirname(__DIR__) . '/tmp', 0777); $params = ['error' => null, 'errorinfo' => '']; $tmpFileName = 'gantt_export_' . Helper::randomString() . '.pdf'; $tmpFilePath = \OC::$SERVERROOT . \OC_App::getAppWebPath('owncollab_chart') . '/tmp/' . $tmpFileName; $encodeData = 'data=' . urlencode($data['data']) . '&type=pdf'; ob_start(); system('curl --request POST "https://export.dhtmlx.com/gantt" --data "' . $encodeData . '"'); $result = ob_get_clean(); //$params['$encodeData'] = $encodeData; //$params['$tmpFilePath'] = print_r($result, true); //$params['result strlen'] = strlen($result); $print_portrait = isset($data['printconf']['orientation']) && $data['printconf']['orientation'] == 'P'; $print_paper_size = isset($data['printconf']['paper_size']) ? $data['printconf']['paper_size'] : 'A4'; $print_notes = isset($data['pagenotes']) ? $data['pagenotes'] : false; if ($result) { if ($is_save = file_put_contents($tmpFilePath, $result)) { $downloadPath = $this->explodePDF($tmpFilePath, $print_portrait, $print_paper_size, $print_notes); if ($downloadPath) { $params['download'] = $downloadPath; } else { $params['errorinfo'] = 'Error: download path exist'; } } else { $params['errorinfo'] = 'Saved PDF file fail. Temp path: ' . $tmpFilePath; } } else { $params['errorinfo'] = 'Request to export.dhtmlx.com is failed. Or response is empty'; } if (is_array($params)) { return new DataResponse($params); } }
protected static function loadCSSFile() { $app = OC::$REQUESTEDAPP; $file = OC::$REQUESTEDFILE; $app_path = OC_App::getAppPath($app); if (file_exists($app_path . '/' . $file)) { $app_web_path = OC_App::getAppWebPath($app); $filepath = $app_web_path . '/' . $file; $minimizer = new OC_Minimizer_CSS(); $info = array($app_path, $app_web_path, $file); $minimizer->output(array($info), $filepath); } }
\OCP\Util::addStyle(K_APP_NAME, 'styles'); \OCP\Util::addScript(K_APP_NAME, 'go'); ?> <div id="apps2_games"> <div id="controls"> <div id="apps2_games_versions"> <?php echo 'Apps2 - Games'.'<br>v'.\OC_Appconfig::getValue(K_APP_NAME,'installed_version').' / '.\OC_Util::getVersionString(); ?> </div> <div id="apps2_games_back" class="button"><span>List of games</span></div> </div> <div id="apps2_games_list" class="hascontrols"> <ul class="apps2_games_grid"> <?php $myPath = \OC_App::getAppWebPath(K_APP_NAME); foreach ( $_['mainList'] as $myItem ) { echo<<<EOG <li class="apps2_games_item"> <a href="$myPath/{$myItem->js}" class="apps2_games_href"> <div class="apps2_games_item_icon"> <img src="$myPath/{$myItem->ico}"> </div> <div class="apps2_games_item_caption">{$myItem->caption}</div> </a> {$myItem->title} </li> EOG; } ?> </ul>
/** * Creates path to an image * @param string $app app * @param string $image image name * @throws \RuntimeException If the image does not exist * @return string the url * * Returns the path to the image. */ public function imagePath($app, $image) { $cache = $this->cacheFactory->create('imagePath'); $cacheKey = $app . '-' . $image; if ($key = $cache->get($cacheKey)) { return $key; } // Read the selected theme from the config file $theme = \OC_Util::getTheme(); //if a theme has a png but not an svg always use the png $basename = substr(basename($image), 0, -4); $appPath = \OC_App::getAppPath($app); // Check if the app is in the app folder $path = ''; if (file_exists(\OC::$SERVERROOT . "/themes/{$theme}/apps/{$app}/img/{$image}")) { $path = \OC::$WEBROOT . "/themes/{$theme}/apps/{$app}/img/{$image}"; } elseif (!file_exists(\OC::$SERVERROOT . "/themes/{$theme}/apps/{$app}/img/{$basename}.svg") && file_exists(\OC::$SERVERROOT . "/themes/{$theme}/apps/{$app}/img/{$basename}.png")) { $path = \OC::$WEBROOT . "/themes/{$theme}/apps/{$app}/img/{$basename}.png"; } elseif ($appPath && file_exists($appPath . "/img/{$image}")) { $path = \OC_App::getAppWebPath($app) . "/img/{$image}"; } elseif ($appPath && !file_exists($appPath . "/img/{$basename}.svg") && file_exists($appPath . "/img/{$basename}.png")) { $path = \OC_App::getAppWebPath($app) . "/img/{$basename}.png"; } elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/themes/{$theme}/{$app}/img/{$image}")) { $path = \OC::$WEBROOT . "/themes/{$theme}/{$app}/img/{$image}"; } elseif (!empty($app) and !file_exists(\OC::$SERVERROOT . "/themes/{$theme}/{$app}/img/{$basename}.svg") && file_exists(\OC::$SERVERROOT . "/themes/{$theme}/{$app}/img/{$basename}.png")) { $path = \OC::$WEBROOT . "/themes/{$theme}/{$app}/img/{$basename}.png"; } elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/{$app}/img/{$image}")) { $path = \OC::$WEBROOT . "/{$app}/img/{$image}"; } elseif (!empty($app) and !file_exists(\OC::$SERVERROOT . "/{$app}/img/{$basename}.svg") && file_exists(\OC::$SERVERROOT . "/{$app}/img/{$basename}.png")) { $path = \OC::$WEBROOT . "/{$app}/img/{$basename}.png"; } elseif (file_exists(\OC::$SERVERROOT . "/themes/{$theme}/core/img/{$image}")) { $path = \OC::$WEBROOT . "/themes/{$theme}/core/img/{$image}"; } elseif (!file_exists(\OC::$SERVERROOT . "/themes/{$theme}/core/img/{$basename}.svg") && file_exists(\OC::$SERVERROOT . "/themes/{$theme}/core/img/{$basename}.png")) { $path = \OC::$WEBROOT . "/themes/{$theme}/core/img/{$basename}.png"; } elseif (file_exists(\OC::$SERVERROOT . "/core/img/{$image}")) { $path = \OC::$WEBROOT . "/core/img/{$image}"; } if ($path !== '') { $cache->set($cacheKey, $path); return $path; } else { throw new RuntimeException('image not found: image:' . $image . ' webroot:' . \OC::$WEBROOT . ' serverroot:' . \OC::$SERVERROOT); } }
/** * @return string */ public static function WebPath() { $sAppPath = ''; if (\RainLoop\Utils::IsOwnCloud()) { if (\class_exists('OC_App')) { $sAppPath = \rtrim(\trim(\OC_App::getAppWebPath('rainloop')), '\\/') . '/app/'; } if (empty($sAppPath)) { $sUrl = \MailSo\Base\Http::SingletonInstance()->GetUrl(); if ($sUrl && \preg_match('/\\/index\\.php\\/apps\\/rainloop/', $sUrl)) { $sAppPath = \preg_replace('/\\/index\\.php\\/apps\\/rainloop.+$/', '/apps/rainloop/app/', $sUrl); } } } return $sAppPath; }
public static function loadCSSFile($param) { $app = $param['app']; $file = $param['file']; $app_path = OC_App::getAppPath($app); if (file_exists($app_path . '/' . $file)) { $app_web_path = OC_App::getAppWebPath($app); $filepath = $app_web_path . '/' . $file; $minimizer = new OC_Minimizer_CSS(); $info = array($app_path, $app_web_path, $file); $minimizer->output(array($info), $filepath); } }
* along with this program. If not, see <http://www.gnu.org/licenses/> * */ // Set the content type to Javascript header("Content-type: text/javascript"); // Disallow caching header("Cache-Control: no-cache, must-revalidate"); header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Enable l10n support $l = \OC::$server->getL10N('core'); // Enable OC_Defaults support $defaults = new OC_Defaults(); // Get the config $apps_paths = array(); foreach (OC_App::getEnabledApps() as $app) { $apps_paths[$app] = OC_App::getAppWebPath($app); } $config = \OC::$server->getConfig(); $value = $config->getAppValue('core', 'shareapi_default_expire_date', 'no'); $defaultExpireDateEnabled = $value === 'yes' ? true : false; $defaultExpireDate = $enforceDefaultExpireDate = null; if ($defaultExpireDateEnabled) { $defaultExpireDate = (int) $config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); $value = $config->getAppValue('core', 'shareapi_enforce_expire_date', 'no'); $enforceDefaultExpireDate = $value === 'yes' ? true : false; } $outgoingServer2serverShareEnabled = $config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes'; $array = array("oc_debug" => defined('DEBUG') && DEBUG ? 'true' : 'false', "oc_isadmin" => OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false', "oc_webroot" => "\"" . OC::$WEBROOT . "\"", "oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), "datepickerFormatDate" => json_encode($l->getDateFormat()), "dayNames" => json_encode(array((string) $l->t('Sunday'), (string) $l->t('Monday'), (string) $l->t('Tuesday'), (string) $l->t('Wednesday'), (string) $l->t('Thursday'), (string) $l->t('Friday'), (string) $l->t('Saturday'))), "monthNames" => json_encode(array((string) $l->t('January'), (string) $l->t('February'), (string) $l->t('March'), (string) $l->t('April'), (string) $l->t('May'), (string) $l->t('June'), (string) $l->t('July'), (string) $l->t('August'), (string) $l->t('September'), (string) $l->t('October'), (string) $l->t('November'), (string) $l->t('December'))), "firstDay" => json_encode($l->getFirstWeekDay()), "oc_config" => json_encode(array('session_lifetime' => min(\OCP\Config::getSystemValue('session_lifetime', ini_get('session.gc_maxlifetime')), ini_get('session.gc_maxlifetime')), 'session_keepalive' => \OCP\Config::getSystemValue('session_keepalive', true), 'version' => implode('.', OC_Util::getVersion()), 'versionstring' => OC_Util::getVersionString(), 'enable_avatars' => \OC::$server->getConfig()->getSystemValue('enable_avatars', true))), "oc_appconfig" => json_encode(array("core" => array('defaultExpireDateEnabled' => $defaultExpireDateEnabled, 'defaultExpireDate' => $defaultExpireDate, 'defaultExpireDateEnforced' => $enforceDefaultExpireDate, 'enforcePasswordForPublicLink' => \OCP\Util::isPublicLinkPasswordRequired(), 'sharingDisabledForUser' => \OCP\Util::isSharingDisabledForUser(), 'resharingAllowed' => \OCP\Share::isResharingAllowed(), 'remoteShareAllowed' => $outgoingServer2serverShareEnabled, 'federatedCloudShareDoc' => \OC::$server->getURLGenerator()->linkToDocs('user-sharing-federated')))), "oc_defaults" => json_encode(array('entity' => $defaults->getEntity(), 'name' => $defaults->getName(), 'title' => $defaults->getTitle(), 'baseUrl' => $defaults->getBaseUrl(), 'syncClientUrl' => $defaults->getSyncClientUrl(), 'docBaseUrl' => $defaults->getDocBaseUrl(), 'slogan' => $defaults->getSlogan(), 'logoClaim' => $defaults->getLogoClaim(), 'shortFooter' => $defaults->getShortFooter(), 'longFooter' => $defaults->getLongFooter()))); // Allow hooks to modify the output values OC_Hook::emit('\\OCP\\Config', 'js', array('array' => &$array)); // Echo it
/** * @brief Creates path to an image * @param string $app app * @param string $image image name * @return string the url * * Returns the path to the image. */ public static function imagePath($app, $image) { // Read the selected theme from the config file $theme = OC_Util::getTheme(); // Check if the app is in the app folder if (file_exists(OC::$SERVERROOT . "/themes/{$theme}/apps/{$app}/img/{$image}")) { return OC::$WEBROOT . "/themes/{$theme}/apps/{$app}/img/{$image}"; } elseif (file_exists(OC_App::getAppPath($app) . "/img/{$image}")) { return OC_App::getAppWebPath($app) . "/img/{$image}"; } elseif (!empty($app) and file_exists(OC::$SERVERROOT . "/themes/{$theme}/{$app}/img/{$image}")) { return OC::$WEBROOT . "/themes/{$theme}/{$app}/img/{$image}"; } elseif (!empty($app) and file_exists(OC::$SERVERROOT . "/{$app}/img/{$image}")) { return OC::$WEBROOT . "/{$app}/img/{$image}"; } elseif (file_exists(OC::$SERVERROOT . "/themes/{$theme}/core/img/{$image}")) { return OC::$WEBROOT . "/themes/{$theme}/core/img/{$image}"; } elseif (file_exists(OC::$SERVERROOT . "/core/img/{$image}")) { return OC::$WEBROOT . "/core/img/{$image}"; } else { echo 'image not found: image:' . $image . ' webroot:' . OC::$WEBROOT . ' serverroot:' . OC::$SERVERROOT; die; } }
public function __construct($renderas) { // Decide which page we show if ($renderas == 'user') { parent::__construct('core', 'layout.user'); if (in_array(OC_APP::getCurrentApp(), array('settings', 'admin', 'help')) !== false) { $this->assign('bodyid', 'body-settings', false); } else { $this->assign('bodyid', 'body-user', false); } // Add navigation entry $navigation = OC_App::getNavigation(); $this->assign('navigation', $navigation, false); $this->assign('settingsnavigation', OC_App::getSettingsNavigation(), false); foreach ($navigation as $entry) { if ($entry['active']) { $this->assign('application', $entry['name'], false); break; } } } else { if ($renderas == 'guest') { parent::__construct('core', 'layout.guest'); } else { parent::__construct('core', 'layout.base'); } } $apps_paths = array(); foreach (OC_App::getEnabledApps() as $app) { $apps_paths[$app] = OC_App::getAppWebPath($app); } $this->assign('apps_paths', str_replace('\\/', '/', json_encode($apps_paths)), false); // Ugly unescape slashes waiting for better solution if (OC_Config::getValue('installed', false) && !OC_AppConfig::getValue('core', 'remote_core.css', false)) { OC_AppConfig::setValue('core', 'remote_core.css', '/core/minimizer.php'); OC_AppConfig::setValue('core', 'remote_core.js', '/core/minimizer.php'); } // Add the js files $jsfiles = self::findJavascriptFiles(OC_Util::$scripts); $this->assign('jsfiles', array(), false); if (!empty(OC_Util::$core_scripts)) { $this->append('jsfiles', OC_Helper::linkToRemoteBase('core.js', false)); } foreach ($jsfiles as $info) { $root = $info[0]; $web = $info[1]; $file = $info[2]; $this->append('jsfiles', $web . '/' . $file); } // Add the css files $cssfiles = self::findStylesheetFiles(OC_Util::$styles); $this->assign('cssfiles', array()); if (!empty(OC_Util::$core_styles)) { $this->append('cssfiles', OC_Helper::linkToRemoteBase('core.css', false)); } foreach ($cssfiles as $info) { $root = $info[0]; $web = $info[1]; $file = $info[2]; $paths = explode('/', $file); $in_root = false; foreach (OC::$APPSROOTS as $app_root) { if ($root == $app_root['path']) { $in_root = true; break; } } if ($in_root) { $app = $paths[0]; unset($paths[0]); $path = implode('/', $paths); $this->append('cssfiles', OC_Helper::linkTo($app, $path)); } else { $this->append('cssfiles', $web . '/' . $file); } } }
/** * Creates path to an image * @param string $app app * @param string $image image name * @throws \RuntimeException If the image does not exist * @return string the url * * Returns the path to the image. */ public function imagePath($app, $image) { // Read the selected theme from the config file $theme = \OC_Util::getTheme(); //if a theme has a png but not an svg always use the png $basename = substr(basename($image), 0, -4); // Check if the app is in the app folder if (file_exists(\OC::$SERVERROOT . "/themes/{$theme}/apps/{$app}/img/{$image}")) { return \OC::$WEBROOT . "/themes/{$theme}/apps/{$app}/img/{$image}"; } elseif (!file_exists(\OC::$SERVERROOT . "/themes/{$theme}/apps/{$app}/img/{$basename}.svg") && file_exists(\OC::$SERVERROOT . "/themes/{$theme}/apps/{$app}/img/{$basename}.png")) { return \OC::$WEBROOT . "/themes/{$theme}/apps/{$app}/img/{$basename}.png"; } elseif (file_exists(\OC_App::getAppPath($app) . "/img/{$image}")) { return \OC_App::getAppWebPath($app) . "/img/{$image}"; } elseif (!file_exists(\OC_App::getAppPath($app) . "/img/{$basename}.svg") && file_exists(\OC_App::getAppPath($app) . "/img/{$basename}.png")) { return \OC_App::getAppPath($app) . "/img/{$basename}.png"; } elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/themes/{$theme}/{$app}/img/{$image}")) { return \OC::$WEBROOT . "/themes/{$theme}/{$app}/img/{$image}"; } elseif (!empty($app) and !file_exists(\OC::$SERVERROOT . "/themes/{$theme}/{$app}/img/{$basename}.svg") && file_exists(\OC::$SERVERROOT . "/themes/{$theme}/{$app}/img/{$basename}.png")) { return \OC::$WEBROOT . "/themes/{$theme}/{$app}/img/{$basename}.png"; } elseif (!empty($app) and file_exists(\OC::$SERVERROOT . "/{$app}/img/{$image}")) { return \OC::$WEBROOT . "/{$app}/img/{$image}"; } elseif (!empty($app) and !file_exists(\OC::$SERVERROOT . "/{$app}/img/{$basename}.svg") && file_exists(\OC::$SERVERROOT . "/{$app}/img/{$basename}.png")) { return \OC::$WEBROOT . "/{$app}/img/{$basename}.png"; } elseif (file_exists(\OC::$SERVERROOT . "/themes/{$theme}/core/img/{$image}")) { return \OC::$WEBROOT . "/themes/{$theme}/core/img/{$image}"; } elseif (!file_exists(\OC::$SERVERROOT . "/themes/{$theme}/core/img/{$basename}.svg") && file_exists(\OC::$SERVERROOT . "/themes/{$theme}/core/img/{$basename}.png")) { return \OC::$WEBROOT . "/themes/{$theme}/core/img/{$basename}.png"; } elseif (file_exists(\OC::$SERVERROOT . "/core/img/{$image}")) { return \OC::$WEBROOT . "/core/img/{$image}"; } else { throw new RuntimeException('image not found: image:' . $image . ' webroot:' . \OC::$WEBROOT . ' serverroot:' . \OC::$SERVERROOT); } }