本文整理汇总了PHP中dolibarr_set_const函数的典型用法代码示例。如果您正苦于以下问题:PHP dolibarr_set_const函数的具体用法?PHP dolibarr_set_const怎么用?PHP dolibarr_set_const使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dolibarr_set_const函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param Conf $conf Handler de conf
* @param Translate $langs Handler de langue
* @param User $user Handler du user connecte
*/
function __construct($db, $conf, $langs, $user)
{
$this->id = "Perso";
$this->length = $langs->trans("SetupPerso");
$this->db = $db;
$this->conf = $conf;
$this->langs = $langs;
$this->user = $user;
if (empty($conf->global->USER_PASSWORD_PATTERN)) {
// default value (8carac, 1maj, 1digit, 1spe, 3 repeat, no ambi at auto generation.
dolibarr_set_const($db, "USER_PASSWORD_PATTERN", '8;1;1;1;3;1', 'chaine', 0, '', $conf->entity);
}
$this->Maj = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$this->Min = strtolower($this->Maj);
$this->Nb = "0123456789";
$this->Spe = "!@#\$%&*()_-+={}[]\\|:;'/";
$this->Ambi = array("1", "I", "l", "|", "O", "0");
$tabConf = explode(";", $conf->global->USER_PASSWORD_PATTERN);
$this->length2 = $tabConf[0];
$this->NbMaj = $tabConf[1];
$this->NbNum = $tabConf[2];
$this->NbSpe = $tabConf[3];
$this->NbRepeat = $tabConf[4];
$this->WithoutAmbi = $tabConf[5];
if ($this->WithoutAmbi) {
$this->Maj = str_replace($this->Ambi, "", $this->Maj);
$this->Min = str_replace($this->Ambi, "", $this->Min);
$this->Nb = str_replace($this->Ambi, "", $this->Nb);
$this->Spe = str_replace($this->Ambi, "", $this->Spe);
}
$this->All = str_shuffle($this->Maj . $this->Min . $this->Nb . $this->Spe);
//$this->All = $this->Maj. $this->Min. $this->Nb. $this->Spe;
//$this->All = $this->Spe;
}
示例2: setVersion
static function setVersion(&$DoliDb, $moduleName)
{
if (class_exists($moduleName)) {
dol_include_once('/core/lib/admin.lib.php');
$mod = new $moduleName($DoliDb);
if (!empty($mod->version)) {
$version = $mod->version;
dolibarr_set_const($DoliDb, 'ATM_MODULE_VERSION_' . strtoupper($moduleName), $version);
}
}
}
示例3: purgeSessions
if (!$sortorder) {
$sortorder = "DESC";
}
if (!$sortfield) {
$sortfield = "dateevent";
}
/*
* Actions
*/
// Purge sessions
if ($action == 'confirm_purge' && $confirm == 'yes' && $user->admin) {
$res = purgeSessions(session_id());
}
// Lock new sessions
if ($action == 'confirm_lock' && $confirm == 'yes' && $user->admin) {
if (dolibarr_set_const($db, 'MAIN_ONLY_LOGIN_ALLOWED', $user->login, 'text', 1, 'Logon is restricted to a particular user', 0) < 0) {
dol_print_error($db);
}
}
// Unlock new sessions
if ($action == 'confirm_unlock' && $user->admin) {
if (dolibarr_del_const($db, 'MAIN_ONLY_LOGIN_ALLOWED', -1) < 0) {
dol_print_error($db);
}
}
/*
* View
*/
llxHeader();
$form = new Form($db);
$userstatic = new User($db);
示例4: init
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options = '')
{
global $db, $conf;
$sql = array();
if (!empty($conf->cashdesk->enabled)) {
if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) {
$res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK", 1, 'chaine', 0, '', $conf->entity);
}
}
return $this->_init($sql, $options);
}
示例5: init
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories.
* @return int 1 if OK, 0 if KO
*/
function init()
{
global $db, $conf, $langs;
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$dirodt = DOL_DATA_ROOT . '/produit';
dol_mkdir($dirodt);
dol_copy(dol_buildpath('/pos/frontend/img/noimage.jpg', 0), $dirodt . '/noimage.jpg', 0, 0);
if (empty($conf->global->POS_TICKET) && empty($conf->global->POS_FACTURE)) {
dolibarr_set_const($db, "POS_FACTURE", '1', 'chaine', 0, '', $conf->entity);
}
if (empty($conf->global->POS_MAX_TTC)) {
dolibarr_set_const($db, "POS_MAX_TTC", '100', 'chaine', 0, '', $conf->entity);
}
$sql = array();
$result = $this->load_tables();
return $this->_init($sql);
}
示例6: setEventMessages
if (!$result > 0) {
$error++;
}
}
if (!$error) {
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null);
} else {
$db->rollback();
dol_print_error($db);
}
$action = '';
}
if ($action == 'setvalue' && $user->admin) {
$db->begin();
$result = dolibarr_set_const($db, $varname, $value, 'chaine', 0, '', $conf->entity);
if (!$result > 0) {
$error++;
}
if (!$error) {
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null);
} else {
$db->rollback();
dol_print_error($db);
}
$action = '';
}
/*
* View
*/
示例7: dol_htmlcleanlastbr
dolibarr_set_const($db, "MAIN_SEARCHFORM_CONTACT", $_POST["MAIN_SEARCHFORM_CONTACT"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_SOCIETE", $_POST["MAIN_SEARCHFORM_SOCIETE"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE",$_POST["MAIN_SEARCHFORM_PRODUITSERVICE"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_ADHERENT",$_POST["MAIN_SEARCHFORM_ADHERENT"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", $_POST["MAIN_HELPCENTER_DISABLELINK"],'chaine',0,'',0); // Param for all entities
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr($_POST["main_home"]),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", $_POST["MAIN_HELP_DISABLELINK"],'chaine',0,'',0); // Param for all entities
dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", $_POST["MAIN_BUGTRACK_ENABLELINK"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", $_POST["MAIN_PROFID1_IN_ADDRESS"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", $_POST["MAIN_PROFID2_IN_ADDRESS"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", $_POST["MAIN_PROFID3_IN_ADDRESS"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", $_POST["MAIN_PROFID4_IN_ADDRESS"],'chaine',0,'',$conf->entity);
$_SESSION["mainmenu"]=""; // Le gestionnaire de menu a pu changer
Header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
exit;
}
/*
* View
*/
$wikihelp='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
llxHeader('',$langs->trans("Setup"),$wikihelp);
示例8: accessforbidden
$langs->load("salaries");
// Security check
if (!$user->admin) {
accessforbidden();
}
$action = GETPOST('action', 'alpha');
// Other parameters SALARIES_*
$list = array('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT', 'SALARIES_ACCOUNTING_ACCOUNT_CHARGE');
/*
* Actions
*/
if ($action == 'update') {
$error = 0;
foreach ($list as $constname) {
$constvalue = GETPOST($constname, 'alpha');
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
/*
* View
*/
llxHeader('', $langs->trans('SalariesSetup'));
$form = new Form($db);
if (!empty($conf->accounting->enabled)) {
示例9: GETPOST
if (!dolibarr_set_const($db, 'LDAP_CONTACT_FIELD_ZIP', GETPOST("fieldzip"), 'chaine', 0, '', $conf->entity)) {
$error++;
}
if (!dolibarr_set_const($db, 'LDAP_CONTACT_FIELD_TOWN', GETPOST("fieldtown"), 'chaine', 0, '', $conf->entity)) {
$error++;
}
if (!dolibarr_set_const($db, 'LDAP_CONTACT_FIELD_COUNTRY', GETPOST("fieldcountry"), 'chaine', 0, '', $conf->entity)) {
$error++;
}
// This one must be after the others
$valkey = '';
$key = GETPOST("key");
if ($key) {
$valkey = $conf->global->{$key};
}
if (!dolibarr_set_const($db, 'LDAP_KEY_CONTACTS', $valkey, 'chaine', 0, '', $conf->entity)) {
$error++;
}
if (!$error) {
$db->commit();
setEventMessage($langs->trans("SetupSaved"));
} else {
$db->rollback();
dol_print_error($db);
}
}
/*
* View
*/
llxHeader('', $langs->trans("LDAPSetup"), 'EN:Module_LDAP_En|FR:Module_LDAP|ES:Módulo_LDAP');
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
示例10: VALUES
*/
}
else
{
// Ajoute boite box_external_rss dans definition des boites
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes_def (file, note)";
$sql.= " VALUES ('box_external_rss.php','".$db->escape($_POST["norss"].' ('.$_POST[$external_rss_title]).")')";
if (! $db->query($sql))
{
dol_print_error($db);
$err++;
}
}
$result1=dolibarr_set_const($db, "EXTERNAL_RSS_TITLE_" . $_POST["norss"],$_POST[$external_rss_title],'chaine',0,'',$conf->entity);
if ($result1) $result2=dolibarr_set_const($db, "EXTERNAL_RSS_URLRSS_" . $_POST["norss"],$_POST[$external_rss_urlrss],'chaine',0,'',$conf->entity);
if ($result1 && $result2)
{
$db->commit();
//$mesg='<div class="ok">'.$langs->trans("Success").'</div>';
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
$db->rollback();
dol_print_error($db);
}
}
}
示例11: while
}
if ($action == "updatename") {
$sql = "SELECT name from " . MAIN_DB_PREFIX . "pos_places_bar where name='{$after}'";
$resql_check = $db->query($sql);
while ($row_check = $db->fetch_array($resql_check)) {
exit;
}
$db->begin();
$db->query("update " . MAIN_DB_PREFIX . "pos_places_bar set name='{$after}' where name='{$place}'");
$db->commit();
}
if ($action == "add") {
$sql = "CREATE TABLE IF NOT EXISTS llx_pos_places_bar\n(\n rowid \tinteger AUTO_INCREMENT PRIMARY KEY,\n\n entity\t\t\t\tinteger DEFAULT 1 \tNOT NULL,\n name\t\t \tvarchar(30) UNIQUE \tNOT NULL,\n description \t\t\ttext,\n terminal \tinteger DEFAULT NULL,\n status\t\t\t \tinteger DEFAULT 1 \tNOT NULL,\n fk_user_c\t\t \tinteger,\n fk_user_m\t\t \tinteger,\n datec\t\t\t\t\tdatetime,\n datea\t\t\t\t\tdatetime,\n left_pos\t\t\t\tfloat,\n top_pos\t\t\t\tfloat,\n zone\t\t\t\t\tint(3)\n \n)ENGINE=innodb;";
$db->query($sql);
$sql = "SELECT name from " . MAIN_DB_PREFIX . "pos_places_bar";
$resql = $db->query($sql);
$data = array();
$i = 0;
while ($row = $db->fetch_array($resql)) {
$data[$i++] = $row[0];
}
$data[$i++] = 0;
$nextplace = max(array_values($data));
$nextplace++;
$db->begin();
$db->query("insert into " . MAIN_DB_PREFIX . "pos_places_bar (name, left_pos, top_pos, zone) values ('{$nextplace}', '25', '25', {$zone})");
$db->commit();
}
if ($action == "updatezonename") {
dolibarr_set_const($db, "DOLIPOSBAR_CUSTOM_ZONE_NAME{$zone}", $after, 'chaine', 0, '', $conf->entity);
}
示例12: GETPOST
if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT') {
$freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT');
// No alpha here, we want exact string
$res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
if (!$error) {
setEventMessage($langs->trans("SetupSaved"));
} else {
setEventMessage($langs->trans("Error"), 'errors');
}
}
//Order display of bank account
if ($action == 'setbankorder') {
if (dolibarr_set_const($db, "BANK_SHOW_ORDER_OPTION", GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity) > 0) {
header("Location: " . $_SERVER["PHP_SELF"]);
exit;
} else {
dol_print_error($db);
}
}
/*
* view
*/
llxHeader("", $langs->trans("BankSetupModule"));
$form = new Form($db);
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
print_fiche_titre($langs->trans("BankSetupModule"), $linkback, 'setup');
print '<br>';
print '<table class="noborder" width="100%">';
示例13: GETPOST
}
$langs->load("admin");
$langs->load("errors");
$action = GETPOST("action");
/*
* Actions
*/
if ($action == 'set') {
$error = 0;
$gimcdf = GETPOST("GEOIPMAXMIND_COUNTRY_DATAFILE");
if (!$gimcdf && !file_exists($gimcdf)) {
setEventMessage($langs->trans("ErrorFileNotFound", $gimcdf), 'errors');
$error++;
}
if (!$error) {
$res = dolibarr_set_const($db, "GEOIPMAXMIND_COUNTRY_DATAFILE", $gimcdf, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
if (!$error) {
setEventMessage($langs->trans("SetupSaved"));
} else {
setEventMessage($langs->trans("Error"), 'errors');
}
}
}
/*
* View
*/
$form = new Form($db);
llxHeader();
示例14: Header
if (preg_match('/del_(.*)/', $action, $reg)) {
$code = $reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0) {
Header("Location: " . $_SERVER["PHP_SELF"]);
exit;
} else {
dol_print_error($db);
}
} else {
if ($action == 'updateform') {
$res1 = dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", $_POST["MAIN_APPLICATION_TITLE"], 'chaine', 0, '', $conf->entity);
$res2 = dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"], 'chaine', 0, '', $conf->entity);
$res3 = dolibarr_set_const($db, 'MAIN_UPLOAD_DOC', $_POST["MAIN_UPLOAD_DOC"], 'chaine', 0, '', $conf->entity);
$res4 = dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"], 'chaine', 0, '', $conf->entity);
$res5 = dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"], 'chaine', 0, '', $conf->entity);
$res6 = dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"], 'chaine', 0, '', $conf->entity);
if ($res1 && $res2 && $res3 && $res4 && $res5 && $res6) {
setEventMessage($langs->trans("RecordModifiedSuccessfully"));
}
} else {
if ($action == 'delete') {
$langs->load("other");
$file = $conf->admin->dir_temp . '/' . GETPOST('urlfile');
// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$ret = dol_delete_file($file);
if ($ret) {
setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
} else {
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
}
Header('Location: ' . $_SERVER["PHP_SELF"]);
示例15: GETPOST
} else {
if ($action == 'setart238') {
$setart238 = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "DONATION_ART238", $setart238, 'yesno', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
if (!$error) {
setEventMessage($langs->trans("SetupSaved"), 'mesgs');
} else {
setEventMessage($langs->trans("Error"), 'mesgs');
}
} else {
if ($action == 'setart885') {
$setart885 = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "DONATION_ART885", $setart885, 'yesno', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
if (!$error) {
setEventMessage($langs->trans("SetupSaved"), 'mesgs');
} else {
setEventMessage($langs->trans("Error"), 'mesgs');
}
}
}
}
}
/*
* View
*/