本文整理汇总了PHP中Kit::Token方法的典型用法代码示例。如果您正苦于以下问题:PHP Kit::Token方法的具体用法?PHP Kit::Token怎么用?PHP Kit::Token使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kit
的用法示例。
在下文中一共展示了Kit::Token方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: defined
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
*
* Theme variables:
* layout_form_add_url = The URL for calling the Layout Add Form
* id = The GridID for rendering AJAX layout table return
* filter_id = The Filter Form ID
* form_meta = Extra form meta that needs to be sent to the CMS to return the list of layouts
* pager = A paging control for this Xibo Grid
*/
defined('XIBO') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser.");
?>
<div id="LayoutAssign" class="well">
<div>
<ul id="LayoutAssignSortable">
<?php
echo Kit::Token('assign_token');
?>
<?php
foreach (Theme::Get('layouts_assigned') as $row) {
?>
<li id="LayoutID_<?php
echo $row->layoutId;
?>
" class="btn btn-sm btn-default"><?php
echo $row->layout;
?>
<span class="glyphicon glyphicon-minus-sign"></span></li>
<?php
}
?>
</ul>
示例2: Get
public static function Get($key)
{
$theme = Theme::GetInstance();
if (!isset($theme->vars[$key])) {
$return = null;
} else {
$return = $theme->vars[$key];
}
if ($key == 'form_meta') {
// Append a token to the end
$return = $return . Kit::Token();
}
return $return;
}
示例3: EditEventForm
/**
* Shows a form to add an event
* will default to the current date if non is provided
* @return
*/
function EditEventForm()
{
$db =& $this->db;
$user =& $this->user;
$response = new ResponseManager();
$eventID = Kit::GetParam('EventID', _GET, _INT, 0);
if ($eventID == 0) {
trigger_error(__('No event selected.'), E_USER_ERROR);
}
// Get the relevant details for this event
$SQL = "";
$SQL .= "SELECT schedule.FromDT, ";
$SQL .= " schedule.ToDT,";
$SQL .= " schedule.CampaignID, ";
$SQL .= " schedule.userid, ";
$SQL .= " schedule.is_priority, ";
$SQL .= " schedule.DisplayGroupIDs, ";
$SQL .= " schedule.recurrence_type, ";
$SQL .= " schedule.recurrence_detail, ";
$SQL .= " schedule.recurrence_range, ";
$SQL .= " schedule.EventID, ";
$SQL .= " schedule.DisplayOrder ";
$SQL .= " FROM schedule ";
$SQL .= " WHERE 1=1 ";
$SQL .= sprintf(" AND schedule.EventID = %d", $eventID);
Debug::LogEntry('audit', $SQL);
if (!($result = $db->query($SQL))) {
trigger_error($db->error());
trigger_error(__('Error getting details for this event.'), E_USER_ERROR);
}
$row = $db->get_assoc_row($result);
$fromDT = Kit::ValidateParam($row['FromDT'], _INT);
$toDT = Kit::ValidateParam($row['ToDT'], _INT);
$displayGroupIds = explode(',', Kit::ValidateParam($row['DisplayGroupIDs'], _STRING));
$recType = Kit::ValidateParam($row['recurrence_type'], _STRING);
$recDetail = Kit::ValidateParam($row['recurrence_detail'], _STRING);
$recToDT = Kit::ValidateParam($row['recurrence_range'], _INT);
$campaignId = Kit::ValidateParam($row['CampaignID'], _STRING);
$isPriority = Kit::ValidateParam($row['is_priority'], _INT);
$displayOrder = Kit::ValidateParam($row['DisplayOrder'], _INT);
// Check that we have permission to edit this event.
if (!$this->IsEventEditable($displayGroupIds)) {
trigger_error(__('You do not have permission to edit this event.'), E_USER_ERROR);
}
$token_id = uniqid();
$token_field = '<input type="hidden" name="token_id" value="' . $token_id . '" />';
$token = Kit::Token($token_id);
Theme::Set('form_id', 'EditEventForm');
Theme::Set('form_action', 'index.php?p=schedule&q=EditEvent');
Theme::Set('form_meta', $token_field . $token . '<input type="hidden" id="EventID" name="EventID" value="' . $eventID . '" />');
// Two tabs
$tabs = array();
$tabs[] = FormManager::AddTab('general', __('General'));
$tabs[] = FormManager::AddTab('repeats', __('Repeats'));
Theme::Set('form_tabs', $tabs);
$formFields = array();
// List of Display Groups
$optionGroups = array(array('id' => 'group', 'label' => __('Groups')), array('id' => 'display', 'label' => __('Displays')));
$groups = array();
$displays = array();
$scheduleWithView = Config::GetSetting('SCHEDULE_WITH_VIEW_PERMISSION') == 'Yes';
foreach ($this->user->DisplayGroupList(-1) as $display) {
// Can schedule with view, but no view permissions
if ($scheduleWithView && $display['view'] != 1) {
continue;
}
// Can't schedule with view, but no edit permissions
if (!$scheduleWithView && $display['edit'] != 1) {
continue;
}
$display['checked_text'] = in_array($display['displaygroupid'], $displayGroupIds) ? ' selected' : '';
if ($display['isdisplayspecific'] == 1) {
$displays[] = $display;
} else {
$groups[] = $display;
}
}
$formFields['general'][] = FormManager::AddMultiCombo('DisplayGroupIDs[]', __('Display'), $displayGroupIds, array('group' => $groups, 'display' => $displays), 'displaygroupid', 'displaygroup', __('Please select one or more displays / groups for this event to be shown on.'), 'd', '', true, '', '', '', $optionGroups, array(array('name' => 'data-live-search', 'value' => "true"), array('name' => 'data-selected-text-format', 'value' => "count > 4")));
// Time controls
$formFields['general'][] = FormManager::AddText('starttimeControl', __('Start Time'), DateManager::getLocalDate($fromDT), __('Select the start time for this event'), 's', 'required');
$formFields['general'][] = FormManager::AddText('endtimeControl', __('End Time'), DateManager::getLocalDate($toDT), __('Select the end time for this event'), 'e', 'required');
// Add two hidden fields to always carry the ISO date
$formFields['general'][] = FormManager::AddHidden('starttime', DateManager::getLocalDate($fromDT, "Y-m-d H:i", false));
$formFields['general'][] = FormManager::AddHidden('endtime', DateManager::getLocalDate($toDT, "Y-m-d H:i", false));
// Generate a list of layouts.
$layouts = $user->CampaignList(NULL, false, false);
$optionGroups = array(array('id' => 'campaign', 'label' => __('Campaigns')), array('id' => 'layout', 'label' => __('Layouts')));
$layoutOptions = array();
$campaignOptions = array();
foreach ($layouts as $layout) {
if ($layout['islayoutspecific'] == 1) {
$layoutOptions[] = array('id' => $layout['campaignid'], 'value' => $layout['campaign']);
} else {
$campaignOptions[] = array('id' => $layout['campaignid'], 'value' => $layout['campaign']);
}
//.........这里部分代码省略.........
示例4: foreach
<?php
}
?>
<?php
}
}
?>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
if ($multiSelect) {
$token = Kit::Token('gridToken', false);
?>
<div class="btn-group">
<button class="btn dropdown-toggle" data-toggle="dropdown">
<span class="fa fa-long-arrow-up"></span>
<?php
echo Theme::Translate('With Selected');
?>
</button>
<ul class="dropdown-menu">
<?php
// Get the buttons that are multi-select
foreach ($multiSelectButtons as $key => $button) {
?>
<li class="XiboMultiSelectFormButton" data-button-id="<?php
echo $key;
示例5: DeleteDayForm
/**
* Shows the DeleteEvent form
* @return
*/
function DeleteDayForm()
{
$response = new ResponseManager();
$date = Kit::GetParam('date', _GET, _INT, 0);
$dateString = date('Y-m-d', $date);
if ($date == 0) {
trigger_error(__('Day not selected'), E_USER_ERROR);
}
$strQuestion = __('Are you sure you want to delete all events that intersect this day from <b>all</b> displays?');
$strAdvice = __('This action cannot be undone.');
$token = Kit::Token();
$form = <<<END
<form id="DeleteDayForm" class="XiboForm" action="index.php?p=schedule&q=DeleteDay">
{$token}
<input type="hidden" name="date" value="{$date}">
<table>
<tr>
<td>{$strQuestion}</td>
</tr>
<tr>
<td>{$strAdvice}</td>
</tr>
</table>
</form>
END;
$response->SetFormRequestResponse($form, sprintf(__('Delete %s'), $dateString), '480px', '240px');
$response->AddButton(__('Help'), "XiboHelpRender('index.php?p=help&q=Display&Topic=Schedule&Category=Delete')");
$response->AddButton(__('No'), 'XiboFormRender("index.php?p=schedule&q=DayViewFilter&date=' . $date . '")');
$response->AddButton(__('Yes'), '$("#DeleteDayForm").submit()');
$response->Respond();
}
示例6: ExchangeGridTokenForFormToken
function ExchangeGridTokenForFormToken()
{
// Check our grid token against the one provided.
if (!Kit::CheckToken('gridToken')) {
die(__('Sorry the form has expired. Please refresh.'));
}
echo Kit::Token('token', false);
exit;
}
示例7: SetFormSubmitResponse
/**
* Sets the Default response options for a form submit
* @return
* @param $message String
* @param $refresh Boolean[optional]
* @param $refreshLocation String[optional]
*/
public function SetFormSubmitResponse($message, $refresh = false, $refreshLocation = '')
{
$this->success = true;
$this->message = $message;
$this->refresh = $refresh;
$this->refreshLocation = $refreshLocation;
$this->nextToken = Kit::Token();
return;
}
示例8: display_settings
function display_settings()
{
$db =& $this->db;
$user =& $this->user;
$helpObject = new HelpManager($db, $user);
$helpButton = $helpObject->HelpButton("content/config/settings", true);
//one giant form, split into tabs
$form = '<form id="SettingsForm" method="post" class="XiboForm" action="index.php?p=admin&q=modify">' . Kit::Token();
$tabs = '';
$pages = '';
//get all the tabs, ordered by catagory
$SQL = "SELECT DISTINCT cat FROM setting WHERE userChange = 1 ORDER BY cat";
if (!($results = $db->query($SQL))) {
trigger_error($db->error());
trigger_error(__("Can't get the setting catagories"), E_USER_ERROR);
}
while ($row = $db->get_row($results)) {
$cat = $row[0];
$ucat = ucfirst($cat);
$cat_tab = $cat . "_tab";
// generate the li and a for this tab
$tabs .= "<li><a href='#{$cat_tab}'><span>{$ucat}</span><i class='icon-chevron-right pull-right'></i></a></li>";
// for each one, call display_cat to get the settings specific to that cat
$cat_page = $this->display_cat($cat);
$pages .= <<<PAGES
\t\t\t<div id="{$cat_tab}">
\t\t\t\t{$cat_page}
\t\t\t</div>
PAGES;
}
$msgSave = __('Save');
$msgCategories = __('Categories');
// Output it all
$form .= <<<FORM
\t\t<div class="span2">
\t\t\t<div class="well affix">
\t\t\t\t<ul class="nav nav-list ">
\t\t\t\t\t<li class="nav-header">{$msgCategories}</li>
\t\t\t\t\t{$tabs}
\t\t\t\t</ul>
\t\t\t</div>
\t\t</div>
\t\t<div class="span10">
\t\t\t{$pages}
\t\t</div>
FORM;
//end the form and output
$form .= "</form>";
return $form;
}