From 3383d314c9ebb21499591f8ed0622c0bd3a724a9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Mar 2012 17:18:11 +0100 Subject: [PATCH] Doxygen --- htdocs/admin/external_rss.php | 2 +- htdocs/comm/propal/class/propal.class.php | 43 +- htdocs/core/boxes/box_external_rss.php | 3 +- htdocs/core/boxes/box_prospect.php | 9 +- htdocs/core/class/canvas.class.php | 4 +- .../core/class/commondocgenerator.class.php | 15 +- htdocs/core/class/commonobject.class.php | 6 +- htdocs/core/class/genericobject.class.php | 2 +- htdocs/core/class/hookmanager.class.php | 2 +- htdocs/core/class/html.form.class.php | 40 +- htdocs/core/class/html.formfile.class.php | 4 +- htdocs/core/class/html.formmail.class.php | 2 +- htdocs/core/class/infobox.class.php | 10 +- htdocs/core/class/interfaces.class.php | 2 +- htdocs/core/class/ldap.class.php | 82 +-- htdocs/core/class/rssparser.class.php | 24 +- .../browser/default/browser.php | 394 +++++------ .../browser/default/frmactualfolder.php | 235 +++---- .../browser/default/frmcreatefolder.php | 273 ++++---- .../browser/default/frmfolders.php | 449 ++++++------ .../browser/default/frmresourceslist.php | 411 +++++------ .../browser/default/frmupload.php | 275 ++++---- .../filemanagerdol/connectors/php/basexml.php | 203 +++--- .../connectors/php/commands.php | 598 ++++++++-------- .../filemanagerdol/connectors/php/config.php | 326 ++++----- .../connectors/php/connector.php | 174 ++--- .../core/filemanagerdol/connectors/php/io.php | 640 +++++++++--------- .../connectors/php/phpcompat.php | 33 +- .../filemanagerdol/connectors/php/upload.php | 134 ++-- .../filemanagerdol/connectors/php/util.php | 440 ++++++------ htdocs/core/lib/pdf.lib.php | 4 +- htdocs/core/login/functions_myopenid.php | 20 +- .../core/menus/smartphone/smartphone.lib.php | 41 +- .../smartphone/smartphone_backoffice.php | 6 +- .../smartphone/smartphone_frontoffice.php | 10 +- htdocs/core/menus/standard/auguria.lib.php | 28 +- htdocs/core/menus/standard/eldy.lib.php | 22 + htdocs/core/menus/standard/empty.php | 28 +- .../doc/pdf_expedition_merou.modules.php | 6 +- .../doc/pdf_expedition_rouget.modules.php | 2 +- .../expedition/mod_expedition_ribera.php | 2 +- .../expedition/mod_expedition_safor.php | 2 +- .../modules/facture/doc/pdf_crabe.modules.php | 4 +- .../facture/doc/pdf_oursin.modules.php | 11 +- .../modules/facture/mod_facture_mercure.php | 8 +- .../modules/facture/mod_facture_terre.php | 11 +- .../core/modules/facture/modules_facture.php | 6 +- .../livraison/mod_livraison_saphir.php | 2 +- .../societe/mod_codeclient_elephant.php | 9 +- .../modules/societe/mod_codeclient_monkey.php | 2 +- .../societe/mod_codecompta_aquarium.php | 18 +- .../pdf/pdf_canelle.modules.php | 17 +- .../interface_20_all_Logevents.class.php | 14 +- ...face_20_modPaypal_PaypalWorkflow.class.php | 12 +- ...e_20_modWorkflow_WorkflowManager.class.php | 13 +- ...terface_50_modAgenda_ActionsAuto.class.php | 12 +- ...interface_50_modLdap_Ldapsynchro.class.php | 12 +- ..._50_modNotification_Notification.class.php | 12 +- .../interface_90_all_Demo.class.php-NORUN | 13 +- htdocs/install/upgrade2.php | 12 +- htdocs/paypal/lib/paypal.lib.php | 10 +- htdocs/support/inc.php | 55 -- htdocs/support/index.php | 4 +- 63 files changed, 2674 insertions(+), 2589 deletions(-) diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index f95d6d5f0ac..11749b8de08 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -205,7 +205,7 @@ print ''; print ''; print ''.$langs->trans("Title").''; print ''; -print 'April,
LinuxFR,
Lolix'; +print 'An interesting RSS feed'; print ''; print ''; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 39a602eadc5..fd1b48bcd72 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -8,17 +8,17 @@ * Copyright (C) 2008 Raphael Bertrand * Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2010-2011 Philippe Grand - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ @@ -206,8 +206,8 @@ class Propal extends CommonObject /** * Adding line of fixed discount in the proposal in DB * - * @param int @idremise Id of fixed discount - * @return int >0 si ok, <0 si ko + * @param int $idremise Id of fixed discount + * @return int >0 if OK, <0 if KO */ function insert_discount($idremise) { @@ -723,22 +723,22 @@ class Propal extends CommonObject } $result = $this->addline( - $this->id, - $this->lines[$i]->desc, - $this->lines[$i]->subprice, - $this->lines[$i]->qty, - $this->lines[$i]->tva_tx, - $this->lines[$i]->localtax1_tx, - $this->lines[$i]->localtax2_tx, - $this->lines[$i]->fk_product, - $this->lines[$i]->remise_percent, - 'HT', - 0, - 0, - $this->lines[$i]->product_type, - $this->lines[$i]->rang, - $this->lines[$i]->special_code, - $fk_parent_line + $this->id, + $this->lines[$i]->desc, + $this->lines[$i]->subprice, + $this->lines[$i]->qty, + $this->lines[$i]->tva_tx, + $this->lines[$i]->localtax1_tx, + $this->lines[$i]->localtax2_tx, + $this->lines[$i]->fk_product, + $this->lines[$i]->remise_percent, + 'HT', + 0, + 0, + $this->lines[$i]->product_type, + $this->lines[$i]->rang, + $this->lines[$i]->special_code, + $fk_parent_line ); if ($result < 0) @@ -828,6 +828,7 @@ class Propal extends CommonObject /** * Insert into DB a proposal object completely defined by its data members (ex, results from copy). + * * @param User $user User that create * @return int Id of the new object if ok, <0 if ko * @see create diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php index 8a3e57a2141..51f197ec3fd 100644 --- a/htdocs/core/boxes/box_external_rss.php +++ b/htdocs/core/boxes/box_external_rss.php @@ -47,7 +47,8 @@ class box_external_rss extends ModeleBoxes /** * Constructor * - * @param DoliDB $db Database handler + * @param DoliDB $db Database handler + * @param string $param More parameters */ function box_external_rss($db,$param) { diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index e532f005091..87d2324013e 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -39,21 +39,22 @@ class box_prospect extends ModeleBoxes var $depends = array("societe"); var $db; - var $param; var $info_box_head = array(); var $info_box_contents = array(); + /** * Constructor + * + * @param DoliDB $db Database handler */ - function box_prospect($DB,$param) + function box_prospect($db) { global $langs; $langs->load("boxes"); - $this->db=$DB; - $this->param=$param; + $this->db=$db; $this->boxlabel=$langs->transnoentitiesnoconv("BoxLastProspects"); } diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index aff50c4de67..73713118b51 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -46,7 +46,7 @@ class Canvas /** * Constructor * - * @param DoliDB $DB Database handler + * @param DoliDB $db Database handler * @param string $actiontype Action type ('create', 'view', 'edit', 'list') */ function __construct($db, $actiontype='view') @@ -129,7 +129,7 @@ class Canvas * @return int 0=Canvas template file does not exist, 1=Canvas template file exists */ function displayCanvasExists($action) - { + { if (empty($this->template_dir)) return 0; if (file_exists($this->template_dir.($this->card?$this->card.'_':'').$this->action.'.tpl.php')) return 1; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index ed49e784dad..f906ea3c75e 100755 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -38,8 +38,9 @@ abstract class CommonDocGenerator /** * Define array with couple subtitution key => subtitution value * - * @param $user User - * @param $outputlangs Language object for output + * @param User $user User + * @param Translate $outputlangs Language object for output + * @return array Array of substitution key->code */ function get_substitutionarray_user($user,$outputlangs) { @@ -61,8 +62,9 @@ abstract class CommonDocGenerator /** * Define array with couple subtitution key => subtitution value * - * @param $mysoc - * @param $outputlangs Language object for output + * @param Societe $mysoc Object thirdparty + * @param Translate $outputlangs Language object for output + * @return array Array of substitution key->code */ function get_substitutionarray_mysoc($mysoc,$outputlangs) { @@ -103,8 +105,9 @@ abstract class CommonDocGenerator /** * Define array with couple subtitution key => subtitution value * - * @param $object - * @param $outputlangs Language object for output + * @param Object $object Object + * @param Translate $outputlangs Language object for output + * @return array Array of substitution key->code */ function get_substitutionarray_thirdparty($object,$outputlangs) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 679d380a40c..dc62d653afe 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2433,8 +2433,8 @@ abstract class CommonObject * * @param string $action GET/POST action * @param array $line Selected object line to output - * @param string $var Is it a an odd line - * @param int $num Number of line + * @param string $var Is it a an odd line (true) + * @param int $num Number of line (0) * @param int $i I * @param int $dateSelector 1=Show also date range input fields * @param string $seller Object of seller third party @@ -2443,7 +2443,7 @@ abstract class CommonObject * @param HookManager $hookmanager Hook manager * @return void */ - function printObjectLine($action,$line,$var=true,$num=0,$i=0,$dateSelector=0,$seller,$buyer,$selected=0,$hookmanager=false) + function printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected=0,$hookmanager=false) { global $conf,$langs,$user; global $form,$bc,$bcdd; diff --git a/htdocs/core/class/genericobject.class.php b/htdocs/core/class/genericobject.class.php index 06f8067f2b4..ace19b2a174 100755 --- a/htdocs/core/class/genericobject.class.php +++ b/htdocs/core/class/genericobject.class.php @@ -35,7 +35,7 @@ class GenericObject extends CommonObject /** * Constructor * - * @param DoliDB $DB Database handler + * @param DoliDB $db Database handler */ function __construct($db) { diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 5036e84c34f..1dc54c041b0 100755 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -44,7 +44,7 @@ class HookManager /** * Constructor * - * @param DoliDB $DB Handler acces base de donnees + * @param DoliDB $db Handler acces base de donnees */ function __construct($db) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c0941ba7c48..e64ba007246 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -389,7 +389,7 @@ class Form * Show a text with a picto and a tooltip on picto * * @param string $text Text to show - * @param string $htmltooltip Content of tooltip + * @param string $htmltext Content of tooltip * @param int $direction 1=Icon is after text, -1=Icon is before text, 0=no icon * @param string $type Type of picto (info, help, warning, superadmin...) * @param string $extracss Add a CSS style to td tags @@ -651,7 +651,7 @@ class Form * @param int $showempty Add an empty field * @param int $showtype Show third party type in combolist (customer, prospect or supplier) * @param int $forcecombo Force to use combo box - @param array $event Event options + * @param array $event Event options * @return string HTML string with */ function select_company($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0, $event=array()) @@ -811,7 +811,7 @@ class Form * @param int $socid Id ot third party or 0 for all * @param string $selected Id contact pre-selectionne * @param string $htmlname Name of HTML field ('none' for a not editable field) - * @param int $show_empty 0=no empty value, 1=add an empty value + * @param int $showempty 0=no empty value, 1=add an empty value * @param string $exclude List of contacts id to exclude * @param string $limitto Disable answers that are not id in this array list * @param string $showfunction Add function into label @@ -822,9 +822,9 @@ class Form function selectcontacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='', $options_only=false) { global $conf,$langs; - + $langs->load('companies'); - + $out=''; // On recherche les societes @@ -901,7 +901,7 @@ class Form { $out.= ''; } - + $this->num = $num; return $out; } @@ -1055,6 +1055,7 @@ class Form * @param int $status -1=Return all products, 0=Products not on sell, 1=Products on sell * @param int $finished 2=all, 1=finished, 0=raw material * @param string $selected_input_value Value of preselected input text (with ajax) + * @param int $hide_label Hide label * @return void */ function select_produits($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$status=1,$finished=2,$selected_input_value='',$hidelabel=0) @@ -1306,13 +1307,13 @@ class Form * Return list of products for customer (in Ajax if Ajax activated or go to select_produits_fournisseurs_do) * * @param int $socid Id third party - * @param string $selected Preselected product - * @param string $htmlname Name of HTML Select - * @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service) - * @param string $filtre For a SQL filter + * @param string $selected Preselected product + * @param string $htmlname Name of HTML Select + * @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service) + * @param string $filtre For a SQL filter * @return void */ - function select_produits_fournisseurs($socid,$selected='',$htmlname='productid',$filtertype='',$filtre) + function select_produits_fournisseurs($socid,$selected='',$htmlname='productid',$filtertype='',$filtre='') { global $langs,$conf; global $price_level, $status, $finished; @@ -1576,7 +1577,7 @@ class Form * @param int $showempty Add an empty field * @return void */ - function select_address($selected='', $socid, $htmlname='address_id',$showempty=0) + function select_address($selected, $socid, $htmlname='address_id',$showempty=0) { // On recherche les utilisateurs $sql = "SELECT a.rowid, a.label"; @@ -2064,6 +2065,7 @@ class Form * @param string $select_name HTML field name * @param int $maxlength Maximum length for labels * @param int $excludeafterid Exclude all categories after this leaf in category tree. + * @return void */ function select_all_categories($type, $selected='', $select_name="", $maxlength=64, $excludeafterid=0) { @@ -2606,7 +2608,7 @@ class Form * * @param string $page Page URL where form is shown * @param int $selected Value pre-selected - * @param string $htmlname Nom du formulaire select. Si none, non modifiable + * @param string $htmlname Nom du formulaire select. Si 'none', non modifiable. Example 'remise_id'. * @param int $socid Third party id * @param float $amount Total amount available * @param string $filter SQL filter on discounts @@ -2614,7 +2616,7 @@ class Form * @param string $more More string to add * @return void */ - function form_remise_dispo($page, $selected='', $htmlname='remise_id', $socid, $amount, $filter='', $maxvalue=0, $more='') + function form_remise_dispo($page, $selected, $htmlname, $socid, $amount, $filter='', $maxvalue=0, $more='') { global $conf,$langs; if ($htmlname != "none") @@ -2728,7 +2730,7 @@ class Form print ''; print ''; print ''; print ''; print '
'; - print $this->select_company($selected , $htmlname); + print $this->select_company($selected, $htmlname); print '
'; @@ -2855,7 +2857,7 @@ class Form * @param Societe $societe_acheteuse Object societe acheteuse * @param int $idprod Id product * @param int $info_bits Miscellaneous information on line - * @param type ''=Unknown, 0=Product, 1=Service (Used if idprod not defined) + * @param string $type ''=Unknown, 0=Product, 1=Service (Used if idprod not defined) * Si vendeur non assujeti a TVA, TVA par defaut=0. Fin de regle. * Si le (pays vendeur = pays acheteur) alors la TVA par defaut=TVA du produit vendu. Fin de regle. * Si (vendeur et acheteur dans Communaute europeenne) et bien vendu = moyen de transports neuf (auto, bateau, avion), TVA par defaut=0 (La TVA doit etre paye par l'acheteur au centre d'impots de son pays et non au vendeur). Fin de regle. @@ -3048,7 +3050,7 @@ class Form { $return.= $this->error; } - + $this->num = $num; return $return; } @@ -3428,7 +3430,7 @@ class Form /** * Return an html string with a select combo box to choose yes or no * - * @param string $name Name of html select field + * @param string $htmlname Name of html select field * @param string $value Pre-selected value * @param int $option 0 return yes/no, 1 return 1/0 * @param bool $disabled true or false @@ -3649,7 +3651,7 @@ class Form { global $dolibarr_main_url_root; $ret.=''; - $ret.='Photo found on Gravatar'; + $ret.='Photo found on Gravatar'; } else { diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 52287a01dc2..43f864dbd9d 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -66,7 +66,7 @@ class FormFile if ($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) { - return $this->_form_ajaxfileupload($object); + return $this->_formAjaxFileUpload($object); } else { @@ -779,7 +779,7 @@ class FormFile * @param Object $object Object to use * @return void */ - private function _form_ajaxfileupload($object) + private function _formAjaxFileUpload($object) { global $langs; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index a60c2ef21aa..cc904120cd5 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -71,7 +71,7 @@ class FormMail /** * Constructor * - * @param DoliDB $DB Database handler + * @param DoliDB $db Database handler */ function FormMail($db) { diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index 7baf404e808..622d364efd7 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -30,6 +30,7 @@ class InfoBox /** * Return array of boxes qualified for area and user * + * @param DoliDB $db Database handler * @param string $mode 'available' or 'activated' * @param string $zone Name or area (-1 for all, 0 for Homepage, 1 for xxx, ...) * @param User $user Objet user to filter (used only if $zone >= 0) @@ -140,10 +141,11 @@ class InfoBox /** * Save order of boxes for area and user * - * @param string $zone Name of area (0 for Homepage, ...) - * @param string $boxorder List of boxes with correct order 'A:123,456,...-B:789,321...' - * @param int $userid Id of user - * @return int <0 if KO, >= 0 if OK + * @param DoliDB $db Database handler + * @param string $zone Name of area (0 for Homepage, ...) + * @param string $boxorder List of boxes with correct order 'A:123,456,...-B:789,321...' + * @param int $userid Id of user + * @return int <0 if KO, >= 0 if OK */ static function saveboxorder($db, $zone,$boxorder,$userid=0) { diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php index d311c7bee4a..b64dcb58881 100644 --- a/htdocs/core/class/interfaces.class.php +++ b/htdocs/core/class/interfaces.class.php @@ -50,7 +50,7 @@ class Interfaces * @param string $action Trigger event code * @param Object $object Objet concern * @param User $user Objet user - * @param Lang $lang Objet lang + * @param Lang $langs Objet lang * @param Conf $conf Objet conf * @return int Nb of triggers ran if no error, -Nb of triggers with errors otherwise. */ diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index e564c78db28..3598497a3a9 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -141,7 +141,7 @@ class Ldap * anonymously, it creates an error code of -1. Returns true if connected, * false if failed. Takes an array of possible servers - if one doesn't work, * it tries the next and so on. - * + * * @return void * @deprecated Utiliser connect_bind a la place */ @@ -286,7 +286,7 @@ class Ldap /** * Simply closes the connection set up earlier. * Returns true if OK, false if there was an error. - * + * * @return boolean true or false */ function close() @@ -304,7 +304,7 @@ class Ldap /** * Anonymously binds to the connection. After this is done, * queries and searches can be done - but read-only. - * + * * @return boolean true or false */ function bind() @@ -329,12 +329,12 @@ class Ldap * like "uid=jbloggs,ou=People,dc=foo,dc=com". * * @param string $bindDn DN - * @param string $pass Password + * @param string $pass Password * @return boolean true or false */ function bindauth($bindDn,$pass) { - if (! $this->result = @ldap_bind( $this->connection,$bindDn,$pass)) + if (! $this->result = @ldap_bind($this->connection, $bindDn, $pass)) { $this->ldapErrorCode = ldap_errno($this->connection); $this->ldapErrorText = ldap_error($this->connection); @@ -349,7 +349,7 @@ class Ldap /** * Unbind du serveur ldap. - * + * * @return boolean true or false */ function unbind() @@ -365,7 +365,7 @@ class Ldap /** * Verification de la version du serveur ldap. - * + * * @return string version */ function getVersion() @@ -377,7 +377,7 @@ class Ldap /** * Change ldap protocol version to use. - * + * * @return string version */ function setVersion() { @@ -388,7 +388,7 @@ class Ldap /** * changement du referrals. - * + * * @return string referrals */ function setReferrals() { @@ -401,7 +401,7 @@ class Ldap /** * Add a LDAP entry * Ldap object connect and bind must have been done - * + * * @param string $dn DN entry key * @param string $info Attributes array * @param User $user Objet user that create @@ -453,7 +453,7 @@ class Ldap /** * Modify a LDAP entry * Ldap object connect and bind must have been done - * + * * @param string $dn DN entry key * @param string $info Attributes array * @param string $user Objet user that modify @@ -505,7 +505,7 @@ class Ldap /** * Modify a LDAP entry (to use if dn != olddn) * Ldap object connect and bind must have been done - * + * * @param string $dn DN entry key * @param string $info Attributes array * @param User $user Objet user that delete @@ -560,7 +560,7 @@ class Ldap /** * Delete a LDAP entry * Ldap object connect and bind must have been done - * + * * @param string $dn DN entry key * @return int <0 if KO, >0 if OK */ @@ -593,7 +593,7 @@ class Ldap /** * Build a LDAP message - * + * * @param string $dn DN entry key * @param string $info Attributes array * @return string Content of file @@ -635,7 +635,7 @@ class Ldap /** * Dump a LDAP message to ldapinput.in file - * + * * @param string $dn DN entry key * @param string $info Attributes array * @return int <0 if KO, >0 if OK @@ -672,7 +672,7 @@ class Ldap /** * Add a LDAP attribute in entry * Ldap object connect and bind must have been done - * + * * @param string $dn DN entry key * @param string $info Attributes array * @param User $user Objet user that create @@ -724,7 +724,7 @@ class Ldap /** * Update a LDAP attribute in entry * Ldap object connect and bind must have been done - * + * * @param string $dn DN entry key * @param string $info Attributes array * @param User $user Objet user that create @@ -776,7 +776,7 @@ class Ldap /** * Delete a LDAP attribute in entry * Ldap object connect and bind must have been done - * + * * @param string $dn DN entry key * @param string $info Attributes array * @param User $user Objet user that create @@ -827,10 +827,10 @@ class Ldap /** * Returns an array containing attributes and values for first record - * + * * @param string $dn DN entry key * @param string $filter Filter - * @return int <0 if KO, >0 if OK + * @return int <0 if KO, >0 if OK */ function getAttribute($dn,$filter) { @@ -859,7 +859,7 @@ class Ldap } // Get values - if (! $values = ldap_get_attributes( $this->connection, $entry)) + if (! $values = ldap_get_attributes($this->connection, $entry)) { $this->ldapErrorCode = ldap_errno($this->connection); $this->ldapErrorText = ldap_error($this->connection); @@ -872,7 +872,7 @@ class Ldap /** * Returns an array containing values for an attribute and for first record matching filterrecord - * + * * @param string $filterrecord Record * @param string $attribute Attributes * @return void @@ -898,7 +898,7 @@ class Ldap } // Get values - if (! $values = @ldap_get_values( $this->connection, $entry, $attribute)) + if (! $values = @ldap_get_values($this->connection, $entry, $attribute)) { $this->ldapErrorCode = ldap_errno($this->connection); $this->ldapErrorText = ldap_error($this->connection); @@ -912,7 +912,7 @@ class Ldap /** * Returns an array containing a details of elements * ldapsearch -LLLx -hlocalhost -Dcn=admin,dc=parinux,dc=org -w password -b "ou=adherents,ou=people,dc=parinux,dc=org" userPassword - * + * * @param string $search Valeur champ cle recherche, sinon '*' pour tous. * @param string $userDn DN (Ex: ou=adherents,ou=people,dc=parinux,dc=org) * @param string $useridentifier Name of key field (Ex: uid) @@ -1012,8 +1012,9 @@ class Ldap * Required by Active Directory * * @param string $hex + * @return string little endian */ - function littleEndian($hex) + function littleEndian($hex) { for ($x=dol_strlen($hex)-2; $x >= 0; $x=$x-2) { $result .= substr($hex,$x,2); @@ -1023,10 +1024,11 @@ class Ldap /** - * Recupere le SID de l'utilisateur + * Recupere le SID de l'utilisateur * Required by Active Directory - * + * * @param string $ldapuser Login de l'utilisateur + * @return string Sid */ function getObjectSid($ldapUser) { @@ -1056,7 +1058,7 @@ class Ldap if (!$entry) { - // Si pas de r�sultat on cherche dans le domaine + // Si pas de resultat on cherche dans le domaine $searchDN = $this->domain; $i++; } @@ -1069,7 +1071,7 @@ class Ldap if ($entry) { - $ldapBinary = ldap_get_values_len ($this->connection, $entry, "objectsid"); + $ldapBinary = ldap_get_values_len($this->connection, $entry, "objectsid"); $SIDText = $this->binSIDtoText($ldapBinary[0]); return $SIDText; } @@ -1083,11 +1085,11 @@ class Ldap /** * Returns the textual SID * Indispensable pour Active Directory - * + * * @param string $binsid Binary SID * @return string Textual SID */ - function binSIDtoText($binsid) + function binSIDtoText($binsid) { $hex_sid=bin2hex($binsid); $rev = hexdec(substr($hex_sid,0,2)); // Get revision-part of SID @@ -1109,9 +1111,9 @@ class Ldap * car conflit majuscule-minuscule. A n'utiliser que pour les pages * 'Fiche LDAP' qui affiche champ lisibles par defaut. * - * @param checkDn DN de recherche (Ex: ou=users,cn=my-domain,cn=com) - * @param filter Filtre de recherche (ex: (sn=nom_personne) ) - * @return array Tableau des reponses (cle en minuscule-valeur) + * @param string $checkDn DN de recherche (Ex: ou=users,cn=my-domain,cn=com) + * @param string $filter Filtre de recherche (ex: (sn=nom_personne) ) + * @return array Tableau des reponses (cle en minuscule-valeur) */ function search($checkDn, $filter) { @@ -1143,7 +1145,7 @@ class Ldap /** * Load all attribute of a LDAP user - * + * * @param User $user User to search for. Not used if a filter is provided. * @param string $filter Filter for search. Must start with &. * Examples: &(objectClass=inetOrgPerson) &(objectClass=user)(objectCategory=person) &(isMemberOf=cn=Sales,ou=Groups,dc=opencsi,dc=com) @@ -1238,10 +1240,10 @@ class Ldap /** * Returns the correct user identifier to use, based on the ldap server type - * - * @return string Login + * + * @return string Login */ - function getUserIdentifier() + function getUserIdentifier() { if ($this->serverType == "activedirectory") { return $this->attr_sambalogin; @@ -1256,7 +1258,7 @@ class Ldap * @param string $uacf UACF * @return void */ - function parseUACF($uacf) + function parseUACF($uacf) { //All flags array $flags = array( "TRUSTED_TO_AUTH_FOR_DELEGATION" => 16777216, @@ -1300,7 +1302,7 @@ class Ldap * @param string $samtype SamType * @return string Sam string */ - function parseSAT($samtype) + function parseSAT($samtype) { $stypes = array( 805306368 => "NORMAL_ACCOUNT", 805306369 => "WORKSTATION_TRUST", diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index dfa1cb857b4..06d3eb057c4 100755 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -25,18 +25,18 @@ class RssParser var $db; var $error; - protected $_format=''; - protected $_urlRSS; - protected $_language; - protected $_generator; - protected $_copyright; - protected $_lastbuilddate; - protected $_imageurl; - protected $_link; - protected $_title; - protected $_description; - protected $_lastfetchdate; // Last successful fetch - protected $_rssarray=array(); + private $_format=''; + private $_urlRSS; + private $_language; + private $_generator; + private $_copyright; + private $_lastbuilddate; + private $_imageurl; + private $_link; + private $_title; + private $_description; + private $_lastfetchdate; // Last successful fetch + private $_rssarray=array(); /** * getFormat diff --git a/htdocs/core/filemanagerdol/browser/default/browser.php b/htdocs/core/filemanagerdol/browser/default/browser.php index bd308aa4eda..497ab68055c 100755 --- a/htdocs/core/filemanagerdol/browser/default/browser.php +++ b/htdocs/core/filemanagerdol/browser/default/browser.php @@ -1,197 +1,197 @@ - - * Copyright (C) 2003-2010 Frederico Caldeira Knabben - * - * Source modified from part of fckeditor (http://www.fckeditor.net) - * retreived as GPL v2 or later - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -require('../../../../main.inc.php'); -?> - - - - FCKeditor - Resources Browser - - - - - - - - - - - - - - - - - + + * Copyright (C) 2003-2010 Frederico Caldeira Knabben + * + * Source modified from part of fckeditor (http://www.fckeditor.net) + * retreived as GPL v2 or later + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +require('../../../../main.inc.php'); +?> + + + + FCKeditor - Resources Browser + + + + + + + + + + + + + + + + + diff --git a/htdocs/core/filemanagerdol/browser/default/frmactualfolder.php b/htdocs/core/filemanagerdol/browser/default/frmactualfolder.php index 982143e0a28..d51a0043da8 100755 --- a/htdocs/core/filemanagerdol/browser/default/frmactualfolder.php +++ b/htdocs/core/filemanagerdol/browser/default/frmactualfolder.php @@ -1,117 +1,118 @@ - - * Copyright (C) 2003-2010 Frederico Caldeira Knabben - * - * Source modified from part of fckeditor (http://www.fckeditor.net) - * retreived as GPL v2 or later - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -require('../../../../main.inc.php'); ?> - - - - - Folder path - - - - - - - - - -
- -
- - + + * Copyright (C) 2003-2010 Frederico Caldeira Knabben + * + * Source modified from part of fckeditor (http://www.fckeditor.net) + * retreived as GPL v2 or later + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +require('../../../../main.inc.php'); +?> + + + + + Folder path + + + + + + + + + +
+ +
+ + diff --git a/htdocs/core/filemanagerdol/browser/default/frmcreatefolder.php b/htdocs/core/filemanagerdol/browser/default/frmcreatefolder.php index f90a81adc5b..867fecf73b4 100755 --- a/htdocs/core/filemanagerdol/browser/default/frmcreatefolder.php +++ b/htdocs/core/filemanagerdol/browser/default/frmcreatefolder.php @@ -1,136 +1,137 @@ - - * Copyright (C) 2003-2010 Frederico Caldeira Knabben - * - * Source modified from part of fckeditor (http://www.fckeditor.net) - * retreived as GPL v2 or later - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -require('../../../../main.inc.php'); ?> - - - - - Create Folder - - - - - - - - - - -
- -
- - + + * Copyright (C) 2003-2010 Frederico Caldeira Knabben + * + * Source modified from part of fckeditor (http://www.fckeditor.net) + * retreived as GPL v2 or later + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +require('../../../../main.inc.php'); +?> + + + + + Create Folder + + + + + + + + + + +
+ +
+ + diff --git a/htdocs/core/filemanagerdol/browser/default/frmfolders.php b/htdocs/core/filemanagerdol/browser/default/frmfolders.php index 3978fb2d1f3..ccb67f9ecf2 100755 --- a/htdocs/core/filemanagerdol/browser/default/frmfolders.php +++ b/htdocs/core/filemanagerdol/browser/default/frmfolders.php @@ -1,224 +1,225 @@ - - * Copyright (C) 2003-2010 Frederico Caldeira Knabben - * - * Source modified from part of fckeditor (http://www.fckeditor.net) - * retreived as GPL v2 or later - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -require('../../../../main.inc.php'); ?> - - - - - - Folders - - - - - - - - - - - -
- - + + * Copyright (C) 2003-2010 Frederico Caldeira Knabben + * + * Source modified from part of fckeditor (http://www.fckeditor.net) + * retreived as GPL v2 or later + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +require('../../../../main.inc.php'); +?> + + + + + + Folders + + + + + + + + + + + +
+ + diff --git a/htdocs/core/filemanagerdol/browser/default/frmresourceslist.php b/htdocs/core/filemanagerdol/browser/default/frmresourceslist.php index e065c4d7107..ff497db02c4 100755 --- a/htdocs/core/filemanagerdol/browser/default/frmresourceslist.php +++ b/htdocs/core/filemanagerdol/browser/default/frmresourceslist.php @@ -1,205 +1,206 @@ - - * Copyright (C) 2003-2010 Frederico Caldeira Knabben - * - * Source modified from part of fckeditor (http://www.fckeditor.net) - * retreived as GPL v2 or later - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -require('../../../../main.inc.php'); ?> - - - - - Resources - - - - - - - - + + * Copyright (C) 2003-2010 Frederico Caldeira Knabben + * + * Source modified from part of fckeditor (http://www.fckeditor.net) + * retreived as GPL v2 or later + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +require('../../../../main.inc.php'); +?> + + + + + Resources + + + + + + + + diff --git a/htdocs/core/filemanagerdol/browser/default/frmupload.php b/htdocs/core/filemanagerdol/browser/default/frmupload.php index a6ac4ddfa8b..20e30651eb5 100755 --- a/htdocs/core/filemanagerdol/browser/default/frmupload.php +++ b/htdocs/core/filemanagerdol/browser/default/frmupload.php @@ -1,137 +1,138 @@ - - * Copyright (C) 2003-2010 Frederico Caldeira Knabben - * - * Source modified from part of fckeditor (http://www.fckeditor.net) - * retreived as GPL v2 or later - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -require('../../../../main.inc.php'); ?> - - - - - File Upload - - - - - - -
- - - - -
- Upload a new file in this folder
- - - - - -
 
-
-
- - + + * Copyright (C) 2003-2010 Frederico Caldeira Knabben + * + * Source modified from part of fckeditor (http://www.fckeditor.net) + * retreived as GPL v2 or later + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +require('../../../../main.inc.php'); +?> + + + + + File Upload + + + + + + +
+ + + + +
+ Upload a new file in this folder
+ + + + + +
 
+
+
+ + diff --git a/htdocs/core/filemanagerdol/connectors/php/basexml.php b/htdocs/core/filemanagerdol/connectors/php/basexml.php index d0f377c34fc..4098375a255 100755 --- a/htdocs/core/filemanagerdol/connectors/php/basexml.php +++ b/htdocs/core/filemanagerdol/connectors/php/basexml.php @@ -1,99 +1,104 @@ -' ; - - // Create the main "Connector" node. - echo '' ; - - // Add the current folder node. - echo '' ; - - $GLOBALS['HeaderSent'] = true ; -} - -function CreateXmlFooter() -{ - echo '' ; -} - -function SendError( $number, $text ) -{ - if ( $_GET['Command'] == 'FileUpload' ) - SendUploadResults( $number, "", "", $text ); - - if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] ) - { - SendErrorNode( $number, $text ); - CreateXmlFooter(); - } - else - { - SetXmlHeaders(); - - // Create the XML document header - echo '' ; - - echo '' ; - - SendErrorNode( $number, $text ); - - echo '' ; - } - exit ; -} - -function SendErrorNode( $number, $text ) -{ - if ($text) - echo '' ; - else - echo '' ; -} -?> +' ; + + // Create the main "Connector" node. + echo '' ; + + // Add the current folder node. + echo '' ; + + $GLOBALS['HeaderSent'] = true ; +} + +function CreateXmlFooter() +{ + echo '' ; +} + +function SendError( $number, $text ) +{ + if ( $_GET['Command'] == 'FileUpload' ) + SendUploadResults( $number, "", "", $text ); + + if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] ) + { + SendErrorNode( $number, $text ); + CreateXmlFooter(); + } + else + { + SetXmlHeaders(); + + // Create the XML document header + echo '' ; + + echo '' ; + + SendErrorNode( $number, $text ); + + echo '' ; + } + exit ; +} + +function SendErrorNode( $number, $text ) +{ + if ($text) + echo '' ; + else + echo '' ; +} +?> diff --git a/htdocs/core/filemanagerdol/connectors/php/commands.php b/htdocs/core/filemanagerdol/connectors/php/commands.php index 1b7946848e8..8f3be8e07df 100755 --- a/htdocs/core/filemanagerdol/connectors/php/commands.php +++ b/htdocs/core/filemanagerdol/connectors/php/commands.php @@ -1,299 +1,299 @@ -' ; - } - closedir( $oCurrentFolder ); - } - - // Open the "Folders" node. - echo "" ; - - natcasesort( $aFolders ); - foreach ( $aFolders as $sFolder ) - echo $sFolder ; - - // Close the "Folders" node. - echo "" ; -} - -function GetFoldersAndFiles( $resourceType, $currentFolder ) -{ - // Map the virtual path to the local server path. - $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFoldersAndFiles' ); - - // Arrays that will hold the folders and files names. - $aFolders = array(); - $aFiles = array(); - - $oCurrentFolder = @opendir( $sServerDir ); - - if ($oCurrentFolder !== false) - { - while ( $sFile = readdir( $oCurrentFolder ) ) - { - if ( $sFile != '.' && $sFile != '..' ) - { - if ( is_dir( $sServerDir . $sFile ) ) - $aFolders[] = '' ; - else - { - $iFileSize = @filesize( $sServerDir . $sFile ); - if ( !$iFileSize ) { - $iFileSize = 0 ; - } - if ( $iFileSize > 0 ) - { - $iFileSize = round( $iFileSize / 1024 ); - if ( $iFileSize < 1 ) - $iFileSize = 1 ; - } - - $aFiles[] = '' ; - } - } - } - closedir( $oCurrentFolder ); - } - - // Send the folders - natcasesort( $aFolders ); - echo '' ; - - foreach ( $aFolders as $sFolder ) - echo $sFolder ; - - echo '' ; - - // Send the files - natcasesort( $aFiles ); - echo '' ; - - foreach ( $aFiles as $sFiles ) - echo $sFiles ; - - echo '' ; -} - -function CreateFolder( $resourceType, $currentFolder ) -{ - if (!isset($_GET)) { - global $_GET; - } - $sErrorNumber = '0' ; - $sErrorMsg = '' ; - - if ( isset( $_GET['NewFolderName'] ) ) - { - $sNewFolderName = $_GET['NewFolderName'] ; - $sNewFolderName = SanitizeFolderName( $sNewFolderName ); - - if ( strpos( $sNewFolderName, '..' ) !== FALSE ) - $sErrorNumber = '102' ; // Invalid folder name. - else - { - // Map the virtual path to the local server path of the current folder. - $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'CreateFolder' ); - - if ( is_writable( $sServerDir ) ) - { - $sServerDir .= $sNewFolderName ; - - $sErrorMsg = CreateServerFolder( $sServerDir ); - - switch ( $sErrorMsg ) - { - case '' : - $sErrorNumber = '0' ; - break ; - case 'Invalid argument' : - case 'No such file or directory' : - $sErrorNumber = '102' ; // Path too long. - break ; - default : - $sErrorNumber = '110' ; - break ; - } - } - else - $sErrorNumber = '103' ; - } - } - else - $sErrorNumber = '102' ; - - // Create the "Error" node. - echo '' ; -} - -// DOL_CHANGE -//function FileUpload( $resourceType, $currentFolder, $sCommand ) -function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') -{ - if (!isset($_FILES)) { - global $_FILES; - } - $sErrorNumber = '0' ; - $sFileName = '' ; - - if ( isset( $_FILES['NewFile'] ) && !is_null( $_FILES['NewFile']['tmp_name'] ) - # This is for the QuickUpload tab box - or (isset($_FILES['upload']) and !is_null($_FILES['upload']['tmp_name']))) - { - global $Config ; - - $oFile = isset($_FILES['NewFile']) ? $_FILES['NewFile'] : $_FILES['upload']; - - // Map the virtual path to the local server path. - $sServerDir = ServerMapFolder( $resourceType, $currentFolder, $sCommand ); - - // Get the uploaded file name. - $sFileName = $oFile['name'] ; - $sFileName = SanitizeFileName( $sFileName ); - - $sOriginalFileName = $sFileName ; - - // Get the extension. - $sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ); - $sExtension = strtolower( $sExtension ); - - if ( isset( $Config['SecureImageUploads'] ) ) - { - if ( ( $isImageValid = IsImageValid( $oFile['tmp_name'], $sExtension ) ) === false ) - { - $sErrorNumber = '202' ; - } - } - - if ( isset( $Config['HtmlExtensions'] ) ) - { - if ( !IsHtmlExtension( $sExtension, $Config['HtmlExtensions'] ) && - ( $detectHtml = DetectHtml( $oFile['tmp_name'] ) ) === true ) - { - $sErrorNumber = '202' ; - } - } - - // Check if it is an allowed extension. - if ( !$sErrorNumber && IsAllowedExt( $sExtension, $resourceType ) ) - { - $iCounter = 0 ; - - while ( true ) - { - $sFilePath = $sServerDir . $sFileName ; - - if ( is_file( $sFilePath ) ) - { - $iCounter++ ; - $sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ; - $sErrorNumber = '201' ; - } - else - { - move_uploaded_file( $oFile['tmp_name'], $sFilePath ); - - if ( is_file( $sFilePath ) ) - { - if ( isset( $Config['ChmodOnUpload'] ) && !$Config['ChmodOnUpload'] ) - { - break ; - } - - $permissions = 0777; - - if ( isset( $Config['ChmodOnUpload'] ) && $Config['ChmodOnUpload'] ) - { - $permissions = $Config['ChmodOnUpload'] ; - } - - $oldumask = umask(0); - chmod( $sFilePath, $permissions ); - umask( $oldumask ); - } - - break ; - } - } - - if ( file_exists( $sFilePath ) ) - { - //previous checks failed, try once again - if ( isset( $isImageValid ) && $isImageValid === -1 && IsImageValid( $sFilePath, $sExtension ) === false ) - { - @unlink( $sFilePath ); - $sErrorNumber = '202' ; - } - else if ( isset( $detectHtml ) && $detectHtml === -1 && DetectHtml( $sFilePath ) === true ) - { - @unlink( $sFilePath ); - $sErrorNumber = '202' ; - } - } - } - else - $sErrorNumber = '202' ; - } - else - $sErrorNumber = '202' ; - - - $sFileUrl = CombinePaths( GetResourceTypePath( $resourceType, $sCommand ) , $currentFolder ); - $sFileUrl = CombinePaths( $sFileUrl, $sFileName ); - - - // DOL_CHANGE - //SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName ); - if($CKEcallback == '') - { - // this line already exists so wrap the if block around it - SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName ); - } - else - { - //issue the CKEditor Callback - SendCKEditorResults ($CKEcallback, $sFileUrl, - ($sErrorNumber != 0 - ? 'Error '. $sErrorNumber. ' upload failed.' - : 'Upload Successful')); - } - - exit ; -} -?> +' ; + } + closedir( $oCurrentFolder ); + } + + // Open the "Folders" node. + echo "" ; + + natcasesort( $aFolders ); + foreach ( $aFolders as $sFolder ) + echo $sFolder ; + + // Close the "Folders" node. + echo "" ; +} + +function GetFoldersAndFiles( $resourceType, $currentFolder ) +{ + // Map the virtual path to the local server path. + $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFoldersAndFiles' ); + + // Arrays that will hold the folders and files names. + $aFolders = array(); + $aFiles = array(); + + $oCurrentFolder = @opendir( $sServerDir ); + + if ($oCurrentFolder !== false) + { + while ( $sFile = readdir( $oCurrentFolder ) ) + { + if ( $sFile != '.' && $sFile != '..' ) + { + if ( is_dir( $sServerDir . $sFile ) ) + $aFolders[] = '' ; + else + { + $iFileSize = @filesize( $sServerDir . $sFile ); + if ( !$iFileSize ) { + $iFileSize = 0 ; + } + if ( $iFileSize > 0 ) + { + $iFileSize = round( $iFileSize / 1024 ); + if ( $iFileSize < 1 ) + $iFileSize = 1 ; + } + + $aFiles[] = '' ; + } + } + } + closedir( $oCurrentFolder ); + } + + // Send the folders + natcasesort( $aFolders ); + echo '' ; + + foreach ( $aFolders as $sFolder ) + echo $sFolder ; + + echo '' ; + + // Send the files + natcasesort( $aFiles ); + echo '' ; + + foreach ( $aFiles as $sFiles ) + echo $sFiles ; + + echo '' ; +} + +function CreateFolder( $resourceType, $currentFolder ) +{ + if (!isset($_GET)) { + global $_GET; + } + $sErrorNumber = '0' ; + $sErrorMsg = '' ; + + if ( isset( $_GET['NewFolderName'] ) ) + { + $sNewFolderName = $_GET['NewFolderName'] ; + $sNewFolderName = SanitizeFolderName( $sNewFolderName ); + + if ( strpos( $sNewFolderName, '..' ) !== FALSE ) + $sErrorNumber = '102' ; // Invalid folder name. + else + { + // Map the virtual path to the local server path of the current folder. + $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'CreateFolder' ); + + if ( is_writable( $sServerDir ) ) + { + $sServerDir .= $sNewFolderName ; + + $sErrorMsg = CreateServerFolder( $sServerDir ); + + switch ( $sErrorMsg ) + { + case '' : + $sErrorNumber = '0' ; + break ; + case 'Invalid argument' : + case 'No such file or directory' : + $sErrorNumber = '102' ; // Path too long. + break ; + default : + $sErrorNumber = '110' ; + break ; + } + } + else + $sErrorNumber = '103' ; + } + } + else + $sErrorNumber = '102' ; + + // Create the "Error" node. + echo '' ; +} + +// DOL_CHANGE +//function FileUpload( $resourceType, $currentFolder, $sCommand ) +function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') +{ + if (!isset($_FILES)) { + global $_FILES; + } + $sErrorNumber = '0' ; + $sFileName = '' ; + + if ( isset( $_FILES['NewFile'] ) && !is_null( $_FILES['NewFile']['tmp_name'] ) + # This is for the QuickUpload tab box + or (isset($_FILES['upload']) and !is_null($_FILES['upload']['tmp_name']))) + { + global $Config ; + + $oFile = isset($_FILES['NewFile']) ? $_FILES['NewFile'] : $_FILES['upload']; + + // Map the virtual path to the local server path. + $sServerDir = ServerMapFolder( $resourceType, $currentFolder, $sCommand ); + + // Get the uploaded file name. + $sFileName = $oFile['name'] ; + $sFileName = SanitizeFileName( $sFileName ); + + $sOriginalFileName = $sFileName ; + + // Get the extension. + $sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ); + $sExtension = strtolower( $sExtension ); + + if ( isset( $Config['SecureImageUploads'] ) ) + { + if ( ( $isImageValid = IsImageValid( $oFile['tmp_name'], $sExtension ) ) === false ) + { + $sErrorNumber = '202' ; + } + } + + if ( isset( $Config['HtmlExtensions'] ) ) + { + if ( !IsHtmlExtension( $sExtension, $Config['HtmlExtensions'] ) && + ( $detectHtml = DetectHtml( $oFile['tmp_name'] ) ) === true ) + { + $sErrorNumber = '202' ; + } + } + + // Check if it is an allowed extension. + if ( !$sErrorNumber && IsAllowedExt( $sExtension, $resourceType ) ) + { + $iCounter = 0 ; + + while ( true ) + { + $sFilePath = $sServerDir . $sFileName ; + + if ( is_file( $sFilePath ) ) + { + $iCounter++ ; + $sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ; + $sErrorNumber = '201' ; + } + else + { + move_uploaded_file( $oFile['tmp_name'], $sFilePath ); + + if ( is_file( $sFilePath ) ) + { + if ( isset( $Config['ChmodOnUpload'] ) && !$Config['ChmodOnUpload'] ) + { + break ; + } + + $permissions = 0777; + + if ( isset( $Config['ChmodOnUpload'] ) && $Config['ChmodOnUpload'] ) + { + $permissions = $Config['ChmodOnUpload'] ; + } + + $oldumask = umask(0); + chmod( $sFilePath, $permissions ); + umask( $oldumask ); + } + + break ; + } + } + + if ( file_exists( $sFilePath ) ) + { + //previous checks failed, try once again + if ( isset( $isImageValid ) && $isImageValid === -1 && IsImageValid( $sFilePath, $sExtension ) === false ) + { + @unlink( $sFilePath ); + $sErrorNumber = '202' ; + } + else if ( isset( $detectHtml ) && $detectHtml === -1 && DetectHtml( $sFilePath ) === true ) + { + @unlink( $sFilePath ); + $sErrorNumber = '202' ; + } + } + } + else + $sErrorNumber = '202' ; + } + else + $sErrorNumber = '202' ; + + + $sFileUrl = CombinePaths( GetResourceTypePath( $resourceType, $sCommand ) , $currentFolder ); + $sFileUrl = CombinePaths( $sFileUrl, $sFileName ); + + + // DOL_CHANGE + //SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName ); + if($CKEcallback == '') + { + // this line already exists so wrap the if block around it + SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName ); + } + else + { + //issue the CKEditor Callback + SendCKEditorResults ($CKEcallback, $sFileUrl, + ($sErrorNumber != 0 + ? 'Error '. $sErrorNumber. ' upload failed.' + : 'Upload Successful')); + } + + exit ; +} +?> diff --git a/htdocs/core/filemanagerdol/connectors/php/config.php b/htdocs/core/filemanagerdol/connectors/php/config.php index 87dc899465c..3248335120c 100755 --- a/htdocs/core/filemanagerdol/connectors/php/config.php +++ b/htdocs/core/filemanagerdol/connectors/php/config.php @@ -1,163 +1,163 @@ - + diff --git a/htdocs/core/filemanagerdol/connectors/php/connector.php b/htdocs/core/filemanagerdol/connectors/php/connector.php index 6f302c6ef53..af720849a79 100755 --- a/htdocs/core/filemanagerdol/connectors/php/connector.php +++ b/htdocs/core/filemanagerdol/connectors/php/connector.php @@ -1,87 +1,87 @@ - + diff --git a/htdocs/core/filemanagerdol/connectors/php/io.php b/htdocs/core/filemanagerdol/connectors/php/io.php index aa957e53fc5..ed329ec13a4 100755 --- a/htdocs/core/filemanagerdol/connectors/php/io.php +++ b/htdocs/core/filemanagerdol/connectors/php/io.php @@ -1,320 +1,320 @@ - 0 ) - return $Config['QuickUploadAbsolutePath'][$resourceType] ; - - // Map the "UserFiles" path to a local directory. - return Server_MapPath( $Config['QuickUploadPath'][$resourceType] ); - } - else - { - if ( strlen( $Config['FileTypesAbsolutePath'][$resourceType] ) > 0 ) - return $Config['FileTypesAbsolutePath'][$resourceType] ; - - // Map the "UserFiles" path to a local directory. - return Server_MapPath( $Config['FileTypesPath'][$resourceType] ); - } -} - -function GetUrlFromPath( $resourceType, $folderPath, $sCommand ) -{ - return CombinePaths( GetResourceTypePath( $resourceType, $sCommand ), $folderPath ); -} - -function RemoveExtension( $fileName ) -{ - return substr( $fileName, 0, strrpos( $fileName, '.' ) ); -} - -function ServerMapFolder( $resourceType, $folderPath, $sCommand ) -{ - // Get the resource type directory. - $sResourceTypePath = GetResourceTypeDirectory( $resourceType, $sCommand ); - - // Ensure that the directory exists. - $sErrorMsg = CreateServerFolder( $sResourceTypePath ); - if ( $sErrorMsg != '' ) - SendError( 1, "Error creating folder \"{$sResourceTypePath}\" ({$sErrorMsg})" ); - - // Return the resource type directory combined with the required path. - return CombinePaths( $sResourceTypePath , $folderPath ); -} - -function GetParentFolder( $folderPath ) -{ - $sPattern = "-[/\\\\][^/\\\\]+[/\\\\]?$-" ; - return preg_replace( $sPattern, '', $folderPath ); -} - -function CreateServerFolder( $folderPath, $lastFolder = null ) -{ - global $Config ; - $sParent = GetParentFolder( $folderPath ); - - // Ensure the folder path has no double-slashes, or mkdir may fail on certain platforms - while ( strpos($folderPath, '//') !== false ) - { - $folderPath = str_replace( '//', '/', $folderPath ); - } - - // Check if the parent exists, or create it. - if ( !empty($sParent) && !file_exists( $sParent ) ) - { - //prevents agains infinite loop when we can't create root folder - if ( !is_null( $lastFolder ) && $lastFolder === $sParent) { - return "Can't create $folderPath directory" ; - } - - $sErrorMsg = CreateServerFolder( $sParent, $folderPath ); - if ( $sErrorMsg != '' ) - return $sErrorMsg ; - } - - if ( !file_exists( $folderPath ) ) - { - // Turn off all error reporting. - error_reporting( 0 ); - - $php_errormsg = '' ; - // Enable error tracking to catch the error. - ini_set( 'track_errors', '1' ); - - if ( isset( $Config['ChmodOnFolderCreate'] ) && !$Config['ChmodOnFolderCreate'] ) - { - mkdir( $folderPath ); - } - else - { - $permissions = 0777 ; - if ( isset( $Config['ChmodOnFolderCreate'] ) ) - { - $permissions = $Config['ChmodOnFolderCreate'] ; - } - // To create the folder with 0777 permissions, we need to set umask to zero. - $oldumask = umask(0); - mkdir( $folderPath, $permissions ); - umask( $oldumask ); - } - - $sErrorMsg = $php_errormsg ; - - // Restore the configurations. - ini_restore( 'track_errors' ); - ini_restore( 'error_reporting' ); - - return $sErrorMsg ; - } - else - return '' ; -} - -function GetRootPath() -{ - if (!isset($_SERVER)) { - global $_SERVER; - } - $sRealPath = realpath( './' ); - // #2124 ensure that no slash is at the end - $sRealPath = rtrim($sRealPath,"\\/"); - - $sSelfPath = $_SERVER['PHP_SELF'] ; - $sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ) ); - - $sSelfPath = str_replace( '/', DIRECTORY_SEPARATOR, $sSelfPath ); - - $position = strpos( $sRealPath, $sSelfPath ); - - // This can check only that this script isn't run from a virtual dir - // But it avoids the problems that arise if it isn't checked - if ( $position === false || $position <> strlen( $sRealPath ) - strlen( $sSelfPath ) ) - SendError( 1, 'Sorry, can\'t map "UserFilesPath" to a physical path. You must set the "UserFilesAbsolutePath" value in "editor/filemanager/connectors/php/config.php".' ); - - return substr( $sRealPath, 0, $position ); -} - -// Emulate the asp Server.mapPath function. -// given an url path return the physical directory that it corresponds to -function Server_MapPath( $path ) -{ - // This function is available only for Apache - if ( function_exists( 'apache_lookup_uri' ) ) - { - $info = apache_lookup_uri( $path ); - return $info->filename . $info->path_info ; - } - - // This isn't correct but for the moment there's no other solution - // If this script is under a virtual directory or symlink it will detect the problem and stop - return GetRootPath() . $path ; -} - -function IsAllowedExt( $sExtension, $resourceType ) -{ - global $Config ; - // Get the allowed and denied extensions arrays. - $arAllowed = $Config['AllowedExtensions'][$resourceType] ; - $arDenied = $Config['DeniedExtensions'][$resourceType] ; - - if ( count($arAllowed) > 0 && !in_array( $sExtension, $arAllowed ) ) - return false ; - - if ( count($arDenied) > 0 && in_array( $sExtension, $arDenied ) ) - return false ; - - return true ; -} - -function IsAllowedType( $resourceType ) -{ - global $Config ; - if ( !in_array( $resourceType, $Config['ConfigAllowedTypes'] ) ) - return false ; - - return true ; -} - -function IsAllowedCommand( $sCommand ) -{ - global $Config ; - - if ( !in_array( $sCommand, $Config['ConfigAllowedCommands'] ) ) - return false ; - - return true ; -} - -function GetCurrentFolder() -{ - if (!isset($_GET)) { - global $_GET; - } - $sCurrentFolder = isset( $_GET['CurrentFolder'] ) ? $_GET['CurrentFolder'] : '/' ; - - // Check the current folder syntax (must begin and start with a slash). - if ( !preg_match( '|/$|', $sCurrentFolder ) ) - $sCurrentFolder .= '/' ; - if ( strpos( $sCurrentFolder, '/' ) !== 0 ) - $sCurrentFolder = '/' . $sCurrentFolder ; - - // Ensure the folder path has no double-slashes - while ( strpos ($sCurrentFolder, '//') !== false ) { - $sCurrentFolder = str_replace ('//', '/', $sCurrentFolder); - } - - // Check for invalid folder paths (..) - if ( strpos( $sCurrentFolder, '..' ) || strpos( $sCurrentFolder, "\\" )) - SendError( 102, '' ); - - if ( preg_match(",(/\.)|[[:cntrl:]]|(//)|(\\\\)|([\:\*\?\"\<\>\|]),", $sCurrentFolder)) - SendError( 102, '' ); - - return $sCurrentFolder ; -} - -// Do a cleanup of the folder name to avoid possible problems -function SanitizeFolderName( $sNewFolderName ) -{ - $sNewFolderName = stripslashes( $sNewFolderName ); - - // Remove . \ / | : ? * " < > - $sNewFolderName = preg_replace( '/\\.|\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[[:cntrl:]]/', '_', $sNewFolderName ); - - return $sNewFolderName ; -} - -// Do a cleanup of the file name to avoid possible problems -function SanitizeFileName( $sNewFileName ) -{ - global $Config ; - - $sNewFileName = stripslashes( $sNewFileName ); - - // Replace dots in the name with underscores (only one dot can be there... security issue). - if ( $Config['ForceSingleExtension'] ) - $sNewFileName = preg_replace( '/\\.(?![^.]*$)/', '_', $sNewFileName ); - - // Remove \ / | : ? * " < > - $sNewFileName = preg_replace( '/\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[[:cntrl:]]/', '_', $sNewFileName ); - - return $sNewFileName ; -} - -// This is the function that sends the results of the uploading process. -function SendUploadResults( $errorNumber, $fileUrl = '', $fileName = '', $customMsg = '' ) -{ - // Minified version of the document.domain automatic fix script (#1919). - // The original script can be found at _dev/domain_fix_template.js - echo << -(function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})(); -EOF; - - if ($errorNumber && $errorNumber != 201) { - $fileUrl = ""; - $fileName = ""; - } - - $rpl = array( '\\' => '\\\\', '"' => '\\"' ); - echo 'window.parent.OnUploadCompleted(' . $errorNumber . ',"' . strtr( $fileUrl, $rpl ) . '","' . strtr( $fileName, $rpl ) . '", "' . strtr( $customMsg, $rpl ) . '");' ; - echo '' ; - exit ; -} - - -// DOL_CHANGE - -// This is the function that sends the results of the uploading process to CKE. -function SendCKEditorResults ($callback, $sFileUrl, $customMsg = '') -{ - echo ''; -} - - -?> + 0 ) + return $Config['QuickUploadAbsolutePath'][$resourceType] ; + + // Map the "UserFiles" path to a local directory. + return Server_MapPath( $Config['QuickUploadPath'][$resourceType] ); + } + else + { + if ( strlen( $Config['FileTypesAbsolutePath'][$resourceType] ) > 0 ) + return $Config['FileTypesAbsolutePath'][$resourceType] ; + + // Map the "UserFiles" path to a local directory. + return Server_MapPath( $Config['FileTypesPath'][$resourceType] ); + } +} + +function GetUrlFromPath( $resourceType, $folderPath, $sCommand ) +{ + return CombinePaths( GetResourceTypePath( $resourceType, $sCommand ), $folderPath ); +} + +function RemoveExtension( $fileName ) +{ + return substr( $fileName, 0, strrpos( $fileName, '.' ) ); +} + +function ServerMapFolder( $resourceType, $folderPath, $sCommand ) +{ + // Get the resource type directory. + $sResourceTypePath = GetResourceTypeDirectory( $resourceType, $sCommand ); + + // Ensure that the directory exists. + $sErrorMsg = CreateServerFolder( $sResourceTypePath ); + if ( $sErrorMsg != '' ) + SendError( 1, "Error creating folder \"{$sResourceTypePath}\" ({$sErrorMsg})" ); + + // Return the resource type directory combined with the required path. + return CombinePaths( $sResourceTypePath , $folderPath ); +} + +function GetParentFolder( $folderPath ) +{ + $sPattern = "-[/\\\\][^/\\\\]+[/\\\\]?$-" ; + return preg_replace( $sPattern, '', $folderPath ); +} + +function CreateServerFolder( $folderPath, $lastFolder = null ) +{ + global $Config ; + $sParent = GetParentFolder( $folderPath ); + + // Ensure the folder path has no double-slashes, or mkdir may fail on certain platforms + while ( strpos($folderPath, '//') !== false ) + { + $folderPath = str_replace( '//', '/', $folderPath ); + } + + // Check if the parent exists, or create it. + if ( !empty($sParent) && !file_exists( $sParent ) ) + { + //prevents agains infinite loop when we can't create root folder + if ( !is_null( $lastFolder ) && $lastFolder === $sParent) { + return "Can't create $folderPath directory" ; + } + + $sErrorMsg = CreateServerFolder( $sParent, $folderPath ); + if ( $sErrorMsg != '' ) + return $sErrorMsg ; + } + + if ( !file_exists( $folderPath ) ) + { + // Turn off all error reporting. + error_reporting( 0 ); + + $php_errormsg = '' ; + // Enable error tracking to catch the error. + ini_set( 'track_errors', '1' ); + + if ( isset( $Config['ChmodOnFolderCreate'] ) && !$Config['ChmodOnFolderCreate'] ) + { + mkdir( $folderPath ); + } + else + { + $permissions = 0777 ; + if ( isset( $Config['ChmodOnFolderCreate'] ) ) + { + $permissions = $Config['ChmodOnFolderCreate'] ; + } + // To create the folder with 0777 permissions, we need to set umask to zero. + $oldumask = umask(0); + mkdir( $folderPath, $permissions ); + umask( $oldumask ); + } + + $sErrorMsg = $php_errormsg ; + + // Restore the configurations. + ini_restore( 'track_errors' ); + ini_restore( 'error_reporting' ); + + return $sErrorMsg ; + } + else + return '' ; +} + +function GetRootPath() +{ + if (!isset($_SERVER)) { + global $_SERVER; + } + $sRealPath = realpath( './' ); + // #2124 ensure that no slash is at the end + $sRealPath = rtrim($sRealPath,"\\/"); + + $sSelfPath = $_SERVER['PHP_SELF'] ; + $sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ) ); + + $sSelfPath = str_replace( '/', DIRECTORY_SEPARATOR, $sSelfPath ); + + $position = strpos( $sRealPath, $sSelfPath ); + + // This can check only that this script isn't run from a virtual dir + // But it avoids the problems that arise if it isn't checked + if ( $position === false || $position <> strlen( $sRealPath ) - strlen( $sSelfPath ) ) + SendError( 1, 'Sorry, can\'t map "UserFilesPath" to a physical path. You must set the "UserFilesAbsolutePath" value in "editor/filemanager/connectors/php/config.php".' ); + + return substr( $sRealPath, 0, $position ); +} + +// Emulate the asp Server.mapPath function. +// given an url path return the physical directory that it corresponds to +function Server_MapPath( $path ) +{ + // This function is available only for Apache + if ( function_exists( 'apache_lookup_uri' ) ) + { + $info = apache_lookup_uri( $path ); + return $info->filename . $info->path_info ; + } + + // This isn't correct but for the moment there's no other solution + // If this script is under a virtual directory or symlink it will detect the problem and stop + return GetRootPath() . $path ; +} + +function IsAllowedExt( $sExtension, $resourceType ) +{ + global $Config ; + // Get the allowed and denied extensions arrays. + $arAllowed = $Config['AllowedExtensions'][$resourceType] ; + $arDenied = $Config['DeniedExtensions'][$resourceType] ; + + if ( count($arAllowed) > 0 && !in_array( $sExtension, $arAllowed ) ) + return false ; + + if ( count($arDenied) > 0 && in_array( $sExtension, $arDenied ) ) + return false ; + + return true ; +} + +function IsAllowedType( $resourceType ) +{ + global $Config ; + if ( !in_array( $resourceType, $Config['ConfigAllowedTypes'] ) ) + return false ; + + return true ; +} + +function IsAllowedCommand( $sCommand ) +{ + global $Config ; + + if ( !in_array( $sCommand, $Config['ConfigAllowedCommands'] ) ) + return false ; + + return true ; +} + +function GetCurrentFolder() +{ + if (!isset($_GET)) { + global $_GET; + } + $sCurrentFolder = isset( $_GET['CurrentFolder'] ) ? $_GET['CurrentFolder'] : '/' ; + + // Check the current folder syntax (must begin and start with a slash). + if ( !preg_match( '|/$|', $sCurrentFolder ) ) + $sCurrentFolder .= '/' ; + if ( strpos( $sCurrentFolder, '/' ) !== 0 ) + $sCurrentFolder = '/' . $sCurrentFolder ; + + // Ensure the folder path has no double-slashes + while ( strpos ($sCurrentFolder, '//') !== false ) { + $sCurrentFolder = str_replace ('//', '/', $sCurrentFolder); + } + + // Check for invalid folder paths (..) + if ( strpos( $sCurrentFolder, '..' ) || strpos( $sCurrentFolder, "\\" )) + SendError( 102, '' ); + + if ( preg_match(",(/\.)|[[:cntrl:]]|(//)|(\\\\)|([\:\*\?\"\<\>\|]),", $sCurrentFolder)) + SendError( 102, '' ); + + return $sCurrentFolder ; +} + +// Do a cleanup of the folder name to avoid possible problems +function SanitizeFolderName( $sNewFolderName ) +{ + $sNewFolderName = stripslashes( $sNewFolderName ); + + // Remove . \ / | : ? * " < > + $sNewFolderName = preg_replace( '/\\.|\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[[:cntrl:]]/', '_', $sNewFolderName ); + + return $sNewFolderName ; +} + +// Do a cleanup of the file name to avoid possible problems +function SanitizeFileName( $sNewFileName ) +{ + global $Config ; + + $sNewFileName = stripslashes( $sNewFileName ); + + // Replace dots in the name with underscores (only one dot can be there... security issue). + if ( $Config['ForceSingleExtension'] ) + $sNewFileName = preg_replace( '/\\.(?![^.]*$)/', '_', $sNewFileName ); + + // Remove \ / | : ? * " < > + $sNewFileName = preg_replace( '/\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[[:cntrl:]]/', '_', $sNewFileName ); + + return $sNewFileName ; +} + +// This is the function that sends the results of the uploading process. +function SendUploadResults( $errorNumber, $fileUrl = '', $fileName = '', $customMsg = '' ) +{ + // Minified version of the document.domain automatic fix script (#1919). + // The original script can be found at _dev/domain_fix_template.js + echo << +(function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})(); +EOF; + + if ($errorNumber && $errorNumber != 201) { + $fileUrl = ""; + $fileName = ""; + } + + $rpl = array( '\\' => '\\\\', '"' => '\\"' ); + echo 'window.parent.OnUploadCompleted(' . $errorNumber . ',"' . strtr( $fileUrl, $rpl ) . '","' . strtr( $fileName, $rpl ) . '", "' . strtr( $customMsg, $rpl ) . '");' ; + echo '' ; + exit ; +} + + +// DOL_CHANGE + +// This is the function that sends the results of the uploading process to CKE. +function SendCKEditorResults ($callback, $sFileUrl, $customMsg = '') +{ + echo ''; +} + + +?> diff --git a/htdocs/core/filemanagerdol/connectors/php/phpcompat.php b/htdocs/core/filemanagerdol/connectors/php/phpcompat.php index 2c967464297..518d533e260 100755 --- a/htdocs/core/filemanagerdol/connectors/php/phpcompat.php +++ b/htdocs/core/filemanagerdol/connectors/php/phpcompat.php @@ -1,17 +1,16 @@ - + diff --git a/htdocs/core/filemanagerdol/connectors/php/util.php b/htdocs/core/filemanagerdol/connectors/php/util.php index e3c9f5e8ef2..fa2921cde8b 100755 --- a/htdocs/core/filemanagerdol/connectors/php/util.php +++ b/htdocs/core/filemanagerdol/connectors/php/util.php @@ -1,220 +1,220 @@ - $val ) - { - $lcaseHtmlExtensions[$key] = strtolower( $val ); - } - return in_array( $ext, $lcaseHtmlExtensions ); -} - -/** - * Detect HTML in the first KB to prevent against potential security issue with - * IE/Safari/Opera file type auto detection bug. - * Returns true if file contain insecure HTML code at the beginning. - * - * @param string $filePath absolute path to file - * @return boolean - */ -function DetectHtml( $filePath ) -{ - $fp = @fopen( $filePath, 'rb' ); - - //open_basedir restriction, see #1906 - if ( $fp === false || !flock( $fp, LOCK_SH ) ) - { - return -1 ; - } - - $chunk = fread( $fp, 1024 ); - flock( $fp, LOCK_UN ); - fclose( $fp ); - - $chunk = strtolower( $chunk ); - - if (!$chunk) - { - return false ; - } - - $chunk = trim( $chunk ); - - if ( preg_match( "/= 4.0.7 - if ( function_exists( 'version_compare' ) ) { - $sCurrentVersion = phpversion(); - if ( version_compare( $sCurrentVersion, "4.2.0" ) >= 0 ) { - $imageCheckExtensions[] = "tiff"; - $imageCheckExtensions[] = "tif"; - } - if ( version_compare( $sCurrentVersion, "4.3.0" ) >= 0 ) { - $imageCheckExtensions[] = "swc"; - } - if ( version_compare( $sCurrentVersion, "4.3.2" ) >= 0 ) { - $imageCheckExtensions[] = "jpc"; - $imageCheckExtensions[] = "jp2"; - $imageCheckExtensions[] = "jpx"; - $imageCheckExtensions[] = "jb2"; - $imageCheckExtensions[] = "xbm"; - $imageCheckExtensions[] = "wbmp"; - } - } - - if ( !in_array( $extension, $imageCheckExtensions ) ) { - return true; - } - - if ( @getimagesize( $filePath ) === false ) { - return false ; - } - - return true; -} - -?> + $val ) + { + $lcaseHtmlExtensions[$key] = strtolower( $val ); + } + return in_array( $ext, $lcaseHtmlExtensions ); +} + +/** + * Detect HTML in the first KB to prevent against potential security issue with + * IE/Safari/Opera file type auto detection bug. + * Returns true if file contain insecure HTML code at the beginning. + * + * @param string $filePath absolute path to file + * @return boolean + */ +function DetectHtml( $filePath ) +{ + $fp = @fopen( $filePath, 'rb' ); + + //open_basedir restriction, see #1906 + if ( $fp === false || !flock( $fp, LOCK_SH ) ) + { + return -1 ; + } + + $chunk = fread( $fp, 1024 ); + flock( $fp, LOCK_UN ); + fclose( $fp ); + + $chunk = strtolower( $chunk ); + + if (!$chunk) + { + return false ; + } + + $chunk = trim( $chunk ); + + if ( preg_match( "/= 4.0.7 + if ( function_exists( 'version_compare' ) ) { + $sCurrentVersion = phpversion(); + if ( version_compare( $sCurrentVersion, "4.2.0" ) >= 0 ) { + $imageCheckExtensions[] = "tiff"; + $imageCheckExtensions[] = "tif"; + } + if ( version_compare( $sCurrentVersion, "4.3.0" ) >= 0 ) { + $imageCheckExtensions[] = "swc"; + } + if ( version_compare( $sCurrentVersion, "4.3.2" ) >= 0 ) { + $imageCheckExtensions[] = "jpc"; + $imageCheckExtensions[] = "jp2"; + $imageCheckExtensions[] = "jpx"; + $imageCheckExtensions[] = "jb2"; + $imageCheckExtensions[] = "xbm"; + $imageCheckExtensions[] = "wbmp"; + } + } + + if ( !in_array( $extension, $imageCheckExtensions ) ) { + return true; + } + + if ( @getimagesize( $filePath ) === false ) { + return false ; + } + + return true; +} + +?> diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 88fb0549e90..94bb4d1e6bf 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -667,8 +667,8 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass * @param PDF &$pdf Object PDF * @param object $object Object * @param Translate $outputlangs Object lang - * @param int $curx X - * @param int $cury Y + * @param int $posx X + * @param int $posy Y * @param int $align Align * @param string $default_font_size Font size * @param HookManager $hookmanager Hook manager object diff --git a/htdocs/core/login/functions_myopenid.php b/htdocs/core/login/functions_myopenid.php index 6cde7eb820f..b6f0e597739 100644 --- a/htdocs/core/login/functions_myopenid.php +++ b/htdocs/core/login/functions_myopenid.php @@ -242,7 +242,6 @@ class SimpleOpenID /** * GetIdentity * - * @param string $a Server * @return void */ function GetIdentity() @@ -253,7 +252,6 @@ class SimpleOpenID /** * SetOpenIDServer * - * @param string $a Server * @return void */ function GetError() @@ -265,7 +263,8 @@ class SimpleOpenID /** * ErrorStore * - * @param string $a Server + * @param string $code Code + * @param string $desc Description * @return void */ function ErrorStore($code, $desc = null) @@ -280,14 +279,16 @@ class SimpleOpenID /** * IsError * - * @param string $a Server * @return void */ function IsError() { - if (count($this->error) > 0){ + if (count($this->error) > 0) + { return true; - }else{ + } + else + { return false; } } @@ -295,7 +296,7 @@ class SimpleOpenID /** * splitResponse * - * @param string $a Server + * @param string $response Server * @return void */ function splitResponse($response) @@ -315,7 +316,7 @@ class SimpleOpenID /** * OpenID_Standarize * - * @param string $a Server + * @param string $openidçidentity Server * @return void */ function OpenID_Standarize($openid_identity = null) @@ -434,7 +435,6 @@ class SimpleOpenID /** * GetRedirectURL * - * @param string $a Server * @return void */ function GetRedirectURL() @@ -459,7 +459,6 @@ class SimpleOpenID /** * Redirect * - * @param string $a Server * @return void */ function Redirect() @@ -480,7 +479,6 @@ class SimpleOpenID /** * ValidateWithServer * - * @param string $a Server * @return void */ function ValidateWithServer() diff --git a/htdocs/core/menus/smartphone/smartphone.lib.php b/htdocs/core/menus/smartphone/smartphone.lib.php index 5750f883c9d..6895867cbd8 100755 --- a/htdocs/core/menus/smartphone/smartphone.lib.php +++ b/htdocs/core/menus/smartphone/smartphone.lib.php @@ -26,10 +26,11 @@ /** * Core function to output top menu smartphone * - * @param $db - * @param $atarget - * @param $type_user 0=Internal,1=External,2=All - * @param $limitmenuto To limit menu to a top or left menu value + * @param DoliDB $db Database handler + * @param string $atarget Target + * @param int $type_user 0=Internal,1=External,2=All + * @param string $limitmenuto To limit menu to a top or left menu value + * @return void */ function print_smartphone_menu($db,$atarget,$type_user,$limitmenuto) { @@ -141,34 +142,66 @@ function print_smartphone_menu($db,$atarget,$type_user,$limitmenuto) print "\n"; } +/** + * Output menu entry + * + * @param string $theme Theme + * @return void + */ function print_start_menu_array($theme='c') { print '
    '; print "\n"; } +/** + * Output start submenu entry + * + * @return void + */ function print_start_submenu_array() { print '
      '; print "\n"; } +/** + * Output start menu entry + * + * @return void + */ function print_start_menu_entry() { print '
    • '; } +/** + * Output menu entry + * + * @param string $text Text + * @return void + */ function print_text_menu_entry($text) { print $text; } +/** + * Output end menu entry + * + * @return void + */ function print_end_menu_entry() { print '
    • '; print "\n"; } +/** + * Output end menu + * + * @return void + */ function print_end_menu() { print '
    '; diff --git a/htdocs/core/menus/smartphone/smartphone_backoffice.php b/htdocs/core/menus/smartphone/smartphone_backoffice.php index d1cb1feb89b..f19ac45351a 100755 --- a/htdocs/core/menus/smartphone/smartphone_backoffice.php +++ b/htdocs/core/menus/smartphone/smartphone_backoffice.php @@ -25,8 +25,8 @@ /** * Class to manage smartphone menu smartphone (for internal users) */ -class MenuSmart { - +class MenuSmart +{ var $db; var $require_left=array("smartphone_backoffice"); // Si doit etre en phase avec un gestionnaire de menu particulier var $hideifnotallowed=0; // Put 0 for back office menu, 1 for front office menu @@ -46,7 +46,7 @@ class MenuSmart { /** * Show menu - * + * * @param string $limitmenuto To limit menu to a top or left menu value * @return void */ diff --git a/htdocs/core/menus/smartphone/smartphone_frontoffice.php b/htdocs/core/menus/smartphone/smartphone_frontoffice.php index 4be38b571c8..0739e894db3 100755 --- a/htdocs/core/menus/smartphone/smartphone_frontoffice.php +++ b/htdocs/core/menus/smartphone/smartphone_frontoffice.php @@ -23,10 +23,10 @@ /** - * \class MenuSmart - * \brief Class to manage smartphone menu smartphone (for external users) + * Class to manage smartphone menu smartphone (for external users) */ -class MenuSmart { +class MenuSmart +{ var $require_left=array("smartphone_frontoffice"); // Si doit etre en phase avec un gestionnaire de menu particulier var $hideifnotallowed=1; // Put 0 for back office menu, 1 for front office menu @@ -36,7 +36,7 @@ class MenuSmart { /** * Constructor * - * @param DoliDB $DB Database handler + * @param DoliDB $db Database handler */ function MenuSmart($db) { @@ -47,7 +47,7 @@ class MenuSmart { /** * Show menu * - * @param limitmenuto To limit menu to a top or left menu value + * @param string $limitmenuto To limit menu to a top or left menu value */ function showmenu($limitmenuto) { diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 02eab5484c8..de947d7edc3 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -108,7 +108,11 @@ function print_auguria_menu($db,$atarget,$type_user) } - +/** + * Output start menu entry + * + * @return void + */ function print_start_menu_array_auguria() { global $conf; @@ -116,6 +120,12 @@ function print_start_menu_array_auguria() else print '
      '; } +/** + * Output menu entry + * + * @param string $idsel Text + * @return void + */ function print_start_menu_entry_auguria($idsel) { global $conf; @@ -123,6 +133,12 @@ function print_start_menu_entry_auguria($idsel) else print '