<?php
//20.0.56.2 FMK/Exception/Assert.php GF 
//VersionVI: 30F200067s
//(c) 2005-2012 PC SOFT  - Release
 define('FMK_Exception_Assert',true); class FMK_Exception_Assert { var $sAssertLog; var $sAssertInfo; var $sAssertc; function FMK_Exception_Assert() { $this->sAssertInfo = ''; $this->sAssertc = ''; $this->sAssertLog = './assert_'.WB_MAPAGE.'.log'; assert_options(ASSERT_ACTIVE,(!ASSERT_IGNORE ? 1 : 0)); assert_options(ASSERT_CALLBACK, 'FMK_Exception_AssertCallback'); } } $_FMK_Exception_Assert = new FMK_Exception_Assert(); function FMK_Exception_Assert() { global $_FMK_Exception_Assert; $argv = func_get_args(); $argc = func_num_args(); if ($argc===0) { return assert(); } $_FMK_Exception_Assert->sAssertInfo = 'Cet assert'; $sChaine = $argv[0]; if ($argc===1) { if (false===is_string($sChaine)) { return assert($sChaine); } } else { if ( (false===is_string($sChaine)) || (utf8_strpos($sChaine,'%'.$argc)===false) ) { $sChaine = utf8_implode(') && (', $argv); } for($i=1;$i<$argc;$i++) { $sChaine = utf8_str_replace("%$i",$argv[$i],$sChaine); } } $_FMK_Exception_Assert->sAssertInfo = $sChaine; return assert(eval('return ('.$_FMK_Exception_Assert->sAssertInfo.');')); } function F5ad513e6( $script, $line, $message ) { global $_FMK_Exception_Assert; $debug = debug_backtrace(); foreach ($debug as $index => $appel) { if ($appel['function'] == 'assert') { ++$index; $appel = $debug [ $index ]; $function = $appel['function']; if ( utf8_strpos(utf8_strtolower(file_get_contents(__FILE__)),utf8_strtolower($function)) === false ) { --$index; $appel = $debug [ $index ]; $function = $appel['function']; } $line = $appel['line']; $script = $appel['file']; $f = file($script); break; } } if (LOG_ASSERT) { $sMessageLog = $function.' '.$message; if (isset($_FMK_Exception_Assert->sAssertc)) { $sMessageLog .= ' ['. $_FMK_Exception_Assert->sAssertc.']'; } $sMessageLog .= ' @ ' . utf8_str_replace(F8df7b692(realpath(WB_INCLUDE_PATH)),'',F8df7b692($script) ). ' : ' . $line . "\n"; error_log($sMessageLog, 3, $_FMK_Exception_Assert->sAssertLog); } if (ASSERT_ET_CONTINUE) { if (isset($_FMK_Exception_Assert->sAssertc)) $message .= ' ['. $_FMK_Exception_Assert->sAssertc.']'; F01cd7827('Assert : ' .$message . ' @ ' . utf8_str_replace(F8df7b692(realpath(WB_INCLUDE_PATH)),'',F8df7b692($script) ). ' : ' . $line. F5a596429() ); return; } echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset='.(UNICODE_PAGE_UTF8 ? 'UTF-8' : 'ISO-8859-1').'"><BODY bgcolor="#C0C0C0"><table border=1 style="width: 800px;border-color:#F8FFFF"><tr><td><div style="width:75px; height:75px; font-size:large">/!\</div></td><td><b>ASSERT</b> dans <b>', $script,'</b> : ligne <b>', $line,'</b> :<br />'; echo '<b>', $message , '</b>'; echo Fd7624002('<p>Détail : ').((empty($_FMK_Exception_Assert->sAssertInfo)) ? 'Cet assert' : $_FMK_Exception_Assert->sAssertInfo).Fd7624002(' est faux.<br />Mieux vaut vérifier le source car ce n\'est pas un comportement normal</p>'); echo '</td></tr></table>'; if (isset($_FMK_Exception_Assert->sAssertc)){ echo '<p style="background-color:orange;width: 800px">' . $_FMK_Exception_Assert->sAssertc . '</p>'; $_FMK_Exception_Assert->sAssertc = null; } echo 'Ligne de l\'assertion :<br /><select size=10  STYLE="width: 800px">'; foreach ($f as $i => $l) { echo '<option' . ( ( ($i==$line-1) ? ' selected' : '') ) . '>' . utf8_htmlentities($l) . '</option>'; } echo '</select>'; echo F5f052058($debug); echo "<table>"; echo "<tr>"; if (ASSERT_PILE_TEXTAREA) { echo "<h1>PILE :</h1><textarea cols=100 rows=25 STYLE=\"width: 800px\">"; var_dump($debug); echo "</textarea>"; } if (ASSERT_SESSION_TEXTAREA) { echo "<h1>SESSION :</h1><textarea cols=100 rows=25 STYLE=\"width: 800px\">"; var_dump($_SESSION); echo "</textarea>"; } echo '</tr>'; echo '</table>'; exit; } function Fbc7b26dd($var) { $data1 = ob_get_contents(); ob_end_clean(); ob_start(); var_dump($var); $data2 = ob_get_contents(); ob_end_clean(); ob_start(); echo $data1; return $data2; } function F5f052058($debug = null,$bAvecJS = ASSERT_PILE_JS) { ob_start(); if (!isset($debug))$debug=debug_backtrace(); $fx_header = <<<EOT
window.addEvent('domready', function() {
	var status = {
		'true': 'open',
		'false': 'close'
	};
EOT;
$fx_format = <<<EOT
	var myVerticalSlide%s = new Fx.Slide('FILE%s');
	$('v_toggle%s').addEvent('click', function(e){
		e.stop();
		myVerticalSlide%s.toggle();
	});
	myVerticalSlide%s.toggle();
EOT;
if (!ASSERT_PILE_MOOTOOLS && $bAvecJS) $js = <<<EOT
function F16ab276d(id)
{
	if (document.getElementById("FILE" + id).style.display == "" )
	document.getElementById("FILE" + id).style.display = "none";
	else
	document.getElementById("FILE" + id).style.display = "";
}
EOT;
else $js = ''; echo '<script>' . $js ; $fx_genere = ''; $echo = '</script>'; $i=0; $echo.='<h1>PILE :<a name="lbl"></a></h1><table border=0 style="width: 800px;border-color:#F8FFFF;"><tr><td>Fonction</td><td>Fichier</td><td>Ligne</td></tr>'; foreach ($debug as $index => $appel) { ++$i; $bArgs=false; $sOnClick = ''; $sDisplayParams = 'none'; if (isset($appel['args']) && is_array($appel['args']) && (count($appel['args'])>0) && ASSERT_PILE_AVEC_PARAMS) { $bArgs=true; if (!ASSERT_PILE_MOOTOOLS && $bAvecJS) { $sOnClick = ' OnClick="javascript:F16ab276d('.$i*100 .')" '; $sDisplayParams = 'none'; } else { $sOnClick = ''; $sDisplayParams = ''; } $args = '[<a id="v_toggle'. $i*100 .'" href="#lbl"'.$sOnClick.'>args</a>]'; $fx_genere .= utf8_str_replace('%s',$i*100,$fx_format); } else { $args = ''; } $fx_genere .= utf8_str_replace('%s',$i,$fx_format); if (ASSERT_PILE_DETAILLEE && $bAvecJS) { $sOnClick = ' OnClick="javascript:F16ab276d('.$i.')" '; $sDisplay = 'none'; } else { $sOnClick = ''; $sDisplay = ''; } $sHREF = ($bAvecJS && ASSERT_PILE_DETAILLEE) ? ' href="#lbl"' : ''; $echo.='<tr><td><a id="v_toggle'.$i.'" name="#lbl'.$i.'"'. $sHREF . $sOnClick.'>'.$appel['function'].'</a>'.$args.'</td><td>'.( (isset($appel['file'])) ? F8df7b692(basename($appel['file'])) : '').'</td><td>'.( (isset($appel['line'])) ? basename($appel['line']) : '').'</td></tr>'; $echo.="<tr><td colspan=3><div id='FILE". $i*100 ."' style='display:".$sDisplayParams."; position:relative; width:800px; overflow:auto; border:1px navy solid'>"; $echo.="<table>"; if ($bArgs && ASSERT_PILE_AVEC_PARAMS) { $nIemeArg=0; foreach ($appel['args'] as $arg) { $echo.="<tr><td STYLE=\"width: 50px;vertical-align:top\">" . (is_object($arg) ? get_class($arg) : gettype($arg)) . '</td><td>'; $echo.="<div width:750px; overflow:auto'><pre>"; $ob=Fbc7b26dd($arg); $echo.= (function_exists("xdebug_start_trace")) ? $ob : utf8_htmlentities($ob); $echo.="</pre></div>"; $echo.='</td></tr>'; ++$nIemeArg; } } $echo.="</table>"; $echo.="</div></td></tr>"; if (ASSERT_PILE_DETAILLEE) { $echo.="<tr><td colspan=3><div id='FILE".$i."' style='display:".$sDisplay."; position:relative; height:300px; width:800px; overflow:auto'>"; $sNomClasse = null; $tabArgs = null; $clObjet = null; foreach ($appel as $id => $tabValeurs) { switch ($id) { case 'args': $tabArgs = $tabValeurs; continue; case 'object': $clObjet = $tabValeurs; continue; case 'class': $sNomClasse = $tabValeurs; continue; case 'type': continue; default: continue; } } if (isset($clObjet)) { $echo.=F93ebc32b($clObjet,$sNomClasse); } $echo.="<div STYLE=\"width: 780px; height:200px\"><pre>"; $ob=Fbc7b26dd($appel); $echo.= (function_exists('xdebug_start_trace')) ? $ob : utf8_htmlentities($ob); $echo.="</pre></div>"; $echo.="</div></td></tr>"; } } $echo.='</table>'; if ($bAvecJS && ASSERT_PILE_MOOTOOLS){ echo $fx_header; echo $fx_genere; echo "});"; } echo $echo; $contents = ob_get_contents(); ob_end_clean(); return $contents; } function F93ebc32b($clVar, $sNomVar, $bIncludeJS = false) { if ($bIncludeJS){ $js = <<<EOT
function F16ab276d(id)
{
	if (document.getElementById("FILE" + id).style.display == "" )
	document.getElementById("FILE" + id).style.display = "none";
	else
	document.getElementById("FILE" + id).style.display = "";
}
EOT;
} else $js = ''; $sRetour = $js; if (is_int($sNomVar)) $sNomVar = 'Indice ' . $sNomVar; if (is_object($clVar)) { $sNomClasse = get_class($clVar); $sRetour.= '<div style="background-color:#'.dechex(rand(0x999999,0xFFFFFF)).'">'; $sRetour.= '<div style="width:100px;float:left">' . $sNomVar . '</div><div style="width:100px;float:left">' . $sNomClasse . '</div><div style="width:100px;float:left">avec</div><br />'; $sRetour.= '<div style="margin-left:20px;">'; $tabMembres = get_class_vars($sNomVar); foreach ($tabMembres as $sNomMembre => $Elem) { $sRetour.= F93ebc32b($Elem,$sNomMembre,false); } $sRetour.= '</div>'; $sRetour.= '</div>'; } elseif (is_array($clVar)) { $style = (count($clVar)==0) ? 'style="background-color:#C0C0C0"' : 'style="background-color:#'.dechex(rand(0x999999,0xFFFFFF)).'"'; $sRetour.= '<div '.$style.'>'; $sRetour.= '<div style="width:100px;float:left">' . $sNomVar . '</div><div style="width:100px;float:left">Array de ' . count($clVar) . Fd7624002('</div><div style="width:100px;float:left">élément(s)</div><br />'); $sRetour.= '<div style="margin-left:20px;">'; foreach ($clVar as $sNomElem => $Elem){ $sRetour.= F93ebc32b($Elem,$sNomElem,false); } $sRetour.= '</div>'; $sRetour.= '</div>'; } else { $sRetour.= '<div style="width:100px;float:left">' . $sNomVar . '</div><div style="width:100px;float:left">' . gettype($clVar) . '</div><div style="width:100px;float:left">' . ((string)utf8_htmlentities($clVar)) . '</div><br />'; } return $sRetour; } function PRECONDITION($bEstVrai) { return assert($bEstVrai); } function POSTCONDITION($bEstVrai) { return assert($bEstVrai); } function INVARIANT($bEstVrai) { return assert($bEstVrai); } function XVERIFY($bEstVrai) { return assert($bEstVrai); } function XASSERT($bEstVrai) { return assert($bEstVrai); } function XASSERTC($bEstVrai,$sMessage) { global $_FMK_Exception_Assert; $_FMK_Exception_Assert->sAssertc = $sMessage; $bAssert = assert($bEstVrai); $_FMK_Exception_Assert->sAssertc = ''; return $bAssert; } function XVALIDSTRING($sChaine) { return assert(is_string($sChaine)); } function Fbd76389c($p) { return assert(isset($p)); } function XVALIDPTR($p) { return assert(isset($p)); } function XASSERTPTROF($p,$sClasse) { $sClasseParametre = get_class($p); $nNbClasse = func_num_args() - 1; for($i=0; $i<$nNbClasse; $i++) { $bOK = false; $sClasse = func_get_arg($i+1); if ((utf8_substr($sClasse,$nTailleClasse=utf8_strlen($sClasse)-1,1)=='*')) { if (!isset($tabClasses)) $tabClasses = get_declared_classes(); foreach ($tabClasses as $sClasseExistante) { if (utf8_strcasecmp( utf8_substr($sClasseExistante,0,$nTailleClasse-1), utf8_substr($sClasse,0,$nTailleClasse-1) )===0 ) { F6b1e3687(); if (is_a($p,$sClasseExistante)) { $bOK = true; } F1e7b0563(); } } } else { F6b1e3687(); $bOK = is_a($p,$sClasse); F1e7b0563(); } if ($bOK) break; } } function CHECKPTROK($p,$nTaille) { if (is_string($p)) return assert(isset($p) && (utf8_strlen($p) == $nTaille-1)); return assert(isset($p)); } function F16204cef($p,$nTaille) { return assert(isset($p) && is_array($p) && (count($p,COUNT_NORMAL)===$nTaille)); } function UNUSED($x) { $x; } function XASSERT_FALSE() { XASSERT(false); } function Fa79fbf41($s) { XASSERTC(false,$s); } function F8b98af41($Var) { return !Fd366f7d9($Var); } function Fd366f7d9($Var) { return $Var==''; } function F61196400($Var) { return (!empty($Var)); } function XDBG($x) { ; } ?>