本文整理汇总了PHP中GetIncomingValue函数的典型用法代码示例。如果您正苦于以下问题:PHP GetIncomingValue函数的具体用法?PHP GetIncomingValue怎么用?PHP GetIncomingValue使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetIncomingValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PluginController_ThankFor_Create
public function PluginController_ThankFor_Create($Sender)
{
$Session = $this->Session;
if (!$Session->IsValid()) {
return;
}
//$Sender->Permission('Plugins.ThankfulPeople.Thank'); // TODO: PERMISSION THANK FOR CATEGORY
$ThanksLogModel = new ThanksLogModel();
$Type = GetValue(0, $Sender->RequestArgs);
$ObjectID = GetValue(1, $Sender->RequestArgs);
$Field = $ThanksLogModel->GetPrimaryKeyField($Type);
$UserID = $ThanksLogModel->GetObjectInserUserID($Type, $ObjectID);
if ($UserID == False) {
throw new Exception('Object has no owner.');
}
if ($UserID == $Session->UserID) {
throw new Exception('You cannot thank yourself.');
}
if (!self::IsThankable($Type)) {
throw new Exception("Not thankable ({$Type}).");
}
// Make sure that user is not trying to say thanks twice.
$Count = $ThanksLogModel->GetCount(array($Field => $ObjectID, 'InsertUserID' => $Session->User->UserID));
if ($Count < 1) {
$ThanksLogModel->PutThank($Type, $ObjectID, $UserID);
}
if ($Sender->DeliveryType() == DELIVERY_TYPE_ALL) {
$Target = GetIncomingValue('Target', 'discussions');
Redirect($Target);
}
$ThankfulPeopleDataSet = $ThanksLogModel->GetThankfulPeople($Type, $ObjectID);
$Sender->SetData('NewThankedByBox', self::ThankedByBox($ThankfulPeopleDataSet->Result(), False));
$Sender->Render();
}
示例2: BuildPager
private function BuildPager($Sender, $Total)
{
$Sanitized = $this->ValidateInputs();
//get offset
$GETString = '?' . Gdn_Url::QueryString() . '&tar=srch';
//use this to providea link back to search - be sure to append the '&tar=srch' to tell to load the main search page
$GETString = str_replace('p=search&', 'search?', $GETString);
//echo $GETString; die;
$Limit = $this->Settings['Admin']->LimitResultsPage;
$Offset = ($Sanitized['Offset'] - 1) * $Limit;
//limit per page
$Pos = strpos($GETString, '&pg=' . $_GET['pg']);
if (!$Pos == FALSE) {
//$Url = substr($GETString, 0, $Pos); //strip the page number if it exists
$Url = str_replace('&pg=' . GetIncomingValue('pg'), '', $GETString);
//strip the page number if it exists
$Url = str_replace('&tar=srch', '', $Url);
//don't want to load adv search page when clicking page numbers
} else {
$Url = str_replace('&tar=srch', '', $GETString);
}
//don't want to load adv search page when clicking page numbers
$PagerFactory = new Gdn_PagerFactory();
$Sender->Pager = $PagerFactory->GetPager('Pager', $Sender);
$Sender->Pager->MoreCode = '>';
$Sender->Pager->LessCode = '<';
$Sender->Pager->ClientID = 'Pager';
$Sender->Pager->Configure($Offset, $Limit, $Total, $Url . '&pg=%1$s');
//echo $Url; die;
$Sender->SetData('GETString', $GETString);
}
示例3: PluginController_TimerTick_Create
public function PluginController_TimerTick_Create($Sender)
{
// Assume that $Sender->RequestArgs is empty.
$Token = GetIncomingValue('TimerTickToken', RandomString(5));
if ($Token == C('Plugins.UsefulFunctions.TimerTick.SecretKey', RandomString(8))) {
require dirname(__FILE__) . '/bin/tick.php';
}
}
示例4: Slug
public function Slug()
{
$Session = Gdn::Session();
if ($Session->IsValid()) {
$Text = GetIncomingValue('Text');
echo CandyModel::Slug($Text);
}
}
示例5: Stash
/**
* Stash a value in the user's session, or unstash it if no value was provided to stash.
*/
public function Stash() {
$this->DeliveryType(DELIVERY_TYPE_BOOL);
$this->DeliveryMethod(DELIVERY_METHOD_JSON);
$Name = GetIncomingValue('Name', '');
$Value = GetIncomingValue('Value', '');
$Response = Gdn::Session()->Stash($Name, $Value);
if ($Name != '' && $Value == '')
$this->SetJson('Unstash', $Response);
$this->Render();
}
示例6: AutoComplete
public function AutoComplete()
{
$this->DeliveryType(DELIVERY_TYPE_NONE);
$Q = GetIncomingValue('q');
$UserModel = new Gdn_UserModel();
$Data = $UserModel->GetLike(array('u.Name' => $Q), 'u.Name', 'asc', 10, 0);
foreach ($Data->Result('Text') as $User) {
echo $User->Name . '|' . $User->UserID . "\n";
}
$this->Render();
}
示例7: Dismiss
/**
* Dismiss a message (per user).
*
* @since 2.0.0
* @access public
*/
public function Dismiss($MessageID = '', $TransientKey = FALSE)
{
$Session = Gdn::Session();
if ($TransientKey !== FALSE && $Session->ValidateTransientKey($TransientKey)) {
$Prefs = $Session->GetPreference('DismissedMessages', array());
$Prefs[] = $MessageID;
$Session->SetPreference('DismissedMessages', $Prefs);
}
if ($this->_DeliveryType === DELIVERY_TYPE_ALL) {
Redirect(GetIncomingValue('Target', '/discussions'));
}
$this->Render();
}
示例8: setToggle
/**
* Set the preference in the user's session.
*/
public function setToggle()
{
$Session = Gdn::session();
if (!$Session->isValid()) {
return;
}
$ShowAllCategories = GetIncomingValue('ShowAllCategories', '');
if ($ShowAllCategories != '') {
$ShowAllCategories = $ShowAllCategories == 'true' ? true : false;
$ShowAllCategoriesPref = $Session->GetPreference('ShowAllCategories');
if ($ShowAllCategories != $ShowAllCategoriesPref) {
$Session->setPreference('ShowAllCategories', $ShowAllCategories);
}
redirect('/' . ltrim(Gdn::request()->Path(), '/'));
}
}
示例9: SetToggle
/**
* Set the preference in the user's session.
*/
public function SetToggle()
{
$Session = Gdn::Session();
if (!$Session->IsValid()) {
return;
}
$ShowAllCategories = GetIncomingValue('ShowAllCategories', '');
if ($ShowAllCategories != '') {
$ShowAllCategories = $ShowAllCategories == 'true' ? TRUE : FALSE;
$ShowAllCategoriesPref = $Session->GetPreference('ShowAllCategories');
if ($ShowAllCategories != $ShowAllCategoriesPref) {
$Session->SetPreference('ShowAllCategories', $ShowAllCategories);
}
Redirect('/' . ltrim(Gdn::Request()->Path(), '/'));
}
}
示例10: Index
public function Index()
{
$Limit = GetIncomingValue('limit', 5);
$Offset = GetIncomingValue('offset', 0);
$DiscussionID = GetIncomingValue('id', 0);
$Session = Gdn::Session();
$Discussion = $this->DiscussionModel->GetID($DiscussionID);
if ($Discussion != False && $Session->CheckPermission('Vanilla.Discussions.View', $Discussion->CategoryID)) {
$this->SetJSON("discussion", $Discussion);
if ($Discussion->CountComments > 0) {
$Comments = $this->CommentModel->Get($DiscussionID, $Limit, $Offset)->Result();
$this->SetJSON("comments", $Comments);
}
}
$this->Render();
}
示例11: Controller_Index
/**
* Settings screen placeholder
*
* @param mixed $Sender
*/
public function Controller_Index($Sender)
{
$Sender->Permission('Garden.Settings.Manage');
$Sender->Title('Community Reporting');
$Sender->AddSideMenu('settings/plugins');
$Sender->AddCssFile('reporting.css', 'plugins/Reporting');
// Check to see if the admin is toggling a feature
$Feature = GetValue('1', $Sender->RequestArgs);
$Command = GetValue('2', $Sender->RequestArgs);
$TransientKey = GetIncomingValue('TransientKey');
if (Gdn::Session()->ValidateTransientKey($TransientKey)) {
if (in_array($Feature, array('awesome', 'report'))) {
SaveToConfig('Plugins.Reporting.' . ucfirst($Feature) . 'Enabled', $Command == 'disable' ? FALSE : TRUE);
Redirect('plugin/reporting');
}
}
$CategoryModel = new CategoryModel();
$Sender->SetData('Plugins.Reporting.Data', array('ReportEnabled' => $this->ReportEnabled, 'AwesomeEnabled' => $this->AwesomeEnabled));
$Sender->Render($this->GetView('settings.php'));
}
示例12: Delete
public function Delete($ActivityID = '', $TransientKey = '')
{
$Session = Gdn::Session();
if ($Session->ValidateTransientKey($TransientKey) && is_numeric($ActivityID)) {
$HasPermission = $Session->CheckPermission('Garden.Activity.Delete');
if (!$HasPermission) {
$Activity = $this->ActivityModel->GetID($ActivityID);
$HasPermission = $Activity->InsertUserID == $Session->UserID;
}
if ($HasPermission) {
$this->ActivityModel->Delete($ActivityID);
}
}
if ($this->_DeliveryType === DELIVERY_TYPE_ALL) {
Redirect(GetIncomingValue('Return', Gdn_Url::WebRoot()));
}
$this->ControllerName = 'Home';
$this->View = 'FileNotFound';
$this->Render();
}
示例13: Base_Render_Before
public function Base_Render_Before($Sender)
{
$InDashboard = !($Sender->MasterView == 'default' || $Sender->MasterView == '');
$Sender->AddJsFile('plugins/embedvanilla/local.js');
// Record the remote source using the embed feature.
$RemoteUrl = C('Plugins.EmbedVanilla.RemoteUrl');
if (!$RemoteUrl) {
$RemoteUrl = GetIncomingValue('remote');
if ($RemoteUrl) {
SaveToConfig('Plugins.EmbedVanilla.RemoteUrl', $RemoteUrl);
}
}
// Report the remote url to redirect to if not currently embedded.
$Sender->AddDefinition('RemoteUrl', $RemoteUrl);
if (!IsSearchEngine() && !$InDashboard && C('Plugins.EmbedVanilla.ForceRemoteUrl')) {
$Sender->AddDefinition('ForceRemoteUrl', TRUE);
}
if ($InDashboard) {
$Sender->AddDefinition('InDashboard', C('Plugins.EmbedVanilla.EmbedDashboard'));
}
}
示例14: Delete
public function Delete($DraftID = '', $TransientKey = '')
{
$Form = Gdn::Factory('Form');
$Session = Gdn::Session();
if (is_numeric($DraftID) && $DraftID > 0 && $Session->UserID > 0 && $Session->ValidateTransientKey($TransientKey)) {
$Draft = $this->DraftModel->GetID($DraftID);
if ($Draft && !$this->DraftModel->Delete($DraftID)) {
$Form->AddError('Failed to delete discussion');
}
} else {
$Form->AddError('ErrPermission');
}
// Redirect
if ($this->_DeliveryType === DELIVERY_TYPE_ALL) {
$Target = GetIncomingValue('Target', '/vanilla/drafts');
Redirect($Target);
}
if ($Form->ErrorCount() > 0) {
$this->SetJson('ErrorMessage', $Form->Errors());
}
$this->Render();
}
示例15: Base_Render_Before
public function Base_Render_Before($Sender)
{
// Set P3P header because IE won't allow cookies thru the iFrame without it
$Sender->SetHeader('P3P', 'CP="CAO PSA OUR"');
$InDashboard = !($Sender->MasterView == 'default' || $Sender->MasterView == '');
$Sender->AddJsFile('plugins/embedvanilla/local.js');
// Record the remote source using the embed feature.
$RemoteUrl = C('Plugins.EmbedVanilla.RemoteUrl');
if (!$RemoteUrl) {
$RemoteUrl = GetIncomingValue('remote');
if ($RemoteUrl) {
SaveToConfig('Plugins.EmbedVanilla.RemoteUrl', $RemoteUrl);
}
}
// Report the remote url to redirect to if not currently embedded.
$Sender->AddDefinition('RemoteUrl', $RemoteUrl);
if (!IsSearchEngine() && !$InDashboard && C('Plugins.EmbedVanilla.ForceRemoteUrl')) {
$Sender->AddDefinition('ForceRemoteUrl', TRUE);
}
$Sender->AddDefinition('Path', Gdn::Request()->Path());
if ($InDashboard) {
$Sender->AddDefinition('InDashboard', C('Plugins.EmbedVanilla.EmbedDashboard'));
}
}