/** * Check if a new version is available */ public static function check() { OC_Appconfig::setValue('core', 'lastupdatedat', microtime(true)); if (OC_Appconfig::getValue('core', 'installedat', '') == '') { OC_Appconfig::setValue('core', 'installedat', microtime(true)); } $updaterurl = 'http://apps.owncloud.com/updater.php'; $version = OC_Util::getVersion(); $version['installed'] = OC_Appconfig::getValue('core', 'installedat'); $version['updated'] = OC_Appconfig::getValue('core', 'lastupdatedat'); $version['updatechannel'] = 'stable'; $version['edition'] = OC_Util::getEditionString(); $versionstring = implode('x', $version); //fetch xml data from updater $url = $updaterurl . '?version=' . $versionstring; $xml = @file_get_contents($url); if ($xml == FALSE) { return array(); } $data = @simplexml_load_string($xml); $tmp = array(); $tmp['version'] = $data->version; $tmp['versionstring'] = $data->versionstring; $tmp['url'] = $data->url; $tmp['web'] = $data->web; return $tmp; }
/** * Check if a new version is available */ public static function check() { OC_Appconfig::setValue('core', 'lastupdatedat', microtime(true)); if (OC_Appconfig::getValue('core', 'installedat', '') == '') { OC_Appconfig::setValue('core', 'installedat', microtime(true)); } $updaterurl = 'http://apps.owncloud.com/updater.php'; $version = OC_Util::getVersion(); $version['installed'] = OC_Appconfig::getValue('core', 'installedat'); $version['updated'] = OC_Appconfig::getValue('core', 'lastupdatedat'); $version['updatechannel'] = 'stable'; $version['edition'] = OC_Util::getEditionString(); $versionstring = implode('x', $version); //fetch xml data from updater $url = $updaterurl . '?version=' . $versionstring; // set a sensible timeout of 10 sec to stay responsive even if the update server is down. $ctx = stream_context_create(array('http' => array('timeout' => 10))); $xml = @file_get_contents($url, 0, $ctx); if ($xml == false) { return array(); } $data = @simplexml_load_string($xml); $tmp = array(); $tmp['version'] = $data->version; $tmp['versionstring'] = $data->versionstring; $tmp['url'] = $data->url; $tmp['web'] = $data->web; return $tmp; }
/** * Returns whether the AppStore is enabled (i.e. because the AppStore is disabled for EE) * @return bool */ protected static function isAppstoreEnabled() { if (OC::$server->getConfig()->getSystemValue('appstoreenabled', true) === false or OC_Util::getEditionString() !== '') { return false; } return true; }
public function __construct(array $urlParams = []) { parent::__construct('updater', $urlParams); $container = $this->getContainer(); /** * Controllers */ $container->registerService('UpdateController', function ($c) { return new UpdateController($c->query('AppName'), $c->query('Request'), $c->query('L10N')); }); $container->registerService('BackupController', function ($c) { return new BackupController($c->query('AppName'), $c->query('Request'), $c->query('Config'), $c->query('L10N')); }); $container->registerService('AdminController', function ($c) { return new AdminController($c->query('AppName'), $c->query('Request'), $c->query('Config'), $c->query('L10N')); }); $container->registerService('L10N', function ($c) { return $c->query('ServerContainer')->getL10N($c->query('AppName')); }); $container->registerService('Config', function ($c) { return new Config($c->query('ServerContainer')->getConfig()); }); $container->registerService('Channel', function ($c) { return new Channel($c->query('L10N')); }); //Startup if (\OC_Util::getEditionString() === '') { \OCP\App::registerAdmin('updater', 'admin'); $appPath = $container->query('Config')->getBackupBase(); if (!@file_exists($appPath)) { Helper::mkdir($appPath); } } }
/** * Check if a new version is available * @param string $updaterUrl the url to check, i.e. 'http://apps.owncloud.com/updater.php' * @return array | bool */ public function check($updaterUrl) { // Look up the cache - it is invalidated all 30 minutes if (\OC_Appconfig::getValue('core', 'lastupdatedat') + 1800 > time()) { return json_decode(\OC_Appconfig::getValue('core', 'lastupdateResult'), true); } \OC_Appconfig::setValue('core', 'lastupdatedat', time()); if (\OC_Appconfig::getValue('core', 'installedat', '') == '') { \OC_Appconfig::setValue('core', 'installedat', microtime(true)); } $version = \OC_Util::getVersion(); $version['installed'] = \OC_Appconfig::getValue('core', 'installedat'); $version['updated'] = \OC_Appconfig::getValue('core', 'lastupdatedat'); $version['updatechannel'] = \OC_Util::getChannel(); $version['edition'] = \OC_Util::getEditionString(); $version['build'] = \OC_Util::getBuild(); $versionString = implode('x', $version); //fetch xml data from updater $url = $updaterUrl . '?version=' . $versionString; // set a sensible timeout of 10 sec to stay responsive even if the update server is down. $ctx = stream_context_create(array('http' => array('timeout' => 10))); $xml = @file_get_contents($url, 0, $ctx); if ($xml == false) { return array(); } $data = @simplexml_load_string($xml); $tmp = array(); $tmp['version'] = $data->version; $tmp['versionstring'] = $data->versionstring; $tmp['url'] = $data->url; $tmp['web'] = $data->web; // Cache the result \OC_Appconfig::setValue('core', 'lastupdateResult', json_encode($data)); return $tmp; }
public static function getCapabilities() { $result = array(); list($major, $minor, $micro) = OC_Util::getVersion(); $result['version'] = array('major' => $major, 'minor' => $minor, 'micro' => $micro, 'string' => OC_Util::getVersionString(), 'edition' => OC_Util::getEditionString()); $result['capabilities'] = \OC::$server->getCapabilitiesManager()->getCapabilities(); return new OC_OCS_Result($result); }
public static function getCapabilities($parameters) { $result = array(); list($major, $minor, $micro) = OC_Util::getVersion(); $result['version'] = array('major' => $major, 'minor' => $minor, 'micro' => $micro, 'string' => OC_Util::getVersionString(), 'edition' => OC_Util::getEditionString()); $result['capabilities'] = array('core' => array('pollinterval' => OC_Config::getValue('pollinterval', 60))); return new OC_OCS_Result($result); }
/** * Get the url of the OCS AppStore server. * @return string of the AppStore server * * This function returns the url of the OCS AppStore server. It´s possible * to set it in the config file or it will fallback to the default */ private static function getAppStoreURL() { if(OC_Util::getEditionString()===''){ $default='https://api.owncloud.com/v1'; }else{ $default=''; } $url = OC_Config::getValue('appstoreurl', $default); return($url); }
/** * Returns whether the AppStore is enabled (i.e. because the AppStore is disabled for EE) * * @return bool */ public function isAppStoreEnabled() { // For a regular edition default to true, all others default to false $default = false; if (\OC_Util::getEditionString() === '') { $default = true; } return $this->config->getSystemValue('appstoreenabled', $default) === true; }
/** * Check if a new version is available * * @param string $updaterUrl the url to check, i.e. 'http://apps.owncloud.com/updater.php' * @return array|bool */ public function check($updaterUrl = null) { // Look up the cache - it is invalidated all 30 minutes if ((int) $this->config->getAppValue('core', 'lastupdatedat') + 1800 > time()) { return json_decode($this->config->getAppValue('core', 'lastupdateResult'), true); } if (is_null($updaterUrl)) { $updaterUrl = 'https://updates.owncloud.com/server/'; } $this->config->setAppValue('core', 'lastupdatedat', time()); if ($this->config->getAppValue('core', 'installedat', '') === '') { $this->config->setAppValue('core', 'installedat', microtime(true)); } $version = Util::getVersion(); $version['installed'] = $this->config->getAppValue('core', 'installedat'); $version['updated'] = $this->config->getAppValue('core', 'lastupdatedat'); $version['updatechannel'] = \OC_Util::getChannel(); $version['edition'] = \OC_Util::getEditionString(); $version['build'] = \OC_Util::getBuild(); $versionString = implode('x', $version); //fetch xml data from updater $url = $updaterUrl . '?version=' . $versionString; $tmp = []; $xml = $this->getUrlContent($url); if ($xml) { $loadEntities = libxml_disable_entity_loader(true); $data = @simplexml_load_string($xml); libxml_disable_entity_loader($loadEntities); if ($data !== false) { $tmp['version'] = (string) $data->version; $tmp['versionstring'] = (string) $data->versionstring; $tmp['url'] = (string) $data->url; $tmp['web'] = (string) $data->web; } else { libxml_clear_errors(); } } else { $data = []; } // Cache the result $this->config->setAppValue('core', 'lastupdateResult', json_encode($data)); return $tmp; }
protected function execute(InputInterface $input, OutputInterface $output) { $values = array('installed' => (bool) \OC::$server->getConfig()->getSystemValue('installed', false), 'version' => implode('.', \OCP\Util::getVersion()), 'versionstring' => \OC_Util::getVersionString(), 'edition' => \OC_Util::getEditionString()); $this->writeArrayInOutputFormat($input, $output, $values); }
/** * Check if the used SSL lib is outdated. Older OpenSSL and NSS versions do * have multiple bugs which likely lead to problems in combination with * functionality required by ownCloud such as SNI. * * @link https://github.com/owncloud/core/issues/17446#issuecomment-122877546 * @link https://bugzilla.redhat.com/show_bug.cgi?id=1241172 * @return string */ private function isUsedTlsLibOutdated() { // Appstore is disabled by default in EE $appStoreDefault = false; if (\OC_Util::getEditionString() === '') { $appStoreDefault = true; } // Don't run check when: // 1. Server has `has_internet_connection` set to false // 2. AppStore AND S2S is disabled if (!$this->config->getSystemValue('has_internet_connection', true)) { return ''; } if (!$this->config->getSystemValue('appstoreenabled', $appStoreDefault) && $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'no' && $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'no') { return ''; } $versionString = $this->getCurlVersion(); if (isset($versionString['ssl_version'])) { $versionString = $versionString['ssl_version']; } else { return ''; } $features = (string) $this->l10n->t('installing and updating apps via the app store or Federated Cloud Sharing'); if (!$this->config->getSystemValue('appstoreenabled', $appStoreDefault)) { $features = (string) $this->l10n->t('Federated Cloud Sharing'); } // Check if at least OpenSSL after 1.01d or 1.0.2b if (strpos($versionString, 'OpenSSL/') === 0) { $majorVersion = substr($versionString, 8, 5); $patchRelease = substr($versionString, 13, 6); if ($majorVersion === '1.0.1' && ord($patchRelease) < ord('d') || $majorVersion === '1.0.2' && ord($patchRelease) < ord('b')) { return (string) $this->l10n->t('cURL is using an outdated %s version (%s). Please update your operating system or features such as %s will not work reliably.', ['OpenSSL', $versionString, $features]); } } // Check if NSS and perform heuristic check if (strpos($versionString, 'NSS/') === 0) { try { $firstClient = $this->clientService->newClient(); $firstClient->get('https://www.owncloud.org/'); $secondClient = $this->clientService->newClient(); $secondClient->get('https://owncloud.org/'); } catch (ClientException $e) { if ($e->getResponse()->getStatusCode() === 400) { return (string) $this->l10n->t('cURL is using an outdated %s version (%s). Please update your operating system or features such as %s will not work reliably.', ['NSS', $versionString, $features]); } } } return ''; }
public function testGetEditionString() { $edition = \OC_Util::getEditionString(); $this->assertTrue(is_string($edition)); }
<?php try { require_once 'lib/base.php'; $systemConfig = \OC::$server->getSystemConfig(); $installed = $systemConfig->getValue('installed') == 1; $maintenance = $systemConfig->getValue('maintenance', false); $values = array('installed' => $installed, 'maintenance' => $maintenance, 'version' => implode('.', OC_Util::getVersion()), 'versionstring' => OC_Util::getVersionString(), 'edition' => OC_Util::getEditionString()); if (OC::$CLI) { print_r($values); } else { header('Access-Control-Allow-Origin: *'); header('Content-Type: application/json'); echo json_encode($values); } } catch (Exception $ex) { OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); \OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL); }
/** * Returns the Settings Navigation * * @return string[] * * This function returns an array containing all settings pages added. The * entries are sorted by the key 'order' ascending. */ public static function getSettingsNavigation() { $l = \OC::$server->getL10N('lib'); $urlGenerator = \OC::$server->getURLGenerator(); $settings = array(); // by default, settings only contain the help menu if (OC_Util::getEditionString() === '' && \OC::$server->getSystemConfig()->getValue('knowledgebaseenabled', true) == true) { $settings = array(array("id" => "help", "order" => 1000, "href" => $urlGenerator->linkToRoute('settings_help'), "name" => $l->t("Help"), "icon" => $urlGenerator->imagePath("settings", "help.svg"))); } // if the user is logged-in if (OC_User::isLoggedIn()) { // personal menu $settings[] = array("id" => "personal", "order" => 1, "href" => $urlGenerator->linkToRoute('settings_personal'), "name" => $l->t("Personal"), "icon" => $urlGenerator->imagePath("settings", "personal.svg")); //SubAdmins are also allowed to access user management $userObject = \OC::$server->getUserSession()->getUser(); $isSubAdmin = false; if ($userObject !== null) { $isSubAdmin = \OC::$server->getGroupManager()->getSubAdmin()->isSubAdmin($userObject); } if ($isSubAdmin) { // admin users menu $settings[] = array("id" => "core_users", "order" => 2, "href" => $urlGenerator->linkToRoute('settings_users'), "name" => $l->t("Users"), "icon" => $urlGenerator->imagePath("settings", "users.svg")); } // if the user is an admin if (OC_User::isAdminUser(OC_User::getUser())) { // admin settings $settings[] = array("id" => "admin", "order" => 1000, "href" => $urlGenerator->linkToRoute('settings_admin'), "name" => $l->t("Admin"), "icon" => $urlGenerator->imagePath("settings", "admin.svg")); } } $navigation = self::proceedNavigation($settings); return $navigation; }
public function testIsUsedTlsLibOutdatedWithAppstoreDisabledAndServerToServerSharingDisabled() { // Appstore is disabled by default in EE $appStoreDefault = false; if (\OC_Util::getEditionString() === '') { $appStoreDefault = true; } $this->config->expects($this->at(0))->method('getSystemValue')->with('has_internet_connection', true)->will($this->returnValue(true)); $this->config->expects($this->at(1))->method('getSystemValue')->with('appstoreenabled', $appStoreDefault)->will($this->returnValue(false)); $this->config->expects($this->at(2))->method('getAppValue')->with('files_sharing', 'outgoing_server2server_share_enabled', 'yes')->will($this->returnValue('no')); $this->config->expects($this->at(3))->method('getAppValue')->with('files_sharing', 'incoming_server2server_share_enabled', 'yes')->will($this->returnValue('no')); $this->checkSetupController->expects($this->never())->method('getCurlVersion')->will($this->returnValue([])); $this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated')); }
protected function execute(InputInterface $input, OutputInterface $output) { $values = array('installed' => \OC_Config::getValue('installed') ? 'true' : 'false', 'version' => implode('.', \OC_Util::getVersion()), 'versionstring' => \OC_Util::getVersionString(), 'edition' => \OC_Util::getEditionString()); print_r($values); }
* You should have received a copy of the GNU Affero General Public License, version 3, * along with this program. If not, see <http://www.gnu.org/licenses/> * */ try { require_once 'lib/base.php'; $systemConfig = \OC::$server->getSystemConfig(); $installed = $systemConfig->getValue('installed') == 1; $maintenance = $systemConfig->getValue('maintenance', false); $values=array( 'installed'=>$installed, 'maintenance' => $maintenance, 'version'=>implode('.', OC_Util::getVersion()), 'versionstring'=>OC_Util::getVersionString(), 'edition'=>OC_Util::getEditionString()); if (OC::$CLI) { print_r($values); } else { header('Content-Type: application/json'); echo json_encode($values); } } catch (Exception $ex) { OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); \OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL); }
/** * Check if a new version is available * * @param string $updaterUrl the url to check, i.e. 'http://apps.owncloud.com/updater.php' * @return array|bool */ public function check($updaterUrl = null) { // Look up the cache - it is invalidated all 30 minutes if (($this->config->getValue('core', 'lastupdatedat') + 1800) > time()) { return json_decode($this->config->getValue('core', 'lastupdateResult'), true); } if (is_null($updaterUrl)) { $updaterUrl = 'https://apps.owncloud.com/updater.php'; } $this->config->setValue('core', 'lastupdatedat', time()); if ($this->config->getValue('core', 'installedat', '') == '') { $this->config->setValue('core', 'installedat', microtime(true)); } $version = \OC_Util::getVersion(); $version['installed'] = $this->config->getValue('core', 'installedat'); $version['updated'] = $this->config->getValue('core', 'lastupdatedat'); $version['updatechannel'] = \OC_Util::getChannel(); $version['edition'] = \OC_Util::getEditionString(); $version['build'] = \OC_Util::getBuild(); $versionString = implode('x', $version); //fetch xml data from updater $url = $updaterUrl . '?version=' . $versionString; // set a sensible timeout of 10 sec to stay responsive even if the update server is down. $tmp = array(); $xml = $this->httpHelper->getUrlContent($url); if ($xml) { $loadEntities = libxml_disable_entity_loader(true); $data = @simplexml_load_string($xml); libxml_disable_entity_loader($loadEntities); if ($data !== false) { $tmp['version'] = $data->version; $tmp['versionstring'] = $data->versionstring; $tmp['url'] = $data->url; $tmp['web'] = $data->web; } } else { $data = array(); } // Cache the result $this->config->setValue('core', 'lastupdateResult', json_encode($data)); return $tmp; }
?> " id="owncloud" tabindex="1"> <div class="logo-icon svg"> <h1 class="hidden-visually"> <?php p($theme->getName()); ?> </h1> </div> </a> <a href="#" class="header-appname-container menutoggle" tabindex="2"> <h1 class="header-appname"> <?php if (OC_Util::getEditionString() === '') { p(!empty($_['application']) ? $_['application'] : $l->t('Apps')); } else { print_unescaped($theme->getHTMLName()); } ?> </h1> <div class="icon-caret svg"></div> </a> <div id="logo-claim" style="display:none;"><?php p($theme->getLogoClaim()); ?> </div> <div id="settings" class="svg"> <div id="expand" tabindex="6" role="link" class="menutoggle">
/** * @param string $baseUrl * @return string */ private function buildUpdateUrl($baseUrl) { return $baseUrl . '?version=' . implode('x', \OCP\Util::getVersion()) . 'xinstalledatxlastupdatedatx' . \OC_Util::getChannel() . 'x' . \OC_Util::getEditionString() . 'x'; }
<?php if ($_['logFileSize'] > 0): ?> <a href="<?php print_unescaped(OC::$server->getURLGenerator()->linkToRoute('settings.LogSettings.download')); ?>" class="button" id="downloadLog"><?php p($l->t('Download logfile'));?></a> <?php endif; ?> <?php if ($_['entriesremain']): ?> <input id="moreLog" type="button" value="<?php p($l->t('More'));?>..."> <input id="lessLog" type="button" value="<?php p($l->t('Less'));?>..."> <?php endif; ?> <?php if ($_['logFileSize'] > (100 * 1024 * 1024)): ?> <br> <em> <?php p($l->t('The logfile is bigger than 100MB. Downloading it may take some time!')); ?> </em> <?php endif; ?> <?php endif; ?> </div> <div class="section"> <h2><?php p($l->t('Version'));?></h2> <strong><?php p($theme->getTitle()); ?></strong> <?php p(OC_Util::getHumanVersion()) ?> <?php if (OC_Util::getEditionString() === ''): ?> <p> <?php print_unescaped($l->t('Developed by the <a href="http://ownCloud.org/contact" target="_blank">ownCloud community</a>, the <a href="https://github.com/owncloud" target="_blank">source code</a> is licensed under the <a href="http://www.gnu.org/licenses/agpl-3.0.html" target="_blank"><abbr title="Affero General Public License">AGPL</abbr></a>.')); ?> </p> <?php endif; ?> </div> <div class="section credits-footer"> <p><?php print_unescaped($theme->getShortFooter()); ?></p> </div> </div>
/** * Returns the Settings Navigation * @return string * * This function returns an array containing all settings pages added. The * entries are sorted by the key 'order' ascending. */ public static function getSettingsNavigation() { $l = \OC::$server->getL10N('lib'); $settings = array(); // by default, settings only contain the help menu if (OC_Util::getEditionString() === '' && OC_Config::getValue('knowledgebaseenabled', true) == true) { $settings = array(array("id" => "help", "order" => 1000, "href" => OC_Helper::linkToRoute("settings_help"), "name" => $l->t("Help"), "icon" => OC_Helper::imagePath("settings", "help.svg"))); } // if the user is logged-in if (OC_User::isLoggedIn()) { // personal menu $settings[] = array("id" => "personal", "order" => 1, "href" => OC_Helper::linkToRoute("settings_personal"), "name" => $l->t("Personal"), "icon" => OC_Helper::imagePath("settings", "personal.svg")); // if there are some settings forms if (!empty(self::$settingsForms)) { // settings menu $settings[] = array("id" => "settings", "order" => 1000, "href" => OC_Helper::linkToRoute("settings_settings"), "name" => $l->t("Settings"), "icon" => OC_Helper::imagePath("settings", "settings.svg")); } //SubAdmins are also allowed to access user management if (OC_SubAdmin::isSubAdmin(OC_User::getUser())) { // admin users menu $settings[] = array("id" => "core_users", "order" => 2, "href" => OC_Helper::linkToRoute("settings_users"), "name" => $l->t("Users"), "icon" => OC_Helper::imagePath("settings", "users.svg")); } // if the user is an admin if (OC_User::isAdminUser(OC_User::getUser())) { // admin settings $settings[] = array("id" => "admin", "order" => 1000, "href" => OC_Helper::linkToRoute("settings_admin"), "name" => $l->t("Admin"), "icon" => OC_Helper::imagePath("settings", "admin.svg")); } } $navigation = self::proceedNavigation($settings); return $navigation; }
?> </code><br /> <em><?php echo $l->t('use this address to connect to your ownCloud in your file manager'); ?> </em> </p> <?php foreach ($_['forms'] as $form) { echo $form; } ?> <p class="personalblock"> <strong>ownCloud</strong> <?php echo OC_Util::getVersionString(); ?> <?php echo OC_Util::getEditionString(); ?> (<?php echo OC_Updater::ShowUpdatingHint(); ?> )<br /> Developed by the <a href="http://ownCloud.org/contact" target="_blank">ownCloud community</a>, the <a href="http://gitorious.org/owncloud" target="_blank">source code</a> is freely licensed under the <a href="http://www.gnu.org/licenses/agpl-3.0.html" target="_blank"><abbr title="Affero General Public License">AGPL</abbr></a>. </p>