Exemple #1
0
 public static function sendEmail($args)
 {
     if (OC_User::userExists($_POST['user'])) {
         $token = hash('sha256', OC_Util::generate_random_bytes(30) . OC_Config::getValue('passwordsalt', ''));
         OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', hash('sha256', $token));
         // Hash the token again to prevent timing attacks
         $email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', '');
         if (!empty($email)) {
             $link = OC_Helper::linkToRoute('core_lostpassword_reset', array('user' => $_POST['user'], 'token' => $token));
             $link = OC_Helper::makeURLAbsolute($link);
             $tmpl = new OC_Template('core/lostpassword', 'email');
             $tmpl->assign('link', $link, false);
             $msg = $tmpl->fetchPage();
             $l = OC_L10N::get('core');
             $from = 'lostpassword-noreply@' . OCP\Util::getServerHost();
             OC_Mail::send($email, $_POST['user'], $l->t('ownCloud password reset'), $msg, $from, 'ownCloud');
             echo 'Mailsent';
             self::displayLostPasswordPage(false, true);
         } else {
             self::displayLostPasswordPage(true, false);
         }
     } else {
         self::displayLostPasswordPage(true, false);
     }
 }
Exemple #2
0
 public static function sendEmail($args)
 {
     $isEncrypted = OC_App::isEnabled('files_encryption');
     if (!$isEncrypted || isset($_POST['continue'])) {
         $continue = true;
     } else {
         $continue = false;
     }
     if (OC_User::userExists($_POST['user']) && $continue) {
         $token = hash('sha256', OC_Util::generate_random_bytes(30) . OC_Config::getValue('passwordsalt', ''));
         OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', hash('sha256', $token));
         // Hash the token again to prevent timing attacks
         $email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', '');
         if (!empty($email)) {
             $link = OC_Helper::linkToRoute('core_lostpassword_reset', array('user' => $_POST['user'], 'token' => $token));
             $link = OC_Helper::makeURLAbsolute($link);
             $tmpl = new OC_Template('core/lostpassword', 'email');
             $tmpl->assign('link', $link, false);
             $msg = $tmpl->fetchPage();
             $l = OC_L10N::get('core');
             $from = OCP\Util::getDefaultEmailAddress('lostpassword-noreply');
             try {
                 OC_Mail::send($email, $_POST['user'], $l->t('ownCloud password reset'), $msg, $from, 'ownCloud');
             } catch (Exception $e) {
                 OC_Template::printErrorPage('A problem occurs during sending the e-mail please contact your administrator.');
             }
             self::displayLostPasswordPage(false, true);
         } else {
             self::displayLostPasswordPage(true, false);
         }
     } else {
         self::displayLostPasswordPage(true, false);
     }
 }
Exemple #3
0
 public static function av_scan($path)
 {
     $path = $path[\OC\Files\Filesystem::signal_param_path];
     if ($path != '') {
         $files_view = \OCP\Files::getStorage("files");
         if ($files_view->file_exists($path)) {
             $root = OC_User::getHome(OC_User::getUser()) . '/files';
             $file = $root . $path;
             $result = self::clamav_scan($file);
             switch ($result) {
                 case CLAMAV_SCANRESULT_UNCHECKED:
                     //TODO: Show warning to the user: The file can not be checked
                     break;
                 case CLAMAV_SCANRESULT_INFECTED:
                     //remove file
                     $files_view->unlink($path);
                     OCP\JSON::error(array("data" => array("message" => "Virus detected! Can't upload the file.")));
                     $email = OC_Preferences::getValue(OC_User::getUser(), 'settings', 'email', '');
                     \OCP\Util::writeLog('files_antivirus', 'Email: ' . $email, \OCP\Util::DEBUG);
                     if (!empty($email)) {
                         $tmpl = new OC_Template('files_antivirus', 'notification');
                         $tmpl->assign('file', $path);
                         $tmpl->assign('host', OCP\Util::getServerHost());
                         $tmpl->assign('user', OC_User::getUser());
                         $msg = $tmpl->fetchPage();
                         $from = OCP\Util::getDefaultEmailAddress('security-noreply');
                         OCP\Util::sendMail($email, OC_User::getUser(), 'Malware detected', $msg, $from, 'ownCloud', 1);
                     }
                     exit;
                     break;
                 case CLAMAV_SCANRESULT_CLEAN:
                     //do nothing
                     break;
             }
         }
     }
 }
 /**
  * create mail body for plain text and html mail
  *
  * @param string $filename the shared file
  * @param string $link link to the shared file
  * @param int $expiration expiration date (timestamp)
  * @param string $prefix prefix of mail template files
  * @return array an array of the html mail body and the plain text mail body
  */
 private function createMailBody($filename, $link, $expiration, $prefix = '')
 {
     $formattedDate = $expiration ? $this->l->l('date', $expiration) : null;
     $html = new \OC_Template('core', $prefix . 'mail', '');
     $html->assign('link', $link);
     $html->assign('user_displayname', $this->senderDisplayName);
     $html->assign('filename', $filename);
     $html->assign('expiration', $formattedDate);
     $htmlMail = $html->fetchPage();
     $plainText = new \OC_Template('core', $prefix . 'altmail', '');
     $plainText->assign('link', $link);
     $plainText->assign('user_displayname', $this->senderDisplayName);
     $plainText->assign('filename', $filename);
     $plainText->assign('expiration', $formattedDate);
     $plainTextMail = $plainText->fetchPage();
     return [$htmlMail, $plainTextMail];
 }
$breadcrumb = array();
$pathtohere = "";
foreach (explode("/", $dir) as $i) {
    if ($i != "") {
        $pathtohere .= "/" . str_replace('+', '%20', urlencode($i));
        $breadcrumb[] = array("dir" => $pathtohere, "name" => $i);
    }
}
// make breadcrumb und filelist markup
$list = new OC_Template("files", "part.list", "");
$list->assign("files", $files);
$list->assign("baseURL", OC_Helper::linkTo("files", "index.php") . "?dir=");
$list->assign("downloadURL", OC_Helper::linkTo("files", "download.php") . "?file=");
$breadcrumbNav = new OC_Template("files", "part.breadcrumb", "");
$breadcrumbNav->assign("breadcrumb", $breadcrumb);
$breadcrumbNav->assign("baseURL", OC_Helper::linkTo("files", "index.php") . "?dir=");
$upload_max_filesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize'));
$post_max_size = OC_Helper::computerFileSize(ini_get('post_max_size'));
$maxUploadFilesize = min($upload_max_filesize, $post_max_size);
$freeSpace = OC_Filesystem::free_space('/');
$freeSpace = max($freeSpace, 0);
$maxUploadFilesize = min($maxUploadFilesize, $freeSpace);
$tmpl = new OC_Template("files", "index", "user");
$tmpl->assign("fileList", $list->fetchPage());
$tmpl->assign("breadcrumb", $breadcrumbNav->fetchPage());
$tmpl->assign('dir', $dir);
$tmpl->assign('readonly', !OC_Filesystem::is_writable($dir));
$tmpl->assign("files", $files);
$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize);
$tmpl->assign('uploadMaxHumanFilesize', OC_Helper::humanFileSize($maxUploadFilesize));
$tmpl->printPage();
Exemple #6
0
 /**
  * @param string $user
  * @throws \Exception
  */
 protected function sendEmail($user)
 {
     if (!$this->userManager->userExists($user)) {
         throw new \Exception($this->l10n->t('Couldn\'t send reset email. Please make sure your username is correct.'));
     }
     $email = $this->config->getUserValue($user, 'settings', 'email');
     if (empty($email)) {
         throw new \Exception($this->l10n->t('Couldn\'t send reset email because there is no ' . 'email address for this username. Please ' . 'contact your administrator.'));
     }
     $token = $this->secureRandom->getMediumStrengthGenerator()->generate(21, ISecureRandom::CHAR_DIGITS . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER);
     $this->config->setUserValue($user, 'owncloud', 'lostpassword', $token);
     $link = $this->urlGenerator->linkToRouteAbsolute('core.lost.resetform', array('userId' => $user, 'token' => $token));
     $tmpl = new \OC_Template('core/lostpassword', 'email');
     $tmpl->assign('link', $link, false);
     $msg = $tmpl->fetchPage();
     try {
         $message = $this->mailer->createMessage();
         $message->setTo([$email => $user]);
         $message->setSubject($this->l10n->t('%s password reset', [$this->defaults->getName()]));
         $message->setPlainBody($msg);
         $message->setFrom([$this->from => $this->defaults->getName()]);
         $this->mailer->send($message);
     } catch (\Exception $e) {
         throw new \Exception($this->l10n->t('Couldn\'t send reset email. Please contact your administrator.'));
     }
 }
 * See the COPYING-README file.
*/
$RUNTIME_NOAPPS = TRUE;
//no apps
require_once '../../lib/base.php';
// Someone lost their password:
if (isset($_POST['user'])) {
    if (OC_User::userExists($_POST['user'])) {
        $token = sha1($_POST['user'] . md5(uniqid(rand(), true)));
        OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', $token);
        $email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', '');
        if (!empty($email) and isset($_POST['sectoken']) and isset($_SESSION['sectoken']) and $_POST['sectoken'] == $_SESSION['sectoken']) {
            $link = OC_Helper::linkToAbsolute('core/lostpassword', 'resetpassword.php') . '?user='******'user'] . '&token=' . $token;
            $tmpl = new OC_Template('core/lostpassword', 'email');
            $tmpl->assign('link', $link);
            $msg = $tmpl->fetchPage();
            $l = OC_L10N::get('core');
            $from = 'lostpassword-noreply@' . OC_Helper::serverHost();
            OC_MAIL::send($email, $_POST['user'], $l->t('ownCloud password reset'), $msg, $from, 'ownCloud');
            echo 'sent';
        }
        $sectoken = rand(1000000, 9999999);
        $_SESSION['sectoken'] = $sectoken;
        OC_Template::printGuestPage('core/lostpassword', 'lostpassword', array('error' => false, 'requested' => true, 'sectoken' => $sectoken));
    } else {
        $sectoken = rand(1000000, 9999999);
        $_SESSION['sectoken'] = $sectoken;
        OC_Template::printGuestPage('core/lostpassword', 'lostpassword', array('error' => true, 'requested' => false, 'sectoken' => $sectoken));
    }
} else {
    $sectoken = rand(1000000, 9999999);
 protected function sendEmail($user, $proceed)
 {
     if ($this->isDataEncrypted && !$proceed) {
         throw new EncryptedDataException();
     }
     if (!$this->userManager->userExists($user)) {
         throw new \Exception($this->l10n->t('Couldn\'t send reset email. Please make sure ' . 'your username is correct.'));
     }
     $token = hash('sha256', \OC_Util::generateRandomBytes(30));
     // Hash the token again to prevent timing attacks
     $this->config->setUserValue($user, 'owncloud', 'lostpassword', hash('sha256', $token));
     $email = $this->config->getUserValue($user, 'settings', 'email');
     if (empty($email)) {
         throw new \Exception($this->l10n->t('Couldn\'t send reset email because there is no ' . 'email address for this username. Please ' . 'contact your administrator.'));
     }
     $link = $this->getLink('core.lost.resetform', $user, $token);
     $tmpl = new \OC_Template('core/lostpassword', 'email');
     $tmpl->assign('link', $link, false);
     $msg = $tmpl->fetchPage();
     try {
         // FIXME: should be added to the container and injected in here
         \OC_Mail::send($email, $user, $this->l10n->t('%s password reset', array($this->defaults->getName())), $msg, $this->from, $this->defaults->getName());
     } catch (\Exception $e) {
         throw new \Exception($this->l10n->t('Couldn\'t send reset email. Please contact your administrator.'));
     }
 }
<?php

/**
* ownCloud - Cloudpress
*
* @author Bastien Ho (EELV - Urbancube)
* @copyleft 2012 bastienho@urbancube.fr
* @projeturl http://ecolosites.eelv.fr
*
* Free Software under creative commons licence
* http://creativecommons.org/licenses/by-nc/3.0/
* Attribution-NonCommercial 3.0 Unported (CC BY-NC 3.0)
* 
* You are free:
* to Share — to copy, distribute and transmit the work
* to Remix — to adapt the work
*
* Under the following conditions:
* Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any way that
* suggests  that they endorse you or your use of the work).
* Noncommercial — You may not use this work for commercial purposes.
*
*/
$wp_instance = new OC_wordpress();
// fill template
$tmpl = new OC_Template('user_wordpress', 'settings');
foreach ($wp_instance->params as $param => $value) {
    $tmpl->assign($param, $value);
}
return $tmpl->fetchPage();
Exemple #10
0
            // enable l10n support
            $l = OC_L10N::get('core');
            // setup the email
            $subject = (string) $l->t('%s shared »%s« with you', array($displayName, $file));
            $content = new OC_Template("core", "mail", "");
            $content->assign('link', $link);
            $content->assign('type', $type);
            $content->assign('user_displayname', $displayName);
            $content->assign('filename', $file);
            $text = $content->fetchPage();
            $content = new OC_Template("core", "altmail", "");
            $content->assign('link', $link);
            $content->assign('type', $type);
            $content->assign('user_displayname', $displayName);
            $content->assign('filename', $file);
            $alttext = $content->fetchPage();
            $default_from = OCP\Util::getDefaultEmailAddress('sharing-noreply');
            $from_address = OCP\Config::getUserValue($user, 'settings', 'email', $default_from);
            // send it out now
            try {
                OCP\Util::sendMail($to_address, $to_address, $subject, $text, $from_address, $displayName, 1, $alttext);
                OCP\JSON::success();
            } catch (Exception $exception) {
                OCP\JSON::error(array('data' => array('message' => OC_Util::sanitizeHTML($exception->getMessage()))));
            }
            break;
    }
} else {
    if (isset($_GET['fetch'])) {
        switch ($_GET['fetch']) {
            case 'getItemsSharedStatuses':
Exemple #11
0
 /**
  * print error page using Exception details
  * @param Exception | Throwable $exception
  */
 public static function printExceptionErrorPage($exception, $fetchPage = false)
 {
     try {
         $request = \OC::$server->getRequest();
         $content = new \OC_Template('', 'exception', 'error', false);
         $content->assign('errorClass', get_class($exception));
         $content->assign('errorMsg', $exception->getMessage());
         $content->assign('errorCode', $exception->getCode());
         $content->assign('file', $exception->getFile());
         $content->assign('line', $exception->getLine());
         $content->assign('trace', $exception->getTraceAsString());
         $content->assign('debugMode', \OC::$server->getSystemConfig()->getValue('debug', false));
         $content->assign('remoteAddr', $request->getRemoteAddress());
         $content->assign('requestID', $request->getId());
         if ($fetchPage) {
             return $content->fetchPage();
         }
         $content->printPage();
     } catch (\Exception $e) {
         $logger = \OC::$server->getLogger();
         $logger->logException($exception, ['app' => 'core']);
         $logger->logException($e, ['app' => 'core']);
         header(self::getHttpProtocol() . ' 500 Internal Server Error');
         header('Content-Type: text/plain; charset=utf-8');
         print "Internal Server Error\n\n";
         print "The server encountered an internal error and was unable to complete your request.\n";
         print "Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.\n";
         print "More details can be found in the server log.\n";
     }
     die;
 }
             $pathtohere .= "/{$i}";
             $breadcrumb[] = array("dir" => $pathtohere, "name" => $i);
         }
     }
     // Load the files we need
     OC_Util::addStyle("files", "files");
     $breadcrumbNav = new OC_Template("files", "part.breadcrumb", "");
     $breadcrumbNav->assign("breadcrumb", $breadcrumb);
     $breadcrumbNav->assign("baseURL", OC_Helper::linkTo("files_sharing", "get.php") . "?token=" . $token . "&path=");
     $list = new OC_Template("files", "part.list", "");
     $list->assign("files", $files);
     $list->assign("baseURL", OC_Helper::linkTo("files_sharing", "get.php") . "?token=" . $token . "&path=");
     $list->assign("downloadURL", OC_Helper::linkTo("files_sharing", "get.php") . "?token=" . $token . "&path=");
     $list->assign("readonly", true);
     $tmpl = new OC_Template("files", "index", "user");
     $tmpl->assign("fileList", $list->fetchPage());
     $tmpl->assign("breadcrumb", $breadcrumbNav->fetchPage());
     $tmpl->assign("readonly", true);
     $tmpl->printPage();
 } else {
     //get time mimetype and set the headers
     $mimetype = OC_Filesystem::getMimeType($source);
     header("Content-Transfer-Encoding: binary");
     header("Expires: 0");
     header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
     header("Pragma: public");
     header('Content-Disposition: filename="' . basename($source) . '"');
     header("Content-Type: " . $mimetype);
     header("Content-Length: " . OC_Filesystem::filesize($source));
     //download the file
     @ob_clean();
<?php

/**
 * Copyright (c) 2011 Bart Visscher <*****@*****.**>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
require_once '../../../lib/base.php';
$l10n = new OC_L10N('calendar');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$userid = OC_User::getUser();
$calendarid = OC_Calendar_Calendar::addCalendar($userid, $_POST['name'], 'VEVENT,VTODO,VJOURNAL', null, 0, $_POST['color']);
OC_Calendar_Calendar::setCalendarActive($calendarid, 1);
$calendar = OC_Calendar_Calendar::findCalendar($calendarid);
$tmpl = new OC_Template('calendar', 'part.choosecalendar.rowfields');
$tmpl->assign('calendar', $calendar);
OC_JSON::success(array('data' => $tmpl->fetchPage()));
 /**
  * @brief Proceeds the template
  * @returns content
  *
  * This function proceeds the template. If $this->renderas is set, it will
  * will produce a full page.
  */
 public function fetchPage()
 {
     $data = $this->_fetch();
     if ($this->renderas) {
         // Decide which page we show
         if ($this->renderas == "user") {
             $page = new OC_Template("core", "layout.user");
             $page->assign('searchurl', OC_Helper::linkTo('search', 'index.php'));
             if (array_search(OC_APP::getCurrentApp(), array('settings', 'admin', 'help')) !== false) {
                 $page->assign('bodyid', 'body-settings');
             } else {
                 $page->assign('bodyid', 'body-user');
             }
             // Add navigation entry
             $page->assign("navigation", OC_App::getNavigation());
             $page->assign("settingsnavigation", OC_App::getSettingsNavigation());
         } else {
             $page = new OC_Template("core", "layout.guest");
         }
         // Add the css and js files
         foreach (OC_Util::$scripts as $script) {
             if (is_file(OC::$SERVERROOT . "/apps/{$script}.js")) {
                 $page->append("jsfiles", OC::$WEBROOT . "/apps/{$script}.js");
             } elseif (is_file(OC::$SERVERROOT . "/{$script}.js")) {
                 $page->append("jsfiles", OC::$WEBROOT . "/{$script}.js");
             } else {
                 $page->append("jsfiles", OC::$WEBROOT . "/core/{$script}.js");
             }
         }
         foreach (OC_Util::$styles as $style) {
             if (is_file(OC::$SERVERROOT . "/apps/{$style}.css")) {
                 $page->append("cssfiles", OC::$WEBROOT . "/apps/{$style}.css");
             } elseif (is_file(OC::$SERVERROOT . "/{$style}.css")) {
                 $page->append("cssfiles", OC::$WEBROOT . "/{$style}.css");
             } else {
                 $page->append("cssfiles", OC::$WEBROOT . "/core/{$style}.css");
             }
         }
         // Add custom headers
         $page->assign('headers', $this->headers);
         foreach (OC_Util::$headers as $header) {
             $page->append('headers', $header);
         }
         // Add css files and js files
         $page->assign("content", $data);
         return $page->fetchPage();
     } else {
         return $data;
     }
 }
 /**
  * @brief Proceeds the template
  * @returns content
  *
  * This function proceeds the template. If $this->renderas is set, it
  * will produce a full page.
  */
 public function fetchPage()
 {
     $data = $this->_fetch();
     if ($this->renderas) {
         // Decide which page we show
         if ($this->renderas == "user") {
             $page = new OC_Template("core", "layout.user");
             $page->assign('searchurl', OC_Helper::linkTo('search', 'index.php'));
             if (array_search(OC_APP::getCurrentApp(), array('settings', 'admin', 'help')) !== false) {
                 $page->assign('bodyid', 'body-settings');
             } else {
                 $page->assign('bodyid', 'body-user');
             }
             // Add navigation entry
             $navigation = OC_App::getNavigation();
             $page->assign("navigation", $navigation);
             $page->assign("settingsnavigation", OC_App::getSettingsNavigation());
             foreach ($navigation as $entry) {
                 if ($entry['active']) {
                     $page->assign('application', $entry['name']);
                     break;
                 }
             }
         } else {
             $page = new OC_Template("core", "layout.guest");
         }
         // Read the selected theme from the config file
         $theme = OC_Config::getValue("theme");
         // Read the detected formfactor and use the right file name.
         $fext = $this->getFormFactorExtension();
         // Add the core js files or the js files provided by the selected theme
         foreach (OC_Util::$scripts as $script) {
             // Is it in 3rd party?
             if ($page->appendIfExist('jsfiles', OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $script . '.js')) {
                 // Is it in apps and overwritten by the theme?
             } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/apps/{$script}{$fext}.js")) {
             } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/apps/{$script}.js")) {
                 // Is it part of an app?
             } elseif ($page->appendIfExist('jsfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/{$script}{$fext}.js")) {
             } elseif ($page->appendIfExist('jsfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/{$script}.js")) {
                 // Is it in the owncloud root but overwritten by the theme?
             } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/{$script}{$fext}.js")) {
             } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/{$script}.js")) {
                 // Is it in the owncloud root ?
             } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "{$script}{$fext}.js")) {
             } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "{$script}.js")) {
                 // Is in core but overwritten by a theme?
             } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/core/{$script}{$fext}.js")) {
             } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/core/{$script}.js")) {
                 // Is it in core?
             } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/{$script}{$fext}.js")) {
             } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/{$script}.js")) {
             } else {
                 echo 'js file not found: script:' . $script . ' formfactor:' . $fext . ' webroot:' . OC::$WEBROOT . ' serverroot:' . OC::$SERVERROOT;
                 die;
             }
         }
         // Add the css files
         foreach (OC_Util::$styles as $style) {
             // is it in 3rdparty?
             if ($page->appendIfExist('cssfiles', OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $style . '.css')) {
                 // or in apps?
             } elseif ($page->appendIfExist('cssfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/{$style}{$fext}.css")) {
             } elseif ($page->appendIfExist('cssfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/{$style}.css")) {
                 // or in the owncloud root?
             } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "{$style}{$fext}.css")) {
             } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "{$style}.css")) {
                 // or in core ?
             } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/{$style}{$fext}.css")) {
             } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/{$style}.css")) {
             } else {
                 echo 'css file not found: style:' . $script . ' formfactor:' . $fext . ' webroot:' . OC::$WEBROOT . ' serverroot:' . OC::$SERVERROOT;
                 die;
             }
         }
         // Add the theme css files. you can override the default values here
         if (!empty($theme)) {
             foreach (OC_Util::$styles as $style) {
                 if ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/apps/{$style}{$fext}.css")) {
                 } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/apps/{$style}.css")) {
                 } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/{$style}{$fext}.css")) {
                 } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/{$style}.css")) {
                 } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/core/{$style}{$fext}.css")) {
                 } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/core/{$style}.css")) {
                 }
             }
         }
         // Add custom headers
         $page->assign('headers', $this->headers);
         foreach (OC_Util::$headers as $header) {
             $page->append('headers', $header);
         }
         // Add css files and js files
         $page->assign("content", $data);
         return $page->fetchPage();
     } else {
         return $data;
     }
 }
	/**
	 * create mail body for plain text and html mail
	 *
	 * @param string $filename the shared file
	 * @param string $link link to the shared file
	 * @param int $expiration expiration date (timestamp)
	 * @return array an array of the html mail body and the plain text mail body
	 */
	private function createMailBody($filename, $link, $expiration) {

		$formatedDate = $expiration ? $this->l->l('date', $expiration) : null;

		$html = new \OC_Template("core", "mail", "");
		$html->assign ('link', $link);
		$html->assign ('user_displayname', $this->senderDisplayName);
		$html->assign ('filename', $filename);
		$html->assign('expiration',  $formatedDate);
		$htmlMail = $html->fetchPage();

		$alttext = new \OC_Template("core", "altmail", "");
		$alttext->assign ('link', $link);
		$alttext->assign ('user_displayname', $this->senderDisplayName);
		$alttext->assign ('filename', $filename);
		$alttext->assign('expiration', $formatedDate);
		$alttextMail = $alttext->fetchPage();

		return array($htmlMail, $alttextMail);
	}
Exemple #17
0
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');
if ($config->getSystemValue('enable_certificate_management', false)) {
    $certificatesTemplate = new OC_Template('settings', 'certificates');
    $certificatesTemplate->assign('type', 'admin');
    $certificatesTemplate->assign('uploadRoute', 'settings.Certificate.addSystemRootCertificate');
    $certificatesTemplate->assign('certs', $certificateManager->listCertificates());
    $certificatesTemplate->assign('urlGenerator', $urlGenerator);
    $forms[] = $certificatesTemplate->fetchPage();
}
$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;
    }
 *
 */
// Init owncloud
require_once '../../../lib/base.php';
$id = $_GET['id'];
$l10n = new OC_L10N('contacts');
// Check if we are a user
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('contacts');
$card = OC_Contacts_VCard::find($id);
if ($card === false) {
    OC_JSON::error(array('data' => array('message' => $l10n->t('Contact could not be found.'))));
    exit;
}
$addressbook = OC_Contacts_Addressbook::find($card['addressbookid']);
if ($addressbook === false || $addressbook['userid'] != OC_USER::getUser()) {
    OC_JSON::error(array('data' => array('message' => $l10n->t('This is not your contact.'))));
    exit;
}
$vcard = OC_Contacts_VCard::parse($card['carddata']);
// Check if the card is valid
if (is_null($vcard)) {
    OC_JSON::error(array('data' => array('message' => $l10n->t('vCard could not be read.'))));
    exit;
}
$details = OC_Contacts_VCard::structureContact($vcard);
$tmpl = new OC_Template('contacts', 'part.details');
$tmpl->assign('details', $details);
$tmpl->assign('id', $id);
$page = $tmpl->fetchPage();
OC_JSON::success(array('data' => array('id' => $id, 'page' => $page)));
Exemple #19
0
 /**
  * create mail body for plain text and html mail
  *
  * @param string $password one-time encryption password
  * @return array an array of the html mail body and the plain text mail body
  */
 protected function createMailBody($password)
 {
     $html = new \OC_Template("encryption", "mail", "");
     $html->assign('password', $password);
     $htmlMail = $html->fetchPage();
     $plainText = new \OC_Template("encryption", "altmail", "");
     $plainText->assign('password', $password);
     $plainTextMail = $plainText->fetchPage();
     return [$htmlMail, $plainTextMail];
 }
// Init owncloud
require_once '../../lib/base.php';
OC_JSON::checkLoggedIn();
// Load the files
$dir = isset($_GET['dir']) ? $_GET['dir'] : '';
$doBreadcrumb = isset($_GET['breadcrumb']) ? true : false;
$data = array();
// Make breadcrumb
if ($doBreadcrumb) {
    $breadcrumb = array();
    $pathtohere = "/";
    foreach (explode("/", $dir) as $i) {
        if ($i != "") {
            $pathtohere .= "{$i}/";
            $breadcrumb[] = array("dir" => $pathtohere, "name" => $i);
        }
    }
    $breadcrumbNav = new OC_Template("files", "part.breadcrumb", "");
    $breadcrumbNav->assign("breadcrumb", $breadcrumb);
    $data['breadcrumb'] = $breadcrumbNav->fetchPage();
}
// make filelist
$files = array();
foreach (OC_Files::getdirectorycontent($dir) as $i) {
    $i["date"] = OC_Util::formatDate($i["mtime"]);
    $files[] = $i;
}
$list = new OC_Template("files", "part.list", "");
$list->assign("files", $files);
$data = array('files' => $list->fetchPage());
OC_JSON::success(array('data' => $data));