echo("3rdparty directory not found! Please put the ownCloud 3rdparty folder in the ownCloud folder or the folder above. You can also configure the location in the config.php file.");
echo("3rdparty directory not found! Please put the ownCloud 3rdparty'
.' folder in the ownCloud folder or the folder above.'
.' You can also configure the location in the config.php file.");
echo("apps directory not found! Please put the ownCloud apps folder in the ownCloud folder or the folder above. You can also configure the location in the config.php file.");
echo("apps directory not found! Please put the ownCloud apps folder in the ownCloud folder'
.' or the folder above. You can also configure the location in the config.php file.");
exit;
}
$paths = array();
@ -202,9 +209,14 @@ class OC {
}
public static function checkConfig() {
if (file_exists(OC::$SERVERROOT . "/config/config.php") and !is_writable(OC::$SERVERROOT . "/config/config.php")) {
if (file_exists(OC::$SERVERROOT . "/config/config.php")
and !is_writable(OC::$SERVERROOT . "/config/config.php")) {
$tmpl = new OC_Template('', 'error', 'guest');
$tmpl->assign('errors', array(1 => array('error' => "Can't write into config directory 'config'", 'hint' => "You can usually fix this by giving the webserver user write access to the config directory in owncloud")));
$tmpl->assign('errors', array(1 => array(
'error' => "Can't write into config directory 'config'",
'hint' => "You can usually fix this by giving the webserver user write access'
.' to the config directory in owncloud"
)));
$tmpl->printPage();
exit();
}
@ -257,7 +269,9 @@ class OC {
if (version_compare($currentVersion, $installedVersion, '>')) {
if ($showTemplate && !OC_Config::getValue('maintenance', false)) {
OC_Config::setValue('maintenance', true);
OC_Log::write('core', 'starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, OC_Log::DEBUG);
OC_Log::write('core',
'starting upgrade from ' . $installedVersion . ' to ' . $currentVersion,
'hint' => $l->t('Files need to be downloaded one by one.') . '<br/><ahref="javascript:history.back()">' . $l->t('Back to Files') . '</a>',
'hint' => $l->t('Files need to be downloaded one by one.')
. '<br/><ahref="javascript:history.back()">' . $l->t('Back to Files') . '</a>',
)
);
$tmpl->assign('errors', $errors);
@ -225,7 +226,9 @@ class OC_Files {
$errors = array(
array(
'error' => $l->t('Selected files too large to generate zip file.'),
'hint' => 'Download the files in smaller chunks, seperately or kindly ask your administrator.<br/><ahref="javascript:history.back()">' . $l->t('Back to Files') . '</a>',
'hint' => 'Download the files in smaller chunks, seperately'
.' or kindly ask your administrator.<br/><ahref="javascript:history.back()">'
* get the mountpoint of the storage object for a path
( note: because a storage is not always mounted inside the fakeroot, the returned mountpoint is relative to the absolute root of the filesystem and doesn't take the chroot into account
* ( note: because a storage is not always mounted inside the fakeroot, the
* returned mountpoint is relative to the absolute root of the filesystem
* and doesn't take the chroot into account )
*
* @param string $path
* @return string
@ -318,7 +320,8 @@ class Filesystem {
/**
* return the path to a local version of the file
* we need this because we can't know if a file is stored local or not from outside the filestorage and for some purposes a local file is needed
* we need this because we can't know if a file is stored local or not from
* outside the filestorage and for some purposes a local file is needed
* get the mountpoint of the storage object for a path
( note: because a storage is not always mounted inside the fakeroot, the returned mountpoint is relative to the absolute root of the filesystem and doesn't take the chroot into account
* ( note: because a storage is not always mounted inside the fakeroot, the
* returned mountpoint is relative to the absolute root of the filesystem
* and doesn't take the chroot into account )
*
* @param string $path
* @return string
@ -113,7 +115,8 @@ class View {
/**
* return the path to a local version of the file
* we need this because we can't know if a file is stored local or not from outside the filestorage and for some purposes a local file is needed
* we need this because we can't know if a file is stored local or not from
* outside the filestorage and for some purposes a local file is needed
*
* @param string $path
* @return string
@ -252,7 +255,8 @@ class View {
public function file_put_contents($path, $data) {
if (is_resource($data)) { //not having to deal with streams in file_put_contents makes life easier
* get the mountpoint of the storage object for a path
( note: because a storage is not always mounted inside the fakeroot, the returned mountpoint is relative to the absolute root of the filesystem and doesn't take the chroot into account
* ( note: because a storage is not always mounted inside the fakeroot, the
* returned mountpoint is relative to the absolute root of the filesystem
* and doesn't take the chroot into account )
*
* @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem
* @param string $path
@ -115,7 +117,8 @@ class OC_Filesystem {
/**
* return the path to a local version of the file
* we need this because we can't know if a file is stored local or not from outside the filestorage and for some purposes a local file is needed
* we need this because we can't know if a file is stored local or not from
* outside the filestorage and for some purposes a local file is needed
*
* @deprecated OC_Filesystem is replaced by \OC\Files\Filesystem
@ -220,7 +222,12 @@ class OC_Group_Database extends OC_Group_Backend {
public function DisplayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0) {
$displayNames = '';
$stmt = OC_DB::prepare('SELECT `*PREFIX*users`.`uid`, `*PREFIX*users`.`displayname` FROM `*PREFIX*users` INNER JOIN `*PREFIX*group_user` ON `*PREFIX*group_user`.`uid` = `*PREFIX*users`.`uid` WHERE `gid` = ? AND `*PREFIX*group_user.uid` LIKE ?', $limit, $offset);
// check if the app is compatible with this version of ownCloud
$version=OC_Util::getVersion();
if(!isset($info['require']) or ($version[0]>$info['require'])) {
OC_Log::write('core', 'App can\'t be installed because it is not compatible with this version of ownCloud', OC_Log::ERROR);
OC_Log::write('core',
'App can\'t be installed because it is not compatible with this version of ownCloud',
OC_Log::ERROR);
OC_Helper::rmdirr($extractDir);
return false;
}
// check if shipped tag is set which is only allowed for apps that are shipped with ownCloud
if(isset($info['shipped']) and ($info['shipped']=='true')) {
OC_Log::write('core', 'App can\'t be installed because it contains the <shipped>true</shippe> tag which is not allowed for non shipped apps', OC_Log::ERROR);
OC_Log::write('core',
'App can\'t be installed because it contains the <shipped>true</shippe>'
.' tag which is not allowed for non shipped apps',
OC_Log::ERROR);
OC_Helper::rmdirr($extractDir);
return false;
}
// check if the ocs version is the same as the version in info.xml/version
if(!isset($info['version']) or ($info['version']<>$data['appdata']['version'])) {
OC_Log::write('core', 'App can\'t be installed because the version in info.xml/version is not the same as the version reported from the app store', OC_Log::ERROR);
OC_Log::write('core',
'App can\'t be installed because the version in info.xml/version is not the same'
.' as the version reported from the app store',
OC_Log::ERROR);
OC_Helper::rmdirr($extractDir);
return false;
}
@ -251,7 +259,8 @@ class OC_Installer{
* -# including appinfo/upgrade.php
* -# setting the installed version
*
* upgrade.php can determine the current installed version of the app using "OC_Appconfig::getValue($appid, 'installed_version')"
* upgrade.php can determine the current installed version of the app using
$txt='Invalid query, please check the syntax. API specifications are here: http://www.freedesktop.org/wiki/Specifications/open-collaboration-services. DEBUG OUTPUT:'."\n";
$txt='Invalid query, please check the syntax. API specifications are here:'
\OC_Log::write('OCP\Share', 'Sharing backend '.$class.' not registered, '.self::$backendTypes[$itemType]['class'].' is already registered for '.$itemType, \OC_Log::WARN);
\OC_Log::write('OCP\Share',
'Sharing backend '.$class.' not registered, '.self::$backendTypes[$itemType]['class']
.' is already registered for '.$itemType,
\OC_Log::WARN);
}
return false;
}
@ -99,8 +113,10 @@ class Share {
* @param int Number of items to return (optional) Returns all by default
* @return Return depends on format
*/
public static function getItemsSharedWith($itemType, $format = self::FORMAT_NONE, $parameters = null, $limit = -1, $includeCollections = false) {
// Only allow the same share to occur again if it is the same owner and is not a user share, this use case is for increasing permissions for a specific user
if ($checkExists = self::getItems($itemType, $itemSource, self::$shareTypeUserAndGroups,
// Only allow the same share to occur again if it is the same owner and is not a group share, this use case is for increasing permissions for a specific user
if ($checkExists = self::getItems($itemType, $itemSource, self::SHARE_TYPE_GROUP, $shareWith,
null, self::FORMAT_NONE, null, 1, true, true)) {
// Only allow the same share to occur again if it is the same
// owner and is not a group share, this use case is for increasing
// permissions for a specific user
if ($checkExists['uid_owner'] != $uidOwner || $checkExists['share_type'] == $shareType) {
$message = 'Sharing '.$itemSource.' failed, because this item is already shared with '.$shareWith;
private static function generateTarget($itemType, $itemSource, $shareType, $shareWith, $uidOwner,
$suggestedTarget = null, $groupParent = null) {
$backend = self::getBackend($itemType);
if ($shareType == self::SHARE_TYPE_LINK) {
if (isset($suggestedTarget)) {
@ -1143,18 +1230,28 @@ class Share {
// Find similar targets to improve backend's chances to generate a unqiue target
if ($userAndGroups) {
if ($column == 'file_target') {
$checkTargets = \OC_DB::prepare('SELECT `'.$column.'` FROM `*PREFIX*share` WHERE `item_type` IN (\'file\', \'folder\') AND `share_type` IN (?,?,?) AND `share_with` IN (\''.implode('\',\'', $userAndGroups).'\')');
$checkTargets = \OC_DB::prepare('SELECT `'.$column.'` FROM `*PREFIX*share` WHERE `item_type` = ? AND `share_type` IN (?,?,?) AND `share_with` IN (\''.implode('\',\'', $userAndGroups).'\')');
$checkTargets = \OC_DB::prepare('SELECT `'.$column.'` FROM `*PREFIX*share` WHERE `item_type` IN (\'file\', \'folder\') AND `share_type` = ? AND `share_with` = ?');
$checkTargets = \OC_DB::prepare('SELECT `'.$column.'` FROM `*PREFIX*share`'
// Check the owner on the first search of reshares, useful for finding and deleting the reshares by a single user of a group share
// Check the owner on the first search of reshares, useful for
// finding and deleting the reshares by a single user of a group share
if (count($ids) == 1 && isset($uidOwner)) {
$query = \OC_DB::prepare('SELECT `id`, `uid_owner`, `item_type`, `item_target`, `parent` FROM `*PREFIX*share` WHERE `parent` IN ('.$parents.') AND `uid_owner` = ?');
.' FROM `*PREFIX*share` WHERE `parent` IN ('.$parents.')');
$result = $query->execute();
}
// Reset parents array, only go through loop again if items are found
$parents = array();
while ($item = $result->fetchRow()) {
// Search for a duplicate parent share, this occurs when an item is shared to the same user through a group and user or the same item is shared by different users
// Search for a duplicate parent share, this occurs when an
// item is shared to the same user through a group and user or the
$query = \OC_DB::prepare('SELECT `id`, `permissions` FROM `*PREFIX*share` WHERE `item_type` = ? AND `item_target` = ? AND `share_type` IN (?,?,?) AND `share_with` IN (\''.implode('\',\'', $userAndGroups).'\') AND `uid_owner` != ? AND `id` != ?');
public static function post_removeFromGroup($arguments) {
// TODO Don't call if user deleted?
$query = \OC_DB::prepare('SELECT `id`, `share_type` FROM `*PREFIX*share` WHERE (`share_type` = ? AND `share_with` = ?) OR (`share_type` = ? AND `share_with` = ?)');
if(isset($data['version']) and $data['version']<>'') {
$txt='<spanstyle="color:#AA0000; font-weight:bold;">'.$l->t('%s is available. Get <ahref="%s">more information</a>', array($data['versionstring'], $data['web'])).'</span>';
// hint: We only can count up. So the internal version number of ownCloud 4.5 will be 4.90.0. This is not visible to the user
// hint: We only can count up. So the internal version number
// of ownCloud 4.5 will be 4.90.0. This is not visible to the user
return array(4, 92, 10);
}
@ -86,7 +87,9 @@ class OC_Util {
}
/**
* get the current installed edition of ownCloud. There is the community edition that just returns an empty string and the enterprise edition that returns "Enterprise".
* get the current installed edition of ownCloud. There is the community
* edition that just returns an empty string and the enterprise edition
* that returns "Enterprise".
* @return string
*/
public static function getEditionString() {
@ -166,24 +169,33 @@ class OC_Util {
$web_server_restart= false;
//check for database drivers
if(!(is_callable('sqlite_open') or class_exists('SQLite3')) and !is_callable('mysql_connect') and !is_callable('pg_connect')) {
$errors[]=array('error'=>'No database drivers (sqlite, mysql, or postgresql) installed.<br/>', 'hint'=>'');//TODO: sane hint
if(!(is_callable('sqlite_open') or class_exists('SQLite3'))
and !is_callable('mysql_connect')
and !is_callable('pg_connect')) {
$errors[]=array('error'=>'No database drivers (sqlite, mysql, or postgresql) installed.<br/>',
'hint'=>'');//TODO: sane hint
$web_server_restart= true;
}
//common hint for all file permissons error messages
$permissionsHint="Permissions can usually be fixed by giving the webserver write access to the ownCloud directory";
$permissionsHint="Permissions can usually be fixed by giving the webserver write access'
.' to the ownCloud directory";
// Check if config folder is writable.
if(!is_writable(OC::$SERVERROOT."/config/") or !is_readable(OC::$SERVERROOT."/config/")) {
$errors[]=array('error'=>"Can't write into config directory 'config'", 'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud");
$errors[]=array('error'=>"Can't write into config directory 'config'",
'hint'=>"You can usually fix this by giving the webserver user write access'
$errors[]=array('error'=>"Can't write into apps directory", 'hint'=>"You can usually fix this by giving the webserver user write access to the apps directory
in owncloud or disabling the appstore in the config file.");
if( OC_App::getInstallPath() === null
|| !is_writable(OC_App::getInstallPath())
|| !is_readable(OC_App::getInstallPath()) ) {
$errors[]=array('error'=>"Can't write into apps directory",
'hint'=>"You can usually fix this by giving the webserver user write access'
.' to the apps directory in owncloud or disabling the appstore in the config file.");
$errors[]=array('error'=>"Can't create data directory (".$CONFIG_DATADIRECTORY.")", 'hint'=>"You can usually fix this by giving the webserver write access to the ownCloud directory '".OC::$SERVERROOT."' (in a terminal, use the command 'chown -R www-data:www-data /path/to/your/owncloud/install/data' ");
$errors[]=array('error'=>"Can't create data directory (".$CONFIG_DATADIRECTORY.")",
'hint'=>"You can usually fix this by giving the webserver write access to the ownCloud directory '"
.OC::$SERVERROOT."' (in a terminal, use the command "
$errors[]=array('error'=>'PHP module zip not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
$errors[]=array('error'=>'PHP module zip not installed.<br/>',
'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(!function_exists('mb_detect_encoding')) {
$errors[]=array('error'=>'PHP module mb multibyte not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
$errors[]=array('error'=>'PHP module mb multibyte not installed.<br/>',
'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(!function_exists('ctype_digit')) {
$errors[]=array('error'=>'PHP module ctype is not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
$errors[]=array('error'=>'PHP module ctype is not installed.<br/>',
'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(!function_exists('json_encode')) {
$errors[]=array('error'=>'PHP module JSON is not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
$errors[]=array('error'=>'PHP module JSON is not installed.<br/>',
'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(!function_exists('imagepng')) {
$errors[]=array('error'=>'PHP module GD is not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
$errors[]=array('error'=>'PHP module GD is not installed.<br/>',
'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(!function_exists('gzencode')) {
$errors[]=array('error'=>'PHP module zlib is not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
$errors[]=array('error'=>'PHP module zlib is not installed.<br/>',
'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(!function_exists('iconv')) {
$errors[]=array('error'=>'PHP module iconv is not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
$errors[]=array('error'=>'PHP module iconv is not installed.<br/>',
'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(!function_exists('simplexml_load_string')) {
$errors[]=array('error'=>'PHP module SimpleXML is not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
$errors[]=array('error'=>'PHP module SimpleXML is not installed.<br/>',
'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
if(floatval(phpversion())<5.3){
$errors[]=array('error'=>'PHP 5.3 is required.<br/>', 'hint'=>'Please ask your server administrator to update PHP to version 5.3 or higher. PHP 5.2 is no longer supported by ownCloud and the PHP community.');
$errors[]=array('error'=>'PHP 5.3 is required.<br/>',
'hint'=>'Please ask your server administrator to update PHP to version 5.3 or higher.'
.' PHP 5.2 is no longer supported by ownCloud and the PHP community.');
$web_server_restart= false;
}
if(!defined('PDO::ATTR_DRIVER_NAME')) {
$errors[]=array('error'=>'PHP PDO module is not installed.<br/>', 'hint'=>'Please ask your server administrator to install the module.');
$errors[]=array('error'=>'PHP PDO module is not installed.<br/>',
'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
@ -248,14 +275,17 @@ class OC_Util {
$tmpDir = session_save_path();
if($tmpDir != "") {
if(!@is_writable($tmpDir)) {
$errors[]=array('error' => 'The temporary folder used by PHP to save the session data is either incorrect or not writable! Please check : '.session_save_path().'<br/>',
'hint'=>'Please ask your server administrator to grant write access or define another temporary folder.');
$errors[]=array('error' => 'The temporary folder used by PHP to save the session data'
.' is either incorrect or not writable! Please check : '.session_save_path().'<br/>',
'hint'=>'Please ask your server administrator to grant write access'
.' or define another temporary folder.');
}
}
}
if($web_server_restart) {
$errors[]=array('error'=>'PHP modules have been installed, but they are still listed as missing?<br/>', 'hint'=>'Please ask your server administrator to restart the web server.');
$errors[]=array('error'=>'PHP modules have been installed, but they are still listed as missing?<br/>',
'hint'=>'Please ask your server administrator to restart the web server.');
}
return $errors;
@ -270,14 +300,16 @@ class OC_Util {
if (stristr(PHP_OS, 'WIN')) {
//TODO: permissions checks for windows hosts
} else {
$permissionsModHint = 'Please change the permissions to 0770 so that the directory cannot be listed by other users.';
$permissionsModHint = 'Please change the permissions to 0770 so that the directory'