コード例 #1
0
ファイル: apps.php プロジェクト: enoch85/owncloud-testserver
 /**
  * @param array $parameters
  * @return OC_OCS_Result
  */
 public function getApps($parameters)
 {
     $apps = OC_App::listAllApps();
     $list = [];
     foreach ($apps as $app) {
         $list[] = $app['id'];
     }
     $filter = isset($_GET['filter']) ? $_GET['filter'] : false;
     if ($filter) {
         switch ($filter) {
             case 'enabled':
                 return new OC_OCS_Result(array('apps' => \OC_App::getEnabledApps()));
                 break;
             case 'disabled':
                 $enabled = OC_App::getEnabledApps();
                 return new OC_OCS_Result(array('apps' => array_diff($list, $enabled)));
                 break;
             default:
                 // Invalid filter variable
                 return new OC_OCS_Result(null, 101);
                 break;
         }
     } else {
         return new OC_OCS_Result(array('apps' => $list));
     }
 }
コード例 #2
0
ファイル: app.php プロジェクト: olucao/owncloud-core
 /**
  * Tests that the app order is correct
  */
 public function testGetEnabledAppsIsSorted()
 {
     $apps = \OC_App::getEnabledApps(true);
     // copy array
     $sortedApps = $apps;
     sort($sortedApps);
     // 'files' is always on top
     unset($sortedApps[array_search('files', $sortedApps)]);
     array_unshift($sortedApps, 'files');
     $this->assertEquals($sortedApps, $apps);
 }
コード例 #3
0
ファイル: appstest.php プロジェクト: Kevin-ZK/vaneDisk
 public function testGetAppsDisabled()
 {
     $_GET['filter'] = 'disabled';
     $result = \OCA\provisioning_API\Apps::getApps(array('filter' => 'disabled'));
     $this->assertTrue($result->succeeded());
     $data = $result->getData();
     $apps = \OC_App::listAllApps();
     $list = array();
     foreach ($apps as $app) {
         $list[] = $app['id'];
     }
     $disabled = array_diff($list, \OC_App::getEnabledApps());
     $this->assertEquals(count($disabled), count($data['apps']));
 }
コード例 #4
0
ファイル: apps.php プロジェクト: netcon-source/apps
 public static function getApps($parameters)
 {
     $filter = isset($_GET['filter']) ? $_GET['filter'] : false;
     if ($filter) {
         switch ($filter) {
             case 'enabled':
                 return array('apps' => OC_App::getEnabledApps());
                 break;
             case 'disabled':
                 $apps = OC_App::getAllApps();
                 $enabled = OC_App::getEnabledApps();
                 return array('apps' => array_diff($apps, $enabled));
                 break;
             default:
                 // Invalid filter variable
                 return 101;
                 break;
         }
     } else {
         return array('apps' => OC_App::getAllApps());
     }
 }
コード例 #5
0
ファイル: base.php プロジェクト: andyboeh/core
 /**
  * Checks if the version requires an update and shows
  * @param bool $showTemplate Whether an update screen should get shown
  * @return bool|void
  */
 public static function checkUpgrade($showTemplate = true)
 {
     if (\OCP\Util::needUpgrade()) {
         $systemConfig = \OC::$server->getSystemConfig();
         if ($showTemplate && !$systemConfig->getValue('maintenance', false)) {
             $version = OC_Util::getVersion();
             $oldTheme = $systemConfig->getValue('theme');
             $systemConfig->setValue('theme', '');
             OC_Util::addScript('config');
             // needed for web root
             OC_Util::addScript('update');
             $tmpl = new OC_Template('', 'update.admin', 'guest');
             $tmpl->assign('version', OC_Util::getVersionString());
             // get third party apps
             $apps = OC_App::getEnabledApps();
             $incompatibleApps = array();
             foreach ($apps as $appId) {
                 $info = OC_App::getAppInfo($appId);
                 if (!OC_App::isAppCompatible($version, $info)) {
                     $incompatibleApps[] = $info;
                 }
             }
             $tmpl->assign('appList', $incompatibleApps);
             $tmpl->assign('productName', 'ownCloud');
             // for now
             $tmpl->assign('oldTheme', $oldTheme);
             $tmpl->printPage();
             exit;
         } else {
             return true;
         }
     }
     return false;
 }
コード例 #6
0
ファイル: util.php プロジェクト: reverserob/core
 /**
  * Check whether the instance needs to perform an upgrade,
  * either when the core version is higher or any app requires
  * an upgrade.
  *
  * @param \OCP\IConfig $config
  * @return bool whether the core or any app needs an upgrade
  */
 public static function needUpgrade(\OCP\IConfig $config)
 {
     if ($config->getSystemValue('installed', false)) {
         $installedVersion = $config->getSystemValue('version', '0.0.0');
         $currentVersion = implode('.', OC_Util::getVersion());
         $versionDiff = version_compare($currentVersion, $installedVersion);
         if ($versionDiff > 0) {
             return true;
         } else {
             if ($versionDiff < 0) {
                 // downgrade attempt, throw exception
                 throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')');
             }
         }
         // also check for upgrades for apps (independently from the user)
         $apps = \OC_App::getEnabledApps(false, true);
         $shouldUpgrade = false;
         foreach ($apps as $app) {
             if (\OC_App::shouldUpgrade($app)) {
                 $shouldUpgrade = true;
                 break;
             }
         }
         return $shouldUpgrade;
     } else {
         return false;
     }
 }
コード例 #7
0
ファイル: updater.php プロジェクト: olucao/owncloud-core
 /**
  * runs the update actions in maintenance mode, does not upgrade the source files
  * except the main .htaccess file
  *
  * @param string $currentVersion current version to upgrade to
  * @param string $installedVersion previous version from which to upgrade from
  *
  * @return bool true if the operation succeeded, false otherwise
  */
 private function doUpgrade($currentVersion, $installedVersion)
 {
     // Update htaccess files for apache hosts
     if (isset($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache')) {
         \OC_Setup::updateHtaccess();
     }
     // create empty file in data dir, so we can later find
     // out that this is indeed an ownCloud data directory
     // (in case it didn't exist before)
     file_put_contents(\OC_Config::getValue('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', '');
     /*
      * START CONFIG CHANGES FOR OLDER VERSIONS
      */
     if (!\OC::$CLI && version_compare($installedVersion, '6.90.1', '<')) {
         // Add the trusted_domains config if it is not existant
         // This is added to prevent host header poisoning
         \OC_Config::setValue('trusted_domains', \OC_Config::getValue('trusted_domains', array(\OC_Request::serverHost())));
     }
     /*
      * STOP CONFIG CHANGES FOR OLDER VERSIONS
      */
     // pre-upgrade repairs
     $repair = new \OC\Repair(\OC\Repair::getBeforeUpgradeRepairSteps());
     $repair->run();
     // simulate DB upgrade
     if ($this->simulateStepEnabled) {
         // simulate core DB upgrade
         \OC_DB::simulateUpdateDbFromStructure(\OC::$SERVERROOT . '/db_structure.xml');
         // simulate apps DB upgrade
         $version = \OC_Util::getVersion();
         $apps = \OC_App::getEnabledApps();
         foreach ($apps as $appId) {
             $info = \OC_App::getAppInfo($appId);
             if (\OC_App::isAppCompatible($version, $info) && \OC_App::shouldUpgrade($appId)) {
                 if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/database.xml')) {
                     \OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId) . '/appinfo/database.xml');
                 }
             }
         }
         $this->emit('\\OC\\Updater', 'dbSimulateUpgrade');
     }
     // upgrade from OC6 to OC7
     // TODO removed it again for OC8
     $sharePolicy = \OC_Appconfig::getValue('core', 'shareapi_share_policy', 'global');
     if ($sharePolicy === 'groups_only') {
         \OC_Appconfig::setValue('core', 'shareapi_only_share_with_group_members', 'yes');
     }
     if ($this->updateStepEnabled) {
         // do the real upgrade
         \OC_DB::updateDbFromStructure(\OC::$SERVERROOT . '/db_structure.xml');
         $this->emit('\\OC\\Updater', 'dbUpgrade');
         // TODO: why not do this at the end ?
         \OC_Config::setValue('version', implode('.', \OC_Util::getVersion()));
         $disabledApps = \OC_App::checkAppsRequirements();
         if (!empty($disabledApps)) {
             $this->emit('\\OC\\Updater', 'disabledApps', array($disabledApps));
         }
         // load all apps to also upgrade enabled apps
         \OC_App::loadApps();
         // post-upgrade repairs
         $repair = new \OC\Repair(\OC\Repair::getRepairSteps());
         $repair->run();
         //Invalidate update feed
         \OC_Appconfig::setValue('core', 'lastupdatedat', 0);
     }
 }
コード例 #8
0
ファイル: Updater.php プロジェクト: stweil/owncloud-core
 /**
  * upgrades all apps within a major ownCloud upgrade. Also loads "priority"
  * (types authentication, filesystem, logging, in that order) afterwards.
  *
  * @throws NeedsUpdateException
  */
 protected function doAppUpgrade()
 {
     $apps = \OC_App::getEnabledApps();
     $priorityTypes = array('authentication', 'filesystem', 'logging');
     $pseudoOtherType = 'other';
     $stacks = array($pseudoOtherType => array());
     foreach ($apps as $appId) {
         $priorityType = false;
         foreach ($priorityTypes as $type) {
             if (!isset($stacks[$type])) {
                 $stacks[$type] = array();
             }
             if (\OC_App::isType($appId, $type)) {
                 $stacks[$type][] = $appId;
                 $priorityType = true;
                 break;
             }
         }
         if (!$priorityType) {
             $stacks[$pseudoOtherType][] = $appId;
         }
     }
     foreach ($stacks as $type => $stack) {
         foreach ($stack as $appId) {
             if (\OC_App::shouldUpgrade($appId)) {
                 $this->emit('\\OC\\Updater', 'appUpgradeStarted', [$appId, \OC_App::getAppVersion($appId)]);
                 \OC_App::updateApp($appId);
                 $this->emit('\\OC\\Updater', 'appUpgrade', [$appId, \OC_App::getAppVersion($appId)]);
             }
             if ($type !== $pseudoOtherType) {
                 // load authentication, filesystem and logging apps after
                 // upgrading them. Other apps my need to rely on modifying
                 // user and/or filesystem aspects.
                 \OC_App::loadApp($appId, false);
             }
         }
     }
 }
コード例 #9
0
ファイル: app.php プロジェクト: kenwi/core
 /**
  * Restore the original app config service.
  */
 private function restoreAppConfig()
 {
     \OC::$server->registerService('AppConfig', function (\OC\Server $c) {
         return new \OC\AppConfig($c->getDatabaseConnection());
     });
     \OC::$server->registerService('AppManager', function (\OC\Server $c) {
         return new \OC\App\AppManager($c->getUserSession(), $c->getAppConfig(), $c->getGroupManager(), $c->getMemCacheFactory());
     });
     // Remove the cache of the mocked apps list with a forceRefresh
     \OC_App::getEnabledApps(true);
 }
コード例 #10
0
ファイル: updater.php プロジェクト: WYSAC/oregon-owncloud
 protected function doAppUpgrade()
 {
     $apps = \OC_App::getEnabledApps();
     foreach ($apps as $appId) {
         if (\OC_App::shouldUpgrade($appId)) {
             \OC_App::updateApp($appId);
             $this->emit('\\OC\\Updater', 'appUpgrade', array($appId, \OC_App::getAppVersion($appId)));
         }
     }
 }
コード例 #11
0
ファイル: ocs.php プロジェクト: ryanshoover/core
 /**
  * get a list of installed web apps
  * @param string $format
  * @return string xml/json
  */
 private static function systemWebApps($format)
 {
     $login = OC_OCS::checkpassword();
     $apps = OC_App::getEnabledApps();
     $values = array();
     foreach ($apps as $app) {
         $info = OC_App::getAppInfo($app);
         if (isset($info['standalone'])) {
             $newvalue = array('name' => $info['name'], 'url' => OC_Helper::linkToAbsolute($app, ''), 'icon' => '');
             $values[] = $newvalue;
         }
     }
     $txt = OC_OCS::generatexml($format, 'ok', 100, '', $values, 'cloud', '', 2, 0, 0);
     echo $txt;
 }
コード例 #12
0
ファイル: app.php プロジェクト: ryanshoover/core
 /**
  * check if the current enabled apps are compatible with the current
  * ownCloud version. disable them if not.
  * This is important if you upgrade ownCloud and have non ported 3rd
  * party apps installed.
  */
 public static function checkAppsRequirements($apps = array())
 {
     if (empty($apps)) {
         $apps = OC_App::getEnabledApps();
     }
     $version = OC_Util::getVersion();
     foreach ($apps as $app) {
         // check if the app is compatible with this version of ownCloud
         $info = OC_App::getAppInfo($app);
         if (!isset($info['require']) or $version[0] . '.' . $version[1] > $info['require']) {
             OC_Log::write('core', 'App "' . $info['name'] . '" (' . $app . ') can\'t be used because it is not compatible with this version of ownCloud', OC_Log::ERROR);
             OC_App::disable($app);
         }
     }
 }
コード例 #13
0
ファイル: AppsTest.php プロジェクト: rchicoli/owncloud-core
 public function testGetAppsDisabled()
 {
     $this->ocsClient->expects($this->any())->method($this->anything())->will($this->returnValue(null));
     $_GET['filter'] = 'disabled';
     $result = $this->api->getApps(['filter' => 'disabled']);
     $this->assertTrue($result->succeeded());
     $data = $result->getData();
     $apps = \OC_App::listAllApps(false, true, $this->ocsClient);
     $list = array();
     foreach ($apps as $app) {
         $list[] = $app['id'];
     }
     $disabled = array_diff($list, \OC_App::getEnabledApps());
     $this->assertEquals(count($disabled), count($data['apps']));
 }
コード例 #14
0
ファイル: app.php プロジェクト: riso/owncloud-core
 /**
  * Restore the original app config service.
  */
 private function restoreAppConfig()
 {
     $oldService = $this->oldAppConfigService;
     \OC::$server->registerService('AppConfig', function ($c) use($oldService) {
         return $oldService;
     });
     // Remove the cache of the mocked apps list with a forceRefresh
     \OC_App::getEnabledApps(true);
 }
コード例 #15
0
 /**
  * check if any apps need updating and update those
  */
 public static function updateApps()
 {
     $versions = self::getAppVersions();
     //ensure files app is installed for upgrades
     if (!isset($versions['files'])) {
         $versions['files'] = '0';
     }
     foreach ($versions as $app => $installedVersion) {
         $currentVersion = OC_App::getAppVersion($app);
         if ($currentVersion) {
             if (version_compare($currentVersion, $installedVersion, '>')) {
                 OC_Log::write($app, 'starting app upgrade from ' . $installedVersion . ' to ' . $currentVersion, OC_Log::DEBUG);
                 OC_App::updateApp($app);
                 OC_Appconfig::setValue($app, 'installed_version', OC_App::getAppVersion($app));
             }
         }
     }
     // check if the current enabled apps are compatible with the current ownCloud version. disable them if not.
     // this is important if you upgrade ownCloud and have non ported 3rd party apps installed
     $apps = OC_App::getEnabledApps();
     $version = OC_Util::getVersion();
     foreach ($apps as $app) {
         // check if the app is compatible with this version of ownCloud
         $info = OC_App::getAppInfo($app);
         if (!isset($info['require']) or $version[0] > $info['require']) {
             OC_Log::write('core', 'App "' . $info['name'] . '" can\'t be used because it is not compatible with this version of ownCloud', OC_Log::ERROR);
             OC_App::disable($app);
         }
     }
 }
コード例 #16
0
ファイル: app.php プロジェクト: Combustible/core
 /**
  * Tests that the apps list is re-requested (not cached) when
  * no user is set.
  */
 public function testEnabledAppsNoCache()
 {
     $this->setupAppConfigMock()->expects($this->exactly(2))->method('getValues')->will($this->returnValue(array('app3' => 'yes', 'app2' => 'no')));
     $apps = \OC_App::getEnabledApps(true);
     $this->assertEquals(array('files', 'app3'), $apps);
     // mock should be called again here
     $apps = \OC_App::getEnabledApps(false);
     $this->assertEquals(array('files', 'app3'), $apps);
     $this->restoreAppConfig();
 }
コード例 #17
0
ファイル: apps.php プロジェクト: rchicoli/owncloud-core
    }
    if ($dh = opendir($path)) {
        while ($name = readdir($dh)) {
            if ($name[0] !== '.') {
                $file = $path . '/' . $name;
                if (is_dir($file)) {
                    loadDirectory($file);
                } elseif (substr($name, -4, 4) === '.php') {
                    require_once $file;
                }
            }
        }
    }
}
function getSubclasses($parentClassName)
{
    $classes = array();
    foreach (get_declared_classes() as $className) {
        if (is_subclass_of($className, $parentClassName)) {
            $classes[] = $className;
        }
    }
    return $classes;
}
$apps = OC_App::getEnabledApps();
foreach ($apps as $app) {
    $dir = OC_App::getAppPath($app);
    if (is_dir($dir . '/tests')) {
        loadDirectory($dir . '/tests');
    }
}
コード例 #18
0
ファイル: converttype.php プロジェクト: Romua1d/core
 protected function createSchema(Connection $toDB, InputInterface $input, OutputInterface $output)
 {
     $output->writeln('<info>Creating schema in new database</info>');
     $schemaManager = new \OC\DB\MDB2SchemaManager($toDB);
     $schemaManager->createDbFromStructure(\OC::$SERVERROOT . '/db_structure.xml');
     $apps = $input->getOption('all-apps') ? \OC_App::getAllApps() : \OC_App::getEnabledApps();
     foreach ($apps as $app) {
         if (file_exists(\OC_App::getAppPath($app) . '/appinfo/database.xml')) {
             $schemaManager->createDbFromStructure(\OC_App::getAppPath($app) . '/appinfo/database.xml');
         }
     }
 }
コード例 #19
0
ファイル: config.php プロジェクト: samj1912/repo
 * 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/>
 *
 */
// 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));
コード例 #20
0
ファイル: base.php プロジェクト: GitHubUser4234/core
 public static function loadAppClassPaths()
 {
     foreach (OC_App::getEnabledApps() as $app) {
         $appPath = OC_App::getAppPath($app);
         if ($appPath === false) {
             continue;
         }
         $file = $appPath . '/appinfo/classpath.php';
         if (file_exists($file)) {
             require_once $file;
         }
     }
 }
コード例 #21
0
ファイル: util.php プロジェクト: pinoniq/core
 /**
  * Check whether the instance needs to perform an upgrade,
  * either when the core version is higher or any app requires
  * an upgrade.
  *
  * @return bool whether the core or any app needs an upgrade
  */
 public static function needUpgrade()
 {
     if (OC_Config::getValue('installed', false)) {
         $installedVersion = OC_Config::getValue('version', '0.0.0');
         $currentVersion = implode('.', OC_Util::getVersion());
         if (version_compare($currentVersion, $installedVersion, '>')) {
             return true;
         }
         // also check for upgrades for apps (independently from the user)
         $apps = \OC_App::getEnabledApps(false, true);
         $shouldUpgrade = false;
         foreach ($apps as $app) {
             if (\OC_App::shouldUpgrade($app)) {
                 $shouldUpgrade = true;
                 break;
             }
         }
         return $shouldUpgrade;
     } else {
         return false;
     }
 }
コード例 #22
0
ファイル: util.php プロジェクト: hjimmy/owncloud
 /**
  * Check if it is allowed to remember login.
  *
  * @note Every app can set 'rememberlogin' to 'false' to disable the remember login feature
  *
  * @return bool
  */
 public static function rememberLoginAllowed()
 {
     $apps = OC_App::getEnabledApps();
     foreach ($apps as $app) {
         $appInfo = OC_App::getAppInfo($app);
         if (isset($appInfo['rememberlogin']) && $appInfo['rememberlogin'] === 'false') {
             return false;
         }
     }
     return true;
 }
コード例 #23
0
ファイル: templatelayout.php プロジェクト: ryanshoover/core
 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);
         }
     }
 }
コード例 #24
0
ファイル: app.php プロジェクト: hjimmy/owncloud
 /**
  * check if the current enabled apps are compatible with the current
  * ownCloud version. disable them if not.
  * This is important if you upgrade ownCloud and have non ported 3rd
  * party apps installed.
  */
 public static function checkAppsRequirements($apps = array())
 {
     if (empty($apps)) {
         $apps = OC_App::getEnabledApps();
     }
     $version = OC_Util::getVersion();
     foreach ($apps as $app) {
         // check if the app is compatible with this version of ownCloud
         $info = OC_App::getAppInfo($app);
         if (!isset($info['require']) or !self::isAppVersionCompatible($version, $info['require'])) {
             OC_Log::write('core', 'App "' . $info['name'] . '" (' . $app . ') can\'t be used because it is' . ' not compatible with this version of ownCloud', OC_Log::ERROR);
             OC_App::disable($app);
             OC_Hook::emit('update', 'success', 'Disabled ' . $info['name'] . ' app because it is not compatible');
         }
     }
 }