本文整理汇总了PHP中Tiki_Profile::useUnicityPrefix方法的典型用法代码示例。如果您正苦于以下问题:PHP Tiki_Profile::useUnicityPrefix方法的具体用法?PHP Tiki_Profile::useUnicityPrefix怎么用?PHP Tiki_Profile::useUnicityPrefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tiki_Profile
的用法示例。
在下文中一共展示了Tiki_Profile::useUnicityPrefix方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wikiplugin_datachannel
function wikiplugin_datachannel($data, $params)
{
static $execution = 0;
global $prefs, $smarty;
$executionId = 'datachannel-exec-' . ++$execution;
$fields = array();
$lines = explode("\n", $data);
$lines = array_map('trim', $lines);
$lines = array_filter($lines);
foreach ($lines as $line) {
$parts = explode(',', $line, 2);
if (count($parts) == 2) {
$fields[$parts[0]] = $parts[1];
}
}
require_once 'lib/profilelib/profilelib.php';
require_once 'lib/profilelib/channellib.php';
require_once 'lib/profilelib/installlib.php';
$groups = Perms::get()->getGroups();
$config = Tiki_Profile_ChannelList::fromConfiguration($prefs['profile_channels']);
if ($config->canExecuteChannels(array($params['channel']), $groups)) {
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['datachannel_execution']) && $_POST['datachannel_execution'] == $executionId) {
$input = array_intersect_key($_POST, $fields);
$static = $params;
unset($static['channel']);
$userInput = array_merge($input, $static);
Tiki_Profile::useUnicityPrefix(uniqid());
$installer = new Tiki_Profile_Installer();
$installer->limitGlobalPreferences(array());
$profiles = $config->getProfiles(array($params['channel']));
$profile = reset($profiles);
$installer->setUserData($userInput);
$installer->install($profile);
header('Location: ' . $_SERVER['REQUEST_URI']);
} else {
$smarty->assign('datachannel_fields', $fields);
$smarty->assign('datachannel_execution', $executionId);
return '~np~' . $smarty->fetch('wiki-plugins/wikiplugin_datachannel.tpl') . '~/np~';
}
}
}
示例2: tra
}
if ( ! $config->canExecuteChannels($channels, $groups) ) {
$access->display_error(
'tiki-channel.php',
tra('One of the requested channels cannot be requested. It does not exist or permission is denied.')
);
}
$profiles = $config->getProfiles($channels);
if ( count($profiles) != count($channels) ) {
$access->display_error('tiki-channel.php', tra('One of the install profiles could not be obtained.'));
}
Tiki_Profile::useUnicityPrefix(uniqid());
$installer = new Tiki_Profile_Installer;
$installer->limitGlobalPreferences(array());
foreach ( $calls as $call ) {
list($channel, $userInput) = $call;
// Profile can be installed multiple times
// Only last values preserved
$profile = $profiles[$channel];
$installer->forget($profile);
$installer->setUserData($userInput);
$installer->install($profile);
}
示例3: wikiplugin_datachannel
//.........这里部分代码省略.........
// (e.g. from trackerlist checkboxes)
}
}
} else {
$arr = $val;
// not an array, so use the initial string val
}
}
}
$input[$key] = $arr;
}
}
}
}
$inputs = array();
if ($params['array_values'] === 'y' && !empty($itemIds)) {
$cid = count($itemIds);
for ($i = 0; $i < $cid; $i++) {
// reorganise array
$arr = array();
foreach (array_keys($input) as $k) {
if (isset($input[$k]) && is_array($input[$k])) {
$arr[$k] = $input[$k][$i];
} else {
$arr[$k] = $input[$k];
}
}
$inputs[] = $arr;
}
} else {
$inputs[] = $input;
}
$static = $params;
$unsets = wikiplugin_datachannel_info();
// get defined params
$unsets = array_keys($unsets['params']);
foreach ($unsets as $un) {
// remove defined params leaving user supplied ones
unset($static[$un]);
}
if (!empty($params['price'])) {
global $paymentlib;
require_once 'lib/payment/paymentlib.php';
$desc = empty($params['paymentlabel']) ? tr('Datachannel:', $prefs['site_language']) . ' ' . $params['channel'] : $params['paymentlabel'];
$posts = array();
foreach ($input as $key => $post) {
$posts[$key] = $post;
$desc .= '/' . $post;
}
$id = $paymentlib->request_payment($desc, $params['price'], $prefs['payment_default_delay']);
$paymentlib->register_behavior($id, 'complete', 'execute_datachannel', array($data, $params, $posts, $executionId));
require_once 'lib/smarty_tiki/function.payment.php';
return '^~np~' . smarty_function_payment(array('id' => $id), $smarty) . '~/np~^';
}
foreach ($inputs as $input) {
$userInput = array_merge($input, $static);
Tiki_Profile::useUnicityPrefix(uniqid());
$profiles = $config->getProfiles(array($params['channel']));
$profile = reset($profiles);
$profile->removeSymbols();
Tiki_Profile::useUnicityPrefix(uniqid());
$installer = new Tiki_Profile_Installer();
//TODO: What is the following line for? Future feature to limit capabilities of data channels?
//$installer->limitGlobalPreferences( array() );
// jb tiki6: looks like if set to an empty array it would prevent any prefs being set
// i guess the idea is to be able to restrict the settable prefs to only harmless ones for security
$installer->setUserData($userInput);
if (!empty($params['debug']) && $params['debug'] === 'y') {
$installer->setDebug();
}
$params['emptyCache'] = isset($params['emptyCache']) ? $params['emptyCache'] : 'all';
$installer->install($profile, $params['emptyCache']);
}
if (empty($params['returnURI'])) {
$params['returnURI'] = $_SERVER['HTTP_REFERER'];
}
// default to return to same page
if (empty($params['debug']) || $params['debug'] != 'y') {
if (isset($params['quietReturn']) && $params['quietReturn'] == 'y') {
return true;
} else {
header('Location: ' . $params['returnURI']);
}
die;
}
$smarty->assign('datachannel_feedbacks', array_merge($installer->getFeedback(), $profile->getFeedback()));
}
$smarty->assign('datachannel_inputfields', $inputfields);
$smarty->assign('datachannel_fields', $fields);
$smarty->assign('button_label', !empty($params['buttonLabel']) ? $params['buttonLabel'] : 'Go');
$smarty->assign('form_class_attr', !empty($params['class']) ? ' class="' . $params['class'] . '"' : '');
if (!empty($js)) {
$headerlib->add_js("function datachannel_form_submit{$execution}() {{$js}\nreturn true;\n}");
$smarty->assign('datachannel_form_onsubmit', ' onsubmit="return datachannel_form_submit' . $execution . '();"');
} else {
$smarty->assign('datachannel_form_onsubmit', '');
}
return '~np~' . $smarty->fetch('wiki-plugins/wikiplugin_datachannel.tpl') . '~/np~';
}
}