Skip to content

Commit

Permalink
Merge branch 'lodel-symfony'
Browse files Browse the repository at this point in the history
  • Loading branch information
bcenou committed Feb 13, 2020
2 parents 54d77ca + ee6dd89 commit 84c5c3d
Show file tree
Hide file tree
Showing 20 changed files with 56 additions and 51 deletions.
6 changes: 4 additions & 2 deletions lodel/scripts/checkxml.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ function checkstring(&$text, $error = 0)
return;
} else {
echo "<font color=red>";
echo preg_replace("/\n/se", "'<br /><b>'.((\$GLOBALS['line']++)+2).'</b> '", htmlspecialchars(substr($text, xml_get_current_byte_index($xml_parser) - 2)));
//echo preg_replace("/\n/se", "'<br /><b>'.((\$GLOBALS['line']++)+2).'</b> '", htmlspecialchars(substr($text, xml_get_current_byte_index($xml_parser) - 2)));
echo preg_replace_callback("/\n/s", function ($str) { return '<br /><b>'.(($GLOBALS['line']++)+2).'</b> '; } , htmlspecialchars(substr($text, xml_get_current_byte_index($xml_parser) - 2)));
echo "</font>\n";
echo sprintf("<br /><H2>XML error: %s ligne %d</H2>", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser));
echo "L'erreur se situe avant la zone rouge. Elle peut etre due a une erreur bien au dessus la ligne donne par le parser<br />";
Expand All @@ -71,7 +72,8 @@ function checkstring(&$text, $error = 0)
*/
function characterHandlerCHECK($parser, $data)
{
echo preg_replace("/\n/se", "'<br /><b>'.((\$GLOBALS[line]++)+2).'</b> '", $data);
//echo preg_replace("/\n/se", "'<br /><b>'.((\$GLOBALS[line]++)+2).'</b> '", $data);
echo preg_replace_callback("/\n/s", function ($str) { return '<br /><b>'.(($GLOBALS[line]++)+2).'</b> '; }, $data);
}


Expand Down
3 changes: 2 additions & 1 deletion lodel/scripts/filterfunc.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ function makefilterfunc()
$arg = $result2[2]; // argument if any

// process the variable. The processing is simple here. Need more ? Sould be associated with parser variable processing.
$arg = preg_replace("/\[\#([A-Z][A-Z_0-9]*)\]/e", ' "$"."context[".strtolower("\\1")."]" ', $arg);
//$arg = preg_replace("/\[\#([A-Z][A-Z_0-9]*)\]/e", ' "$"."context[".strtolower("\\1")."]" ', $arg);
$arg = preg_replace_callback("/\[\#([A-Z][A-Z_0-9]*)\]/", function ($test) { return "$"."context[".strtolower($test[1])."]";} , $arg);

if ($arg) {
$arg = ','. $arg;
Expand Down
4 changes: 2 additions & 2 deletions lodel/scripts/imapfunc.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function extractattachments($mbox, $mnum, $extre, $struct = 0, $pno = "")
if ($pno) {
$pno .= ".";
}
while (list ($j) = each($struct->parts)) {
foreach ($struct->parts as $j) {
$nbattachment += extractattachments($mbox, $mnum, $extre, $struct->parts[$j], $pno.$partno);
$partno ++;
}
Expand Down Expand Up @@ -118,4 +118,4 @@ function extractattachments($mbox, $mnum, $extre, $struct = 0, $pno = "")
}
return $nbattachment;
}
?>
?>
14 changes: 10 additions & 4 deletions lodel/scripts/lodelparser.php
Original file line number Diff line number Diff line change
Expand Up @@ -560,12 +560,18 @@ protected function parse_after(& $text)
<?php
\$langfile="lang-".\$context['sitelang']."_tpl_{$this->tpl}";
if(!isset(\$GLOBALS['langcache'][\$context['sitelang']])) { \$GLOBALS['langcache'][\$context['sitelang']] = array(); }
if (!(\$langcontents = cache_get(\$langfile))) {
\$GLOBALS['langcache'][\$context['sitelang']] += generateLangCache(\$context['sitelang'], \$langfile, array({$tt}));
\$langcontents = cache_get(\$langfile);
if (\$langcontents === false) {
\$cachelang = generateLangCache(\$context['sitelang'], \$langfile, array({$tt}));
if (!is_array(\$cachelang)) {
\$cachelang = array(\$cachelang);
}
array_merge(\$GLOBALS['langcache'][\$context['sitelang']], \$cachelang);
} else {
\$GLOBALS['langcache'][\$context['sitelang']] += \$langcontents;
array_merge(\$GLOBALS['langcache'][\$context['sitelang']], \$langcontents);
}
unset(\$langfile, \$langcontents);
unset(\$langfile, \$langcontents, \$cachelang);
?>
{$text}
PHP;
Expand Down
4 changes: 3 additions & 1 deletion lodel/scripts/logic.php
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,9 @@ protected function _makeMask(&$context, &$error)
$mask = $context['mask']['user'];
if(isset($context['mask_regexp'])) {
// disable eval options for more security
$mask = $context['mask']['user'] = preg_replace('/^(.)(.*)(\\1)([msieDASuUXxJ]*)?$/e', "'\\1'.\\2.'\\1'.str_replace('e', '', \"\\4\")", $mask);
$mask = $context['mask']['user'] = preg_replace_callback("/^(.)(.*)(\\1)([msieDASuUXxJ]*)?$/s",
function ($text){return($text[1].$text[2].$text[1].str_replace('e','',"$text[4]"));},$mask);
//$mask = $context['mask']['user'] = preg_replace('/^(.)(.*)(\\1)([msieDASuUXxJ]*)?$/e', "'\\1'.\\2.'\\1'.str_replace('e', '', \"\\4\")", $mask);
if(FALSE === @preg_match($mask, 'just a test for user regexp')) {
$error['mask'] = 'mask: '.getlodeltextcontents('mask_bad_regexp', 'common');
return;
Expand Down
2 changes: 1 addition & 1 deletion lodel/scripts/logic/class.data.php
Original file line number Diff line number Diff line change
Expand Up @@ -1920,7 +1920,7 @@ private function _updateTypes($datas, &$error='') {
}
$field = $db->GetRow("SELECT * FROM `{$table}__oldME` WHERE id = '{$val}'") or trigger_error("SQL ERROR :<br />".$GLOBALS['db']->ErrorMsg(), E_USER_ERROR);
unset($field['id']);
array_walk($field, create_function('&$f', '$f = addcslashes($f, "\'");'));
array_walk($field, function(&$f) { $f = addcslashes($f, "\'");});
$db->execute("INSERT INTO `{$table}` ({$typesFields}) VALUES ('{$id}','".join("','", $field)."')") or trigger_error("SQL ERROR :<br />".$GLOBALS['db']->ErrorMsg(), E_USER_ERROR);
$fieldName = $db->getOne("SELECT type FROM `{$table}__oldME` WHERE id = '{$val}'") or trigger_error("SQL ERROR :<br />".$GLOBALS['db']->ErrorMsg(), E_USER_ERROR);
$db->execute("INSERT INTO `$tablefieldsTable`(name, idgroup, class, title, altertitle, style, type, g_name, cond, defaultvalue, processing, allowedtags, gui_user_complexity, filtering, edition, editionparams, weight, comment, status, rank, upd, mask) (SELECT name, idgroup, class, title, altertitle, style, type, g_name, cond, defaultvalue, processing, allowedtags, gui_user_complexity, filtering, edition, editionparams, weight, comment, status, rank, upd, mask FROM `{$tablefieldsTable}__oldME` WHERE name = '{$fieldName}');\n") or trigger_error("SQL ERROR :<br />".$GLOBALS['db']->ErrorMsg(), E_USER_ERROR);
Expand Down
10 changes: 6 additions & 4 deletions lodel/scripts/logic/class.entities_index.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,10 @@ protected function _indexField ($id, $fieldValue, $fieldName, $fieldWeight, $dao
*/
protected function _decode_html_entities($text)
{
$text= preg_replace('/&#(\d+);/me',utf8_encode("chr(\\1)"),$text); #decimal notation
$text= preg_replace('/&#x([a-f0-9]+);/mei',utf8_encode("chr(0x\\1)"),$text); #hex notation
$text= preg_replace_callback('/&#(\d+);/m',function ($str) { return utf8_encode(chr($str[1])); },$text); #decimal notation
$text= preg_replace_callback('/&#x([a-f0-9]+);/mi',function ($str) { return utf8_encode(chr(hexdec('0x'.$str[1]))); },$text); #hex notation
//$text= preg_replace('/&#(\d+);/me',utf8_encode("chr(\\1)"),$text); #decimal notation
//$text= preg_replace('/&#x([a-f0-9]+);/mei',utf8_encode("chr(0x\\1)"),$text); #hex notation
return $text;
}

Expand Down Expand Up @@ -216,7 +218,7 @@ protected function _cleanAndcountTokens ($string, $regs=0)
{
$tokens = $this->_splitInTokens($string,$regs);
$indexs = array();//Array of each word weight for this field
while (list (, $token) = each ($tokens)) {
foreach ($tokens as $token) {
//particular case : two letter acronym or initials
if (preg_match ("/([A-Z][0-9A-Z]{1,2})/", $token) || strlen ($token) > 3) {
//little hack because oe ligature is not supported in ISO-latin!!
Expand Down Expand Up @@ -302,4 +304,4 @@ protected function _indexEntitiesRelations ($id, $nature, $daoIndex)
}

}//end of class
?>
?>
2 changes: 1 addition & 1 deletion lodel/scripts/logic/class.translations.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ protected function _saveRelatedTables($vo,&$context)
#if (in_array($lang,$langs)) continue; // the text already exists in the correct lang
#echo $row['name']," ";

$inserts[]="('".$row['name']."','".$row['textgroup']."','".mysql_escape_string($row['contents'])."','-1','".$context['lang']."')";
$inserts[]="('".$row['name']."','".$row['textgroup']."','".mysqli_escape_string($row['contents'])."','-1','".$context['lang']."')";
$count++;
$result->MoveNext();
}
Expand Down
2 changes: 1 addition & 1 deletion lodel/scripts/pma/common.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function PMA_backquote($a_name, $do_it = TRUE)
if (is_array($a_name)) {
$result = array();
reset($a_name);
while(list($key, $val) = each($a_name)) {
foreach ($a_name as $key => $val) {
$result[$key] = '`' . $val . '`';
}
return $result;
Expand Down
4 changes: 2 additions & 2 deletions lodel/scripts/pma/defines.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
// php 4.1+
if (!empty($_SERVER['HTTP_USER_AGENT'])) {
$HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
} else if (!empty($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) {
$HTTP_USER_AGENT = $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
} else if (!empty($_SERVER['HTTP_USER_AGENT'])) {
$HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
} else if (!isset($HTTP_USER_AGENT)) {
$HTTP_USER_AGENT = '';
}
Expand Down
17 changes: 4 additions & 13 deletions lodel/scripts/pma/defines_php.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,7 @@

// MySQL client API
if (!defined('PMA_MYSQL_CLIENT_API')) {
if (function_exists('mysql_get_client_info') || function_exists('mysqli_get_client_info')) {
if('mysql' == DBDRIVER)
$client_api = mysql_get_client_info();
else
$client_api = mysqli_get_client_info();
} else {
// for compatibility with php <= 4.0.5
// expect the worst!
$client_api = '3.21.0';
}
$client_api = mysqli_get_client_info();
$client_api = explode('.', $client_api);
define('PMA_MYSQL_CLIENT_API', (int)sprintf('%d%02d%02d', $client_api[0], $client_api[1], intval($client_api[2])));
unset($client_api);
Expand Down Expand Up @@ -80,8 +71,8 @@ function PMA_dl($module) {
$a = strip_tags(ob_get_contents());
ob_end_clean();
/* Get GD version string from phpinfo output */
if (ereg('Thread Safety[[:space:]]*enabled', $a)) {
if (ereg('Server API[[:space:]]*\(CGI\|CLI\)', $a)) {
if (preg_match('Thread Safety[[:space:]]*enabled', $a)) {
if (preg_match('Server API[[:space:]]*\(CGI\|CLI\)', $a)) {
$GLOBALS['PMA_dl_allowed'] = TRUE;
} else {
$GLOBALS['PMA_dl_allowed'] = FALSE;
Expand Down Expand Up @@ -134,7 +125,7 @@ function PMA_dl($module) {
$a = strip_tags(ob_get_contents());
ob_end_clean();
/* Get GD version string from phpinfo output */
if (ereg('GD Version[[:space:]]*\(.*\)', $a, $v)) {
if (preg_match('GD Version[[:space:]]*\(.*\)', $a, $v)) {
if (strstr($v, '2.')) {
define('PMA_IS_GD2', 1);
} else {
Expand Down
2 changes: 1 addition & 1 deletion lodel/scripts/pma/mysql_wrappers.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function PMA_mysql_fetch_array($result, $type = FALSE) {
if (isset($data[$name])) $ret[PMA_convert_display_charset($name)] = PMA_convert_display_charset($data[$name]);
} else {
/* Meta information available -> check type of field and convert it according to the type */
if ($meta->blob || eregi('BINARY', $meta->type)) {
if ($meta->blob || preg_match('BINARY/i', $meta->type)) {
if (isset($data[$i])) $ret[$i] = $data[$i];
if (isset($data[$name])) $ret[PMA_convert_display_charset($name)] = $data[$name];
} else {
Expand Down
8 changes: 4 additions & 4 deletions lodel/scripts/pma/sql-modified.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ function PMA_getTableDef($db, $table, $crlf, $error_url, $do_relation = false, $
if (isset($comments_map) && count($comments_map) > 0) {
$schema_create .= $crlf . $crlf . '/* COMMENTS FOR TABLE ' . PMA_backquote($table, $use_backquotes) . ':' . $crlf;
@reset($comments_map);
while(list($comment_field, $comment) = each($comments_map)) {
foreach ($comments_map as $comment_field => $comment) {
$schema_create .= ' ' . PMA_backquote($comment_field, $use_backquotes) . $crlf . ' ' . PMA_backquote($comment, $use_backquotes) . $crlf;
// omitting html_format is intentional. No use for htmlchars in the dump.
}
Expand All @@ -279,7 +279,7 @@ function PMA_getTableDef($db, $table, $crlf, $error_url, $do_relation = false, $
if (isset($mime_map) && count($mime_map) > 0) {
$schema_create .= $crlf . $crlf . '/* MIME TYPES FOR TABLE ' . PMA_backquote($table, $use_backquotes) . ':' . $crlf;
@reset($mime_map);
while(list($mime_field, $mime) = each($mime_map)) {
foreach ($mime_map as $mime_field => $mime) {
$schema_create .= ' ' . PMA_backquote($mime_field, $use_backquotes) . $crlf . ' ' . PMA_backquote($mime['mimetype'], $use_backquotes) . $crlf;
// omitting html_format is intentional. No use for htmlchars in the dump.
}
Expand All @@ -289,7 +289,7 @@ function PMA_getTableDef($db, $table, $crlf, $error_url, $do_relation = false, $
if ($have_rel) {
$schema_create .= $crlf . $crlf . '/* RELATIONS FOR TABLE ' . PMA_backquote($table, $use_backquotes) . ':' . $crlf;
@reset($res_rel);
while(list($rel_field, $rel) = each($res_rel)) {
foreach ($res_rel as $rel_field => $rel) {
$schema_create .= ' ' . PMA_backquote($rel_field, $use_backquotes) . $crlf . ' ' . PMA_backquote($rel['foreign_table'], $use_backquotes) . ' -> ' . PMA_backquote($rel['foreign_field'], $use_backquotes) . $crlf;
// omitting html_format is intentional. No use for htmlchars in the dump.
}
Expand Down Expand Up @@ -352,7 +352,7 @@ function PMA_getTableDef($db, $table, $crlf, $error_url, $do_relation = false, $
} // end while
$result->Close();

while (list($x, $columns) = @each($index)) {
foreach ($index as $x => $columns) {
$schema_create .= ',' . $crlf;
if ($x == 'PRIMARY') {
$schema_create .= ' PRIMARY KEY (';
Expand Down
4 changes: 2 additions & 2 deletions lodel/scripts/pma/sqlparser.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1970,7 +1970,7 @@ function PMA_SQP_buildCssData()
global $cfg;

$css_string = '';
while (list($key, $col) = each($cfg['SQP']['fmtColor'])) {
foreach ($cfg['SQP']['fmtColor'] as $key => $col) {
$css_string .= PMA_SQP_buildCssRule('syntax_' . $key, 'color', $col);
}
for ($i = 0; $i < 8; $i++) {
Expand All @@ -1993,7 +1993,7 @@ function PMA_SQP_buildCssData()
function PMA_SQP_formatNone($arr)
{
$formatted_sql = htmlspecialchars($arr['raw']);
$formatted_sql = ereg_replace("((\015\012)|(\015)|(\012)){3,}", "\n\n", $formatted_sql);
$formatted_sql = preg_replace("((\015\012)|(\015)|(\012)){3,}", "\n\n", $formatted_sql);

return $formatted_sql;
} // end of the "PMA_SQP_formatNone()" function
Expand Down
4 changes: 2 additions & 2 deletions lodel/scripts/servooclient.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ServOO_Client {
* @param string $url Location of the ServOO server.
*/

function ServOO_Client($url) {
function __construct($url) {
$this->_soapclient = new soapclientmime($url);

$err = $this->_soapclient->getError();
Expand Down Expand Up @@ -576,7 +576,7 @@ function _convertToXML_Pre_Extract_CB($p_event, &$p_header)

class servooattachment {
var $cid;
function servooattachment($cid) {
function __construct($cid) {
$this->cid=$cid;
}

Expand Down
2 changes: 1 addition & 1 deletion lodel/scripts/servoofunc.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ServOO extends ServOO_Client {
private $options; // username / passwd / url
public $status; // true ou false

function ServOO($other = "") {
function __construct($other = "") {
if(!empty($other)) {
if(FALSE === $this->SelectOtherServer($other)) {
$this->status = FALSE;
Expand Down
8 changes: 4 additions & 4 deletions lodel/scripts/textfunc.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,25 +214,25 @@ function spip($letexte)
{
$puce = "<IMG SRC=\"Images/smallpuce.gif\">";
// Harmoniser les retours chariot
$letexte = ereg_replace("\r\n?", "\n", $letexte);
$letexte = preg_replace("\r\n?", "\n", $letexte);

// Corriger HTML
$letexte = eregi_replace("</?p>", "\n\n\n", $letexte);
$letexte = preg_replace("</?p>/i", "\n\n\n", $letexte);

//
// Raccourcis liens
//
$regexp = "\[([^][]*)->([^]]*)\]";
$texte_a_voir = $letexte;
$texte_vu = '';
while (ereg($regexp, $texte_a_voir, $regs)) {
while (preg($regexp, $texte_a_voir, $regs)) {
$lien_texte = $regs[1];
$lien_url = trim($regs[2]);
$compt_liens ++;
$lien_interne = false;

$insert = "<a href=\"$lien_url\">".$lien_texte."</a>";
$zetexte = split($regexp, $texte_a_voir, 2);
$zetexte = preg_split($regexp, $texte_a_voir, 2);
$texte_vu .= $zetexte[0].$insert;
$texte_a_voir = $zetexte[1];
}
Expand Down
1 change: 1 addition & 0 deletions lodel/scripts/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ private function _eval($contents, &$context)
}

ob_start();
//var_dump($contents);
eval("?>" . $contents);
$contents = ob_get_clean();
}
Expand Down
6 changes: 3 additions & 3 deletions lodel/src/lodel/edition/oochargement.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function printErrors($errors, $exit = true, $isFrame = true)

if(C::get('sortie') && C::get('adminlodel', 'lodeluser'))
{
array_walk_recursive($contents, create_function('&$var', '$var = htmlentities($var, ENT_COMPAT, "UTF-8");'));
array_walk_recursive($contents, function(&$var) { $var = htmlentities($var, ENT_COMPAT, "UTF-8");});
echo '<pre>'. print_r($contents, 1) . '</pre>';
die();
}
Expand Down Expand Up @@ -257,7 +257,7 @@ function removefilesfromimport($rep)

if(C::get('sortie') && C::get('adminlodel', 'lodeluser'))
{
array_walk_recursive($contents, create_function('&$var', '$var = htmlentities($var, ENT_COMPAT, "UTF-8");'));
array_walk_recursive($contents, function(&$var) {$var = htmlentities($var, ENT_COMPAT, "UTF-8");});
echo '<pre>'. print_r($contents, 1) . '</pre>';
die();
}
Expand Down Expand Up @@ -418,7 +418,7 @@ function removefilesfromimport($rep)

if(empty($context['multiple']) && C::get('sortie') && C::get('adminlodel', 'lodeluser'))
{
array_walk_recursive($contents, create_function('&$var', '$var = htmlentities($var, ENT_COMPAT, "UTF-8");'));
array_walk_recursive($contents, function(&$var) {$var = htmlentities($var, ENT_COMPAT, "UTF-8");});
echo '<pre>'. print_r($contents, 1) . '</pre>';
die();
}
Expand Down
4 changes: 2 additions & 2 deletions lodel/src/lodel/edition/tpl/unpublish_confirm.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</tr>
</table>

[@EDITION.FOLLOWING_ENTITIES_ARE_PROTECTED_CONFIRM_UNPUBLISIHING]:</br>
[@EDITION.FOLLOWING_ENTITIES_ARE_PROTECTED_CONFIRM_UNPUBLISIHING]:<br />
<br/>
<ul>
<LOOP NAME="protectedentities">
Expand All @@ -38,4 +38,4 @@
</form>
</table>
<MACRO NAME="CLOSE_HTML">
<MACRO NAME="CLOSE_HTML">

0 comments on commit 84c5c3d

Please sign in to comment.