本文整理汇总了PHP中dol_htmlcleanlastbr函数的典型用法代码示例。如果您正苦于以下问题:PHP dol_htmlcleanlastbr函数的具体用法?PHP dol_htmlcleanlastbr怎么用?PHP dol_htmlcleanlastbr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dol_htmlcleanlastbr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dol_loginfunction
//.........这里部分代码省略.........
$sessiontimeout = 'DOLSESSTIMEOUT_' . $prefix;
if (!empty($conf->global->MAIN_SESSION_TIMEOUT)) {
setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", '', 0);
}
if (GETPOST('urlfrom', 'alpha')) {
$_SESSION["urlfrom"] = GETPOST('urlfrom', 'alpha');
} else {
unset($_SESSION["urlfrom"]);
}
if (!GETPOST("username")) {
$focus_element = 'username';
} else {
$focus_element = 'password';
}
$login_background = DOL_URL_ROOT . '/theme/login_background.png';
if (file_exists(DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/img/login_background.png')) {
$login_background = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/login_background.png';
}
$demologin = '';
$demopassword = '';
if (!empty($dolibarr_main_demo)) {
$tab = explode(',', $dolibarr_main_demo);
$demologin = $tab[0];
$demopassword = $tab[1];
}
// Execute hook getLoginPageOptions
// Should be an array with differents options in $hookmanager->resArray
$parameters = array('entity' => GETPOST('entity', 'int'));
$hookmanager->executeHooks('getLoginPageOptions', $parameters);
// Note that $action and $object may have been modified by some hooks
// Login
$login = !empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username", "alpha") ? GETPOST("username", "alpha") : $demologin);
$password = $demopassword;
// Show logo (search in order: small company logo, large company logo, theme logo, common logo)
$width = 0;
$urllogo = DOL_URL_ROOT . '/theme/login_logo.png';
if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small)) {
$urllogo = DOL_URL_ROOT . '/viewimage.php?cache=1&modulepart=companylogo&file=' . urlencode('thumbs/' . $mysoc->logo_small);
} elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output . '/logos/' . $mysoc->logo)) {
$urllogo = DOL_URL_ROOT . '/viewimage.php?cache=1&modulepart=companylogo&file=' . urlencode($mysoc->logo);
$width = 128;
} elseif (is_readable(DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/img/dolibarr_logo.png')) {
$urllogo = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/dolibarr_logo.png';
} elseif (is_readable(DOL_DOCUMENT_ROOT . '/theme/dolibarr_logo.png')) {
$urllogo = DOL_URL_ROOT . '/theme/dolibarr_logo.png';
}
// Security graphical code
$captcha = 0;
$captcha_refresh = '';
if (function_exists("imagecreatefrompng") && !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) {
$captcha = 1;
$captcha_refresh = img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"');
}
// Extra link
$forgetpasslink = 0;
$helpcenterlink = 0;
if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK) || empty($conf->global->MAIN_HELPCENTER_DISABLELINK)) {
if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) {
$forgetpasslink = 1;
}
if (empty($conf->global->MAIN_HELPCENTER_DISABLELINK)) {
$helpcenterlink = 1;
}
}
// Home message
$main_home = '';
if (!empty($conf->global->MAIN_HOME)) {
$i = 0;
while (preg_match('/__\\(([a-zA-Z|@]+)\\)__/i', $conf->global->MAIN_HOME, $reg) && $i < 100) {
$tmp = explode('|', $reg[1]);
if (!empty($tmp[1])) {
$langs->load($tmp[1]);
}
$conf->global->MAIN_HOME = preg_replace('/__\\(' . preg_quote($reg[1]) . '\\)__/i', $langs->trans($tmp[0]), $conf->global->MAIN_HOME);
$i++;
}
$main_home = dol_htmlcleanlastbr($conf->global->MAIN_HOME);
}
// Google AD
$main_google_ad_client = !empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT) ? 1 : 0;
// Set jquery theme
$dol_loginmesg = !empty($_SESSION["dol_loginmesg"]) ? $_SESSION["dol_loginmesg"] : '';
$favicon = dol_buildpath('/theme/' . $conf->theme . '/img/favicon.ico', 1);
if (!empty($conf->global->MAIN_FAVICON_URL)) {
$favicon = $conf->global->MAIN_FAVICON_URL;
}
$jquerytheme = 'smoothness';
if (!empty($conf->global->MAIN_USE_JQUERY_THEME)) {
$jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
}
// Set dol_hide_topmenu, dol_hide_leftmenu, dol_optimize_smallscreen, dol_nomousehover
$dol_hide_topmenu = GETPOST('dol_hide_topmenu', 'int');
$dol_hide_leftmenu = GETPOST('dol_hide_leftmenu', 'int');
$dol_optimize_smallscreen = GETPOST('dol_optimize_smallscreen', 'int');
$dol_no_mouse_hover = GETPOST('dol_no_mouse_hover', 'int');
$dol_use_jmobile = GETPOST('dol_use_jmobile', 'int');
// Include login page template
include $template_dir . 'login.tpl.php';
$_SESSION["dol_loginmesg"] = '';
}
示例2: getSupplierInvoicesForThirdParty
/**
* Get list of invoices for third party
*
* @param array $authentication Array of authentication information
* @param int $idthirdparty Id thirdparty
* @return array Array result
*
*/
function getSupplierInvoicesForThirdParty($authentication,$idthirdparty)
{
global $db,$conf,$langs;
dol_syslog("Function: getSupplierInvoicesForThirdParty login=".$authentication['login']." idthirdparty=".$idthirdparty);
if ($authentication['entity']) $conf->entity=$authentication['entity'];
// Init and check authentication
$objectresp=array();
$errorcode='';$errorlabel='';
$error=0;
$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
// Check parameters
if (! $error && empty($idthirdparty))
{
$error++;
$errorcode='BAD_PARAMETERS'; $errorlabel='Parameter id is not provided';
}
if (! $error)
{
$linesinvoice=array();
$sql.='SELECT f.rowid as facid';
$sql.=' FROM '.MAIN_DB_PREFIX.'facture_fourn as f';
//$sql.=', '.MAIN_DB_PREFIX.'societe as s';
//$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product = p.rowid';
//$sql.=" WHERE f.fk_soc = s.rowid AND nom = '".$db->escape($idthirdparty)."'";
//$sql.=" WHERE f.fk_soc = s.rowid AND nom = '".$db->escape($idthirdparty)."'";
$sql.=" WHERE f.entity = ".$conf->entity;
if ($idthirdparty != 'all') $sql.=" AND f.fk_soc = ".$db->escape($idthirdparty);
$resql=$db->query($sql);
if ($resql)
{
$num=$db->num_rows($resql);
$i=0;
while ($i < $num)
{
// En attendant remplissage par boucle
$obj=$db->fetch_object($resql);
$invoice=new FactureFournisseur($db);
$invoice->fetch($obj->facid);
// Define lines of invoice
$linesresp=array();
foreach($invoice->lines as $line)
{
$linesresp[]=array(
'id'=>$line->rowid,
'type'=>$line->product_type,
'desc'=>dol_htmlcleanlastbr($line->description),
'total_net'=>$line->total_ht,
'total_vat'=>$line->total_tva,
'total'=>$line->total_ttc,
'vat_rate'=>$line->tva_tx,
'qty'=>$line->qty,
'product_ref'=>$line->product_ref,
'product_label'=>$line->product_label,
'product_desc'=>$line->product_desc,
);
}
// Now define invoice
$linesinvoice[]=array(
'id'=>$invoice->id,
'ref'=>$invoice->ref,
'ref_supplier'=>$invoice->ref_supplier,
'ref_ext'=>$invoice->ref_ext,
'fk_user_author' => $invoice->fk_user_author,
'fk_user_valid' => $invoice->fk_user_valid,
'fk_thirdparty' => $invoice->fk_soc,
'type'=>$invoice->type,
'status'=>$invoice->statut,
'total_net'=>$invoice->total_ht,
'total_vat'=>$invoice->total_tva,
'total'=>$invoice->total_ttc,
'date_creation'=>dol_print_date($invoice->datec,'dayhourrfc'),
'date_modification'=>dol_print_date($invoice->tms,'dayhourrfc'),
'date_invoice'=>dol_print_date($invoice->date,'dayhourrfc'),
'date_term'=>dol_print_date($invoice->date_echeance,'dayhourrfc'),
'label'=>$invoice->libelle,
'paid'=>$invoice->paye,
'note'=>$invoice->note,
'note_public'=>$invoice->note_public,
'close_code'=>$invoice->close_code,
'close_note'=>$invoice->close_note,
'lines' => $linesresp
);
//.........这里部分代码省略.........
示例3: GETPOST
$action = "create";
}
}
}
// Update a product or service
if ($action == 'update' && ($user->rights->produit->creer || $user->rights->service->creer)) {
if (GETPOST('cancel')) {
$action = '';
} else {
if ($object->id > 0) {
$object->oldcopy = clone $object;
$object->ref = $ref;
$object->label = GETPOST('label');
$object->description = dol_htmlcleanlastbr(GETPOST('desc'));
$object->url = GETPOST('url');
$object->note = dol_htmlcleanlastbr(GETPOST('note'));
$object->customcode = GETPOST('customcode');
$object->country_id = GETPOST('country_id');
$object->status = GETPOST('statut');
$object->status_buy = GETPOST('statut_buy');
$object->status_batch = GETPOST('status_batch');
// removed from update view so GETPOST always empty
/*
$object->seuil_stock_alerte = GETPOST('seuil_stock_alerte');
$object->desiredstock = GETPOST('desiredstock');
*/
$object->duration_value = GETPOST('duration_value');
$object->duration_unit = GETPOST('duration_unit');
$object->canvas = GETPOST('canvas');
$object->weight = GETPOST('weight');
$object->weight_units = GETPOST('weight_units');
示例4: setEventMessages
setEventMessages($object->error, $object->errors, 'errors');
}
$action = '';
}
}
} elseif ($action == 'updateligne' && $user->rights->facture->creer && !GETPOST('cancel')) {
if (!$object->fetch($id) > 0) {
dol_print_error($db);
}
$object->fetch_thirdparty();
// Clean parameters
$date_start = '';
$date_end = '';
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
$description = dol_htmlcleanlastbr(GETPOST('product_desc'));
$pu_ht = GETPOST('price_ht');
$vat_rate = GETPOST('tva_tx') ? GETPOST('tva_tx') : 0;
$qty = GETPOST('qty');
// Define info_bits
$info_bits = 0;
if (preg_match('/\\*/', $vat_rate)) {
$info_bits |= 0x1;
}
// Define vat_rate
$vat_rate = str_replace('*', '', $vat_rate);
$localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty);
$localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty);
// Add buying price
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : '');
示例5: unset
unset($_POST['np_tva_tx']);
unset($_POST['np_buying_price']);
} else {
$mesg = '<div class="error">' . $object->error . '</div>';
}
}
}
}
} else {
if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('save') == $langs->trans('Save')) {
// Clean parameters
$date_start = '';
$date_end = '';
$date_start = dol_mktime(0, 0, 0, GETPOST('date_start' . $suffixe . 'month'), GETPOST('date_start' . $suffixe . 'day'), GETPOST('date_start' . $suffixe . 'year'));
$date_end = dol_mktime(0, 0, 0, GETPOST('date_end' . $suffixe . 'month'), GETPOST('date_end' . $suffixe . 'day'), GETPOST('date_end' . $suffixe . 'year'));
$description = dol_htmlcleanlastbr(GETPOST('desc'));
$up_ht = GETPOST('pu') ? GETPOST('pu') : GETPOST('subprice');
// Define info_bits
$info_bits = 0;
if (preg_match('/\\*/', GETPOST('tva_tx'))) {
$info_bits |= 0x1;
}
// Define vat_rate
$vat_rate = GETPOST('tva_tx');
$vat_rate = str_replace('*', '', $vat_rate);
$localtax1_rate = get_localtax($vat_rate, 1, $object->client);
$localtax2_rate = get_localtax($vat_rate, 2, $object->client);
// ajout prix d'achat
$fk_fournprice = GETPOST('fournprice');
if (GETPOST('buying_price')) {
$pa_ht = GETPOST('buying_price');
示例6: setEventMessage
} else {
$action = 'add';
setEventMessage($object->error, 'errors');
}
}
// Validation de l'edition
if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->rights->categorie->creer) {
$object->fetch($id);
$current_lang = $langs->getDefaultLang();
foreach ($object->multilangs as $key => $value) {
if ($key == $current_lang) {
$object->label = $_POST["libelle-" . $key];
$object->description = dol_htmlcleanlastbr($_POST["desc-" . $key]);
} else {
$object->multilangs[$key]["label"] = $_POST["libelle-" . $key];
$object->multilangs[$key]["description"] = dol_htmlcleanlastbr($_POST["desc-" . $key]);
}
}
if ($object->setMultiLangs() > 0) {
$action = '';
} else {
$action = 'edit';
setEventMessage($object->error, 'errors');
}
}
$result = $object->fetch($id, $ref);
/*
* View
*/
llxHeader("", "", $langs->trans("Translation"));
$form = new Form($db);
示例7: header
if ($idContactOrigin) {
header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idContactOrigin . '&type=' . $type);
exit;
} else {
header("Location: " . DOL_URL_ROOT . '/categories/index.php?leftmenu=cat&type=' . $type);
exit;
}
}
}
}
}
}
}
}
$object->label = $label;
$object->description = dol_htmlcleanlastbr($description);
$object->socid = $socid ? $socid : 'null';
$object->visible = $visible;
$object->type = $type;
if ($parent != "-1") {
$object->fk_parent = $parent;
}
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
if (!$object->label) {
$error++;
$errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Ref"));
$action = 'create';
}
// Create category in database
if (!$error) {
$result = $object->create($user);
示例8: add
/**
* Add an action/event into database
* @param user Object user making action
* @param notrigger 1 = disable triggers, 0 = enable triggers
* @return int Id of created event, < 0 if KO
*/
function add($user, $notrigger = 0)
{
global $langs, $conf;
$now = dol_now();
// Clean parameters
$this->label = dol_trunc(trim($this->label), 128);
$this->location = dol_trunc(trim($this->location), 128);
$this->note = dol_htmlcleanlastbr(trim($this->note));
if (empty($this->percentage)) {
$this->percentage = 0;
}
if (empty($this->priority)) {
$this->priority = 0;
}
if (empty($this->fulldayevent)) {
$this->fuldayevent = 0;
}
if (empty($this->punctual)) {
$this->punctual = 0;
}
if ($this->percentage > 100) {
$this->percentage = 100;
}
if ($this->percentage == 100 && !$this->dateend) {
$this->dateend = $this->date;
}
if ($this->datep && $this->datef) {
$this->durationp = $this->datef - $this->datep;
}
if ($this->date && $this->dateend) {
$this->durationa = $this->dateend - $this->date;
}
if ($this->datep && $this->datef && $this->datep > $this->datef) {
$this->datef = $this->datep;
}
if ($this->date && $this->dateend && $this->date > $this->dateend) {
$this->dateend = $this->date;
}
if ($this->fk_project < 0) {
$this->fk_project = 0;
}
if ($this->elementtype == 'facture') {
$this->elementtype = 'invoice';
}
if ($this->elementtype == 'commande') {
$this->elementtype = 'order';
}
if ($this->elementtype == 'contrat') {
$this->elementtype = 'contract';
}
if (!$this->type_id && $this->type_code) {
# Get id from code
$cactioncomm = new CActionComm($this->db);
$result = $cactioncomm->fetch($this->type_code);
if ($result > 0) {
$this->type_id = $cactioncomm->id;
} else {
if ($result == 0) {
$this->error = 'Failed to get record with code AC_OTH from dictionnary "type of events"';
return -1;
} else {
$this->error = $cactioncomm->error;
return -1;
}
}
}
// Check parameters
if (!$this->type_id) {
$this->error = "ErrorWrongParameters";
return -1;
}
$this->db->begin();
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "actioncomm";
$sql .= "(datec,";
$sql .= "datep,";
$sql .= "datep2,";
$sql .= "datea,";
$sql .= "datea2,";
$sql .= "durationp,";
$sql .= "durationa,";
$sql .= "fk_action,";
$sql .= "fk_soc,";
$sql .= "fk_project,";
$sql .= "note,";
$sql .= "fk_contact,";
$sql .= "fk_user_author,";
$sql .= "fk_user_action,";
$sql .= "fk_user_done,";
$sql .= "label,percent,priority,fulldayevent,location,punctual,";
$sql .= "fk_element,";
$sql .= "elementtype,";
$sql .= "entity";
$sql .= ") VALUES (";
$sql .= "'" . $this->db->idate($now) . "',";
//.........这里部分代码省略.........
示例9: Canvas
$usecanvas=$_POST["canvas"];
if (empty($conf->global->MAIN_USE_CANVAS)) $usecanvas=0;
if (! empty($usecanvas)) // Overwrite product here
{
$canvas = new Canvas($db,$user);
$product = $canvas->load_canvas('product',$_POST["canvas"]);
}
if ($product->fetch($id))
{
$product->ref = $ref;
$product->libelle = $_POST["libelle"];
$product->description = dol_htmlcleanlastbr($_POST["desc"]);
$product->note = dol_htmlcleanlastbr($_POST["note"]);
$product->customcode = $_POST["customcode"];
$product->country_id = $_POST["country_id"];
$product->status = $_POST["statut"];
$product->status_buy = $_POST["statut_buy"];
$product->seuil_stock_alerte = $_POST["seuil_stock_alerte"];
$product->duration_value = $_POST["duration_value"];
$product->duration_unit = $_POST["duration_unit"];
$product->canvas = $_POST["canvas"];
$product->weight = $_POST["weight"];
$product->weight_units = $_POST["weight_units"];
$product->length = $_POST["size"];
$product->length_units = $_POST["size_units"];
$product->surface = $_POST["surface"];
$product->surface_units = $_POST["surface_units"];
$product->volume = $_POST["volume"];
示例10: dol_htmlcleanlastbr
if ($type == 'select' || $type == 'sellist' || $type == 'checkbox' || $type == 'radio') {
?>
<tr id="value_choice">
<td>
<?php
echo $langs->trans("Value");
?>
</td>
<td>
<table class="nobordernopadding">
<tr><td>
<textarea name="param" id="param" cols="80" rows="<?php
echo ROWS_4;
?>
"><?php
echo dol_htmlcleanlastbr($param_chain);
?>
</textarea>
</td><td><?php
print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelp" . $type), 1, 0);
?>
</td></tr>
</table>
</td>
</tr>
<?php
}
?>
<!-- Unique -->
<tr><td><?php
echo $langs->trans("Unique");
示例11: getInvoice
/**
* Get invoice from id, ref or ref_ext.
*
* @param array $authentication Array of authentication information
* @param int $id Id
* @param string $ref Ref
* @param string $ref_ext Ref_ext
* @return array Array result
*/
function getInvoice($authentication, $id = '', $ref = '', $ref_ext = '')
{
global $db, $conf, $langs;
dol_syslog("Function: getInvoice login=" . $authentication['login'] . " id=" . $id . " ref=" . $ref . " ref_ext=" . $ref_ext);
if ($authentication['entity']) {
$conf->entity = $authentication['entity'];
}
// Init and check authentication
$objectresp = array();
$errorcode = '';
$errorlabel = '';
$error = 0;
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
// Check parameters
if (!$error && ($id && $ref || $id && $ref_ext || $ref && $ref_ext)) {
$error++;
$errorcode = 'BAD_PARAMETERS';
$errorlabel = "Parameter id, ref and ref_ext can't be both provided. You must choose one or other but not both.";
}
if (!$error) {
$fuser->getrights();
if ($fuser->rights->facture->lire) {
$invoice = new Facture($db);
$result = $invoice->fetch($id, $ref, $ref_ext);
if ($result > 0) {
$linesresp = array();
$i = 0;
foreach ($invoice->lines as $line) {
//var_dump($line); exit;
$linesresp[] = array('id' => $line->rowid, 'type' => $line->product_type, 'desc' => dol_htmlcleanlastbr($line->desc), 'total_net' => $line->total_ht, 'total_vat' => $line->total_tva, 'total' => $line->total_ttc, 'vat_rate' => $line->tva_tx, 'qty' => $line->qty, 'product_ref' => $line->product_ref, 'product_label' => $line->product_label, 'product_desc' => $line->product_desc);
$i++;
}
// Create invoice
$objectresp = array('result' => array('result_code' => 'OK', 'result_label' => ''), 'invoice' => array('id' => $invoice->id, 'ref' => $invoice->ref, 'ref_ext' => $invoice->ref_ext ? $invoice->ref_ext : '', 'fk_user_author' => $invoice->user_author ? $invoice->user_author : '', 'fk_user_valid' => $invoice->user_valid ? $invoice->user_valid : '', 'date' => $invoice->date ? dol_print_date($invoice->date, 'dayrfc') : '', 'date_creation' => $invoice->date_creation ? dol_print_date($invoice->date_creation, 'dayhourrfc') : '', 'date_validation' => $invoice->date_validation ? dol_print_date($invoice->date_creation, 'dayhourrfc') : '', 'date_modification' => $invoice->datem ? dol_print_date($invoice->datem, 'dayhourrfc') : '', 'type' => $invoice->type, 'total_net' => $invoice->total_ht, 'total_vat' => $invoice->total_tva, 'total' => $invoice->total_ttc, 'note_private' => $invoice->note_private ? $invoice->note_private : '', 'note_public' => $invoice->note_public ? $invoice->note_public : '', 'status' => $invoice->statut, 'close_code' => $invoice->close_code ? $invoice->close_code : '', 'close_note' => $invoice->close_note ? $invoice->close_note : '', 'lines' => $linesresp));
} else {
$error++;
$errorcode = 'NOT_FOUND';
$errorlabel = 'Object not found for id=' . $id . ' nor ref=' . $ref . ' nor ref_ext=' . $ref_ext;
}
} else {
$error++;
$errorcode = 'PERMISSION_DENIED';
$errorlabel = 'User does not have permission for this request';
}
}
if ($error) {
$objectresp = array('result' => array('result_code' => $errorcode, 'result_label' => $errorlabel));
}
return $objectresp;
}
示例12: add
/**
* Add an action/event into database.
* $this->type_id OR $this->type_code must be set.
*
* @param User $user Object user making action
* @param int $notrigger 1 = disable triggers, 0 = enable triggers
* @return int Id of created event, < 0 if KO
*/
function add($user, $notrigger = 0)
{
global $langs, $conf, $hookmanager;
$error = 0;
$now = dol_now();
// Check parameters
if (empty($this->userownerid)) {
$this->errors[] = 'ErrorPropertyUserowneridNotDefined';
return -1;
}
// Clean parameters
$this->label = dol_trunc(trim($this->label), 128);
$this->location = dol_trunc(trim($this->location), 128);
$this->note = dol_htmlcleanlastbr(trim($this->note));
if (empty($this->percentage)) {
$this->percentage = 0;
}
if (empty($this->priority) || !is_numeric($this->priority)) {
$this->priority = 0;
}
if (empty($this->fulldayevent)) {
$this->fulldayevent = 0;
}
if (empty($this->punctual)) {
$this->punctual = 0;
}
if (empty($this->transparency)) {
$this->transparency = 0;
}
if ($this->percentage > 100) {
$this->percentage = 100;
}
//if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date;
if (!empty($this->datep) && !empty($this->datef)) {
$this->durationp = $this->datef - $this->datep;
}
// deprecated
//if (! empty($this->date) && ! empty($this->dateend)) $this->durationa=($this->dateend - $this->date);
if (!empty($this->datep) && !empty($this->datef) && $this->datep > $this->datef) {
$this->datef = $this->datep;
}
//if (! empty($this->date) && ! empty($this->dateend) && $this->date > $this->dateend) $this->dateend=$this->date;
if (!isset($this->fk_project) || $this->fk_project < 0) {
$this->fk_project = 0;
}
if ($this->elementtype == 'facture') {
$this->elementtype = 'invoice';
}
if ($this->elementtype == 'commande') {
$this->elementtype = 'order';
}
if ($this->elementtype == 'contrat') {
$this->elementtype = 'contract';
}
if (!is_array($this->userassigned) && !empty($this->userassigned)) {
$tmpid = $this->userassigned;
$this->userassigned = array();
$this->userassigned[$tmpid] = array('id' => $tmpid);
}
if (is_object($this->contact) && $this->contact->id > 0 && !($this->contactid > 0)) {
$this->contactid = $this->contact->id;
}
// For backward compatibility. Using this->contact->xx is deprecated
$userownerid = $this->userownerid;
$userdoneid = $this->userdoneid;
// Be sure assigned user is defined as an array of array('id'=>,'mandatory'=>,...).
if (empty($this->userassigned) || count($this->userassigned) == 0 || !is_array($this->userassigned)) {
$this->userassigned = array($userownerid => array('id' => $userownerid));
}
if (!$this->type_id || !$this->type_code) {
$key = empty($this->type_id) ? $this->type_code : $this->type_id;
// Get id from code
$cactioncomm = new CActionComm($this->db);
$result = $cactioncomm->fetch($key);
if ($result > 0) {
$this->type_id = $cactioncomm->id;
$this->type_code = $cactioncomm->code;
} else {
if ($result == 0) {
$this->error = 'Failed to get record with id ' . $this->type_id . ' code ' . $this->type_code . ' from dictionary "type of events"';
return -1;
} else {
$this->error = $cactioncomm->error;
return -1;
}
}
}
// Check parameters
if (!$this->type_id) {
$this->error = "ErrorWrongParameters";
return -1;
}
//.........这里部分代码省略.........
示例13: testDolHtmlCleanLastBr
/**
* testDolHtmlCleanLastBr
*
* @return boolean
*/
public function testDolHtmlCleanLastBr()
{
$input="A string<br>";
$after=dol_htmlcleanlastbr($input);
$this->assertEquals("A string",$after);
$input="A string first<br>\nA string second<br>";
$after=dol_htmlcleanlastbr($input);
$this->assertEquals("A string first<br>\nA string second",$after);
$input="A string\n<br type=\"_moz\" />\n";
$after=dol_htmlcleanlastbr($input);
$this->assertEquals("A string",$after);
$input="A string\n<br><br />\n\n";
$after=dol_htmlcleanlastbr($input);
$this->assertEquals("A string",$after);
return true;
}
示例14: dol_loginfunction
//.........这里部分代码省略.........
// Title
$title = 'Speedealing ' . DOL_VERSION;
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
$title = $conf->global->MAIN_APPLICATION_TITLE;
}
// Select templates
if (file_exists(DOL_DOCUMENT_ROOT . "/theme/" . $conf->theme . "/tpl/login.tpl.php")) {
$template_dir = DOL_DOCUMENT_ROOT . "/theme/" . $conf->theme . "/tpl/";
} else {
$template_dir = DOL_DOCUMENT_ROOT . "/core/tpl/";
}
$conf->css = "/theme/" . (GETPOST('theme') ? GETPOST('theme', 'alpha') : $conf->theme) . "/style.css.php?lang=" . $langs->defaultlang;
$conf_css = DOL_URL_ROOT . $conf->css;
// Set cookie for timeout management
$prefix = dol_getprefix();
$sessiontimeout = 'DOLSESSTIMEOUT_' . $prefix;
if (!empty($conf->global->MAIN_SESSION_TIMEOUT)) {
setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", '', 0);
}
if (GETPOST('urlfrom', 'alpha')) {
$_SESSION["urlfrom"] = GETPOST('urlfrom', 'alpha');
} else {
unset($_SESSION["urlfrom"]);
}
if (!GETPOST("username")) {
$focus_element = 'username';
} else {
$focus_element = 'password';
}
$login_background = DOL_URL_ROOT . '/theme/login_background.png';
if (file_exists(DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/img/login_background.png')) {
$login_background = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/login_background.png';
}
$demologin = '';
$demopassword = '';
if (!empty($dolibarr_main_demo)) {
$tab = explode(',', $dolibarr_main_demo);
$demologin = $tab[0];
$demopassword = $tab[1];
}
// Execute hook getLoginPageOptions
// Should be an array with differents options in $hookmanager->resArray
$parameters = array('entity' => $_POST['entity']);
$hookmanager->executeHooks('getLoginPageOptions', $parameters);
// Note that $action and $object may have been modified by some hooks
// Login
$login = !empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username", "alpha", 2) ? GETPOST("username", "alpha", 2) : $demologin);
$password = $demopassword;
// Show logo (search in order: small company logo, large company logo, theme logo, common logo)
$width = 0;
$urllogo = DOL_URL_ROOT . '/theme/login_logo.png';
if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small)) {
$urllogo = DOL_URL_ROOT . '/viewimage.php?cache=1&modulepart=companylogo&file=' . urlencode('thumbs/' . $mysoc->logo_small);
} elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output . '/logos/' . $mysoc->logo)) {
$urllogo = DOL_URL_ROOT . '/viewimage.php?cache=1&modulepart=companylogo&file=' . urlencode($mysoc->logo);
$width = 128;
} elseif (is_readable(DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/img/dolibarr_logo.png')) {
$urllogo = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/dolibarr_logo.png';
} elseif (is_readable(DOL_DOCUMENT_ROOT . '/theme/dolibarr_logo.png')) {
$urllogo = DOL_URL_ROOT . '/theme/dolibarr_logo.png';
}
// Security graphical code
$captcha = 0;
$captcha_refresh = '';
if (function_exists("imagecreatefrompng") && !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) {
$captcha = 1;
$captcha_refresh = img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"');
}
// Extra link
$forgetpasslink = 0;
$helpcenterlink = 0;
if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK) || empty($conf->global->MAIN_HELPCENTER_DISABLELINK)) {
if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) {
$forgetpasslink = 1;
}
if (empty($conf->global->MAIN_HELPCENTER_DISABLELINK)) {
$helpcenterlink = 1;
}
}
// Home message
if (!empty($conf->global->MAIN_HOME)) {
$i = 0;
while (preg_match('/__\\(([a-zA-Z]+)\\)__/i', $conf->global->MAIN_HOME, $reg) && $i < 100) {
$conf->global->MAIN_HOME = preg_replace('/__\\(' . $reg[1] . '\\)__/i', $langs->trans($reg[1]), $conf->global->MAIN_HOME);
$i++;
}
}
$main_home = dol_htmlcleanlastbr($conf->global->MAIN_HOME);
// Google AD
$main_google_ad_client = !empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT) ? 1 : 0;
$dol_loginmesg = $_SESSION["dol_loginmesg"];
$favicon = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/favicon.ico';
$jquerytheme = 'smoothness';
if (!empty($conf->global->MAIN_USE_JQUERY_THEME)) {
$jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
}
include $template_dir . 'login.tpl.php';
// To use native PHP
$_SESSION["dol_loginmesg"] = '';
}
示例15: dol_print_date
}
print '</tr></table>';
print '</td><td colspan="2">';
if ($action == 'editdate_livraison') {
print '<form name="setdate_livraison" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="setdate_livraison">';
$html->select_date($object->date_livraison ? $object->date_livraison : -1, 'liv_', '', '', '', "setdate_livraison");
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
print '</form>';
} else {
print $object->date_livraison ? dol_print_date($object->date_livraison, 'daytext') : ' ';
}
print '</td>';
print '<td rowspan="' . $nbrow . '" valign="top">' . $langs->trans('NotePublic') . ' :<br>';
print dol_htmlcleanlastbr($object->note_public);
print '</td>';
print '</tr>';
// Delivery address
if ($conf->global->COMMANDE_ADD_DELIVERY_ADDRESS) {
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('DeliveryAddress');
print '</td>';
if ($action != 'editdelivery_adress' && $object->brouillon) {
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdelivery_adress&socid=' . $object->socid . '&id=' . $object->id . '">' . img_edit($langs->trans('SetDeliveryAddress'), 1) . '</a></td>';
}
print '</tr></table>';
print '</td><td colspan="2">';
if ($action == 'editdelivery_adress') {
$html->form_address($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_delivery_address, $socid, 'fk_address', 'commande', $object->id);