From 43a0f4e29b5704264f41284f4c24acc9c9fb7d08 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 15:53:54 +0000 Subject: [PATCH 1/8] Fix: Removed warnings --- htdocs/lib/admin.lib.php | 816 +++++++++++++++++++-------------------- 1 file changed, 408 insertions(+), 408 deletions(-) diff --git a/htdocs/lib/admin.lib.php b/htdocs/lib/admin.lib.php index 00e62cc2ca5..6bcab638b91 100644 --- a/htdocs/lib/admin.lib.php +++ b/htdocs/lib/admin.lib.php @@ -31,11 +31,11 @@ */ function versiontostring($versionarray) { - $string='?'; - if (isset($versionarray[0])) $string=$versionarray[0]; - if (isset($versionarray[1])) $string.='.'.$versionarray[1]; - if (isset($versionarray[2])) $string.='.'.$versionarray[2]; - return $string; + $string='?'; + if (isset($versionarray[0])) $string=$versionarray[0]; + if (isset($versionarray[1])) $string.='.'.$versionarray[1]; + if (isset($versionarray[2])) $string.='.'.$versionarray[2]; + return $string; } /** @@ -49,28 +49,28 @@ function versiontostring($versionarray) */ function versioncompare($versionarray1,$versionarray2) { - $ret=0; - $level=0; - $count1=count($versionarray1); - $count2=count($versionarray2); - $maxcount=max($count1,$count2); - while ($level < $maxcount) - { - $operande1=isset($versionarray1[$level])?$versionarray1[$level]:0; - $operande2=isset($versionarray2[$level])?$versionarray2[$level]:0; - if (preg_match('/alpha|dev/i',$operande1)) $operande1=-3; - if (preg_match('/alpha|dev/i',$operande2)) $operande2=-3; - if (preg_match('/beta/i',$operande1)) $operande1=-2; - if (preg_match('/beta/i',$operande2)) $operande2=-2; - if (preg_match('/rc/i',$operande1)) $operande1=-1; - if (preg_match('/rc/i',$operande2)) $operande2=-1; - $level++; - //print 'level '.$level.' '.$operande1.'-'.$operande2.'
'; - if ($operande1 < $operande2) { $ret = -$level; break; } - if ($operande1 > $operande2) { $ret = $level; break; } - } - //print join('.',$versionarray1).'('.count($versionarray1).') / '.join('.',$versionarray2).'('.count($versionarray2).') => '.$ret; - return $ret; + $ret=0; + $level=0; + $count1=count($versionarray1); + $count2=count($versionarray2); + $maxcount=max($count1,$count2); + while ($level < $maxcount) + { + $operande1=isset($versionarray1[$level])?$versionarray1[$level]:0; + $operande2=isset($versionarray2[$level])?$versionarray2[$level]:0; + if (preg_match('/alpha|dev/i',$operande1)) $operande1=-3; + if (preg_match('/alpha|dev/i',$operande2)) $operande2=-3; + if (preg_match('/beta/i',$operande1)) $operande1=-2; + if (preg_match('/beta/i',$operande2)) $operande2=-2; + if (preg_match('/rc/i',$operande1)) $operande1=-1; + if (preg_match('/rc/i',$operande2)) $operande2=-1; + $level++; + //print 'level '.$level.' '.$operande1.'-'.$operande2.'
'; + if ($operande1 < $operande2) { $ret = -$level; break; } + if ($operande1 > $operande2) { $ret = $level; break; } + } + //print join('.',$versionarray1).'('.count($versionarray1).') / '.join('.',$versionarray2).'('.count($versionarray2).') => '.$ret; + return $ret; } @@ -81,7 +81,7 @@ function versioncompare($versionarray1,$versionarray2) */ function versionphparray() { - return explode('.',PHP_VERSION); + return explode('.',PHP_VERSION); } /** @@ -91,7 +91,7 @@ function versionphparray() */ function versiondolibarrarray() { - return explode('.',DOL_VERSION); + return explode('.',DOL_VERSION); } @@ -112,189 +112,189 @@ function versiondolibarrarray() */ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='') { - global $db, $conf, $langs, $user; + global $db, $conf, $langs, $user; - dol_syslog("Admin.lib::run_sql run sql file ".$sqlfile, LOG_DEBUG); + dol_syslog("Admin.lib::run_sql run sql file ".$sqlfile, LOG_DEBUG); - $ok=0; - $error=0; - $i=0; - $buffer = ''; - $arraysql = Array(); + $ok=0; + $error=0; + $i=0; + $buffer = ''; + $arraysql = Array(); - // Get version of database - $versionarray=$db->getVersionArray(); + // Get version of database + $versionarray=$db->getVersionArray(); - $fp = fopen($sqlfile,"r"); - if ($fp) - { - while (! feof($fp)) - { - $buf = fgets($fp, 4096); + $fp = fopen($sqlfile,"r"); + if ($fp) + { + while (! feof($fp)) + { + $buf = fgets($fp, 4096); - // Cas special de lignes autorisees pour certaines versions uniquement - if (preg_match('/^--\sV([0-9\.]+)/i',$buf,$reg)) - { - $versioncommande=explode('.',$reg[1]); - //print var_dump($versioncommande); - //print var_dump($versionarray); - if (count($versioncommande) && count($versionarray) - && versioncompare($versioncommande,$versionarray) <= 0) - { - // Version qualified, delete SQL comments - $buf=preg_replace('/^--\sV([0-9\.]+)/i','',$buf); - //print "Ligne $i qualifi?e par version: ".$buf.'
'; - } - } + // Cas special de lignes autorisees pour certaines versions uniquement + if (preg_match('/^--\sV([0-9\.]+)/i',$buf,$reg)) + { + $versioncommande=explode('.',$reg[1]); + //print var_dump($versioncommande); + //print var_dump($versionarray); + if (count($versioncommande) && count($versionarray) + && versioncompare($versioncommande,$versionarray) <= 0) + { + // Version qualified, delete SQL comments + $buf=preg_replace('/^--\sV([0-9\.]+)/i','',$buf); + //print "Ligne $i qualifi?e par version: ".$buf.'
'; + } + } - // Add line buf to buffer if not a comment - if (! preg_match('/^--/',$buf)) - { + // Add line buf to buffer if not a comment + if (! preg_match('/^--/',$buf)) + { $buf=preg_replace('/--.*$/','',$buf); //remove comment from a line that not start with -- before add it to the buffer - $buffer .= trim($buf); - } + $buffer .= trim($buf); + } - // print $buf.'
'; + // print $buf.'
'; - if (preg_match('/;/',$buffer)) // If string contains ';', it's end of a request string, we save it in arraysql. - { - // Found new request - if ($buffer) $arraysql[$i]=$buffer; - $i++; - $buffer=''; - } - } + if (preg_match('/;/',$buffer)) // If string contains ';', it's end of a request string, we save it in arraysql. + { + // Found new request + if ($buffer) $arraysql[$i]=$buffer; + $i++; + $buffer=''; + } + } - if ($buffer) $arraysql[$i]=$buffer; - fclose($fp); - } - else - { - dol_syslog("Admin.lib::run_sql failed to open file ".$sqlfile, LOG_ERR); - } + if ($buffer) $arraysql[$i]=$buffer; + fclose($fp); + } + else + { + dol_syslog("Admin.lib::run_sql failed to open file ".$sqlfile, LOG_ERR); + } - // Loop on each request to see if there is a __+MAX_table__ key - $listofmaxrowid=array(); // This is a cache table - foreach($arraysql as $i => $sql) - { - $newsql=$sql; + // Loop on each request to see if there is a __+MAX_table__ key + $listofmaxrowid=array(); // This is a cache table + foreach($arraysql as $i => $sql) + { + $newsql=$sql; - // Replace __+MAX_table__ with max of table - while (preg_match('/__\+MAX_([A-Za-z_]+)__/i',$newsql,$reg)) - { - $table=$reg[1]; - if (! isset($listofmaxrowid[$table])) - { - //var_dump($db); - $sqlgetrowid='SELECT MAX(rowid) as max from '.$table; - $resql=$db->query($sqlgetrowid); - if ($resql) - { - $obj=$db->fetch_object($resql); - $listofmaxrowid[$table]=$obj->max; - if (empty($listofmaxrowid[$table])) $listofmaxrowid[$table]=0; - } - else - { - dol_syslog('Admin.lib::run_sql Failed to get max rowid for '.$table.' '.$db->lasterror().' sql='.$sqlgetrowid, LOG_ERR); - if (! $silent) print ''; - if (! $silent) print '
'.$langs->trans("Failed to get max rowid for ".$table)."
"; - if (! $silent) print ''; - $error++; - break; - } - } - $from='__+MAX_'.$table.'__'; - $to='+'.$listofmaxrowid[$table]; - $newsql=str_replace($from,$to,$newsql); - dol_syslog('Admin.lib::run_sql New Request '.($i+1).' (replacing '.$from.' to '.$to.') sql='.$newsql, LOG_DEBUG); + // Replace __+MAX_table__ with max of table + while (preg_match('/__\+MAX_([A-Za-z_]+)__/i',$newsql,$reg)) + { + $table=$reg[1]; + if (! isset($listofmaxrowid[$table])) + { + //var_dump($db); + $sqlgetrowid='SELECT MAX(rowid) as max from '.$table; + $resql=$db->query($sqlgetrowid); + if ($resql) + { + $obj=$db->fetch_object($resql); + $listofmaxrowid[$table]=$obj->max; + if (empty($listofmaxrowid[$table])) $listofmaxrowid[$table]=0; + } + else + { + dol_syslog('Admin.lib::run_sql Failed to get max rowid for '.$table.' '.$db->lasterror().' sql='.$sqlgetrowid, LOG_ERR); + if (! $silent) print ''; + if (! $silent) print '
'.$langs->trans("Failed to get max rowid for ".$table)."
"; + if (! $silent) print ''; + $error++; + break; + } + } + $from='__+MAX_'.$table.'__'; + $to='+'.$listofmaxrowid[$table]; + $newsql=str_replace($from,$to,$newsql); + dol_syslog('Admin.lib::run_sql New Request '.($i+1).' (replacing '.$from.' to '.$to.') sql='.$newsql, LOG_DEBUG); - $arraysql[$i]=$newsql; - } - } + $arraysql[$i]=$newsql; + } + } - // Loop on each request to execute request - $cursorinsert=0; - $listofinsertedrowid=array(); - foreach($arraysql as $i => $sql) - { - if ($sql) - { - if (!empty($handler)) $sql=preg_replace('/__HANDLER__/i',"'".$handler."'",$sql); + // Loop on each request to execute request + $cursorinsert=0; + $listofinsertedrowid=array(); + foreach($arraysql as $i => $sql) + { + if ($sql) + { + if (!empty($handler)) $sql=preg_replace('/__HANDLER__/i',"'".$handler."'",$sql); - $newsql=preg_replace('/__ENTITY__/i',(!empty($entity)?$entity:$conf->entity),$sql); + $newsql=preg_replace('/__ENTITY__/i',(!empty($entity)?$entity:$conf->entity),$sql); - // Ajout trace sur requete (eventuellement a commenter si beaucoup de requetes) - if (! $silent) print ''.$langs->trans("Request").' '.($i+1)." sql='".$newsql."'\n"; - dol_syslog('Admin.lib::run_sql Request '.($i+1).' sql='.$newsql, LOG_DEBUG); + // Ajout trace sur requete (eventuellement a commenter si beaucoup de requetes) + if (! $silent) print ''.$langs->trans("Request").' '.($i+1)." sql='".$newsql."'\n"; + dol_syslog('Admin.lib::run_sql Request '.($i+1).' sql='.$newsql, LOG_DEBUG); - // Replace for encrypt data - if (preg_match_all('/__ENCRYPT\(\'([^\,]+)\'\)__/i',$newsql,$reg)) - { - $num=count($reg[0]); + // Replace for encrypt data + if (preg_match_all('/__ENCRYPT\(\'([^\,]+)\'\)__/i',$newsql,$reg)) + { + $num=count($reg[0]); - for($i=0;$i<$num;$i++) - { - $from = $reg[0][$i]; - $to = $db->encrypt($reg[1][$i],1); - $newsql = str_replace($from,$to,$newsql); - } - } + for($i=0;$i<$num;$i++) + { + $from = $reg[0][$i]; + $to = $db->encrypt($reg[1][$i],1); + $newsql = str_replace($from,$to,$newsql); + } + } - // Replace for decrypt data - if (preg_match_all('/__DECRYPT\(\'([^\,]+)\'\)__/i',$newsql,$reg)) - { - $num=count($reg[0]); + // Replace for decrypt data + if (preg_match_all('/__DECRYPT\(\'([^\,]+)\'\)__/i',$newsql,$reg)) + { + $num=count($reg[0]); - for($i=0;$i<$num;$i++) - { - $from = $reg[0][$i]; - $to = $db->decrypt($reg[1][$i]); - $newsql = str_replace($from,$to,$newsql); - } - } + for($i=0;$i<$num;$i++) + { + $from = $reg[0][$i]; + $to = $db->decrypt($reg[1][$i]); + $newsql = str_replace($from,$to,$newsql); + } + } - // Replace __x__ with rowid of insert nb x - while (preg_match('/__([0-9]+)__/',$newsql,$reg)) - { - $cursor=$reg[1]; - if (empty($listofinsertedrowid[$cursor])) - { - if (! $silent) print ''; - if (! $silent) print '
'.$langs->trans("FileIsNotCorrect")."
"; - if (! $silent) print ''; - $error++; - break; - } - $from='__'.$cursor.'__'; - $to=$listofinsertedrowid[$cursor]; - $newsql=str_replace($from,$to,$newsql); - dol_syslog('Admin.lib::run_sql New Request '.($i+1).' (replacing '.$from.' to '.$to.') sql='.$newsql, LOG_DEBUG); - } + // Replace __x__ with rowid of insert nb x + while (preg_match('/__([0-9]+)__/',$newsql,$reg)) + { + $cursor=$reg[1]; + if (empty($listofinsertedrowid[$cursor])) + { + if (! $silent) print ''; + if (! $silent) print '
'.$langs->trans("FileIsNotCorrect")."
"; + if (! $silent) print ''; + $error++; + break; + } + $from='__'.$cursor.'__'; + $to=$listofinsertedrowid[$cursor]; + $newsql=str_replace($from,$to,$newsql); + dol_syslog('Admin.lib::run_sql New Request '.($i+1).' (replacing '.$from.' to '.$to.') sql='.$newsql, LOG_DEBUG); + } - $result=$db->query($newsql,$usesavepoint); - if ($result) - { - if (! $silent) print ''."\n"; + $result=$db->query($newsql,$usesavepoint); + if ($result) + { + if (! $silent) print ''."\n"; - if (preg_replace('/insert into ([^\s]+)/i',$newsql,$reg)) - { - $cursorinsert++; + if (preg_replace('/insert into ([^\s]+)/i',$newsql,$reg)) + { + $cursorinsert++; - // It's an insert - $table=preg_replace('/([^a-zA-Z_]+)/i','',$reg[1]); - $insertedrowid=$db->last_insert_id($table); - $listofinsertedrowid[$cursorinsert]=$insertedrowid; - dol_syslog('Admin.lib::run_sql Insert nb '.$cursorinsert.', done in table '.$table.', rowid is '.$listofinsertedrowid[$cursorinsert], LOG_DEBUG); - } - // print 'OK'; - } - else - { - $errno=$db->errno(); - if (! $silent) print ''."\n"; + // It's an insert + $table=preg_replace('/([^a-zA-Z_]+)/i','',$reg[1]); + $insertedrowid=$db->last_insert_id($table); + $listofinsertedrowid[$cursorinsert]=$insertedrowid; + dol_syslog('Admin.lib::run_sql Insert nb '.$cursorinsert.', done in table '.$table.', rowid is '.$listofinsertedrowid[$cursorinsert], LOG_DEBUG); + } + // print 'OK'; + } + else + { + $errno=$db->errno(); + if (! $silent) print ''."\n"; - $okerror=array( 'DB_ERROR_TABLE_ALREADY_EXISTS', + $okerror=array( 'DB_ERROR_TABLE_ALREADY_EXISTS', 'DB_ERROR_COLUMN_ALREADY_EXISTS', 'DB_ERROR_KEY_NAME_ALREADY_EXISTS', 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS', // PgSql use same code for table and key already exist @@ -309,36 +309,36 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='') ); if (in_array($errno,$okerror)) { - //if (! $silent) print $langs->trans("OK"); + //if (! $silent) print $langs->trans("OK"); } else { - if (! $silent) print ''; - if (! $silent) print '
'.$langs->trans("Error")." ".$db->errno().": ".$newsql."
".$db->error()."
"; - if (! $silent) print ''."\n"; - dol_syslog('Admin.lib::run_sql Request '.($i+1)." Error ".$db->errno()." ".$newsql."
".$db->error(), LOG_ERR); - $error++; + if (! $silent) print ''; + if (! $silent) print '
'.$langs->trans("Error")." ".$db->errno().": ".$newsql."
".$db->error()."
"; + if (! $silent) print ''."\n"; + dol_syslog('Admin.lib::run_sql Request '.($i+1)." Error ".$db->errno()." ".$newsql."
".$db->error(), LOG_ERR); + $error++; } - } + } - if (! $silent) print ''."\n"; - } - } + if (! $silent) print ''."\n"; + } + } - if ($error == 0) - { - if (! $silent) print ''.$langs->trans("ProcessMigrateScript").''; - if (! $silent) print ''.$langs->trans("OK").''."\n"; - $ok = 1; - } - else - { - if (! $silent) print ''.$langs->trans("ProcessMigrateScript").''; - if (! $silent) print ''.$langs->trans("KO").''."\n"; - $ok = 0; - } + if ($error == 0) + { + if (! $silent) print ''.$langs->trans("ProcessMigrateScript").''; + if (! $silent) print ''.$langs->trans("OK").''."\n"; + $ok = 1; + } + else + { + if (! $silent) print ''.$langs->trans("ProcessMigrateScript").''; + if (! $silent) print ''.$langs->trans("KO").''."\n"; + $ok = 0; + } - return $ok; + return $ok; } @@ -354,26 +354,26 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='') */ function dolibarr_del_const($db, $name, $entity=1) { - global $conf; + global $conf; - $sql = "DELETE FROM ".MAIN_DB_PREFIX."const"; - $sql.= " WHERE (".$db->decrypt('name')." = '".$db->escape($name)."'"; - if (is_numeric($name)) $sql.= " OR rowid = '".$db->escape($name)."'"; - $sql.= ")"; - if ($entity >= 0) $sql.= " AND entity = ".$entity; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."const"; + $sql.= " WHERE (".$db->decrypt('name')." = '".$db->escape($name)."'"; + if (is_numeric($name)) $sql.= " OR rowid = '".$db->escape($name)."'"; + $sql.= ")"; + if ($entity >= 0) $sql.= " AND entity = ".$entity; - dol_syslog("admin.lib::dolibarr_del_const sql=".$sql); - $resql=$db->query($sql); - if ($resql) - { - $conf->global->$name=''; - return 1; - } - else - { - dol_print_error($db); - return -1; - } + dol_syslog("admin.lib::dolibarr_del_const sql=".$sql); + $resql=$db->query($sql); + if ($resql) + { + $conf->global->$name=''; + return 1; + } + else + { + dol_print_error($db); + return -1; + } } /** @@ -388,22 +388,22 @@ function dolibarr_del_const($db, $name, $entity=1) */ function dolibarr_get_const($db, $name, $entity=1) { - global $conf; - $value=''; + global $conf; + $value=''; - $sql = "SELECT ".$db->decrypt('value')." as value"; - $sql.= " FROM ".MAIN_DB_PREFIX."const"; - $sql.= " WHERE name = ".$db->encrypt($name,1); - $sql.= " AND entity = ".$entity; + $sql = "SELECT ".$db->decrypt('value')." as value"; + $sql.= " FROM ".MAIN_DB_PREFIX."const"; + $sql.= " WHERE name = ".$db->encrypt($name,1); + $sql.= " AND entity = ".$entity; - dol_syslog("admin.lib::dolibarr_get_const sql=".$sql); - $resql=$db->query($sql); - if ($resql) - { - $obj=$db->fetch_object($resql); - if ($obj) $value=$obj->value; - } - return $value; + dol_syslog("admin.lib::dolibarr_get_const sql=".$sql); + $resql=$db->query($sql); + if ($resql) + { + $obj=$db->fetch_object($resql); + if ($obj) $value=$obj->value; + } + return $value; } @@ -423,57 +423,57 @@ function dolibarr_get_const($db, $name, $entity=1) */ function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1) { - global $conf; + global $conf; - // Clean parameters - $name=trim($name); + // Clean parameters + $name=trim($name); - // Check parameters - if (empty($name)) - { - dol_print_error($db,"Error: Call to function dolibarr_set_const with wrong parameters", LOG_ERR); - exit; - } + // Check parameters + if (empty($name)) + { + dol_print_error($db,"Error: Call to function dolibarr_set_const with wrong parameters", LOG_ERR); + exit; + } - //dol_syslog("dolibarr_set_const name=$name, value=$value type=$type, visible=$visible, note=$note entity=$entity"); + //dol_syslog("dolibarr_set_const name=$name, value=$value type=$type, visible=$visible, note=$note entity=$entity"); - $db->begin(); + $db->begin(); - $sql = "DELETE FROM ".MAIN_DB_PREFIX."const"; - $sql.= " WHERE name = ".$db->encrypt($name,1); - if ($entity > 0) $sql.= " AND entity = ".$entity; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."const"; + $sql.= " WHERE name = ".$db->encrypt($name,1); + if ($entity > 0) $sql.= " AND entity = ".$entity; - dol_syslog("admin.lib::dolibarr_set_const sql=".$sql, LOG_DEBUG); - $resql=$db->query($sql); + dol_syslog("admin.lib::dolibarr_set_const sql=".$sql, LOG_DEBUG); + $resql=$db->query($sql); - if (strcmp($value,'')) // true if different. Must work for $value='0' or $value=0 - { - $sql = "INSERT INTO llx_const(name,value,type,visible,note,entity)"; - $sql.= " VALUES ("; - $sql.= $db->encrypt($name,1); - $sql.= ", ".$db->encrypt($value,1); - $sql.= ",'".$type."',".$visible.",'".$db->escape($note)."',".$entity.")"; + if (strcmp($value,'')) // true if different. Must work for $value='0' or $value=0 + { + $sql = "INSERT INTO llx_const(name,value,type,visible,note,entity)"; + $sql.= " VALUES ("; + $sql.= $db->encrypt($name,1); + $sql.= ", ".$db->encrypt($value,1); + $sql.= ",'".$type."',".$visible.",'".$db->escape($note)."',".$entity.")"; - //print "sql".$value."-".pg_escape_string($value)."-".$sql;exit; + //print "sql".$value."-".pg_escape_string($value)."-".$sql;exit; //print "xx".$db->escape($value); //print $sql;exit; - dol_syslog("admin.lib::dolibarr_set_const sql=".$sql, LOG_DEBUG); - $resql=$db->query($sql); - } + dol_syslog("admin.lib::dolibarr_set_const sql=".$sql, LOG_DEBUG); + $resql=$db->query($sql); + } - if ($resql) - { - $db->commit(); - $conf->global->$name=$value; - return 1; - } - else - { - $error=$db->lasterror(); - dol_syslog("admin.lib::dolibarr_set_const ".$error, LOG_ERR); - $db->rollback(); - return -1; - } + if ($resql) + { + $db->commit(); + $conf->global->$name=$value; + return 1; + } + else + { + $error=$db->lasterror(); + dol_syslog("admin.lib::dolibarr_set_const ".$error, LOG_ERR); + $db->rollback(); + return -1; + } } @@ -484,31 +484,31 @@ function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $not */ function security_prepare_head() { - global $langs, $conf, $user; - $h = 0; - $head = array(); + global $langs, $conf, $user; + $h = 0; + $head = array(); $head[$h][0] = DOL_URL_ROOT."/admin/proxy.php"; $head[$h][1] = $langs->trans("ExternalAccess"); $head[$h][2] = 'proxy'; $h++; - $head[$h][0] = DOL_URL_ROOT."/admin/security_other.php"; - $head[$h][1] = $langs->trans("Miscellanous"); - $head[$h][2] = 'misc'; - $h++; + $head[$h][0] = DOL_URL_ROOT."/admin/security_other.php"; + $head[$h][1] = $langs->trans("Miscellanous"); + $head[$h][2] = 'misc'; + $h++; $head[$h][0] = DOL_URL_ROOT."/admin/security.php"; $head[$h][1] = $langs->trans("Passwords"); $head[$h][2] = 'passwords'; $h++; - $head[$h][0] = DOL_URL_ROOT."/admin/events.php"; - $head[$h][1] = $langs->trans("Audit"); - $head[$h][2] = 'audit'; - $h++; + $head[$h][0] = DOL_URL_ROOT."/admin/events.php"; + $head[$h][1] = $langs->trans("Audit"); + $head[$h][2] = 'audit'; + $h++; - $head[$h][0] = DOL_URL_ROOT."/admin/perms.php"; + $head[$h][0] = DOL_URL_ROOT."/admin/perms.php"; $head[$h][1] = $langs->trans("DefaultRights"); $head[$h][2] = 'default'; $h++; @@ -524,44 +524,44 @@ function security_prepare_head() */ function listOfSessions() { - global $conf; + global $conf; - $arrayofSessions = array(); - $sessPath = ini_get("session.save_path").'/'; - dol_syslog('admin.lib:listOfSessions sessPath='.$sessPath); + $arrayofSessions = array(); + $sessPath = ini_get("session.save_path").'/'; + dol_syslog('admin.lib:listOfSessions sessPath='.$sessPath); - $dh = @opendir($sessPath); - if ($dh) - { - while(($file = @readdir($dh)) !== false) - { - if (preg_match('/^sess_/i',$file) && $file != "." && $file != "..") - { - $fullpath = $sessPath.$file; - if(! @is_dir($fullpath) && is_readable($fullpath)) - { - $sessValues = file_get_contents($fullpath); // get raw session data + $dh = @opendir(dol_osencode($sessPath)); + if ($dh) + { + while(($file = @readdir($dh)) !== false) + { + if (preg_match('/^sess_/i',$file) && $file != "." && $file != "..") + { + $fullpath = $sessPath.$file; + if(! @is_dir($fullpath) && is_readable($fullpath)) + { + $sessValues = file_get_contents($fullpath); // get raw session data - if (preg_match('/dol_login/i',$sessValues) && // limit to dolibarr session - preg_match('/dol_entity\|s:([0-9]+):"('.$conf->entity.')"/i',$sessValues) && // limit to current entity - preg_match('/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"/i',$sessValues)) // limit to company name - { - $tmp=explode('_', $file); - $idsess=$tmp[1]; - $login = preg_match('/dol_login\|s:[0-9]+:"([A-Za-z0-9]+)"/i',$sessValues,$regs); - $arrayofSessions[$idsess]["login"] = $regs[1]; - $arrayofSessions[$idsess]["age"] = time()-filectime($fullpath); - $arrayofSessions[$idsess]["creation"] = filectime($fullpath); - $arrayofSessions[$idsess]["modification"] = filemtime($fullpath); - $arrayofSessions[$idsess]["raw"] = $sessValues; - } - } - } - } - @closedir($dh); - } + if (preg_match('/dol_login/i',$sessValues) && // limit to dolibarr session + preg_match('/dol_entity\|s:([0-9]+):"('.$conf->entity.')"/i',$sessValues) && // limit to current entity + preg_match('/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"/i',$sessValues)) // limit to company name + { + $tmp=explode('_', $file); + $idsess=$tmp[1]; + $login = preg_match('/dol_login\|s:[0-9]+:"([A-Za-z0-9]+)"/i',$sessValues,$regs); + $arrayofSessions[$idsess]["login"] = $regs[1]; + $arrayofSessions[$idsess]["age"] = time()-filectime($fullpath); + $arrayofSessions[$idsess]["creation"] = filectime($fullpath); + $arrayofSessions[$idsess]["modification"] = filemtime($fullpath); + $arrayofSessions[$idsess]["raw"] = $sessValues; + } + } + } + } + @closedir($dh); + } - return $arrayofSessions; + return $arrayofSessions; } /** @@ -572,43 +572,43 @@ function listOfSessions() */ function purgeSessions($mysessionid) { - global $conf; + global $conf; - $arrayofSessions = array(); - $sessPath = ini_get("session.save_path")."/"; - dol_syslog('admin.lib:purgeSessions mysessionid='.$mysessionid.' sessPath='.$sessPath); + $arrayofSessions = array(); + $sessPath = ini_get("session.save_path")."/"; + dol_syslog('admin.lib:purgeSessions mysessionid='.$mysessionid.' sessPath='.$sessPath); - $error=0; - $dh = @opendir($sessPath); - while(($file = @readdir($dh)) !== false) - { - if ($file != "." && $file != "..") - { - $fullpath = $sessPath.$file; - if(! @is_dir($fullpath)) - { - $sessValues = file_get_contents($fullpath); // get raw session data + $error=0; + $dh = @opendir(dol_osencode($sessPath)); + while(($file = @readdir($dh)) !== false) + { + if ($file != "." && $file != "..") + { + $fullpath = $sessPath.$file; + if(! @is_dir($fullpath)) + { + $sessValues = file_get_contents($fullpath); // get raw session data - if (preg_match('/dol_login/i',$sessValues) && // limit to dolibarr session - preg_match('/dol_entity\|s:([0-9]+):"('.$conf->entity.')"/i',$sessValues) && // limit to current entity - preg_match('/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"/i',$sessValues)) // limit to company name - { - $tmp=explode('_', $file); - $idsess=$tmp[1]; - // We remove session if it's not ourself - if ($idsess != $mysessionid) - { - $res=@unlink($fullpath); - if (! $res) $error++; - } - } - } - } - } - @closedir($dh); + if (preg_match('/dol_login/i',$sessValues) && // limit to dolibarr session + preg_match('/dol_entity\|s:([0-9]+):"('.$conf->entity.')"/i',$sessValues) && // limit to current entity + preg_match('/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"/i',$sessValues)) // limit to company name + { + $tmp=explode('_', $file); + $idsess=$tmp[1]; + // We remove session if it's not ourself + if ($idsess != $mysessionid) + { + $res=@unlink($fullpath); + if (! $res) $error++; + } + } + } + } + } + @closedir($dh); - if (! $error) return 1; - else return -$error; + if (! $error) return 1; + else return -$error; } @@ -634,37 +634,37 @@ function Activate($value,$withdeps=1) // Loop on each directory $found=false; - foreach ($conf->file->dol_document_root as $type => $dirroot) + foreach ($conf->file->dol_document_root as $type => $dirroot) { $modulesdir[] = $dirroot."/includes/modules/"; if ($type == 'alt') - { - $handle=@opendir($dirroot); - if (is_resource($handle)) - { - while (($file = readdir($handle))!==false) - { - if (is_dir($dirroot.'/'.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS' && $file != 'includes') - { - if (is_dir($dirroot . '/' . $file . '/includes/modules/')) - { - $modulesdir[] = $dirroot . '/' . $file . '/includes/modules/'; - } - } - } - closedir($handle); - } - } + { + $handle=@opendir(dol_osencode($dirroot)); + if (is_resource($handle)) + { + while (($file = readdir($handle))!==false) + { + if (is_dir($dirroot.'/'.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS' && $file != 'includes') + { + if (is_dir($dirroot . '/' . $file . '/includes/modules/')) + { + $modulesdir[] = $dirroot . '/' . $file . '/includes/modules/'; + } + } + } + closedir($handle); + } + } } foreach ($modulesdir as $dir) { - if (file_exists($dir.$modFile)) - { - $found=@include_once($dir.$modFile); - if ($found) break; - } + if (file_exists($dir.$modFile)) + { + $found=@include_once($dir.$modFile); + if ($found) break; + } } $objMod = new $modName($db); @@ -748,38 +748,38 @@ function UnActivate($value, $requiredby=1) $modulesdir=array(); // Loop on each directory - $found=false; + $found=false; foreach ($conf->file->dol_document_root as $type => $dirroot) { $modulesdir[] = $dirroot."/includes/modules/"; if ($type == 'alt') - { - $handle=@opendir($dirroot); - if (is_resource($handle)) - { - while (($file = readdir($handle))!==false) - { - if (is_dir($dirroot.'/'.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS' && $file != 'includes') - { - if (is_dir($dirroot . '/' . $file . '/includes/modules/')) - { - $modulesdir[] = $dirroot . '/' . $file . '/includes/modules/'; - } - } - } - closedir($handle); - } - } + { + $handle=@opendir(dol_osencode($dirroot)); + if (is_resource($handle)) + { + while (($file = readdir($handle))!==false) + { + if (is_dir($dirroot.'/'.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS' && $file != 'includes') + { + if (is_dir($dirroot . '/' . $file . '/includes/modules/')) + { + $modulesdir[] = $dirroot . '/' . $file . '/includes/modules/'; + } + } + } + closedir($handle); + } + } } foreach ($modulesdir as $dir) { - if (file_exists($dir.$modFile)) - { - $found=@include_once($dir.$modFile); - if ($found) break; - } + if (file_exists($dir.$modFile)) + { + $found=@include_once($dir.$modFile); + if ($found) break; + } } if ($found) @@ -846,7 +846,7 @@ function complete_dictionnary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsq // Load modules attributes in arrays (name, numero, orders) from dir directory //print $dir."\n
"; dol_syslog("Scan directory ".$dir." for modules"); - $handle=@opendir($dir); + $handle=@opendir(dol_osencode($dir)); if (is_resource($handle)) { while (($file = readdir($handle))!==false) From 42373e1ac811dd5c62f99b5742a0da26b23cc7ce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 16:40:52 +0000 Subject: [PATCH 2/8] Fix: Removed warnings --- htdocs/admin/dict.php | 11 +++++------ htdocs/includes/modules/modDocument.class.php | 2 +- htdocs/includes/modules/modExpedition.class.php | 2 +- htdocs/includes/modules/modFicheinter.class.php | 2 +- htdocs/includes/modules/modLabel.class.php | 2 +- htdocs/includes/modules/modMailing.class.php | 2 +- htdocs/lib/admin.lib.php | 1 + 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index f3ab92d170c..276f2a6326c 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -35,8 +35,7 @@ $langs->load("other"); $langs->load("admin"); $langs->load("companies"); -if (!$user->admin) -accessforbidden(); +if (!$user->admin) accessforbidden(); $acts[0] = "activate"; $acts[1] = "disable"; @@ -123,7 +122,7 @@ $tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.d $tabsql[8] = "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_typent"; //$tabsql[9] = "SELECT code, code_iso, label as libelle, symbole, active FROM ".MAIN_DB_PREFIX."c_currencies"; $tabsql[9] = "SELECT code, code_iso, label as libelle, active FROM ".MAIN_DB_PREFIX."c_currencies"; -$tabsql[10]= "SELECT t.rowid, t.taux, t.localtax1, t.localtax2, p.libelle as pays, p.code as pays_code, t.fk_pays as pays_id, t.recuperableonly, t.note, t.active,t.accountancy_code FROM ".MAIN_DB_PREFIX."c_tva as t, llx_c_pays as p WHERE t.fk_pays=p.rowid"; +$tabsql[10]= "SELECT t.rowid, t.taux, t.localtax1, t.localtax2, p.libelle as pays, p.code as pays_code, t.fk_pays as pays_id, t.recuperableonly, t.note, t.active, t.accountancy_code FROM ".MAIN_DB_PREFIX."c_tva as t, llx_c_pays as p WHERE t.fk_pays=p.rowid"; $tabsql[11]= "SELECT t.rowid as rowid, element, source, code, libelle, active FROM ".MAIN_DB_PREFIX."c_type_contact AS t"; $tabsql[12]= "SELECT c.rowid as rowid, code, sortorder, c.libelle, c.libelle_facture, nbjour, fdm, decalage, active FROM ".MAIN_DB_PREFIX.'c_payment_term AS c'; $tabsql[13]= "SELECT id as rowid, code, c.libelle, type, active FROM ".MAIN_DB_PREFIX."c_paiement AS c"; @@ -639,7 +638,7 @@ if ($_GET["id"]) if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); } if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); } if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='pays_id') { $valuetoshow=''; } - if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } + if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } if ($valuetoshow != '') { print ''; @@ -725,7 +724,7 @@ if ($_GET["id"]) if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); } if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); } if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='pays_id') { $showfield=0; } - if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } + if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } // Affiche nom du champ if ($showfield) { @@ -904,7 +903,7 @@ llxFooter(); * * @param array $fieldlist Array of fields * @param Object $obj If we show a particular record, obj is filled with record fields - * @return void + * @return void */ function fieldList($fieldlist,$obj='') { diff --git a/htdocs/includes/modules/modDocument.class.php b/htdocs/includes/modules/modDocument.class.php index 86167b35cfd..1c45bfe4dda 100644 --- a/htdocs/includes/modules/modDocument.class.php +++ b/htdocs/includes/modules/modDocument.class.php @@ -1,4 +1,4 @@ - * Copyright (C) 2005-2009 Regis Houssin * diff --git a/htdocs/includes/modules/modExpedition.class.php b/htdocs/includes/modules/modExpedition.class.php index a312d24e2b8..b9750cdc7e5 100644 --- a/htdocs/includes/modules/modExpedition.class.php +++ b/htdocs/includes/modules/modExpedition.class.php @@ -1,4 +1,4 @@ - * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin diff --git a/htdocs/includes/modules/modFicheinter.class.php b/htdocs/includes/modules/modFicheinter.class.php index 87652809052..0534ef0d359 100644 --- a/htdocs/includes/modules/modFicheinter.class.php +++ b/htdocs/includes/modules/modFicheinter.class.php @@ -1,4 +1,4 @@ - * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio diff --git a/htdocs/includes/modules/modLabel.class.php b/htdocs/includes/modules/modLabel.class.php index b00b88ae3b2..f610d20c60e 100644 --- a/htdocs/includes/modules/modLabel.class.php +++ b/htdocs/includes/modules/modLabel.class.php @@ -1,4 +1,4 @@ - * Copyright (C) 2008 Laurent Destailleur * diff --git a/htdocs/includes/modules/modMailing.class.php b/htdocs/includes/modules/modMailing.class.php index 5f21e1354e0..750f6e1b530 100644 --- a/htdocs/includes/modules/modMailing.class.php +++ b/htdocs/includes/modules/modMailing.class.php @@ -1,4 +1,4 @@ - * Copyright (C) 2005-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin diff --git a/htdocs/lib/admin.lib.php b/htdocs/lib/admin.lib.php index 6bcab638b91..d94fac368e7 100644 --- a/htdocs/lib/admin.lib.php +++ b/htdocs/lib/admin.lib.php @@ -849,6 +849,7 @@ function complete_dictionnary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsq $handle=@opendir(dol_osencode($dir)); if (is_resource($handle)) { + while (($file = readdir($handle))!==false) { //print "$i ".$file."\n
"; From f229e254992168323df739204a90207b45143cca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 16:56:23 +0000 Subject: [PATCH 3/8] Fix: Removed warnings --- htdocs/compta/ajaxpayment.php | 2 +- htdocs/theme/phones/smartphone/theme/default/default.css.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/ajaxpayment.php b/htdocs/compta/ajaxpayment.php index c4fb53b1b00..d1dce30d069 100644 --- a/htdocs/compta/ajaxpayment.php +++ b/htdocs/compta/ajaxpayment.php @@ -1,4 +1,4 @@ - * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/theme/phones/smartphone/theme/default/default.css.php b/htdocs/theme/phones/smartphone/theme/default/default.css.php index 0eb93af0b86..c31b3f61a68 100644 --- a/htdocs/theme/phones/smartphone/theme/default/default.css.php +++ b/htdocs/theme/phones/smartphone/theme/default/default.css.php @@ -1,4 +1,4 @@ - * * This program is free software; you can redistribute it and/or modify From 0a68db4da25786e35fabcecbd566edffea0b0eb3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 17:11:14 +0000 Subject: [PATCH 4/8] Qual: Convert non UTF8 into UTF8 without BOM Qual: Removed useless files --- htdocs/theme/auguria/ckeditor/config.js | 164 +++++++++--------- .../theme/auguria/fckeditor/fck_dialog_ie6.js | 110 ------------ htdocs/theme/bureau2crea/ckeditor/config.js | 164 +++++++++--------- .../bureau2crea/fckeditor/fck_dialog_ie6.js | 110 ------------ htdocs/theme/cameleo/ckeditor/config.js | 164 +++++++++--------- .../theme/cameleo/fckeditor/fck_dialog_ie6.js | 110 ------------ htdocs/theme/eldy/ckeditor/config.js | 164 +++++++++--------- htdocs/theme/eldy/fckeditor/fck_dialog_ie6.js | 110 ------------ 8 files changed, 328 insertions(+), 768 deletions(-) delete mode 100644 htdocs/theme/auguria/fckeditor/fck_dialog_ie6.js delete mode 100644 htdocs/theme/bureau2crea/fckeditor/fck_dialog_ie6.js delete mode 100644 htdocs/theme/cameleo/fckeditor/fck_dialog_ie6.js delete mode 100644 htdocs/theme/eldy/fckeditor/fck_dialog_ie6.js diff --git a/htdocs/theme/auguria/ckeditor/config.js b/htdocs/theme/auguria/ckeditor/config.js index ad6868029ee..699f7d61ec7 100644 --- a/htdocs/theme/auguria/ckeditor/config.js +++ b/htdocs/theme/auguria/ckeditor/config.js @@ -1,82 +1,82 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -CKEDITOR.editorConfig = function( config ) -{ - // Define changes to default configuration here. - // http://docs.cksource.com/CKEditor_3.x/Developers_Guide - // http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html - config.enterMode = CKEDITOR.ENTER_BR; - config.resize_enabled = false; - //config.resize_maxHeight = 3000; - //config.resize_maxWidth = 3000; - //config.height = '300px'; - //config.resize_dir = 'vertical'; // horizontal, vertical, both - config.removePlugins = 'elementspath,save'; // config.removePlugins = 'elementspath,save,font'; - config.removeDialogTabs = 'flash:advanced'; // config.removeDialogTabs = 'flash:advanced;image:Link'; - config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // Prevent PHP Code to be formatted - //config.menu_groups = 'clipboard,table,anchor,link,image'; // for context menu 'clipboard,form,tablecell,tablecellproperties,tablerow,tablecolumn,table,anchor,link,image,flash,checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea' - //config.language = 'de'; - //config.defaultLanguage = 'en'; - //config.contentsLanguage = 'fr'; - config.fullPage = false; // Not a full html page string, just part of it - config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)'; - //config.contentsCss = '/css/mysitestyles.css'; - config.image_previewText=' '; - - config.toolbar_Full = - [ - ['Source','-','Save','NewPage','Preview','-','Templates'], - ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'], - ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], - ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'], - '/', - ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], - ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'], - ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['BidiLtr', 'BidiRtl'], - ['Link','Unlink','Anchor'], - ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'], - '/', - ['Styles','Format','Font','FontSize'], - ['TextColor','BGColor'], - ['Maximize', 'ShowBlocks','-','About'] - ]; - - config.toolbar_dolibarr_mailings = - [ - ['Source','Maximize'], - ['Cut','Copy','Paste','-','SpellChecker'], - ['Undo','Redo','-','Find','Replace'], - ['Font','FontSize'], - ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], - ['NumberedList','BulletedList','Outdent','Indent'], - ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','Anchor','Image','Table','SpecialChar'] - ]; - - config.toolbar_dolibarr_notes = - [ - ['Source'], - ['Cut','Copy','Paste','-','SpellChecker'], - ['Undo','Redo','-','Find','Replace'], - ['Font','FontSize'], - ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], - ['NumberedList','BulletedList','Outdent','Indent'], - ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','Image','Table','SpecialChar'] - ]; - - config.toolbar_dolibarr_details = - [ - ['Source','Maximize'], - ['Cut','Copy','Paste','-','SpellChecker'], - ['Font','FontSize'], - ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], - ['NumberedList','BulletedList','Outdent','Indent'], - ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['SpecialChar'] - ]; -}; +/* +Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ + +CKEDITOR.editorConfig = function( config ) +{ + // Define changes to default configuration here. + // http://docs.cksource.com/CKEditor_3.x/Developers_Guide + // http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html + config.enterMode = CKEDITOR.ENTER_BR; + config.resize_enabled = false; + //config.resize_maxHeight = 3000; + //config.resize_maxWidth = 3000; + //config.height = '300px'; + //config.resize_dir = 'vertical'; // horizontal, vertical, both + config.removePlugins = 'elementspath,save'; // config.removePlugins = 'elementspath,save,font'; + config.removeDialogTabs = 'flash:advanced'; // config.removeDialogTabs = 'flash:advanced;image:Link'; + config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // Prevent PHP Code to be formatted + //config.menu_groups = 'clipboard,table,anchor,link,image'; // for context menu 'clipboard,form,tablecell,tablecellproperties,tablerow,tablecolumn,table,anchor,link,image,flash,checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea' + //config.language = 'de'; + //config.defaultLanguage = 'en'; + //config.contentsLanguage = 'fr'; + config.fullPage = false; // Not a full html page string, just part of it + config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)'; + //config.contentsCss = '/css/mysitestyles.css'; + config.image_previewText=' '; + + config.toolbar_Full = + [ + ['Source','-','Save','NewPage','Preview','-','Templates'], + ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'], + ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], + ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'], + '/', + ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], + ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], + ['BidiLtr', 'BidiRtl'], + ['Link','Unlink','Anchor'], + ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'], + '/', + ['Styles','Format','Font','FontSize'], + ['TextColor','BGColor'], + ['Maximize', 'ShowBlocks','-','About'] + ]; + + config.toolbar_dolibarr_mailings = + [ + ['Source','Maximize'], + ['Cut','Copy','Paste','-','SpellChecker'], + ['Undo','Redo','-','Find','Replace'], + ['Font','FontSize'], + ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], + ['NumberedList','BulletedList','Outdent','Indent'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], + ['Link','Unlink','Anchor','Image','Table','SpecialChar'] + ]; + + config.toolbar_dolibarr_notes = + [ + ['Source'], + ['Cut','Copy','Paste','-','SpellChecker'], + ['Undo','Redo','-','Find','Replace'], + ['Font','FontSize'], + ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], + ['NumberedList','BulletedList','Outdent','Indent'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], + ['Link','Unlink','Image','Table','SpecialChar'] + ]; + + config.toolbar_dolibarr_details = + [ + ['Source','Maximize'], + ['Cut','Copy','Paste','-','SpellChecker'], + ['Font','FontSize'], + ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], + ['NumberedList','BulletedList','Outdent','Indent'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], + ['SpecialChar'] + ]; +}; diff --git a/htdocs/theme/auguria/fckeditor/fck_dialog_ie6.js b/htdocs/theme/auguria/fckeditor/fck_dialog_ie6.js deleted file mode 100644 index 804cc8d24de..00000000000 --- a/htdocs/theme/auguria/fckeditor/fck_dialog_ie6.js +++ /dev/null @@ -1,110 +0,0 @@ -/* - * FCKeditor - The text editor for Internet - http://www.fckeditor.net - * Copyright (C) 2003-2008 Frederico Caldeira Knabben - * - * == BEGIN LICENSE == - * - * 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 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 - * - * == END LICENSE == - */ - -(function() -{ - // IE6 doens't handle absolute positioning properly (it is always in quirks - // mode). This function fixes the sizes and positions of many elements that - // compose the skin (this is skin specific). - var fixSizes = window.DoResizeFixes = function() - { - var fckDlg = window.document.body ; - - for ( var i = 0 ; i < fckDlg.childNodes.length ; i++ ) - { - var child = fckDlg.childNodes[i] ; - switch ( child.className ) - { - case 'contents' : - child.style.width = Math.max(0, fckDlg.offsetWidth - 16 - 16); // -left -right - child.style.height = Math.max(0, fckDlg.clientHeight - 20 - 2); // -bottom -top - break ; - - case 'blocker' : - case 'cover' : - child.style.width = Math.max(0, fckDlg.offsetWidth - 16 - 16 + 4); // -left -right + 4 - child.style.height = Math.max(0, fckDlg.clientHeight - 20 - 2 + 4); // -bottom -top + 4 - break ; - - case 'tr' : - child.style.left = Math.max(0, fckDlg.clientWidth - 16); - break ; - - case 'tc' : - child.style.width = Math.max(0, fckDlg.clientWidth - 16 - 16); - break ; - - case 'ml' : - child.style.height = Math.max(0, fckDlg.clientHeight - 16 - 51); - break ; - - case 'mr' : - child.style.left = Math.max(0, fckDlg.clientWidth - 16); - child.style.height = Math.max(0, fckDlg.clientHeight - 16 - 51); - break ; - - case 'bl' : - child.style.top = Math.max(0, fckDlg.clientHeight - 51); - break ; - - case 'br' : - child.style.left = Math.max(0, fckDlg.clientWidth - 30); - child.style.top = Math.max(0, fckDlg.clientHeight - 51); - break ; - - case 'bc' : - child.style.width = Math.max(0, fckDlg.clientWidth - 30 - 30); - child.style.top = Math.max(0, fckDlg.clientHeight - 51); - break ; - } - } - } - - var closeButtonOver = function() - { - this.style.backgroundPosition = '-16px -687px' ; - } ; - - var closeButtonOut = function() - { - this.style.backgroundPosition = '-16px -651px' ; - } ; - - var fixCloseButton = function() - { - var closeButton = document.getElementById ('closeButton'); - - closeButton.onmouseover = closeButtonOver ; - closeButton.onmouseout = closeButtonOut ; - } - - var onLoad = function() - { - fixSizes() ; - fixCloseButton() ; - - window.attachEvent('onresize', fixSizes); - window.detachEvent('onload', onLoad); - } - - window.attachEvent('onload', onLoad); - -})() ; diff --git a/htdocs/theme/bureau2crea/ckeditor/config.js b/htdocs/theme/bureau2crea/ckeditor/config.js index ad6868029ee..699f7d61ec7 100644 --- a/htdocs/theme/bureau2crea/ckeditor/config.js +++ b/htdocs/theme/bureau2crea/ckeditor/config.js @@ -1,82 +1,82 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -CKEDITOR.editorConfig = function( config ) -{ - // Define changes to default configuration here. - // http://docs.cksource.com/CKEditor_3.x/Developers_Guide - // http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html - config.enterMode = CKEDITOR.ENTER_BR; - config.resize_enabled = false; - //config.resize_maxHeight = 3000; - //config.resize_maxWidth = 3000; - //config.height = '300px'; - //config.resize_dir = 'vertical'; // horizontal, vertical, both - config.removePlugins = 'elementspath,save'; // config.removePlugins = 'elementspath,save,font'; - config.removeDialogTabs = 'flash:advanced'; // config.removeDialogTabs = 'flash:advanced;image:Link'; - config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // Prevent PHP Code to be formatted - //config.menu_groups = 'clipboard,table,anchor,link,image'; // for context menu 'clipboard,form,tablecell,tablecellproperties,tablerow,tablecolumn,table,anchor,link,image,flash,checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea' - //config.language = 'de'; - //config.defaultLanguage = 'en'; - //config.contentsLanguage = 'fr'; - config.fullPage = false; // Not a full html page string, just part of it - config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)'; - //config.contentsCss = '/css/mysitestyles.css'; - config.image_previewText=' '; - - config.toolbar_Full = - [ - ['Source','-','Save','NewPage','Preview','-','Templates'], - ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'], - ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], - ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'], - '/', - ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], - ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'], - ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['BidiLtr', 'BidiRtl'], - ['Link','Unlink','Anchor'], - ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'], - '/', - ['Styles','Format','Font','FontSize'], - ['TextColor','BGColor'], - ['Maximize', 'ShowBlocks','-','About'] - ]; - - config.toolbar_dolibarr_mailings = - [ - ['Source','Maximize'], - ['Cut','Copy','Paste','-','SpellChecker'], - ['Undo','Redo','-','Find','Replace'], - ['Font','FontSize'], - ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], - ['NumberedList','BulletedList','Outdent','Indent'], - ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','Anchor','Image','Table','SpecialChar'] - ]; - - config.toolbar_dolibarr_notes = - [ - ['Source'], - ['Cut','Copy','Paste','-','SpellChecker'], - ['Undo','Redo','-','Find','Replace'], - ['Font','FontSize'], - ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], - ['NumberedList','BulletedList','Outdent','Indent'], - ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','Image','Table','SpecialChar'] - ]; - - config.toolbar_dolibarr_details = - [ - ['Source','Maximize'], - ['Cut','Copy','Paste','-','SpellChecker'], - ['Font','FontSize'], - ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], - ['NumberedList','BulletedList','Outdent','Indent'], - ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['SpecialChar'] - ]; -}; +/* +Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ + +CKEDITOR.editorConfig = function( config ) +{ + // Define changes to default configuration here. + // http://docs.cksource.com/CKEditor_3.x/Developers_Guide + // http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html + config.enterMode = CKEDITOR.ENTER_BR; + config.resize_enabled = false; + //config.resize_maxHeight = 3000; + //config.resize_maxWidth = 3000; + //config.height = '300px'; + //config.resize_dir = 'vertical'; // horizontal, vertical, both + config.removePlugins = 'elementspath,save'; // config.removePlugins = 'elementspath,save,font'; + config.removeDialogTabs = 'flash:advanced'; // config.removeDialogTabs = 'flash:advanced;image:Link'; + config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // Prevent PHP Code to be formatted + //config.menu_groups = 'clipboard,table,anchor,link,image'; // for context menu 'clipboard,form,tablecell,tablecellproperties,tablerow,tablecolumn,table,anchor,link,image,flash,checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea' + //config.language = 'de'; + //config.defaultLanguage = 'en'; + //config.contentsLanguage = 'fr'; + config.fullPage = false; // Not a full html page string, just part of it + config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)'; + //config.contentsCss = '/css/mysitestyles.css'; + config.image_previewText=' '; + + config.toolbar_Full = + [ + ['Source','-','Save','NewPage','Preview','-','Templates'], + ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'], + ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], + ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'], + '/', + ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], + ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], + ['BidiLtr', 'BidiRtl'], + ['Link','Unlink','Anchor'], + ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'], + '/', + ['Styles','Format','Font','FontSize'], + ['TextColor','BGColor'], + ['Maximize', 'ShowBlocks','-','About'] + ]; + + config.toolbar_dolibarr_mailings = + [ + ['Source','Maximize'], + ['Cut','Copy','Paste','-','SpellChecker'], + ['Undo','Redo','-','Find','Replace'], + ['Font','FontSize'], + ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], + ['NumberedList','BulletedList','Outdent','Indent'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], + ['Link','Unlink','Anchor','Image','Table','SpecialChar'] + ]; + + config.toolbar_dolibarr_notes = + [ + ['Source'], + ['Cut','Copy','Paste','-','SpellChecker'], + ['Undo','Redo','-','Find','Replace'], + ['Font','FontSize'], + ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], + ['NumberedList','BulletedList','Outdent','Indent'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], + ['Link','Unlink','Image','Table','SpecialChar'] + ]; + + config.toolbar_dolibarr_details = + [ + ['Source','Maximize'], + ['Cut','Copy','Paste','-','SpellChecker'], + ['Font','FontSize'], + ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], + ['NumberedList','BulletedList','Outdent','Indent'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], + ['SpecialChar'] + ]; +}; diff --git a/htdocs/theme/bureau2crea/fckeditor/fck_dialog_ie6.js b/htdocs/theme/bureau2crea/fckeditor/fck_dialog_ie6.js deleted file mode 100644 index 804cc8d24de..00000000000 --- a/htdocs/theme/bureau2crea/fckeditor/fck_dialog_ie6.js +++ /dev/null @@ -1,110 +0,0 @@ -/* - * FCKeditor - The text editor for Internet - http://www.fckeditor.net - * Copyright (C) 2003-2008 Frederico Caldeira Knabben - * - * == BEGIN LICENSE == - * - * 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 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 - * - * == END LICENSE == - */ - -(function() -{ - // IE6 doens't handle absolute positioning properly (it is always in quirks - // mode). This function fixes the sizes and positions of many elements that - // compose the skin (this is skin specific). - var fixSizes = window.DoResizeFixes = function() - { - var fckDlg = window.document.body ; - - for ( var i = 0 ; i < fckDlg.childNodes.length ; i++ ) - { - var child = fckDlg.childNodes[i] ; - switch ( child.className ) - { - case 'contents' : - child.style.width = Math.max(0, fckDlg.offsetWidth - 16 - 16); // -left -right - child.style.height = Math.max(0, fckDlg.clientHeight - 20 - 2); // -bottom -top - break ; - - case 'blocker' : - case 'cover' : - child.style.width = Math.max(0, fckDlg.offsetWidth - 16 - 16 + 4); // -left -right + 4 - child.style.height = Math.max(0, fckDlg.clientHeight - 20 - 2 + 4); // -bottom -top + 4 - break ; - - case 'tr' : - child.style.left = Math.max(0, fckDlg.clientWidth - 16); - break ; - - case 'tc' : - child.style.width = Math.max(0, fckDlg.clientWidth - 16 - 16); - break ; - - case 'ml' : - child.style.height = Math.max(0, fckDlg.clientHeight - 16 - 51); - break ; - - case 'mr' : - child.style.left = Math.max(0, fckDlg.clientWidth - 16); - child.style.height = Math.max(0, fckDlg.clientHeight - 16 - 51); - break ; - - case 'bl' : - child.style.top = Math.max(0, fckDlg.clientHeight - 51); - break ; - - case 'br' : - child.style.left = Math.max(0, fckDlg.clientWidth - 30); - child.style.top = Math.max(0, fckDlg.clientHeight - 51); - break ; - - case 'bc' : - child.style.width = Math.max(0, fckDlg.clientWidth - 30 - 30); - child.style.top = Math.max(0, fckDlg.clientHeight - 51); - break ; - } - } - } - - var closeButtonOver = function() - { - this.style.backgroundPosition = '-16px -687px' ; - } ; - - var closeButtonOut = function() - { - this.style.backgroundPosition = '-16px -651px' ; - } ; - - var fixCloseButton = function() - { - var closeButton = document.getElementById ('closeButton'); - - closeButton.onmouseover = closeButtonOver ; - closeButton.onmouseout = closeButtonOut ; - } - - var onLoad = function() - { - fixSizes() ; - fixCloseButton() ; - - window.attachEvent('onresize', fixSizes); - window.detachEvent('onload', onLoad); - } - - window.attachEvent('onload', onLoad); - -})() ; diff --git a/htdocs/theme/cameleo/ckeditor/config.js b/htdocs/theme/cameleo/ckeditor/config.js index 2d41b7a7d06..d7bf8a6fd19 100644 --- a/htdocs/theme/cameleo/ckeditor/config.js +++ b/htdocs/theme/cameleo/ckeditor/config.js @@ -1,82 +1,82 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -CKEDITOR.editorConfig = function( config ) -{ - // Define changes to default configuration here. - // http://docs.cksource.com/CKEditor_3.x/Developers_Guide - // http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html - config.enterMode = CKEDITOR.ENTER_BR; - config.resize_enabled = false; - //config.resize_maxHeight = 3000; - //config.resize_maxWidth = 3000; - //config.height = '300px'; - //config.resize_dir = 'vertical'; // horizontal, vertical, both - config.removePlugins = 'elementspath,save'; // config.removePlugins = 'elementspath,save,font'; - config.removeDialogTabs = 'flash:advanced'; // config.removeDialogTabs = 'flash:advanced;image:Link'; - config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // Prevent PHP Code to be formatted - //config.menu_groups = 'clipboard,table,anchor,link,image'; // for context menu 'clipboard,form,tablecell,tablecellproperties,tablerow,tablecolumn,table,anchor,link,image,flash,checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea' - //config.language = 'de'; - //config.defaultLanguage = 'en'; - //config.contentsLanguage = 'fr'; - config.fullPage = false; // Not a full html page string, just part of it - config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)'; - //config.contentsCss = '/css/mysitestyles.css'; - config.image_previewText=' '; // Must no be empty - - config.toolbar_Full = - [ - ['Source','-','Save','NewPage','Preview','-','Templates'], - ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'], - ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], - ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'], - '/', - ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], - ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'], - ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['BidiLtr', 'BidiRtl'], - ['Link','Unlink','Anchor'], - ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'], - '/', - ['Styles','Format','Font','FontSize'], - ['TextColor','BGColor'], - ['Maximize', 'ShowBlocks','-','About'] - ]; - - config.toolbar_dolibarr_mailings = - [ - ['Source','Maximize'], - ['Cut','Copy','Paste','-','SpellChecker'], - ['Undo','Redo','-','Find','Replace'], - ['Font','FontSize'], - ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], - ['NumberedList','BulletedList','Outdent','Indent'], - ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','Anchor','Image','Table','SpecialChar'] - ]; - - config.toolbar_dolibarr_notes = - [ - ['Source'], - ['Cut','Copy','Paste','-','SpellChecker'], - ['Undo','Redo','-','Find','Replace'], - ['Font','FontSize'], - ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], - ['NumberedList','BulletedList','Outdent','Indent'], - ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','Image','Table','SpecialChar'] - ]; - - config.toolbar_dolibarr_details = - [ - ['Source','Maximize'], - ['Cut','Copy','Paste','-','SpellChecker'], - ['Font','FontSize'], - ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], - ['NumberedList','BulletedList','Outdent','Indent'], - ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['SpecialChar'] - ]; -}; +/* +Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ + +CKEDITOR.editorConfig = function( config ) +{ + // Define changes to default configuration here. + // http://docs.cksource.com/CKEditor_3.x/Developers_Guide + // http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html + config.enterMode = CKEDITOR.ENTER_BR; + config.resize_enabled = false; + //config.resize_maxHeight = 3000; + //config.resize_maxWidth = 3000; + //config.height = '300px'; + //config.resize_dir = 'vertical'; // horizontal, vertical, both + config.removePlugins = 'elementspath,save'; // config.removePlugins = 'elementspath,save,font'; + config.removeDialogTabs = 'flash:advanced'; // config.removeDialogTabs = 'flash:advanced;image:Link'; + config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // Prevent PHP Code to be formatted + //config.menu_groups = 'clipboard,table,anchor,link,image'; // for context menu 'clipboard,form,tablecell,tablecellproperties,tablerow,tablecolumn,table,anchor,link,image,flash,checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea' + //config.language = 'de'; + //config.defaultLanguage = 'en'; + //config.contentsLanguage = 'fr'; + config.fullPage = false; // Not a full html page string, just part of it + config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)'; + //config.contentsCss = '/css/mysitestyles.css'; + config.image_previewText=' '; // Must no be empty + + config.toolbar_Full = + [ + ['Source','-','Save','NewPage','Preview','-','Templates'], + ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'], + ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], + ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'], + '/', + ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], + ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], + ['BidiLtr', 'BidiRtl'], + ['Link','Unlink','Anchor'], + ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'], + '/', + ['Styles','Format','Font','FontSize'], + ['TextColor','BGColor'], + ['Maximize', 'ShowBlocks','-','About'] + ]; + + config.toolbar_dolibarr_mailings = + [ + ['Source','Maximize'], + ['Cut','Copy','Paste','-','SpellChecker'], + ['Undo','Redo','-','Find','Replace'], + ['Font','FontSize'], + ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], + ['NumberedList','BulletedList','Outdent','Indent'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], + ['Link','Unlink','Anchor','Image','Table','SpecialChar'] + ]; + + config.toolbar_dolibarr_notes = + [ + ['Source'], + ['Cut','Copy','Paste','-','SpellChecker'], + ['Undo','Redo','-','Find','Replace'], + ['Font','FontSize'], + ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], + ['NumberedList','BulletedList','Outdent','Indent'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], + ['Link','Unlink','Image','Table','SpecialChar'] + ]; + + config.toolbar_dolibarr_details = + [ + ['Source','Maximize'], + ['Cut','Copy','Paste','-','SpellChecker'], + ['Font','FontSize'], + ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], + ['NumberedList','BulletedList','Outdent','Indent'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], + ['SpecialChar'] + ]; +}; diff --git a/htdocs/theme/cameleo/fckeditor/fck_dialog_ie6.js b/htdocs/theme/cameleo/fckeditor/fck_dialog_ie6.js deleted file mode 100644 index 804cc8d24de..00000000000 --- a/htdocs/theme/cameleo/fckeditor/fck_dialog_ie6.js +++ /dev/null @@ -1,110 +0,0 @@ -/* - * FCKeditor - The text editor for Internet - http://www.fckeditor.net - * Copyright (C) 2003-2008 Frederico Caldeira Knabben - * - * == BEGIN LICENSE == - * - * 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 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 - * - * == END LICENSE == - */ - -(function() -{ - // IE6 doens't handle absolute positioning properly (it is always in quirks - // mode). This function fixes the sizes and positions of many elements that - // compose the skin (this is skin specific). - var fixSizes = window.DoResizeFixes = function() - { - var fckDlg = window.document.body ; - - for ( var i = 0 ; i < fckDlg.childNodes.length ; i++ ) - { - var child = fckDlg.childNodes[i] ; - switch ( child.className ) - { - case 'contents' : - child.style.width = Math.max(0, fckDlg.offsetWidth - 16 - 16); // -left -right - child.style.height = Math.max(0, fckDlg.clientHeight - 20 - 2); // -bottom -top - break ; - - case 'blocker' : - case 'cover' : - child.style.width = Math.max(0, fckDlg.offsetWidth - 16 - 16 + 4); // -left -right + 4 - child.style.height = Math.max(0, fckDlg.clientHeight - 20 - 2 + 4); // -bottom -top + 4 - break ; - - case 'tr' : - child.style.left = Math.max(0, fckDlg.clientWidth - 16); - break ; - - case 'tc' : - child.style.width = Math.max(0, fckDlg.clientWidth - 16 - 16); - break ; - - case 'ml' : - child.style.height = Math.max(0, fckDlg.clientHeight - 16 - 51); - break ; - - case 'mr' : - child.style.left = Math.max(0, fckDlg.clientWidth - 16); - child.style.height = Math.max(0, fckDlg.clientHeight - 16 - 51); - break ; - - case 'bl' : - child.style.top = Math.max(0, fckDlg.clientHeight - 51); - break ; - - case 'br' : - child.style.left = Math.max(0, fckDlg.clientWidth - 30); - child.style.top = Math.max(0, fckDlg.clientHeight - 51); - break ; - - case 'bc' : - child.style.width = Math.max(0, fckDlg.clientWidth - 30 - 30); - child.style.top = Math.max(0, fckDlg.clientHeight - 51); - break ; - } - } - } - - var closeButtonOver = function() - { - this.style.backgroundPosition = '-16px -687px' ; - } ; - - var closeButtonOut = function() - { - this.style.backgroundPosition = '-16px -651px' ; - } ; - - var fixCloseButton = function() - { - var closeButton = document.getElementById ('closeButton'); - - closeButton.onmouseover = closeButtonOver ; - closeButton.onmouseout = closeButtonOut ; - } - - var onLoad = function() - { - fixSizes() ; - fixCloseButton() ; - - window.attachEvent('onresize', fixSizes); - window.detachEvent('onload', onLoad); - } - - window.attachEvent('onload', onLoad); - -})() ; diff --git a/htdocs/theme/eldy/ckeditor/config.js b/htdocs/theme/eldy/ckeditor/config.js index 2d41b7a7d06..0672ec12f27 100644 --- a/htdocs/theme/eldy/ckeditor/config.js +++ b/htdocs/theme/eldy/ckeditor/config.js @@ -1,82 +1,82 @@ -/* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -CKEDITOR.editorConfig = function( config ) -{ - // Define changes to default configuration here. - // http://docs.cksource.com/CKEditor_3.x/Developers_Guide - // http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html - config.enterMode = CKEDITOR.ENTER_BR; - config.resize_enabled = false; - //config.resize_maxHeight = 3000; - //config.resize_maxWidth = 3000; - //config.height = '300px'; - //config.resize_dir = 'vertical'; // horizontal, vertical, both - config.removePlugins = 'elementspath,save'; // config.removePlugins = 'elementspath,save,font'; - config.removeDialogTabs = 'flash:advanced'; // config.removeDialogTabs = 'flash:advanced;image:Link'; - config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // Prevent PHP Code to be formatted - //config.menu_groups = 'clipboard,table,anchor,link,image'; // for context menu 'clipboard,form,tablecell,tablecellproperties,tablerow,tablecolumn,table,anchor,link,image,flash,checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea' - //config.language = 'de'; - //config.defaultLanguage = 'en'; - //config.contentsLanguage = 'fr'; - config.fullPage = false; // Not a full html page string, just part of it - config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)'; - //config.contentsCss = '/css/mysitestyles.css'; - config.image_previewText=' '; // Must no be empty - - config.toolbar_Full = - [ - ['Source','-','Save','NewPage','Preview','-','Templates'], - ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'], - ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], - ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'], - '/', - ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], - ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'], - ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['BidiLtr', 'BidiRtl'], - ['Link','Unlink','Anchor'], - ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'], - '/', - ['Styles','Format','Font','FontSize'], - ['TextColor','BGColor'], - ['Maximize', 'ShowBlocks','-','About'] - ]; - - config.toolbar_dolibarr_mailings = - [ - ['Source','Maximize'], - ['Cut','Copy','Paste','-','SpellChecker'], - ['Undo','Redo','-','Find','Replace'], - ['Font','FontSize'], - ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], - ['NumberedList','BulletedList','Outdent','Indent'], - ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','Anchor','Image','Table','SpecialChar'] - ]; - - config.toolbar_dolibarr_notes = - [ - ['Source'], - ['Cut','Copy','Paste','-','SpellChecker'], - ['Undo','Redo','-','Find','Replace'], - ['Font','FontSize'], - ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], - ['NumberedList','BulletedList','Outdent','Indent'], - ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['Link','Unlink','Image','Table','SpecialChar'] - ]; - - config.toolbar_dolibarr_details = - [ - ['Source','Maximize'], - ['Cut','Copy','Paste','-','SpellChecker'], - ['Font','FontSize'], - ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], - ['NumberedList','BulletedList','Outdent','Indent'], - ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], - ['SpecialChar'] - ]; -}; +/* +Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ + +CKEDITOR.editorConfig = function( config ) +{ + // Define changes to default configuration here. + // http://docs.cksource.com/CKEditor_3.x/Developers_Guide + // http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html + config.enterMode = CKEDITOR.ENTER_BR; + config.resize_enabled = false; + //config.resize_maxHeight = 3000; + //config.resize_maxWidth = 3000; + //config.height = '300px'; + //config.resize_dir = 'vertical'; // horizontal, vertical, both + config.removePlugins = 'elementspath,save'; // config.removePlugins = 'elementspath,save,font'; + config.removeDialogTabs = 'flash:advanced'; // config.removeDialogTabs = 'flash:advanced;image:Link'; + config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // Prevent PHP Code to be formatted + //config.menu_groups = 'clipboard,table,anchor,link,image'; // for context menu 'clipboard,form,tablecell,tablecellproperties,tablerow,tablecolumn,table,anchor,link,image,flash,checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea' + //config.language = 'de'; + //config.defaultLanguage = 'en'; + //config.contentsLanguage = 'fr'; + config.fullPage = false; // Not a full html page string, just part of it + config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)'; + //config.contentsCss = '/css/mysitestyles.css'; + config.image_previewText=' '; // Must no be empty + + config.toolbar_Full = + [ + ['Source','-','Save','NewPage','Preview','-','Templates'], + ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'], + ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], + ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'], + '/', + ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], + ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], + ['BidiLtr', 'BidiRtl'], + ['Link','Unlink','Anchor'], + ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'], + '/', + ['Styles','Format','Font','FontSize'], + ['TextColor','BGColor'], + ['Maximize', 'ShowBlocks','-','About'] + ]; + + config.toolbar_dolibarr_mailings = + [ + ['Source','Maximize'], + ['Cut','Copy','Paste','-','SpellChecker'], + ['Undo','Redo','-','Find','Replace'], + ['Font','FontSize'], + ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], + ['NumberedList','BulletedList','Outdent','Indent'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], + ['Link','Unlink','Anchor','Image','Table','SpecialChar'] + ]; + + config.toolbar_dolibarr_notes = + [ + ['Source'], + ['Cut','Copy','Paste','-','SpellChecker'], + ['Undo','Redo','-','Find','Replace'], + ['Font','FontSize'], + ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], + ['NumberedList','BulletedList','Outdent','Indent'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], + ['Link','Unlink','Image','Table','SpecialChar'] + ]; + + config.toolbar_dolibarr_details = + [ + ['Source','Maximize'], + ['Cut','Copy','Paste','-','SpellChecker'], + ['Font','FontSize'], + ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], + ['NumberedList','BulletedList','Outdent','Indent'], + ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], + ['SpecialChar'] + ]; +}; diff --git a/htdocs/theme/eldy/fckeditor/fck_dialog_ie6.js b/htdocs/theme/eldy/fckeditor/fck_dialog_ie6.js deleted file mode 100644 index 804cc8d24de..00000000000 --- a/htdocs/theme/eldy/fckeditor/fck_dialog_ie6.js +++ /dev/null @@ -1,110 +0,0 @@ -/* - * FCKeditor - The text editor for Internet - http://www.fckeditor.net - * Copyright (C) 2003-2008 Frederico Caldeira Knabben - * - * == BEGIN LICENSE == - * - * 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 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 - * - * == END LICENSE == - */ - -(function() -{ - // IE6 doens't handle absolute positioning properly (it is always in quirks - // mode). This function fixes the sizes and positions of many elements that - // compose the skin (this is skin specific). - var fixSizes = window.DoResizeFixes = function() - { - var fckDlg = window.document.body ; - - for ( var i = 0 ; i < fckDlg.childNodes.length ; i++ ) - { - var child = fckDlg.childNodes[i] ; - switch ( child.className ) - { - case 'contents' : - child.style.width = Math.max(0, fckDlg.offsetWidth - 16 - 16); // -left -right - child.style.height = Math.max(0, fckDlg.clientHeight - 20 - 2); // -bottom -top - break ; - - case 'blocker' : - case 'cover' : - child.style.width = Math.max(0, fckDlg.offsetWidth - 16 - 16 + 4); // -left -right + 4 - child.style.height = Math.max(0, fckDlg.clientHeight - 20 - 2 + 4); // -bottom -top + 4 - break ; - - case 'tr' : - child.style.left = Math.max(0, fckDlg.clientWidth - 16); - break ; - - case 'tc' : - child.style.width = Math.max(0, fckDlg.clientWidth - 16 - 16); - break ; - - case 'ml' : - child.style.height = Math.max(0, fckDlg.clientHeight - 16 - 51); - break ; - - case 'mr' : - child.style.left = Math.max(0, fckDlg.clientWidth - 16); - child.style.height = Math.max(0, fckDlg.clientHeight - 16 - 51); - break ; - - case 'bl' : - child.style.top = Math.max(0, fckDlg.clientHeight - 51); - break ; - - case 'br' : - child.style.left = Math.max(0, fckDlg.clientWidth - 30); - child.style.top = Math.max(0, fckDlg.clientHeight - 51); - break ; - - case 'bc' : - child.style.width = Math.max(0, fckDlg.clientWidth - 30 - 30); - child.style.top = Math.max(0, fckDlg.clientHeight - 51); - break ; - } - } - } - - var closeButtonOver = function() - { - this.style.backgroundPosition = '-16px -687px' ; - } ; - - var closeButtonOut = function() - { - this.style.backgroundPosition = '-16px -651px' ; - } ; - - var fixCloseButton = function() - { - var closeButton = document.getElementById ('closeButton'); - - closeButton.onmouseover = closeButtonOver ; - closeButton.onmouseout = closeButtonOut ; - } - - var onLoad = function() - { - fixSizes() ; - fixCloseButton() ; - - window.attachEvent('onresize', fixSizes); - window.detachEvent('onload', onLoad); - } - - window.attachEvent('onload', onLoad); - -})() ; From db001411c422ea120f20cb5ef27da7f1821ff53c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 22:32:11 +0000 Subject: [PATCH 5/8] Fix: Revert patch: Dolibarr must do what user setup to do. If user asked to not decrease stock or to decrease on order, Dolibarr must not force decrease on other event that the one decided by user. So i added a hidden option for people who want to have dolibarr doing the opposite than setup ask to do (I add this option, but who want that ?). --- htdocs/cashdesk/include/environnement.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/cashdesk/include/environnement.php b/htdocs/cashdesk/include/environnement.php index b4912dc03eb..2e2946e9fca 100644 --- a/htdocs/cashdesk/include/environnement.php +++ b/htdocs/cashdesk/include/environnement.php @@ -1,7 +1,7 @@ - * Copyright (C) 2009-2010 Laurent Destailleur - * Copyright (C) 2011 Juanjo Menent +/* Copyright (C) 2007-2008 Jeremie Ollivier + * Copyright (C) 2009-2011 Laurent Destailleur + * Copyright (C) 2011 Juanjo Menent * * 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 @@ -42,12 +42,11 @@ $conf_fkaccount_cb = (! empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]))?$_SESSIO //var_dump($_SESSION); -// Parametres d'affichage +// View parameters $conf_taille_listes = (empty($conf->global->PRODUIT_LIMIT_SIZE)?500:$conf->global->PRODUIT_LIMIT_SIZE); // Nombre max de lignes a afficher dans les listes $conf_nbr_car_listes = 60; // Nombre max de caracteres par ligne dans les listes -// Aurélien Imhof: Force decremente stock sur validation facture, quelque soit mode configuré -if(!isset($conf->global->STOCK_CALCULATE_ON_BILL)) -$conf->global->STOCK_CALCULATE_ON_BILL = 1 ; +// Add hidden option to force decrease of stock whatever is user setup +if (! empty($conf->global->CASHDESK_FORCE_STOCK_ON_BILL)) $conf->global->STOCK_CALCULATE_ON_BILL=1; ?> From 8a0707f6a4ab30589247dce63f0a2b1678bdffd6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 22:58:17 +0000 Subject: [PATCH 6/8] Add space before end of page --- build/doxygen/doxygen_footer.html | 1 + 1 file changed, 1 insertion(+) diff --git a/build/doxygen/doxygen_footer.html b/build/doxygen/doxygen_footer.html index dbc8fe21b38..38985bb5c27 100755 --- a/build/doxygen/doxygen_footer.html +++ b/build/doxygen/doxygen_footer.html @@ -38,6 +38,7 @@ google_ad_height = 60; +
\ No newline at end of file From 94526bdd0212b782364c58f70a89e55c90c3ef69 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 23:28:01 +0000 Subject: [PATCH 7/8] Fix: Removed warnings --- htdocs/comm/action/class/actioncomm.class.php | 13 +++++++------ htdocs/comm/action/class/cactioncomm.class.php | 18 +++++++++--------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 8b5658fcf93..cfaa14c3aee 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -91,9 +91,10 @@ class ActionComm extends CommonObject /** * Add an action/event into database - * @param user Object user making action - * @param notrigger 1 = disable triggers, 0 = enable triggers - * @return int Id of created event, < 0 if KO + * + * @param User $user Object user making action + * @param int $notrigger 1 = disable triggers, 0 = enable triggers + * @return int Id of created event, < 0 if KO */ function add($user,$notrigger=0) { @@ -144,7 +145,7 @@ class ActionComm extends CommonObject } - $this->db->begin("ActionComm::add"); + $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm"; $sql.= "(datec,"; @@ -204,13 +205,13 @@ class ActionComm extends CommonObject // Fin appel triggers } - $this->db->commit("ActionComm::add"); + $this->db->commit(); return $this->id; } else { $this->error=$this->db->lasterror().' sql='.$sql; - $this->db->rollback("ActionComm::add"); + $this->db->rollback(); return -1; } diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 6c5bac7db5b..786317a30c9 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -53,19 +53,19 @@ class CActionComm } /** - * Charge l'objet type d'action depuis la base + * Load action type from database * - * @param id id ou code du type d'action a recuperer - * @return int 1=ok, 0=aucune action, -1=erreur + * @param int $id id or code of action type to read + * @return int 1=ok, 0=not found, -1=error */ function fetch($id) { - $sql = "SELECT id, code, type, libelle, active"; $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm"; if (is_numeric($id)) $sql.= " WHERE id=".$id; else $sql.= " WHERE code='".$id."'"; + dol_syslog(get_class($this)."::fetch sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -98,7 +98,7 @@ class CActionComm /** * Return list of event types * - * @param int $active 1 or 0 to filter on event state active or not ('' bu default = no filter) + * @param int $active 1 or 0 to filter on event state active or not ('' by default = no filter) * @param string $idorcode 'id' or 'code' * @return array Array of all event types if OK, <0 if KO */ @@ -118,7 +118,7 @@ class CActionComm } $sql.= " ORDER BY module, position"; - dol_syslog("CActionComm::liste_array sql=".$sql); + dol_syslog(get_class($this)."::liste_array sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -160,10 +160,10 @@ class CActionComm /** - * Renvoie le nom sous forme d'un libelle traduit d'un type d'action + * Return name of action type as a label translated * - * @param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul - * @return string Libelle du type d'action + * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Picto only + * @return string Label of action type */ function getNomUrl($withpicto=0) { From f87b2f716ae9ccfc093da4b22f38c62caaa44f01 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Sep 2011 23:41:42 +0000 Subject: [PATCH 8/8] Uniformize code --- htdocs/comm/action/class/actioncomm.class.php | 45 +++++++++++-------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index cfaa14c3aee..73f5325a470 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011 Juanjo Menent * @@ -189,7 +189,7 @@ class ActionComm extends CommonObject $sql.= $conf->entity; $sql.= ")"; - dol_syslog("ActionComm::add sql=".$sql); + dol_syslog(get_class($this)."::add sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -219,7 +219,9 @@ class ActionComm extends CommonObject /** * Charge l'objet action depuis la base - * @param id id de l'action a recuperer + * + * @param int $id id de l'action a recuperer + * @return int <0 if KO, >0 if OK */ function fetch($id) { @@ -247,7 +249,7 @@ class ActionComm extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; $sql.= " WHERE a.id=".$id." AND a.fk_action=c.id"; - dol_syslog("ActionComm::fetch sql=".$sql); + dol_syslog(get_class($this)."::fetch sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -305,14 +307,15 @@ class ActionComm extends CommonObject /** * Supprime l'action de la base - * @return int <0 si ko, >0 si ok + * + * @return int <0 if KO, >0 if OK */ function delete() { $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm"; $sql.= " WHERE id=".$this->id; - dol_syslog("ActionComm::delete sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); if ($this->db->query($sql)) { return 1; @@ -327,7 +330,8 @@ class ActionComm extends CommonObject /** * Met a jour l'action en base. * Si percentage = 100, on met a jour date 100% - * @return int <0 si ko, >0 si ok + * + * @return int <0 if KO, >0 if OK */ function update($user) { @@ -372,7 +376,7 @@ class ActionComm extends CommonObject $sql.= ", fk_user_done=".($this->userdone->id > 0 ? "'".$this->userdone->id."'":"null"); $sql.= " WHERE id=".$this->id; - dol_syslog("ActionComm::update sql=".$sql); + dol_syslog(get_class($this)."::update sql=".$sql); if ($this->db->query($sql)) { return 1; @@ -380,7 +384,7 @@ class ActionComm extends CommonObject else { $this->error=$this->db->error(); - dol_syslog("ActionComm::update ".$this->error,LOG_ERR); + dol_syslog(get_class($this)."::update ".$this->error,LOG_ERR); return -1; } } @@ -407,7 +411,7 @@ class ActionComm extends CommonObject } if (! empty($filter)) $sql.= $filter; - dol_syslog("ActionComm::getActions sql=".$sql); + dol_syslog(get_class($this)."::getActions sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -476,7 +480,9 @@ class ActionComm extends CommonObject /** * Charge les informations d'ordre info dans l'objet facture - * @param id Id de la facture a charger + * + * @param int $id Id de la facture a charger + * @return void */ function info($id) { @@ -489,7 +495,7 @@ class ActionComm extends CommonObject $sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; $sql.= ' WHERE a.id = '.$id; - dol_syslog("ActionComm::info sql=".$sql); + dol_syslog(get_class($this)."::info sql=".$sql); $result=$this->db->query($sql); if ($result) { @@ -524,6 +530,7 @@ class ActionComm extends CommonObject /** * Return label of status + * * @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param hidenastatus 1=Show nothing if status is "Not applicable" * @return string String with status @@ -535,6 +542,7 @@ class ActionComm extends CommonObject /** * Return label of action status + * * @param percent Percent * @param mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Very short label+Picto * @param hidenastatus 1=Show nothing if status is "Not applicable" @@ -645,6 +653,7 @@ class ActionComm extends CommonObject /** * Export events from database into a cal file. + * * @param format 'vcal', 'ical/ics', 'rss' * @param type 'event' or 'journal' * @param cachedelay Do not rebuild file if date older than cachedelay seconds @@ -659,7 +668,7 @@ class ActionComm extends CommonObject require_once (DOL_DOCUMENT_ROOT ."/lib/xcal.lib.php"); require_once (DOL_DOCUMENT_ROOT ."/lib/date.lib.php"); - dol_syslog("ActionComm::build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG); + dol_syslog(get_class($this)."::build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG); // Check parameters if (empty($format)) return -1; @@ -689,7 +698,7 @@ class ActionComm extends CommonObject include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php'); if (dol_filemtime($outputfile) > ($nowgmt - $cachedelay)) { - dol_syslog("ActionComm::build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled"); + dol_syslog(get_class($this)."::build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled"); $buildfile = false; } } @@ -763,7 +772,7 @@ class ActionComm extends CommonObject $sql.= " ORDER by datep"; //print $sql;exit; - dol_syslog("ActionComm::build_exportfile select events sql=".$sql); + dol_syslog(get_class($this)."::build_exportfile select events sql=".$sql); $resql=$this->db->query($sql); if ($resql) { @@ -809,7 +818,7 @@ class ActionComm extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog("ActionComm::build_exportfile ".$this->db->lasterror(), LOG_ERR); + dol_syslog(get_class($this)."::build_exportfile ".$this->db->lasterror(), LOG_ERR); return -1; } @@ -848,14 +857,14 @@ class ActionComm extends CommonObject if (rename($outputfiletmp,$outputfile)) $result=1; else { - dol_syslog("ActionComm::build_exportfile failed to rename ".$outputfiletmp." to ".$outputfile, LOG_ERR); + dol_syslog(get_class($this)."::build_exportfile failed to rename ".$outputfiletmp." to ".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp,0,1); $result=-1; } } else { - dol_syslog("ActionComm::build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); + dol_syslog(get_class($this)."::build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp,0,1); $langs->load("errors"); $this->error=$langs->trans("ErrorFailToCreateFile",$outputfile);