本文整理汇总了PHP中GETPOST函数的典型用法代码示例。如果您正苦于以下问题:PHP GETPOST函数的具体用法?PHP GETPOST怎么用?PHP GETPOST使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GETPOST函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doActions
function doActions($parameters, &$object, &$action, $hookmanager)
{
if (GETPOST('addcontratline')) {
$fk_line_contrat_origin = GETPOST('fk_line_contrat_origin', 'int');
if ($fk_line_contrat_origin > 0) {
global $db;
dol_include_once('/contrat/class/contrat.class.php');
$lineContrat = new ContratLigne($db);
$res = $lineContrat->fetch($fk_line_contrat_origin);
if ($res > 0) {
$linePropal = new PropaleLigne($db);
$array_options = array();
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
$extrafields = new ExtraFields($db);
$TExtra = $extrafields->fetch_name_optionals_label($linePropal->table_element);
// Récupération des extrafields de la ligne contrat vers la ligne propal
$lineContrat->fetch_optionals();
foreach ($lineContrat->array_options as $key => $val) {
$subkey = substr($key, 8);
if (isset($TExtra[$subkey])) {
$array_options[$key] = $val;
}
}
if (isset($TExtra['fk_contratdet_origin'])) {
$array_options['options_fk_contratdet_origin'] = $lineContrat->id;
}
$object->addline($lineContrat->description, $lineContrat->subprice, $lineContrat->qty, $lineContrat->tva_tx, $lineContrat->localtax1_tx, $lineContrat->localtax2_tx, $lineContrat->fk_product, $lineContrat->remise_percent, 'HT', 0.0, $lineContrat->info_bits, 1, -1, 0, 0, 0, $lineContrat->pa_ht, '', $lineContrat->date_ouverture_prevue, $lineContrat->date_fin_validite, $array_options, $lineContrat->fk_unit);
}
}
}
}
开发者ID:ATM-Consulting,项目名称:dolibarr_module_contratconcurrent,代码行数:31,代码来源:actions_contratconcurrent.class.php
示例2: _action
function _action()
{
global $user, $db, $conf, $langs;
$action = GETPOST('action', 'alpha');
switch ($action) {
case 'import':
ini_set("auto_detect_line_endings", true);
$TPayment = _parseFile($conf);
_printHeader($langs, $user);
_printFormFile($user, $db, $conf, $langs);
_printFormConfirm($user, $db, $conf, $langs, $TPayment);
_printFooter();
break;
case 'import_confirm':
_setPayment($user, $db, $conf, $langs);
header('Location: ' . dol_buildpath('/paymentimport/card.php', 2));
exit;
break;
default:
_printHeader($langs, $user);
_printFormFile($user, $db, $conf, $langs);
_printErrorFromImportConfirm();
_printFooter();
break;
}
}
示例3: __construct
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $datatoimport String code describing import set (ex: 'societe_1')
*/
function __construct($db, $datatoimport)
{
global $conf, $langs;
$this->db = $db;
$this->separator = GETPOST('separator') ? GETPOST('separator') : (empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE) ? ',' : $conf->global->IMPORT_CSV_SEPARATOR_TO_USE);
$this->enclosure = '"';
$this->escape = '"';
$this->id = 'csv';
// Same value then xxx in file name export_xxx.modules.php
$this->label = 'Csv';
// Label of driver
$this->desc = $langs->trans("CSVFormatDesc", $this->separator, $this->enclosure, $this->escape);
$this->extension = 'csv';
// Extension for generated file by this driver
$this->picto = 'mime/other';
// Picto
$this->version = '1.34';
// Driver version
// If driver use an external library, put its name here
$this->label_lib = 'Dolibarr';
$this->version_lib = DOL_VERSION;
$this->datatoimport = $datatoimport;
if (preg_match('/^societe_/', $datatoimport)) {
$this->thirpartyobject = new Societe($this->db);
}
}
示例4: formObjectOptions
/** Overloading the doActions function : replacing the parent's function with the one below
* @param parameters meta datas of the hook (context, etc...)
* @param object the object you want to process (an invoice if you are in invoice module, a propale in propale's module, etc...)
* @param action current action (if set). Generally create or edit or null
* @return void
*/
function formObjectOptions($parameters, &$object, &$action, $hookmanager)
{
global $langs, $db;
define('INC_FROM_DOLIBARR', true);
dol_include_once("/propalehistory/config.php");
dol_include_once("/comm/propal/class/propal.class.php");
if (in_array('propalcard', explode(':', $parameters['context']))) {
if ($action != 'create' && $action != 'statut' && $action != 'presend') {
dol_include_once("/propalehistory/class/propaleHist.class.php");
$ATMdb = new TPDOdb();
$actionATM = GETPOST('actionATM');
if ($actionATM == 'viewVersion') {
?>
<script type="text/javascript">
$(document).ready(function() {
$('div.tabsAction').html('<?php
echo '<div><a id="returnCurrent" href="' . $_SERVER['PHP_SELF'] . '?id=' . $_REQUEST['id'] . '">Retour version courante</a> <a id="butRestaurer" class="butAction" href="' . DOL_URL_ROOT . '/comm/propal.php?id=' . $_REQUEST['id'] . '&actionATM=restaurer&idVersion=' . $_REQUEST['idVersion'] . '">Restaurer</a><a id="butSupprimer" class="butAction" href="' . DOL_URL_ROOT . '/comm/propal.php?id=' . $_REQUEST['id'] . '&actionATM=supprimer&idVersion=' . $_REQUEST['idVersion'] . '">Supprimer</a></div>';
?>
');
$('#butRestaurer').insertAfter('#voir');
$('#butSupprimer').insertBefore('#voir');
$('#builddoc_form').hide();
})
</script>
<?php
TPropaleHist::listeVersions($db, $object);
} elseif ($actionATM == 'createVersion') {
TPropaleHist::listeVersions($db, $object);
} elseif ($actionATM == '' && $object->statut == 1) {
print '<a id="butNewVersion" class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $_REQUEST['id'] . '&actionATM=createVersion">Archiver</a>';
?>
<script type="text/javascript">
$(document).ready(function() {
$("#butNewVersion").appendTo('div.tabsAction');
})
</script>
<?php
$num = TPropaleHist::listeVersions($db, $object);
} else {
$num = TPropaleHist::listeVersions($db, $object);
}
if (!empty($num)) {
?>
<script type="text/javascript">
$("a#comm").first().append(" / v. <?php
echo $num + 1;
?>
");
console.log($("a#comm").first());
</script>
<?php
}
}
}
return 0;
}
开发者ID:ATM-Consulting,项目名称:dolibarr_module_propalehistory,代码行数:63,代码来源:actions_propalehistory.class.php
示例5: check_user_password_otp
/**
* Check validity of user/password/entity
* If test is ko, reason must be filled into $_SESSION["dol_loginmesg"]
*
* @param string $usertotest Login
* @param string $passwordtotest Password
* @param int $entitytotest Number of instance (always 1 if module multicompany not enabled)
* @return string Login if OK, '' if KO
*/
function check_user_password_otp($usertotest, $passwordtotest, $entitytotest)
{
global $db, $conf, $dolibarr_main_cookie_cryptkey;
dol_include_once('/core/login/functions_dolibarr.php');
//We first check if user & password are OK
if (check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotest) == '') {
return '';
}
// Force master entity in transversal mode
$entity = $entitytotest;
if (!empty($conf->multicompany->enabled) && !empty($conf->multicompany->transverse_mode)) {
$entity = 1;
}
$sql = 'SELECT rowid, otp_seed, otp_counter';
$sql .= ' FROM ' . MAIN_DB_PREFIX . "user";
$sql .= ' WHERE login = "' . $db->escape($usertotest) . '"';
$sql .= ' AND entity IN (0,' . ($entity ? $entity : 1) . ")";
dol_syslog("functions_dolibarr::check_user_password_dolibarr sql=" . $sql);
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
if ($obj) {
//The user has not configured an OTP key
if (!$obj->otp_seed) {
return $usertotest;
}
//Now we validate OTP
$providedOTP = GETPOST('otp');
if (empty($providedOTP)) {
return '';
}
/**
* Examples from http://es.php.net/mcrypt_encrypt
*/
$ciphertext_dec = base64_decode($obj->otp_seed);
$key = pack('H*', $dolibarr_main_cookie_cryptkey);
# recupera la IV, iv_size debería crearse usando mcrypt_get_iv_size()
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC);
$iv_dec = substr($ciphertext_dec, 0, $iv_size);
# recupera el texto cifrado (todo excepto el $iv_size en el frente)
$ciphertext_dec = substr($ciphertext_dec, $iv_size);
# podrían eliminarse los caracteres con valor 00h del final del texto puro
$otpSeed = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $ciphertext_dec, MCRYPT_MODE_CBC, $iv_dec);
$otplib = new \Rych\OTP\HOTP($otpSeed);
if ($otplib->validate($providedOTP, $obj->otp_counter)) {
$obj->otp_counter++;
$sql = "UPDATE " . MAIN_DB_PREFIX . "user SET otp_counter = '" . $obj->otp_counter . "' WHERE rowid = " . $obj->rowid;
$db->query($sql);
// Now the user is authenticated
return $usertotest;
}
}
}
return '';
}
示例6: formObjectOptions
public function formObjectOptions($parameters, &$object, &$action, HookManager $hookManager)
{
global $db, $user, $langs, $mysoc, $dolibarr_main_cookie_cryptkey;
$langs->load('otp@otp');
$regenerate_button = '<form method="post">
<input type="submit" value="' . $langs->trans('OTPRegenerate') . '" class="button" name="regenerate_otp">
</form>';
if ($action == '') {
print '<tr><td>' . $langs->trans('OTPLogin') . '</td><td colspan="2">';
if (GETPOST('regenerate_otp')) {
if ($user->admin || $user->id == GETPOST('id', 'int')) {
/**
* Examples from http://es.php.net/mcrypt_encrypt
*/
// Generates a 20-byte (160-bit) secret key
$otpSeed = Seed::generate();
$base32Seed = $otpSeed->getValue(Seed::FORMAT_BASE32);
$key = pack('H*', $dolibarr_main_cookie_cryptkey);
# crear una aleatoria IV para utilizarla co condificación CBC
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$ciphertext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $base32Seed, MCRYPT_MODE_CBC, $iv);
# anteponer la IV para que esté disponible para el descifrado
$ciphertext = $iv . $ciphertext;
# codificar el texto cifrado resultante para que pueda ser representado por un string
$ciphertext_base64 = base64_encode($ciphertext);
$sql = "UPDATE " . MAIN_DB_PREFIX . "user SET otp_seed = '" . $db->escape($ciphertext_base64) . "', otp_counter = 0 WHERE rowid = " . $user->id;
$db->query($sql);
$qrCode = new QrCode();
$qrCode->setText("otpauth://hotp/" . $mysoc->name . ":" . $user->login . "?secret=" . $base32Seed . "&issuer=" . $mysoc->name);
$qrCode->setSize(96);
$qrCode->setPadding(5);
$img_path = __DIR__ . '/../tmp/' . $user->id . '.png';
$qrCode->save($img_path);
//Qrcode library doesn't warn on image creation error
if (file_exists($img_path)) {
print '<img src="' . dol_buildpath('/otp/showdoc.php', 1) . '?img=' . $user->id . '"><br>' . $langs->trans('OTPTroubleHash') . '<br />
<span style="font-family:monospace;font-size:20px">' . $base32Seed . '</span><br>' . $langs->trans('OTPKeyType');
} else {
print $regenerate_button;
setEventMessage('ErrorCreatingImage', 'errors');
}
}
} else {
if ($user->admin || $user->id == GETPOST('id', 'int')) {
print $regenerate_button;
}
}
print '</td></tr>';
}
}
示例7: _put
function _put($put)
{
$PDOdb = new TPDOdb();
switch ($put) {
case 'view':
$ps = new TPersonnalView();
$ps->loadByElementAction($PDOdb, GETPOST('element'), GETPOST('action'));
$ps->element = GETPOST('element');
$ps->action = GETPOST('action');
$ps->TField = GETPOST('TField', 'array');
echo $ps->save($PDOdb);
break;
}
}
示例8: _get
function _get(&$PDOdb, $get)
{
switch ($get) {
case 'serial_number':
__out(_serial_number($PDOdb, GETPOST('term')), 'json');
break;
case 'autocomplete_asset':
__out(_autocomplete_asset($PDOdb, GETPOST('lot_number'), GETPOST('productid')), 'json');
break;
case 'autocomplete_lot_number':
__out(_autocomplete_lot_number($PDOdb, GETPOST('productid')), 'json');
break;
}
}
示例9: doActions
/**
* Overloading the doActions function : replacing the parent's function with the one below
*
* @param array() $parameters Hook metadatas (context, etc...)
* @param CommonObject &$object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...)
* @param string &$action Current action (if set). Generally create or edit or null
* @param HookManager $hookmanager Hook manager propagated to allow calling another hook
* @return int < 0 on error, 0 on success, 1 to replace standard code
*/
function doActions($parameters, &$object, &$action, $hookmanager)
{
global $user, $conf, $langs, $db;
if ($parameters['currentcontext'] == 'ordersuppliercard' && !empty($conf->fournisseur->enabled) && $object->statut >= 2 && $action == 'billedreception') {
if ($user->rights->fournisseur->facture->creer) {
$datereception = GETPOST('datereception');
if (!empty($datereception)) {
$resultset = $db->query("SELECT fk_commandefourndet,fk_product,SUM(qty) as qty\n\t\t\t\t\tFROM " . MAIN_DB_PREFIX . "commande_fournisseur_dispatch \n\t\t\t\t\tWHERE fk_commande=" . $object->id . "\n\t\t\t\t\tAND datec LIKE '" . date('Y-m-d H', strtotime($datereception)) . "%'\n\t\t\t\t\tGROUP BY fk_commandefourndet,fk_product\n\t\t\t\t\t");
$Tab = array();
while ($obj = $db->fetch_object($resultset)) {
$obj->line = $this->getGoodLine($object, $obj->fk_commandefourndet, $obj->fk_product);
$Tab[] = $obj;
}
$this->createFacture($object, $Tab);
}
}
}
}
开发者ID:ATM-Consulting,项目名称:dolibarr_module_facturerreception,代码行数:27,代码来源:actions_facturerreception.class.php
示例10: _priceUpdateDolibarr
function _priceUpdateDolibarr(&$db, &$conf, &$langs)
{
dol_include_once('/product/class/product.class.php');
$error = 0;
$fk_category = GETPOST('fk_category', 'int');
$tms = dol_mktime(GETPOST('tmshour', 'int'), GETPOST('tmsmin', 'int'), 0, GETPOST('tmsmonth', 'int'), GETPOST('tmsday', 'int'), GETPOST('tmsyear', 'int'));
$percentage = (double) GETPOST('percentage');
if ($fk_category <= -1) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('quickpriceupdate_category_required')), null, 'errors');
$error++;
}
if ($tms == '') {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('quickpriceupdate_date_required')), null, 'errors');
$error++;
}
if (!$error && $percentage != 0) {
$tms = date('Y-m-d H:i:00', $tms);
_priceUpdateDolibarrAction($db, $conf, $langs, $fk_category, $tms, $percentage);
}
}
示例11: doActions
function doActions($parameters, &$object, &$action)
{
global $langs, $user;
$langs->load('resource@resource');
if (in_array('element_resource', explode(':', $parameters['context']))) {
// Efface une ressource
if ($action == 'confirm_delete_resource' && $user->rights->resource->delete && GETPOST('confirm') == 'yes') {
$res = $object->fetch(GETPOST('lineid'));
if ($res) {
$result = $object->delete_resource(GETPOST('lineid'), GETPOST('element'));
if ($result >= 0) {
setEventMessage($langs->trans('RessourceLineSuccessfullyDeleted'));
Header("Location: " . $_SERVER['PHP_SELF'] . "?element=" . GETPOST('element') . "&element_id=" . GETPOST('element_id'));
exit;
} else {
setEventMessage($object->error, 'errors');
}
}
}
// Update ressource
if ($action == 'update_resource' && $user->rights->resource->write && !GETPOST('cancel')) {
$res = $object->fetch(GETPOST('lineid'));
if ($res) {
$object->id = GETPOST('lineid');
$object->busy = GETPOST('busy');
$object->mandatory = GETPOST('mandatory');
$result = $object->update();
if ($result >= 0) {
setEventMessage($langs->trans('RessourceLineSuccessfullyUpdated'));
Header("Location: " . $_SERVER['PHP_SELF'] . "?element=" . GETPOST('element') . "&element_id=" . GETPOST('element_id'));
exit;
} else {
setEventMessage($object->error, 'errors');
}
}
}
}
}
示例12: printingadmin_prepare_head
/**
* Define head array for tabs of printing tools setup pages
*
* @param string $mode Mode
* @return Array of head
*/
function printingadmin_prepare_head($mode)
{
global $langs, $conf;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT . "/printing/admin/printing.php?mode=config";
$head[$h][1] = $langs->trans("ListDrivers");
$head[$h][2] = 'config';
$h++;
if ($mode == 'setup') {
$head[$h][0] = DOL_URL_ROOT . "/printing/admin/printing.php?mode=setup&driver=" . GETPOST('driver', 'alpha');
$head[$h][1] = $langs->trans("SetupDriver");
$head[$h][2] = 'setup';
$h++;
}
if ($mode == 'test') {
$head[$h][0] = DOL_URL_ROOT . "/printing/admin/printing.php?mode=test&driver=" . GETPOST('driver', 'alpha');
$head[$h][1] = $langs->trans("TargetedPrinter");
$head[$h][2] = 'test';
$h++;
}
/** TODO This feature seem to be not ready yet.
$head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=userconf";
$head[$h][1] = $langs->trans("UserConf");
$head[$h][2] = 'userconf';
$h++;
*/
//$object=new stdClass();
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
//complete_head_from_modules($conf,$langs,$object,$head,$h,'printingadmin');
//complete_head_from_modules($conf,$langs,$object,$head,$h,'printing','remove');
return $head;
}
示例13: getOptionalsFromPost
/**
* return array_options array for object by extrafields value (using for data send by forms)
*
* @param array $extralabels $array of extrafields
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
* @return int 1 if array_options set / 0 if no value
*/
function getOptionalsFromPost($extralabels, $keyprefix = '', $keysuffix = '')
{
global $_POST;
$array_options = array();
if (is_array($extralabels)) {
// Get extra fields
foreach ($extralabels as $key => $value) {
$key_type = $this->attribute_type[$key];
if (in_array($key_type, array('date', 'datetime'))) {
// Clean parameters
$value_key = dol_mktime($_POST[$keysuffix . "options_" . $key . $keyprefix . "hour"], $_POST[$keysuffix . "options_" . $key . $keyprefix . "min"], 0, $_POST[$keysuffix . "options_" . $key . $keyprefix . "month"], $_POST[$keysuffix . "options_" . $key . $keyprefix . "day"], $_POST[$keysuffix . "options_" . $key . $keyprefix . "year"]);
} else {
if (in_array($key_type, array('checkbox'))) {
$value_arr = GETPOST($keysuffix . "options_" . $key . $keyprefix);
// Make sure we get an array even if there's only one checkbox
$value_arr = (array) $value_arr;
$value_key = implode(',', $value_arr);
} else {
if (in_array($key_type, array('price', 'double'))) {
$value_arr = GETPOST($keysuffix . "options_" . $key . $keyprefix);
$value_key = price2num($value_arr);
} else {
$value_key = GETPOST($keysuffix . "options_" . $key . $keyprefix);
}
}
}
$array_options[$keysuffix . "options_" . $key] = $value_key;
// No keyprefix here. keyprefix is used only for read.
}
return $array_options;
} else {
return 0;
}
}
示例14: accessforbidden
* \file htdocs/categories/index.php
* \ingroup category
* \brief Home page of category area
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/treeview.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
$langs->load("categories");
if (!$user->rights->categorie->lire) {
accessforbidden();
}
$id = GETPOST('id', 'int');
$type = GETPOST('type') ? GETPOST('type') : Categorie::TYPE_PRODUCT;
$catname = GETPOST('catname', 'alpha');
$section = GETPOST('section') ? GETPOST('section') : 0;
/*
* View
*/
$categstatic = new Categorie($db);
$form = new Form($db);
if ($type == Categorie::TYPE_PRODUCT) {
$title = $langs->trans("ProductsCategoriesArea");
} elseif ($type == Categorie::TYPE_SUPPLIER) {
$title = $langs->trans("SuppliersCategoriesArea");
} elseif ($type == Categorie::TYPE_CUSTOMER) {
$title = $langs->trans("CustomersCategoriesArea");
} elseif ($type == Categorie::TYPE_MEMBER) {
$title = $langs->trans("MembersCategoriesArea");
} elseif ($type == Categorie::TYPE_CONTACT) {
$title = $langs->trans("ContactsCategoriesArea");
示例15: GETPOST
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/societe/note.php
* \brief Tab for notes on third party
* \ingroup societe
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
$action = GETPOST('action');
$langs->load("companies");
// Security check
$id = GETPOST('id') ? GETPOST('id', 'int') : GETPOST('socid', 'int');
if ($user->societe_id) {
$id = $user->societe_id;
}
$result = restrictedArea($user, 'societe', $id, '&societe');
$object = new Societe($db);
if ($id > 0) {
$object->fetch($id);
}
$permissionnote = $user->rights->societe->creer;
// Used by the include of actions_setnotes.inc.php
/*
* Actions
*/
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php';
// Must be include, not includ_once