Пример #1
0
 public function display($post)
 {
     $defaults = array('adminlogin' => '', 'adminpass' => '', 'dbuser' => '', 'dbpass' => '', 'dbname' => '', 'dbtablespace' => '', 'dbhost' => 'localhost', 'dbtype' => '');
     $parameters = array_merge($defaults, $post);
     \OC_Util::addVendorScript('strengthify/jquery.strengthify');
     \OC_Util::addVendorStyle('strengthify/strengthify');
     \OC_Util::addScript('setup');
     \OC_Template::printGuestPage('', 'installation', $parameters);
 }
Пример #2
0
/**
 * Shortcut for adding scripts to a page
 * @param string $app the appname
 * @param string|string[] $file the filename,
 * if an array is given it will add all scripts
 */
function script($app, $file = null)
{
    if (is_array($file)) {
        foreach ($file as $f) {
            OC_Util::addScript($app, $f);
        }
    } else {
        OC_Util::addScript($app, $file);
    }
}
Пример #3
0
 /**
  * Register a sharing backend class that implements OCP\Share_Backend for an item type
  * @param string $itemType Item type
  * @param string $class Backend class
  * @param string $collectionOf (optional) Depends on item type
  * @param array $supportedFileExtensions (optional) List of supported file extensions if this item type depends on files
  * @return boolean true if backend is registered or false if error
  */
 public static function registerBackend($itemType, $class, $collectionOf = null, $supportedFileExtensions = null)
 {
     if (self::isEnabled()) {
         if (!isset(self::$backendTypes[$itemType])) {
             self::$backendTypes[$itemType] = array('class' => $class, 'collectionOf' => $collectionOf, 'supportedFileExtensions' => $supportedFileExtensions);
             if (count(self::$backendTypes) === 1) {
                 \OC_Util::addScript('core', 'share');
                 \OC_Util::addStyle('core', 'share');
             }
             return true;
         }
         \OC_Log::write('OCP\\Share', 'Sharing backend ' . $class . ' not registered, ' . self::$backendTypes[$itemType]['class'] . ' is already registered for ' . $itemType, \OC_Log::WARN);
     }
     return false;
 }
Пример #4
0
<?php

/**
* 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';
OC_Util::checkAppEnabled($app_id);
OC_App::register(array('order' => 70, 'id' => $app_id, 'name' => ucfirst($app_id)));
OC_Util::addScript($app_id, 'actlink.min');
OC_Util::addScript('3rdparty', 'chosen/chosen.jquery.min');
OC_Util::addStyle('3rdparty', 'chosen/chosen');
if (!OC_App::isEnabled('files_sharing')) {
    OC_Util::addStyle($app_id, 'styles');
}
Пример #5
0
	public static function init() {
		// register autoloader
		$loaderStart = microtime(true);
		require_once __DIR__ . '/autoloader.php';
		self::$loader = new \OC\Autoloader();
		spl_autoload_register(array(self::$loader, 'load'));
		$loaderEnd = microtime(true);

		self::initPaths();

		// setup 3rdparty autoloader
		$vendorAutoLoad = OC::$THIRDPARTYROOT . '/3rdparty/autoload.php';
		if (file_exists($vendorAutoLoad)) {
			require_once $vendorAutoLoad;
		} else {
			OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
			// we can't use the template error page here, because this needs the
			// DI container which isn't available yet
			print('Composer autoloader not found, unable to continue. Check the folder "3rdparty".');
			exit();
		}

		// setup the basic server
		self::$server = new \OC\Server(\OC::$WEBROOT);
		\OC::$server->getEventLogger()->log('autoloader', 'Autoloader', $loaderStart, $loaderEnd);
		\OC::$server->getEventLogger()->start('boot', 'Initialize');

		// set some stuff
		//ob_start();
		error_reporting(E_ALL | E_STRICT);
		if (defined('DEBUG') && DEBUG) {
			ini_set('display_errors', 1);
		}
		self::$CLI = (php_sapi_name() == 'cli');

		date_default_timezone_set('UTC');
		ini_set('arg_separator.output', '&amp;');

		//try to configure php to enable big file uploads.
		//this doesn´t work always depending on the webserver and php configuration.
		//Let´s try to overwrite some defaults anyways

		//try to set the maximum execution time to 60min
		@set_time_limit(3600);
		@ini_set('max_execution_time', 3600);
		@ini_set('max_input_time', 3600);

		//try to set the maximum filesize to 10G
		@ini_set('upload_max_filesize', '10G');
		@ini_set('post_max_size', '10G');
		@ini_set('file_uploads', '50');

		self::handleAuthHeaders();
		self::registerAutoloaderCache();

		// initialize intl fallback is necessary
		\Patchwork\Utf8\Bootup::initIntl();
		OC_Util::isSetLocaleWorking();

		if (!defined('PHPUNIT_RUN')) {
			OC\Log\ErrorHandler::setLogger(OC_Log::$object);
			if (defined('DEBUG') and DEBUG) {
				OC\Log\ErrorHandler::register(true);
				set_exception_handler(array('OC_Template', 'printExceptionErrorPage'));
			} else {
				OC\Log\ErrorHandler::register();
			}
		}

		// register the stream wrappers
		stream_wrapper_register('fakedir', 'OC\Files\Stream\Dir');
		stream_wrapper_register('static', 'OC\Files\Stream\StaticStream');
		stream_wrapper_register('close', 'OC\Files\Stream\Close');
		stream_wrapper_register('quota', 'OC\Files\Stream\Quota');
		stream_wrapper_register('oc', 'OC\Files\Stream\OC');

		\OC::$server->getEventLogger()->start('init_session', 'Initialize session');
		OC_App::loadApps(array('session'));
		if (!self::$CLI) {
			self::initSession();
		}
		\OC::$server->getEventLogger()->end('init_session');
		self::initTemplateEngine();
		self::checkConfig();
		self::checkInstalled();
		self::checkSSL();
		OC_Response::addSecurityHeaders();

		$errors = OC_Util::checkServer(\OC::$server->getConfig());
		if (count($errors) > 0) {
			if (self::$CLI) {
				foreach ($errors as $error) {
					echo $error['error'] . "\n";
					echo $error['hint'] . "\n\n";
				}
			} else {
				OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
				OC_Template::printGuestPage('', 'error', array('errors' => $errors));
			}
			exit;
		}

		//try to set the session lifetime
		$sessionLifeTime = self::getSessionLifeTime();
		@ini_set('gc_maxlifetime', (string)$sessionLifeTime);

		$systemConfig = \OC::$server->getSystemConfig();

		// User and Groups
		if (!$systemConfig->getValue("installed", false)) {
			self::$server->getSession()->set('user_id', '');
		}

		OC_User::useBackend(new OC_User_Database());
		OC_Group::useBackend(new OC_Group_Database());

		//setup extra user backends
		if (!self::checkUpgrade(false)) {
			OC_User::setupBackends();
		}

		self::registerCacheHooks();
		self::registerFilesystemHooks();
		self::registerPreviewHooks();
		self::registerShareHooks();
		self::registerLogRotate();
		self::registerLocalAddressBook();

		//make sure temporary files are cleaned up
		$tmpManager = \OC::$server->getTempManager();
		register_shutdown_function(array($tmpManager, 'clean'));

		if ($systemConfig->getValue('installed', false) && !self::checkUpgrade(false)) {
			if (\OC::$server->getConfig()->getAppValue('core', 'backgroundjobs_mode', 'ajax') == 'ajax') {
				OC_Util::addScript('backgroundjobs');
			}
		}

		// Check whether the sample configuration has been copied
		if($systemConfig->getValue('copied_sample_config', false)) {
			$l = \OC::$server->getL10N('lib');
			header('HTTP/1.1 503 Service Temporarily Unavailable');
			header('Status: 503 Service Temporarily Unavailable');
			OC_Template::printErrorPage(
				$l->t('Sample configuration detected'),
				$l->t('It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php')
			);
			return;
		}

		$host = OC_Request::insecureServerHost();
		// if the host passed in headers isn't trusted
		if (!OC::$CLI
			// overwritehost is always trusted
			&& OC_Request::getOverwriteHost() === null
			&& !OC_Request::isTrustedDomain($host)
		) {
			header('HTTP/1.1 400 Bad Request');
			header('Status: 400 Bad Request');

			$tmpl = new OCP\Template('core', 'untrustedDomain', 'guest');
			$tmpl->assign('domain', $_SERVER['SERVER_NAME']);
			$tmpl->printPage();

			exit();
		}
		\OC::$server->getEventLogger()->end('boot');
	}
Пример #6
0
 * This program 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, version 3,
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 *
 */
use OC\Lock\NoopLockingProvider;
OC_Util::checkAdminUser();
\OC::$server->getNavigationManager()->setActiveEntry("admin");
$template = new OC_Template('settings', 'admin', 'user');
$l = \OC::$server->getL10N('settings');
OC_Util::addScript('settings', 'certificates');
OC_Util::addScript('files', 'jquery.fileupload');
\OC::$server->getEventDispatcher()->dispatch('OC\\Settings\\Admin::loadAdditionalScripts');
$showLog = \OC::$server->getConfig()->getSystemValue('log_type', 'owncloud') === 'owncloud';
$numEntriesToLoad = 3;
$entries = \OC\Log\Owncloud::getEntries($numEntriesToLoad + 1);
$entriesRemaining = count($entries) > $numEntriesToLoad;
$entries = array_slice($entries, 0, $numEntriesToLoad);
$logFilePath = \OC\Log\Owncloud::getLogFilePath();
$doesLogFileExist = file_exists($logFilePath);
$logFileSize = 0;
if ($doesLogFileExist) {
    $logFileSize = filesize($logFilePath);
}
$config = \OC::$server->getConfig();
$appConfig = \OC::$server->getAppConfig();
$request = \OC::$server->getRequest();
Пример #7
0
 /**
  * @brief Handle the request
  */
 public static function handleRequest()
 {
     if (!OC_Config::getValue('installed', false)) {
         // Check for autosetup:
         $autosetup_file = OC::$SERVERROOT . "/config/autoconfig.php";
         if (file_exists($autosetup_file)) {
             OC_Log::write('core', 'Autoconfig file found, setting up owncloud...', OC_Log::INFO);
             include $autosetup_file;
             $_POST['install'] = 'true';
             $_POST = array_merge($_POST, $AUTOCONFIG);
             unlink($autosetup_file);
         }
         OC_Util::addScript('setup');
         require_once 'setup.php';
         exit;
     }
     // Handle WebDAV
     if ($_SERVER['REQUEST_METHOD'] == 'PROPFIND') {
         header('location: ' . OC_Helper::linkToRemote('webdav'));
         return;
     }
     // Handle app css files
     if (substr(OC::$REQUESTEDFILE, -3) == 'css') {
         self::loadCSSFile();
         return;
     }
     // Someone is logged in :
     if (OC_User::isLoggedIn()) {
         OC_App::loadApps();
         OC_User::setupBackends();
         if (isset($_GET["logout"]) and $_GET["logout"]) {
             OC_User::logout();
             header("Location: " . OC::$WEBROOT . '/');
         } else {
             $app = OC::$REQUESTEDAPP;
             $file = OC::$REQUESTEDFILE;
             if (is_null($file)) {
                 $file = 'index.php';
             }
             $file_ext = substr($file, -3);
             if ($file_ext != 'php' || !self::loadAppScriptFile($app, $file)) {
                 header('HTTP/1.0 404 Not Found');
             }
         }
         return;
     }
     // Not handled and not logged in
     self::handleLogin();
 }
Пример #8
0
 public static function init()
 {
     // calculate the root directories
     OC::$SERVERROOT = str_replace("\\", '/', substr(__DIR__, 0, -4));
     // register autoloader
     $loaderStart = microtime(true);
     require_once __DIR__ . '/autoloader.php';
     self::$loader = new \OC\Autoloader([OC::$SERVERROOT . '/lib', OC::$SERVERROOT . '/core', OC::$SERVERROOT . '/settings', OC::$SERVERROOT . '/ocs', OC::$SERVERROOT . '/ocs-provider', OC::$SERVERROOT . '/3rdparty']);
     spl_autoload_register(array(self::$loader, 'load'));
     $loaderEnd = microtime(true);
     self::$CLI = php_sapi_name() == 'cli';
     try {
         self::initPaths();
         // setup 3rdparty autoloader
         $vendorAutoLoad = OC::$THIRDPARTYROOT . '/3rdparty/autoload.php';
         if (!file_exists($vendorAutoLoad)) {
             throw new \RuntimeException('Composer autoloader not found, unable to continue. Check the folder "3rdparty". Running "git submodule update --init" will initialize the git submodule that handles the subfolder "3rdparty".');
         }
         require_once $vendorAutoLoad;
     } catch (\RuntimeException $e) {
         OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
         // we can't use the template error page here, because this needs the
         // DI container which isn't available yet
         print $e->getMessage();
         exit;
     }
     foreach (OC::$APPSROOTS as $appRoot) {
         self::$loader->addValidRoot($appRoot['path']);
     }
     // setup the basic server
     self::$server = new \OC\Server(\OC::$WEBROOT);
     \OC::$server->getEventLogger()->log('autoloader', 'Autoloader', $loaderStart, $loaderEnd);
     \OC::$server->getEventLogger()->start('boot', 'Initialize');
     // Don't display errors and log them
     error_reporting(E_ALL | E_STRICT);
     @ini_set('display_errors', 0);
     @ini_set('log_errors', 1);
     date_default_timezone_set('UTC');
     //try to configure php to enable big file uploads.
     //this doesn´t work always depending on the webserver and php configuration.
     //Let´s try to overwrite some defaults anyways
     //try to set the maximum execution time to 60min
     @set_time_limit(3600);
     @ini_set('max_execution_time', 3600);
     @ini_set('max_input_time', 3600);
     //try to set the maximum filesize to 10G
     @ini_set('upload_max_filesize', '10G');
     @ini_set('post_max_size', '10G');
     @ini_set('file_uploads', '50');
     self::setRequiredIniValues();
     self::handleAuthHeaders();
     self::registerAutoloaderCache();
     // initialize intl fallback is necessary
     \Patchwork\Utf8\Bootup::initIntl();
     OC_Util::isSetLocaleWorking();
     if (!defined('PHPUNIT_RUN')) {
         $logger = \OC::$server->getLogger();
         OC\Log\ErrorHandler::setLogger($logger);
         if (\OC::$server->getConfig()->getSystemValue('debug', false)) {
             OC\Log\ErrorHandler::register(true);
             set_exception_handler(array('OC_Template', 'printExceptionErrorPage'));
         } else {
             OC\Log\ErrorHandler::register();
         }
     }
     // register the stream wrappers
     stream_wrapper_register('fakedir', 'OC\\Files\\Stream\\Dir');
     stream_wrapper_register('static', 'OC\\Files\\Stream\\StaticStream');
     stream_wrapper_register('close', 'OC\\Files\\Stream\\Close');
     stream_wrapper_register('quota', 'OC\\Files\\Stream\\Quota');
     stream_wrapper_register('oc', 'OC\\Files\\Stream\\OC');
     \OC::$server->getEventLogger()->start('init_session', 'Initialize session');
     OC_App::loadApps(array('session'));
     if (!self::$CLI) {
         self::initSession();
     }
     \OC::$server->getEventLogger()->end('init_session');
     self::initTemplateEngine();
     self::checkConfig();
     self::checkInstalled();
     OC_Response::addSecurityHeaders();
     if (self::$server->getRequest()->getServerProtocol() === 'https') {
         ini_set('session.cookie_secure', true);
     }
     if (!defined('OC_CONSOLE')) {
         $errors = OC_Util::checkServer(\OC::$server->getConfig());
         if (count($errors) > 0) {
             if (self::$CLI) {
                 // Convert l10n string into regular string for usage in database
                 $staticErrors = [];
                 foreach ($errors as $error) {
                     echo $error['error'] . "\n";
                     echo $error['hint'] . "\n\n";
                     $staticErrors[] = ['error' => (string) $error['error'], 'hint' => (string) $error['hint']];
                 }
                 try {
                     \OC::$server->getConfig()->setAppValue('core', 'cronErrors', json_encode($staticErrors));
                 } catch (\Exception $e) {
                     echo 'Writing to database failed';
                 }
                 exit(1);
             } else {
                 OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
                 OC_Template::printGuestPage('', 'error', array('errors' => $errors));
                 exit;
             }
         } elseif (self::$CLI && \OC::$server->getConfig()->getSystemValue('installed', false)) {
             \OC::$server->getConfig()->deleteAppValue('core', 'cronErrors');
         }
     }
     //try to set the session lifetime
     $sessionLifeTime = self::getSessionLifeTime();
     @ini_set('gc_maxlifetime', (string) $sessionLifeTime);
     $systemConfig = \OC::$server->getSystemConfig();
     // User and Groups
     if (!$systemConfig->getValue("installed", false)) {
         self::$server->getSession()->set('user_id', '');
     }
     OC_User::useBackend(new OC_User_Database());
     OC_Group::useBackend(new OC_Group_Database());
     //setup extra user backends
     if (!self::checkUpgrade(false)) {
         OC_User::setupBackends();
     }
     self::registerCacheHooks();
     self::registerFilesystemHooks();
     if (\OC::$server->getSystemConfig()->getValue('enable_previews', true)) {
         self::registerPreviewHooks();
     }
     self::registerShareHooks();
     self::registerLogRotate();
     self::registerLocalAddressBook();
     self::registerEncryptionWrapper();
     self::registerEncryptionHooks();
     //make sure temporary files are cleaned up
     $tmpManager = \OC::$server->getTempManager();
     register_shutdown_function(array($tmpManager, 'clean'));
     $lockProvider = \OC::$server->getLockingProvider();
     register_shutdown_function(array($lockProvider, 'releaseAll'));
     if ($systemConfig->getValue('installed', false) && !self::checkUpgrade(false)) {
         if (\OC::$server->getConfig()->getAppValue('core', 'backgroundjobs_mode', 'ajax') == 'ajax') {
             OC_Util::addScript('backgroundjobs');
         }
     }
     // Check whether the sample configuration has been copied
     if ($systemConfig->getValue('copied_sample_config', false)) {
         $l = \OC::$server->getL10N('lib');
         header('HTTP/1.1 503 Service Temporarily Unavailable');
         header('Status: 503 Service Temporarily Unavailable');
         OC_Template::printErrorPage($l->t('Sample configuration detected'), $l->t('It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php'));
         return;
     }
     $request = \OC::$server->getRequest();
     $host = $request->getInsecureServerHost();
     /**
      * if the host passed in headers isn't trusted
      * FIXME: Should not be in here at all :see_no_evil:
      */
     if (!OC::$CLI && self::$server->getConfig()->getSystemValue('overwritehost') === '' && !\OC::$server->getTrustedDomainHelper()->isTrustedDomain($host) && self::$server->getConfig()->getSystemValue('installed', false)) {
         header('HTTP/1.1 400 Bad Request');
         header('Status: 400 Bad Request');
         $tmpl = new OCP\Template('core', 'untrustedDomain', 'guest');
         $tmpl->assign('domain', $request->server['SERVER_NAME']);
         $tmpl->printPage();
         exit;
     }
     \OC::$server->getEventLogger()->end('boot');
 }
Пример #9
0
$RUNTIME_NOAPPS = TRUE;
//no apps, yet
require_once 'lib/base.php';
// Setup required :
$not_installed = !OC_Config::getValue('installed', false);
if ($not_installed) {
    // Check for autosetup:
    $autosetup_file = OC::$SERVERROOT . "/config/autoconfig.php";
    if (file_exists($autosetup_file)) {
        OC_Log::write('core', 'Autoconfig file found, setting up owncloud...', OC_Log::INFO);
        include $autosetup_file;
        $_POST['install'] = 'true';
        $_POST = array_merge($_POST, $AUTOCONFIG);
        unlink($autosetup_file);
    }
    OC_Util::addScript('setup');
    require_once 'setup.php';
    exit;
}
// Handle WebDAV
if ($_SERVER['REQUEST_METHOD'] == 'PROPFIND') {
    header('location: ' . OC_Helper::linkToRemote('webdav'));
    exit;
} elseif (!OC_User::isLoggedIn() && substr(OC::$REQUESTEDFILE, -3) == 'css') {
    OC_App::loadApps();
    OC::loadfile();
} elseif (OC_User::isLoggedIn()) {
    OC_App::loadApps();
    if (isset($_GET["logout"]) and $_GET["logout"]) {
        OC_User::logout();
        header("Location: " . OC::$WEBROOT . '/');
Пример #10
0
<?php

OC_Util::checkAdminUser();
OC_Util::addStyle('neurocloud', "nc");
OC_Util::addScript("neurocloud", "admin");
$tmpl = new OC_Template('neurocloud', 'settings');
return $tmpl->fetchPage();
Пример #11
0
* 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/>.
*
*/
OC_Util::checkAdminUser();
OC_App::loadApps();
// Load the files we need
OC_Util::addStyle("settings", "settings");
OC_Util::addScript("settings", "apps");
OC_App::setActiveNavigationEntry("core_apps");
$installedApps = OC_App::getAllApps();
//TODO which apps do we want to blacklist and how do we integrate blacklisting with the multi apps folder feature?
$blacklist = array('files');
//we dont want to show configuration for these
$appList = array();
foreach ($installedApps as $app) {
    if (array_search($app, $blacklist) === false) {
        $info = OC_App::getAppInfo($app);
        if (!isset($info['name'])) {
            OC_Log::write('core', 'App id "' . $app . '" has no name in appinfo', OC_Log::ERROR);
            continue;
        }
        if (OC_Appconfig::getValue($app, 'enabled', 'no') == 'yes') {
            $active = true;
Пример #12
0
	public static function init() {
		// register autoloader
		require_once __DIR__ . '/autoloader.php';
		self::$loader = new \OC\Autoloader();
		self::$loader->registerPrefix('Doctrine\\Common', 'doctrine/common/lib');
		self::$loader->registerPrefix('Doctrine\\DBAL', 'doctrine/dbal/lib');
		self::$loader->registerPrefix('Symfony\\Component\\Routing', 'symfony/routing');
		self::$loader->registerPrefix('Symfony\\Component\\Console', 'symfony/console');
		self::$loader->registerPrefix('Patchwork', '3rdparty');
		self::$loader->registerPrefix('Pimple', '3rdparty/Pimple');
		spl_autoload_register(array(self::$loader, 'load'));

		// make a dummy session available as early as possible since error pages need it
		self::$session = new \OC\Session\Memory('');

		// set some stuff
		//ob_start();
		error_reporting(E_ALL | E_STRICT);
		if (defined('DEBUG') && DEBUG) {
			ini_set('display_errors', 1);
		}
		self::$CLI = (php_sapi_name() == 'cli');

		date_default_timezone_set('UTC');
		ini_set('arg_separator.output', '&amp;');

		// try to switch magic quotes off.
		if (get_magic_quotes_gpc() == 1) {
			ini_set('magic_quotes_runtime', 0);
		}

		//try to configure php to enable big file uploads.
		//this doesn´t work always depending on the webserver and php configuration.
		//Let´s try to overwrite some defaults anyways

		//try to set the maximum execution time to 60min
		@set_time_limit(3600);
		@ini_set('max_execution_time', 3600);
		@ini_set('max_input_time', 3600);

		//try to set the maximum filesize to 10G
		@ini_set('upload_max_filesize', '10G');
		@ini_set('post_max_size', '10G');
		@ini_set('file_uploads', '50');

		self::handleAuthHeaders();
		self::initPaths();
		self::registerAutoloaderCache();

		OC_Util::isSetLocaleWorking();

		// setup 3rdparty autoloader
		$vendorAutoLoad = OC::$THIRDPARTYROOT . '/3rdparty/autoload.php';
		if (file_exists($vendorAutoLoad)) {
			require_once $vendorAutoLoad;
		}

		if (!defined('PHPUNIT_RUN')) {
			OC\Log\ErrorHandler::setLogger(OC_Log::$object);
			if (defined('DEBUG') and DEBUG) {
				OC\Log\ErrorHandler::register(true);
				set_exception_handler(array('OC_Template', 'printExceptionErrorPage'));
			} else {
				OC\Log\ErrorHandler::register();
			}
		}

		// register the stream wrappers
		stream_wrapper_register('fakedir', 'OC\Files\Stream\Dir');
		stream_wrapper_register('static', 'OC\Files\Stream\StaticStream');
		stream_wrapper_register('close', 'OC\Files\Stream\Close');
		stream_wrapper_register('quota', 'OC\Files\Stream\Quota');
		stream_wrapper_register('oc', 'OC\Files\Stream\OC');

		// setup the basic server
		self::$server = new \OC\Server();

		self::initTemplateEngine();
		OC_App::loadApps(array('session'));
		if (!self::$CLI) {
			self::initSession();
		} else {
			self::$session = new \OC\Session\Memory('');
		}
		self::checkConfig();
		self::checkInstalled();
		self::checkSSL();
		OC_Response::addSecurityHeaders();

		$errors = OC_Util::checkServer(\OC::$server->getConfig());
		if (count($errors) > 0) {
			if (self::$CLI) {
				foreach ($errors as $error) {
					echo $error['error'] . "\n";
					echo $error['hint'] . "\n\n";
				}
			} else {
				OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
				OC_Template::printGuestPage('', 'error', array('errors' => $errors));
			}
			exit;
		}

		//try to set the session lifetime
		$sessionLifeTime = self::getSessionLifeTime();
		@ini_set('gc_maxlifetime', (string)$sessionLifeTime);

		// User and Groups
		if (!OC_Config::getValue("installed", false)) {
			self::$session->set('user_id', '');
		}

		OC_User::useBackend(new OC_User_Database());
		OC_Group::useBackend(new OC_Group_Database());

		//setup extra user backends
		if (!self::checkUpgrade(false)) {
			OC_User::setupBackends();
		}

		self::registerCacheHooks();
		self::registerFilesystemHooks();
		self::registerPreviewHooks();
		self::registerShareHooks();
		self::registerLogRotate();
		self::registerLocalAddressBook();

		//make sure temporary files are cleaned up
		register_shutdown_function(array('OC_Helper', 'cleanTmp'));

		if (OC_Config::getValue('installed', false) && !self::checkUpgrade(false)) {
			if (OC_Appconfig::getValue('core', 'backgroundjobs_mode', 'ajax') == 'ajax') {
				OC_Util::addScript('backgroundjobs');
			}
		}

		$host = OC_Request::insecureServerHost();
		// if the host passed in headers isn't trusted
		if (!OC::$CLI
			// overwritehost is always trusted
			&& OC_Request::getOverwriteHost() === null
			&& !OC_Request::isTrustedDomain($host)
		) {
			header('HTTP/1.1 400 Bad Request');
			header('Status: 400 Bad Request');

			$tmpl = new OCP\Template('core', 'untrustedDomain', 'guest');
			$tmpl->assign('domain', $_SERVER['SERVER_NAME']);
			$tmpl->printPage();

			exit();
		}
	}
Пример #13
0
*
* @author Frank Karlitschek
* @copyright 2012 Frank Karlitschek frank@owncloud.org
*
* 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/>.
*
*/
OC_Util::checkAdminUser();
// Load the files we need
OC_Util::addStyle("settings", "settings");
OC_Util::addScript("core", "multiselect");
OC_App::setActiveNavigationEntry("core_apps");
$combinedApps = OC_App::listAllApps();
$groups = \OC_Group::getGroups();
$tmpl = new OC_Template("settings", "apps", "user");
$tmpl->assign('apps', $combinedApps);
$tmpl->assign('groups', $groups);
$appid = isset($_GET['appid']) ? strip_tags($_GET['appid']) : '';
$tmpl->assign('appid', $appid);
$tmpl->printPage();
Пример #14
0
/**
* 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/>.
* 
*/
OC::$CLASSPATH['OC_IntBks'] = 'apps/internal_bookmarks/lib/intbks.class.php';
OC_App::register(array('order' => 70, 'id' => 'internal_bookmarks', 'name' => 'Internal Bookmarks'));
OC_Util::addScript("internal_bookmarks", "actlink.min");
$i = 0;
foreach (OC_IntBks::getAllItemsByUser() as $item) {
    OC_App::addNavigationEntry(array('id' => 'internal_bookmarks_index_' . $item['bkid'], 'order' => 70 + $item['bkorder'] / 100, 'href' => OC_Helper::linkTo('files', 'index.php?dir=' . $item['bktarget']), 'icon' => OC_Helper::imagePath('internal_bookmarks', 'star_on.png'), 'name' => $item['bktitle']));
    $i++;
}
if ($i > 0) {
    OC_App::registerPersonal('internal_bookmarks', 'settings');
}
Пример #15
0
 public function testAddScript()
 {
     \OC_Util::addScript('core', 'myFancyJSFile1');
     \OC_Util::addScript('myApp', 'myFancyJSFile2');
     \OC_Util::addScript('core', 'myFancyJSFile0', true);
     \OC_Util::addScript('core', 'myFancyJSFile10', true);
     // add duplicate
     \OC_Util::addScript('core', 'myFancyJSFile1');
     $this->assertEquals(['core/js/myFancyJSFile10', 'core/js/myFancyJSFile0', 'core/js/myFancyJSFile1', 'myApp/l10n/en', 'myApp/js/myFancyJSFile2'], \OC_Util::$scripts);
     $this->assertEquals([], \OC_Util::$styles);
 }
<?php

/**
 * ownCloud
 *
 * @author Michael Gapczynski
 * @copyright 2011 Michael Gapczynski GapczynskiM@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/>.
 *
 */
require_once '../../lib/base.php';
require_once 'lib_share.php';
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('files_sharing');
OC_App::setActiveNavigationEntry("files_sharing_list");
OC_Util::addScript("files_sharing", "list");
$tmpl = new OC_Template("files_sharing", "list", "user");
$tmpl->assign("shared_items", OC_Share::getMySharedItems());
$tmpl->printPage();
<?php

$l = new OC_L10N('calendar');
OC::$CLASSPATH['OC_Calendar_Calendar'] = 'apps/calendar/lib/calendar.php';
OC::$CLASSPATH['OC_Calendar_Object'] = 'apps/calendar/lib/object.php';
OC::$CLASSPATH['OC_Calendar_Hooks'] = 'apps/calendar/lib/hooks.php';
OC::$CLASSPATH['OC_Connector_Sabre_CalDAV'] = 'apps/calendar/lib/connector_sabre.php';
OC_HOOK::connect('OC_User', 'post_createUser', 'OC_Calendar_Hooks', 'deleteUser');
OC_Util::addScript('calendar', 'loader');
OC_App::register(array('order' => 10, 'id' => 'calendar', 'name' => 'Calendar'));
OC_App::addNavigationEntry(array('id' => 'calendar_index', 'order' => 10, 'href' => OC_Helper::linkTo('calendar', 'index.php'), 'icon' => OC_Helper::imagePath('calendar', 'icon.png'), 'name' => $l->t('Calendar')));
OC_App::registerPersonal('calendar', 'settings');
Пример #18
0
<?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.
 */
OC_Util::checkSubAdminUser();
OC_App::loadApps();
// We have some javascript foo!
OC_Util::addScript('settings', 'users');
OC_Util::addScript('core', 'multiselect');
OC_Util::addScript('core', 'jquery.inview');
OC_Util::addStyle('settings', 'settings');
OC_App::setActiveNavigationEntry('core_users');
$users = array();
$groups = array();
$isadmin = OC_Group::inGroup(OC_User::getUser(), 'admin') ? true : false;
if ($isadmin) {
    $accessiblegroups = OC_Group::getGroups();
    $accessibleusers = OC_User::getUsers('', 30);
    $subadmins = OC_SubAdmin::getAllSubAdmins();
} else {
    $accessiblegroups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser());
    $accessibleusers = OC_Group::usersInGroups($accessiblegroups, '', 30);
    $subadmins = false;
}
foreach ($accessibleusers as $i) {
    $users[] = array("name" => $i, "groups" => join(", ", OC_Group::getUserGroups($i)), 'quota' => OC_Preferences::getValue($i, 'files', 'quota', 'default'), 'subadmin' => implode(', ', OC_SubAdmin::getSubAdminsGroups($i)));
}
foreach ($accessiblegroups as $i) {
Пример #19
0
 public static function init()
 {
     // register autoloader
     spl_autoload_register(array('OC', 'autoload'));
     OC_Util::issetlocaleworking();
     // set some stuff
     //ob_start();
     error_reporting(E_ALL | E_STRICT);
     if (defined('DEBUG') && DEBUG) {
         ini_set('display_errors', 1);
     }
     self::$CLI = php_sapi_name() == 'cli';
     date_default_timezone_set('UTC');
     ini_set('arg_separator.output', '&amp;');
     // try to switch magic quotes off.
     if (get_magic_quotes_gpc() == 1) {
         ini_set('magic_quotes_runtime', 0);
     }
     //try to configure php to enable big file uploads.
     //this doesn´t work always depending on the webserver and php configuration.
     //Let´s try to overwrite some defaults anyways
     //try to set the maximum execution time to 60min
     @set_time_limit(3600);
     @ini_set('max_execution_time', 3600);
     @ini_set('max_input_time', 3600);
     //try to set the maximum filesize to 10G
     @ini_set('upload_max_filesize', '10G');
     @ini_set('post_max_size', '10G');
     @ini_set('file_uploads', '50');
     //copy http auth headers for apache+php-fcgid work around
     if (isset($_SERVER['HTTP_XAUTHORIZATION']) && !isset($_SERVER['HTTP_AUTHORIZATION'])) {
         $_SERVER['HTTP_AUTHORIZATION'] = $_SERVER['HTTP_XAUTHORIZATION'];
     }
     //set http auth headers for apache+php-cgi work around
     if (isset($_SERVER['HTTP_AUTHORIZATION']) && preg_match('/Basic\\s+(.*)$/i', $_SERVER['HTTP_AUTHORIZATION'], $matches)) {
         list($name, $password) = explode(':', base64_decode($matches[1]), 2);
         $_SERVER['PHP_AUTH_USER'] = strip_tags($name);
         $_SERVER['PHP_AUTH_PW'] = strip_tags($password);
     }
     //set http auth headers for apache+php-cgi work around if variable gets renamed by apache
     if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) && preg_match('/Basic\\s+(.*)$/i', $_SERVER['REDIRECT_HTTP_AUTHORIZATION'], $matches)) {
         list($name, $password) = explode(':', base64_decode($matches[1]), 2);
         $_SERVER['PHP_AUTH_USER'] = strip_tags($name);
         $_SERVER['PHP_AUTH_PW'] = strip_tags($password);
     }
     self::initPaths();
     // set debug mode if an xdebug session is active
     if (!defined('DEBUG') || !DEBUG) {
         if (isset($_COOKIE['XDEBUG_SESSION'])) {
             define('DEBUG', true);
         }
     }
     if (!defined('PHPUNIT_RUN') and !(defined('DEBUG') and DEBUG)) {
         register_shutdown_function(array('OC_Log', 'onShutdown'));
         set_error_handler(array('OC_Log', 'onError'));
         set_exception_handler(array('OC_Log', 'onException'));
     }
     // register the stream wrappers
     stream_wrapper_register('fakedir', 'OC\\Files\\Stream\\Dir');
     stream_wrapper_register('static', 'OC\\Files\\Stream\\StaticStream');
     stream_wrapper_register('close', 'OC\\Files\\Stream\\Close');
     stream_wrapper_register('oc', 'OC\\Files\\Stream\\OC');
     self::initTemplateEngine();
     self::checkConfig();
     self::checkInstalled();
     self::checkSSL();
     self::initSession();
     $errors = OC_Util::checkServer();
     if (count($errors) > 0) {
         OC_Template::printGuestPage('', 'error', array('errors' => $errors));
         exit;
     }
     //try to set the session lifetime
     $sessionLifeTime = self::getSessionLifeTime();
     @ini_set('gc_maxlifetime', (string) $sessionLifeTime);
     // User and Groups
     if (!OC_Config::getValue("installed", false)) {
         $_SESSION['user_id'] = '';
     }
     OC_User::useBackend(new OC_User_Database());
     OC_Group::useBackend(new OC_Group_Database());
     if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SESSION['user_id']) && $_SERVER['PHP_AUTH_USER'] != $_SESSION['user_id']) {
         OC_User::logout();
     }
     // Load Apps
     // This includes plugins for users and filesystems as well
     global $RUNTIME_NOAPPS;
     global $RUNTIME_APPTYPES;
     if (!$RUNTIME_NOAPPS) {
         if ($RUNTIME_APPTYPES) {
             OC_App::loadApps($RUNTIME_APPTYPES);
         } else {
             OC_App::loadApps();
         }
     }
     //setup extra user backends
     OC_User::setupBackends();
     self::registerCacheHooks();
     self::registerFilesystemHooks();
     self::registerShareHooks();
     //make sure temporary files are cleaned up
     register_shutdown_function(array('OC_Helper', 'cleanTmp'));
     //parse the given parameters
     self::$REQUESTEDAPP = isset($_GET['app']) && trim($_GET['app']) != '' && !is_null($_GET['app']) ? OC_App::cleanAppId(strip_tags($_GET['app'])) : OC_Config::getValue('defaultapp', 'files');
     if (substr_count(self::$REQUESTEDAPP, '?') != 0) {
         $app = substr(self::$REQUESTEDAPP, 0, strpos(self::$REQUESTEDAPP, '?'));
         $param = substr($_GET['app'], strpos($_GET['app'], '?') + 1);
         parse_str($param, $get);
         $_GET = array_merge($_GET, $get);
         self::$REQUESTEDAPP = $app;
         $_GET['app'] = $app;
     }
     self::$REQUESTEDFILE = isset($_GET['getfile']) ? $_GET['getfile'] : null;
     if (substr_count(self::$REQUESTEDFILE, '?') != 0) {
         $file = substr(self::$REQUESTEDFILE, 0, strpos(self::$REQUESTEDFILE, '?'));
         $param = substr(self::$REQUESTEDFILE, strpos(self::$REQUESTEDFILE, '?') + 1);
         parse_str($param, $get);
         $_GET = array_merge($_GET, $get);
         self::$REQUESTEDFILE = $file;
         $_GET['getfile'] = $file;
     }
     if (!is_null(self::$REQUESTEDFILE)) {
         $subdir = OC_App::getAppPath(OC::$REQUESTEDAPP) . '/' . self::$REQUESTEDFILE;
         $parent = OC_App::getAppPath(OC::$REQUESTEDAPP);
         if (!OC_Helper::issubdirectory($subdir, $parent)) {
             self::$REQUESTEDFILE = null;
             header('HTTP/1.0 404 Not Found');
             exit;
         }
     }
     // write error into log if locale can't be set
     if (OC_Util::issetlocaleworking() == false) {
         OC_Log::write('core', 'setting locale to en_US.UTF-8/en_US.UTF8 failed. Support is probably not installed on your system', OC_Log::ERROR);
     }
     if (OC_Config::getValue('installed', false) && !self::checkUpgrade(false)) {
         if (OC_Appconfig::getValue('core', 'backgroundjobs_mode', 'ajax') == 'ajax') {
             OC_Util::addScript('backgroundjobs');
         }
     }
 }
Пример #20
0
 /**
  * Limit maintenance mode access
  * @param IRequest $request
  */
 public static function checkMaintenanceMode(IRequest $request)
 {
     // Check if requested URL matches 'index.php/occ'
     $isOccControllerRequested = preg_match('|/index\\.php$|', $request->getScriptName()) === 1 && strpos($request->getPathInfo(), '/occ/') === 0;
     // Allow ajax update script to execute without being stopped
     if (\OC::$server->getSystemConfig()->getValue('maintenance', false) && OC::$SUBURI != '/core/ajax/update.php' && !$isOccControllerRequested) {
         // send http status 503
         header('HTTP/1.1 503 Service Temporarily Unavailable');
         header('Status: 503 Service Temporarily Unavailable');
         header('Retry-After: 120');
         // render error page
         $template = new OC_Template('', 'update.user', 'guest');
         OC_Util::addScript('maintenance-check');
         $template->printPage();
         die;
     }
 }
* @author Arthur Schiwon
* @copyright 2011 Arthur Schiwon blizzz@arthur-schiwon.de
* 
* 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';
// Check if we are a user
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('bookmarks');
require_once 'bookmarksHelper.php';
OC_App::setActiveNavigationEntry('bookmarks_index');
OC_Util::addScript('bookmarks', 'addBm');
OC_Util::addStyle('bookmarks', 'bookmarks');
$tmpl = new OC_Template('bookmarks', 'addBm', 'user');
$url = isset($_GET['url']) ? urldecode($_GET['url']) : '';
$metadata = getURLMetadata($url);
$tmpl->assign('URL', htmlentities($metadata['url']));
$tmpl->assign('TITLE', htmlentities($metadata['title']));
$tmpl->printPage();
Пример #22
0
 * 
 * NOTE: to make sure that the hooks are called everytime that a file is written, the application
 * must be registered with type "filesystem". Otherwise, those hooks will be called only when uploading from the web interface
 * 
 * to register the application as a filesystem type, put in info.xml * 
 * <types><filesystem/></types>
 *
 */
#OC_Hook::connect(OC\Files\Filesystem::CLASSNAME, OC\Files\Filesystem::signal_write, "OC_Neurocloud", "beforeFileWrite");
#OC_Hook::connect(OC\Files\Filesystem::CLASSNAME, OC\Files\Filesystem::signal_post_write, "OC_Neurocloud", "afterFileWrite");
OC_Hook::connect(OC\Files\Filesystem::CLASSNAME, 'post_delete', "OC_Neurocloud", "fileDeleted");
OC_Hook::connect(OC\Files\Filesystem::CLASSNAME, OC\Files\Filesystem::signal_post_rename, "OC_Neurocloud", "fileRenamed");
// hooks for delete/rename, do not allow deleting of directory if there is a running job
OC_Hook::connect(OC\Files\Filesystem::CLASSNAME, OC\Files\Filesystem::signal_delete, "OC_Neurocloud", "beforeFileRenameDelete");
OC_Hook::connect(OC\Files\Filesystem::CLASSNAME, OC\Files\Filesystem::signal_rename, "OC_Neurocloud", "beforeFileRenameDelete");
/**
 * User hooks:
 * - before login, check if the user has a home folder correctly mounted on the kore storage. Abort login if not.
 * - before creating the user, generate a RSA private key
 * - after deleting the user, delete the private key
 */
OC_Hook::connect("OC_User", "pre_createUser", "OC_Neurocloud", "beforeCreateUser");
OC_Hook::connect("OC_User", "post_deleteUser", "OC_Neurocloud", "afterDeleteUser");
OC_Hook::connect("OC_User", "pre_login", "OC_Neurocloud", "beforeLogin");
/**
 * add Javascript code
 */
OC_Util::addScript("neurocloud", "neurocloud");
// register the fileproxy implementation. This subtitutes the old pre/post write hook because of implementation changes of owncloud 5.0.0
include_once 'neurocloud/lib/proxy.php';
OC_FileProxy::register(new NC_FileProxy());
Пример #23
0
* 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/>.
*
*/
OC_Util::addStyle('ocdownloader', 'styles');
OC_Util::addScript('3rdparty', 'chosen/chosen.jquery.min');
OC_Util::addStyle('3rdparty', 'chosen');
OC_Util::addScript('ocdownloader', 'functions');
?>

<div id="ocdownloader">
	<div class="personalblock topblock titleblock">
		ocDownloader
	</div>
	<?php 
if (isset($_['curl_error'])) {
    ?>
	<div class="personalblock red">
		<?php 
    print $_['curl_error'];
    ?>
	</div>
	<?php 
Пример #24
0
 /**
  * add a javascript file
  * @param string $application
  * @param string $file
  * @since 4.0.0
  */
 public static function addScript($application, $file = null)
 {
     \OC_Util::addScript($application, $file);
 }
Пример #25
0
 public static function initTemplateEngine($renderAs)
 {
     if (self::$initTemplateEngineFirstRun) {
         //apps that started before the template initialization can load their own scripts/styles
         //so to make sure this scripts/styles here are loaded first we use OC_Util::addScript() with $prepend=true
         //meaning the last script/style in this list will be loaded first
         if (\OC::$server->getSystemConfig()->getValue('installed', false) && $renderAs !== 'error' && !\OCP\Util::needUpgrade()) {
             if (\OC::$server->getConfig()->getAppValue('core', 'backgroundjobs_mode', 'ajax') == 'ajax') {
                 OC_Util::addScript('backgroundjobs', null, true);
             }
         }
         OC_Util::addStyle("tooltip", null, true);
         OC_Util::addStyle('jquery-ui-fixes', null, true);
         OC_Util::addVendorStyle('jquery-ui/themes/base/jquery-ui', null, true);
         OC_Util::addStyle("multiselect", null, true);
         OC_Util::addStyle("fixes", null, true);
         OC_Util::addStyle("global", null, true);
         OC_Util::addStyle("apps", null, true);
         OC_Util::addStyle("fonts", null, true);
         OC_Util::addStyle("icons", null, true);
         OC_Util::addStyle("mobile", null, true);
         OC_Util::addStyle("header", null, true);
         OC_Util::addStyle("inputs", null, true);
         OC_Util::addStyle("styles", null, true);
         // avatars
         if (\OC::$server->getSystemConfig()->getValue('enable_avatars', true) === true) {
             \OC_Util::addScript('avatar', null, true);
             \OC_Util::addScript('jquery.avatar', null, true);
             \OC_Util::addScript('placeholder', null, true);
         }
         OC_Util::addScript('oc-backbone', null, true);
         OC_Util::addVendorScript('core', 'backbone/backbone', true);
         OC_Util::addVendorScript('snapjs/dist/latest/snap', null, true);
         OC_Util::addScript('mimetypelist', null, true);
         OC_Util::addScript('mimetype', null, true);
         OC_Util::addScript("apps", null, true);
         OC_Util::addScript("oc-requesttoken", null, true);
         OC_Util::addScript('search', 'search', true);
         OC_Util::addScript("config", null, true);
         OC_Util::addScript("eventsource", null, true);
         OC_Util::addScript("octemplate", null, true);
         OC_Util::addTranslations("core", null, true);
         OC_Util::addScript("l10n", null, true);
         OC_Util::addScript("js", null, true);
         OC_Util::addScript("oc-dialogs", null, true);
         OC_Util::addScript("jquery.ocdialog", null, true);
         OC_Util::addStyle("jquery.ocdialog");
         OC_Util::addScript("compatibility", null, true);
         OC_Util::addScript("placeholders", null, true);
         OC_Util::addScript('files/fileinfo');
         OC_Util::addScript('files/client');
         // Add the stuff we need always
         // following logic will import all vendor libraries that are
         // specified in core/js/core.json
         $fileContent = file_get_contents(OC::$SERVERROOT . '/core/js/core.json');
         if ($fileContent !== false) {
             $coreDependencies = json_decode($fileContent, true);
             foreach (array_reverse($coreDependencies['vendor']) as $vendorLibrary) {
                 // remove trailing ".js" as addVendorScript will append it
                 OC_Util::addVendorScript(substr($vendorLibrary, 0, strlen($vendorLibrary) - 3), null, true);
             }
         } else {
             throw new \Exception('Cannot read core/js/core.json');
         }
         if (\OC::$server->getRequest()->isUserAgent([\OC\AppFramework\Http\Request::USER_AGENT_IE])) {
             // shim for the davclient.js library
             \OCP\Util::addScript('files/iedavclient');
         }
         self::$initTemplateEngineFirstRun = false;
     }
 }
Пример #26
0
 * Copyright (c) 2011, Robin Appelman <*****@*****.**>
 * This file is licensed under the Affero General Public License version 3 or later.
 * See the COPYING-README file.
 */
OC_Util::checkLoggedIn();
OC_App::loadApps();
$defaults = new OC_Defaults();
// initialize themable default strings and urls
// Highlight navigation entry
OC_Util::addScript('settings', 'personal');
OC_Util::addStyle('settings', 'settings');
OC_Util::addScript('3rdparty', 'chosen/chosen.jquery.min');
OC_Util::addStyle('3rdparty', 'chosen');
\OC_Util::addScript('files', 'jquery.fileupload');
if (\OC_Config::getValue('enable_avatars', true) === true) {
    \OC_Util::addScript('3rdparty/Jcrop', 'jquery.Jcrop.min');
    \OC_Util::addStyle('3rdparty/Jcrop', 'jquery.Jcrop.min');
}
OC_App::setActiveNavigationEntry('personal');
$storageInfo = OC_Helper::getStorageInfo('/');
$email = OC_Preferences::getValue(OC_User::getUser(), 'settings', 'email', '');
$userLang = OC_Preferences::getValue(OC_User::getUser(), 'core', 'lang', OC_L10N::findLanguage());
$languageCodes = OC_L10N::findAvailableLanguages();
//check if encryption was enabled in the past
$enableDecryptAll = OC_Util::encryptedFiles();
// array of common languages
$commonlangcodes = array('en', 'es', 'fr', 'de', 'de_DE', 'ja_JP', 'ar', 'ru', 'nl', 'it', 'pt_BR', 'pt_PT', 'da', 'fi_FI', 'nb_NO', 'sv', 'zh_CN', 'ko');
$languageNames = (include 'languageCodes.php');
$languages = array();
$commonlanguages = array();
foreach ($languageCodes as $lang) {
Пример #27
0
<?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();
<?php

require_once 'apps/files_sharing/sharedstorage.php';
OC::$CLASSPATH['OC_Share'] = "apps/files_sharing/lib_share.php";
OC_Hook::connect("OC_Filesystem", "post_delete", "OC_Share", "deleteItem");
OC_Hook::connect("OC_Filesystem", "post_rename", "OC_Share", "renameItem");
OC_Filesystem::registerStorageType("shared", "OC_Filestorage_Shared", array("datadir" => "string"));
OC_Util::addScript("files_sharing", "share");
OC_Util::addScript("3rdparty", "chosen/chosen.jquery.min");
OC_Util::addStyle('files_sharing', 'sharing');
OC_Util::addStyle("3rdparty", "chosen/chosen");
 *
 * 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/>.
 *
 */
// Init owncloud
require_once '../lib/base.php';
// Check if we are a user
OC_Util::checkLoggedIn();
// Load the files we need
OC_Util::addStyle("files", "files");
OC_Util::addScript("files", "files");
OC_Util::addScript('files', 'filelist');
OC_Util::addScript('files', 'fileactions');
if (!isset($_SESSION['timezone'])) {
    OC_Util::addScript('files', 'timezone');
}
OC_App::setActiveNavigationEntry("files_index");
// Load the files
$dir = isset($_GET['dir']) ? stripslashes($_GET['dir']) : '';
// Redirect if directory does not exist
if (!OC_Filesystem::is_dir($dir . '/')) {
    header("Location: " . $_SERVER['PHP_SELF'] . "");
}
$files = array();
foreach (OC_Files::getdirectorycontent($dir) as $i) {
    $i["date"] = OC_Util::formatDate($i["mtime"]);
    if ($i['type'] == 'file') {
        $fileinfo = pathinfo($i['name']);
        $i['basename'] = $fileinfo['filename'];
        if (!empty($fileinfo['extension'])) {
Пример #30
0
 /**
  * Register a sharing backend class that implements OCP\Share_Backend for an item type
  * @param string $itemType Item type
  * @param string $class Backend class
  * @param string $collectionOf (optional) Depends on item type
  * @param array $supportedFileExtensions (optional) List of supported file extensions if this item type depends on files
  * @return boolean true if backend is registered or false if error
  */
 public static function registerBackend($itemType, $class, $collectionOf = null, $supportedFileExtensions = null)
 {
     if (self::isEnabled()) {
         if (!isset(self::$backendTypes[$itemType])) {
             self::$backendTypes[$itemType] = array('class' => $class, 'collectionOf' => $collectionOf, 'supportedFileExtensions' => $supportedFileExtensions);
             if (count(self::$backendTypes) === 1) {
                 \OC_Util::addScript('core', 'shareconfigmodel');
                 \OC_Util::addScript('core', 'shareitemmodel');
                 \OC_Util::addScript('core', 'sharedialogresharerinfoview');
                 \OC_Util::addScript('core', 'sharedialoglinkshareview');
                 \OC_Util::addScript('core', 'sharedialogmailview');
                 \OC_Util::addScript('core', 'sharedialogexpirationview');
                 \OC_Util::addScript('core', 'sharedialogshareelistview');
                 \OC_Util::addScript('core', 'sharedialogview');
                 \OC_Util::addScript('core', 'share');
                 \OC_Util::addStyle('core', 'share');
             }
             return true;
         }
         \OCP\Util::writeLog('OCP\\Share', 'Sharing backend ' . $class . ' not registered, ' . self::$backendTypes[$itemType]['class'] . ' is already registered for ' . $itemType, \OCP\Util::WARN);
     }
     return false;
 }