本文整理汇总了PHP中Toolbox::get_max_input_vars方法的典型用法代码示例。如果您正苦于以下问题:PHP Toolbox::get_max_input_vars方法的具体用法?PHP Toolbox::get_max_input_vars怎么用?PHP Toolbox::get_max_input_vars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Toolbox
的用法示例。
在下文中一共展示了Toolbox::get_max_input_vars方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: call
/**
* parse POST var to retrieve
* - Resource
* - Identifier
* - and parameters
*
* And send to method corresponding identified resource
*
* @since version 9.1
*
* @return xmlrpc response
*/
public function call()
{
$resource = $this->parseIncomingParams();
// retrieve session (if exist)
$this->retrieveSession();
$code = 200;
if ($resource === "initSession") {
$this->session_write = true;
return $this->returnResponse($this->initSession($this->parameters));
} else {
if ($resource === "killSession") {
// logout from glpi
$this->session_write = true;
return $this->returnResponse($this->killSession());
} else {
if ($resource === "changeActiveEntities") {
// change active entities
$this->session_write = true;
return $this->returnResponse($this->changeActiveEntities($this->parameters));
} else {
if ($resource === "getMyEntities") {
// get all entities of logged user
return $this->returnResponse($this->getMyEntities($this->parameters));
} else {
if ($resource === "getActiveEntities") {
// get curent active entity
return $this->returnResponse($this->getActiveEntities($this->parameters));
} else {
if ($resource === "changeActiveProfile") {
// change active profile
$this->session_write = true;
return $this->returnResponse($this->changeActiveProfile($this->parameters));
} else {
if ($resource === "getMyProfiles") {
// get all profiles of current logged user
return $this->returnResponse($this->getMyProfiles($this->parameters));
} else {
if ($resource === "getActiveProfile") {
// get current active profile
return $this->returnResponse($this->getActiveProfile($this->parameters));
} else {
if ($resource === "getFullSession") {
// get complete php session
return $this->returnResponse($this->getFullSession($this->parameters));
} else {
if ($resource === "getGlpiConfig") {
// get complete php var $CFG_GLPI
return $this->returnResponse($this->getGlpiConfig($this->parameters));
} else {
if ($resource === "getMultipleItems") {
// get multiple items (with various itemtype)
return $this->returnResponse($this->getMultipleItems($this->parameters));
} else {
if ($resource === "listSearchOptions") {
// list searchOptions of an itemtype
return $this->returnResponse($this->listSearchOptions($this->parameters['itemtype'], $this->parameters));
} else {
if ($resource === "search") {
// Search on itemtype
self::checkSessionToken();
//search
$response = $this->searchItems($this->parameters['itemtype'], $this->parameters);
//add pagination headers
$additionalheaders = array();
$additionalheaders["Content-Range"] = $response['content-range'];
$additionalheaders["Accept-Range"] = $this->parameters['itemtype'] . " " . Toolbox::get_max_input_vars();
// diffent http return codes for complete or partial response
if ($response['count'] < $response['totalcount']) {
$code = 206;
// partial content
}
return $this->returnResponse($response, $code, $additionalheaders);
} else {
if (in_array($resource, array("getItem", "getItems", "createItems", "updateItems", "deleteItems"))) {
// commonDBTM manipulation
// check itemtype parameter
if (!isset($this->parameters['itemtype'])) {
$this->returnError(__("missing itemtype"), 400, "ITEMTYPE_RESOURCE_MISSING");
}
if (!class_exists($this->parameters['itemtype']) || !is_subclass_of($this->parameters['itemtype'], 'CommonDBTM') && $this->parameters['itemtype'] != "AllAssets") {
$this->returnError(__("itemtype not found or not an instance of CommonDBTM"), 400, "ERROR_ITEMTYPE_NOT_FOUND_NOR_COMMONDBTM");
} else {
// get an CommonDBTM item
if ($resource === "getItem") {
// check id parameter
if (!isset($this->parameters['id'])) {
$this->returnError(__("missing id"), 400, "ID_RESOURCE_MISSING");
}
//.........这里部分代码省略.........
示例2: showMassiveActions
/**
* Display massive actions
*
* @since 0.84 (before Search::displayMassiveActions)
* @since version 0.85 only 1 parameter (in 0.84 $itemtype required)
*
* @todo replace 'hidden' by data-glpicore-ma-tags ?
*
* @param $options array of parameters
* must contains :
* - container : DOM ID of the container of the item checkboxes (since version 0.85)
* may contains :
* - num_displayed : integer number of displayed items. Permit to check suhosin limit. (default -1 not to check)
* - ontop : boolean true if displayed on top (default true)
* - fixed : boolean true if used with fixed table display (default true)
* - forcecreate : boolean force creation of modal window (default = false).
* Modal is automatically created when displayed the ontop item.
* If only a bottom one is displayed use it
* - check_itemtype : string alternate itemtype to check right if different from main itemtype (default empty)
* - check_items_id : integer ID of the alternate item used to check right / optional (default empty)
* - is_deleted : boolean is massive actions for deleted items ?
* - extraparams : string extra URL parameters to pass to massive actions (default empty)
* if ([extraparams]['hidden'] is set : add hidden fields to post)
* - specific_actions : array of specific actions (do not use standard one)
* - add_actions : array of actions to add (do not use standard one)
* - confirm : string of confirm message before massive action
* - item : CommonDBTM object that has to be passed to the actions
* - tag_to_send : the tag of the elements to send to the ajax window (default: common)
*
* @return nothing
**/
static function showMassiveActions($options = array())
{
global $CFG_GLPI;
/// TODO : permit to pass several itemtypes to show possible actions of all types : need to clean visibility management after
$p['ontop'] = true;
$p['num_displayed'] = -1;
$p['fixed'] = true;
$p['forcecreate'] = false;
$p['check_itemtype'] = '';
$p['check_items_id'] = '';
$p['is_deleted'] = false;
$p['extraparams'] = array();
$p['width'] = 800;
$p['height'] = 400;
$p['specific_actions'] = array();
$p['add_actions'] = array();
$p['confirm'] = '';
$p['rand'] = '';
$p['container'] = '';
$p['display_arrow'] = true;
$p['title'] = _n('Action', 'Actions', Session::getPluralNumber());
$p['item'] = false;
$p['tag_to_send'] = 'common';
foreach ($options as $key => $val) {
if (isset($p[$key])) {
$p[$key] = $val;
}
}
$url = $CFG_GLPI['root_doc'] . "/ajax/massiveaction.php";
if ($p['container']) {
$p['extraparams']['container'] = $p['container'];
}
if ($p['is_deleted']) {
$p['extraparams']['is_deleted'] = 1;
}
if (!empty($p['check_itemtype'])) {
$p['extraparams']['check_itemtype'] = $p['check_itemtype'];
}
if (!empty($p['check_items_id'])) {
$p['extraparams']['check_items_id'] = $p['check_items_id'];
}
if (is_array($p['specific_actions']) && count($p['specific_actions'])) {
$p['extraparams']['specific_actions'] = $p['specific_actions'];
}
if (is_array($p['add_actions']) && count($p['add_actions'])) {
$p['extraparams']['add_actions'] = $p['add_actions'];
}
if ($p['item'] instanceof CommonDBTM) {
$p['extraparams']['item_itemtype'] = $p['item']->getType();
$p['extraparams']['item_items_id'] = $p['item']->getID();
}
// Manage modal window
if (isset($_REQUEST['_is_modal']) && $_REQUEST['_is_modal']) {
$p['extraparams']['hidden']['_is_modal'] = 1;
}
if ($p['fixed']) {
$width = '950px';
} else {
$width = '95%';
}
$identifier = md5($url . serialize($p['extraparams']) . $p['rand']);
$max = Toolbox::get_max_input_vars();
if ($p['num_displayed'] >= 0 && $max > 0 && $max < $p['num_displayed'] + 10) {
if (!$p['ontop'] || isset($p['forcecreate']) && $p['forcecreate']) {
echo "<table class='tab_cadre' width='{$width}'><tr class='tab_bg_1'>" . "<td><span class='b'>";
echo __('Selection too large, massive action disabled.') . "</span>";
if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) {
echo "<br>" . __('To increase the limit: change max_input_vars or suhosin.post.max_vars in php configuration.');
}
//.........这里部分代码省略.........
示例3: call
//.........这里部分代码省略.........
} else {
if ($resource === "getActiveProfile") {
// get current active profile
return $this->returnResponse($this->getActiveProfile($this->parameters));
} else {
if ($resource === "getFullSession") {
// get complete php session
return $this->returnResponse($this->getFullSession($this->parameters));
} else {
if ($resource === "getGlpiConfig") {
// get complete php var $CFG_GLPI
return $this->returnResponse($this->getGlpiConfig($this->parameters));
} else {
if ($resource === "listSearchOptions") {
// list searchOptions of an itemtype
$itemtype = $this->getItemtype(1);
return $this->returnResponse($this->listSearchOptions($itemtype, $this->parameters));
} else {
if ($resource === "getMultipleItems") {
// get multiple items (with various itemtype)
return $this->returnResponse($this->getMultipleItems($this->parameters));
} else {
if ($resource === "search") {
// Search on itemtype
self::checkSessionToken();
$itemtype = $this->getItemtype(1, true, true);
//clean stdObjects in parameter
$params = json_decode(json_encode($this->parameters), true);
//search
$response = $this->searchItems($itemtype, $params);
//add pagination headers
$additionalheaders = array();
$additionalheaders["Content-Range"] = $response['content-range'];
$additionalheaders["Accept-Range"] = $itemtype . " " . Toolbox::get_max_input_vars();
// diffent http return codes for complete or partial response
if ($response['count'] >= $response['totalcount']) {
$code = 200;
// full content
} else {
$code = 206;
// partial content
}
return $this->returnResponse($response, $code, $additionalheaders);
} else {
// commonDBTM manipulation
$itemtype = $this->getItemtype(0);
$id = $this->getId();
$additionalheaders = array();
$code = 200;
switch ($this->verb) {
default:
case "GET":
// retrieve item(s)
if ($id > 0 || $id == 0 && $itemtype == "Entity") {
$response = $this->getItem($itemtype, $id, $this->parameters);
if (isset($response['date_mod'])) {
$datemod = strtotime($response['date_mod']);
$additionalheaders['Last-Modified'] = gmdate("D, d M Y H:i:s", $datemod) . " GMT";
}
} else {
// return collection of items
$totalcount = 0;
$response = $this->getItems($itemtype, $this->parameters, $totalcount);
//add pagination headers
$range = [0, $_SESSION['glpilist_limit']];
if (isset($this->parameters['range'])) {
示例4: showMassiveActions
/**
* Display massive actions
*
* @since 0.84 (before Search::displayMassiveActions)
*
* @param $itemtype string itemtype for massive actions
* @param $options array of parameters
* may contains :
* - num_displayed : integer number of displayed items. Permit to check suhosin limit. (default -1 not to check)
* - ontop : boolean true if displayed on top (default true)
* - fixed : boolean true if used with fixed table display (default true)
* - forcecreate : boolean force creation of modal window (default = false).
* Modal is automatically created when displayed the ontop item.
* If only a bottom one is displayed use it
* - check_itemtype : string alternate itemtype to check right if different from main itemtype (default empty)
* - check_items_id : integer ID of the alternate item used to check right / optional (default empty)
* - is_deleted : boolean is massive actions for deleted items ?
* - extraparams : string extra URL parameters to pass to massive actions (default empty)
* - specific_actions : array of specific actions (do not use standard one)
* - confirm : string of confirm message before massive action
*
* @return nothing
**/
static function showMassiveActions($itemtype, $options = array())
{
global $CFG_GLPI;
$p['ontop'] = true;
$p['num_displayed'] = -1;
$p['fixed'] = true;
$p['forcecreate'] = false;
$p['check_itemtype'] = '';
$p['check_items_id'] = '';
$p['is_deleted'] = false;
$p['extraparams'] = array();
$p['width'] = 800;
$p['height'] = 400;
$p['specific_actions'] = array();
$p['confirm'] = '';
$p['rand'] = '';
foreach ($options as $key => $val) {
if (isset($p[$key])) {
$p[$key] = $val;
}
}
$p['extraparams']['itemtype'] = $itemtype;
$url = $CFG_GLPI['root_doc'] . "/ajax/massiveaction.php";
if ($p['is_deleted']) {
$p['extraparams']['is_deleted'] = 1;
}
if (!empty($p['check_itemtype'])) {
$p['extraparams']['check_itemtype'] = $p['check_itemtype'];
}
if (!empty($p['check_items_id'])) {
$p['extraparams']['check_items_id'] = $p['check_items_id'];
}
if (is_array($p['specific_actions']) && count($p['specific_actions'])) {
$p['extraparams']['specific_actions'] = $p['specific_actions'];
}
if ($p['fixed']) {
$width = '950px';
} else {
$width = '80%';
}
$identifier = md5($url . $itemtype . serialize($p['extraparams']) . $p['rand']);
$max = Toolbox::get_max_input_vars();
if ($p['num_displayed'] >= 0 && $max > 0 && $max < $p['num_displayed'] + 10) {
if (!$p['ontop'] || isset($p['forcecreate']) && $p['forcecreate']) {
echo "<table class='tab_cadre' width='{$width}'><tr class='tab_bg_1'>" . "<td><span class='b'>";
echo __('Selection too large, massive action disabled.') . "</span>";
if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) {
echo "<br>" . __('To increase the limit: change max_input_vars or suhosin.post.max_vars in php configuration.');
}
echo "</td></tr></table>";
}
} else {
// Create Modal window on top
if ($p['ontop'] || isset($p['forcecreate']) && $p['forcecreate']) {
echo "<div id='massiveactioncontent{$identifier}'></div>";
// echo "<script type='text/javascript' >\n";
// echo "Ext.DomHelper.append(document.body, {tag: 'div', id: 'massiveactioncontent$identifier'});";
// echo "</script>";
Ajax::createModalWindow('massiveaction_window' . $identifier, $url, array('title' => _n('Action', 'Actions', 2), 'container' => 'massiveactioncontent' . $identifier, 'extraparams' => $p['extraparams'], 'width' => $p['width'], 'height' => $p['height']));
}
echo "<table class='tab_glpi' width='{$width}'><tr>";
echo "<td width='30px'><img src='" . $CFG_GLPI["root_doc"] . "/pics/arrow-left" . ($p['ontop'] ? '-top' : '') . ".png' alt=''></td>";
echo "<td width='100%' class='left'>";
echo "<a class='vsubmit' ";
if (is_array($p['confirm'] || strlen($p['confirm']))) {
echo self::addConfirmationOnAction($p['confirm'], "massiveaction_window{$identifier}.show();");
} else {
echo "onclick='massiveaction_window{$identifier}.show();'";
}
echo "href='#modal_massaction_content{$identifier}' title=\"" . _sn('Action', 'Actions', 2) . "\">";
echo _n('Action', 'Actions', 2) . "</a>";
echo "</td>";
echo "</tr></table>";
if (!$p['ontop'] || isset($p['forcecreate']) && $p['forcecreate']) {
// Clean selection
$_SESSION['glpimassiveactionselected'][$itemtype] = array();
}
//.........这里部分代码省略.........
示例5: showListLimit
/**
* show dropdown to select list limit
*
* @since version 0.83
*
* @param $onchange String optional, for ajax (default '')
**/
static function showListLimit($onchange = '')
{
global $CFG_GLPI;
if (isset($_SESSION['glpilist_limit'])) {
$list_limit = $_SESSION['glpilist_limit'];
} else {
$list_limit = $CFG_GLPI['list_limit'];
}
$values = array();
for ($i = 5; $i < 20; $i += 5) {
$values[$i] = $i;
}
for ($i = 20; $i < 50; $i += 10) {
$values[$i] = $i;
}
for ($i = 50; $i < 250; $i += 50) {
$values[$i] = $i;
}
for ($i = 250; $i < 1000; $i += 250) {
$values[$i] = $i;
}
for ($i = 1000; $i < 5000; $i += 1000) {
$values[$i] = $i;
}
for ($i = 5000; $i <= 10000; $i += 5000) {
$values[$i] = $i;
}
$values[9999999] = 9999999;
// Propose max input vars -10
$max = Toolbox::get_max_input_vars();
if ($max > 10) {
$values[$max - 10] = $max - 10;
}
ksort($values);
return self::showFromArray('glpilist_limit', $values, array('on_change' => $onchange, 'value' => $list_limit));
}
示例6: showListLimit
/**
* show dropdown to select list limit
*
* @since version 0.83
*
* @param $onchange String optional, for ajax (default '')
**/
static function showListLimit($onchange = '')
{
global $CFG_GLPI;
echo "<select name='glpilist_limit'";
if ($onchange) {
echo " onChange='{$onchange}'>";
} else {
echo ">";
}
if (isset($_SESSION['glpilist_limit'])) {
$list_limit = $_SESSION['glpilist_limit'];
} else {
$list_limit = $CFG_GLPI['list_limit'];
}
$values = array();
for ($i = 5; $i < 20; $i += 5) {
$values[$i] = $i;
}
for ($i = 20; $i < 50; $i += 10) {
$values[$i] = $i;
}
for ($i = 50; $i < 250; $i += 50) {
$values[$i] = $i;
}
for ($i = 250; $i < 1000; $i += 250) {
$values[$i] = $i;
}
for ($i = 1000; $i < 5000; $i += 1000) {
$values[$i] = $i;
}
for ($i = 5000; $i <= 10000; $i += 5000) {
$values[$i] = $i;
}
$values[9999999] = 9999999;
// Propose max input vars -10
$max = Toolbox::get_max_input_vars();
if ($max > 10) {
$values[$max - 10] = $max - 10;
}
ksort($values);
foreach ($values as $val) {
echo "<option value='{$val}' " . ($list_limit == $val ? " selected " : "") . ">{$val}</option>";
}
echo "</select>";
}
示例7: seePreImport
//.........这里部分代码省略.........
}
//////////////////////HEADER///////////////
if ($output_type == Search::HTML_OUTPUT) {
echo "<form method='post' name='massiveaction_form' id='massiveaction_form' action=\"../ajax/massiveaction.php\">";
}
//echo Search::displaySearchHeader($output_type,0); //table + div
if ($canedit) {
$nbcols = 11 + $colsup;
} else {
$nbcols = 10 + $colsup;
}
$LIST_LIMIT = $_SESSION['glpilist_limit'];
$begin_display = $p['start'];
$end_display = $p['start'] + $LIST_LIMIT;
foreach ($toview as $key => $val) {
$linkto = '';
if (!isset($searchopt["PluginManufacturersimportsPreImport"][$val]['nosort']) || !$searchopt["PluginManufacturersimportsPreImport"][$val]['nosort']) {
$linkto = "{$target}?itemtype=" . $p['itemtype'] . "&manufacturers_id=" . $p['manufacturers_id'] . "&imported=" . $p['imported'] . "&sort=" . $val . "&order=" . ($p['order'] == "ASC" ? "DESC" : "ASC") . "&start=" . $p['start'] . $globallinkto;
}
}
echo Search::showHeader($output_type, $end_display - $begin_display + 1, $nbcols);
echo Search::showNewLine($output_type);
$header_num = 1;
echo Search::showHeaderItem($output_type, "", $header_num);
echo Search::showHeaderItem($output_type, __('Name'), $header_num, $linkto, $p['sort'] == $val, $p['order']);
if (Session::isMultiEntitiesMode()) {
echo Search::showHeaderItem($output_type, __('Entity'), $header_num);
}
echo Search::showHeaderItem($output_type, __('Serial number'), $header_num);
echo $supplier->showItemTitle($output_type, $header_num);
echo Search::showHeaderItem($output_type, __('Financial and administrative information'), $header_num);
echo Search::showHeaderItem($output_type, __('Supplier attached', 'manufacturersimports'), $header_num);
echo Search::showHeaderItem($output_type, __('New warranty attached', 'manufacturersimports'), $header_num);
echo Search::showHeaderItem($output_type, _n('Link', 'Links', 1), $header_num);
echo Search::showHeaderItem($output_type, _n('Status', 'Statuses', 1), $header_num);
echo $supplier->showDocTitle($output_type, $header_num);
// End Line for column headers
echo Search::showEndLine($output_type);
$i = $p['start'];
if (isset($_GET['export_all'])) {
$i = 0;
}
if ($i > 0) {
$DB->data_seek($result, $i);
}
$row_num = 1;
while ($i < $numrows && $i < $end_display) {
$i++;
$item_num = 1;
$line = $DB->fetch_array($result);
$compSerial = $line['serial'];
$compId = $line['id'];
$model = $line["model_name"];
if (!$line["itemtype"]) {
$line["itemtype"] = $p['itemtype'];
}
self::showImport($row_num, $item_num, $line, $output_type, $p['manufacturers_id'], $line["import_status"], $p['imported']);
//1.show already imported items && import_status not failed
if ($p['imported'] == 1) {
$total += 1;
}
}
echo "<tr class='tab_bg_1'><td colspan='" . ($canedit ? 11 + $colsup : 10 + $colsup) . "'>";
echo sprintf(__('Total number of devices to import %s', 'manufacturersimports'), $total);
echo "</td></tr>";
// Close Table
$title = "";
// Create title
if ($output_type == Search::PDF_OUTPUT_PORTRAIT || $output_type == Search::PDF_OUTPUT_LANDSCAPE) {
$title .= PluginManufacturersimportsPreImport::getTypeName(2) . " " . $suppliername;
}
echo Search::showFooter($output_type, $title);
//massive action
if ($canedit && $output_type == Search::HTML_OUTPUT) {
if ($_SESSION['glpilist_limit'] < Toolbox::get_max_input_vars()) {
Html::openArrowMassives("massiveaction_form", false);
self::dropdownMassiveAction($compId, $p['itemtype'], $p['manufacturers_id'], $p['start'], $p['imported']);
Html::closeArrowMassives(array());
} else {
echo "<table class='tab_cadre' width='80%'><tr class='tab_bg_1'>" . "<td><span class='b'>";
echo __('Selection too large, massive action disabled.') . "</span>";
if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) {
echo "<br>" . __('To increase the limit: change max_input_vars or suhosin.post.max_vars in php configuration.');
}
echo "</td></tr></table>";
}
Html::closeForm();
} else {
echo "</table>";
echo "</div>";
}
echo "<br>";
if ($output_type == Search::HTML_OUTPUT) {
self::printPager($p['start'], $numrows, $target, $parameters, $p['itemtype']);
}
} else {
echo "<div align='center'><b>" . __('No device finded', 'manufacturersimports') . "</b></div>";
}
}
}