Exemplo n.º 1
0
 public static function sendMail($path)
 {
     if (!\OCP\User::isLoggedIn()) {
         return;
     }
     $config = \OC::$server->getConfig();
     $user = \OC::$server->getUserSession()->getUser();
     $email = $user->getEMailAddress();
     $displayName = $user->getDisplayName();
     if (strval($displayName) === '') {
         $displayName = $user->getUID();
     }
     \OCP\Util::writeLog('files_antivirus', 'Email: ' . $email, \OCP\Util::DEBUG);
     if (!empty($email)) {
         try {
             $tmpl = new \OCP\Template('files_antivirus', 'notification');
             $tmpl->assign('file', $path);
             $tmpl->assign('host', \OC::$server->getRequest()->getServerHost());
             $tmpl->assign('user', $displayName);
             $msg = $tmpl->fetchPage();
             $from = \OCP\Util::getDefaultEmailAddress('security-noreply');
             $mailer = \OC::$server->getMailer();
             $message = $mailer->createMessage();
             $message->setSubject(\OCP\Util::getL10N('files_antivirus')->t('Malware detected'));
             $message->setFrom([$from => 'ownCloud Notifier']);
             $message->setTo([$email => $displayName]);
             $message->setPlainBody($msg);
             $message->setHtmlBody($msg);
             $mailer->send($message);
         } catch (\Exception $e) {
             \OC::$server->getLogger()->error(__METHOD__ . ', exception: ' . $e->getMessage(), ['app' => 'files_antivirus']);
         }
     }
 }
Exemplo n.º 2
0
function print_collection_list($list)
{
    foreach ($list as $collection) {
        if ($collection instanceof OCA\News\Folder) {
            $tmpl_folder = new OCP\Template("news", "part.listfolder");
            $tmpl_folder->assign('folder', $collection);
            $tmpl_folder->printpage();
            print_collection_list($collection->getChildren());
            echo '</ul></li>';
        } elseif ($collection instanceof OCA\News\Feed) {
            //onhover $(element).attr('id', 'newID');
            $itemmapper = new OCA\News\ItemMapper();
            $items = $itemmapper->findByFeedId($collection->getId());
            $counter = 0;
            foreach ($items as $item) {
                if (!$item->isRead()) {
                    ++$counter;
                }
            }
            $tmpl_feed = new OCP\Template("news", "part.listfeed");
            $tmpl_feed->assign('feed', $collection);
            $tmpl_feed->assign('unreadItemsCount', $counter);
            $tmpl_feed->printpage();
        } else {
            //TODO:handle error in this case
        }
    }
}
Exemplo n.º 3
0
 /**
  * Returns the rendered html
  * @return the rendered html
  */
 public function render()
 {
     if ($this->renderAs === 'blank') {
         $template = new \OCP\Template($this->appName, $this->templateName);
     } else {
         $template = new \OCP\Template($this->appName, $this->templateName, $this->renderAs);
     }
     foreach ($this->params as $key => $value) {
         $template->assign($key, $value, false);
     }
     return $template->fetchPage();
 }
Exemplo n.º 4
0
 /**
  * Get the users we want to send an email to
  *
  * @param null|string $forceActive Navigation entry that should be marked as active
  * @return \OCP\Template
  */
 public function getTemplate($forceActive = null)
 {
     $active = $forceActive ?: $this->active;
     $template = new \OCP\Template('activity', 'navigation', '');
     $entries = $this->getLinkList();
     $additionalEntries = \OC::$server->getActivityManager()->getNavigation();
     $entries['apps'] = array_merge($entries['apps'], $additionalEntries['apps']);
     $entries['top'] = array_merge($entries['top'], $additionalEntries['top']);
     if (sizeof($entries['apps']) === 1) {
         // If there is only the files app, we simply do not show it,
         // as it is the same as the 'all' filter.
         $entries['apps'] = array();
     }
     $template->assign('activeNavigation', $active);
     $template->assign('navigations', $entries);
     $template->assign('rssLink', $this->rssLink);
     return $template;
 }
Exemplo n.º 5
0
 public static function sendMail($path)
 {
     if (!\OCP\User::isLoggedIn()) {
         return;
     }
     $email = \OCP\Config::getUserValue(\OCP\User::getUser(), 'settings', 'email', '');
     \OCP\Util::writeLog('files_antivirus', 'Email: ' . $email, \OCP\Util::DEBUG);
     if (!empty($email)) {
         $defaults = new \OCP\Defaults();
         $tmpl = new \OCP\Template('files_antivirus', 'notification');
         $tmpl->assign('file', $path);
         $tmpl->assign('host', \OCP\Util::getServerHost());
         $tmpl->assign('user', \OCP\User::getDisplayName());
         $msg = $tmpl->fetchPage();
         $from = \OCP\Util::getDefaultEmailAddress('security-noreply');
         \OCP\Util::sendMail($email, \OCP\User::getUser(), \OCP\Util::getL10N('files_antivirus')->t('Malware detected'), $msg, $from, $defaults->getName(), true);
     }
 }
 /**
  * Send a mail signaling a user deletion
  * @param \OC\User\User $user
  */
 public function mailUserDeletion(\OC\User\User $user)
 {
     $toAddress = $toName = $this->config->getSystemValue('monitoring_admin_email');
     $theme = new \OC_Defaults();
     $now = new \DateTime();
     $niceNow = date_format($now, 'd/m/Y H:i:s');
     $subject = (string) $this->l->t('%s - User %s just has been deleted (%s)', array($theme->getTitle(), $user->getUID(), $niceNow));
     $html = new \OCP\Template($this->appName, "mail_userdeletion_html", "");
     $html->assign('userUID', $user->getUID());
     $html->assign('datetime', $niceNow);
     $htmlMail = $html->fetchPage();
     $alttext = new \OCP\Template($this->appName, "mail_userdeletion_text", "");
     $alttext->assign('userUID', $user->getUID());
     $alttext->assign('datetime', $niceNow);
     $altMail = $alttext->fetchPage();
     $fromAddress = $fromName = \OCP\Util::getDefaultEmailAddress('owncloud');
     try {
         \OCP\Util::sendMail($toAddress, $toName, $subject, $htmlMail, $fromAddress, $fromName, 1, $altMail);
     } catch (\Exception $e) {
         \OCP\Util::writeLog('user_account_actions', "Can't send mail for user deletion: " . $e->getMessage(), \OCP\Util::ERROR);
     }
 }
Exemplo n.º 7
0
 /**
  * Binds variables to the template and prints it
  * The following values are always assigned: userId, trans
  * @param $arguments an array with arguments in $templateVar => $content
  * @param $template the name of the template
  * @param $safeParams template parameters which should not be escaped
  * @param $fullPage if true, it will render a full page, otherwise only a part
  *                  defaults to true
  */
 protected function render($template, $arguments = array(), $safeParams = array(), $fullPage = true)
 {
     if ($fullPage) {
         $template = new \OCP\Template('news', $template, 'user');
     } else {
         $template = new \OCP\Template('news', $template);
     }
     foreach ($arguments as $key => $value) {
         if (array_key_exists($key, $safeParams)) {
             $template->assign($key, $value, false);
         } else {
             $template->assign($key, $value);
         }
     }
     $template->assign('userId', $this->userId);
     $template->assign('trans', $this->trans);
     $template->printPage();
 }
Exemplo n.º 8
0
?>
" id="datecontrol_today"/>
			</form>
		</li>
		<li>
			<a id="newCalendar"><?php 
p($l->t('New Calendar'));
?>
</a>
		</li>
		
		<?php 
$option_calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
for ($i = 0; $i < count($option_calendars); $i++) {
    print_unescaped("<li data-id='" . OC_Util::sanitizeHTML($option_calendars[$i]['id']) . "'>");
    $tmpl = new OCP\Template('calendar', 'part.choosecalendar.rowfields');
    $tmpl->assign('calendar', $option_calendars[$i]);
    if ($option_calendars[$i]['userid'] != OCP\User::getUser()) {
        $sharedCalendar = OCP\Share::getItemSharedWithBySource('calendar', $option_calendars[$i]['id']);
        $shared = true;
    } else {
        $shared = false;
    }
    $tmpl->assign('shared', $shared);
    $tmpl->printpage();
    print_unescaped("</li>");
}
?>
		<li id="caldav_url_entry">
			<input style="display:none;width: 78%;float: left;" type="text" id="caldav_url" title="<?php 
p($l->t("CalDav Link"));
Exemplo n.º 9
0
<?php

/**
 * ownCloud - gsync plugin
 * 
 * @author Victor Dubiniuk
 * @copyright 2012-2013 Victor Dubiniuk victor.dubiniuk@gmail.com
 * 
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 */
namespace OCA_Gsync;

App::initController();
\OCP\Util::addScript(App::APP_ID, 'settings');
$info = \OCP\App::getAppInfo(App::APP_ID);
$tmpl = new \OCP\Template(App::APP_ID, 'settings');
$tmpl->assign(App::GOOGLE_CLIENT_ID, App::getClientId());
$tmpl->assign(App::GOOGLE_SECRET, App::getSecret());
$tmpl->assign(App::GOOGLE_REFRESH_TOKEN, App::getRefreshToken());
$tmpl->assign('gsync_redirect', App::getRedirectUri());
$tmpl->assign('app_version', @$info['version']);
return $tmpl->fetchPage();
Exemplo n.º 10
0
 * ownCloud - Addressbook
 *
 * @author Thomas Tanghus
 * @copyright 2012 Thomas Tanghus <*****@*****.**>
 *
 * 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/>.
 *
 */
// Init owncloud
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
$tmp_path = $_GET['tmp_path'];
$id = $_GET['id'];
OCP\Util::writeLog('contacts', 'ajax/cropphoto.php: tmp_path: ' . $tmp_path . ', exists: ' . file_exists($tmp_path), OCP\Util::DEBUG);
$tmpl = new OCP\Template("contacts", "part.cropphoto");
$tmpl->assign('tmp_path', $tmp_path);
$tmpl->assign('id', $id);
$page = $tmpl->fetchPage();
OCP\JSON::success(array('data' => array('page' => $page)));
Exemplo n.º 11
0
 /**
  * Returns the rendered html
  * @return string the rendered html
  * @since 6.0.0
  */
 public function render()
 {
     // \OCP\Template needs an empty string instead of 'blank' for an unwrapped response
     $renderAs = $this->renderAs === 'blank' ? '' : $this->renderAs;
     $template = new \OCP\Template($this->appName, $this->templateName, $renderAs);
     foreach ($this->params as $key => $value) {
         $template->assign($key, $value);
     }
     return $template->fetchPage();
 }
Exemplo n.º 12
0
<?php

/**
 * Copyright (c) 2011 Thomas Tanghus <*****@*****.**>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
$books = OC_Contacts_Addressbook::all(OCP\USER::getUser());
$tmpl = new OCP\Template("contacts", "part.selectaddressbook");
$tmpl->assign('addressbooks', $books);
$page = $tmpl->fetchPage();
OCP\JSON::success(array('data' => array('page' => $page)));
Exemplo n.º 13
0
 *
 * 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/external.php';
OCP\User::checkLoggedIn();
if (isset($_GET['id'])) {
    $id = $_GET['id'];
    $id = (int) $id;
    $sites = OC_External::getSites();
    if (sizeof($sites) >= $id) {
        $url = $sites[$id - 1][1];
        OCP\App::setActiveNavigationEntry('external_index' . $id);
        $tmpl = new OCP\Template('external', 'frame', 'user');
        //overwrite x-frame-options
        $tmpl->addHeader('X-Frame-Options', 'ALLOW-FROM *');
        $tmpl->assign('url', $url);
        $tmpl->printPage();
    }
}
Exemplo n.º 14
0
 * ownCloud - sipgate
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later. See the COPYING file.
 *
 * @author Raphael Pigulla <*****@*****.**>
 * @copyright Raphael Pigulla 2015
 */
use OCP\AppFramework\App;
use OCA\Sipgate\Service\UserSettings;
$app = new App('sipgate');
$container = $app->getContainer();
/** @var OCP\IDateTimeZone $timeZone */
$timeZone = $container->query('OCP\\IDateTimeZone');
/** @var OCA\Sipgate\Service\UserSettings $userSettings */
$userSettings = $container->query('OCA\\Sipgate\\Service\\UserSettings');
$lastUpdated = $userSettings->getLastUpdated();
$lastUpdated->setTimezone($timeZone->getTimeZone());
$template = new \OCP\Template('sipgate', 'settings-personal');
$template->assign('username', $userSettings->getUsername());
$template->assign('password', $userSettings->getPassword());
$template->assign('retention', $userSettings->getRetention());
$template->assign('syncPeriod', $userSettings->getSyncPeriod());
$template->assign('localUris', implode(' ', $userSettings->getLocalURIs()));
$template->assign('defaultCountryCode', $userSettings->getDefaultCountryCode());
$template->assign('lastUpdated', $lastUpdated->format('Y-m-d H:i:s'));
$template->assign('SYNC_PERIOD_MIN', UserSettings::SYNC_PERIOD_MIN);
$template->assign('SYNC_PERIOD_MAX', UserSettings::SYNC_PERIOD_MAX);
$template->assign('RETENTION_MIN', UserSettings::RETENTION_MIN);
$template->assign('RETENTION_MAX', UserSettings::RETENTION_MAX);
return $template->fetchPage();
Exemplo n.º 15
0
 * 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();
$params = array('cas_server_version', 'cas_server_hostname', 'cas_server_port', 'cas_server_path', 'cas_autocreate', 'cas_update_user_data', 'cas_protected_groups', 'cas_default_group', 'cas_email_mapping', 'cas_displayName_mapping', 'cas_group_mapping', 'cas_cert_path');
OCP\Util::addscript('user_minimalcas', 'settings');
if ($_POST) {
    // CSRF check
    OCP\JSON::callCheck();
    foreach ($params as $param) {
        if (isset($_POST[$param])) {
            OCP\Config::setAppValue('user_minimalcas', $param, $_POST[$param]);
        } elseif ('cas_autocreate' == $param) {
            // unchecked checkboxes are not included in the post paramters
            OCP\Config::setAppValue('user_minimalcas', $param, 0);
        } elseif ('cas_update_user_data' == $param) {
            OCP\Config::setAppValue('user_minimalcas', $param, 0);
        }
    }
}
// fill template
$tmpl = new OCP\Template('user_minimalcas', 'settings');
foreach ($params as $param) {
    $value = htmlentities(OCP\Config::getAppValue('user_minimalcas', $param, ''));
    $tmpl->assign($param, $value);
}
return $tmpl->fetchPage();
Exemplo n.º 16
0
    if (sizeof($users) !== 1) {
        // User not found
        header('HTTP/1.0 404 Not Found');
        exit;
    }
    // Token found login as that user
    \OC_User::setUserId(array_shift($users));
    $forceUserLogout = true;
}
// check if the user has the right permissions.
\OCP\User::checkLoggedIn();
// rss is of content type text/xml
if (isset($_SERVER['HTTP_ACCEPT']) && stristr($_SERVER['HTTP_ACCEPT'], 'application/rss+xml')) {
    header('Content-Type: application/rss+xml');
} else {
    header('Content-Type: text/xml; charset=UTF-8');
}
// generate and show the rss feed
$l = \OCP\Util::getL10N('activity');
$data = new \OCA\Activity\Data(\OC::$server->getActivityManager());
$groupHelper = new \OCA\Activity\GroupHelper(\OC::$server->getActivityManager(), new \OCA\Activity\DataHelper(\OC::$server->getActivityManager(), new \OCA\Activity\ParameterHelper(new \OC\Files\View(''), $l), $l), false);
$tmpl = new \OCP\Template('activity', 'rss');
$tmpl->assign('rssLang', \OC_Preferences::getValue(\OCP\User::getUser(), 'core', 'lang'));
$tmpl->assign('rssLink', \OCP\Util::linkToAbsolute('activity', 'rss.php'));
$tmpl->assign('rssPubDate', date('r'));
$tmpl->assign('user', \OCP\User::getUser());
$tmpl->assign('activities', $data->read($groupHelper, 0, 30, 'all'));
$tmpl->printPage();
if ($forceUserLogout) {
    \OC_User::logout();
}
Exemplo n.º 17
0
* 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/>.
*
*/
/**
 * @file content.php
 * Content of the imprint as configured
 * @access public
 */
// Session checks
// \OCP\User::checkLoggedIn();
\OCP\App::checkAppEnabled('imprint');
// prepare content
if (FALSE === ($content = \OCP\Config::getAppValue('imprint', 'content', FALSE))) {
    $tmpl = new \OCP\Template('imprint', 'tmpl_dummy');
    \OCP\Util::addStyle('imprint', 'reference');
} else {
    // detect type of stored content and process accordingly
    if (strlen($content) != strlen(strip_tags($content))) {
        $processed_content = $content;
    } else {
        $processed_content = sprintf("<pre>\n%s\n</pre>", $content);
    }
    // output processed content
    \OCP\Util::addStyle('imprint', 'content');
    $tmpl = new \OCP\Template('imprint', 'tmpl_content');
    $tmpl->assign('processed-content', $processed_content);
}
// render template
$tmpl->printPage();
Exemplo n.º 18
0
 * 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/>.
 * 
 */
namespace OCA\Documents;

\OCP\User::checkLoggedIn();
\OCP\JSON::checkAppEnabled('documents');
\OCP\App::setActiveNavigationEntry('documents_index');
\OCP\Util::addStyle('documents', 'style');
\OCP\Util::addStyle('documents', '3rdparty/webodf/dojo-app');
\OCP\Util::addScript('documents', 'documents');
\OCP\Util::addScript('files', 'file-upload');
\OCP\Util::addScript('files', 'jquery.iframe-transport');
\OCP\Util::addScript('files', 'jquery.fileupload');
$tmpl = new \OCP\Template('documents', 'documents', 'user');
$previewsEnabled = \OC::$server->getConfig()->getSystemValue('enable_previews', true);
$unstable = \OCP\Config::getAppValue('documents', 'unstable', 'false');
$maxUploadFilesize = \OCP\Util::maxUploadFilesize("/");
$savePath = \OCP\Config::getUserValue(\OCP\User::getUser(), 'documents', 'save_path', '/');
$tmpl->assign('enable_previews', $previewsEnabled);
$tmpl->assign('useUnstable', $unstable);
$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize);
$tmpl->assign('uploadMaxHumanFilesize', \OCP\Util::humanFileSize($maxUploadFilesize));
$tmpl->assign('savePath', $savePath);
$tmpl->assign("allowShareWithLink", \OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes'));
$tmpl->printPage();
Exemplo n.º 19
0
<?php

/**
* ownCloud - eBook reader application
*
* @author Priyanka Menghani
* 
*/
OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('reader');
OCP\App::setActiveNavigationEntry('reader_index');
OCP\Util::addscript('reader', 'integrate');
OCP\Util::addscript('reader', 'pdf');
OCP\Util::addStyle('reader', 'reader');
// Get the current directory from window url.
$dir = empty($_GET['dir']) ? '/' : $_GET['dir'];
$tmpl = new OCP\Template('reader', 'index', 'user');
$tmpl->assign('dir', $dir);
$tmpl->printPage();
Exemplo n.º 20
0
    if (sizeof($users) !== 1) {
        // User not found
        header('HTTP/1.0 404 Not Found');
        exit;
    }
    // Token found login as that user
    \OC_User::setUserId(array_shift($users));
    $forceUserLogout = true;
}
// check if the user has the right permissions.
\OCP\User::checkLoggedIn();
// rss is of content type text/xml
if (isset($_SERVER['HTTP_ACCEPT']) && stristr($_SERVER['HTTP_ACCEPT'], 'application/rss+xml')) {
    header('Content-Type: application/rss+xml');
} else {
    header('Content-Type: text/xml; charset=UTF-8');
}
// generate and show the rss feed
$l = \OCP\Util::getL10N('activity');
$data = new \OCA\Activity\Data(\OC::$server->getActivityManager());
$groupHelper = new \OCA\Activity\GroupHelper(\OC::$server->getActivityManager(), new \OCA\Activity\DataHelper(\OC::$server->getActivityManager(), new \OCA\Activity\ParameterHelper(new \OC\Files\View(''), \OC::$server->getConfig(), $l), $l), false);
$tmpl = new \OCP\Template('activity', 'rss');
$tmpl->assign('rssLang', \OC_Preferences::getValue(\OCP\User::getUser(), 'core', 'lang'));
$tmpl->assign('rssLink', \OC::$server->getURLGenerator()->getAbsoluteURL(\OC::$server->getURLGenerator()->linkToRoute('activity.rss')));
$tmpl->assign('rssPubDate', date('r'));
$tmpl->assign('user', \OCP\User::getUser());
$tmpl->assign('activities', $data->read($groupHelper, 0, 30, 'all'));
$tmpl->printPage();
if ($forceUserLogout) {
    \OCP\User::logout();
}
<?php

\OCP\User::checkLoggedIn();
\OCP\App::checkAppEnabled('fc_mail_attachments');
\OCP\Util::addscript('fc_mail_attachments', 'utils');
\OCP\Util::addscript('fc_mail_attachments', 'account');
//OCP\Util::addstyle('fc_mail_attachments', 'style');
$user = OCP\User::getUser();
$tmpl = new OCP\Template('fc_mail_attachments', 'settings');
$query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*fc_mail_attachments` WHERE user = ?');
$results = $query->execute(array($user))->fetchAll();
if (sizeof($results)) {
    $conf = $results[0];
    $tmpl->assign('dir', $conf['dir']);
    $tmpl->assign('mail_host', $conf['mail_host']);
    $tmpl->assign('mail_port', $conf['mail_port']);
    $tmpl->assign('mail_security', $conf['mail_security']);
    $tmpl->assign('mail_user', $conf['mail_user']);
}
return $tmpl->fetchPage();
Exemplo n.º 22
0
<?php

/**
 * ownCloud - Updater plugin
 *
 * @author Victor Dubiniuk
 * @copyright 2012-2013 Victor Dubiniuk victor.dubiniuk@gmail.com
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 */
namespace OCA\Updater;

\OCP\User::checkAdminUser();
\OCP\Util::addScript(App::APP_ID, '3rdparty/angular');
\OCP\Util::addScript(App::APP_ID, 'app');
\OCP\Util::addScript(App::APP_ID, 'controllers');
\OCP\Util::addStyle(App::APP_ID, 'updater');
if (!@file_exists(App::getBackupBase())) {
    Helper::mkdir(App::getBackupBase());
}
$data = App::getFeed();
$isNewVersionAvailable = isset($data['version']) && $data['version'] != '' && $data['version'] !== array();
$tmpl = new \OCP\Template(App::APP_ID, 'admin');
$lastCheck = \OC_Appconfig::getValue('core', 'lastupdatedat');
$tmpl->assign('checkedAt', \OCP\Util::formatDate($lastCheck));
$tmpl->assign('isNewVersionAvailable', $isNewVersionAvailable ? 'true' : 'false');
$tmpl->assign('channels', Channel::getChannels());
$tmpl->assign('currentChannel', Channel::getCurrentChannel());
$tmpl->assign('version', isset($data['versionstring']) ? $data['versionstring'] : '');
return $tmpl->fetchPage();
Exemplo n.º 23
0
 *
 */
OC_Util::checkAdminUser();
$params = array('cas_server_version', 'cas_server_hostname', 'cas_server_port', 'cas_server_path', 'cas_group_mapping', 'cas_group_root', 'cas_aliasName');
OCP\Util::addscript('user_cas', 'settings');
if ($_POST) {
    foreach ($params as $param) {
        if (isset($_POST[$param])) {
            OCP\Config::setAppValue('user_cas', $param, $_POST[$param]);
        } elseif ('cas_autocreate' == $param) {
            OCP\Config::setAppValue('user_cas', $param, 0);
        } elseif ('cas_update_user_data' == $param) {
            OCP\Config::setAppValue('user_cas', $param, 0);
        }
    }
}
// fill template
$tmpl = new OCP\Template('user_cas', 'settings');
foreach ($params as $param) {
    $value = htmlentities(OCP\Config::getAppValue('user_cas', $param, ''));
    $tmpl->assign($param, $value);
}
// settings with default values
$tmpl->assign('cas_server_version', OCP\Config::getAppValue('user_cas', 'cas_server_version', '2.0'));
$tmpl->assign('cas_server_hostname', OCP\Config::getAppValue('user_cas', 'cas_server_hostname', 'ident.domain.fr'));
$tmpl->assign('cas_server_port', OCP\Config::getAppValue('user_cas', 'cas_server_port', '443'));
$tmpl->assign('cas_server_path', OCP\Config::getAppValue('user_cas', 'cas_server_path', '/cas'));
$tmpl->assign('cas_group_mapping', OCP\Config::getAppValue('user_cas', 'cas_group_mapping', ''));
$tmpl->assign('cas_group_root', OCP\Config::getAppValue('user_cas', 'cas_group_root', ''));
$tmpl->assign('cas_aliasName', OCP\Config::getAppValue('user_cas', 'cas_aliasName', ''));
return $tmpl->fetchPage();
Exemplo n.º 24
0
 * as published by the Free Software Foundation.
 *
 * 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/>
 *
 */
OCP\User::checkAdminUser();
$htaccessWorking = getenv('htaccessWorking') == 'true';
$upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize'));
$post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
$maxUploadFilesize = OCP\Util::humanFileSize(min($upload_max_filesize, $post_max_size));
if ($_POST && OC_Util::isCallRegistered()) {
    if (isset($_POST['maxUploadSize'])) {
        if (($setMaxSize = OC_Files::setUploadLimit(OCP\Util::computerFileSize($_POST['maxUploadSize']))) !== false) {
            $maxUploadFilesize = OCP\Util::humanFileSize($setMaxSize);
        }
    }
}
$htaccessWritable = is_writable(OC::$SERVERROOT . '/.htaccess');
$tmpl = new OCP\Template('files', 'admin');
$tmpl->assign('uploadChangable', $htaccessWorking and $htaccessWritable);
$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize);
// max possible makes only sense on a 32 bit system
$tmpl->assign('displayMaxPossibleUploadSize', PHP_INT_SIZE === 4);
$tmpl->assign('maxPossibleUploadSize', OCP\Util::humanFileSize(PHP_INT_MAX));
return $tmpl->fetchPage();
Exemplo n.º 25
0
<?php

$tmpl = new OCP\Template('contacts', 'settings');
$tmpl->assign('addressbooks', OC_Contacts_Addressbook::all(OCP\USER::getUser()));
$tmpl->printPage();
Exemplo n.º 26
0
<?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.
 */
$tmpl = new OCP\Template('calendar', 'settings');
$timezone = OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezone', '');
$tmpl->assign('timezone', $timezone);
$tmpl->assign('timezones', DateTimeZone::listIdentifiers());
$tmpl->assign('calendars', OC_Calendar_Calendar::allCalendars(OCP\USER::getUser()), false);
OCP\Util::addscript('calendar', 'settings');
$tmpl->printPage();
Exemplo n.º 27
0
* 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();
OCP\Util::addScript('files_external', 'settings');
OCP\Util::addscript('3rdparty', 'chosen/chosen.jquery.min');
OCP\Util::addStyle('files_external', 'settings');
OCP\Util::addStyle('3rdparty', 'chosen/chosen');
$backends = OC_Mount_Config::getBackends();
$personal_backends = array();
$enabled_backends = explode(',', OCP\Config::getAppValue('files_external', 'user_mounting_backends', ''));
foreach ($backends as $class => $backend) {
    if ($class != '\\OC\\Files\\Storage\\Local') {
        $personal_backends[$class] = array('backend' => $backend['backend'], 'enabled' => in_array($class, $enabled_backends));
    }
}
$tmpl = new OCP\Template('files_external', 'settings');
$tmpl->assign('isAdminPage', true);
$tmpl->assign('mounts', OC_Mount_Config::getSystemMountPoints());
$tmpl->assign('backends', $backends);
$tmpl->assign('personal_backends', $personal_backends);
$tmpl->assign('groups', OC_Group::getGroups());
$tmpl->assign('users', OCP\User::getUsers());
$tmpl->assign('userDisplayNames', OC_User::getDisplayNames());
$tmpl->assign('dependencies', OC_Mount_Config::checkDependencies());
$tmpl->assign('allowUserMounting', OCP\Config::getAppValue('files_external', 'allow_user_mounting', 'yes'));
return $tmpl->fetchPage();
Exemplo n.º 28
0
 * @copyright 2012 Jakob Sack <*****@*****.**>
 *
 * 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/>.
 *
 */
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('mail');
$accounts = OCA_Mail\App::getFolders(OCP\User::getUser());
//
// TODO: error is listed within the accounts
//
if ($accounts['error']) {
    OCP\JSON::error(array('data' => array('message' => $accounts['error'])));
    exit;
}
$tmpl = new OCP\Template('mail', 'part.folders');
$tmpl->assign('accounts', $accounts);
$page = $tmpl->fetchPage();
OCP\JSON::success(array('data' => $page));
Exemplo n.º 29
0
* 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/>.
* 
*/
// Check if we are a user
OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('media');
require_once OC::$APPSROOT . '/apps/media/lib_collection.php';
require_once OC::$APPSROOT . '/apps/media/lib_scanner.php';
OCP\Util::addscript('media', 'player');
OCP\Util::addscript('media', 'music');
OCP\Util::addscript('media', 'playlist');
OCP\Util::addscript('media', 'collection');
OCP\Util::addscript('media', 'scanner');
OCP\Util::addscript('media', 'jquery.jplayer.min');
OCP\Util::addStyle('media', 'music');
OCP\App::setActiveNavigationEntry('media_index');
$tmpl = new OCP\Template('media', 'music', 'user');
$tmpl->printPage();
?>
 
Exemplo n.º 30
0
*/
OCP\User::checkAdminUser();
$htaccessWorking = getenv('htaccessWorking') == 'true';
$upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize'));
$post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
$maxUploadFilesize = OCP\Util::humanFileSize(min($upload_max_filesize, $post_max_size));
if ($_POST && OC_Util::isCallRegistered()) {
    if (isset($_POST['maxUploadSize'])) {
        if (($setMaxSize = OC_Files::setUploadLimit(OCP\Util::computerFileSize($_POST['maxUploadSize']))) !== false) {
            $maxUploadFilesize = OCP\Util::humanFileSize($setMaxSize);
        }
    }
}
OCP\App::setActiveNavigationEntry("files_administration");
$htaccessWritable = is_writable(OC::$SERVERROOT . '/.htaccess');
$tmpl = new OCP\Template('files', 'admin');
/* 
* extended version
* + only users with permission can delete files(in the files app only)
* + file type restriction
*/
$filetyprestriction = \OC_Appconfig::getValue('core', 'filetyperes_enabled', 'no');
$allowed_types = \OC_Appconfig::getValue('core', 'allowed_filetypes', '');
$deleteGroupsList = \OC_Appconfig::getValue('core', 'delete', '');
$deleteGroupsList = explode(',', $deleteGroupsList);
$tmpl->assign('deleteGroupsList', implode('|', $deleteGroupsList));
$tmpl->assign('fileTypeRes', $filetyprestriction);
$tmpl->assign('allowed_filetypes', $allowed_types);
$tmpl->assign('uploadChangable', $htaccessWorking and $htaccessWritable);
$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize);
// max possible makes only sense on a 32 bit system