本文整理汇总了PHP中OC_Helper::linkToRoute方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Helper::linkToRoute方法的具体用法?PHP OC_Helper::linkToRoute怎么用?PHP OC_Helper::linkToRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Helper
的用法示例。
在下文中一共展示了OC_Helper::linkToRoute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendEmail
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);
}
}
示例2: sendEmail
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);
}
}
示例3: search
function search($query)
{
$files = \OC\Files\Filesystem::search($query, true);
$results = array();
$l = OC_L10N::get('lib');
foreach ($files as $fileData) {
$path = $fileData['path'];
$mime = $fileData['mimetype'];
$name = basename($path);
$container = dirname($path);
$text = '';
$skip = false;
if ($mime == 'httpd/unix-directory') {
$link = OC_Helper::linkTo('files', 'index.php', array('dir' => $path));
$type = (string) $l->t('Files');
} else {
$link = OC_Helper::linkToRoute('download', array('file' => $path));
$mimeBase = $fileData['mimepart'];
switch ($mimeBase) {
case 'audio':
$skip = true;
break;
case 'text':
$type = (string) $l->t('Text');
break;
case 'image':
$type = (string) $l->t('Images');
break;
default:
if ($mime == 'application/xml') {
$type = (string) $l->t('Text');
} else {
$type = (string) $l->t('Files');
}
}
}
if (!$skip) {
$results[] = new OC_Search_Result($name, $text, $link, $type, $container);
}
}
return $results;
}
示例4: print_unescaped
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="<?php
print_unescaped(OC_Helper::linkTo('files_pdfviewer', '3rdparty/pdfjs/viewer.css'));
?>
"/>
<!-- oC changes-->
<script type="text/javascript" src="<?php
print_unescaped(OC_Helper::linkTo('core', 'js/jquery-1.7.2.min.js'));
?>
"></script>
<script type="text/javascript" src="<?php
print_unescaped(OC_Helper::linkToRoute('js_config'));
?>
"></script>
<script type="text/javascript" src="<?php
print_unescaped(OC_Helper::linkTo('core', 'js/oc-dialogs.js'));
?>
"></script>
<script type="text/javascript" src="<?php
print_unescaped(OC_Helper::linkTo('core', 'js/js.js'));
?>
"></script>
<!-- oC changes -->
<script type="text/javascript" src="<?php
print_unescaped(OC_Helper::linkTo('files_pdfviewer', '3rdparty/pdfjs/compatibility.js'));
?>
示例5: linkToRoute
/**
* Creates an url using a defined route
* @param string $route
* @param array $parameters
* @internal param array $args with param=>value, will be appended to the returned url
* @return string the url
* @deprecated 8.1.0 Use \OC::$server->getURLGenerator()->linkToRoute($route, $parameters)
* @since 5.0.0
*/
public static function linkToRoute($route, $parameters = array())
{
return \OC_Helper::linkToRoute($route, $parameters);
}
示例6: __construct
/**
* @param string $renderAs
* @param string $appId application id
*/
public function __construct($renderAs, $appId = '')
{
// yes - should be injected ....
$this->config = \OC::$server->getConfig();
// Decide which page we show
if ($renderAs == 'user') {
parent::__construct('core', 'layout.user');
if (in_array(OC_App::getCurrentApp(), ['settings', 'admin', 'help']) !== false) {
$this->assign('bodyid', 'body-settings');
} else {
$this->assign('bodyid', 'body-user');
}
// Update notification
if ($this->config->getSystemValue('updatechecker', true) === true && OC_User::isAdminUser(OC_User::getUser())) {
$updater = new \OC\Updater(\OC::$server->getHTTPHelper(), \OC::$server->getConfig());
$data = $updater->check();
if (isset($data['version']) && $data['version'] != '' and $data['version'] !== array()) {
$this->assign('updateAvailable', true);
$this->assign('updateVersion', $data['versionstring']);
$this->assign('updateLink', $data['web']);
\OCP\Util::addScript('core', 'update-notification');
} else {
$this->assign('updateAvailable', false);
// No update available or not an admin user
}
} else {
$this->assign('updateAvailable', false);
// Update check is disabled
}
// Add navigation entry
$this->assign('application', '');
$this->assign('appid', $appId);
$navigation = OC_App::getNavigation();
$this->assign('navigation', $navigation);
$settingsNavigation = OC_App::getSettingsNavigation();
$this->assign('settingsnavigation', $settingsNavigation);
foreach ($navigation as $entry) {
if ($entry['active']) {
$this->assign('application', $entry['name']);
break;
}
}
foreach ($settingsNavigation as $entry) {
if ($entry['active']) {
$this->assign('application', $entry['name']);
break;
}
}
$userDisplayName = OC_User::getDisplayName();
$this->assign('user_displayname', $userDisplayName);
$this->assign('user_uid', OC_User::getUser());
$this->assign('appsmanagement_active', strpos(\OC::$server->getRequest()->getRequestUri(), \OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')) === 0);
$this->assign('enableAvatars', $this->config->getSystemValue('enable_avatars', true));
$this->assign('userAvatarSet', \OC_Helper::userAvatarSet(OC_User::getUser()));
} else {
if ($renderAs == 'error') {
parent::__construct('core', 'layout.guest', '', false);
$this->assign('bodyid', 'body-login');
} else {
if ($renderAs == 'guest') {
parent::__construct('core', 'layout.guest');
$this->assign('bodyid', 'body-login');
} else {
parent::__construct('core', 'layout.base');
}
}
}
// Send the language to our layouts
$this->assign('language', OC_L10N::findLanguage());
if (empty(self::$versionHash)) {
$v = OC_App::getAppVersions();
$v['core'] = implode('.', \OC_Util::getVersion());
self::$versionHash = md5(implode(',', $v));
}
$useAssetPipeline = self::isAssetPipelineEnabled();
if ($useAssetPipeline) {
$this->append('jsfiles', OC_Helper::linkToRoute('js_config', array('v' => self::$versionHash)));
$this->generateAssets();
} else {
// Add the js files
$jsFiles = self::findJavascriptFiles(OC_Util::$scripts);
$this->assign('jsfiles', array(), false);
if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
$this->append('jsfiles', OC_Helper::linkToRoute('js_config', array('v' => self::$versionHash)));
}
foreach ($jsFiles as $info) {
$web = $info[1];
$file = $info[2];
$this->append('jsfiles', $web . '/' . $file . '?v=' . self::$versionHash);
}
// Add the css files
$cssFiles = self::findStylesheetFiles(OC_Util::$styles);
$this->assign('cssfiles', array());
foreach ($cssFiles as $info) {
$web = $info[1];
$file = $info[2];
//.........这里部分代码省略.........
示例7: preview_icon
public static function preview_icon($path)
{
return \OC_Helper::linkToRoute('core_ajax_trashbin_preview', array('x' => 36, 'y' => 36, 'file' => $path));
}
示例8: finishSetup
public function finishSetup()
{
header('Location: ' . \OC_Helper::linkToRoute('post_setup_check'));
exit;
}
示例9: class_exists
}
OC_Util::addScript('setup');
$hasSQLite = class_exists('SQLite3');
$hasMySQL = is_callable('mysql_connect');
$hasPostgreSQL = is_callable('pg_connect');
$hasOracle = is_callable('oci_connect');
$hasMSSQL = is_callable('sqlsrv_connect');
$datadir = OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data');
$vulnerableToNullByte = false;
if (@file_exists(__FILE__ . "Nullbyte")) {
// Check if the used PHP version is vulnerable to the NULL Byte attack (CVE-2006-7243)
$vulnerableToNullByte = true;
}
// Protect data directory here, so we can test if the protection is working
OC_Setup::protectDataDirectory();
$opts = array('hasSQLite' => $hasSQLite, 'hasMySQL' => $hasMySQL, 'hasPostgreSQL' => $hasPostgreSQL, 'hasOracle' => $hasOracle, 'hasMSSQL' => $hasMSSQL, 'directory' => $datadir, 'secureRNG' => OC_Util::secureRNGAvailable(), 'htaccessWorking' => OC_Util::isHtAccessWorking(), 'vulnerableToNullByte' => $vulnerableToNullByte, 'errors' => array(), 'dbIsSet' => $dbIsSet, 'directoryIsSet' => $directoryIsSet);
if (isset($_POST['install']) and $_POST['install'] == 'true') {
// We have to launch the installation process :
$e = OC_Setup::install($_POST);
$errors = array('errors' => $e);
if (count($e) > 0) {
//OC_Template::printGuestPage("", "error", array("errors" => $errors));
$options = array_merge($_POST, $opts, $errors);
OC_Template::printGuestPage("", "installation", $options);
} else {
header('Location: ' . OC_Helper::linkToRoute('post_setup_check'));
exit;
}
} else {
OC_Template::printGuestPage("", "installation", $opts);
}
示例10: print_unescaped
<?php
\OCP\Util::addStyle('registration', 'style');
?>
<form action="<?php
print_unescaped(OC_Helper::linkToRoute('registration.register.createAccount', array('token' => $_['token'])));
?>
" method="post">
<input type="hidden" name="requesttoken" value="<?php
p($_['requesttoken']);
?>
" />
<fieldset>
<?php
if ($_['errormsgs']) {
?>
<ul class="error">
<?php
foreach ($_['errormsgs'] as $errormsg) {
echo "<li>{$errormsg}</li>";
}
?>
</ul>
<?php
} else {
?>
<ul class="msg">
<li><?php
print_unescaped($l->t('Welcome, you can create your account below.'));
?>
</li>
示例11: print_unescaped
<?php
//load the file we need
OCP\Util::addStyle('lostpassword', 'lostpassword');
if ($_['requested']) {
?>
<div class="update"><p>
<?php
print_unescaped($l->t('The link to reset your password has been sent to your email.<br>If you do not receive it within a reasonable amount of time, check your spam/junk folders.<br>If it is not there ask your local administrator .'));
?>
</p></div>
<?php
} else {
?>
<form action="<?php
print_unescaped(OC_Helper::linkToRoute('core_lostpassword_send_email'));
?>
" method="post">
<fieldset>
<?php
if ($_['error']) {
?>
<div class="error"><p>
<?php
print_unescaped($l->t('Request failed!<br>Did you make sure your email/username was right?'));
?>
</p></div>
<?php
}
?>
<div class="update"><?php
示例12:
echo $l->t('If you did not change your password recently, your account may be compromised!');
?>
</small><br>
<small><?php
echo $l->t('Please change your password to secure your account again.');
?>
</small>
</li>
<?php
}
?>
<?php
if (isset($_['invalidpassword']) && $_['invalidpassword']) {
?>
<a href="<?php
echo OC_Helper::linkToRoute('core_lostpassword_index');
?>
"><li class="errors">
<?php
echo $l->t('Lost your password?');
?>
</li></a>
<?php
}
?>
</ul>
<p class="infield">
<label for="user" class="infield"><?php
echo $l->t('Username');
?>
</label>
示例13: p
p($entry['name']);
?>
</span>
</a>
</li>
<?php
}
?>
<!-- show "More apps" link to app administration directly in app navigation, as last entry -->
<?php
if (OC_User::isAdminUser(OC_User::getUser())) {
?>
<li id="apps-management">
<a href="<?php
print_unescaped(OC_Helper::linkToRoute('settings_apps'));
?>
" title=""
<?php
if ($_['appsmanagement_active']) {
?>
class="active"<?php
}
?>
>
<img class="app-icon svg" alt="" src="<?php
print_unescaped(OC_Helper::imagePath('settings', 'apps.svg'));
?>
"/>
<div class="icon-loading-dark" style="display:none;"></div>
<span>
示例14: array
* Copyright (c) 2011, Robin Appelman <icewind1991@gmail.com>
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file.
*/
$allGroups = array();
foreach ($_["groups"] as $group) {
$allGroups[] = $group['name'];
}
$_['subadmingroups'] = $allGroups;
$items = array_flip($_['subadmingroups']);
unset($items['admin']);
$_['subadmingroups'] = array_flip($items);
?>
<script type="text/javascript" src="<?php
print_unescaped(OC_Helper::linkToRoute('isadmin'));
?>
"></script>
<table class="hascontrols grid" data-groups="<?php
p(json_encode($allGroups));
?>
">
<thead>
<tr>
<?php
if ($_['enableAvatars']) {
?>
<th id='headerAvatar' style="text-align:center;width:50px;"></th>
<?php
}
示例15: print_unescaped
print_unescaped(image_path('', 'actions/mail.svg'));
?>
" alt=""/>
</p>
<input type="submit" id="submit" value="<?php
print_unescaped($l->t('Request verification link'));
?>
" />
</fieldset>
</form>
<?php
}
} else {
?>
<form action="<?php
print_unescaped(OC_Helper::linkToRoute('registration.register.validateEmail'));
?>
" method="post">
<fieldset>
<?php
if ($_['errormsg']) {
?>
<ul class="error">
<li><?php
print_unescaped($_['errormsg']);
?>
</li>
<li><?php
print_unescaped($l->t('Please re-enter a valid email address'));
?>
</li>