Beispiel #1
0
 /**
  * @brief Constructor.
  * @param $imageref The path to a local file, a base64 encoded string or a resource created by an imagecreate* function.
  * @returns bool False on error
  */
 public function __construct($imageRef = null)
 {
     //OC_Log::write('core',__METHOD__.'(): start', OC_Log::DEBUG);
     if (!extension_loaded('gd') || !function_exists('gd_info')) {
         OC_Log::write('core', __METHOD__ . '(): GD module not installed', OC_Log::ERROR);
         return false;
     }
     if (\OC_Util::fileInfoLoaded()) {
         $this->fileInfo = new finfo(FILEINFO_MIME_TYPE);
     }
     if (!is_null($imageRef)) {
         $this->load($imageRef);
     }
 }
Beispiel #2
0
 /**
  * Constructor.
  *
  * @param resource|string $imageRef The path to a local file, a base64 encoded string or a resource created by
  * an imagecreate* function.
  * @param \OCP\ILogger $logger
  */
 public function __construct($imageRef = null, $logger = null)
 {
     $this->logger = $logger;
     if (is_null($logger)) {
         $this->logger = \OC::$server->getLogger();
     }
     if (!extension_loaded('gd') || !function_exists('gd_info')) {
         $this->logger->error(__METHOD__ . '(): GD module not installed', array('app' => 'core'));
         return false;
     }
     if (\OC_Util::fileInfoLoaded()) {
         $this->fileInfo = new finfo(FILEINFO_MIME_TYPE);
     }
     if (!is_null($imageRef)) {
         $this->load($imageRef);
     }
 }
// warn if Windows is used
$template->assign('WindowsWarning', OC_Util::runningOnWindows());
// warn if outdated version of a memcache module is used
$caches = ['apcu' => ['name' => $l->t('APCu'), 'version' => '4.0.6'], 'redis' => ['name' => $l->t('Redis'), 'version' => '2.2.5']];
$outdatedCaches = [];
foreach ($caches as $php_module => $data) {
    $isOutdated = extension_loaded($php_module) && version_compare(phpversion($php_module), $data['version'], '<');
    if ($isOutdated) {
        $outdatedCaches[$php_module] = $data;
    }
}
$template->assign('OutdatedCacheWarning', $outdatedCaches);
// add hardcoded forms from the template
$forms = OC_App::getForms('admin');
$formsAndMore = array();
if ($request->getServerProtocol() !== 'https' || !OC_Util::isAnnotationsWorking() || $suggestedOverwriteCliUrl || !OC_Util::isSetLocaleWorking() || !OC_Util::fileInfoLoaded() || $databaseOverload) {
    $formsAndMore[] = array('anchor' => 'security-warning', 'section-name' => $l->t('Security & setup warnings'));
}
$formsAndMore[] = array('anchor' => 'shareAPI', 'section-name' => $l->t('Sharing'));
$formsAndMore[] = ['anchor' => 'encryptionAPI', 'section-name' => $l->t('Server-side encryption')];
// Prioritize fileSharingSettings and files_external and move updater to the version
$fileSharingSettings = $filesExternal = $updaterAppPanel = $ocDefaultEncryptionModulePanel = '';
foreach ($forms as $index => $form) {
    if (strpos($form, 'id="fileSharingSettings"')) {
        $fileSharingSettings = $form;
        unset($forms[$index]);
        continue;
    }
    if (strpos($form, 'id="files_external"')) {
        $filesExternal = $form;
        unset($forms[$index]);
Beispiel #4
0
 public function testFileInfoLoaded()
 {
     $expected = function_exists('finfo_open');
     $this->assertEquals($expected, \OC_Util::fileInfoLoaded());
 }
Beispiel #5
0
$template->assign('allowPublicMailNotification', $appConfig->getValue('core', 'shareapi_allow_public_notification', 'no'));
$template->assign('allowMailNotification', $appConfig->getValue('core', 'shareapi_allow_mail_notification', 'no'));
$template->assign('onlyShareWithGroupMembers', \OC\Share\Share::shareWithGroupMembersOnly());
$databaseOverload = (strpos(\OCP\Config::getSystemValue('dbtype'), 'sqlite') !== false);
$template->assign('databaseOverload', $databaseOverload);

// warn if Windows is used
$template->assign('WindowsWarning', OC_Util::runningOnWindows());

// add hardcoded forms from the template
$forms = OC_App::getForms('admin');
$l = OC_L10N::get('settings');
$formsAndMore = array();
if (OC_Request::serverProtocol() !== 'https' || !OC_Util::isAnnotationsWorking() ||
	$suggestedOverwriteCliUrl || !OC_Util::isSetLocaleWorking() || !OC_Util::isPhpCharSetUtf8() ||
	!OC_Util::fileInfoLoaded() || $databaseOverload
) {
	$formsAndMore[] = array('anchor' => 'security-warning', 'section-name' => $l->t('Security & Setup Warnings'));
}

$formsMap = array_map(function ($form) {
	if (preg_match('%(<h2[^>]*>.*?</h2>)%i', $form, $regs)) {
		$sectionName = str_replace('<h2>', '', $regs[0]);
		$sectionName = str_replace('</h2>', '', $sectionName);
		$anchor = strtolower($sectionName);
		$anchor = str_replace(' ', '-', $anchor);

		return array(
			'anchor' => 'goto-' . $anchor,
			'section-name' => $sectionName,
			'form' => $form
Beispiel #6
0
$tmpl->assign('mail_from_address', OC_Config::getValue("mail_from_address", ''));
$tmpl->assign('mail_smtpmode', OC_Config::getValue("mail_smtpmode", ''));
$tmpl->assign('mail_smtpsecure', OC_Config::getValue("mail_smtpsecure", ''));
$tmpl->assign('mail_smtphost', OC_Config::getValue("mail_smtphost", ''));
$tmpl->assign('mail_smtpport', OC_Config::getValue("mail_smtpport", ''));
$tmpl->assign('mail_smtpauthtype', OC_Config::getValue("mail_smtpauthtype", ''));
$tmpl->assign('mail_smtpauth', OC_Config::getValue("mail_smtpauth", false));
$tmpl->assign('mail_smtpname', OC_Config::getValue("mail_smtpname", ''));
$tmpl->assign('mail_smtppassword', OC_Config::getValue("mail_smtppassword", ''));
$tmpl->assign('entries', $entries);
$tmpl->assign('entriesremain', $entriesremain);
$tmpl->assign('htaccessworking', $htaccessworking);
$tmpl->assign('readOnlyConfigEnabled', OC_Helper::isReadOnlyConfigEnabled());
$tmpl->assign('isLocaleWorking', OC_Util::isSetLocaleWorking());
$tmpl->assign('isAnnotationsWorking', OC_Util::isAnnotationsWorking());
$tmpl->assign('has_fileinfo', OC_Util::fileInfoLoaded());
$tmpl->assign('old_php', OC_Util::isPHPoutdated());
$tmpl->assign('backgroundjobs_mode', OC_Appconfig::getValue('core', 'backgroundjobs_mode', 'ajax'));
$tmpl->assign('cron_log', OC_Config::getValue('cron_log', true));
$tmpl->assign('lastcron', OC_Appconfig::getValue('core', 'lastcron', false));
$tmpl->assign('shareAPIEnabled', OC_Appconfig::getValue('core', 'shareapi_enabled', 'yes'));
$tmpl->assign('shareDefaultExpireDateSet', OC_Appconfig::getValue('core', 'shareapi_default_expire_date', 'no'));
$tmpl->assign('shareExpireAfterNDays', OC_Appconfig::getValue('core', 'shareapi_expire_after_n_days', '7'));
$tmpl->assign('shareEnforceExpireDate', OC_Appconfig::getValue('core', 'shareapi_enforce_expire_date', 'no'));
$excludeGroups = OC_Appconfig::getValue('core', 'shareapi_exclude_groups', 'no') === 'yes' ? true : false;
$tmpl->assign('shareExcludeGroups', $excludeGroups);
$excludedGroupsList = OC_Appconfig::getValue('core', 'shareapi_exclude_groups_list', '');
$excludedGroupsList = explode(',', $excludedGroupsList);
// FIXME: this should be JSON!
$tmpl->assign('shareExcludedGroupsList', implode('|', $excludedGroupsList));
// Check if connected using HTTPS
Beispiel #7
0
$suggestedOverwriteCliUrl = $shouldSuggestOverwriteCliUrl ? \OC::$WEBROOT : '';
$template->assign('suggestedOverwriteCliUrl', $suggestedOverwriteCliUrl);
$template->assign('allowLinks', $appConfig->getValue('core', 'shareapi_allow_links', 'yes'));
$template->assign('enforceLinkPassword', \OCP\Util::isPublicLinkPasswordRequired());
$template->assign('allowPublicUpload', $appConfig->getValue('core', 'shareapi_allow_public_upload', 'yes'));
$template->assign('allowResharing', $appConfig->getValue('core', 'shareapi_allow_resharing', 'yes'));
$template->assign('allowPublicMailNotification', $appConfig->getValue('core', 'shareapi_allow_public_notification', 'no'));
$template->assign('allowMailNotification', $appConfig->getValue('core', 'shareapi_allow_mail_notification', 'no'));
$template->assign('onlyShareWithGroupMembers', \OC\Share\Share::shareWithGroupMembersOnly());
$databaseOverload = strpos(\OCP\Config::getSystemValue('dbtype'), 'sqlite') !== false;
$template->assign('databaseOverload', $databaseOverload);
// add hardcoded forms from the template
$forms = OC_App::getForms('admin');
$l = OC_L10N::get('settings');
$formsAndMore = array();
if (OC_Request::serverProtocol() !== 'https' || !OC_Util::isAnnotationsWorking() || $suggestedOverwriteWebRoot || !OC_Util::isSetLocaleWorking() || !OC_Util::isPhpCharSetUtf8() || !OC_Util::fileInfoLoaded() || $databaseOverload) {
    $formsAndMore[] = array('anchor' => 'security-warning', 'section-name' => $l->t('Security & Setup Warnings'));
}
$formsMap = array_map(function ($form) {
    if (preg_match('%(<h2[^>]*>.*?</h2>)%i', $form, $regs)) {
        $sectionName = str_replace('<h2>', '', $regs[0]);
        $sectionName = str_replace('</h2>', '', $sectionName);
        $anchor = strtolower($sectionName);
        $anchor = str_replace(' ', '-', $anchor);
        return array('anchor' => 'goto-' . $anchor, 'section-name' => $sectionName, 'form' => $form);
    }
    return array('form' => $form);
}, $forms);
$formsAndMore = array_merge($formsAndMore, $formsMap);
// add bottom hardcoded forms from the template
$formsAndMore[] = array('anchor' => 'backgroundjobs', 'section-name' => $l->t('Cron'));
Beispiel #8
0
$template->assign('mail_smtpsecure', $config->getSystemValue("mail_smtpsecure", ''));
$template->assign('mail_smtphost', $config->getSystemValue("mail_smtphost", ''));
$template->assign('mail_smtpport', $config->getSystemValue("mail_smtpport", ''));
$template->assign('mail_smtpauthtype', $config->getSystemValue("mail_smtpauthtype", ''));
$template->assign('mail_smtpauth', $config->getSystemValue("mail_smtpauth", false));
$template->assign('mail_smtpname', $config->getSystemValue("mail_smtpname", ''));
$template->assign('mail_smtppassword', $config->getSystemValue("mail_smtppassword", ''));
$template->assign('entries', $entries);
$template->assign('entriesremain', $entriesRemaining);
$template->assign('logFileSize', $logFileSize);
$template->assign('doesLogFileExist', $doesLogFileExist);
$template->assign('showLog', $showLog);
$template->assign('readOnlyConfigEnabled', OC_Helper::isReadOnlyConfigEnabled());
$template->assign('isLocaleWorking', OC_Util::isSetLocaleWorking());
$template->assign('isAnnotationsWorking', OC_Util::isAnnotationsWorking());
$template->assign('has_fileinfo', OC_Util::fileInfoLoaded());
$template->assign('backgroundjobs_mode', $appConfig->getValue('core', 'backgroundjobs_mode', 'ajax'));
$template->assign('cron_log', $config->getSystemValue('cron_log', true));
$template->assign('lastcron', $appConfig->getValue('core', 'lastcron', false));
$template->assign('shareAPIEnabled', $appConfig->getValue('core', 'shareapi_enabled', 'yes'));
$template->assign('shareDefaultExpireDateSet', $appConfig->getValue('core', 'shareapi_default_expire_date', 'no'));
$template->assign('shareExpireAfterNDays', $appConfig->getValue('core', 'shareapi_expire_after_n_days', '7'));
$template->assign('shareEnforceExpireDate', $appConfig->getValue('core', 'shareapi_enforce_expire_date', 'no'));
$excludeGroups = $appConfig->getValue('core', 'shareapi_exclude_groups', 'no') === 'yes' ? true : false;
$template->assign('shareExcludeGroups', $excludeGroups);
$excludedGroupsList = $appConfig->getValue('core', 'shareapi_exclude_groups_list', '');
$excludedGroupsList = explode(',', $excludedGroupsList);
// FIXME: this should be JSON!
$template->assign('shareExcludedGroupsList', implode('|', $excludedGroupsList));
$template->assign('encryptionEnabled', \OC::$server->getEncryptionManager()->isEnabled());
$backends = \OC::$server->getUserManager()->getBackends();