if (!in_array($basedir, $listdir)) { print img_warning($langs->trans('WarningSafeModeOnCheckExecDir')); dol_syslog("safe_mode is on, basedir is " . $basedir . ", safe_mode_exec_dir is " . ini_get('safe_mode_exec_dir'), LOG_WARNING); } } print '<input type="text" name="MAIN_ANTIVIRUS_COMMAND" size="72" value="' . (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? dol_htmlentities($conf->global->MAIN_ANTIVIRUS_COMMAND) : '') . '">'; print "</td>"; print '</tr>'; // Use anti virus $var = !$var; print "<tr " . $bc[$var] . ">"; print '<td colspan="2">' . $langs->trans("AntiVirusParam") . '<br>'; print $langs->trans("AntiVirusParamExample"); print '</td>'; print '<td>'; print '<input type="text" name="MAIN_ANTIVIRUS_PARAM" size="72" value="' . (!empty($conf->global->MAIN_ANTIVIRUS_PARAM) ? dol_htmlentities($conf->global->MAIN_ANTIVIRUS_PARAM) : '') . '">'; print "</td>"; print '</tr>'; print '</table>'; dol_fiche_end(); print '<div class="center"><input type="submit" class="button" name="button" value="' . $langs->trans("Modify") . '"></div>'; print '</form>'; // Form to test upload print '<br>'; $formfile = new FormFile($db); $formfile->form_attach_new_file($_SERVER['PHP_SELF'], $langs->trans("FormToTestFileUploadForm"), 0, 0, 1, 50, '', '', 1, '', 0); // List of document $filearray = dol_dir_list($upload_dir, "files", 0, '', '', 'name', SORT_ASC, 1); $formfile->list_of_documents($filearray, '', 'admin_temp', ''); llxFooter(); $db->close();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . GETPOST('id'), $langs->trans('CloneAction'), $langs->trans('ConfirmCloneAction', $object->label), 'confirm_clone', $formquestion, 'yes', 1); print $formconfirm; } // Affichage fiche action en mode visu print '<table class="border" width="100%">'; $linkback = '<a href="' . DOL_URL_ROOT . '/comm/action/listactions.php">' . $langs->trans("BackToList") . '</a>'; // Ref print '<tr><td width="30%">' . $langs->trans("Ref") . '</td><td colspan="3">'; print $form->showrefnav($object, 'id', $linkback, $user->societe_id ? 0 : 1, 'id', 'ref', ''); print '</td></tr>'; // Type if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { print '<tr><td>' . $langs->trans("Type") . '</td><td colspan="3">' . $object->type . '</td></tr>'; } // Title print '<tr><td>' . $langs->trans("Title") . '</td><td colspan="3">' . dol_htmlentities($object->label) . '</td></tr>'; // Full day event print '<tr><td>' . $langs->trans("EventOnFullDay") . '</td><td colspan="3">' . yn($object->fulldayevent, 3) . '</td></tr>'; $rowspan = 4; if (empty($conf->global->AGENDA_DISABLE_LOCATION)) { $rowspan++; } // Date start print '<tr><td width="30%">' . $langs->trans("DateActionStart") . '</td><td colspan="3">'; if (!$object->fulldayevent) { print dol_print_date($object->datep, 'dayhour'); } else { print dol_print_date($object->datep, 'day'); } if ($object->percentage == 0 && $object->datep && $object->datep < $now - $delay_warning) { print img_warning($langs->trans("Late"));
print '<img src="' . dol_buildpath('/opensurvey/img/medaille.png', 1) . '"> ' . $langs->trans('TheBestChoices') . ": <b>" . $meilleursujet . "</b> " . $langs->trans('with') . " <b>{$meilleurecolonne} </b>" . $vote_str . ".\n"; } print '</p><br>' . "\n"; } } print '<br>'; // Comment list $comments = $object->getComments(); if ($comments) { print "<br><b>" . $langs->trans("CommentsOfVoters") . ":</b><br>\n"; foreach ($comments as $obj) { print '<div class="comment"><span class="usercomment">'; if (in_array($obj->usercomment, $listofvoters)) { print '<a href="' . $_SERVER["PHP_SELF"] . '?deletecomment=' . $obj->id_comment . '&sondage=' . $numsondage . '"> ' . img_picto('', 'delete.png') . '</a> '; } print dol_htmlentities($obj->usercomment) . ':</span> <span class="comment">' . dol_nl2br(dol_htmlentities($obj->comment)) . "</span></div>"; } } // Form to add comment if ($object->allow_comments) { print '<div class="addcomment">' . $langs->trans("AddACommentForPoll") . "<br>\n"; print '<textarea name="comment" rows="2" cols="60"></textarea><br>' . "\n"; print $langs->trans("Name") . ': '; print '<input type="text" name="commentuser" maxlength="64" /> ' . "\n"; print '<input type="submit" class="button" name="ajoutcomment" value="' . dol_escape_htmltag($langs->trans("AddComment")) . '"><br>' . "\n"; print '</form>' . "\n"; print '</div>' . "\n"; // div add comment } print '<br><br>'; print '<a name="bas"></a>' . "\n";
print '<a href="' . dol_buildpath('/opensurvey/card.php', 1) . '?id=' . $obj->id_sondage . '">' . img_picto('', 'object_opensurvey') . ' ' . $obj->id_sondage . '</a>'; print '</td><td>' . dol_htmlentities($obj->titre) . '</td><td>'; $type = $obj->format == 'A' ? 'classic' : 'date'; print img_picto('', dol_buildpath('/opensurvey/img/' . ($type == 'classic' ? 'chart-32.png' : 'calendar-32.png'), 1), 'width="16"', 1); print ' ' . $langs->trans($type == 'classic' ? "TypeClassic" : "TypeDate"); print '</td><td>'; // Author if ($obj->fk_user_creat) { $userstatic = new User($db); $userstatic->id = $obj->fk_user_creat; $userstatic->firstname = $obj->firstname; $userstatic->lastname = $obj->lastname; $userstatic->login = $userstatic->getFullName($langs, 0, -1, 48); print $userstatic->getLoginUrl(1); } else { print dol_htmlentities($obj->nom_admin); } print '</td>'; print '<td align="center">' . dol_print_date($db->jdate($obj->date_fin), 'day'); if ($db->jdate($obj->date_fin) < time()) { print ' (' . $langs->trans("Expired") . ')'; } print '</td>'; print '<td align="center">' . $nbuser . '</td>' . "\n"; print '</tr>' . "\n"; $i++; } print '</table>' . "\n"; print '</form>'; print '</div>' . "\n"; llxFooter();
/** * This function is called to encode a string into a HTML string but differs from htmlentities because * all entities but &,<,> are converted. This permits to encode special chars to entities with no double * encoding for already encoded HTML strings. * This function also remove last CR/BR. * For PDF usage, you can show text by 2 ways: * - writeHTMLCell -> param must be encoded into HTML. * - MultiCell -> param must not be encoded into HTML. * Because writeHTMLCell convert also \n into <br>, if function * is used to build PDF, nl2brmode must be 1. * @param stringtoencode String to encode * @param nl2brmode 0=Adding br before \n, 1=Replacing \n by br (for use with FPDF writeHTMLCell function for example) * @param pagecodefrom Pagecode stringtoencode is encoded */ function dol_htmlentitiesbr($stringtoencode, $nl2brmode = 0, $pagecodefrom = 'UTF-8') { if (dol_textishtml($stringtoencode)) { $newstring = $stringtoencode; //$newstring=preg_replace('/([^<li\s*>]+)(\r\n|\r|\n)+/i',($forxml?'$1<br />':'$1<br>'),$stringtoencode); // Don't replace if in list //$newstring=preg_replace('/<li\s*>(\r\n|\r|\n)+/','__li__',$newstring); // Don't replace if \n is just after a li //$newstring=preg_replace('/(\r\n|\r|\n)+/i',($forxml?'<br />':'<br>'),$newstring); // If already HTML, CR should be <br> so we don't change \n $newstring = preg_replace('/<br(\\s[\\sa-zA-Z_="]*)?\\/?>/i', '<br>', $newstring); // Replace "<br type="_moz" />" by "<br>". It's same and avoid pb with FPDF. $newstring = preg_replace('/<br>$/i', '', $newstring); // Remove last <br> $newstring = strtr($newstring, array('&' => '__and__', '<' => '__lt__', '>' => '__gt__', '"' => '__dquot__')); $newstring = dol_htmlentities($newstring, ENT_COMPAT, $pagecodefrom); // Make entity encoding $newstring = strtr($newstring, array('__and__' => '&', '__lt__' => '<', '__gt__' => '>', '__dquot__' => '"')); //$newstring=strtr($newstring,array('__li__'=>"<li>\n")); // Restore <li>\n } else { $newstring = dol_nl2br(dol_htmlentities($stringtoencode, ENT_COMPAT, $pagecodefrom), $nl2brmode); } // Other substitutions that htmlentities does not do //$newstring=str_replace(chr(128),'€',$newstring); // 128 = 0x80. Not in html entity table. return $newstring; }
/** * Ouput html header of a page. * This code is also duplicated into security2.lib.php::dol_loginfunction * * @param string $head Optionnal head lines * @param string $title HTML title * @param int $disablejs More content into html header * @param int $disablehead More content into html header * @param array $arrayofjs Array of complementary js files * @param array $arrayofcss Array of complementary css files * @return void */ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '') { global $user, $conf, $langs, $db; top_httphead(); if (empty($conf->css)) { $conf->css = '/theme/eldy/style.css.php'; } // If not defined, eldy by default if (empty($conf->global->MAIN_ACTIVATE_HTML5)) { $doctype = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'; } else { $doctype = '<!doctype html>'; // Html5 - Developement - Only available on Eldy template } print $doctype . "\n"; if (!empty($conf->global->MAIN_USE_CACHE_MANIFEST)) { print '<html lang="' . substr($langs->defaultlang, 0, 2) . '" manifest="' . DOL_URL_ROOT . '/cache.manifest">' . "\n"; } else { print '<html lang="' . substr($langs->defaultlang, 0, 2) . '">' . "\n"; } //print '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">'."\n"; if (empty($disablehead)) { print "<head>\n"; if (GETPOST('dol_basehref')) { print '<base href="' . dol_escape_htmltag(GETPOST('dol_basehref')) . '">' . "\n"; } // Displays meta print '<meta name="robots" content="noindex,nofollow">' . "\n"; // Do not index print '<meta name="viewport" content="width=device-width, initial-scale=1">'; // Scale for mobile device print '<meta name="author" content="Dolibarr Development Team">' . "\n"; if (!empty($conf->global->MAIN_ACTIVATE_HTML5)) { print '<meta name="viewport" content="width=device-width, initial-scale=1.0">' . "\n"; } // Needed for Responsive Web Design $favicon = dol_buildpath('/theme/' . $conf->theme . '/img/favicon.ico', 1); if (!empty($conf->global->MAIN_FAVICON_URL)) { $favicon = $conf->global->MAIN_FAVICON_URL; } print '<link rel="shortcut icon" type="image/x-icon" href="' . $favicon . '"/>' . "\n"; if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { print '<link rel="top" title="' . $langs->trans("Home") . '" href="' . (DOL_URL_ROOT ? DOL_URL_ROOT : '/') . '">' . "\n"; } if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { print '<link rel="copyright" title="GNU General Public License" href="http://www.gnu.org/copyleft/gpl.html#SEC1">' . "\n"; } if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { print '<link rel="author" title="Dolibarr Development Team" href="http://www.dolibarr.org">' . "\n"; } // Displays title $appli = 'Dolibarr'; if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { $appli = $conf->global->MAIN_APPLICATION_TITLE; } if ($title && !empty($conf->global->MAIN_HTML_TITLE) && preg_match('/noapp/', $conf->global->MAIN_HTML_TITLE)) { print '<title>' . dol_htmlentities($title) . '</title>'; } if ($title) { print '<title>' . dol_htmlentities($appli . ' - ' . $title) . '</title>'; } else { print "<title>" . dol_htmlentities($appli) . "</title>"; } print "\n"; $ext = ''; if (!empty($conf->dol_use_jmobile)) { $ext = 'version=' . urlencode(DOL_VERSION); } if (GETPOST('version')) { $ext = 'version=' . GETPOST('version', 'int'); } // usefull to force no cache on css/js if (!defined('DISABLE_JQUERY') && !$disablejs && $conf->use_javascript_ajax) { print '<!-- Includes CSS for JQuery (Ajax library) -->' . "\n"; $jquerytheme = 'smoothness'; if (!empty($conf->global->MAIN_USE_JQUERY_THEME)) { $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME; } if (constant('JS_JQUERY_UI')) { print '<link rel="stylesheet" type="text/css" href="' . JS_JQUERY_UI . 'css/' . $jquerytheme . '/jquery-ui.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n"; } else { print '<link rel="stylesheet" type="text/css" href="' . DOL_URL_ROOT . '/includes/jquery/css/' . $jquerytheme . '/jquery-ui.css' . ($ext ? '?' . $ext : '') . '">' . "\n"; } // JQuery print '<link rel="stylesheet" type="text/css" href="' . DOL_URL_ROOT . '/includes/jquery/plugins/tiptip/tipTip.css' . ($ext ? '?' . $ext : '') . '">' . "\n"; // Tooltip print '<link rel="stylesheet" type="text/css" href="' . DOL_URL_ROOT . '/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n"; // JNotify /*if (! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) || (defined('REQUIRE_JQUERY_FILEUPLOAD') && constant('REQUIRE_JQUERY_FILEUPLOAD'))) // jQuery fileupload { print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/css/jquery.fileupload-ui.css'.($ext?'?'.$ext:'').'">'."\n"; }*/ if (!empty($conf->global->MAIN_USE_JQUERY_DATATABLES) || defined('REQUIRE_JQUERY_DATATABLES') && constant('REQUIRE_JQUERY_DATATABLES')) { //print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/datatables/css/jquery.dataTables.css'.($ext?'?'.$ext:'').'">'."\n"; print '<link rel="stylesheet" type="text/css" href="' . DOL_URL_ROOT . '/includes/jquery/plugins/datatables/media/css/jquery.dataTables.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n"; print '<link rel="stylesheet" type="text/css" href="' . DOL_URL_ROOT . '/includes/jquery/plugins/datatables/extensions/ColReorder/css/dataTables.colReorder.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n"; print '<link rel="stylesheet" type="text/css" href="' . DOL_URL_ROOT . '/includes/jquery/plugins/datatables/extensions/ColVis/css/dataTables.colVis.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n"; print '<link rel="stylesheet" type="text/css" href="' . DOL_URL_ROOT . '/includes/jquery/plugins/datatables/extensions/TableTools/css/dataTables.tableTools.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n"; } if (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) { $tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; print '<link rel="stylesheet" type="text/css" href="' . DOL_URL_ROOT . '/includes/jquery/plugins/' . $tmpplugin . '/' . $tmpplugin . '.css' . ($ext ? '?' . $ext : '') . '">' . "\n"; } // jQuery Timepicker if (!empty($conf->global->MAIN_USE_JQUERY_TIMEPICKER) || defined('REQUIRE_JQUERY_TIMEPICKER')) { print '<link rel="stylesheet" type="text/css" href="' . DOL_URL_ROOT . '/includes/jquery/plugins/timepicker/jquery-ui-timepicker-addon.css' . ($ext ? '?' . $ext : '') . '">' . "\n"; } // jQuery jMobile if (!empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || !empty($conf->dol_use_jmobile)) { print '<link rel="stylesheet" type="text/css" href="' . DOL_URL_ROOT . '/includes/jquery/plugins/mobile/jquery.mobile-latest.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n"; } } print '<!-- Includes CSS for Dolibarr theme -->' . "\n"; // Output style sheets (optioncss='print' or ''). Note: $conf->css looks like '/theme/eldy/style.css.php' //$themepath=dol_buildpath((empty($conf->global->MAIN_FORCETHEMEDIR)?'':$conf->global->MAIN_FORCETHEMEDIR).$conf->css,1); $themepath = dol_buildpath($conf->css, 1); $themesubdir = ''; if (!empty($conf->modules_parts['theme'])) { foreach ($conf->modules_parts['theme'] as $reldir) { if (file_exists(dol_buildpath($reldir . $conf->css, 0))) { $themepath = dol_buildpath($reldir . $conf->css, 1); $themesubdir = $reldir; break; } } } $themeparam = '?lang=' . $langs->defaultlang . '&theme=' . $conf->theme . (GETPOST('optioncss') ? '&optioncss=' . GETPOST('optioncss', 'alpha', 1) : '') . '&userid=' . $user->id . '&entity=' . $conf->entity; $themeparam .= $ext ? '&' . $ext : ''; if (!empty($_SESSION['dol_resetcache'])) { $themeparam .= '&dol_resetcache=' . $_SESSION['dol_resetcache']; } if (GETPOST('dol_hide_topmenu')) { $themeparam .= '&dol_hide_topmenu=' . GETPOST('dol_hide_topmenu', 'int'); } if (GETPOST('dol_hide_leftmenu')) { $themeparam .= '&dol_hide_leftmenu=' . GETPOST('dol_hide_leftmenu', 'int'); } if (GETPOST('dol_optimize_smallscreen')) { $themeparam .= '&dol_optimize_smallscreen=' . GETPOST('dol_optimize_smallscreen', 'int'); } if (GETPOST('dol_no_mouse_hover')) { $themeparam .= '&dol_no_mouse_hover=' . GETPOST('dol_no_mouse_hover', 'int'); } if (GETPOST('dol_use_jmobile')) { $themeparam .= '&dol_use_jmobile=' . GETPOST('dol_use_jmobile', 'int'); $conf->dol_use_jmobile = GETPOST('dol_use_jmobile', 'int'); } //print 'themepath='.$themepath.' themeparam='.$themeparam;exit; print '<link rel="stylesheet" type="text/css" href="' . $themepath . $themeparam . '">' . "\n"; if (!empty($conf->global->MAIN_FIX_FLASH_ON_CHROME)) { print '<!-- Includes CSS that does not exists as workaround of flash bug of chrome -->' . "\n" . '<link rel="stylesheet" type="text/css" href="filethatdoesnotexiststosolvechromeflashbug">' . "\n"; } // CSS forced by modules (relative url starting with /) if (!empty($conf->modules_parts['css'])) { $arraycss = (array) $conf->modules_parts['css']; foreach ($arraycss as $modcss => $filescss) { $filescss = (array) $filescss; // To be sure filecss is an array foreach ($filescss as $cssfile) { if (empty($cssfile)) { dol_syslog("Warning: module " . $modcss . " declared a css path file into its descriptor that is empty.", LOG_WARNING); } // cssfile is a relative path print '<!-- Includes CSS added by module ' . $modcss . ' -->' . "\n" . '<link rel="stylesheet" type="text/css" href="' . dol_buildpath($cssfile, 1); // We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters, so browser cache is not used. if (!preg_match('/\\.css$/i', $cssfile)) { print $themeparam; } print '">' . "\n"; } } } // CSS forced by page in top_htmlhead call (relative url starting with /) if (is_array($arrayofcss)) { foreach ($arrayofcss as $cssfile) { print '<!-- Includes CSS added by page -->' . "\n" . '<link rel="stylesheet" type="text/css" title="default" href="' . dol_buildpath($cssfile, 1); // We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters and browser cache is not used. if (!preg_match('/\\.css$/i', $cssfile)) { print $themeparam; } print '">' . "\n"; } } // Output standard javascript links if (!defined('DISABLE_JQUERY') && !$disablejs && !empty($conf->use_javascript_ajax)) { // JQuery. Must be before other includes print '<!-- Includes JS for JQuery -->' . "\n"; if (constant('JS_JQUERY')) { print '<script type="text/javascript" src="' . JS_JQUERY . 'jquery.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; } else { print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/includes/jquery/js/jquery.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; } if (constant('JS_JQUERY_UI')) { print '<script type="text/javascript" src="' . JS_JQUERY_UI . 'jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; } else { print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/includes/jquery/js/jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; } print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/includes/jquery/plugins/tablednd/jquery.tablednd.0.6.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/includes/jquery/plugins/tiptip/jquery.tipTip.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; // jQuery Layout if (empty($conf->dol_use_jmobile) && !empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) || defined('REQUIRE_JQUERY_LAYOUT')) { print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/includes/jquery/plugins/layout/jquery.layout.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; } // jQuery jnotify if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && !defined('DISABLE_JQUERY_JNOTIFY')) { print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/includes/jquery/plugins/jnotify/jquery.jnotify.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/core/js/jnotify.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; } // jQuery blockUI if (!empty($conf->global->MAIN_USE_JQUERY_BLOCKUI) || defined('REQUIRE_JQUERY_BLOCKUI')) { print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/includes/jquery/plugins/blockUI/jquery.blockUI.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; print '<script type="text/javascript">' . "\n"; print 'var indicatorBlockUI = \'' . DOL_URL_ROOT . "/theme/" . $conf->theme . "/img/working2.gif" . '\';' . "\n"; print '</script>' . "\n"; print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/core/js/blockUI.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; } // Flot if (empty($conf->global->MAIN_DISABLE_JQUERY_FLOT)) { if (constant('JS_JQUERY_FLOT')) { print '<script type="text/javascript" src="' . JS_JQUERY_FLOT . 'jquery.flot.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; print '<script type="text/javascript" src="' . JS_JQUERY_FLOT . 'jquery.flot.pie.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; print '<script type="text/javascript" src="' . JS_JQUERY_FLOT . 'jquery.flot.stack.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; } else { print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/includes/jquery/plugins/flot/jquery.flot.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/includes/jquery/plugins/flot/jquery.flot.pie.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/includes/jquery/plugins/flot/jquery.flot.stack.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; } } // jQuery jeditable if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) { print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/includes/jquery/plugins/jeditable/jquery.jeditable.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/includes/jquery/plugins/jeditable/jquery.jeditable.ui-autocomplete.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; print '<script type="text/javascript">' . "\n"; print 'var urlSaveInPlace = \'' . DOL_URL_ROOT . '/core/ajax/saveinplace.php\';' . "\n"; print 'var urlLoadInPlace = \'' . DOL_URL_ROOT . '/core/ajax/loadinplace.php\';' . "\n"; print 'var tooltipInPlace = \'' . $langs->transnoentities('ClickToEdit') . '\';' . "\n"; print 'var placeholderInPlace = \'' . $langs->trans('ClickToEdit') . '\';' . "\n"; print 'var cancelInPlace = \'' . $langs->trans('Cancel') . '\';' . "\n"; print 'var submitInPlace = \'' . $langs->trans('Ok') . '\';' . "\n"; print 'var indicatorInPlace = \'<img src="' . DOL_URL_ROOT . "/theme/" . $conf->theme . "/img/working.gif" . '">\';' . "\n"; print '</script>' . "\n"; print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/core/js/editinplace.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/includes/jquery/plugins/jeditable/jquery.jeditable.ckeditor.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; } // jQuery File Upload /* if (! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) || (defined('REQUIRE_JQUERY_FILEUPLOAD') && constant('REQUIRE_JQUERY_FILEUPLOAD'))) { print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/template/tmpl.min'.$ext.'"></script>'."\n"; print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/jquery.iframe-transport'.$ext.'"></script>'."\n"; print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/jquery.fileupload'.$ext.'"></script>'."\n"; print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/jquery.fileupload-fp'.$ext.'"></script>'."\n"; print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/jquery.fileupload-ui'.$ext.'"></script>'."\n"; print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/jquery.fileupload-jui'.$ext.'"></script>'."\n"; print '<!-- The XDomainRequest Transport is included for cross-domain file deletion for IE8+ -->'."\n"; print '<!--[if gte IE 8]><script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/fileupload/js/cors/jquery.xdr-transport'.$ext.'"></script><![endif]-->'."\n"; }*/ // jQuery DataTables if (!empty($conf->global->MAIN_USE_JQUERY_DATATABLES) || defined('REQUIRE_JQUERY_DATATABLES') && constant('REQUIRE_JQUERY_DATATABLES')) { print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/includes/jquery/plugins/datatables/media/js/jquery.dataTables.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/includes/jquery/plugins/datatables/extensions/ColReorder/js/dataTables.colReorder.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/includes/jquery/plugins/datatables/extensions/ColVis/js/dataTables.colVis.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/includes/jquery/plugins/datatables/extensions/TableTools/js/dataTables.tableTools.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; } // jQuery Timepicker if (!empty($conf->global->MAIN_USE_JQUERY_TIMEPICKER) || defined('REQUIRE_JQUERY_TIMEPICKER')) { print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/includes/jquery/plugins/timepicker/jquery-ui-timepicker-addon.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/core/js/timepicker.js.php?lang=' . $langs->defaultlang . ($ext ? '&' . $ext : '') . '"></script>' . "\n"; } if (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) { $tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/includes/jquery/plugins/' . $tmpplugin . '/' . $tmpplugin . '.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; } // jQuery jMobile if (!empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || !empty($conf->dol_use_jmobile) && $conf->dol_use_jmobile > 0) { // We must force not using ajax because cache of jquery does not load js of other pages. // This also increase seriously speed onto mobile device where complex js code is very slow and memory very low. // Note: dol_use_jmobile=1 use jmobile without ajax, dol_use_jmobile=2 use jmobile with ajax if (empty($conf->dol_use_jmobile) || $conf->dol_use_jmobile != 2 && $conf->dol_use_jmobile != 3) { print '<script type="text/javascript"> $(document).bind("mobileinit", function(){ $.extend( $.mobile , { autoInitializePage : true, /* We need this to run jmobile */ /* loadingMessage : \'xxxxx\', */ touchOverflowEnabled : true, defaultPageTransition : \'none\', defaultDialogTransition : \'none\', ajaxEnabled : false /* old param was ajaxFormsEnabled and ajaxLinksEnabled */ }); }); </script>'; } if (empty($conf->dol_use_jmobile) || $conf->dol_use_jmobile != 3) { print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/includes/jquery/plugins/mobile/jquery.mobile-latest.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; } } } if (!$disablejs && !empty($conf->use_javascript_ajax)) { // CKEditor if (!empty($conf->fckeditor->enabled) && (empty($conf->global->FCKEDITOR_EDITORNAME) || $conf->global->FCKEDITOR_EDITORNAME == 'ckeditor')) { print '<!-- Includes JS for CKEditor -->' . "\n"; $pathckeditor = DOL_URL_ROOT . '/includes/ckeditor/'; $jsckeditor = 'ckeditor.js'; if (constant('JS_CKEDITOR')) { $pathckeditor = constant('JS_CKEDITOR'); } print '<script type="text/javascript">'; print 'var CKEDITOR_BASEPATH = \'' . $pathckeditor . '\';' . "\n"; print 'var ckeditorConfig = \'' . dol_buildpath($themesubdir . '/theme/' . $conf->theme . '/ckeditor/config.js', 1) . '\';' . "\n"; // $themesubdir='' in standard usage print 'var ckeditorFilebrowserBrowseUrl = \'' . DOL_URL_ROOT . '/core/filemanagerdol/browser/default/browser.php?Connector=' . DOL_URL_ROOT . '/core/filemanagerdol/connectors/php/connector.php\';' . "\n"; print 'var ckeditorFilebrowserImageBrowseUrl = \'' . DOL_URL_ROOT . '/core/filemanagerdol/browser/default/browser.php?Type=Image&Connector=' . DOL_URL_ROOT . '/core/filemanagerdol/connectors/php/connector.php\';' . "\n"; print '</script>' . "\n"; print '<script type="text/javascript" src="' . $pathckeditor . $jsckeditor . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; } // Global js function print '<!-- Includes JS of Dolibarr -->' . "\n"; print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/core/js/lib_head.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; // Add datepicker default options print '<script type="text/javascript" src="' . DOL_URL_ROOT . '/core/js/datepicker.js.php?lang=' . $langs->defaultlang . ($ext ? '&' . $ext : '') . '"></script>' . "\n"; // JS forced by modules (relative url starting with /) if (!empty($conf->modules_parts['js'])) { $arrayjs = (array) $conf->modules_parts['js']; foreach ($arrayjs as $modjs => $filesjs) { $filesjs = (array) $filesjs; // To be sure filejs is an array foreach ($filesjs as $jsfile) { // jsfile is a relative path print '<!-- Include JS added by module ' . $modjs . '-->' . "\n" . '<script type="text/javascript" src="' . dol_buildpath($jsfile, 1) . '"></script>' . "\n"; } } } // JS forced by page in top_htmlhead (relative url starting with /) if (is_array($arrayofjs)) { print '<!-- Includes JS added by page -->' . "\n"; foreach ($arrayofjs as $jsfile) { if (preg_match('/^http/i', $jsfile)) { print '<script type="text/javascript" src="' . $jsfile . '"></script>' . "\n"; } else { if (!preg_match('/^\\//', $jsfile)) { $jsfile = '/' . $jsfile; } // For backward compatibility print '<script type="text/javascript" src="' . dol_buildpath($jsfile, 1) . '"></script>' . "\n"; } } } } if (!empty($head)) { print $head . "\n"; } if (!empty($conf->global->MAIN_HTML_HEADER)) { print $conf->global->MAIN_HTML_HEADER . "\n"; } print "</head>\n\n"; } $conf->headerdone = 1; // To tell header was output }
$compteursujet = 0; $meilleursujet = ''; for ($i = 0; $i < $nbcolonnes; $i++) { if (isset($sumfor[$i]) === true && isset($meilleurecolonne) === true && $sumfor[$i] == $meilleurecolonne) { $meilleursujet .= ", "; if ($object->format == "D") { $meilleursujetexport = $toutsujet[$i]; if (strpos($toutsujet[$i], '@') !== false) { $toutsujetdate = explode("@", $toutsujet[$i]); $meilleursujet .= dol_print_date($toutsujetdate[0], 'daytext') . ' (' . dol_print_date($toutsujetdate[0], '%A') . ')' . ' - ' . $toutsujetdate[1]; } else { $meilleursujet .= dol_print_date($toutsujet[$i], 'daytext') . ' (' . dol_print_date($toutsujet[$i], '%A') . ')'; } } else { $tmps = explode('@', $toutsujet[$i]); $meilleursujet .= dol_htmlentities($tmps[0]); } $compteursujet++; } } $meilleursujet = substr("{$meilleursujet}", 1); $meilleursujet = str_replace("°", "'", $meilleursujet); // Show best choice if ($nbofcheckbox >= 2) { $vote_str = $langs->trans('votes'); print '<p class="affichageresultats">' . "\n"; if (isset($meilleurecolonne) && $compteursujet == "1") { print "<img src=\"" . dol_buildpath('/opensurvey/img/medaille.png', 1) . "\"> " . $langs->trans('TheBestChoice') . ": <b>" . $meilleursujet . " </b>" . $langs->trans("with") . " <b>{$meilleurecolonne} </b>" . $vote_str . ".\n"; } elseif (isset($meilleurecolonne)) { print "<img src=\"" . dol_buildpath('/opensurvey/img/medaille.png', 1) . "\"> " . $langs->trans('TheBestChoices') . ": <b>" . $meilleursujet . " </b>" . $langs->trans("with") . " <b>{$meilleurecolonne} </b>" . $vote_str . ".\n"; }
/** * Launch a sql file. Function used by: * - Migrate process (dolibarr-xyz-abc.sql) * - Loading sql menus (auguria) * - Running specific Sql by a module init * Install process however does not use it. * Note that Sql files must have all comments at start of line. * * @param string $sqlfile Full path to sql file * @param int $silent 1=Do not output anything, 0=Output line for update page * @param int $entity Entity targeted for multicompany module * @param int $usesavepoint 1=Run a savepoint before each request and a rollback to savepoint if error (this allow to have some request with errors inside global transactions). * @param string $handler Handler targeted for menu * @param string $okerror Family of errors we accept ('default', 'none') * @return int <=0 if KO, >0 if OK */ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handler = '', $okerror = 'default') { global $db, $conf, $langs, $user; dol_syslog("Admin.lib::run_sql run sql file " . $sqlfile . " silent=" . $silent . " entity=" . $entity . " usesavepoint=" . $usesavepoint . " handler=" . $handler . " okerror=" . $okerror, LOG_DEBUG); $ok = 0; $error = 0; $i = 0; $buffer = ''; $arraysql = array(); // Get version of database $versionarray = $db->getVersionArray(); $fp = fopen($sqlfile, "r"); if ($fp) { while (!feof($fp)) { $buf = fgets($fp, 4096); // Test if request must be ran only for particular database or version (if yes, we must remove the -- comment) if (preg_match('/^--\\sV(MYSQL|PGSQL|)([0-9\\.]+)/i', $buf, $reg)) { $qualified = 1; // restrict on database type if (!empty($reg[1])) { if (!preg_match('/' . preg_quote($reg[1]) . '/i', $db->type)) { $qualified = 0; } } // restrict on version if ($qualified) { $versionrequest = explode('.', $reg[2]); //print var_dump($versionrequest); //print var_dump($versionarray); if (!count($versionrequest) || !count($versionarray) || versioncompare($versionrequest, $versionarray) > 0) { $qualified = 0; } } if ($qualified) { // Version qualified, delete SQL comments $buf = preg_replace('/^--\\sV(MYSQL|PGSQL|)([0-9\\.]+)/i', '', $buf); //print "Ligne $i qualifi?e par version: ".$buf.'<br>'; } } // Add line buf to buffer if not a comment if (!preg_match('/^--/', $buf)) { $buf = preg_replace('/--.*$/', '', $buf); //remove comment from a line that not start with -- before add it to the buffer $buffer .= trim($buf); } // print $buf.'<br>'; if (preg_match('/;/', $buffer)) { // Found new request if ($buffer) { $arraysql[$i] = $buffer; } $i++; $buffer = ''; } } if ($buffer) { $arraysql[$i] = $buffer; } fclose($fp); } else { dol_syslog("Admin.lib::run_sql failed to open file " . $sqlfile, LOG_ERR); } // Loop on each request to see if there is a __+MAX_table__ key $listofmaxrowid = array(); // This is a cache table foreach ($arraysql as $i => $sql) { $newsql = $sql; // Replace __+MAX_table__ with max of table while (preg_match('/__\\+MAX_([A-Za-z_]+)__/i', $newsql, $reg)) { $table = $reg[1]; if (!isset($listofmaxrowid[$table])) { //var_dump($db); $sqlgetrowid = 'SELECT MAX(rowid) as max from ' . $table; $resql = $db->query($sqlgetrowid); if ($resql) { $obj = $db->fetch_object($resql); $listofmaxrowid[$table] = $obj->max; if (empty($listofmaxrowid[$table])) { $listofmaxrowid[$table] = 0; } } else { if (!$silent) { print '<tr><td valign="top" colspan="2">'; } if (!$silent) { print '<div class="error">' . $langs->trans("Failed to get max rowid for " . $table) . "</div></td>"; } if (!$silent) { print '</tr>'; } $error++; break; } } $from = '__+MAX_' . $table . '__'; $to = '+' . $listofmaxrowid[$table]; $newsql = str_replace($from, $to, $newsql); dol_syslog('Admin.lib::run_sql New Request ' . ($i + 1) . ' (replacing ' . $from . ' to ' . $to . ')', LOG_DEBUG); $arraysql[$i] = $newsql; } } // Loop on each request to execute request $cursorinsert = 0; $listofinsertedrowid = array(); foreach ($arraysql as $i => $sql) { if ($sql) { // Replace the prefix tables if (MAIN_DB_PREFIX != 'llx_') { $sql = preg_replace('/llx_/i', MAIN_DB_PREFIX, $sql); } if (!empty($handler)) { $sql = preg_replace('/__HANDLER__/i', "'" . $handler . "'", $sql); } $newsql = preg_replace('/__ENTITY__/i', !empty($entity) ? $entity : $conf->entity, $sql); // Ajout trace sur requete (eventuellement a commenter si beaucoup de requetes) if (!$silent) { print '<tr><td valign="top">' . $langs->trans("Request") . ' ' . ($i + 1) . " sql='" . dol_htmlentities($newsql, ENT_NOQUOTES) . "'</td></tr>\n"; } dol_syslog('Admin.lib::run_sql Request ' . ($i + 1), LOG_DEBUG); $sqlmodified = 0; // Replace for encrypt data if (preg_match_all('/__ENCRYPT\\(\'([^\']+)\'\\)__/i', $newsql, $reg)) { $num = count($reg[0]); for ($j = 0; $j < $num; $j++) { $from = $reg[0][$j]; $to = $db->encrypt($reg[1][$j], 1); $newsql = str_replace($from, $to, $newsql); } $sqlmodified++; } // Replace for decrypt data if (preg_match_all('/__DECRYPT\\(\'([A-Za-z0-9_]+)\'\\)__/i', $newsql, $reg)) { $num = count($reg[0]); for ($j = 0; $j < $num; $j++) { $from = $reg[0][$j]; $to = $db->decrypt($reg[1][$j]); $newsql = str_replace($from, $to, $newsql); } $sqlmodified++; } // Replace __x__ with rowid of insert nb x while (preg_match('/__([0-9]+)__/', $newsql, $reg)) { $cursor = $reg[1]; if (empty($listofinsertedrowid[$cursor])) { if (!$silent) { print '<tr><td valign="top" colspan="2">'; } if (!$silent) { print '<div class="error">' . $langs->trans("FileIsNotCorrect") . "</div></td>"; } if (!$silent) { print '</tr>'; } $error++; break; } $from = '__' . $cursor . '__'; $to = $listofinsertedrowid[$cursor]; $newsql = str_replace($from, $to, $newsql); $sqlmodified++; } if ($sqlmodified) { dol_syslog('Admin.lib::run_sql New Request ' . ($i + 1), LOG_DEBUG); } $result = $db->query($newsql, $usesavepoint); if ($result) { if (!$silent) { print '<!-- Result = OK -->' . "\n"; } if (preg_replace('/insert into ([^\\s]+)/i', $newsql, $reg)) { $cursorinsert++; // It's an insert $table = preg_replace('/([^a-zA-Z_]+)/i', '', $reg[1]); $insertedrowid = $db->last_insert_id($table); $listofinsertedrowid[$cursorinsert] = $insertedrowid; dol_syslog('Admin.lib::run_sql Insert nb ' . $cursorinsert . ', done in table ' . $table . ', rowid is ' . $listofinsertedrowid[$cursorinsert], LOG_DEBUG); } // print '<td align="right">OK</td>'; } else { $errno = $db->errno(); if (!$silent) { print '<!-- Result = ' . $errno . ' -->' . "\n"; } // Define list of errors we accept (array $okerrors) $okerrors = array('DB_ERROR_TABLE_ALREADY_EXISTS', 'DB_ERROR_COLUMN_ALREADY_EXISTS', 'DB_ERROR_KEY_NAME_ALREADY_EXISTS', 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS', 'DB_ERROR_RECORD_ALREADY_EXISTS', 'DB_ERROR_NOSUCHTABLE', 'DB_ERROR_NOSUCHFIELD', 'DB_ERROR_NO_FOREIGN_KEY_TO_DROP', 'DB_ERROR_NO_INDEX_TO_DROP', 'DB_ERROR_CANNOT_CREATE', 'DB_ERROR_CANT_DROP_PRIMARY_KEY', 'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS'); if ($okerror == 'none') { $okerrors = array(); } // Is it an error we accept if (!in_array($errno, $okerrors)) { if (!$silent) { print '<tr><td valign="top" colspan="2">'; } if (!$silent) { print '<div class="error">' . $langs->trans("Error") . " " . $db->errno() . ": " . $newsql . "<br>" . $db->error() . "</div></td>"; } if (!$silent) { print '</tr>' . "\n"; } dol_syslog('Admin.lib::run_sql Request ' . ($i + 1) . " Error " . $db->errno() . " " . $newsql . "<br>" . $db->error(), LOG_ERR); $error++; } } if (!$silent) { print '</tr>' . "\n"; } } } if ($error == 0) { if (!$silent) { print '<tr><td>' . $langs->trans("ProcessMigrateScript") . '</td>'; } if (!$silent) { print '<td align="right">' . $langs->trans("OK") . '</td></tr>' . "\n"; } $ok = 1; } else { if (!$silent) { print '<tr><td>' . $langs->trans("ProcessMigrateScript") . '</td>'; } if (!$silent) { print '<td align="right"><font class="error">' . $langs->trans("KO") . '</font></td></tr>' . "\n"; } $ok = 0; } return $ok; }
} print '</div>'; if ($action == 'delete') { print $form->formconfirm($_SERVER["PHP_SELF"] . '?&id=' . $numsondage, $langs->trans("RemovePoll"), $langs->trans("ConfirmRemovalOfPoll", $id), 'delete_confirm', '', '', 1); } print '<br>'; print '<form name="formulaire5" action="#" method="POST">' . "\n"; print_fiche_titre($langs->trans("CommentsOfVoters"), '', ''); // Comment list $comments = $object->getComments(); if ($comments) { foreach ($comments as $comment) { if ($user->rights->opensurvey->write) { print '<a href="' . dol_buildpath('/opensurvey/card.php', 1) . '?deletecomment=' . $comment->id_comment . '&id=' . $numsondage . '"> ' . img_picto('', 'delete.png') . '</a> '; } print dol_htmlentities($comment->usercomment) . ': ' . dol_nl2br(dol_htmlentities($comment->comment)) . " <br>"; } } else { print $langs->trans("NoCommentYet") . '<br>'; } print '<br>'; // Add comment if ($object->allow_comments) { print $langs->trans("AddACommentForPoll") . '<br>'; print '<textarea name="comment" rows="2" cols="80"></textarea><br>' . "\n"; print $langs->trans("Name") . ': <input type="text" name="commentuser" value="' . $user->getFullName($langs) . '"><br>' . "\n"; print '<input type="submit" class="button" name="ajoutcomment" value="' . dol_escape_htmltag($langs->trans("AddComment")) . '"><br>' . "\n"; if (isset($erreur_commentaire_vide) && $erreur_commentaire_vide == "yes") { print "<font color=#FF0000>" . $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")) . "</font>"; } }
$return = array(); if ($db->num_rows($query)) { $productstatic = new Product($db); while ($objp = $db->fetch_object($query)) { $var = !$var; $productstatic->id = $objp->rowid; $productstatic->ref = $objp->ref; $productstatic->label = $objp->label; $productstatic->type = $objp->fk_product_type; $productstatic->entity = $objp->entity; print "<tr " . $bc[$var] . ">"; print '<td class="nowrap">'; print $productstatic->getNomUrl(1); print '</td>'; print '<td align="center">'; print dol_trunc(dol_htmlentities($objp->label), 30); print '</td>'; print '<td align="right" class="nowrap">' . dol_print_date($objp->tms) . '</td>'; print '</tr>'; } } print '</table>'; } /* * Last supplier orders */ $orderstatic = new CommandeFournisseur($db); if ($user->rights->fournisseur->commande->lire) { // TODO move to DAO class // Check if there are supplier orders billable $sql2 = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_supplier,';
/** * Return a HTML area with the reference of object and a navigation bar for a business object * To add a particular filter on select, you must set $object->next_prev_filter to SQL criteria. * * @param object $object Object to show * @param string $paramid Name of parameter to use to name the id into the URL link * @param string $morehtml More html content to output just before the nav bar * @param int $shownav Show Condition (navigation is shown if value is 1) * @param string $fieldid Nom du champ en base a utiliser pour select next et previous * @param string $fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous * @param string $morehtmlref Code html supplementaire a afficher apres ref * @param string $moreparam More param to add in nav link url. * @param int $nodbprefix Do not include DB prefix to forge table name * @return string Portion HTML avec ref + boutons nav */ function showrefnav($object, $paramid, $morehtml = '', $shownav = 1, $fieldid = 'rowid', $fieldref = 'ref', $morehtmlref = '', $moreparam = '', $nodbprefix = 0) { global $langs, $conf; $ret = ''; if (empty($fieldid)) { $fieldid = 'rowid'; } if (empty($fieldref)) { $fieldref = 'ref'; } //print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam"; $object->load_previous_next_ref(isset($object->next_prev_filter) ? $object->next_prev_filter : '', $fieldid, $nodbprefix); $previous_ref = $object->ref_previous ? '<a data-role="button" data-icon="arrow-l" data-iconpos="left" href="' . $_SERVER["PHP_SELF"] . '?' . $paramid . '=' . urlencode($object->ref_previous) . $moreparam . '">' . (empty($conf->dol_use_jmobile) ? img_picto($langs->trans("Previous"), 'previous.png') : ' ') . '</a>' : ''; $next_ref = $object->ref_next ? '<a data-role="button" data-icon="arrow-r" data-iconpos="right" href="' . $_SERVER["PHP_SELF"] . '?' . $paramid . '=' . urlencode($object->ref_next) . $moreparam . '">' . (empty($conf->dol_use_jmobile) ? img_picto($langs->trans("Next"), 'next.png') : ' ') . '</a>' : ''; //print "xx".$previous_ref."x".$next_ref; if ($previous_ref || $next_ref || $morehtml) { $ret .= '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">'; } $ret .= dol_htmlentities($object->{$fieldref}); if ($morehtmlref) { $ret .= ' ' . $morehtmlref; } if ($morehtml) { $ret .= '</td><td class="paddingrightonly" align="right">' . $morehtml; } if ($shownav && ($previous_ref || $next_ref)) { $ret .= '</td><td class="nobordernopadding" align="center" width="20">' . $previous_ref . '</td>'; $ret .= '<td class="nobordernopadding" align="center" width="20">' . $next_ref; } if ($previous_ref || $next_ref || $morehtml) { $ret .= '</td></tr></table>'; } return $ret; }
/** * Return a HTML area with the reference of object and a navigation bar for a business object * To add a particular filter on select, you must set $object->next_prev_filter to SQL criteria. * * @param object $object Object to show * @param string $paramid Name of parameter to use to name the id into the URL next/previous link * @param string $morehtml More html content to output just before the nav bar * @param int $shownav Show Condition (navigation is shown if value is 1) * @param string $fieldid Nom du champ en base a utiliser pour select next et previous (we make the select max and min on this field) * @param string $fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous * @param string $morehtmlref More html to show after ref * @param string $moreparam More param to add in nav link url. * @param int $nodbprefix Do not include DB prefix to forge table name * @param string $morehtmlleft More html code to show before ref * @param string $morehtmlright More html code to show before navigation arrows * @return string Portion HTML avec ref + boutons nav */ function showrefnav($object, $paramid, $morehtml = '', $shownav = 1, $fieldid = 'rowid', $fieldref = 'ref', $morehtmlref = '', $moreparam = '', $nodbprefix = 0, $morehtmlleft = '', $morehtmlright = '') { global $langs, $conf; $ret = ''; if (empty($fieldid)) { $fieldid = 'rowid'; } if (empty($fieldref)) { $fieldref = 'ref'; } //print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam"; $object->load_previous_next_ref(isset($object->next_prev_filter) ? $object->next_prev_filter : '', $fieldid, $nodbprefix); //$previous_ref = $object->ref_previous?'<a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'">'.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Previous"),'previous.png'):' ').'</a>':''; //$next_ref = $object->ref_next?'<a data-role="button" data-icon="arrow-r" data-iconpos="right" href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'">'.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Next"),'next.png'):' ').'</a>':''; $previous_ref = $object->ref_previous ? '<a data-role="button" data-icon="arrow-l" data-iconpos="left" href="' . $_SERVER["PHP_SELF"] . '?' . $paramid . '=' . urlencode($object->ref_previous) . $moreparam . '">' . (empty($conf->dol_use_jmobile) ? '<' : ' ') . '</a>' : ''; $next_ref = $object->ref_next ? '<a data-role="button" data-icon="arrow-r" data-iconpos="right" href="' . $_SERVER["PHP_SELF"] . '?' . $paramid . '=' . urlencode($object->ref_next) . $moreparam . '">' . (empty($conf->dol_use_jmobile) ? '>' : ' ') . '</a>' : ''; //print "xx".$previous_ref."x".$next_ref; $ret .= '<div style="vertical-align: middle">'; $ret .= '<div class="inline-block floatleft">' . $morehtmlleft . '</div>'; $ret .= '<div class="inline-block floatleft valignmiddle refid' . ($shownav && ($previous_ref || $next_ref) ? ' refidpadding' : '') . '">'; // For thirdparty and contact, the ref is the id, so we show something else if ($object->element == 'societe') { $ret .= dol_htmlentities($object->name); } else { if (in_array($object->element, array('contact', 'user', 'member'))) { $ret .= dol_htmlentities($object->getFullName($langs)); } else { $ret .= dol_htmlentities($object->{$fieldref}); } } if ($morehtmlref) { $ret .= ' ' . $morehtmlref; } $ret .= '</div>'; if ($previous_ref || $next_ref || $morehtml) { $ret .= '<div class="pagination"><ul>'; } if ($morehtml) { $ret .= '<li class="noborder litext">' . $morehtml . '</li>'; } if ($shownav && ($previous_ref || $next_ref)) { $ret .= '<li class="pagination">' . $previous_ref . '</li>'; $ret .= '<li class="pagination">' . $next_ref . '</li>'; } if ($previous_ref || $next_ref || $morehtml) { $ret .= '</ul></div>'; } if ($morehtmlright) { $ret .= '<div class="statusref">' . $morehtmlright . '</div>'; } $ret .= '</div>'; return $ret; }
/** * This function is called to encode a string into a HTML string but differs from htmlentities because * a detection is done before to see if text is already HTML or not. Also, all entities but &,<,> are converted. * This permits to encode special chars to entities with no double encoding for already encoded HTML strings. * This function also remove last EOL or BR if $removelasteolbr=1 (default). * For PDF usage, you can show text by 2 ways: * - writeHTMLCell -> param must be encoded into HTML. * - MultiCell -> param must not be encoded into HTML. * Because writeHTMLCell convert also \n into <br>, if function * is used to build PDF, nl2brmode must be 1. * * @param string $stringtoencode String to encode * @param int $nl2brmode 0=Adding br before \n, 1=Replacing \n by br (for use with FPDF writeHTMLCell function for example) * @param string $pagecodefrom Pagecode stringtoencode is encoded * @param int $removelasteolbr 1=Remove last br or lasts \n (default), 0=Do nothing * @return string String encoded */ function dol_htmlentitiesbr($stringtoencode, $nl2brmode = 0, $pagecodefrom = 'UTF-8', $removelasteolbr = 1) { $newstring = $stringtoencode; if (dol_textishtml($stringtoencode)) { $newstring = preg_replace('/<br(\\s[\\sa-zA-Z_="]*)?\\/?>/i', '<br>', $newstring); // Replace "<br type="_moz" />" by "<br>". It's same and avoid pb with FPDF. if ($removelasteolbr) { $newstring = preg_replace('/<br>$/i', '', $newstring); } // Remove last <br> (remove only last one) $newstring = strtr($newstring, array('&' => '__and__', '<' => '__lt__', '>' => '__gt__', '"' => '__dquot__')); $newstring = dol_htmlentities($newstring, ENT_COMPAT, $pagecodefrom); // Make entity encoding $newstring = strtr($newstring, array('__and__' => '&', '__lt__' => '<', '__gt__' => '>', '__dquot__' => '"')); } else { if ($removelasteolbr) { $newstring = preg_replace('/(\\r\\n|\\r|\\n)$/i', '', $newstring); } // Remove last \n (may remove several) $newstring = dol_nl2br(dol_htmlentities($newstring, ENT_COMPAT, $pagecodefrom), $nl2brmode); } // Other substitutions that htmlentities does not do //$newstring=str_replace(chr(128),'€',$newstring); // 128 = 0x80. Not in html entity table. // Seems useles with TCPDF. Make bug with UTF8 languages return $newstring; }