diff --git a/dev/codesniffer/jenkins_ruleset.xml b/dev/codesniffer/jenkins_ruleset.xml index 4b96a48e5e8..a1ea07a3cb0 100755 --- a/dev/codesniffer/jenkins_ruleset.xml +++ b/dev/codesniffer/jenkins_ruleset.xml @@ -78,13 +78,13 @@ - + - + diff --git a/dev/codesniffer/ruleset.xml b/dev/codesniffer/ruleset.xml index 49cd7e3c2e9..4cd890871f8 100755 --- a/dev/codesniffer/ruleset.xml +++ b/dev/codesniffer/ruleset.xml @@ -78,13 +78,13 @@ - + - + diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index 7cebab29a03..07abdecf796 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -344,7 +344,7 @@ $formfile=new FormFile($db); $formfile->form_attach_new_file(DOL_URL_ROOT.'/admin/security_other.php',$langs->trans("FormToTestFileUploadForm"),0,0,1); -$db->close(); - llxFooter(); + +$db->close(); ?> diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 2ed8ac14ba2..2ac3afab931 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -464,10 +464,11 @@ class ActionComm extends CommonObject /** * Load all objects with filters * - * @param int $socid Filter by thirdparty - * @param int $fk_element Id of element action is linked to - * @param string $elementtype Type of element action is linked to - * @param filter Other filter + * @param int $socid Filter by thirdparty + * @param int $fk_element Id of element action is linked to + * @param string $elementtype Type of element action is linked to + * @param string $filter Other filter + * @return int <0 if KO, >0 if OK */ function getActions($socid=0, $fk_element=0, $elementtype='', $filter='') { @@ -732,7 +733,7 @@ class ActionComm extends CommonObject * @param string $type 'event' or 'journal' * @param int $cachedelay Do not rebuild file if date older than cachedelay seconds * @param string $filename Force filename - * @param filters Array of filters + * @param array $filters Array of filters * @return int <0 if error, nb of events in new file if ok */ function build_exportfile($format,$type,$cachedelay,$filename,$filters) diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index c3a3c52be06..bddd4802bc5 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -47,7 +47,7 @@ class ical function read_file($file) { $this->file = $file; - $file_text = join("", file ($file)); //load file + $file_text = join("", file($file)); //load file $file_text = preg_replace("/[\r\n]{1,} ([:;])/","\\1",$file_text); return $file_text; // return all text @@ -105,7 +105,7 @@ class ical switch ($text) // search special string { case "BEGIN:VTODO": - $this->todo_count = $this->todo_count+1; // new todo begin + $this->todo_count = $this->todo_count+1; // new to do begin $type = "VTODO"; break; @@ -157,9 +157,10 @@ class ical /** * Add to $this->ical array one value and key. Type is VTODO, VEVENT, VFREEBUSY, VCALENDAR ... . * - * @param string $type Type - * @param string $key Key - * @param string $value Value + * @param string $type Type + * @param string $key Key + * @param string $value Value + * @return void */ function add_to_array($type, $key, $value) { diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index f61a49bbc90..ef9d8a8bc32 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -798,12 +798,13 @@ llxFooter(); * @param int $year Year * @param int $monthshown Current month shown in calendar view * @param string $style Style to use for this day - * @param array $eventarray Array of events + * @param array &$eventarray Array of events * @param int $maxPrint Nb of actions to show each day on month view (0 means non limit) * @param int $maxnbofchar Nb of characters to show for event line * @param string $newparam Parameters on current URL * @param int $showinfo Add extended information (used by day view) * @param int $minheight Minimum height for each event. 60px by default. + * @return void */ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxPrint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60) { diff --git a/htdocs/core/ajax/fileupload.php b/htdocs/core/ajax/fileupload.php index ec07af6971c..bd3d2b32ef5 100644 --- a/htdocs/core/ajax/fileupload.php +++ b/htdocs/core/ajax/fileupload.php @@ -48,7 +48,8 @@ $element = GETPOST('element'); /** - * + * \file htdocs/core/ajax/fileupload.php + * \brief This class is used to manage file upload using ajax */ class UploadHandler { @@ -56,6 +57,7 @@ class UploadHandler private $fk_elment; private $element; + /** * Constructor * @@ -107,7 +109,7 @@ class UploadHandler /** * Enter description here ... * - * @param string $file_name + * @param string $file_name Filename * @return stdClass|NULL */ private function get_file_object($file_name) @@ -136,18 +138,20 @@ class UploadHandler /** * Enter description here ... + * + * @return void */ private function get_file_objects() { - return array_values(array_filter(array_map( - array($this, 'get_file_object'), - scandir($this->options['upload_dir']) - ))); + return array_values(array_filter(array_map(array($this, 'get_file_object'), scandir($this->options['upload_dir'])))); } /** * Create thumbs - * options is array('max_width', 'max_height') + * + * @param string $file_name Filename + * @param string $options is array('max_width', 'max_height') + * @return void */ private function create_scaled_image($file_name, $options) { @@ -177,9 +181,9 @@ class UploadHandler /** * Enter description here ... * - * @param unknown_type $uploaded_file - * @param unknown_type $file - * @param unknown_type $error + * @param string $uploaded_file Uploade file + * @param string $file File + * @param string $error Error * @return unknown|string */ private function has_error($uploaded_file, $file, $error) @@ -216,11 +220,11 @@ class UploadHandler /** * Enter description here ... * - * @param unknown_type $uploaded_file - * @param unknown_type $name - * @param unknown_type $size - * @param unknown_type $type - * @param unknown_type $error + * @param string $uploaded_file Uploade file + * @param string $name Name + * @param int $size Size + * @param string $type Type + * @param string $error Error * @return stdClass */ private function handle_file_upload($uploaded_file, $name, $size, $type, $error) @@ -284,7 +288,9 @@ class UploadHandler } /** - * Enter description here ... + * Output data + * + * @return void */ public function get() { @@ -300,7 +306,9 @@ class UploadHandler } /** - * Enter description here ... + * Output data + * + * @return void */ public function post() { @@ -317,24 +325,18 @@ class UploadHandler foreach ($upload['tmp_name'] as $index => $value) { $info[] = $this->handle_file_upload( $upload['tmp_name'][$index], - isset($_SERVER['HTTP_X_FILE_NAME']) ? - $_SERVER['HTTP_X_FILE_NAME'] : $upload['name'][$index], - isset($_SERVER['HTTP_X_FILE_SIZE']) ? - $_SERVER['HTTP_X_FILE_SIZE'] : $upload['size'][$index], - isset($_SERVER['HTTP_X_FILE_TYPE']) ? - $_SERVER['HTTP_X_FILE_TYPE'] : $upload['type'][$index], + isset($_SERVER['HTTP_X_FILE_NAME']) ? $_SERVER['HTTP_X_FILE_NAME'] : $upload['name'][$index], + isset($_SERVER['HTTP_X_FILE_SIZE']) ? $_SERVER['HTTP_X_FILE_SIZE'] : $upload['size'][$index], + isset($_SERVER['HTTP_X_FILE_TYPE']) ? $_SERVER['HTTP_X_FILE_TYPE'] : $upload['type'][$index], $upload['error'][$index] ); } } else { $info[] = $this->handle_file_upload( $upload['tmp_name'], - isset($_SERVER['HTTP_X_FILE_NAME']) ? - $_SERVER['HTTP_X_FILE_NAME'] : $upload['name'], - isset($_SERVER['HTTP_X_FILE_SIZE']) ? - $_SERVER['HTTP_X_FILE_SIZE'] : $upload['size'], - isset($_SERVER['HTTP_X_FILE_TYPE']) ? - $_SERVER['HTTP_X_FILE_TYPE'] : $upload['type'], + isset($_SERVER['HTTP_X_FILE_NAME']) ? $_SERVER['HTTP_X_FILE_NAME'] : $upload['name'], + isset($_SERVER['HTTP_X_FILE_SIZE']) ? $_SERVER['HTTP_X_FILE_SIZE'] : $upload['size'], + isset($_SERVER['HTTP_X_FILE_TYPE']) ? $_SERVER['HTTP_X_FILE_TYPE'] : $upload['type'], $upload['error'] ); } @@ -349,7 +351,9 @@ class UploadHandler } /** - * Enter description here ... + * Delete uploaded file + * + * @return void */ public function delete() { diff --git a/htdocs/core/ajax/ziptown.php b/htdocs/core/ajax/ziptown.php index 38c403d878e..9c8b45dc7ff 100644 --- a/htdocs/core/ajax/ziptown.php +++ b/htdocs/core/ajax/ziptown.php @@ -116,7 +116,7 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town'])) $row_array['value'] = $row['town']; $row_array['zipcode'] = $row['zip']; } - $row_array['departement_id'] = $row['fk_county']; // TODO deprecated + $row_array['departement_id'] = $row['fk_county']; // deprecated $row_array['selectcountry_id'] = $row['fk_country']; $row_array['state_id'] = $row['fk_county']; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 787e83882ba..eff452e6ff2 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -58,73 +58,81 @@ class FormFile * @param int $sectionid If upload must be done inside a particular ECM section * @param int $perm Value of permission to allow upload * @param int $size Length of input file area + * @param Object $object Object to use (when attachment is done on an element) * @return int <0 if KO, >0 if OK */ - function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50) + function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='') { global $conf,$langs; - $maxlength=$size; - - print "\n\n\n"; - - if (empty($title)) $title=$langs->trans("AttachANewFile"); - if ($title != 'none') print_titre($title); - - print '
'; - print ''; - print ''; - - print ''; - print '"; - print "
'; - - $max=$conf->global->MAIN_UPLOAD_DOC; // En Kb - $maxphp=@ini_get('upload_max_filesize'); // En inconnu - if (preg_match('/m$/i',$maxphp)) $maxphp=$maxphp*1024; - if (preg_match('/k$/i',$maxphp)) $maxphp=$maxphp; - // Now $max and $maxphp are in Kb - if ($maxphp > 0) $max=min($max,$maxphp); - - if ($max > 0) + if ($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) { - print ''; - } - print 'global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled="disabled"':''); - print '>'; - print '   '; - print 'global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled="disabled"':''); - print '>'; - - if ($addcancel) - { - print '   '; - print ''; - } - - if (! empty($conf->global->MAIN_UPLOAD_DOC)) - { - if ($perm) - { - print ' ('.$langs->trans("MaxSize").': '.$max.' '.$langs->trans("Kb"); - print ' '.info_admin($langs->trans("ThisLimitIsDefinedInSetup",$max,$maxphp),1); - print ')'; - } + return $this->_form_ajaxfileupload($object); } else { - print ' ('.$langs->trans("UploadDisabled").')'; + $maxlength=$size; + + print "\n\n\n"; + + if (empty($title)) $title=$langs->trans("AttachANewFile"); + if ($title != 'none') print_titre($title); + + print ''; + print ''; + print ''; + + print ''; + print '"; + print "
'; + + $max=$conf->global->MAIN_UPLOAD_DOC; // En Kb + $maxphp=@ini_get('upload_max_filesize'); // En inconnu + if (preg_match('/m$/i',$maxphp)) $maxphp=$maxphp*1024; + if (preg_match('/k$/i',$maxphp)) $maxphp=$maxphp; + // Now $max and $maxphp are in Kb + if ($maxphp > 0) $max=min($max,$maxphp); + + if ($max > 0) + { + print ''; + } + print 'global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled="disabled"':''); + print '>'; + print '   '; + print 'global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled="disabled"':''); + print '>'; + + if ($addcancel) + { + print '   '; + print ''; + } + + if (! empty($conf->global->MAIN_UPLOAD_DOC)) + { + if ($perm) + { + print ' ('.$langs->trans("MaxSize").': '.$max.' '.$langs->trans("Kb"); + print ' '.info_admin($langs->trans("ThisLimitIsDefinedInSetup",$max,$maxphp),1); + print ')'; + } + } + else + { + print ' ('.$langs->trans("UploadDisabled").')'; + } + print "
"; + + print ''; + if (empty($sectionid)) print '
'; + + print "\n\n\n"; + + return 1; } - print "
"; - - print ''; - if (empty($sectionid)) print '
'; - - print "\n\n\n"; - - return 1; } /** @@ -723,12 +731,13 @@ class FormFile } /** - * Show form to upload a new file with jquery fileupload + * Show form to upload a new file with jquery fileupload. + * This form use the fileupload.php file. * * @param Object $object Object to use * @return void */ - function form_ajaxfileupload($object) + private function _form_ajaxfileupload($object) { global $langs; diff --git a/htdocs/ecm/docdir.php b/htdocs/ecm/docdir.php index 162d55c4a2b..25f685f47ae 100644 --- a/htdocs/ecm/docdir.php +++ b/htdocs/ecm/docdir.php @@ -158,7 +158,7 @@ if ($_GET["action"] == 'create') // Label print ''.$langs->trans("Label").''."\n"; - print ''.$langs->trans ("AddIn").''; + print ''.$langs->trans("AddIn").''; print $formecm->select_all_sections(! empty($_GET["catParent"])?$_GET["catParent"]:$ecmdir->fk_parent,'catParent'); print ''."\n"; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index f78e790f531..e9fd3cfbd76 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -51,7 +51,7 @@ class Expedition extends CommonObject var $origin; var $origin_id; var $lines=array(); - var $expedition_method_id; // TODO deprecated + var $expedition_method_id; // deprecated var $shipping_method_id; var $tracking_number; var $tracking_url; diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 6f926b195bb..dc3f4e3c61e 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -69,11 +69,12 @@ class Export { global $langs,$conf,$mysoc; - dol_syslog("Export::load_arrays user=".$user->id." filter=".$filter); + dol_syslog(get_class($this)."::load_arrays user=".$user->id." filter=".$filter); $var=true; $i=0; + // Define list of modules directories into modulesdir foreach ($conf->file->dol_document_root as $type => $dirroot) { $modulesdir[] = $dirroot . "/core/modules/"; @@ -188,7 +189,7 @@ class Export $this->array_export_sql_end[$i]=$module->export_sql_end[$r]; //$this->array_export_sql[$i]=$module->export_sql[$r]; - dol_syslog("Export loaded for module ".$modulename." with index ".$i.", dataset=".$module->export_code[$r].", nb of fields=".count($module->export_fields_code[$r])); + dol_syslog(get_class($this)."::load_arrays loaded for module ".$modulename." with index ".$i.", dataset=".$module->export_code[$r].", nb of fields=".count($module->export_fields_code[$r])); $i++; // } } diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 569d04408fd..0670724d264 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -800,8 +800,9 @@ llxFooter(); /** * Return table name of an alias. For this, we look for the "tablename as alias" in sql string. * - * @param code Alias.Fieldname - * @param sqlmaxforexport SQL request to parse + * @param string $code Alias.Fieldname + * @param string $sqlmaxforexport SQL request to parse + * @return string Table name of field */ function getablenamefromfield($code,$sqlmaxforexport) { diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index c8ced73a08d..ca3eb2cbbb1 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -207,9 +207,9 @@ class Fichinter extends CommonObject /** * Fetch a intervention * - * @param int $id Id of intervention - * @param string $ref Ref of intervention - * @return int <0 if ko, >0 if ok + * @param int $rowid Id of intervention + * @param string $ref Ref of intervention + * @return int <0 if KO, >0 if OK */ function fetch($rowid,$ref='') { @@ -389,6 +389,7 @@ class Fichinter extends CommonObject /** * Returns the label status + * * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label */ @@ -445,8 +446,8 @@ class Fichinter extends CommonObject /** * Return clicable name (with picto eventually) * - * @param int withpicto 0=_No picto, 1=Includes the picto in the linkn, 2=Picto only - * @return string String with URL + * @param int $withpicto 0=_No picto, 1=Includes the picto in the linkn, 2=Picto only + * @return string String with URL */ function getNomUrl($withpicto=0) { @@ -520,7 +521,8 @@ class Fichinter extends CommonObject /** * Information sur l'objet fiche intervention * - * @param int $id id de la fiche d'intervention + * @param int $id Id de la fiche d'intervention + * @return void */ function info($id) { @@ -570,7 +572,8 @@ class Fichinter extends CommonObject /** * Delete intervetnion * - * @param User $user Object user who deletes + * @param User $user Object user who delete + * @return int <0 if KO, >0 if OK */ function delete($user) { @@ -875,8 +878,9 @@ class FichinterLigne /** - * Constructeur d'objets ligne d'intervention - * @param DoliDB $DB handler d'acces base de donnee + * Constructor + * + * @param DoliDB $DB Database handler */ function FichinterLigne($DB) { @@ -886,7 +890,8 @@ class FichinterLigne /** * Retrieve the line of intervention * - * @param int $rowid line id + * @param int $rowid Line id + * @return int <0 if KO, >0 if OK */ function fetch($rowid) { diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 52d07817a06..99c5e282bbf 100755 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -85,7 +85,7 @@ if ($search_desc) $sql .= " AND (f.description like '%".$db->escape($search_d if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND s.rowid = " . $socid; $sql.= " ORDER BY ".$sortfield." ".$sortorder; -$sql.= $db->plimit($limit + 1 ,$offset); +$sql.= $db->plimit($limit+1, $offset); $result=$db->query($sql); if ($result) diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index 9a5f670c652..d4eea8f36a9 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -36,7 +36,17 @@ define("NOLOGIN",1); // This means this output page does not require to be logg define("NOCSRFCHECK",1); // We accept to go on this page from external web site. // C'est un wrapper, donc header vierge +/** + * Header function + * + * @return void + */ function llxHeaderVierge() { print 'Export agenda cal'; } +/** + * Footer function + * + * @return void + */ function llxFooterVierge() { print ''; } require("../../main.inc.php"); diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 893b35ac9ea..b009c9694b0 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -340,8 +340,8 @@ llxFooterVierge(); /** * Show header for demo * - * @param string $title - * @param string $head + * @param string $title Title + * @param string $head Head string * @return void */ function llxHeaderVierge($title, $head = "") diff --git a/htdocs/public/donations/donateurs_code.php b/htdocs/public/donations/donateurs_code.php index e2992904f12..12fa44d9fc9 100644 --- a/htdocs/public/donations/donateurs_code.php +++ b/htdocs/public/donations/donateurs_code.php @@ -25,7 +25,17 @@ define("NOLOGIN",1); // This means this output page does not require to be logg define("NOCSRFCHECK",1); // We accept to go on this page from external web site. // C'est un wrapper, donc header vierge +/** + * Header function + * + * @return void + */ function llxHeaderVierge() { print 'Export agenda cal'; } +/** + * Header function + * + * @return void + */ function llxFooterVierge() { print ''; } require("../../main.inc.php"); diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 4b7057125c4..3dd92a3947d 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -211,14 +211,7 @@ if ($socid > 0) $formfile=new FormFile($db); // Show upload form - if ($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) - { - $formfile->form_ajaxfileupload($object); - } - else - { - $formfile->form_attach_new_file($_SERVER["PHP_SELF"].'?socid='.$socid,'',0,0,$user->rights->societe->creer); - } + $formfile->form_attach_new_file($_SERVER["PHP_SELF"].'?socid='.$socid,'',0,0,$user->rights->societe->creer,50,$object); // List of document $param='&socid='.$object->id;