This commit is contained in:
Laurent Destailleur 2012-03-19 17:18:11 +01:00
parent 5759523c7a
commit 3383d314c9
63 changed files with 2674 additions and 2589 deletions

View File

@ -205,7 +205,7 @@ print '</tr>';
print '<tr class="impair">'; print '<tr class="impair">';
print '<td width="100">'.$langs->trans("Title").'</td>'; print '<td width="100">'.$langs->trans("Title").'</td>';
print '<td><input type="text" name="external_rss_title_'.($lastexternalrss+1).'" value="'.@constant("EXTERNAL_RSS_TITLE_" . ($lastexternalrss+1)).'" size="64"></td>'; print '<td><input type="text" name="external_rss_title_'.($lastexternalrss+1).'" value="'.@constant("EXTERNAL_RSS_TITLE_" . ($lastexternalrss+1)).'" size="64"></td>';
print '<td>April,<br>LinuxFR,<br>Lolix</td>'; print '<td>An interesting RSS feed</td>';
print '</tr>'; print '</tr>';
print '<tr class="pair">'; print '<tr class="pair">';

View File

@ -8,17 +8,17 @@
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
@ -206,8 +206,8 @@ class Propal extends CommonObject
/** /**
* Adding line of fixed discount in the proposal in DB * Adding line of fixed discount in the proposal in DB
* *
* @param int @idremise Id of fixed discount * @param int $idremise Id of fixed discount
* @return int >0 si ok, <0 si ko * @return int >0 if OK, <0 if KO
*/ */
function insert_discount($idremise) function insert_discount($idremise)
{ {
@ -723,22 +723,22 @@ class Propal extends CommonObject
} }
$result = $this->addline( $result = $this->addline(
$this->id, $this->id,
$this->lines[$i]->desc, $this->lines[$i]->desc,
$this->lines[$i]->subprice, $this->lines[$i]->subprice,
$this->lines[$i]->qty, $this->lines[$i]->qty,
$this->lines[$i]->tva_tx, $this->lines[$i]->tva_tx,
$this->lines[$i]->localtax1_tx, $this->lines[$i]->localtax1_tx,
$this->lines[$i]->localtax2_tx, $this->lines[$i]->localtax2_tx,
$this->lines[$i]->fk_product, $this->lines[$i]->fk_product,
$this->lines[$i]->remise_percent, $this->lines[$i]->remise_percent,
'HT', 'HT',
0, 0,
0, 0,
$this->lines[$i]->product_type, $this->lines[$i]->product_type,
$this->lines[$i]->rang, $this->lines[$i]->rang,
$this->lines[$i]->special_code, $this->lines[$i]->special_code,
$fk_parent_line $fk_parent_line
); );
if ($result < 0) 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). * Insert into DB a proposal object completely defined by its data members (ex, results from copy).
*
* @param User $user User that create * @param User $user User that create
* @return int Id of the new object if ok, <0 if ko * @return int Id of the new object if ok, <0 if ko
* @see create * @see create

View File

@ -47,7 +47,8 @@ class box_external_rss extends ModeleBoxes
/** /**
* Constructor * Constructor
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $param More parameters
*/ */
function box_external_rss($db,$param) function box_external_rss($db,$param)
{ {

View File

@ -39,21 +39,22 @@ class box_prospect extends ModeleBoxes
var $depends = array("societe"); var $depends = array("societe");
var $db; var $db;
var $param;
var $info_box_head = array(); var $info_box_head = array();
var $info_box_contents = array(); var $info_box_contents = array();
/** /**
* Constructor * Constructor
*
* @param DoliDB $db Database handler
*/ */
function box_prospect($DB,$param) function box_prospect($db)
{ {
global $langs; global $langs;
$langs->load("boxes"); $langs->load("boxes");
$this->db=$DB; $this->db=$db;
$this->param=$param;
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastProspects"); $this->boxlabel=$langs->transnoentitiesnoconv("BoxLastProspects");
} }

View File

@ -46,7 +46,7 @@ class Canvas
/** /**
* Constructor * Constructor
* *
* @param DoliDB $DB Database handler * @param DoliDB $db Database handler
* @param string $actiontype Action type ('create', 'view', 'edit', 'list') * @param string $actiontype Action type ('create', 'view', 'edit', 'list')
*/ */
function __construct($db, $actiontype='view') 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 * @return int 0=Canvas template file does not exist, 1=Canvas template file exists
*/ */
function displayCanvasExists($action) function displayCanvasExists($action)
{ {
if (empty($this->template_dir)) return 0; if (empty($this->template_dir)) return 0;
if (file_exists($this->template_dir.($this->card?$this->card.'_':'').$this->action.'.tpl.php')) return 1; if (file_exists($this->template_dir.($this->card?$this->card.'_':'').$this->action.'.tpl.php')) return 1;

View File

@ -38,8 +38,9 @@ abstract class CommonDocGenerator
/** /**
* Define array with couple subtitution key => subtitution value * Define array with couple subtitution key => subtitution value
* *
* @param $user User * @param User $user User
* @param $outputlangs Language object for output * @param Translate $outputlangs Language object for output
* @return array Array of substitution key->code
*/ */
function get_substitutionarray_user($user,$outputlangs) function get_substitutionarray_user($user,$outputlangs)
{ {
@ -61,8 +62,9 @@ abstract class CommonDocGenerator
/** /**
* Define array with couple subtitution key => subtitution value * Define array with couple subtitution key => subtitution value
* *
* @param $mysoc * @param Societe $mysoc Object thirdparty
* @param $outputlangs Language object for output * @param Translate $outputlangs Language object for output
* @return array Array of substitution key->code
*/ */
function get_substitutionarray_mysoc($mysoc,$outputlangs) function get_substitutionarray_mysoc($mysoc,$outputlangs)
{ {
@ -103,8 +105,9 @@ abstract class CommonDocGenerator
/** /**
* Define array with couple subtitution key => subtitution value * Define array with couple subtitution key => subtitution value
* *
* @param $object * @param Object $object Object
* @param $outputlangs Language object for output * @param Translate $outputlangs Language object for output
* @return array Array of substitution key->code
*/ */
function get_substitutionarray_thirdparty($object,$outputlangs) function get_substitutionarray_thirdparty($object,$outputlangs)
{ {

View File

@ -2433,8 +2433,8 @@ abstract class CommonObject
* *
* @param string $action GET/POST action * @param string $action GET/POST action
* @param array $line Selected object line to output * @param array $line Selected object line to output
* @param string $var Is it a an odd line * @param string $var Is it a an odd line (true)
* @param int $num Number of line * @param int $num Number of line (0)
* @param int $i I * @param int $i I
* @param int $dateSelector 1=Show also date range input fields * @param int $dateSelector 1=Show also date range input fields
* @param string $seller Object of seller third party * @param string $seller Object of seller third party
@ -2443,7 +2443,7 @@ abstract class CommonObject
* @param HookManager $hookmanager Hook manager * @param HookManager $hookmanager Hook manager
* @return void * @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 $conf,$langs,$user;
global $form,$bc,$bcdd; global $form,$bc,$bcdd;

View File

@ -35,7 +35,7 @@ class GenericObject extends CommonObject
/** /**
* Constructor * Constructor
* *
* @param DoliDB $DB Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) function __construct($db)
{ {

View File

@ -44,7 +44,7 @@ class HookManager
/** /**
* Constructor * Constructor
* *
* @param DoliDB $DB Handler acces base de donnees * @param DoliDB $db Handler acces base de donnees
*/ */
function __construct($db) function __construct($db)
{ {

View File

@ -389,7 +389,7 @@ class Form
* Show a text with a picto and a tooltip on picto * Show a text with a picto and a tooltip on picto
* *
* @param string $text Text to show * @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 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 $type Type of picto (info, help, warning, superadmin...)
* @param string $extracss Add a CSS style to td tags * @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 $showempty Add an empty field
* @param int $showtype Show third party type in combolist (customer, prospect or supplier) * @param int $showtype Show third party type in combolist (customer, prospect or supplier)
* @param int $forcecombo Force to use combo box * @param int $forcecombo Force to use combo box
@param array $event Event options * @param array $event Event options
* @return string HTML string with * @return string HTML string with
*/ */
function select_company($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0, $event=array()) 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 int $socid Id ot third party or 0 for all
* @param string $selected Id contact pre-selectionne * @param string $selected Id contact pre-selectionne
* @param string $htmlname Name of HTML field ('none' for a not editable field) * @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 $exclude List of contacts id to exclude
* @param string $limitto Disable answers that are not id in this array list * @param string $limitto Disable answers that are not id in this array list
* @param string $showfunction Add function into label * @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) function selectcontacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='', $options_only=false)
{ {
global $conf,$langs; global $conf,$langs;
$langs->load('companies'); $langs->load('companies');
$out=''; $out='';
// On recherche les societes // On recherche les societes
@ -901,7 +901,7 @@ class Form
{ {
$out.= '</select>'; $out.= '</select>';
} }
$this->num = $num; $this->num = $num;
return $out; 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 $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 int $finished 2=all, 1=finished, 0=raw material
* @param string $selected_input_value Value of preselected input text (with ajax) * @param string $selected_input_value Value of preselected input text (with ajax)
* @param int $hide_label Hide label
* @return void * @return void
*/ */
function select_produits($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$status=1,$finished=2,$selected_input_value='',$hidelabel=0) 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) * 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 int $socid Id third party
* @param string $selected Preselected product * @param string $selected Preselected product
* @param string $htmlname Name of HTML Select * @param string $htmlname Name of HTML Select
* @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service) * @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
* @param string $filtre For a SQL filter * @param string $filtre For a SQL filter
* @return void * @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 $langs,$conf;
global $price_level, $status, $finished; global $price_level, $status, $finished;
@ -1576,7 +1577,7 @@ class Form
* @param int $showempty Add an empty field * @param int $showempty Add an empty field
* @return void * @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 // On recherche les utilisateurs
$sql = "SELECT a.rowid, a.label"; $sql = "SELECT a.rowid, a.label";
@ -2064,6 +2065,7 @@ class Form
* @param string $select_name HTML field name * @param string $select_name HTML field name
* @param int $maxlength Maximum length for labels * @param int $maxlength Maximum length for labels
* @param int $excludeafterid Exclude all categories after this leaf in category tree. * @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) 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 string $page Page URL where form is shown
* @param int $selected Value pre-selected * @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 int $socid Third party id
* @param float $amount Total amount available * @param float $amount Total amount available
* @param string $filter SQL filter on discounts * @param string $filter SQL filter on discounts
@ -2614,7 +2616,7 @@ class Form
* @param string $more More string to add * @param string $more More string to add
* @return void * @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; global $conf,$langs;
if ($htmlname != "none") if ($htmlname != "none")
@ -2728,7 +2730,7 @@ class Form
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">'; print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
print '<tr><td>'; print '<tr><td>';
print $this->select_company($selected , $htmlname); print $this->select_company($selected, $htmlname);
print '</td>'; print '</td>';
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>'; print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr></table></form>'; print '</tr></table></form>';
@ -2855,7 +2857,7 @@ class Form
* @param Societe $societe_acheteuse Object societe acheteuse * @param Societe $societe_acheteuse Object societe acheteuse
* @param int $idprod Id product * @param int $idprod Id product
* @param int $info_bits Miscellaneous information on line * @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 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 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. * 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; $return.= $this->error;
} }
$this->num = $num; $this->num = $num;
return $return; return $return;
} }
@ -3428,7 +3430,7 @@ class Form
/** /**
* Return an html string with a select combo box to choose yes or no * 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 string $value Pre-selected value
* @param int $option 0 return yes/no, 1 return 1/0 * @param int $option 0 return yes/no, 1 return 1/0
* @param bool $disabled true or false * @param bool $disabled true or false
@ -3649,7 +3651,7 @@ class Form
{ {
global $dolibarr_main_url_root; global $dolibarr_main_url_root;
$ret.='<!-- Put link to gravatar -->'; $ret.='<!-- Put link to gravatar -->';
$ret.='<img alt="Photo found on Gravatar" title="Photo Gravatar.com - email '.$email.'" border="0" width="'.$width.'" src="http://www.gravatar.com/avatar/'.dol_hash($email).'?s='.$width.'&d='.urlencode( dol_buildpath('/theme/common/nophoto.jpg',2) ).'">'; $ret.='<img alt="Photo found on Gravatar" title="Photo Gravatar.com - email '.$email.'" border="0" width="'.$width.'" src="http://www.gravatar.com/avatar/'.dol_hash($email).'?s='.$width.'&d='.urlencode(dol_buildpath('/theme/common/nophoto.jpg',2)).'">';
} }
else else
{ {

View File

@ -66,7 +66,7 @@ class FormFile
if ($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) if ($conf->global->MAIN_USE_JQUERY_FILEUPLOAD)
{ {
return $this->_form_ajaxfileupload($object); return $this->_formAjaxFileUpload($object);
} }
else else
{ {
@ -779,7 +779,7 @@ class FormFile
* @param Object $object Object to use * @param Object $object Object to use
* @return void * @return void
*/ */
private function _form_ajaxfileupload($object) private function _formAjaxFileUpload($object)
{ {
global $langs; global $langs;

View File

@ -71,7 +71,7 @@ class FormMail
/** /**
* Constructor * Constructor
* *
* @param DoliDB $DB Database handler * @param DoliDB $db Database handler
*/ */
function FormMail($db) function FormMail($db)
{ {

View File

@ -30,6 +30,7 @@ class InfoBox
/** /**
* Return array of boxes qualified for area and user * Return array of boxes qualified for area and user
* *
* @param DoliDB $db Database handler
* @param string $mode 'available' or 'activated' * @param string $mode 'available' or 'activated'
* @param string $zone Name or area (-1 for all, 0 for Homepage, 1 for xxx, ...) * @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) * @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 * Save order of boxes for area and user
* *
* @param string $zone Name of area (0 for Homepage, ...) * @param DoliDB $db Database handler
* @param string $boxorder List of boxes with correct order 'A:123,456,...-B:789,321...' * @param string $zone Name of area (0 for Homepage, ...)
* @param int $userid Id of user * @param string $boxorder List of boxes with correct order 'A:123,456,...-B:789,321...'
* @return int <0 if KO, >= 0 if OK * @param int $userid Id of user
* @return int <0 if KO, >= 0 if OK
*/ */
static function saveboxorder($db, $zone,$boxorder,$userid=0) static function saveboxorder($db, $zone,$boxorder,$userid=0)
{ {

View File

@ -50,7 +50,7 @@ class Interfaces
* @param string $action Trigger event code * @param string $action Trigger event code
* @param Object $object Objet concern * @param Object $object Objet concern
* @param User $user Objet user * @param User $user Objet user
* @param Lang $lang Objet lang * @param Lang $langs Objet lang
* @param Conf $conf Objet conf * @param Conf $conf Objet conf
* @return int Nb of triggers ran if no error, -Nb of triggers with errors otherwise. * @return int Nb of triggers ran if no error, -Nb of triggers with errors otherwise.
*/ */

View File

@ -141,7 +141,7 @@ class Ldap
* anonymously, it creates an error code of -1. Returns true if connected, * 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, * false if failed. Takes an array of possible servers - if one doesn't work,
* it tries the next and so on. * it tries the next and so on.
* *
* @return void * @return void
* @deprecated Utiliser connect_bind a la place * @deprecated Utiliser connect_bind a la place
*/ */
@ -286,7 +286,7 @@ class Ldap
/** /**
* Simply closes the connection set up earlier. * Simply closes the connection set up earlier.
* Returns true if OK, false if there was an error. * Returns true if OK, false if there was an error.
* *
* @return boolean true or false * @return boolean true or false
*/ */
function close() function close()
@ -304,7 +304,7 @@ class Ldap
/** /**
* Anonymously binds to the connection. After this is done, * Anonymously binds to the connection. After this is done,
* queries and searches can be done - but read-only. * queries and searches can be done - but read-only.
* *
* @return boolean true or false * @return boolean true or false
*/ */
function bind() function bind()
@ -329,12 +329,12 @@ class Ldap
* like "uid=jbloggs,ou=People,dc=foo,dc=com". * like "uid=jbloggs,ou=People,dc=foo,dc=com".
* *
* @param string $bindDn DN * @param string $bindDn DN
* @param string $pass Password * @param string $pass Password
* @return boolean true or false * @return boolean true or false
*/ */
function bindauth($bindDn,$pass) 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->ldapErrorCode = ldap_errno($this->connection);
$this->ldapErrorText = ldap_error($this->connection); $this->ldapErrorText = ldap_error($this->connection);
@ -349,7 +349,7 @@ class Ldap
/** /**
* Unbind du serveur ldap. * Unbind du serveur ldap.
* *
* @return boolean true or false * @return boolean true or false
*/ */
function unbind() function unbind()
@ -365,7 +365,7 @@ class Ldap
/** /**
* Verification de la version du serveur ldap. * Verification de la version du serveur ldap.
* *
* @return string version * @return string version
*/ */
function getVersion() function getVersion()
@ -377,7 +377,7 @@ class Ldap
/** /**
* Change ldap protocol version to use. * Change ldap protocol version to use.
* *
* @return string version * @return string version
*/ */
function setVersion() { function setVersion() {
@ -388,7 +388,7 @@ class Ldap
/** /**
* changement du referrals. * changement du referrals.
* *
* @return string referrals * @return string referrals
*/ */
function setReferrals() { function setReferrals() {
@ -401,7 +401,7 @@ class Ldap
/** /**
* Add a LDAP entry * Add a LDAP entry
* Ldap object connect and bind must have been done * Ldap object connect and bind must have been done
* *
* @param string $dn DN entry key * @param string $dn DN entry key
* @param string $info Attributes array * @param string $info Attributes array
* @param User $user Objet user that create * @param User $user Objet user that create
@ -453,7 +453,7 @@ class Ldap
/** /**
* Modify a LDAP entry * Modify a LDAP entry
* Ldap object connect and bind must have been done * Ldap object connect and bind must have been done
* *
* @param string $dn DN entry key * @param string $dn DN entry key
* @param string $info Attributes array * @param string $info Attributes array
* @param string $user Objet user that modify * @param string $user Objet user that modify
@ -505,7 +505,7 @@ class Ldap
/** /**
* Modify a LDAP entry (to use if dn != olddn) * Modify a LDAP entry (to use if dn != olddn)
* Ldap object connect and bind must have been done * Ldap object connect and bind must have been done
* *
* @param string $dn DN entry key * @param string $dn DN entry key
* @param string $info Attributes array * @param string $info Attributes array
* @param User $user Objet user that delete * @param User $user Objet user that delete
@ -560,7 +560,7 @@ class Ldap
/** /**
* Delete a LDAP entry * Delete a LDAP entry
* Ldap object connect and bind must have been done * Ldap object connect and bind must have been done
* *
* @param string $dn DN entry key * @param string $dn DN entry key
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
@ -593,7 +593,7 @@ class Ldap
/** /**
* Build a LDAP message * Build a LDAP message
* *
* @param string $dn DN entry key * @param string $dn DN entry key
* @param string $info Attributes array * @param string $info Attributes array
* @return string Content of file * @return string Content of file
@ -635,7 +635,7 @@ class Ldap
/** /**
* Dump a LDAP message to ldapinput.in file * Dump a LDAP message to ldapinput.in file
* *
* @param string $dn DN entry key * @param string $dn DN entry key
* @param string $info Attributes array * @param string $info Attributes array
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
@ -672,7 +672,7 @@ class Ldap
/** /**
* Add a LDAP attribute in entry * Add a LDAP attribute in entry
* Ldap object connect and bind must have been done * Ldap object connect and bind must have been done
* *
* @param string $dn DN entry key * @param string $dn DN entry key
* @param string $info Attributes array * @param string $info Attributes array
* @param User $user Objet user that create * @param User $user Objet user that create
@ -724,7 +724,7 @@ class Ldap
/** /**
* Update a LDAP attribute in entry * Update a LDAP attribute in entry
* Ldap object connect and bind must have been done * Ldap object connect and bind must have been done
* *
* @param string $dn DN entry key * @param string $dn DN entry key
* @param string $info Attributes array * @param string $info Attributes array
* @param User $user Objet user that create * @param User $user Objet user that create
@ -776,7 +776,7 @@ class Ldap
/** /**
* Delete a LDAP attribute in entry * Delete a LDAP attribute in entry
* Ldap object connect and bind must have been done * Ldap object connect and bind must have been done
* *
* @param string $dn DN entry key * @param string $dn DN entry key
* @param string $info Attributes array * @param string $info Attributes array
* @param User $user Objet user that create * @param User $user Objet user that create
@ -827,10 +827,10 @@ class Ldap
/** /**
* Returns an array containing attributes and values for first record * Returns an array containing attributes and values for first record
* *
* @param string $dn DN entry key * @param string $dn DN entry key
* @param string $filter Filter * @param string $filter Filter
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function getAttribute($dn,$filter) function getAttribute($dn,$filter)
{ {
@ -859,7 +859,7 @@ class Ldap
} }
// Get values // 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->ldapErrorCode = ldap_errno($this->connection);
$this->ldapErrorText = ldap_error($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 * Returns an array containing values for an attribute and for first record matching filterrecord
* *
* @param string $filterrecord Record * @param string $filterrecord Record
* @param string $attribute Attributes * @param string $attribute Attributes
* @return void * @return void
@ -898,7 +898,7 @@ class Ldap
} }
// Get values // 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->ldapErrorCode = ldap_errno($this->connection);
$this->ldapErrorText = ldap_error($this->connection); $this->ldapErrorText = ldap_error($this->connection);
@ -912,7 +912,7 @@ class Ldap
/** /**
* Returns an array containing a details of elements * 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 * 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 $search Valeur champ cle recherche, sinon '*' pour tous.
* @param string $userDn DN (Ex: ou=adherents,ou=people,dc=parinux,dc=org) * @param string $userDn DN (Ex: ou=adherents,ou=people,dc=parinux,dc=org)
* @param string $useridentifier Name of key field (Ex: uid) * @param string $useridentifier Name of key field (Ex: uid)
@ -1012,8 +1012,9 @@ class Ldap
* Required by Active Directory * Required by Active Directory
* *
* @param string $hex * @param string $hex
* @return string little endian
*/ */
function littleEndian($hex) function littleEndian($hex)
{ {
for ($x=dol_strlen($hex)-2; $x >= 0; $x=$x-2) { for ($x=dol_strlen($hex)-2; $x >= 0; $x=$x-2) {
$result .= substr($hex,$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 * Required by Active Directory
* *
* @param string $ldapuser Login de l'utilisateur * @param string $ldapuser Login de l'utilisateur
* @return string Sid
*/ */
function getObjectSid($ldapUser) function getObjectSid($ldapUser)
{ {
@ -1056,7 +1058,7 @@ class Ldap
if (!$entry) if (!$entry)
{ {
// Si pas de r<EFBFBD>sultat on cherche dans le domaine // Si pas de resultat on cherche dans le domaine
$searchDN = $this->domain; $searchDN = $this->domain;
$i++; $i++;
} }
@ -1069,7 +1071,7 @@ class Ldap
if ($entry) 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]); $SIDText = $this->binSIDtoText($ldapBinary[0]);
return $SIDText; return $SIDText;
} }
@ -1083,11 +1085,11 @@ class Ldap
/** /**
* Returns the textual SID * Returns the textual SID
* Indispensable pour Active Directory * Indispensable pour Active Directory
* *
* @param string $binsid Binary SID * @param string $binsid Binary SID
* @return string Textual SID * @return string Textual SID
*/ */
function binSIDtoText($binsid) function binSIDtoText($binsid)
{ {
$hex_sid=bin2hex($binsid); $hex_sid=bin2hex($binsid);
$rev = hexdec(substr($hex_sid,0,2)); // Get revision-part of SID $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 * car conflit majuscule-minuscule. A n'utiliser que pour les pages
* 'Fiche LDAP' qui affiche champ lisibles par defaut. * 'Fiche LDAP' qui affiche champ lisibles par defaut.
* *
* @param checkDn DN de recherche (Ex: ou=users,cn=my-domain,cn=com) * @param string $checkDn DN de recherche (Ex: ou=users,cn=my-domain,cn=com)
* @param filter Filtre de recherche (ex: (sn=nom_personne) ) * @param string $filter Filtre de recherche (ex: (sn=nom_personne) )
* @return array Tableau des reponses (cle en minuscule-valeur) * @return array Tableau des reponses (cle en minuscule-valeur)
*/ */
function search($checkDn, $filter) function search($checkDn, $filter)
{ {
@ -1143,7 +1145,7 @@ class Ldap
/** /**
* Load all attribute of a LDAP user * Load all attribute of a LDAP user
* *
* @param User $user User to search for. Not used if a filter is provided. * @param User $user User to search for. Not used if a filter is provided.
* @param string $filter Filter for search. Must start with &. * @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) * 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 * 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") { if ($this->serverType == "activedirectory") {
return $this->attr_sambalogin; return $this->attr_sambalogin;
@ -1256,7 +1258,7 @@ class Ldap
* @param string $uacf UACF * @param string $uacf UACF
* @return void * @return void
*/ */
function parseUACF($uacf) function parseUACF($uacf)
{ {
//All flags array //All flags array
$flags = array( "TRUSTED_TO_AUTH_FOR_DELEGATION" => 16777216, $flags = array( "TRUSTED_TO_AUTH_FOR_DELEGATION" => 16777216,
@ -1300,7 +1302,7 @@ class Ldap
* @param string $samtype SamType * @param string $samtype SamType
* @return string Sam string * @return string Sam string
*/ */
function parseSAT($samtype) function parseSAT($samtype)
{ {
$stypes = array( 805306368 => "NORMAL_ACCOUNT", $stypes = array( 805306368 => "NORMAL_ACCOUNT",
805306369 => "WORKSTATION_TRUST", 805306369 => "WORKSTATION_TRUST",

View File

@ -25,18 +25,18 @@ class RssParser
var $db; var $db;
var $error; var $error;
protected $_format=''; private $_format='';
protected $_urlRSS; private $_urlRSS;
protected $_language; private $_language;
protected $_generator; private $_generator;
protected $_copyright; private $_copyright;
protected $_lastbuilddate; private $_lastbuilddate;
protected $_imageurl; private $_imageurl;
protected $_link; private $_link;
protected $_title; private $_title;
protected $_description; private $_description;
protected $_lastfetchdate; // Last successful fetch private $_lastfetchdate; // Last successful fetch
protected $_rssarray=array(); private $_rssarray=array();
/** /**
* getFormat * getFormat

View File

@ -1,197 +1,197 @@
<?php <?php
/* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2003-2010 Frederico Caldeira Knabben * Copyright (C) 2003-2010 Frederico Caldeira Knabben
* *
* Source modified from part of fckeditor (http://www.fckeditor.net) * Source modified from part of fckeditor (http://www.fckeditor.net)
* retreived as GPL v2 or later * retreived as GPL v2 or later
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
require('../../../../main.inc.php'); require('../../../../main.inc.php');
?> ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd"> "http://www.w3.org/TR/html4/frameset.dtd">
<html> <html>
<head> <head>
<title>FCKeditor - Resources Browser</title> <title>FCKeditor - Resources Browser</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="js/fckxml.js"></script> <script type="text/javascript" src="js/fckxml.js"></script>
<script type="text/javascript"> <script type="text/javascript">
// Automatically detect the correct document.domain (#1919). // Automatically detect the correct document.domain (#1919).
(function() (function()
{ {
var d = document.domain ; var d = document.domain ;
while ( true ) while ( true )
{ {
// Test if we can access a parent property. // Test if we can access a parent property.
try try
{ {
var test = window.opener.document.domain ; var test = window.opener.document.domain ;
break ; break ;
} }
catch( e ) catch( e )
{} {}
// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ... // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
d = d.replace( /.*?(?:\.|$)/, '' ); d = d.replace( /.*?(?:\.|$)/, '' );
if ( d.length == 0 ) if ( d.length == 0 )
break ; // It was not able to detect the domain. break ; // It was not able to detect the domain.
try try
{ {
document.domain = d ; document.domain = d ;
} }
catch (e) catch (e)
{ {
break ; break ;
} }
} }
})(); })();
function GetUrlParam( paramName ) function GetUrlParam( paramName )
{ {
var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' ); var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' );
var oMatch = oRegex.exec( window.top.location.search ); var oMatch = oRegex.exec( window.top.location.search );
if ( oMatch && oMatch.length > 1 ) if ( oMatch && oMatch.length > 1 )
return decodeURIComponent( oMatch[1] ); return decodeURIComponent( oMatch[1] );
else else
return '' ; return '' ;
} }
var oConnector = new Object(); var oConnector = new Object();
oConnector.CurrentFolder = '/' ; oConnector.CurrentFolder = '/' ;
var sConnUrl = GetUrlParam( 'Connector' ); var sConnUrl = GetUrlParam( 'Connector' );
// Gecko has some problems when using relative URLs (not starting with slash). // Gecko has some problems when using relative URLs (not starting with slash).
if ( sConnUrl.substr(0,1) != '/' && sConnUrl.indexOf( '://' ) < 0 ) if ( sConnUrl.substr(0,1) != '/' && sConnUrl.indexOf( '://' ) < 0 )
sConnUrl = window.location.href.replace( /browser.php.*$/, '' ) + sConnUrl ; sConnUrl = window.location.href.replace( /browser.php.*$/, '' ) + sConnUrl ;
oConnector.ConnectorUrl = sConnUrl + ( sConnUrl.indexOf('?') != -1 ? '&' : '?' ); oConnector.ConnectorUrl = sConnUrl + ( sConnUrl.indexOf('?') != -1 ? '&' : '?' );
var sServerPath = GetUrlParam( 'ServerPath' ); var sServerPath = GetUrlParam( 'ServerPath' );
if ( sServerPath.length > 0 ) if ( sServerPath.length > 0 )
oConnector.ConnectorUrl += 'ServerPath=' + encodeURIComponent( sServerPath ) + '&' ; oConnector.ConnectorUrl += 'ServerPath=' + encodeURIComponent( sServerPath ) + '&' ;
oConnector.ResourceType = GetUrlParam( 'Type' ); oConnector.ResourceType = GetUrlParam( 'Type' );
oConnector.ShowAllTypes = ( oConnector.ResourceType.length == 0 ); oConnector.ShowAllTypes = ( oConnector.ResourceType.length == 0 );
if ( oConnector.ShowAllTypes ) if ( oConnector.ShowAllTypes )
oConnector.ResourceType = 'File' ; oConnector.ResourceType = 'File' ;
oConnector.SendCommand = function( command, params, callBackFunction ) oConnector.SendCommand = function( command, params, callBackFunction )
{ {
var sUrl = this.ConnectorUrl + 'Command=' + command ; var sUrl = this.ConnectorUrl + 'Command=' + command ;
sUrl += '&Type=' + this.ResourceType ; sUrl += '&Type=' + this.ResourceType ;
sUrl += '&CurrentFolder=' + encodeURIComponent( this.CurrentFolder ); sUrl += '&CurrentFolder=' + encodeURIComponent( this.CurrentFolder );
if ( params ) sUrl += '&' + params ; if ( params ) sUrl += '&' + params ;
// Add a random salt to avoid getting a cached version of the command execution // Add a random salt to avoid getting a cached version of the command execution
sUrl += '&uuid=' + new Date().getTime(); sUrl += '&uuid=' + new Date().getTime();
var oXML = new FCKXml(); var oXML = new FCKXml();
if ( callBackFunction ) if ( callBackFunction )
oXML.LoadUrl( sUrl, callBackFunction ); // Asynchronous load. oXML.LoadUrl( sUrl, callBackFunction ); // Asynchronous load.
else else
return oXML.LoadUrl( sUrl ); return oXML.LoadUrl( sUrl );
return null ; return null ;
} }
oConnector.CheckError = function( responseXml ) oConnector.CheckError = function( responseXml )
{ {
var iErrorNumber = 0 ; var iErrorNumber = 0 ;
var oErrorNode = responseXml.SelectSingleNode( 'Connector/Error' ); var oErrorNode = responseXml.SelectSingleNode( 'Connector/Error' );
if ( oErrorNode ) if ( oErrorNode )
{ {
iErrorNumber = parseInt( oErrorNode.attributes.getNamedItem('number').value, 10 ); iErrorNumber = parseInt( oErrorNode.attributes.getNamedItem('number').value, 10 );
switch ( iErrorNumber ) switch ( iErrorNumber )
{ {
case 0 : case 0 :
break ; break ;
case 1 : // Custom error. Message placed in the "text" attribute. case 1 : // Custom error. Message placed in the "text" attribute.
alert( oErrorNode.attributes.getNamedItem('text').value ); alert( oErrorNode.attributes.getNamedItem('text').value );
break ; break ;
case 101 : case 101 :
alert( 'Folder already exists' ); alert( 'Folder already exists' );
break ; break ;
case 102 : case 102 :
alert( 'Invalid folder name' ); alert( 'Invalid folder name' );
break ; break ;
case 103 : case 103 :
alert( 'You have no permissions to create the folder' ); alert( 'You have no permissions to create the folder' );
break ; break ;
case 110 : case 110 :
alert( 'Unknown error creating folder' ); alert( 'Unknown error creating folder' );
break ; break ;
default : default :
alert( 'Error on your request. Error number: ' + iErrorNumber ); alert( 'Error on your request. Error number: ' + iErrorNumber );
break ; break ;
} }
} }
return iErrorNumber ; return iErrorNumber ;
} }
var oIcons = new Object(); var oIcons = new Object();
oIcons.AvailableIconsArray = [ oIcons.AvailableIconsArray = [
'ai','avi','bmp','cs','dll','doc','exe','fla','gif','htm','html','jpg','js', 'ai','avi','bmp','cs','dll','doc','exe','fla','gif','htm','html','jpg','js',
'mdb','mp3','pdf','png','ppt','rdp','swf','swt','txt','vsd','xls','xml','zip' ] ; 'mdb','mp3','pdf','png','ppt','rdp','swf','swt','txt','vsd','xls','xml','zip' ] ;
oIcons.AvailableIcons = new Object(); oIcons.AvailableIcons = new Object();
for ( var i = 0 ; i < oIcons.AvailableIconsArray.length ; i++ ) for ( var i = 0 ; i < oIcons.AvailableIconsArray.length ; i++ )
oIcons.AvailableIcons[ oIcons.AvailableIconsArray[i] ] = true ; oIcons.AvailableIcons[ oIcons.AvailableIconsArray[i] ] = true ;
oIcons.GetIcon = function( fileName ) oIcons.GetIcon = function( fileName )
{ {
var sExtension = fileName.substr( fileName.lastIndexOf('.') + 1 ).toLowerCase(); var sExtension = fileName.substr( fileName.lastIndexOf('.') + 1 ).toLowerCase();
if ( this.AvailableIcons[ sExtension ] == true ) if ( this.AvailableIcons[ sExtension ] == true )
return sExtension ; return sExtension ;
else else
return 'default.icon' ; return 'default.icon' ;
} }
function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )
{ {
if (errorNumber == "1") if (errorNumber == "1")
window.frames['frmUpload'].OnUploadCompleted( errorNumber, customMsg ); window.frames['frmUpload'].OnUploadCompleted( errorNumber, customMsg );
else else
window.frames['frmUpload'].OnUploadCompleted( errorNumber, fileName ); window.frames['frmUpload'].OnUploadCompleted( errorNumber, fileName );
} }
</script> </script>
</head> </head>
<frameset cols="150,*" framespacing="3" border="1" style="border: 2px solid #CCCCCC;"> <frameset cols="150,*" framespacing="3" border="1" style="border: 2px solid #CCCCCC;">
<frame name="frmFolders" src="frmfolders.php" scrolling="auto" frameborder="1"> <frame name="frmFolders" src="frmfolders.php" scrolling="auto" frameborder="1">
<frameset rows="50,*,50" framespacing="0"> <frameset rows="50,*,50" framespacing="0">
<frame name="frmActualFolder" src="frmactualfolder.php" scrolling="no" frameborder="0"> <frame name="frmActualFolder" src="frmactualfolder.php" scrolling="no" frameborder="0">
<frame name="frmResourcesList" src="frmresourceslist.php" scrolling="auto" frameborder="0"> <frame name="frmResourcesList" src="frmresourceslist.php" scrolling="auto" frameborder="0">
<frameset cols="150,*,0" framespacing="0" border="0"> <frameset cols="150,*,0" framespacing="0" border="0">
<frame name="frmCreateFolder" src="frmcreatefolder.php" scrolling="no" frameborder="0"> <frame name="frmCreateFolder" src="frmcreatefolder.php" scrolling="no" frameborder="0">
<frame name="frmUpload" src="frmupload.php" scrolling="no" frameborder="0"> <frame name="frmUpload" src="frmupload.php" scrolling="no" frameborder="0">
<frame name="frmUploadWorker" src="javascript:void(0)" scrolling="no" frameborder="0"> <frame name="frmUploadWorker" src="javascript:void(0)" scrolling="no" frameborder="0">
</frameset> </frameset>
</frameset> </frameset>
</frameset> </frameset>
</html> </html>

View File

@ -1,117 +1,118 @@
<?php <?php
/* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2003-2010 Frederico Caldeira Knabben * Copyright (C) 2003-2010 Frederico Caldeira Knabben
* *
* Source modified from part of fckeditor (http://www.fckeditor.net) * Source modified from part of fckeditor (http://www.fckeditor.net)
* retreived as GPL v2 or later * retreived as GPL v2 or later
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
require('../../../../main.inc.php'); ?> require('../../../../main.inc.php');
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> ?>
<!-- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
* FCKeditor - The text editor for Internet - http://www.fckeditor.net <!--
* Copyright (C) 2003-2010 Frederico Caldeira Knabben * FCKeditor - The text editor for Internet - http://www.fckeditor.net
* * Copyright (C) 2003-2010 Frederico Caldeira Knabben
* == BEGIN LICENSE == *
* * == BEGIN LICENSE ==
* Licensed under the terms of any of the following licenses at your *
* choice: * Licensed under the terms of any of the following licenses at your
* * choice:
* - GNU General Public License Version 2 or later (the "GPL") *
* http://www.gnu.org/licenses/gpl.html * - GNU General Public License Version 2 or later (the "GPL")
* * http://www.gnu.org/licenses/gpl.html
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL") *
* http://www.gnu.org/licenses/lgpl.html * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* * http://www.gnu.org/licenses/lgpl.html
* - Mozilla Public License Version 1.1 or later (the "MPL") *
* http://www.mozilla.org/MPL/MPL-1.1.html * - Mozilla Public License Version 1.1 or later (the "MPL")
* * http://www.mozilla.org/MPL/MPL-1.1.html
* == END LICENSE == *
* * == END LICENSE ==
* This page shows the actual folder path. *
--> * This page shows the actual folder path.
<html> -->
<head> <html>
<title>Folder path</title> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Folder path</title>
<link href="browser.css" type="text/css" rel="stylesheet"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript"> <link href="browser.css" type="text/css" rel="stylesheet">
// Automatically detect the correct document.domain (#1919). <script type="text/javascript">
(function() // Automatically detect the correct document.domain (#1919).
{ (function()
var d = document.domain ; {
var d = document.domain ;
while ( true )
{ while ( true )
// Test if we can access a parent property. {
try // Test if we can access a parent property.
{ try
var test = window.top.opener.document.domain ; {
break ; var test = window.top.opener.document.domain ;
} break ;
catch( e ) }
{} catch( e )
{}
// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
d = d.replace( /.*?(?:\.|$)/, '' ); // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
d = d.replace( /.*?(?:\.|$)/, '' );
if ( d.length == 0 )
break ; // It was not able to detect the domain. if ( d.length == 0 )
break ; // It was not able to detect the domain.
try
{ try
document.domain = d ; {
} document.domain = d ;
catch (e) }
{ catch (e)
break ; {
} break ;
} }
})(); }
})();
function SetCurrentFolder( resourceType, folderPath )
{ function SetCurrentFolder( resourceType, folderPath )
document.getElementById('tdName').innerHTML = folderPath ; {
} document.getElementById('tdName').innerHTML = folderPath ;
}
window.onload = function()
{ window.onload = function()
window.top.IsLoadedActualFolder = true ; {
} window.top.IsLoadedActualFolder = true ;
}
</script>
</head> </script>
<body> </head>
<table class="fullHeight" cellSpacing="0" cellPadding="0" width="100%" border="0"> <body>
<tr> <table class="fullHeight" cellSpacing="0" cellPadding="0" width="100%" border="0">
<td> <tr>
<button style="WIDTH: 100%" type="button"> <td>
<table cellSpacing="0" cellPadding="0" width="100%" border="0"> <button style="WIDTH: 100%" type="button">
<tr> <table cellSpacing="0" cellPadding="0" width="100%" border="0">
<td><?php echo img_picto_common('','treemenu/folder.gif','width="16" height="16"'); ?></td> <tr>
<td>&nbsp;</td> <td><?php echo img_picto_common('','treemenu/folder.gif','width="16" height="16"'); ?></td>
<td id="tdName" width="100%" nowrap class="ActualFolder">/</td> <td>&nbsp;</td>
<td>&nbsp;</td> <td id="tdName" width="100%" nowrap class="ActualFolder">/</td>
<td>&nbsp;</td> <td>&nbsp;</td>
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> <td>&nbsp;</td>
</table> </tr>
</button> </table>
</td> </button>
</tr> </td>
</table> </tr>
</body> </table>
</html> </body>
</html>

View File

@ -1,136 +1,137 @@
<?php <?php
/* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2003-2010 Frederico Caldeira Knabben * Copyright (C) 2003-2010 Frederico Caldeira Knabben
* *
* Source modified from part of fckeditor (http://www.fckeditor.net) * Source modified from part of fckeditor (http://www.fckeditor.net)
* retreived as GPL v2 or later * retreived as GPL v2 or later
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
require('../../../../main.inc.php'); ?> require('../../../../main.inc.php');
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> ?>
<!-- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
* FCKeditor - The text editor for Internet - http://www.fckeditor.net <!--
* Copyright (C) 2003-2010 Frederico Caldeira Knabben * FCKeditor - The text editor for Internet - http://www.fckeditor.net
* * Copyright (C) 2003-2010 Frederico Caldeira Knabben
* == BEGIN LICENSE == *
* * == BEGIN LICENSE ==
* Licensed under the terms of any of the following licenses at your *
* choice: * Licensed under the terms of any of the following licenses at your
* * choice:
* - GNU General Public License Version 2 or later (the "GPL") *
* http://www.gnu.org/licenses/gpl.html * - GNU General Public License Version 2 or later (the "GPL")
* * http://www.gnu.org/licenses/gpl.html
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL") *
* http://www.gnu.org/licenses/lgpl.html * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* * http://www.gnu.org/licenses/lgpl.html
* - Mozilla Public License Version 1.1 or later (the "MPL") *
* http://www.mozilla.org/MPL/MPL-1.1.html * - Mozilla Public License Version 1.1 or later (the "MPL")
* * http://www.mozilla.org/MPL/MPL-1.1.html
* == END LICENSE == *
* * == END LICENSE ==
* Page used to create new folders in the current folder. *
--> * Page used to create new folders in the current folder.
<html> -->
<head> <html>
<title>Create Folder</title> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Create Folder</title>
<link href="browser.css" type="text/css" rel="stylesheet"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="js/common.js"></script> <link href="browser.css" type="text/css" rel="stylesheet">
<script type="text/javascript"> <script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript">
function SetCurrentFolder( resourceType, folderPath )
{ function SetCurrentFolder( resourceType, folderPath )
oConnector.ResourceType = resourceType ; {
oConnector.CurrentFolder = folderPath ; oConnector.ResourceType = resourceType ;
} oConnector.CurrentFolder = folderPath ;
}
function CreateFolder()
{ function CreateFolder()
var sFolderName ; {
var sFolderName ;
while ( true )
{ while ( true )
sFolderName = prompt( 'Type the name of the new folder:', '' ); {
sFolderName = prompt( 'Type the name of the new folder:', '' );
if ( sFolderName == null )
return ; if ( sFolderName == null )
else if ( sFolderName.length == 0 ) return ;
alert( 'Please type the folder name' ); else if ( sFolderName.length == 0 )
else alert( 'Please type the folder name' );
break ; else
} break ;
}
oConnector.SendCommand( 'CreateFolder', 'NewFolderName=' + encodeURIComponent( sFolderName) , CreateFolderCallBack );
} oConnector.SendCommand( 'CreateFolder', 'NewFolderName=' + encodeURIComponent( sFolderName) , CreateFolderCallBack );
}
function CreateFolderCallBack( fckXml )
{ function CreateFolderCallBack( fckXml )
if ( oConnector.CheckError( fckXml ) == 0 ) {
window.parent.frames['frmResourcesList'].Refresh(); if ( oConnector.CheckError( fckXml ) == 0 )
window.parent.frames['frmResourcesList'].Refresh();
/*
// Get the current folder path. /*
var oNode = fckXml.SelectSingleNode( 'Connector/Error' ); // Get the current folder path.
var iErrorNumber = parseInt( oNode.attributes.getNamedItem('number').value ); var oNode = fckXml.SelectSingleNode( 'Connector/Error' );
var iErrorNumber = parseInt( oNode.attributes.getNamedItem('number').value );
switch ( iErrorNumber )
{ switch ( iErrorNumber )
case 0 : {
window.parent.frames['frmResourcesList'].Refresh(); case 0 :
break ; window.parent.frames['frmResourcesList'].Refresh();
case 101 : break ;
alert( 'Folder already exists' ); case 101 :
break ; alert( 'Folder already exists' );
case 102 : break ;
alert( 'Invalid folder name' ); case 102 :
break ; alert( 'Invalid folder name' );
case 103 : break ;
alert( 'You have no permissions to create the folder' ); case 103 :
break ; alert( 'You have no permissions to create the folder' );
case 110 : break ;
alert( 'Unknown error creating folder' ); case 110 :
break ; alert( 'Unknown error creating folder' );
default : break ;
alert( 'Error creating folder. Error number: ' + iErrorNumber ); default :
break ; alert( 'Error creating folder. Error number: ' + iErrorNumber );
} break ;
*/ }
} */
}
window.onload = function()
{ window.onload = function()
window.top.IsLoadedCreateFolder = true ; {
} window.top.IsLoadedCreateFolder = true ;
</script> }
</head> </script>
<body> </head>
<table class="fullHeight" cellSpacing="0" cellPadding="0" width="100%" border="0"> <body>
<tr> <table class="fullHeight" cellSpacing="0" cellPadding="0" width="100%" border="0">
<td> <tr>
<button type="button" style="WIDTH: 100%" onclick="CreateFolder();"> <td>
<table cellSpacing="0" cellPadding="0" border="0"> <button type="button" style="WIDTH: 100%" onclick="CreateFolder();">
<tr> <table cellSpacing="0" cellPadding="0" border="0">
<td><?php echo img_picto_common('','treemenu/folder.gif','width="16" height="16"'); ?></td> <tr>
<td>&nbsp;</td> <td><?php echo img_picto_common('','treemenu/folder.gif','width="16" height="16"'); ?></td>
<td nowrap>Create New Folder</td> <td>&nbsp;</td>
</tr> <td nowrap>Create New Folder</td>
</table> </tr>
</button> </table>
</td> </button>
</tr> </td>
</table> </tr>
</body> </table>
</html> </body>
</html>

View File

@ -1,224 +1,225 @@
<?php <?php
/* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2003-2010 Frederico Caldeira Knabben * Copyright (C) 2003-2010 Frederico Caldeira Knabben
* *
* Source modified from part of fckeditor (http://www.fckeditor.net) * Source modified from part of fckeditor (http://www.fckeditor.net)
* retreived as GPL v2 or later * retreived as GPL v2 or later
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
require('../../../../main.inc.php'); ?> require('../../../../main.inc.php');
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> ?>
<!-- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
* FCKeditor - The text editor for Internet - http://www.fckeditor.net <!--
* Copyright (C) 2003-2010 Frederico Caldeira Knabben * FCKeditor - The text editor for Internet - http://www.fckeditor.net
* * Copyright (C) 2003-2010 Frederico Caldeira Knabben
* == BEGIN LICENSE == *
* * == BEGIN LICENSE ==
* Licensed under the terms of any of the following licenses at your *
* choice: * Licensed under the terms of any of the following licenses at your
* * choice:
* - GNU General Public License Version 2 or later (the "GPL") *
* http://www.gnu.org/licenses/gpl.html * - GNU General Public License Version 2 or later (the "GPL")
* * http://www.gnu.org/licenses/gpl.html
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL") *
* http://www.gnu.org/licenses/lgpl.html * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* * http://www.gnu.org/licenses/lgpl.html
* - Mozilla Public License Version 1.1 or later (the "MPL") *
* http://www.mozilla.org/MPL/MPL-1.1.html * - Mozilla Public License Version 1.1 or later (the "MPL")
* * http://www.mozilla.org/MPL/MPL-1.1.html
* == END LICENSE == *
* * == END LICENSE ==
* This page shows the list of folders available in the parent folder *
* of the current folder. * This page shows the list of folders available in the parent folder
--> * of the current folder.
<?php -->
//$arrayofjs=array('js/common.js'); <?php
//echo top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers //$arrayofjs=array('js/common.js');
?> //echo top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
<html> ?>
<head> <html>
<title>Folders</title> <head>
<link href="browser.css" type="text/css" rel="stylesheet"> <title>Folders</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link href="browser.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="js/common.js"></script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript"> <script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript">
var sActiveFolder ;
var sActiveFolder ;
var bIsLoaded = false ;
var iIntervalId ; var bIsLoaded = false ;
var iIntervalId ;
var oListManager = new Object();
var oListManager = new Object();
oListManager.Init = function()
{ oListManager.Init = function()
this.Table = document.getElementById('tableFiles'); {
this.UpRow = document.getElementById('trUp'); this.Table = document.getElementById('tableFiles');
this.UpRow = document.getElementById('trUp');
this.TableRows = new Object();
} this.TableRows = new Object();
}
oListManager.Clear = function()
{ oListManager.Clear = function()
// Remove all other rows available. {
while ( this.Table.rows.length > 1 ) // Remove all other rows available.
this.Table.deleteRow(1); while ( this.Table.rows.length > 1 )
this.Table.deleteRow(1);
// Reset the TableRows collection.
this.TableRows = new Object(); // Reset the TableRows collection.
} this.TableRows = new Object();
}
oListManager.AddItem = function( folderName, folderPath )
{ oListManager.AddItem = function( folderName, folderPath )
// Create the new row. {
var oRow = this.Table.insertRow(-1); // Create the new row.
oRow.className = 'FolderListFolder' ; var oRow = this.Table.insertRow(-1);
oRow.className = 'FolderListFolder' ;
// Build the link to view the folder.
var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath + '\');return false;">' ; // Build the link to view the folder.
var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath + '\');return false;">' ;
// Add the folder icon cell.
var oCell = oRow.insertCell(-1); // Add the folder icon cell.
oCell.width = 16 ; var oCell = oRow.insertCell(-1);
oCell.innerHTML = sLink + '<img alt="" src="spacer.gif" width="16" height="16" border="0"><\/a>' ; oCell.width = 16 ;
oCell.innerHTML = sLink + '<img alt="" src="spacer.gif" width="16" height="16" border="0"><\/a>' ;
// Add the folder name cell.
oCell = oRow.insertCell(-1); // Add the folder name cell.
oCell.noWrap = true ; oCell = oRow.insertCell(-1);
oCell.innerHTML = '&nbsp;' + sLink + folderName + '<\/a>' ; oCell.noWrap = true ;
oCell.innerHTML = '&nbsp;' + sLink + folderName + '<\/a>' ;
this.TableRows[ folderPath ] = oRow ;
} this.TableRows[ folderPath ] = oRow ;
}
oListManager.ShowUpFolder = function( upFolderPath )
{ oListManager.ShowUpFolder = function( upFolderPath )
this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' ); {
this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' );
if ( upFolderPath != null )
{ if ( upFolderPath != null )
document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function() {
{ document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function()
LoadFolders( upFolderPath ); {
return false ; LoadFolders( upFolderPath );
} return false ;
} }
} }
}
function CheckLoaded()
{ function CheckLoaded()
if ( window.top.IsLoadedActualFolder {
&& window.top.IsLoadedCreateFolder if ( window.top.IsLoadedActualFolder
&& window.top.IsLoadedUpload && window.top.IsLoadedCreateFolder
&& window.top.IsLoadedResourcesList ) && window.top.IsLoadedUpload
{ && window.top.IsLoadedResourcesList )
window.clearInterval( iIntervalId ); {
bIsLoaded = true ; window.clearInterval( iIntervalId );
OpenFolder( sActiveFolder ); bIsLoaded = true ;
} OpenFolder( sActiveFolder );
} }
}
function OpenFolder( folderPath )
{ function OpenFolder( folderPath )
sActiveFolder = folderPath ; {
sActiveFolder = folderPath ;
if ( ! bIsLoaded )
{ if ( ! bIsLoaded )
if ( ! iIntervalId ) {
iIntervalId = window.setInterval( CheckLoaded, 100 ); if ( ! iIntervalId )
return ; iIntervalId = window.setInterval( CheckLoaded, 100 );
} return ;
}
// Change the style for the select row (to show the opened folder).
for ( var sFolderPath in oListManager.TableRows ) // Change the style for the select row (to show the opened folder).
{ for ( var sFolderPath in oListManager.TableRows )
oListManager.TableRows[ sFolderPath ].className = {
( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' ); oListManager.TableRows[ sFolderPath ].className =
} ( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' );
}
// Set the current folder in all frames.
window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ); // Set the current folder in all frames.
window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ); window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath );
window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath ); window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath );
window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath );
// Load the resources list for this folder.
window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath ); // Load the resources list for this folder.
} window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath );
}
function LoadFolders( folderPath )
{ function LoadFolders( folderPath )
// Clear the folders list. {
oListManager.Clear(); // Clear the folders list.
oListManager.Clear();
// Get the parent folder path.
var sParentFolderPath ; // Get the parent folder path.
if ( folderPath != '/' ) var sParentFolderPath ;
sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 ); if ( folderPath != '/' )
sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 );
// Show/Hide the Up Folder.
oListManager.ShowUpFolder( sParentFolderPath ); // Show/Hide the Up Folder.
oListManager.ShowUpFolder( sParentFolderPath );
if ( folderPath != '/' )
{ if ( folderPath != '/' )
sActiveFolder = folderPath ; {
oConnector.CurrentFolder = sParentFolderPath ; sActiveFolder = folderPath ;
oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack ); oConnector.CurrentFolder = sParentFolderPath ;
} oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack );
else }
OpenFolder( '/' ); else
} OpenFolder( '/' );
}
function GetFoldersCallBack( fckXml )
{ function GetFoldersCallBack( fckXml )
if ( oConnector.CheckError( fckXml ) != 0 ) {
return ; if ( oConnector.CheckError( fckXml ) != 0 )
return ;
// Get the current folder path.
var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ); // Get the current folder path.
var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ; var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' );
var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ;
var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' );
var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' );
for ( var i = 0 ; i < oNodes.length ; i++ )
{ for ( var i = 0 ; i < oNodes.length ; i++ )
var sFolderName = oNodes[i].attributes.getNamedItem('name').value ; {
oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + '/' ); var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
} oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + '/' );
}
OpenFolder( sActiveFolder );
} OpenFolder( sActiveFolder );
}
function SetResourceType( type )
{ function SetResourceType( type )
oConnector.ResourceType = type ; {
LoadFolders( '/' ); oConnector.ResourceType = type ;
} LoadFolders( '/' );
}
window.onload = function()
{ window.onload = function()
oListManager.Init(); {
LoadFolders( '/' ); oListManager.Init();
} LoadFolders( '/' );
</script> }
</head> </script>
<body class="FileArea"> </head>
<table id="tableFiles" cellSpacing="0" cellPadding="0" width="100%" border="0"> <body class="FileArea">
<tr id="trUp" style="DISPLAY: none"> <table id="tableFiles" cellSpacing="0" cellPadding="0" width="100%" border="0">
<td width="16"><a id="linkUpIcon" href="#"><img alt="" src="images/FolderUp.gif" width="16" height="16" border="0"></a></td> <tr id="trUp" style="DISPLAY: none">
<td nowrap width="100%">&nbsp;<a id="linkUp" href="#">..</a></td> <td width="16"><a id="linkUpIcon" href="#"><img alt="" src="images/FolderUp.gif" width="16" height="16" border="0"></a></td>
</tr> <td nowrap width="100%">&nbsp;<a id="linkUp" href="#">..</a></td>
</table> </tr>
</body> </table>
</html> </body>
</html>

View File

@ -1,205 +1,206 @@
<?php <?php
/* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2003-2010 Frederico Caldeira Knabben * Copyright (C) 2003-2010 Frederico Caldeira Knabben
* *
* Source modified from part of fckeditor (http://www.fckeditor.net) * Source modified from part of fckeditor (http://www.fckeditor.net)
* retreived as GPL v2 or later * retreived as GPL v2 or later
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
require('../../../../main.inc.php'); ?> require('../../../../main.inc.php');
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> ?>
<!-- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
* FCKeditor - The text editor for Internet - http://www.fckeditor.net <!--
* Copyright (C) 2003-2010 Frederico Caldeira Knabben * FCKeditor - The text editor for Internet - http://www.fckeditor.net
* * Copyright (C) 2003-2010 Frederico Caldeira Knabben
* == BEGIN LICENSE == *
* * == BEGIN LICENSE ==
* Licensed under the terms of any of the following licenses at your *
* choice: * Licensed under the terms of any of the following licenses at your
* * choice:
* - GNU General Public License Version 2 or later (the "GPL") *
* http://www.gnu.org/licenses/gpl.html * - GNU General Public License Version 2 or later (the "GPL")
* * http://www.gnu.org/licenses/gpl.html
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL") *
* http://www.gnu.org/licenses/lgpl.html * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* * http://www.gnu.org/licenses/lgpl.html
* - Mozilla Public License Version 1.1 or later (the "MPL") *
* http://www.mozilla.org/MPL/MPL-1.1.html * - Mozilla Public License Version 1.1 or later (the "MPL")
* * http://www.mozilla.org/MPL/MPL-1.1.html
* == END LICENSE == *
* * == END LICENSE ==
* This page shows all resources available in a folder in the File Browser. *
--> * This page shows all resources available in a folder in the File Browser.
<html> -->
<head> <html>
<title>Resources</title> <head>
<link href="browser.css" type="text/css" rel="stylesheet"> <title>Resources</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link href="browser.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="js/common.js"></script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript"> <script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript">
var oListManager = new Object();
var oListManager = new Object();
oListManager.Clear = function()
{ oListManager.Clear = function()
document.body.innerHTML = '' ; {
} document.body.innerHTML = '' ;
}
function ProtectPath(path)
{ function ProtectPath(path)
path = path.replace( /\\/g, '\\\\'); {
path = path.replace( /'/g, '\\\''); path = path.replace( /\\/g, '\\\\');
return path ; path = path.replace( /'/g, '\\\'');
} return path ;
}
oListManager.GetFolderRowHtml = function( folderName, folderPath )
{ oListManager.GetFolderRowHtml = function( folderName, folderPath )
// Build the link to view the folder. {
var sLink = '<a href="#" onclick="OpenFolder(\'' + ProtectPath(folderPath ) + '\');return false;">' ; // Build the link to view the folder.
var sLink = '<a href="#" onclick="OpenFolder(\'' + ProtectPath(folderPath ) + '\');return false;">' ;
return '<tr>' +
'<td width="16">' + return '<tr>' +
sLink + '<td width="16">' +
'<img alt="" src="images/Folder.gif" width="16" height="16" border="0"><\/a>' + sLink +
'<\/td><td nowrap colspan="2">&nbsp;' + '<img alt="" src="images/Folder.gif" width="16" height="16" border="0"><\/a>' +
sLink + '<\/td><td nowrap colspan="2">&nbsp;' +
folderName + sLink +
'<\/a>' + folderName +
'<\/td><\/tr>' ; '<\/a>' +
} '<\/td><\/tr>' ;
}
oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )
{ oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )
// Build the link to view the folder. {
var sLink = '<a href="#" onclick="OpenFile(\'' + ProtectPath(fileUrl ) + '\');return false;">' ; // Build the link to view the folder.
var sLink = '<a href="#" onclick="OpenFile(\'' + ProtectPath(fileUrl ) + '\');return false;">' ;
// Get the file icon.
var sIcon = oIcons.GetIcon( fileName ); // Get the file icon.
var sIcon = oIcons.GetIcon( fileName );
return '<tr>' +
'<td width="16">' + return '<tr>' +
sLink + '<td width="16">' +
'<img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0"><\/a>' + sLink +
'<\/td><td>&nbsp;' + '<img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0"><\/a>' +
sLink + '<\/td><td>&nbsp;' +
fileName + sLink +
'<\/a>' + fileName +
'<\/td><td align="right" nowrap>&nbsp;' + '<\/a>' +
fileSize + '<\/td><td align="right" nowrap>&nbsp;' +
' KB' + fileSize +
'<\/td><\/tr>' ; ' KB' +
} '<\/td><\/tr>' ;
}
function OpenFolder( folderPath )
{ function OpenFolder( folderPath )
// Load the resources list for this folder. {
window.parent.frames['frmFolders'].LoadFolders( folderPath ); // Load the resources list for this folder.
} window.parent.frames['frmFolders'].LoadFolders( folderPath );
}
function GetUrlParam( paramName )
{ function GetUrlParam( paramName )
var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' ); {
var oMatch = oRegex.exec( window.top.location.search ); var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' );
var oMatch = oRegex.exec( window.top.location.search );
if ( oMatch && oMatch.length > 1 )
return decodeURIComponent( oMatch[1] ); if ( oMatch && oMatch.length > 1 )
else return decodeURIComponent( oMatch[1] );
return '' ; else
} return '' ;
}
function OpenFile( fileUrl )
{ function OpenFile( fileUrl )
funcNum = GetUrlParam('CKEditorFuncNum'); {
window.top.opener.CKEDITOR.tools.callFunction(funcNum, encodeURI( fileUrl ).replace( '#', '%23' )); funcNum = GetUrlParam('CKEditorFuncNum');
window.top.opener.CKEDITOR.tools.callFunction(funcNum, encodeURI( fileUrl ).replace( '#', '%23' ));
///////////////////////////////////
window.top.close(); ///////////////////////////////////
window.top.opener.focus(); window.top.close();
} window.top.opener.focus();
}
function LoadResources( resourceType, folderPath )
{ function LoadResources( resourceType, folderPath )
oListManager.Clear(); {
oConnector.ResourceType = resourceType ; oListManager.Clear();
oConnector.CurrentFolder = folderPath ; oConnector.ResourceType = resourceType ;
oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack ); oConnector.CurrentFolder = folderPath ;
} oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack );
}
function Refresh()
{ function Refresh()
LoadResources( oConnector.ResourceType, oConnector.CurrentFolder ); {
} LoadResources( oConnector.ResourceType, oConnector.CurrentFolder );
}
function GetFoldersAndFilesCallBack( fckXml )
{ function GetFoldersAndFilesCallBack( fckXml )
if ( oConnector.CheckError( fckXml ) != 0 ) {
return ; if ( oConnector.CheckError( fckXml ) != 0 )
return ;
// Get the current folder path.
var oFolderNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ); // Get the current folder path.
if ( oFolderNode == null ) var oFolderNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' );
{ if ( oFolderNode == null )
alert( 'The server didn\'t reply with a proper XML data. Please check your configuration.' ); {
return ; alert( 'The server didn\'t reply with a proper XML data. Please check your configuration.' );
} return ;
var sCurrentFolderPath = oFolderNode.attributes.getNamedItem('path').value ; }
var sCurrentFolderUrl = oFolderNode.attributes.getNamedItem('url').value ; var sCurrentFolderPath = oFolderNode.attributes.getNamedItem('path').value ;
var sCurrentFolderUrl = oFolderNode.attributes.getNamedItem('url').value ;
// var dTimer = new Date();
// var dTimer = new Date();
var oHtml = new StringBuilder( '<table id="tableFiles" cellspacing="1" cellpadding="0" width="100%" border="0">' );
var oHtml = new StringBuilder( '<table id="tableFiles" cellspacing="1" cellpadding="0" width="100%" border="0">' );
// Add the Folders.
var oNodes ; // Add the Folders.
oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ); var oNodes ;
for ( var i = 0 ; i < oNodes.length ; i++ ) oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' );
{ for ( var i = 0 ; i < oNodes.length ; i++ )
var sFolderName = oNodes[i].attributes.getNamedItem('name').value ; {
oHtml.Append( oListManager.GetFolderRowHtml( sFolderName, sCurrentFolderPath + sFolderName + "/" ) ); var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
} oHtml.Append( oListManager.GetFolderRowHtml( sFolderName, sCurrentFolderPath + sFolderName + "/" ) );
}
// Add the Files.
oNodes = fckXml.SelectNodes( 'Connector/Files/File' ); // Add the Files.
for ( var j = 0 ; j < oNodes.length ; j++ ) oNodes = fckXml.SelectNodes( 'Connector/Files/File' );
{ for ( var j = 0 ; j < oNodes.length ; j++ )
var oNode = oNodes[j] ; {
var sFileName = oNode.attributes.getNamedItem('name').value ; var oNode = oNodes[j] ;
var sFileSize = oNode.attributes.getNamedItem('size').value ; var sFileName = oNode.attributes.getNamedItem('name').value ;
var sFileSize = oNode.attributes.getNamedItem('size').value ;
// Get the optional "url" attribute. If not available, build the url.
var oFileUrlAtt = oNodes[j].attributes.getNamedItem('url'); // Get the optional "url" attribute. If not available, build the url.
var sFileUrl = oFileUrlAtt != null ? oFileUrlAtt.value : encodeURI( sCurrentFolderUrl + sFileName ).replace( /#/g, '%23' ); var oFileUrlAtt = oNodes[j].attributes.getNamedItem('url');
var sFileUrl = oFileUrlAtt != null ? oFileUrlAtt.value : encodeURI( sCurrentFolderUrl + sFileName ).replace( /#/g, '%23' );
oHtml.Append( oListManager.GetFileRowHtml( sFileName, sFileUrl, sFileSize ) );
} oHtml.Append( oListManager.GetFileRowHtml( sFileName, sFileUrl, sFileSize ) );
}
oHtml.Append( '<\/table>' );
oHtml.Append( '<\/table>' );
document.body.innerHTML = oHtml.ToString();
document.body.innerHTML = oHtml.ToString();
// window.top.document.title = 'Finished processing in ' + ( ( ( new Date() ) - dTimer ) / 1000 ) + ' seconds' ;
// window.top.document.title = 'Finished processing in ' + ( ( ( new Date() ) - dTimer ) / 1000 ) + ' seconds' ;
}
}
window.onload = function()
{ window.onload = function()
window.top.IsLoadedResourcesList = true ; {
} window.top.IsLoadedResourcesList = true ;
</script> }
</head> </script>
<body class="FileArea"> </head>
</body> <body class="FileArea">
</html> </body>
</html>

View File

@ -1,137 +1,138 @@
<?php <?php
/* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2003-2010 Frederico Caldeira Knabben * Copyright (C) 2003-2010 Frederico Caldeira Knabben
* *
* Source modified from part of fckeditor (http://www.fckeditor.net) * Source modified from part of fckeditor (http://www.fckeditor.net)
* retreived as GPL v2 or later * retreived as GPL v2 or later
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
require('../../../../main.inc.php'); ?> require('../../../../main.inc.php');
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> ?>
<!-- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
* FCKeditor - The text editor for Internet - http://www.fckeditor.net <!--
* Copyright (C) 2003-2010 Frederico Caldeira Knabben * FCKeditor - The text editor for Internet - http://www.fckeditor.net
* * Copyright (C) 2003-2010 Frederico Caldeira Knabben
* == BEGIN LICENSE == *
* * == BEGIN LICENSE ==
* Licensed under the terms of any of the following licenses at your *
* choice: * Licensed under the terms of any of the following licenses at your
* * choice:
* - GNU General Public License Version 2 or later (the "GPL") *
* http://www.gnu.org/licenses/gpl.html * - GNU General Public License Version 2 or later (the "GPL")
* * http://www.gnu.org/licenses/gpl.html
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL") *
* http://www.gnu.org/licenses/lgpl.html * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* * http://www.gnu.org/licenses/lgpl.html
* - Mozilla Public License Version 1.1 or later (the "MPL") *
* http://www.mozilla.org/MPL/MPL-1.1.html * - Mozilla Public License Version 1.1 or later (the "MPL")
* * http://www.mozilla.org/MPL/MPL-1.1.html
* == END LICENSE == *
* * == END LICENSE ==
* Page used to upload new files in the current folder. *
--> * Page used to upload new files in the current folder.
<html> -->
<head> <html>
<title>File Upload</title> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>File Upload</title>
<link href="browser.css" type="text/css" rel="stylesheet" > <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="js/common.js"></script> <link href="browser.css" type="text/css" rel="stylesheet" >
<script type="text/javascript"> <script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript">
function SetCurrentFolder( resourceType, folderPath )
{ function SetCurrentFolder( resourceType, folderPath )
var sUrl = oConnector.ConnectorUrl + 'Command=FileUpload' ; {
sUrl += '&Type=' + resourceType ; var sUrl = oConnector.ConnectorUrl + 'Command=FileUpload' ;
sUrl += '&CurrentFolder=' + encodeURIComponent( folderPath ); sUrl += '&Type=' + resourceType ;
sUrl += '&CurrentFolder=' + encodeURIComponent( folderPath );
document.getElementById('frmUpload').action = sUrl ;
} document.getElementById('frmUpload').action = sUrl ;
}
function OnSubmit()
{ function OnSubmit()
if ( document.getElementById('NewFile').value.length == 0 ) {
{ if ( document.getElementById('NewFile').value.length == 0 )
alert( 'Please select a file from your computer' ); {
return false ; alert( 'Please select a file from your computer' );
} return false ;
}
// Set the interface elements.
document.getElementById('eUploadMessage').innerHTML = 'Upload a new file in this folder (Upload in progress, please wait...)' ; // Set the interface elements.
document.getElementById('btnUpload').disabled = true ; document.getElementById('eUploadMessage').innerHTML = 'Upload a new file in this folder (Upload in progress, please wait...)' ;
document.getElementById('btnUpload').disabled = true ;
return true ;
} return true ;
}
function OnUploadCompleted( errorNumber, data )
{ function OnUploadCompleted( errorNumber, data )
// Reset the Upload Worker Frame. {
window.parent.frames['frmUploadWorker'].location = 'javascript:void(0)' ; // Reset the Upload Worker Frame.
window.parent.frames['frmUploadWorker'].location = 'javascript:void(0)' ;
// Reset the upload form (On IE we must do a little trick to avoid problems).
if ( document.all ) // Reset the upload form (On IE we must do a little trick to avoid problems).
document.getElementById('NewFile').outerHTML = '<input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file">' ; if ( document.all )
else document.getElementById('NewFile').outerHTML = '<input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file">' ;
document.getElementById('frmUpload').reset(); else
document.getElementById('frmUpload').reset();
// Reset the interface elements.
document.getElementById('eUploadMessage').innerHTML = 'Upload a new file in this folder' ; // Reset the interface elements.
document.getElementById('btnUpload').disabled = false ; document.getElementById('eUploadMessage').innerHTML = 'Upload a new file in this folder' ;
document.getElementById('btnUpload').disabled = false ;
switch ( errorNumber )
{ switch ( errorNumber )
case 0 : {
window.parent.frames['frmResourcesList'].Refresh(); case 0 :
break ; window.parent.frames['frmResourcesList'].Refresh();
case 1 : // Custom error. break ;
alert( data ); case 1 : // Custom error.
break ; alert( data );
case 201 : break ;
window.parent.frames['frmResourcesList'].Refresh(); case 201 :
alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + data + '"' ); window.parent.frames['frmResourcesList'].Refresh();
break ; alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + data + '"' );
case 202 : break ;
alert( 'Invalid file' ); case 202 :
break ; alert( 'Invalid file' );
default : break ;
alert( 'Error on file upload. Error number: ' + errorNumber ); default :
break ; alert( 'Error on file upload. Error number: ' + errorNumber );
} break ;
} }
}
window.onload = function()
{ window.onload = function()
window.top.IsLoadedUpload = true ; {
} window.top.IsLoadedUpload = true ;
</script> }
</head> </script>
<body> </head>
<form id="frmUpload" action="" target="frmUploadWorker" method="post" enctype="multipart/form-data" onsubmit="return OnSubmit();"> <body>
<table class="fullHeight" cellspacing="0" cellpadding="0" width="100%" border="0"> <form id="frmUpload" action="" target="frmUploadWorker" method="post" enctype="multipart/form-data" onsubmit="return OnSubmit();">
<tr> <table class="fullHeight" cellspacing="0" cellpadding="0" width="100%" border="0">
<td nowrap="nowrap"> <tr>
<span id="eUploadMessage">Upload a new file in this folder</span><br> <td nowrap="nowrap">
<table cellspacing="0" cellpadding="0" width="100%" border="0"> <span id="eUploadMessage">Upload a new file in this folder</span><br>
<tr> <table cellspacing="0" cellpadding="0" width="100%" border="0">
<td width="100%"><input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file"></td> <tr>
<td nowrap="nowrap">&nbsp;<input id="btnUpload" type="submit" value="Upload"></td> <td width="100%"><input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file"></td>
</tr> <td nowrap="nowrap">&nbsp;<input id="btnUpload" type="submit" value="Upload"></td>
</table> </tr>
</td> </table>
</tr> </td>
</table> </tr>
</form> </table>
</body> </form>
</html> </body>
</html>

View File

@ -1,99 +1,104 @@
<?php <?php
/* /*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net * FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2010 Frederico Caldeira Knabben * Copyright (C) 2003-2010 Frederico Caldeira Knabben
* *
* == BEGIN LICENSE == * == BEGIN LICENSE ==
* *
* Licensed under the terms of any of the following licenses at your * Licensed under the terms of any of the following licenses at your
* choice: * choice:
* *
* - GNU General Public License Version 2 or later (the "GPL") * - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html * http://www.gnu.org/licenses/gpl.html
* *
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html * http://www.gnu.org/licenses/lgpl.html
* *
* - Mozilla Public License Version 1.1 or later (the "MPL") * - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html * http://www.mozilla.org/MPL/MPL-1.1.html
* *
* == END LICENSE == * == END LICENSE ==
* *
* These functions define the base of the XML response sent by the PHP * These functions define the base of the XML response sent by the PHP
* connector. * connector.
*/ */
function SetXmlHeaders() /**
{ * SetXmlHeaders
ob_end_clean(); *
* @return void
// Prevent the browser from caching the result. */
// Date in the past function SetXmlHeaders()
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); {
// always modified ob_end_clean();
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
// HTTP/1.1 // Prevent the browser from caching the result.
header('Cache-Control: no-store, no-cache, must-revalidate'); // Date in the past
header('Cache-Control: post-check=0, pre-check=0', false); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
// HTTP/1.0 // always modified
header('Pragma: no-cache'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
// HTTP/1.1
// Set the response format. header('Cache-Control: no-store, no-cache, must-revalidate');
header( 'Content-Type: text/xml; charset=utf-8' ); header('Cache-Control: post-check=0, pre-check=0', false);
} // HTTP/1.0
header('Pragma: no-cache');
function CreateXmlHeader( $command, $resourceType, $currentFolder )
{ // Set the response format.
SetXmlHeaders(); header( 'Content-Type: text/xml; charset=utf-8' );
}
// Create the XML document header.
echo '<?xml version="1.0" encoding="utf-8" ?>' ; function CreateXmlHeader( $command, $resourceType, $currentFolder )
{
// Create the main "Connector" node. SetXmlHeaders();
echo '<Connector command="' . $command . '" resourceType="' . $resourceType . '">' ;
// Create the XML document header.
// Add the current folder node. echo '<?xml version="1.0" encoding="utf-8" ?>' ;
echo '<CurrentFolder path="' . ConvertToXmlAttribute( $currentFolder ) . '" url="' . ConvertToXmlAttribute( GetUrlFromPath( $resourceType, $currentFolder, $command ) ) . '" />' ;
// Create the main "Connector" node.
$GLOBALS['HeaderSent'] = true ; echo '<Connector command="' . $command . '" resourceType="' . $resourceType . '">' ;
}
// Add the current folder node.
function CreateXmlFooter() echo '<CurrentFolder path="' . ConvertToXmlAttribute( $currentFolder ) . '" url="' . ConvertToXmlAttribute( GetUrlFromPath( $resourceType, $currentFolder, $command ) ) . '" />' ;
{
echo '</Connector>' ; $GLOBALS['HeaderSent'] = true ;
} }
function SendError( $number, $text ) function CreateXmlFooter()
{ {
if ( $_GET['Command'] == 'FileUpload' ) echo '</Connector>' ;
SendUploadResults( $number, "", "", $text ); }
if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] ) function SendError( $number, $text )
{ {
SendErrorNode( $number, $text ); if ( $_GET['Command'] == 'FileUpload' )
CreateXmlFooter(); SendUploadResults( $number, "", "", $text );
}
else if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] )
{ {
SetXmlHeaders(); SendErrorNode( $number, $text );
CreateXmlFooter();
// Create the XML document header }
echo '<?xml version="1.0" encoding="utf-8" ?>' ; else
{
echo '<Connector>' ; SetXmlHeaders();
SendErrorNode( $number, $text ); // Create the XML document header
echo '<?xml version="1.0" encoding="utf-8" ?>' ;
echo '</Connector>' ;
} echo '<Connector>' ;
exit ;
} SendErrorNode( $number, $text );
function SendErrorNode( $number, $text ) echo '</Connector>' ;
{ }
if ($text) exit ;
echo '<Error number="' . $number . '" text="' . htmlspecialchars( $text ) . '" />' ; }
else
echo '<Error number="' . $number . '" />' ; function SendErrorNode( $number, $text )
} {
?> if ($text)
echo '<Error number="' . $number . '" text="' . htmlspecialchars( $text ) . '" />' ;
else
echo '<Error number="' . $number . '" />' ;
}
?>

View File

@ -1,299 +1,299 @@
<?php <?php
/* /*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net * FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2010 Frederico Caldeira Knabben * Copyright (C) 2003-2010 Frederico Caldeira Knabben
* *
* == BEGIN LICENSE == * == BEGIN LICENSE ==
* *
* Licensed under the terms of any of the following licenses at your * Licensed under the terms of any of the following licenses at your
* choice: * choice:
* *
* - GNU General Public License Version 2 or later (the "GPL") * - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html * http://www.gnu.org/licenses/gpl.html
* *
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html * http://www.gnu.org/licenses/lgpl.html
* *
* - Mozilla Public License Version 1.1 or later (the "MPL") * - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html * http://www.mozilla.org/MPL/MPL-1.1.html
* *
* == END LICENSE == * == END LICENSE ==
* *
* This is the File Manager Connector for PHP. * This is the File Manager Connector for PHP.
*/ */
function GetFolders( $resourceType, $currentFolder ) function GetFolders( $resourceType, $currentFolder )
{ {
// Map the virtual path to the local server path. // Map the virtual path to the local server path.
$sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFolders' ); $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFolders' );
// Array that will hold the folders names. // Array that will hold the folders names.
$aFolders = array(); $aFolders = array();
$oCurrentFolder = @opendir( $sServerDir ); $oCurrentFolder = @opendir( $sServerDir );
if ($oCurrentFolder !== false) if ($oCurrentFolder !== false)
{ {
while ( $sFile = readdir( $oCurrentFolder ) ) while ( $sFile = readdir( $oCurrentFolder ) )
{ {
if ( $sFile != '.' && $sFile != '..' && is_dir( $sServerDir . $sFile ) ) if ( $sFile != '.' && $sFile != '..' && is_dir( $sServerDir . $sFile ) )
$aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ; $aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ;
} }
closedir( $oCurrentFolder ); closedir( $oCurrentFolder );
} }
// Open the "Folders" node. // Open the "Folders" node.
echo "<Folders>" ; echo "<Folders>" ;
natcasesort( $aFolders ); natcasesort( $aFolders );
foreach ( $aFolders as $sFolder ) foreach ( $aFolders as $sFolder )
echo $sFolder ; echo $sFolder ;
// Close the "Folders" node. // Close the "Folders" node.
echo "</Folders>" ; echo "</Folders>" ;
} }
function GetFoldersAndFiles( $resourceType, $currentFolder ) function GetFoldersAndFiles( $resourceType, $currentFolder )
{ {
// Map the virtual path to the local server path. // Map the virtual path to the local server path.
$sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFoldersAndFiles' ); $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFoldersAndFiles' );
// Arrays that will hold the folders and files names. // Arrays that will hold the folders and files names.
$aFolders = array(); $aFolders = array();
$aFiles = array(); $aFiles = array();
$oCurrentFolder = @opendir( $sServerDir ); $oCurrentFolder = @opendir( $sServerDir );
if ($oCurrentFolder !== false) if ($oCurrentFolder !== false)
{ {
while ( $sFile = readdir( $oCurrentFolder ) ) while ( $sFile = readdir( $oCurrentFolder ) )
{ {
if ( $sFile != '.' && $sFile != '..' ) if ( $sFile != '.' && $sFile != '..' )
{ {
if ( is_dir( $sServerDir . $sFile ) ) if ( is_dir( $sServerDir . $sFile ) )
$aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ; $aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ;
else else
{ {
$iFileSize = @filesize( $sServerDir . $sFile ); $iFileSize = @filesize( $sServerDir . $sFile );
if ( !$iFileSize ) { if ( !$iFileSize ) {
$iFileSize = 0 ; $iFileSize = 0 ;
} }
if ( $iFileSize > 0 ) if ( $iFileSize > 0 )
{ {
$iFileSize = round( $iFileSize / 1024 ); $iFileSize = round( $iFileSize / 1024 );
if ( $iFileSize < 1 ) if ( $iFileSize < 1 )
$iFileSize = 1 ; $iFileSize = 1 ;
} }
$aFiles[] = '<File name="' . ConvertToXmlAttribute( $sFile ) . '" size="' . $iFileSize . '" />' ; $aFiles[] = '<File name="' . ConvertToXmlAttribute( $sFile ) . '" size="' . $iFileSize . '" />' ;
} }
} }
} }
closedir( $oCurrentFolder ); closedir( $oCurrentFolder );
} }
// Send the folders // Send the folders
natcasesort( $aFolders ); natcasesort( $aFolders );
echo '<Folders>' ; echo '<Folders>' ;
foreach ( $aFolders as $sFolder ) foreach ( $aFolders as $sFolder )
echo $sFolder ; echo $sFolder ;
echo '</Folders>' ; echo '</Folders>' ;
// Send the files // Send the files
natcasesort( $aFiles ); natcasesort( $aFiles );
echo '<Files>' ; echo '<Files>' ;
foreach ( $aFiles as $sFiles ) foreach ( $aFiles as $sFiles )
echo $sFiles ; echo $sFiles ;
echo '</Files>' ; echo '</Files>' ;
} }
function CreateFolder( $resourceType, $currentFolder ) function CreateFolder( $resourceType, $currentFolder )
{ {
if (!isset($_GET)) { if (!isset($_GET)) {
global $_GET; global $_GET;
} }
$sErrorNumber = '0' ; $sErrorNumber = '0' ;
$sErrorMsg = '' ; $sErrorMsg = '' ;
if ( isset( $_GET['NewFolderName'] ) ) if ( isset( $_GET['NewFolderName'] ) )
{ {
$sNewFolderName = $_GET['NewFolderName'] ; $sNewFolderName = $_GET['NewFolderName'] ;
$sNewFolderName = SanitizeFolderName( $sNewFolderName ); $sNewFolderName = SanitizeFolderName( $sNewFolderName );
if ( strpos( $sNewFolderName, '..' ) !== FALSE ) if ( strpos( $sNewFolderName, '..' ) !== FALSE )
$sErrorNumber = '102' ; // Invalid folder name. $sErrorNumber = '102' ; // Invalid folder name.
else else
{ {
// Map the virtual path to the local server path of the current folder. // Map the virtual path to the local server path of the current folder.
$sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'CreateFolder' ); $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'CreateFolder' );
if ( is_writable( $sServerDir ) ) if ( is_writable( $sServerDir ) )
{ {
$sServerDir .= $sNewFolderName ; $sServerDir .= $sNewFolderName ;
$sErrorMsg = CreateServerFolder( $sServerDir ); $sErrorMsg = CreateServerFolder( $sServerDir );
switch ( $sErrorMsg ) switch ( $sErrorMsg )
{ {
case '' : case '' :
$sErrorNumber = '0' ; $sErrorNumber = '0' ;
break ; break ;
case 'Invalid argument' : case 'Invalid argument' :
case 'No such file or directory' : case 'No such file or directory' :
$sErrorNumber = '102' ; // Path too long. $sErrorNumber = '102' ; // Path too long.
break ; break ;
default : default :
$sErrorNumber = '110' ; $sErrorNumber = '110' ;
break ; break ;
} }
} }
else else
$sErrorNumber = '103' ; $sErrorNumber = '103' ;
} }
} }
else else
$sErrorNumber = '102' ; $sErrorNumber = '102' ;
// Create the "Error" node. // Create the "Error" node.
echo '<Error number="' . $sErrorNumber . '" />' ; echo '<Error number="' . $sErrorNumber . '" />' ;
} }
// DOL_CHANGE // DOL_CHANGE
//function FileUpload( $resourceType, $currentFolder, $sCommand ) //function FileUpload( $resourceType, $currentFolder, $sCommand )
function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
{ {
if (!isset($_FILES)) { if (!isset($_FILES)) {
global $_FILES; global $_FILES;
} }
$sErrorNumber = '0' ; $sErrorNumber = '0' ;
$sFileName = '' ; $sFileName = '' ;
if ( isset( $_FILES['NewFile'] ) && !is_null( $_FILES['NewFile']['tmp_name'] ) if ( isset( $_FILES['NewFile'] ) && !is_null( $_FILES['NewFile']['tmp_name'] )
# This is for the QuickUpload tab box # This is for the QuickUpload tab box
or (isset($_FILES['upload']) and !is_null($_FILES['upload']['tmp_name']))) or (isset($_FILES['upload']) and !is_null($_FILES['upload']['tmp_name'])))
{ {
global $Config ; global $Config ;
$oFile = isset($_FILES['NewFile']) ? $_FILES['NewFile'] : $_FILES['upload']; $oFile = isset($_FILES['NewFile']) ? $_FILES['NewFile'] : $_FILES['upload'];
// Map the virtual path to the local server path. // Map the virtual path to the local server path.
$sServerDir = ServerMapFolder( $resourceType, $currentFolder, $sCommand ); $sServerDir = ServerMapFolder( $resourceType, $currentFolder, $sCommand );
// Get the uploaded file name. // Get the uploaded file name.
$sFileName = $oFile['name'] ; $sFileName = $oFile['name'] ;
$sFileName = SanitizeFileName( $sFileName ); $sFileName = SanitizeFileName( $sFileName );
$sOriginalFileName = $sFileName ; $sOriginalFileName = $sFileName ;
// Get the extension. // Get the extension.
$sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ); $sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) );
$sExtension = strtolower( $sExtension ); $sExtension = strtolower( $sExtension );
if ( isset( $Config['SecureImageUploads'] ) ) if ( isset( $Config['SecureImageUploads'] ) )
{ {
if ( ( $isImageValid = IsImageValid( $oFile['tmp_name'], $sExtension ) ) === false ) if ( ( $isImageValid = IsImageValid( $oFile['tmp_name'], $sExtension ) ) === false )
{ {
$sErrorNumber = '202' ; $sErrorNumber = '202' ;
} }
} }
if ( isset( $Config['HtmlExtensions'] ) ) if ( isset( $Config['HtmlExtensions'] ) )
{ {
if ( !IsHtmlExtension( $sExtension, $Config['HtmlExtensions'] ) && if ( !IsHtmlExtension( $sExtension, $Config['HtmlExtensions'] ) &&
( $detectHtml = DetectHtml( $oFile['tmp_name'] ) ) === true ) ( $detectHtml = DetectHtml( $oFile['tmp_name'] ) ) === true )
{ {
$sErrorNumber = '202' ; $sErrorNumber = '202' ;
} }
} }
// Check if it is an allowed extension. // Check if it is an allowed extension.
if ( !$sErrorNumber && IsAllowedExt( $sExtension, $resourceType ) ) if ( !$sErrorNumber && IsAllowedExt( $sExtension, $resourceType ) )
{ {
$iCounter = 0 ; $iCounter = 0 ;
while ( true ) while ( true )
{ {
$sFilePath = $sServerDir . $sFileName ; $sFilePath = $sServerDir . $sFileName ;
if ( is_file( $sFilePath ) ) if ( is_file( $sFilePath ) )
{ {
$iCounter++ ; $iCounter++ ;
$sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ; $sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ;
$sErrorNumber = '201' ; $sErrorNumber = '201' ;
} }
else else
{ {
move_uploaded_file( $oFile['tmp_name'], $sFilePath ); move_uploaded_file( $oFile['tmp_name'], $sFilePath );
if ( is_file( $sFilePath ) ) if ( is_file( $sFilePath ) )
{ {
if ( isset( $Config['ChmodOnUpload'] ) && !$Config['ChmodOnUpload'] ) if ( isset( $Config['ChmodOnUpload'] ) && !$Config['ChmodOnUpload'] )
{ {
break ; break ;
} }
$permissions = 0777; $permissions = 0777;
if ( isset( $Config['ChmodOnUpload'] ) && $Config['ChmodOnUpload'] ) if ( isset( $Config['ChmodOnUpload'] ) && $Config['ChmodOnUpload'] )
{ {
$permissions = $Config['ChmodOnUpload'] ; $permissions = $Config['ChmodOnUpload'] ;
} }
$oldumask = umask(0); $oldumask = umask(0);
chmod( $sFilePath, $permissions ); chmod( $sFilePath, $permissions );
umask( $oldumask ); umask( $oldumask );
} }
break ; break ;
} }
} }
if ( file_exists( $sFilePath ) ) if ( file_exists( $sFilePath ) )
{ {
//previous checks failed, try once again //previous checks failed, try once again
if ( isset( $isImageValid ) && $isImageValid === -1 && IsImageValid( $sFilePath, $sExtension ) === false ) if ( isset( $isImageValid ) && $isImageValid === -1 && IsImageValid( $sFilePath, $sExtension ) === false )
{ {
@unlink( $sFilePath ); @unlink( $sFilePath );
$sErrorNumber = '202' ; $sErrorNumber = '202' ;
} }
else if ( isset( $detectHtml ) && $detectHtml === -1 && DetectHtml( $sFilePath ) === true ) else if ( isset( $detectHtml ) && $detectHtml === -1 && DetectHtml( $sFilePath ) === true )
{ {
@unlink( $sFilePath ); @unlink( $sFilePath );
$sErrorNumber = '202' ; $sErrorNumber = '202' ;
} }
} }
} }
else else
$sErrorNumber = '202' ; $sErrorNumber = '202' ;
} }
else else
$sErrorNumber = '202' ; $sErrorNumber = '202' ;
$sFileUrl = CombinePaths( GetResourceTypePath( $resourceType, $sCommand ) , $currentFolder ); $sFileUrl = CombinePaths( GetResourceTypePath( $resourceType, $sCommand ) , $currentFolder );
$sFileUrl = CombinePaths( $sFileUrl, $sFileName ); $sFileUrl = CombinePaths( $sFileUrl, $sFileName );
// DOL_CHANGE // DOL_CHANGE
//SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName ); //SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName );
if($CKEcallback == '') if($CKEcallback == '')
{ {
// this line already exists so wrap the if block around it // this line already exists so wrap the if block around it
SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName ); SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName );
} }
else else
{ {
//issue the CKEditor Callback //issue the CKEditor Callback
SendCKEditorResults ($CKEcallback, $sFileUrl, SendCKEditorResults ($CKEcallback, $sFileUrl,
($sErrorNumber != 0 ($sErrorNumber != 0
? 'Error '. $sErrorNumber. ' upload failed.' ? 'Error '. $sErrorNumber. ' upload failed.'
: 'Upload Successful')); : 'Upload Successful'));
} }
exit ; exit ;
} }
?> ?>

View File

@ -1,163 +1,163 @@
<?php <?php
/* /*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net * FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2010 Frederico Caldeira Knabben * Copyright (C) 2003-2010 Frederico Caldeira Knabben
* *
* == BEGIN LICENSE == * == BEGIN LICENSE ==
* *
* Licensed under the terms of any of the following licenses at your * Licensed under the terms of any of the following licenses at your
* choice: * choice:
* *
* - GNU General Public License Version 2 or later (the "GPL") * - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html * http://www.gnu.org/licenses/gpl.html
* *
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html * http://www.gnu.org/licenses/lgpl.html
* *
* - Mozilla Public License Version 1.1 or later (the "MPL") * - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html * http://www.mozilla.org/MPL/MPL-1.1.html
* *
* == END LICENSE == * == END LICENSE ==
* *
* Configuration file for the File Manager Connector for PHP. * Configuration file for the File Manager Connector for PHP.
*/ */
global $Config ; global $Config ;
define('NOTOKENRENEWAL',1); // Disables token renewal define('NOTOKENRENEWAL',1); // Disables token renewal
// We must include the main because this page is // We must include the main because this page is
// a web page that require security controls and // a web page that require security controls and
// is a security hole if anybody can access without // is a security hole if anybody can access without
// being an authenticated user. // being an authenticated user.
require_once("../../../../main.inc.php"); require_once("../../../../main.inc.php");
$uri=preg_replace('/^http(s?):\/\//i','',$dolibarr_main_url_root); $uri=preg_replace('/^http(s?):\/\//i','',$dolibarr_main_url_root);
$pos = strstr ($uri, '/'); // $pos contient alors url sans nom domaine $pos = strstr($uri, '/'); // $pos contient alors url sans nom domaine
if ($pos == '/') $pos = ''; // si $pos vaut /, on le met a '' if ($pos == '/') $pos = ''; // si $pos vaut /, on le met a ''
define('DOL_URL_ROOT', $pos); define('DOL_URL_ROOT', $pos);
// SECURITY: You must explicitly enable this "connector". (Set it to "true"). // SECURITY: You must explicitly enable this "connector". (Set it to "true").
// WARNING: don't just set "$Config['Enabled'] = true ;", you must be sure that only // WARNING: don't just set "$Config['Enabled'] = true ;", you must be sure that only
// authenticated users can access this file or use some kind of session checking. // authenticated users can access this file or use some kind of session checking.
$Config['Enabled'] = true ; $Config['Enabled'] = true ;
// Path to user files relative to the document root. // Path to user files relative to the document root.
$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=fckeditor&file=' ; $Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=fckeditor&file=' ;
// Fill the following value it you prefer to specify the absolute path for the // Fill the following value it you prefer to specify the absolute path for the
// user files directory. Useful if you are using a virtual directory, symbolic // user files directory. Useful if you are using a virtual directory, symbolic
// link or alias. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'. // link or alias. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
// Attention: The above 'UserFilesPath' must point to the same directory. // Attention: The above 'UserFilesPath' must point to the same directory.
$Config['UserFilesAbsolutePath'] = $dolibarr_main_data_root.'/fckeditor/'; $Config['UserFilesAbsolutePath'] = $dolibarr_main_data_root.'/fckeditor/';
// Due to security issues with Apache modules, it is recommended to leave the // Due to security issues with Apache modules, it is recommended to leave the
// following setting enabled. // following setting enabled.
$Config['ForceSingleExtension'] = true ; $Config['ForceSingleExtension'] = true ;
// Perform additional checks for image files. // Perform additional checks for image files.
// If set to true, validate image size (using getimagesize). // If set to true, validate image size (using getimagesize).
$Config['SecureImageUploads'] = true; $Config['SecureImageUploads'] = true;
// What the user can do with this connector. // What the user can do with this connector.
$Config['ConfigAllowedCommands'] = array('QuickUpload', 'FileUpload', 'GetFolders', 'GetFoldersAndFiles', 'CreateFolder'); $Config['ConfigAllowedCommands'] = array('QuickUpload', 'FileUpload', 'GetFolders', 'GetFoldersAndFiles', 'CreateFolder');
// Allowed Resource Types. // Allowed Resource Types.
$Config['ConfigAllowedTypes'] = array('File', 'Image', 'Flash', 'Media'); $Config['ConfigAllowedTypes'] = array('File', 'Image', 'Flash', 'Media');
// For security, HTML is allowed in the first Kb of data for files having the // For security, HTML is allowed in the first Kb of data for files having the
// following extensions only. // following extensions only.
$Config['HtmlExtensions'] = array("html", "htm", "xml", "xsd", "txt", "js"); $Config['HtmlExtensions'] = array("html", "htm", "xml", "xsd", "txt", "js");
// After file is uploaded, sometimes it is required to change its permissions // After file is uploaded, sometimes it is required to change its permissions
// so that it was possible to access it at the later time. // so that it was possible to access it at the later time.
// If possible, it is recommended to set more restrictive permissions, like 0755. // If possible, it is recommended to set more restrictive permissions, like 0755.
// Set to 0 to disable this feature. // Set to 0 to disable this feature.
// Note: not needed on Windows-based servers. // Note: not needed on Windows-based servers.
$Config['ChmodOnUpload'] = 0775 ; $Config['ChmodOnUpload'] = 0775 ;
// See comments above. // See comments above.
// Used when creating folders that does not exist. // Used when creating folders that does not exist.
$Config['ChmodOnFolderCreate'] = 0775 ; $Config['ChmodOnFolderCreate'] = 0775 ;
/* /*
Configuration settings for each Resource Type Configuration settings for each Resource Type
- AllowedExtensions: the possible extensions that can be allowed. - AllowedExtensions: the possible extensions that can be allowed.
If it is empty then any file type can be uploaded. If it is empty then any file type can be uploaded.
- DeniedExtensions: The extensions that won't be allowed. - DeniedExtensions: The extensions that won't be allowed.
If it is empty then no restrictions are done here. If it is empty then no restrictions are done here.
For a file to be uploaded it has to fulfill both the AllowedExtensions For a file to be uploaded it has to fulfill both the AllowedExtensions
and DeniedExtensions (that's it: not being denied) conditions. and DeniedExtensions (that's it: not being denied) conditions.
- FileTypesPath: the virtual folder relative to the document root where - FileTypesPath: the virtual folder relative to the document root where
these resources will be located. these resources will be located.
Attention: It must start and end with a slash: '/' Attention: It must start and end with a slash: '/'
- FileTypesAbsolutePath: the physical path to the above folder. It must be - FileTypesAbsolutePath: the physical path to the above folder. It must be
an absolute path. an absolute path.
If it's an empty string then it will be autocalculated. If it's an empty string then it will be autocalculated.
Useful if you are using a virtual directory, symbolic link or alias. Useful if you are using a virtual directory, symbolic link or alias.
Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
Attention: The above 'FileTypesPath' must point to the same directory. Attention: The above 'FileTypesPath' must point to the same directory.
Attention: It must end with a slash: '/' Attention: It must end with a slash: '/'
- QuickUploadPath: the virtual folder relative to the document root where - QuickUploadPath: the virtual folder relative to the document root where
these resources will be uploaded using the Upload tab in the resources these resources will be uploaded using the Upload tab in the resources
dialogs. dialogs.
Attention: It must start and end with a slash: '/' Attention: It must start and end with a slash: '/'
- QuickUploadAbsolutePath: the physical path to the above folder. It must be - QuickUploadAbsolutePath: the physical path to the above folder. It must be
an absolute path. an absolute path.
If it's an empty string then it will be autocalculated. If it's an empty string then it will be autocalculated.
Useful if you are using a virtual directory, symbolic link or alias. Useful if you are using a virtual directory, symbolic link or alias.
Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
Attention: The above 'QuickUploadPath' must point to the same directory. Attention: The above 'QuickUploadPath' must point to the same directory.
Attention: It must end with a slash: '/' Attention: It must end with a slash: '/'
NOTE: by default, QuickUploadPath and QuickUploadAbsolutePath point to NOTE: by default, QuickUploadPath and QuickUploadAbsolutePath point to
"userfiles" directory to maintain backwards compatibility with older versions of FCKeditor. "userfiles" directory to maintain backwards compatibility with older versions of FCKeditor.
This is fine, but you in some cases you will be not able to browse uploaded files using file browser. This is fine, but you in some cases you will be not able to browse uploaded files using file browser.
Example: if you click on "image button", select "Upload" tab and send image Example: if you click on "image button", select "Upload" tab and send image
to the server, image will appear in FCKeditor correctly, but because it is placed to the server, image will appear in FCKeditor correctly, but because it is placed
directly in /userfiles/ directory, you'll be not able to see it in built-in file browser. directly in /userfiles/ directory, you'll be not able to see it in built-in file browser.
The more expected behaviour would be to send images directly to "image" subfolder. The more expected behaviour would be to send images directly to "image" subfolder.
To achieve that, simply change To achieve that, simply change
$Config['QuickUploadPath']['Image'] = $Config['UserFilesPath'] ; $Config['QuickUploadPath']['Image'] = $Config['UserFilesPath'] ;
$Config['QuickUploadAbsolutePath']['Image'] = $Config['UserFilesAbsolutePath'] ; $Config['QuickUploadAbsolutePath']['Image'] = $Config['UserFilesAbsolutePath'] ;
into: into:
$Config['QuickUploadPath']['Image'] = $Config['FileTypesPath']['Image'] ; $Config['QuickUploadPath']['Image'] = $Config['FileTypesPath']['Image'] ;
$Config['QuickUploadAbsolutePath']['Image'] = $Config['FileTypesAbsolutePath']['Image'] ; $Config['QuickUploadAbsolutePath']['Image'] = $Config['FileTypesAbsolutePath']['Image'] ;
*/ */
$Config['AllowedExtensions']['File'] = array('7z', 'aiff', 'asf', 'avi', 'bmp', 'csv', 'doc', 'fla', 'flv', 'gif', 'gz', 'gzip', 'jpeg', 'jpg', 'mid', 'mov', 'mp3', 'mp4', 'mpc', 'mpeg', 'mpg', 'ods', 'odt', 'pdf', 'png', 'ppt', 'pxd', 'qt', 'ram', 'rar', 'rm', 'rmi', 'rmvb', 'rtf', 'sdc', 'sitd', 'swf', 'sxc', 'sxw', 'tar', 'tgz', 'tif', 'tiff', 'txt', 'vsd', 'wav', 'wma', 'wmv', 'xls', 'xml', 'zip'); $Config['AllowedExtensions']['File'] = array('7z', 'aiff', 'asf', 'avi', 'bmp', 'csv', 'doc', 'fla', 'flv', 'gif', 'gz', 'gzip', 'jpeg', 'jpg', 'mid', 'mov', 'mp3', 'mp4', 'mpc', 'mpeg', 'mpg', 'ods', 'odt', 'pdf', 'png', 'ppt', 'pxd', 'qt', 'ram', 'rar', 'rm', 'rmi', 'rmvb', 'rtf', 'sdc', 'sitd', 'swf', 'sxc', 'sxw', 'tar', 'tgz', 'tif', 'tiff', 'txt', 'vsd', 'wav', 'wma', 'wmv', 'xls', 'xml', 'zip');
$Config['DeniedExtensions']['File'] = array(); $Config['DeniedExtensions']['File'] = array();
$Config['FileTypesPath']['File'] = $Config['UserFilesPath'] . 'file/' ; $Config['FileTypesPath']['File'] = $Config['UserFilesPath'] . 'file/' ;
$Config['FileTypesAbsolutePath']['File']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'file/' ; $Config['FileTypesAbsolutePath']['File']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'file/' ;
$Config['QuickUploadPath']['File'] = $Config['UserFilesPath'] ; $Config['QuickUploadPath']['File'] = $Config['UserFilesPath'] ;
$Config['QuickUploadAbsolutePath']['File']= $Config['UserFilesAbsolutePath'] ; $Config['QuickUploadAbsolutePath']['File']= $Config['UserFilesAbsolutePath'] ;
$Config['AllowedExtensions']['Image'] = array('bmp','gif','jpeg','jpg','png'); $Config['AllowedExtensions']['Image'] = array('bmp','gif','jpeg','jpg','png');
$Config['DeniedExtensions']['Image'] = array(); $Config['DeniedExtensions']['Image'] = array();
$Config['FileTypesPath']['Image'] = $Config['UserFilesPath'] . 'image/' ; $Config['FileTypesPath']['Image'] = $Config['UserFilesPath'] . 'image/' ;
$Config['FileTypesAbsolutePath']['Image']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'image/' ; $Config['FileTypesAbsolutePath']['Image']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'image/' ;
$Config['QuickUploadPath']['Image'] = $Config['UserFilesPath'] ; $Config['QuickUploadPath']['Image'] = $Config['UserFilesPath'] ;
$Config['QuickUploadAbsolutePath']['Image']= $Config['UserFilesAbsolutePath'] ; $Config['QuickUploadAbsolutePath']['Image']= $Config['UserFilesAbsolutePath'] ;
$Config['AllowedExtensions']['Flash'] = array('swf','flv'); $Config['AllowedExtensions']['Flash'] = array('swf','flv');
$Config['DeniedExtensions']['Flash'] = array(); $Config['DeniedExtensions']['Flash'] = array();
$Config['FileTypesPath']['Flash'] = $Config['UserFilesPath'] . 'flash/' ; $Config['FileTypesPath']['Flash'] = $Config['UserFilesPath'] . 'flash/' ;
$Config['FileTypesAbsolutePath']['Flash']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'flash/' ; $Config['FileTypesAbsolutePath']['Flash']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'flash/' ;
$Config['QuickUploadPath']['Flash'] = $Config['UserFilesPath'] ; $Config['QuickUploadPath']['Flash'] = $Config['UserFilesPath'] ;
$Config['QuickUploadAbsolutePath']['Flash']= $Config['UserFilesAbsolutePath'] ; $Config['QuickUploadAbsolutePath']['Flash']= $Config['UserFilesAbsolutePath'] ;
$Config['AllowedExtensions']['Media'] = array('aiff', 'asf', 'avi', 'bmp', 'fla', 'flv', 'gif', 'jpeg', 'jpg', 'mid', 'mov', 'mp3', 'mp4', 'mpc', 'mpeg', 'mpg', 'png', 'qt', 'ram', 'rm', 'rmi', 'rmvb', 'swf', 'tif', 'tiff', 'wav', 'wma', 'wmv'); $Config['AllowedExtensions']['Media'] = array('aiff', 'asf', 'avi', 'bmp', 'fla', 'flv', 'gif', 'jpeg', 'jpg', 'mid', 'mov', 'mp3', 'mp4', 'mpc', 'mpeg', 'mpg', 'png', 'qt', 'ram', 'rm', 'rmi', 'rmvb', 'swf', 'tif', 'tiff', 'wav', 'wma', 'wmv');
$Config['DeniedExtensions']['Media'] = array(); $Config['DeniedExtensions']['Media'] = array();
$Config['FileTypesPath']['Media'] = $Config['UserFilesPath'] . 'media/' ; $Config['FileTypesPath']['Media'] = $Config['UserFilesPath'] . 'media/' ;
$Config['FileTypesAbsolutePath']['Media']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'media/' ; $Config['FileTypesAbsolutePath']['Media']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'media/' ;
$Config['QuickUploadPath']['Media'] = $Config['UserFilesPath'] ; $Config['QuickUploadPath']['Media'] = $Config['UserFilesPath'] ;
$Config['QuickUploadAbsolutePath']['Media']= $Config['UserFilesAbsolutePath'] ; $Config['QuickUploadAbsolutePath']['Media']= $Config['UserFilesAbsolutePath'] ;
?> ?>

View File

@ -1,87 +1,87 @@
<?php <?php
/* /*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net * FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2010 Frederico Caldeira Knabben * Copyright (C) 2003-2010 Frederico Caldeira Knabben
* *
* == BEGIN LICENSE == * == BEGIN LICENSE ==
* *
* Licensed under the terms of any of the following licenses at your * Licensed under the terms of any of the following licenses at your
* choice: * choice:
* *
* - GNU General Public License Version 2 or later (the "GPL") * - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html * http://www.gnu.org/licenses/gpl.html
* *
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html * http://www.gnu.org/licenses/lgpl.html
* *
* - Mozilla Public License Version 1.1 or later (the "MPL") * - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html * http://www.mozilla.org/MPL/MPL-1.1.html
* *
* == END LICENSE == * == END LICENSE ==
* *
* This is the File Manager Connector for PHP. * This is the File Manager Connector for PHP.
*/ */
ob_start(); ob_start();
require('./config.php'); require('./config.php');
require('./util.php'); require('./util.php');
require('./io.php'); require('./io.php');
require('./basexml.php'); require('./basexml.php');
require('./commands.php'); require('./commands.php');
require('./phpcompat.php'); require('./phpcompat.php');
if ( !$Config['Enabled'] ) if ( !$Config['Enabled'] )
SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/connectors/php/config.php" file' ); SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/connectors/php/config.php" file' );
DoResponse(); DoResponse();
function DoResponse() function DoResponse()
{ {
if (!isset($_GET)) { if (!isset($_GET)) {
global $_GET; global $_GET;
} }
if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) ) if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) )
return ; return ;
// Get the main request informaiton. // Get the main request informaiton.
$sCommand = $_GET['Command'] ; $sCommand = $_GET['Command'] ;
$sResourceType = $_GET['Type'] ; $sResourceType = $_GET['Type'] ;
$sCurrentFolder = GetCurrentFolder(); $sCurrentFolder = GetCurrentFolder();
// Check if it is an allowed command // Check if it is an allowed command
if ( ! IsAllowedCommand( $sCommand ) ) if ( ! IsAllowedCommand( $sCommand ) )
SendError( 1, 'The "' . $sCommand . '" command isn\'t allowed' ); SendError( 1, 'The "' . $sCommand . '" command isn\'t allowed' );
// Check if it is an allowed type. // Check if it is an allowed type.
if ( !IsAllowedType( $sResourceType ) ) if ( !IsAllowedType( $sResourceType ) )
SendError( 1, 'Invalid type specified' ); SendError( 1, 'Invalid type specified' );
// File Upload doesn't have to Return XML, so it must be intercepted before anything. // File Upload doesn't have to Return XML, so it must be intercepted before anything.
if ( $sCommand == 'FileUpload' ) if ( $sCommand == 'FileUpload' )
{ {
FileUpload( $sResourceType, $sCurrentFolder, $sCommand ); FileUpload( $sResourceType, $sCurrentFolder, $sCommand );
return ; return ;
} }
CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder ); CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder );
// Execute the required command. // Execute the required command.
switch ( $sCommand ) switch ( $sCommand )
{ {
case 'GetFolders' : case 'GetFolders' :
GetFolders( $sResourceType, $sCurrentFolder ); GetFolders( $sResourceType, $sCurrentFolder );
break ; break ;
case 'GetFoldersAndFiles' : case 'GetFoldersAndFiles' :
GetFoldersAndFiles( $sResourceType, $sCurrentFolder ); GetFoldersAndFiles( $sResourceType, $sCurrentFolder );
break ; break ;
case 'CreateFolder' : case 'CreateFolder' :
CreateFolder( $sResourceType, $sCurrentFolder ); CreateFolder( $sResourceType, $sCurrentFolder );
break ; break ;
} }
CreateXmlFooter(); CreateXmlFooter();
exit ; exit ;
} }
?> ?>

View File

@ -1,320 +1,320 @@
<?php <?php
/* /*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net * FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2010 Frederico Caldeira Knabben * Copyright (C) 2003-2010 Frederico Caldeira Knabben
* *
* == BEGIN LICENSE == * == BEGIN LICENSE ==
* *
* Licensed under the terms of any of the following licenses at your * Licensed under the terms of any of the following licenses at your
* choice: * choice:
* *
* - GNU General Public License Version 2 or later (the "GPL") * - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html * http://www.gnu.org/licenses/gpl.html
* *
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html * http://www.gnu.org/licenses/lgpl.html
* *
* - Mozilla Public License Version 1.1 or later (the "MPL") * - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html * http://www.mozilla.org/MPL/MPL-1.1.html
* *
* == END LICENSE == * == END LICENSE ==
* *
* This is the File Manager Connector for PHP. * This is the File Manager Connector for PHP.
*/ */
function CombinePaths( $sBasePath, $sFolder ) function CombinePaths( $sBasePath, $sFolder )
{ {
return RemoveFromEnd( $sBasePath, '/' ) . '/' . RemoveFromStart( $sFolder, '/' ); return RemoveFromEnd( $sBasePath, '/' ) . '/' . RemoveFromStart( $sFolder, '/' );
} }
function GetResourceTypePath( $resourceType, $sCommand ) function GetResourceTypePath( $resourceType, $sCommand )
{ {
global $Config ; global $Config ;
if ( $sCommand == "QuickUpload") if ( $sCommand == "QuickUpload")
return $Config['QuickUploadPath'][$resourceType] ; return $Config['QuickUploadPath'][$resourceType] ;
else else
return $Config['FileTypesPath'][$resourceType] ; return $Config['FileTypesPath'][$resourceType] ;
} }
function GetResourceTypeDirectory( $resourceType, $sCommand ) function GetResourceTypeDirectory( $resourceType, $sCommand )
{ {
global $Config ; global $Config ;
if ( $sCommand == "QuickUpload") if ( $sCommand == "QuickUpload")
{ {
if ( strlen( $Config['QuickUploadAbsolutePath'][$resourceType] ) > 0 ) if ( strlen( $Config['QuickUploadAbsolutePath'][$resourceType] ) > 0 )
return $Config['QuickUploadAbsolutePath'][$resourceType] ; return $Config['QuickUploadAbsolutePath'][$resourceType] ;
// Map the "UserFiles" path to a local directory. // Map the "UserFiles" path to a local directory.
return Server_MapPath( $Config['QuickUploadPath'][$resourceType] ); return Server_MapPath( $Config['QuickUploadPath'][$resourceType] );
} }
else else
{ {
if ( strlen( $Config['FileTypesAbsolutePath'][$resourceType] ) > 0 ) if ( strlen( $Config['FileTypesAbsolutePath'][$resourceType] ) > 0 )
return $Config['FileTypesAbsolutePath'][$resourceType] ; return $Config['FileTypesAbsolutePath'][$resourceType] ;
// Map the "UserFiles" path to a local directory. // Map the "UserFiles" path to a local directory.
return Server_MapPath( $Config['FileTypesPath'][$resourceType] ); return Server_MapPath( $Config['FileTypesPath'][$resourceType] );
} }
} }
function GetUrlFromPath( $resourceType, $folderPath, $sCommand ) function GetUrlFromPath( $resourceType, $folderPath, $sCommand )
{ {
return CombinePaths( GetResourceTypePath( $resourceType, $sCommand ), $folderPath ); return CombinePaths( GetResourceTypePath( $resourceType, $sCommand ), $folderPath );
} }
function RemoveExtension( $fileName ) function RemoveExtension( $fileName )
{ {
return substr( $fileName, 0, strrpos( $fileName, '.' ) ); return substr( $fileName, 0, strrpos( $fileName, '.' ) );
} }
function ServerMapFolder( $resourceType, $folderPath, $sCommand ) function ServerMapFolder( $resourceType, $folderPath, $sCommand )
{ {
// Get the resource type directory. // Get the resource type directory.
$sResourceTypePath = GetResourceTypeDirectory( $resourceType, $sCommand ); $sResourceTypePath = GetResourceTypeDirectory( $resourceType, $sCommand );
// Ensure that the directory exists. // Ensure that the directory exists.
$sErrorMsg = CreateServerFolder( $sResourceTypePath ); $sErrorMsg = CreateServerFolder( $sResourceTypePath );
if ( $sErrorMsg != '' ) if ( $sErrorMsg != '' )
SendError( 1, "Error creating folder \"{$sResourceTypePath}\" ({$sErrorMsg})" ); SendError( 1, "Error creating folder \"{$sResourceTypePath}\" ({$sErrorMsg})" );
// Return the resource type directory combined with the required path. // Return the resource type directory combined with the required path.
return CombinePaths( $sResourceTypePath , $folderPath ); return CombinePaths( $sResourceTypePath , $folderPath );
} }
function GetParentFolder( $folderPath ) function GetParentFolder( $folderPath )
{ {
$sPattern = "-[/\\\\][^/\\\\]+[/\\\\]?$-" ; $sPattern = "-[/\\\\][^/\\\\]+[/\\\\]?$-" ;
return preg_replace( $sPattern, '', $folderPath ); return preg_replace( $sPattern, '', $folderPath );
} }
function CreateServerFolder( $folderPath, $lastFolder = null ) function CreateServerFolder( $folderPath, $lastFolder = null )
{ {
global $Config ; global $Config ;
$sParent = GetParentFolder( $folderPath ); $sParent = GetParentFolder( $folderPath );
// Ensure the folder path has no double-slashes, or mkdir may fail on certain platforms // Ensure the folder path has no double-slashes, or mkdir may fail on certain platforms
while ( strpos($folderPath, '//') !== false ) while ( strpos($folderPath, '//') !== false )
{ {
$folderPath = str_replace( '//', '/', $folderPath ); $folderPath = str_replace( '//', '/', $folderPath );
} }
// Check if the parent exists, or create it. // Check if the parent exists, or create it.
if ( !empty($sParent) && !file_exists( $sParent ) ) if ( !empty($sParent) && !file_exists( $sParent ) )
{ {
//prevents agains infinite loop when we can't create root folder //prevents agains infinite loop when we can't create root folder
if ( !is_null( $lastFolder ) && $lastFolder === $sParent) { if ( !is_null( $lastFolder ) && $lastFolder === $sParent) {
return "Can't create $folderPath directory" ; return "Can't create $folderPath directory" ;
} }
$sErrorMsg = CreateServerFolder( $sParent, $folderPath ); $sErrorMsg = CreateServerFolder( $sParent, $folderPath );
if ( $sErrorMsg != '' ) if ( $sErrorMsg != '' )
return $sErrorMsg ; return $sErrorMsg ;
} }
if ( !file_exists( $folderPath ) ) if ( !file_exists( $folderPath ) )
{ {
// Turn off all error reporting. // Turn off all error reporting.
error_reporting( 0 ); error_reporting( 0 );
$php_errormsg = '' ; $php_errormsg = '' ;
// Enable error tracking to catch the error. // Enable error tracking to catch the error.
ini_set( 'track_errors', '1' ); ini_set( 'track_errors', '1' );
if ( isset( $Config['ChmodOnFolderCreate'] ) && !$Config['ChmodOnFolderCreate'] ) if ( isset( $Config['ChmodOnFolderCreate'] ) && !$Config['ChmodOnFolderCreate'] )
{ {
mkdir( $folderPath ); mkdir( $folderPath );
} }
else else
{ {
$permissions = 0777 ; $permissions = 0777 ;
if ( isset( $Config['ChmodOnFolderCreate'] ) ) if ( isset( $Config['ChmodOnFolderCreate'] ) )
{ {
$permissions = $Config['ChmodOnFolderCreate'] ; $permissions = $Config['ChmodOnFolderCreate'] ;
} }
// To create the folder with 0777 permissions, we need to set umask to zero. // To create the folder with 0777 permissions, we need to set umask to zero.
$oldumask = umask(0); $oldumask = umask(0);
mkdir( $folderPath, $permissions ); mkdir( $folderPath, $permissions );
umask( $oldumask ); umask( $oldumask );
} }
$sErrorMsg = $php_errormsg ; $sErrorMsg = $php_errormsg ;
// Restore the configurations. // Restore the configurations.
ini_restore( 'track_errors' ); ini_restore( 'track_errors' );
ini_restore( 'error_reporting' ); ini_restore( 'error_reporting' );
return $sErrorMsg ; return $sErrorMsg ;
} }
else else
return '' ; return '' ;
} }
function GetRootPath() function GetRootPath()
{ {
if (!isset($_SERVER)) { if (!isset($_SERVER)) {
global $_SERVER; global $_SERVER;
} }
$sRealPath = realpath( './' ); $sRealPath = realpath( './' );
// #2124 ensure that no slash is at the end // #2124 ensure that no slash is at the end
$sRealPath = rtrim($sRealPath,"\\/"); $sRealPath = rtrim($sRealPath,"\\/");
$sSelfPath = $_SERVER['PHP_SELF'] ; $sSelfPath = $_SERVER['PHP_SELF'] ;
$sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ) ); $sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ) );
$sSelfPath = str_replace( '/', DIRECTORY_SEPARATOR, $sSelfPath ); $sSelfPath = str_replace( '/', DIRECTORY_SEPARATOR, $sSelfPath );
$position = strpos( $sRealPath, $sSelfPath ); $position = strpos( $sRealPath, $sSelfPath );
// This can check only that this script isn't run from a virtual dir // 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 // But it avoids the problems that arise if it isn't checked
if ( $position === false || $position <> strlen( $sRealPath ) - strlen( $sSelfPath ) ) 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".' ); 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 ); return substr( $sRealPath, 0, $position );
} }
// Emulate the asp Server.mapPath function. // Emulate the asp Server.mapPath function.
// given an url path return the physical directory that it corresponds to // given an url path return the physical directory that it corresponds to
function Server_MapPath( $path ) function Server_MapPath( $path )
{ {
// This function is available only for Apache // This function is available only for Apache
if ( function_exists( 'apache_lookup_uri' ) ) if ( function_exists( 'apache_lookup_uri' ) )
{ {
$info = apache_lookup_uri( $path ); $info = apache_lookup_uri( $path );
return $info->filename . $info->path_info ; return $info->filename . $info->path_info ;
} }
// This isn't correct but for the moment there's no other solution // 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 // If this script is under a virtual directory or symlink it will detect the problem and stop
return GetRootPath() . $path ; return GetRootPath() . $path ;
} }
function IsAllowedExt( $sExtension, $resourceType ) function IsAllowedExt( $sExtension, $resourceType )
{ {
global $Config ; global $Config ;
// Get the allowed and denied extensions arrays. // Get the allowed and denied extensions arrays.
$arAllowed = $Config['AllowedExtensions'][$resourceType] ; $arAllowed = $Config['AllowedExtensions'][$resourceType] ;
$arDenied = $Config['DeniedExtensions'][$resourceType] ; $arDenied = $Config['DeniedExtensions'][$resourceType] ;
if ( count($arAllowed) > 0 && !in_array( $sExtension, $arAllowed ) ) if ( count($arAllowed) > 0 && !in_array( $sExtension, $arAllowed ) )
return false ; return false ;
if ( count($arDenied) > 0 && in_array( $sExtension, $arDenied ) ) if ( count($arDenied) > 0 && in_array( $sExtension, $arDenied ) )
return false ; return false ;
return true ; return true ;
} }
function IsAllowedType( $resourceType ) function IsAllowedType( $resourceType )
{ {
global $Config ; global $Config ;
if ( !in_array( $resourceType, $Config['ConfigAllowedTypes'] ) ) if ( !in_array( $resourceType, $Config['ConfigAllowedTypes'] ) )
return false ; return false ;
return true ; return true ;
} }
function IsAllowedCommand( $sCommand ) function IsAllowedCommand( $sCommand )
{ {
global $Config ; global $Config ;
if ( !in_array( $sCommand, $Config['ConfigAllowedCommands'] ) ) if ( !in_array( $sCommand, $Config['ConfigAllowedCommands'] ) )
return false ; return false ;
return true ; return true ;
} }
function GetCurrentFolder() function GetCurrentFolder()
{ {
if (!isset($_GET)) { if (!isset($_GET)) {
global $_GET; global $_GET;
} }
$sCurrentFolder = isset( $_GET['CurrentFolder'] ) ? $_GET['CurrentFolder'] : '/' ; $sCurrentFolder = isset( $_GET['CurrentFolder'] ) ? $_GET['CurrentFolder'] : '/' ;
// Check the current folder syntax (must begin and start with a slash). // Check the current folder syntax (must begin and start with a slash).
if ( !preg_match( '|/$|', $sCurrentFolder ) ) if ( !preg_match( '|/$|', $sCurrentFolder ) )
$sCurrentFolder .= '/' ; $sCurrentFolder .= '/' ;
if ( strpos( $sCurrentFolder, '/' ) !== 0 ) if ( strpos( $sCurrentFolder, '/' ) !== 0 )
$sCurrentFolder = '/' . $sCurrentFolder ; $sCurrentFolder = '/' . $sCurrentFolder ;
// Ensure the folder path has no double-slashes // Ensure the folder path has no double-slashes
while ( strpos ($sCurrentFolder, '//') !== false ) { while ( strpos ($sCurrentFolder, '//') !== false ) {
$sCurrentFolder = str_replace ('//', '/', $sCurrentFolder); $sCurrentFolder = str_replace ('//', '/', $sCurrentFolder);
} }
// Check for invalid folder paths (..) // Check for invalid folder paths (..)
if ( strpos( $sCurrentFolder, '..' ) || strpos( $sCurrentFolder, "\\" )) if ( strpos( $sCurrentFolder, '..' ) || strpos( $sCurrentFolder, "\\" ))
SendError( 102, '' ); SendError( 102, '' );
if ( preg_match(",(/\.)|[[:cntrl:]]|(//)|(\\\\)|([\:\*\?\"\<\>\|]),", $sCurrentFolder)) if ( preg_match(",(/\.)|[[:cntrl:]]|(//)|(\\\\)|([\:\*\?\"\<\>\|]),", $sCurrentFolder))
SendError( 102, '' ); SendError( 102, '' );
return $sCurrentFolder ; return $sCurrentFolder ;
} }
// Do a cleanup of the folder name to avoid possible problems // Do a cleanup of the folder name to avoid possible problems
function SanitizeFolderName( $sNewFolderName ) function SanitizeFolderName( $sNewFolderName )
{ {
$sNewFolderName = stripslashes( $sNewFolderName ); $sNewFolderName = stripslashes( $sNewFolderName );
// Remove . \ / | : ? * " < > // Remove . \ / | : ? * " < >
$sNewFolderName = preg_replace( '/\\.|\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[[:cntrl:]]/', '_', $sNewFolderName ); $sNewFolderName = preg_replace( '/\\.|\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[[:cntrl:]]/', '_', $sNewFolderName );
return $sNewFolderName ; return $sNewFolderName ;
} }
// Do a cleanup of the file name to avoid possible problems // Do a cleanup of the file name to avoid possible problems
function SanitizeFileName( $sNewFileName ) function SanitizeFileName( $sNewFileName )
{ {
global $Config ; global $Config ;
$sNewFileName = stripslashes( $sNewFileName ); $sNewFileName = stripslashes( $sNewFileName );
// Replace dots in the name with underscores (only one dot can be there... security issue). // Replace dots in the name with underscores (only one dot can be there... security issue).
if ( $Config['ForceSingleExtension'] ) if ( $Config['ForceSingleExtension'] )
$sNewFileName = preg_replace( '/\\.(?![^.]*$)/', '_', $sNewFileName ); $sNewFileName = preg_replace( '/\\.(?![^.]*$)/', '_', $sNewFileName );
// Remove \ / | : ? * " < > // Remove \ / | : ? * " < >
$sNewFileName = preg_replace( '/\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[[:cntrl:]]/', '_', $sNewFileName ); $sNewFileName = preg_replace( '/\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[[:cntrl:]]/', '_', $sNewFileName );
return $sNewFileName ; return $sNewFileName ;
} }
// This is the function that sends the results of the uploading process. // This is the function that sends the results of the uploading process.
function SendUploadResults( $errorNumber, $fileUrl = '', $fileName = '', $customMsg = '' ) function SendUploadResults( $errorNumber, $fileUrl = '', $fileName = '', $customMsg = '' )
{ {
// Minified version of the document.domain automatic fix script (#1919). // Minified version of the document.domain automatic fix script (#1919).
// The original script can be found at _dev/domain_fix_template.js // The original script can be found at _dev/domain_fix_template.js
echo <<<EOF echo <<<EOF
<script type="text/javascript"> <script type="text/javascript">
(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;}}})(); (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; EOF;
if ($errorNumber && $errorNumber != 201) { if ($errorNumber && $errorNumber != 201) {
$fileUrl = ""; $fileUrl = "";
$fileName = ""; $fileName = "";
} }
$rpl = array( '\\' => '\\\\', '"' => '\\"' ); $rpl = array( '\\' => '\\\\', '"' => '\\"' );
echo 'window.parent.OnUploadCompleted(' . $errorNumber . ',"' . strtr( $fileUrl, $rpl ) . '","' . strtr( $fileName, $rpl ) . '", "' . strtr( $customMsg, $rpl ) . '");' ; echo 'window.parent.OnUploadCompleted(' . $errorNumber . ',"' . strtr( $fileUrl, $rpl ) . '","' . strtr( $fileName, $rpl ) . '", "' . strtr( $customMsg, $rpl ) . '");' ;
echo '</script>' ; echo '</script>' ;
exit ; exit ;
} }
// DOL_CHANGE // DOL_CHANGE
// This is the function that sends the results of the uploading process to CKE. // This is the function that sends the results of the uploading process to CKE.
function SendCKEditorResults ($callback, $sFileUrl, $customMsg = '') function SendCKEditorResults ($callback, $sFileUrl, $customMsg = '')
{ {
echo '<script type="text/javascript">'; echo '<script type="text/javascript">';
$rpl = array( '\\' => '\\\\', '"' => '\\"' ); $rpl = array( '\\' => '\\\\', '"' => '\\"' );
echo 'window.parent.CKEDITOR.tools.callFunction("'. $callback. '","'. echo 'window.parent.CKEDITOR.tools.callFunction("'. $callback. '","'.
strtr($sFileUrl, $rpl). '", "'. strtr($customMsg, $rpl). '");' ; strtr($sFileUrl, $rpl). '", "'. strtr($customMsg, $rpl). '");' ;
echo '</script>'; echo '</script>';
} }
?> ?>

View File

@ -1,17 +1,16 @@
<?php <?php
if ( !isset( $_SERVER ) ) { if ( !isset( $_SERVER ) ) {
$_SERVER = $HTTP_SERVER_VARS ; $_SERVER = $HTTP_SERVER_VARS ;
} }
if ( !isset( $_GET ) ) { if ( !isset( $_GET ) ) {
$_GET = $HTTP_GET_VARS ; $_GET = $HTTP_GET_VARS ;
} }
if ( !isset( $_FILES ) ) { if ( !isset( $_FILES ) ) {
$_FILES = $HTTP_POST_FILES ; $_FILES = $HTTP_POST_FILES ;
} }
if ( !defined( 'DIRECTORY_SEPARATOR' ) ) { if (! defined('DIRECTORY_SEPARATOR'))
define( 'DIRECTORY_SEPARATOR', {
strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? '\\' : '/' define('DIRECTORY_SEPARATOR', strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? '\\' : '/');
); }
}

View File

@ -1,67 +1,67 @@
<?php <?php
/* /*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net * FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2010 Frederico Caldeira Knabben * Copyright (C) 2003-2010 Frederico Caldeira Knabben
* *
* == BEGIN LICENSE == * == BEGIN LICENSE ==
* *
* Licensed under the terms of any of the following licenses at your * Licensed under the terms of any of the following licenses at your
* choice: * choice:
* *
* - GNU General Public License Version 2 or later (the "GPL") * - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html * http://www.gnu.org/licenses/gpl.html
* *
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html * http://www.gnu.org/licenses/lgpl.html
* *
* - Mozilla Public License Version 1.1 or later (the "MPL") * - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html * http://www.mozilla.org/MPL/MPL-1.1.html
* *
* == END LICENSE == * == END LICENSE ==
* *
* This is the "File Uploader" for PHP. * This is the "File Uploader" for PHP.
*/ */
require('./config.php'); require('./config.php');
require('./util.php'); require('./util.php');
require('./io.php'); require('./io.php');
require('./commands.php'); require('./commands.php');
require('./phpcompat.php'); require('./phpcompat.php');
function SendError( $number, $text ) function SendError( $number, $text )
{ {
SendUploadResults( $number, '', '', $text ); SendUploadResults( $number, '', '', $text );
} }
// Check if this uploader has been enabled. // Check if this uploader has been enabled.
if ( !$Config['Enabled'] ) if ( !$Config['Enabled'] )
SendUploadResults( '1', '', '', 'This file uploader is disabled. Please check the "editor/filemanager/connectors/php/config.php" file' ); SendUploadResults( '1', '', '', 'This file uploader is disabled. Please check the "editor/filemanager/connectors/php/config.php" file' );
$sCommand = 'QuickUpload' ; $sCommand = 'QuickUpload' ;
// The file type (from the QueryString, by default 'File'). // The file type (from the QueryString, by default 'File').
$sType = isset( $_GET['Type'] ) ? $_GET['Type'] : 'File' ; $sType = isset( $_GET['Type'] ) ? $_GET['Type'] : 'File' ;
$sCurrentFolder = "/" ; $sCurrentFolder = "/" ;
// Is enabled the upload? // Is enabled the upload?
if ( ! IsAllowedCommand( $sCommand ) ) if ( ! IsAllowedCommand( $sCommand ) )
SendUploadResults( '1', '', '', 'The ""' . $sCommand . '"" command isn\'t allowed' ); SendUploadResults( '1', '', '', 'The ""' . $sCommand . '"" command isn\'t allowed' );
// Check if it is an allowed type. // Check if it is an allowed type.
if ( !IsAllowedType( $sType ) ) if ( !IsAllowedType( $sType ) )
SendUploadResults( 1, '', '', 'Invalid type specified' ); SendUploadResults( 1, '', '', 'Invalid type specified' );
// DOL_CHANGE // DOL_CHANGE
//FileUpload( $sType, $sCurrentFolder, $sCommand ) //FileUpload( $sType, $sCurrentFolder, $sCommand )
// Get the CKEditor Callback // Get the CKEditor Callback
$CKEcallback = $_GET['CKEditorFuncNum']; $CKEcallback = $_GET['CKEditorFuncNum'];
//modify the next line adding in the new param //modify the next line adding in the new param
FileUpload($sType, $sCurrentFolder, $sCommand, $CKEcallback); FileUpload($sType, $sCurrentFolder, $sCommand, $CKEcallback);
?> ?>

View File

@ -1,220 +1,220 @@
<?php <?php
/* /*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net * FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2010 Frederico Caldeira Knabben * Copyright (C) 2003-2010 Frederico Caldeira Knabben
* *
* == BEGIN LICENSE == * == BEGIN LICENSE ==
* *
* Licensed under the terms of any of the following licenses at your * Licensed under the terms of any of the following licenses at your
* choice: * choice:
* *
* - GNU General Public License Version 2 or later (the "GPL") * - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html * http://www.gnu.org/licenses/gpl.html
* *
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html * http://www.gnu.org/licenses/lgpl.html
* *
* - Mozilla Public License Version 1.1 or later (the "MPL") * - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html * http://www.mozilla.org/MPL/MPL-1.1.html
* *
* == END LICENSE == * == END LICENSE ==
* *
* Utility functions for the File Manager Connector for PHP. * Utility functions for the File Manager Connector for PHP.
*/ */
function RemoveFromStart( $sourceString, $charToRemove ) function RemoveFromStart( $sourceString, $charToRemove )
{ {
$sPattern = '|^' . $charToRemove . '+|' ; $sPattern = '|^' . $charToRemove . '+|' ;
return preg_replace( $sPattern, '', $sourceString ); return preg_replace( $sPattern, '', $sourceString );
} }
function RemoveFromEnd( $sourceString, $charToRemove ) function RemoveFromEnd( $sourceString, $charToRemove )
{ {
$sPattern = '|' . $charToRemove . '+$|' ; $sPattern = '|' . $charToRemove . '+$|' ;
return preg_replace( $sPattern, '', $sourceString ); return preg_replace( $sPattern, '', $sourceString );
} }
function FindBadUtf8( $string ) function FindBadUtf8( $string )
{ {
$regex = $regex =
'([\x00-\x7F]'. '([\x00-\x7F]'.
'|[\xC2-\xDF][\x80-\xBF]'. '|[\xC2-\xDF][\x80-\xBF]'.
'|\xE0[\xA0-\xBF][\x80-\xBF]'. '|\xE0[\xA0-\xBF][\x80-\xBF]'.
'|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'. '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'.
'|\xED[\x80-\x9F][\x80-\xBF]'. '|\xED[\x80-\x9F][\x80-\xBF]'.
'|\xF0[\x90-\xBF][\x80-\xBF]{2}'. '|\xF0[\x90-\xBF][\x80-\xBF]{2}'.
'|[\xF1-\xF3][\x80-\xBF]{3}'. '|[\xF1-\xF3][\x80-\xBF]{3}'.
'|\xF4[\x80-\x8F][\x80-\xBF]{2}'. '|\xF4[\x80-\x8F][\x80-\xBF]{2}'.
'|(.{1}))'; '|(.{1}))';
while (preg_match('/'.$regex.'/S', $string, $matches)) { while (preg_match('/'.$regex.'/S', $string, $matches)) {
if ( isset($matches[2])) { if ( isset($matches[2])) {
return true; return true;
} }
$string = substr($string, strlen($matches[0])); $string = substr($string, strlen($matches[0]));
} }
return false; return false;
} }
function ConvertToXmlAttribute( $value ) function ConvertToXmlAttribute( $value )
{ {
if ( defined( 'PHP_OS' ) ) if ( defined( 'PHP_OS' ) )
{ {
$os = PHP_OS ; $os = PHP_OS ;
} }
else else
{ {
$os = php_uname(); $os = php_uname();
} }
if ( strtoupper( substr( $os, 0, 3 ) ) === 'WIN' || FindBadUtf8( $value ) ) if ( strtoupper( substr( $os, 0, 3 ) ) === 'WIN' || FindBadUtf8( $value ) )
{ {
return ( utf8_encode( htmlspecialchars( $value ) ) ); return ( utf8_encode( htmlspecialchars( $value ) ) );
} }
else else
{ {
return ( htmlspecialchars( $value ) ); return ( htmlspecialchars( $value ) );
} }
} }
/** /**
* Check whether given extension is in html etensions list * Check whether given extension is in html etensions list
* *
* @param string $ext * @param string $ext
* @param array $formExtensions * @param array $formExtensions
* @return boolean * @return boolean
*/ */
function IsHtmlExtension( $ext, $formExtensions ) function IsHtmlExtension( $ext, $formExtensions )
{ {
if ( !$formExtensions || !is_array( $formExtensions ) ) if ( !$formExtensions || !is_array( $formExtensions ) )
{ {
return false ; return false ;
} }
$lcaseHtmlExtensions = array(); $lcaseHtmlExtensions = array();
foreach ( $formExtensions as $key => $val ) foreach ( $formExtensions as $key => $val )
{ {
$lcaseHtmlExtensions[$key] = strtolower( $val ); $lcaseHtmlExtensions[$key] = strtolower( $val );
} }
return in_array( $ext, $lcaseHtmlExtensions ); return in_array( $ext, $lcaseHtmlExtensions );
} }
/** /**
* Detect HTML in the first KB to prevent against potential security issue with * Detect HTML in the first KB to prevent against potential security issue with
* IE/Safari/Opera file type auto detection bug. * IE/Safari/Opera file type auto detection bug.
* Returns true if file contain insecure HTML code at the beginning. * Returns true if file contain insecure HTML code at the beginning.
* *
* @param string $filePath absolute path to file * @param string $filePath absolute path to file
* @return boolean * @return boolean
*/ */
function DetectHtml( $filePath ) function DetectHtml( $filePath )
{ {
$fp = @fopen( $filePath, 'rb' ); $fp = @fopen( $filePath, 'rb' );
//open_basedir restriction, see #1906 //open_basedir restriction, see #1906
if ( $fp === false || !flock( $fp, LOCK_SH ) ) if ( $fp === false || !flock( $fp, LOCK_SH ) )
{ {
return -1 ; return -1 ;
} }
$chunk = fread( $fp, 1024 ); $chunk = fread( $fp, 1024 );
flock( $fp, LOCK_UN ); flock( $fp, LOCK_UN );
fclose( $fp ); fclose( $fp );
$chunk = strtolower( $chunk ); $chunk = strtolower( $chunk );
if (!$chunk) if (!$chunk)
{ {
return false ; return false ;
} }
$chunk = trim( $chunk ); $chunk = trim( $chunk );
if ( preg_match( "/<!DOCTYPE\W*X?HTML/sim", $chunk ) ) if ( preg_match( "/<!DOCTYPE\W*X?HTML/sim", $chunk ) )
{ {
return true; return true;
} }
$tags = array( '<body', '<head', '<html', '<img', '<pre', '<script', '<table', '<title' ); $tags = array( '<body', '<head', '<html', '<img', '<pre', '<script', '<table', '<title' );
foreach( $tags as $tag ) foreach( $tags as $tag )
{ {
if( false !== strpos( $chunk, $tag ) ) if( false !== strpos( $chunk, $tag ) )
{ {
return true ; return true ;
} }
} }
//type = javascript //type = javascript
if ( preg_match( '!type\s*=\s*[\'"]?\s*(?:\w*/)?(?:ecma|java)!sim', $chunk ) ) if ( preg_match( '!type\s*=\s*[\'"]?\s*(?:\w*/)?(?:ecma|java)!sim', $chunk ) )
{ {
return true ; return true ;
} }
//href = javascript //href = javascript
//src = javascript //src = javascript
//data = javascript //data = javascript
if ( preg_match( '!(?:href|src|data)\s*=\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk ) ) if ( preg_match( '!(?:href|src|data)\s*=\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk ) )
{ {
return true ; return true ;
} }
//url(javascript //url(javascript
if ( preg_match( '!url\s*\(\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk ) ) if ( preg_match( '!url\s*\(\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk ) )
{ {
return true ; return true ;
} }
return false ; return false ;
} }
/** /**
* Check file content. * Check file content.
* Currently this function validates only image files. * Currently this function validates only image files.
* Returns false if file is invalid. * Returns false if file is invalid.
* *
* @param string $filePath absolute path to file * @param string $filePath absolute path to file
* @param string $extension file extension * @param string $extension file extension
* @param integer $detectionLevel 0 = none, 1 = use getimagesize for images, 2 = use DetectHtml for images * @param integer $detectionLevel 0 = none, 1 = use getimagesize for images, 2 = use DetectHtml for images
* @return boolean * @return boolean
*/ */
function IsImageValid( $filePath, $extension ) function IsImageValid( $filePath, $extension )
{ {
if (!@is_readable($filePath)) { if (!@is_readable($filePath)) {
return -1; return -1;
} }
$imageCheckExtensions = array('gif', 'jpeg', 'jpg', 'png', 'swf', 'psd', 'bmp', 'iff'); $imageCheckExtensions = array('gif', 'jpeg', 'jpg', 'png', 'swf', 'psd', 'bmp', 'iff');
// version_compare is available since PHP4 >= 4.0.7 // version_compare is available since PHP4 >= 4.0.7
if ( function_exists( 'version_compare' ) ) { if ( function_exists( 'version_compare' ) ) {
$sCurrentVersion = phpversion(); $sCurrentVersion = phpversion();
if ( version_compare( $sCurrentVersion, "4.2.0" ) >= 0 ) { if ( version_compare( $sCurrentVersion, "4.2.0" ) >= 0 ) {
$imageCheckExtensions[] = "tiff"; $imageCheckExtensions[] = "tiff";
$imageCheckExtensions[] = "tif"; $imageCheckExtensions[] = "tif";
} }
if ( version_compare( $sCurrentVersion, "4.3.0" ) >= 0 ) { if ( version_compare( $sCurrentVersion, "4.3.0" ) >= 0 ) {
$imageCheckExtensions[] = "swc"; $imageCheckExtensions[] = "swc";
} }
if ( version_compare( $sCurrentVersion, "4.3.2" ) >= 0 ) { if ( version_compare( $sCurrentVersion, "4.3.2" ) >= 0 ) {
$imageCheckExtensions[] = "jpc"; $imageCheckExtensions[] = "jpc";
$imageCheckExtensions[] = "jp2"; $imageCheckExtensions[] = "jp2";
$imageCheckExtensions[] = "jpx"; $imageCheckExtensions[] = "jpx";
$imageCheckExtensions[] = "jb2"; $imageCheckExtensions[] = "jb2";
$imageCheckExtensions[] = "xbm"; $imageCheckExtensions[] = "xbm";
$imageCheckExtensions[] = "wbmp"; $imageCheckExtensions[] = "wbmp";
} }
} }
if ( !in_array( $extension, $imageCheckExtensions ) ) { if ( !in_array( $extension, $imageCheckExtensions ) ) {
return true; return true;
} }
if ( @getimagesize( $filePath ) === false ) { if ( @getimagesize( $filePath ) === false ) {
return false ; return false ;
} }
return true; return true;
} }
?> ?>

View File

@ -667,8 +667,8 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
* @param PDF &$pdf Object PDF * @param PDF &$pdf Object PDF
* @param object $object Object * @param object $object Object
* @param Translate $outputlangs Object lang * @param Translate $outputlangs Object lang
* @param int $curx X * @param int $posx X
* @param int $cury Y * @param int $posy Y
* @param int $align Align * @param int $align Align
* @param string $default_font_size Font size * @param string $default_font_size Font size
* @param HookManager $hookmanager Hook manager object * @param HookManager $hookmanager Hook manager object

View File

@ -242,7 +242,6 @@ class SimpleOpenID
/** /**
* GetIdentity * GetIdentity
* *
* @param string $a Server
* @return void * @return void
*/ */
function GetIdentity() function GetIdentity()
@ -253,7 +252,6 @@ class SimpleOpenID
/** /**
* SetOpenIDServer * SetOpenIDServer
* *
* @param string $a Server
* @return void * @return void
*/ */
function GetError() function GetError()
@ -265,7 +263,8 @@ class SimpleOpenID
/** /**
* ErrorStore * ErrorStore
* *
* @param string $a Server * @param string $code Code
* @param string $desc Description
* @return void * @return void
*/ */
function ErrorStore($code, $desc = null) function ErrorStore($code, $desc = null)
@ -280,14 +279,16 @@ class SimpleOpenID
/** /**
* IsError * IsError
* *
* @param string $a Server
* @return void * @return void
*/ */
function IsError() function IsError()
{ {
if (count($this->error) > 0){ if (count($this->error) > 0)
{
return true; return true;
}else{ }
else
{
return false; return false;
} }
} }
@ -295,7 +296,7 @@ class SimpleOpenID
/** /**
* splitResponse * splitResponse
* *
* @param string $a Server * @param string $response Server
* @return void * @return void
*/ */
function splitResponse($response) function splitResponse($response)
@ -315,7 +316,7 @@ class SimpleOpenID
/** /**
* OpenID_Standarize * OpenID_Standarize
* *
* @param string $a Server * @param string $openidçidentity Server
* @return void * @return void
*/ */
function OpenID_Standarize($openid_identity = null) function OpenID_Standarize($openid_identity = null)
@ -434,7 +435,6 @@ class SimpleOpenID
/** /**
* GetRedirectURL * GetRedirectURL
* *
* @param string $a Server
* @return void * @return void
*/ */
function GetRedirectURL() function GetRedirectURL()
@ -459,7 +459,6 @@ class SimpleOpenID
/** /**
* Redirect * Redirect
* *
* @param string $a Server
* @return void * @return void
*/ */
function Redirect() function Redirect()
@ -480,7 +479,6 @@ class SimpleOpenID
/** /**
* ValidateWithServer * ValidateWithServer
* *
* @param string $a Server
* @return void * @return void
*/ */
function ValidateWithServer() function ValidateWithServer()

View File

@ -26,10 +26,11 @@
/** /**
* Core function to output top menu smartphone * Core function to output top menu smartphone
* *
* @param $db * @param DoliDB $db Database handler
* @param $atarget * @param string $atarget Target
* @param $type_user 0=Internal,1=External,2=All * @param int $type_user 0=Internal,1=External,2=All
* @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
* @return void
*/ */
function print_smartphone_menu($db,$atarget,$type_user,$limitmenuto) function print_smartphone_menu($db,$atarget,$type_user,$limitmenuto)
{ {
@ -141,34 +142,66 @@ function print_smartphone_menu($db,$atarget,$type_user,$limitmenuto)
print "\n"; print "\n";
} }
/**
* Output menu entry
*
* @param string $theme Theme
* @return void
*/
function print_start_menu_array($theme='c') function print_start_menu_array($theme='c')
{ {
print '<ul data-role="listview" data-theme="'.$theme.'">'; print '<ul data-role="listview" data-theme="'.$theme.'">';
print "\n"; print "\n";
} }
/**
* Output start submenu entry
*
* @return void
*/
function print_start_submenu_array() function print_start_submenu_array()
{ {
print '<ul>'; print '<ul>';
print "\n"; print "\n";
} }
/**
* Output start menu entry
*
* @return void
*/
function print_start_menu_entry() function print_start_menu_entry()
{ {
print '<li>'; print '<li>';
} }
/**
* Output menu entry
*
* @param string $text Text
* @return void
*/
function print_text_menu_entry($text) function print_text_menu_entry($text)
{ {
print $text; print $text;
} }
/**
* Output end menu entry
*
* @return void
*/
function print_end_menu_entry() function print_end_menu_entry()
{ {
print '</li>'; print '</li>';
print "\n"; print "\n";
} }
/**
* Output end menu
*
* @return void
*/
function print_end_menu() function print_end_menu()
{ {
print '</ul>'; print '</ul>';

View File

@ -25,8 +25,8 @@
/** /**
* Class to manage smartphone menu smartphone (for internal users) * Class to manage smartphone menu smartphone (for internal users)
*/ */
class MenuSmart { class MenuSmart
{
var $db; var $db;
var $require_left=array("smartphone_backoffice"); // Si doit etre en phase avec un gestionnaire de menu particulier 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 var $hideifnotallowed=0; // Put 0 for back office menu, 1 for front office menu
@ -46,7 +46,7 @@ class MenuSmart {
/** /**
* Show menu * Show menu
* *
* @param string $limitmenuto To limit menu to a top or left menu value * @param string $limitmenuto To limit menu to a top or left menu value
* @return void * @return void
*/ */

View File

@ -23,10 +23,10 @@
/** /**
* \class MenuSmart * Class to manage smartphone menu smartphone (for external users)
* \brief 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 $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 var $hideifnotallowed=1; // Put 0 for back office menu, 1 for front office menu
@ -36,7 +36,7 @@ class MenuSmart {
/** /**
* Constructor * Constructor
* *
* @param DoliDB $DB Database handler * @param DoliDB $db Database handler
*/ */
function MenuSmart($db) function MenuSmart($db)
{ {
@ -47,7 +47,7 @@ class MenuSmart {
/** /**
* Show menu * 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) function showmenu($limitmenuto)
{ {

View File

@ -108,7 +108,11 @@ function print_auguria_menu($db,$atarget,$type_user)
} }
/**
* Output start menu entry
*
* @return void
*/
function print_start_menu_array_auguria() function print_start_menu_array_auguria()
{ {
global $conf; global $conf;
@ -116,6 +120,12 @@ function print_start_menu_array_auguria()
else print '<ul class="tmenu">'; else print '<ul class="tmenu">';
} }
/**
* Output menu entry
*
* @param string $idsel Text
* @return void
*/
function print_start_menu_entry_auguria($idsel) function print_start_menu_entry_auguria($idsel)
{ {
global $conf; global $conf;
@ -123,6 +133,12 @@ function print_start_menu_entry_auguria($idsel)
else print '<li class="tmenu" id="mainmenutd_'.$idsel.'">'; else print '<li class="tmenu" id="mainmenutd_'.$idsel.'">';
} }
/**
* Output menu entry
*
* @param string $text Text
* @return void
*/
function print_text_menu_entry_auguria($text) function print_text_menu_entry_auguria($text)
{ {
global $conf; global $conf;
@ -131,6 +147,11 @@ function print_text_menu_entry_auguria($text)
print '</span>'; print '</span>';
} }
/**
* Output end menu entry
*
* @return void
*/
function print_end_menu_entry_auguria() function print_end_menu_entry_auguria()
{ {
global $conf; global $conf;
@ -139,6 +160,11 @@ function print_end_menu_entry_auguria()
print "\n"; print "\n";
} }
/**
* Output menu array
*
* @return void
*/
function print_end_menu_array_auguria() function print_end_menu_array_auguria()
{ {
global $conf; global $conf;

View File

@ -511,6 +511,12 @@ function print_start_menu_array()
else print '<ul class="tmenu">'; else print '<ul class="tmenu">';
} }
/**
* Output start menu entry
*
* @param string $idsel Text
* @return void
*/
function print_start_menu_entry($idsel) function print_start_menu_entry($idsel)
{ {
global $conf; global $conf;
@ -518,6 +524,12 @@ function print_start_menu_entry($idsel)
else print '<li class="tmenu" id="mainmenutd_'.$idsel.'">'; else print '<li class="tmenu" id="mainmenutd_'.$idsel.'">';
} }
/**
* Output menu entry
*
* @param string $text Text
* @return void
*/
function print_text_menu_entry($text) function print_text_menu_entry($text)
{ {
global $conf; global $conf;
@ -526,6 +538,11 @@ function print_text_menu_entry($text)
print '</span>'; print '</span>';
} }
/**
* Output end menu entry
*
* @return void
*/
function print_end_menu_entry() function print_end_menu_entry()
{ {
global $conf; global $conf;
@ -534,6 +551,11 @@ function print_end_menu_entry()
print "\n"; print "\n";
} }
/**
* Output menu array
*
* @return void
*/
function print_end_menu_array() function print_end_menu_array()
{ {
global $conf; global $conf;

View File

@ -71,7 +71,11 @@ class MenuTop
} }
/**
* Output menu entry
*
* @return void
*/
function print_start_menu_array_empty() function print_start_menu_array_empty()
{ {
global $conf; global $conf;
@ -79,6 +83,12 @@ function print_start_menu_array_empty()
else print '<ul class="tmenu">'; else print '<ul class="tmenu">';
} }
/**
* Output start menu entry
*
* @param string $idsel Text
* @return void
*/
function print_start_menu_entry_empty($idsel) function print_start_menu_entry_empty($idsel)
{ {
global $conf; global $conf;
@ -86,6 +96,12 @@ function print_start_menu_entry_empty($idsel)
else print '<li class="tmenu" id="mainmenutd_'.$idsel.'">'; else print '<li class="tmenu" id="mainmenutd_'.$idsel.'">';
} }
/**
* Output menu entry
*
* @param string $text Text
* @return void
*/
function print_text_menu_entry_empty($text) function print_text_menu_entry_empty($text)
{ {
global $conf; global $conf;
@ -94,6 +110,11 @@ function print_text_menu_entry_empty($text)
print '</span>'; print '</span>';
} }
/**
* Output end menu entry
*
* @return void
*/
function print_end_menu_entry_empty() function print_end_menu_entry_empty()
{ {
global $conf; global $conf;
@ -102,6 +123,11 @@ function print_end_menu_entry_empty()
print "\n"; print "\n";
} }
/**
* Output menu array
*
* @return void
*/
function print_end_menu_array_empty() function print_end_menu_array_empty()
{ {
global $conf; global $conf;

View File

@ -74,9 +74,9 @@ Class pdf_expedition_merou extends ModelePdfExpedition
/** /**
* Fonction generant le document sur le disque * Fonction generant le document sur le disque
* *
* @param object Objet expedition a generer (ou id si ancienne methode) * @param Object &$object Objet expedition a generer (ou id si ancienne methode)
* @param outputlangs Lang output object * @param Translate $outputlangs Lang output object
* @return int 1=ok, 0=ko * @return int 1=ok, 0=ko
*/ */
function write_file(&$object, $outputlangs) function write_file(&$object, $outputlangs)
{ {

View File

@ -76,7 +76,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
/** /**
* Fonction generant le document sur le disque * Fonction generant le document sur le disque
* *
* @param Object $object Objet expedition a generer (ou id si ancienne methode) * @param Object &$object Objet expedition a generer (ou id si ancienne methode)
* @param Translate $outputlangs Lang output object * @param Translate $outputlangs Lang output object
* @return int 1=ok, 0=ko * @return int 1=ok, 0=ko
*/ */

View File

@ -120,7 +120,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition
* Return next free value * Return next free value
* *
* @param Societe $objsoc Third party object * @param Societe $objsoc Third party object
* @param Object $shipment Shipment object * @param Object $objforref Shipment object
* @return string Next free value * @return string Next free value
*/ */
function expedition_get_num($objsoc,$objforref) function expedition_get_num($objsoc,$objforref)

View File

@ -132,7 +132,7 @@ class mod_expedition_safor extends ModelNumRefExpedition
* Return next free value * Return next free value
* *
* @param Societe $objsoc Third party object * @param Societe $objsoc Third party object
* @param Object $shipment Shipment object * @param Object $objforref Shipment object
* @return string Next free value * @return string Next free value
*/ */
function expedition_get_num($objsoc,$objforref) function expedition_get_num($objsoc,$objforref)

View File

@ -513,7 +513,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($tab3_posx+58, $tab3_top+$y); $pdf->SetXY($tab3_posx+58, $tab3_top+$y);
$pdf->MultiCell(20, 3, $invoice->ref, 0, 'L', 0); $pdf->MultiCell(20, 3, $invoice->ref, 0, 'L', 0);
$pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3 ); $pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3);
$i++; $i++;
} }
@ -552,7 +552,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($tab3_posx+58, $tab3_top+$y); $pdf->SetXY($tab3_posx+58, $tab3_top+$y);
$pdf->MultiCell(30, 3, $row->num, 0, 'L', 0); $pdf->MultiCell(30, 3, $row->num, 0, 'L', 0);
$pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3 ); $pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3);
$i++; $i++;
} }

View File

@ -209,7 +209,7 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetFillColor(220,220,220); $pdf->SetFillColor(220,220,220);
$pdf->SetFont('','', $default_font_size - 1); $pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->marges['g'], $tab_top + $this->marges['g'] ); $pdf->SetXY($this->marges['g'], $tab_top + $this->marges['g']);
$iniY = $pdf->GetY(); $iniY = $pdf->GetY();
$curY = $pdf->GetY(); $curY = $pdf->GetY();
@ -356,13 +356,13 @@ class pdf_oursin extends ModelePDFFactures
$pdf->Rect($tab3_posx, $tab3_top-1, $tab3_width, $tab3_height); $pdf->Rect($tab3_posx, $tab3_top-1, $tab3_width, $tab3_height);
$pdf->SetFont('','', $default_font_size - 4); $pdf->SetFont('','', $default_font_size - 4);
$pdf->SetXY($tab3_posx, $tab3_top-1 ); $pdf->SetXY($tab3_posx, $tab3_top-1);
$pdf->MultiCell(20, 4, $outputlangs->transnoentities("Payment"), 0, 'L', 0); $pdf->MultiCell(20, 4, $outputlangs->transnoentities("Payment"), 0, 'L', 0);
$pdf->SetXY($tab3_posx+21, $tab3_top-1 ); $pdf->SetXY($tab3_posx+21, $tab3_top-1);
$pdf->MultiCell(20, 4, $outputlangs->transnoentities("Amount"), 0, 'L', 0); $pdf->MultiCell(20, 4, $outputlangs->transnoentities("Amount"), 0, 'L', 0);
$pdf->SetXY($tab3_posx+40, $tab3_top-1 ); $pdf->SetXY($tab3_posx+40, $tab3_top-1);
$pdf->MultiCell(20, 4, $outputlangs->transnoentities("Type"), 0, 'L', 0); $pdf->MultiCell(20, 4, $outputlangs->transnoentities("Type"), 0, 'L', 0);
$pdf->SetXY($tab3_posx+58, $tab3_top-1 ); $pdf->SetXY($tab3_posx+58, $tab3_top-1);
$pdf->MultiCell(20, 4, $outputlangs->transnoentities("Num"), 0, 'L', 0); $pdf->MultiCell(20, 4, $outputlangs->transnoentities("Num"), 0, 'L', 0);
$y=0; $y=0;
@ -746,6 +746,7 @@ class pdf_oursin extends ModelePDFFactures
* @param string $tab_top Top position of table * @param string $tab_top Top position of table
* @param string $tab_height Height of table (rectangle) * @param string $tab_height Height of table (rectangle)
* @param int $nexY Y * @param int $nexY Y
* @param Object $object Object
* @param Translate $outputlangs Langs object * @param Translate $outputlangs Langs object
* @return void * @return void
*/ */

View File

@ -110,10 +110,10 @@ class mod_facture_mercure extends ModeleNumRefFactures
/** /**
* Return next value * Return next value
* *
* @param objsoc Object third party * @param Societe $objsoc Object third party
* @param facture Object invoice * @param Facture $facture Object invoice
* @param mode 'next' for next value or 'last' for last value * @param string $mode 'next' for next value or 'last' for last value
* @return string Value if OK, 0 if KO * @return string Value if OK, 0 if KO
*/ */
function getNextValue($objsoc,$facture,$mode='next') function getNextValue($objsoc,$facture,$mode='next')
{ {

View File

@ -114,12 +114,13 @@ class mod_facture_terre extends ModeleNumRefFactures
return true; return true;
} }
/** Return next value not used or last value used /**
* Return next value not used or last value used
* *
* @param objsoc Object third party * @param Societe $objsoc Object third party
* @param facture Object invoice * @param Facture $facture Object invoice
* @param mode 'next' for next value or 'last' for last value * @param string $mode 'next' for next value or 'last' for last value
* @return string Value * @return string Value
*/ */
function getNextValue($objsoc,$facture,$mode='next') function getNextValue($objsoc,$facture,$mode='next')
{ {

View File

@ -116,9 +116,9 @@ abstract class ModeleNumRefFactures
/** /**
* Renvoi prochaine valeur attribuee * Renvoi prochaine valeur attribuee
* *
* @param objsoc Objet societe * @param Societe $objsoc Objet societe
* @param facture Objet facture * @param Facture $facture Objet facture
* @return string Valeur * @return string Value
*/ */
function getNextValue($objsoc,$facture) function getNextValue($objsoc,$facture)
{ {

View File

@ -143,7 +143,7 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder
* Return next free ref * Return next free ref
* *
* @param Societe $objsoc Object thirdparty * @param Societe $objsoc Object thirdparty
* @param Object $livraison Objet livraison * @param Object $object Objet livraison
* @return string Texte descripif * @return string Texte descripif
*/ */
function livraison_get_num($objsoc=0,$object='') function livraison_get_num($objsoc=0,$object='')

View File

@ -152,11 +152,12 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
return $examplecust.'<br>'.$examplesup; return $examplecust.'<br>'.$examplesup;
} }
/** Return next value /**
* Return next value
* *
* @param objsoc Object third party * @param Societe $objsoc Object third party
* @param $type Client ou fournisseur (0:customer, 1:supplier) * @param int $type Client ou fournisseur (0:customer, 1:supplier)
* @return string Value if OK, '' if module not configured, <0 if KO * @return string Value if OK, '' if module not configured, <0 if KO
*/ */
function getNextValue($objsoc=0,$type=-1) function getNextValue($objsoc=0,$type=-1)
{ {

View File

@ -247,7 +247,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
* Renvoi si un code respecte la syntaxe * Renvoi si un code respecte la syntaxe
* *
* @param string $code Code a verifier * @param string $code Code a verifier
* * @return int 0 si OK, <0 si KO * @return int 0 si OK, <0 si KO
*/ */
function verif_syntax($code) function verif_syntax($code)
{ {

View File

@ -100,10 +100,10 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
/** /**
* Set accountancy account code for a third party into this->code * Set accountancy account code for a third party into this->code
* *
* @param db Database handler * @param DoliDB $db Database handler
* @param societe Third party object * @param Societe $societe Third party object
* @param type 'customer' or 'supplier' * @param string $type 'customer' or 'supplier'
* @return int >=0 if OK, <0 if KO * @return int >=0 if OK, <0 if KO
*/ */
function get_code($db, $societe, $type) function get_code($db, $societe, $type)
{ {
@ -138,11 +138,11 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
/** /**
* Return if a code is available * Return if a code is available
* *
* @param db Database handler * @param DoliDB $db Database handler
* @param code Code of third party * @param string $code Code of third party
* @param societe Object third party * @param Societe $societe Object third party
* @param type 'supplier' or 'customer' * @param string $type 'supplier' or 'customer'
* @return int 0 if OK but not available, >0 if OK and available, <0 if KO * @return int 0 if OK but not available, >0 if OK and available, <0 if KO
*/ */
function verif($db, $code, $societe, $type) function verif($db, $code, $societe, $type)
{ {

View File

@ -115,9 +115,10 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
/** /**
* Write the invoice as a document onto disk * Write the invoice as a document onto disk
* @param object Object invoice to build (or id if old method) *
* @param outputlangs Lang object for output language * @param Object $object Object invoice to build (or id if old method)
* @return int 1=OK, 0=KO * @param Translate $outputlangs Lang object for output language
* @return int 1=OK, 0=KO
*/ */
function write_file($object,$outputlangs='') function write_file($object,$outputlangs='')
{ {
@ -712,13 +713,13 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height); $pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height);
$pdf->SetFont('','', $default_font_size - 4); $pdf->SetFont('','', $default_font_size - 4);
$pdf->SetXY($tab3_posx, $tab3_top ); $pdf->SetXY($tab3_posx, $tab3_top);
$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Payment"), 0, 'L', 0); $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Payment"), 0, 'L', 0);
$pdf->SetXY($tab3_posx+21, $tab3_top ); $pdf->SetXY($tab3_posx+21, $tab3_top);
$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Amount"), 0, 'L', 0); $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Amount"), 0, 'L', 0);
$pdf->SetXY($tab3_posx+40, $tab3_top ); $pdf->SetXY($tab3_posx+40, $tab3_top);
$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Type"), 0, 'L', 0); $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Type"), 0, 'L', 0);
$pdf->SetXY($tab3_posx+58, $tab3_top ); $pdf->SetXY($tab3_posx+58, $tab3_top);
$pdf->MultiCell(20, 3, $outputlangs->transnoentities("Num"), 0, 'L', 0); $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Num"), 0, 'L', 0);
$y=0; $y=0;
@ -752,7 +753,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$pdf->SetXY($tab3_posx+58, $tab3_top+$y); $pdf->SetXY($tab3_posx+58, $tab3_top+$y);
$pdf->MultiCell(30, 3, $row->num, 0, 'L', 0); $pdf->MultiCell(30, 3, $row->num, 0, 'L', 0);
$pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3 ); $pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3);
$i++; $i++;
} }

View File

@ -93,13 +93,13 @@ class InterfaceLogevents
* Function called when a Dolibarrr business event is done. * Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
* *
* @param action Code de l'evenement * @param string $action Event action code
* @param object Objet concerne * @param Object $object Object
* @param user Objet user * @param User $user Object user
* @param langs Objet langs * @param Translate $langs Object langs
* @param conf Objet conf * @param conf $conf Object conf
* @param entity Value for instance of data (Always 1 except if module MultiCompany is installed) * @param string $entity Value for instance of data (Always 1 except if module MultiCompany is installed)
* @return int <0 if KO, 0 if no triggered ran, >0 if OK * @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/ */
function run_trigger($action,$object,$user,$langs,$conf,$entity=1) function run_trigger($action,$object,$user,$langs,$conf,$entity=1)
{ {

View File

@ -88,12 +88,12 @@ class InterfacePaypalWorkflow
* Fonction appelee lors du declenchement d'un evenement Dolibarr. * Fonction appelee lors du declenchement d'un evenement Dolibarr.
* D'autres fonctions run_trigger peuvent etre presentes dans core/triggers * D'autres fonctions run_trigger peuvent etre presentes dans core/triggers
* *
* @param string $action Code de l'evenement * @param string $action Event action code
* @param CommonObject $object Objet concerne * @param Object $object Object
* @param User $user Objet user * @param User $user Object user
* @param Translate $langs Objet lang * @param Translate $langs Object langs
* @param Conf $conf Objet conf * @param conf $conf Object conf
* @return int <0 if fatal error, 0 si nothing done, >0 if ok * @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/ */
function run_trigger($action,$object,$user,$langs,$conf) function run_trigger($action,$object,$user,$langs,$conf)
{ {

View File

@ -90,12 +90,13 @@ class InterfaceWorkflowManager
* Function called when a Dolibarrr business event is done. * Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
* *
* @param action Event code (COMPANY_CREATE, PROPAL_VALIDATE, ...) * @param string $action Event action code
* @param object Object action is done on * @param Object $object Object
* @param user Object user * @param User $user Object user
* @param langs Object langs * @param Translate $langs Object langs
* @param conf Object conf * @param conf $conf Object conf
* @return int <0 if KO, 0 if no action are done, >0 if OK * @param string $entity Value for instance of data (Always 1 except if module MultiCompany is installed)
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/ */
function run_trigger($action,$object,$user,$langs,$conf) function run_trigger($action,$object,$user,$langs,$conf)
{ {

View File

@ -104,12 +104,12 @@ class InterfaceActionsAuto
* $object->fk_element * $object->fk_element
* $object->elementtype * $object->elementtype
* *
* @param action Event code (COMPANY_CREATE, PROPAL_VALIDATE, ...) * @param string $action Event action code
* @param object Object action is done on * @param Object $object Object
* @param user Object user * @param User $user Object user
* @param langs Object langs * @param Translate $langs Object langs
* @param conf Object conf * @param conf $conf Object conf
* @return int <0 if KO, 0 if no action are done, >0 if OK * @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/ */
function run_trigger($action,$object,$user,$langs,$conf) function run_trigger($action,$object,$user,$langs,$conf)
{ {

View File

@ -89,12 +89,12 @@ class InterfaceLdapsynchro
* Function called when a Dolibarrr business event is done. * Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
* *
* @param action Event code (COMPANY_CREATE, PROPAL_VALIDATE, ...) * @param string $action Event action code
* @param object Object action is done on * @param Object $object Object
* @param user Object user * @param User $user Object user
* @param langs Object langs * @param Translate $langs Object langs
* @param conf Object conf * @param conf $conf Object conf
* @return int <0 if KO, 0 if no action are done, >0 if OK * @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/ */
function run_trigger($action,$object,$user,$langs,$conf) function run_trigger($action,$object,$user,$langs,$conf)
{ {

View File

@ -89,12 +89,12 @@ class InterfaceNotification
* Function called when a Dolibarrr business event is done. * Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
* *
* @param action Event code (COMPANY_CREATE, PROPAL_VALIDATE, ...) * @param string $action Event action code
* @param object Object action is done on * @param Object $object Object
* @param user Object user * @param User $user Object user
* @param langs Object langs * @param Translate $langs Object langs
* @param conf Object conf * @param conf $conf Object conf
* @return int <0 if KO, 0 if no action are done, >0 if OK * @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/ */
function run_trigger($action,$object,$user,$langs,$conf) function run_trigger($action,$object,$user,$langs,$conf)
{ {

View File

@ -92,12 +92,13 @@ class InterfaceDemo
/** /**
* Function called when a Dolibarrr business event is done. * Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
* @param action Code de l'evenement *
* @param object Objet concerne * @param string $action Event action code
* @param user Objet user * @param Object $object Object
* @param langs Objet langs * @param User $user Object user
* @param conf Objet conf * @param Translate $langs Object langs
* @return int <0 if KO, 0 if no triggered ran, >0 if OK * @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/ */
function run_trigger($action,$object,$user,$langs,$conf) function run_trigger($action,$object,$user,$langs,$conf)
{ {

View File

@ -806,6 +806,7 @@ function migrate_contracts_det($db,$langs,$conf)
} }
/** /**
* Function to migrate links into llx_bank_url
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param Translate $langs Object langs * @param Translate $langs Object langs
@ -2687,9 +2688,14 @@ function migrate_project_task_actors($db,$langs,$conf)
/** /**
* Migration des tables de relation * Migration des tables de relation
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param Translate $langs Object langs * @param Translate $langs Object langs
* @param Conf $conf Object conf * @param Conf $conf Object conf
* @param string $table Table name
* @param int $fk_source Id of element source
* @param type $sourcetype Type of element source
* @param int $fk_target Id of element target
* @param type $targettype Type of element target
* @return void * @return void
*/ */
function migrate_relationship_tables($db,$langs,$conf,$table,$fk_source,$sourcetype,$fk_target,$targettype) function migrate_relationship_tables($db,$langs,$conf,$table,$fk_source,$sourcetype,$fk_target,$targettype)

View File

@ -55,18 +55,18 @@ function llxHeaderPaypal($title, $head = "")
print '.CTableRow2 { margin: 1px; padding: 3px; font: 12px verdana,arial; background: #FFFFFF; color: #000000; -moz-border-radius-topleft:6px; -moz-border-radius-topright:6px; -moz-border-radius-bottomleft:6px; -moz-border-radius-bottomright:6px;}'; print '.CTableRow2 { margin: 1px; padding: 3px; font: 12px verdana,arial; background: #FFFFFF; color: #000000; -moz-border-radius-topleft:6px; -moz-border-radius-topright:6px; -moz-border-radius-bottomleft:6px; -moz-border-radius-bottomright:6px;}';
print '</style>'; print '</style>';
} }
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
print '<!-- Includes for JQuery (Ajax library) -->'."\n"; print '<!-- Includes for JQuery (Ajax library) -->'."\n";
print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css" />'."\n"; // JNotify print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css" />'."\n"; // JNotify
// Output standard javascript links // Output standard javascript links
$ext='.js'; $ext='.js';
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) { if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x01)) {
$ext='.jgz'; $ext='.jgz';
} // mini='_mini', ext='.gz' } // mini='_mini', ext='.gz'
// JQuery. Must be before other includes // JQuery. Must be before other includes
print '<!-- Includes JS for JQuery -->'."\n"; print '<!-- Includes JS for JQuery -->'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-latest.min'.$ext.'"></script>'."\n"; print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-latest.min'.$ext.'"></script>'."\n";
@ -764,7 +764,9 @@ function deformatNVP($nvpstr)
} }
/** /**
* Get API errors * Get API errors
*
* @return array Array of errors
*/ */
function getApiError() function getApiError()
{ {

View File

@ -50,27 +50,6 @@ if (isset($_SERVER["DOCUMENT_URI"]) && $_SERVER["DOCUMENT_URI"])
} }
// Define syslog constants
if (! defined('LOG_DEBUG'))
{
if (function_exists("define_syslog_variables"))
{
define_syslog_variables(); // Deprecated since php 5.3.0, syslog variables no longer need to be initialized
}
else
{
// Pour PHP sans syslog (comme sous Windows)
define('LOG_EMERG',0);
define('LOG_ALERT',1);
define('LOG_CRIT',2);
define('LOG_ERR',3);
define('LOG_WARNING',4);
define('LOG_NOTICE',5);
define('LOG_INFO',6);
define('LOG_DEBUG',7);
}
}
$includeconferror=''; $includeconferror='';
// Define vars // Define vars
@ -135,28 +114,6 @@ if (empty($conf->db->dolibarr_main_db_cryptkey)) $conf->db->dolibarr_main_db_c
if (empty($conf->db->user)) $conf->db->user=''; if (empty($conf->db->user)) $conf->db->user='';
// Removed magic_quotes
if (function_exists('get_magic_quotes_gpc')) // magic_quotes_* removed in PHP6
{
if (get_magic_quotes_gpc())
{
// Forcing parameter setting magic_quotes_gpc and cleaning parameters
// (Otherwise he would have for each position, condition
// Reading stripslashes variable according to state get_magic_quotes_gpc).
// Off mode (recommended, you just do $db->escape when an insert / update.
function stripslashes_deep($value)
{
return (is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value));
}
$_GET = array_map('stripslashes_deep', $_GET);
$_POST = array_map('stripslashes_deep', $_POST);
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
$_REQUEST = array_map('stripslashes_deep', $_REQUEST);
@set_magic_quotes_runtime(0);
}
}
// Defini objet langs // Defini objet langs
$langs = new Translate('..',$conf); $langs = new Translate('..',$conf);
if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang')); if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang'));
@ -257,16 +214,4 @@ function pFooter($nonext=0,$setuplang='')
print '</html>'."\n"; print '</html>'."\n";
} }
/**
* Output a text into a log file
*
* @param string $message Message to show
* @param string $level Log level
*/
function dolibarr_support_syslog($message, $level=LOG_DEBUG)
{
if (! defined('LOG_DEBUG')) define('LOG_DEBUG',6);
dol_syslog($message,$level);
}
?> ?>

View File

@ -154,7 +154,7 @@ print '</td></tr></table>';
print '</td>'; print '</td>';
print '</tr><tr>'; print '</tr><tr>';
$urlwiki='http://wiki.dolibarr.org/index.php/List_of_OpenSource_Software_companies_and_freelancers'; $urlwiki='http://wiki.dolibarr.org/index.php/List of Dolibarr partners and providers';
print '<td align="center" valign="top">'; print '<td align="center" valign="top">';
print '<table class="nocellnopadd">'; print '<table class="nocellnopadd">';
/*print '<tr><td align="center" valign="top">'; /*print '<tr><td align="center" valign="top">';
@ -190,7 +190,7 @@ print '</td></tr></table>';
print '</td>'; print '</td>';
print '</tr><tr>'; print '</tr><tr>';
$urlwiki='http://wiki.dolibarr.org/index.php/List_of_OpenSource_Software_companies_and_freelancers'; $urlwiki='http://wiki.dolibarr.org/index.php/List of Dolibarr partners and providers';
print '<td align="center" valign="top">'; print '<td align="center" valign="top">';
print '<table class="nocellnopadd">'; print '<table class="nocellnopadd">';
/*print '<tr><td align="center" valign="top">'; /*print '<tr><td align="center" valign="top">';