function debug($name, $data){ ob_start(); print_r($data); $str = ob_get_contents(); ob_end_clean(); debug_var($name, $str); }
if ($resultat_session == 'c') { header("Location: ../utilisateurs/mon_compte.php?change_mdp=yes"); die; } else { if ($resultat_session == '0') { header("Location: ../logout.php?auto=1"); die; } } if (!checkAccess()) { header("Location: ../logout.php?auto=1"); die; } $msg_complement = ""; if (getSettingValue('classes_ajout_debug_var') == 'y') { debug_var(); } if (getSettingValue('classes_ajout_sans_regime') == 'y') { $classes_ajout_sans_regime = "y"; } else { $classes_ajout_sans_regime = "n"; } // On ne propose pas de définir le régime quand suhosin est actif... on a alors trop de variables postées s'il y a beaucoup d'élèves $suhosin_post_max_totalname_length = ini_get('suhosin.post.max_totalname_length'); if ($suhosin_post_max_totalname_length != '') { $classes_ajout_sans_regime = "y"; } $sql = "SELECT classe FROM classes WHERE id = '{$id_classe}';"; $call_classe = mysqli_query($GLOBALS["mysqli"], $sql); if (mysqli_num_rows($call_classe) == 0) { echo "La classe n°{$id_classe} (id_classe) n'existe pas.<br />\n";
if (!verify()) { exit; } else { $userId = $_SESSION['user']; if (!check_rights("1")) { print_lack_of_privledge_warning(); } } $sessionToken = $_SESSION["token"]; ?> <form name="handleChange" action="<? print $PHP_SELF; ?>" method="post"> <INPUT TYPE="hidden" NAME=changeType VALUE=<?php print "\"$changeType\">"; debug_var("Change type",$changeType); if ($changeType == "1") { $changeTypeLabel = "Threshold"; ?> <h2>Creating Changes for Threshold - (Step 1 of 2)</h2> <? } elseif ($changeType == "2") { $changeTypeLabel = "Message Wording"; ?> <h2>Creating Changes for Message Wording - (Step 1 of 2)</h2> <? } elseif ($changeType == "3") { $changeTypeLabel = "Polling Interval"; ?>
function menu($action) { global $menu_arr; // Debugging - Fenster �ffnen if ($_SESSION['debugging'] === true) { debug_open_window(); debug_var('Seite: ', $_SERVER['PHP_SELF']); debug_var('Action: ', $_REQUEST); debug_msg('Debugging ist aktiv'); debug_finish(); $message = 'Debugging: aktiv!'; } $html = ''; $html .= '<h2>Menu</h2>' . "\n"; $html .= '<ul>' . "\n"; if (in_array($GLOBALS['CMS']['MENU01'], $menu_arr)) { $html .= '<li class="' . set_class($action, 'NAVIGA') . '"><a href="#" onclick="javascript:start_form(\'naviga\');">' . $GLOBALS['CMS']['MENU01'] . '</a></li>' . "\n"; } if (in_array($GLOBALS['CMS']['MENU02'], $menu_arr)) { $html .= '<li class="' . set_class($action, 'SEITEN') . '"><a href="#" onclick="javascript:start_form(\'seiten\');">' . $GLOBALS['CMS']['MENU02'] . '</a></li>' . "\n"; } if (in_array($GLOBALS['CMS']['MENU11'], $menu_arr)) { $html .= '<li class="' . set_class($action, 'FRGMNT') . '"><a href="#" onclick="javascript:start_form(\'frgmnt\');">' . $GLOBALS['CMS']['MENU11'] . '</a></li>' . "\n"; } if (in_array($GLOBALS['CMS']['MENU12'], $menu_arr)) { $html .= '<li class="' . set_class($action, 'ADDONS') . '"><a href="#" onclick="javascript:start_form(\'addons\');">' . $GLOBALS['CMS']['MENU12'] . '</a></li>' . "\n"; } if (in_array($GLOBALS['CMS']['MENU03'], $menu_arr)) { $html .= '<li class="' . set_class($action, 'MEDIEN') . '"><a href="#" onclick="javascript:start_form(\'medien\');">' . $GLOBALS['CMS']['MENU03'] . '</a></li>' . "\n"; } if (in_array($GLOBALS['CMS']['MENU10'], $menu_arr)) { $html .= '<li class="' . set_class($action, 'CONFIG') . '"><a href="#" onclick="javascript:start_form(\'config\');">' . $GLOBALS['CMS']['MENU10'] . '</a></li>' . "\n"; } if (in_array($GLOBALS['CMS']['MENU06'], $menu_arr)) { $html .= '<li class="' . set_class($action, 'XLINKS') . '"><a href="#" onclick="javascript:start_form(\'xlinks\');">' . $GLOBALS['CMS']['MENU06'] . '</a></li>' . "\n"; } if (in_array($GLOBALS['CMS']['MENU07'], $menu_arr)) { $html .= '<li class="' . set_class($action, 'BACKUP') . '"><a href="#" onclick="javascript:start_form(\'backup\');">' . $GLOBALS['CMS']['MENU07'] . '</a></li>' . "\n"; } if (in_array($GLOBALS['CMS']['MENU08'], $menu_arr)) { $html .= '<li class="' . set_class($action, 'DOKU') . '"><a href="#" onclick="javascript:start_form(\'docu\');">' . $GLOBALS['CMS']['MENU08'] . '</a></li>' . "\n"; } $html .= '<li class="even">' . "\n"; $html .= '<p><font color="#00CC00">' . $GLOBALS['TEXTE']['ANGEMELDET'] . ' ' . $_SESSION['username'] . '</font><br />' . "\n"; if ($message != '') { $html .= $message; } $html .= '</p>' . "\n"; $html .= '</li>' . "\n"; $html .= '<li class="even"><a href="#" onclick="javascript:start_form(\'logout\');">' . $GLOBALS['CMS']['MENU09'] . '</a></li>' . "\n"; $html .= '</ul>' . "\n"; return $html; }
<?php // File inc/display_variable.php / FirebirdWebAdmin // Purpose print variable content for debugging purpose // Author Lutz Brueckner <*****@*****.**> // Copyright (c) 2000, 2001, 2002, 2003, 2004 by Lutz Brueckner, // published under the terms of the GNU General Public Licence v.2, // see file LICENCE for details require './configuration.inc.php'; require './debug_funcs.inc.php'; session_start(); switch ($_GET['var']) { case 'SESSION': $display = $_SESSION; break; case 'POST': case 'GET': $display = $_SESSION['s_' . $_GET['var']]; break; default: $display = NULL; } debug_var($display);
private function resolve_expression($variable, $expression, $inconnue) { if (is_array($expression)) { $finded = 0; $index = -1; foreach ($expression as $i => $bloc) { if (stripos($bloc, $variable)) { $index = $i; $finded++; } } switch ($finded) { case 0: return null; break; case 1: // On ne fait rien on passe à la suite break; default: // Plusieurs instances de la variable pas possible return null; break; } if (count($expression) - 1 === $index) { // Dernier bloc $signe = $expression[$index - 1]; $newexp = $expression[$index]; $debut = null; for ($i = 0; $i < $index - 1; $i++) { $debut .= $expression[$i]; } if ($this->is_commutative($signe)) { $signe = $this->invert_sign($signe); $newincon = $inconnue . $signe . '(' . $debut . ')'; debug_var($newexp); } else { $newincon = '(' . $debut . ')' . $signe . $inconnue; } return $this->resolve_expression($variable, $newexp, $newincon); } else { //TODO Déplacer le bloc mal placé } } else { $pos = stripos($expression, $variable); $debut = ""; $fin = ""; if (strlen($variable) + $pos == strlen($expression) or strlen($variable) + $pos + 1 == strlen($expression) && $expression[strlen($variable) + $pos] === ')') { // Dernière variable for ($i = 0; $i < $pos - 1; $i++) { $debut .= $expression[$i]; } $signe = $expression[$pos - 1]; if ($this->is_commutative($signe)) { $signe = $this->invert_sign($signe); if (preg_match('/\\*|\\/|\\+|-/i', $debut)) { return $inconnue . $signe . '(' . $debut . ')'; } return $inconnue . $signe . $debut; } else { return $debut . $signe . '(' . $inconnue . ')'; } } else { $signe = $expression[$pos + strlen($variable)]; if ($this->is_commutative($signe)) { for ($i = 0; $i < $pos; $i++) { $debut .= $expression[$i]; } for ($i = $pos + strlen($variable) + 1; $i < strlen($expression); $i++) { $fin .= $expression[$i]; } $newexp = $debut . $fin . $signe . $variable; return $this->resolve_expression($variable, $newexp, $inconnue); } else { //TODO Déplacer bloc non commutatif return null; } } } }
function getMediaAnnotationXml($id_media) { global $conn; $conn->Execute("SET SESSION group_concat_max_len = 1000000;"); $tags = ew_ExecuteScalar("SELECT GROUP_CONCAT( distinct '<annotation concepttype=\"',ct.value,'\">',title,'</annotation>' SEPARATOR '\n') \n\t\t\tfrom " . EW_CONN_DB_MEDIA . ".annotations \n\t\t\tLEFT JOIN " . EW_CONN_DB_MEDIA . ".concepts as c ON (c.id_concepts = annotations.id_concepts) \n\t\t\tLEFT JOIN " . EW_CONN_DB_MEDIA . ".concept_types as ct ON (c.id_concept_types = ct.id_concept_types) \n\t\t\t\n\t\t\tWHERE id_media = '{$id_media}' "); debug_var($tags); return "<annotations>\n\t\t\t" . $tags . "</annotations>"; }
debug_msg ("Category type: $categoryType"); debug_msg ("Grep string: $grepString"); preg_match_all($grepString,$categoryTypes,$catLabelRow,PREG_SET_ORDER); debug_var ("Category types matching this type",$catLabelRow); foreach ($catLabelRow as $row) { $catLabelId = $row[1]; $categoryTypeDisp = $row[2]; if ($catLabelId == $categoryType) { continue; } } debug_var("Result of category label grep",$catLabelRow); $categoryDescriptionDisp = $categoryDescription; # We need to get the $catFunction = get_category_function_label($categoryName); $catFunction = implode (",", $catFunction); if ($catFunction == "") { $catFunction = "NONE"; } $allCategoriesString = $allCategoriesString . $categoryName . ","; ?> <TR><TD><a href="javascript:populate_categories_submit(<? print "'$categoryName','$categoryDescriptionDisp','$categoryType'"; ?>)"</a><? print "$categoryName"; ?></TD> <TD NOWRAP><? print "$categoryTypeDisp"; ?></TD><TD NOWRAP><? print "$categoryDescriptionDisp"; ?></TD><TD NOWRAP><? print "$catFunction"; ?></TD></TR> <? }
function debug_stop($var) { debug_var($var); die; }
<?php require 'vendor/autoload.php'; $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9); debug_var($array); die_dump($array);
require_once FUNKTION . 'erzeuge_code.php'; /* Script fuer Google Analytics erstellen, falls ein GA-Konto gefunden wurde */ $ga_script = $cfg->google_analytics(GOOGLE_ANALYTICS); // Test für den Einsatz von FirePHP //ob_start(); /* require_once('FirePHPCore/FirePHP.class.php'); $firephp = FirePHP::getInstance(true); $var = array('i'=>10, 'j'=>20); $firephp->setEnabled(true); */ //$firephp->log($action, 'Action'); //$firephp->log($_SESSION['debugging'], 'Debugging'); //ob_end_flush(); // Debugging kann aktiviert werden, indem &debug=1 an die URL angehängt wird. require_once FUNKTION . 'debug.php'; if (isset($_REQUEST['debug']) && $_REQUEST['debug'] == 1) { $_SESSION['debugging'] = true; } // Debugging deaktivieren if (isset($_REQUEST['debug']) && $_REQUEST['debug'] == 0) { $_SESSION['debugging'] = false; } // Debugging - Fenster öffnen if ($_SESSION['debugging'] === true) { debug_var('Seite: ', $_SERVER['PHP_SELF']); debug_var('Action: ', $_REQUEST); debug_msg('Debugging ist aktiv'); debug_finish(); //echo 'Debugging aktiv!<br />'; }
$_SESSION["debug"] = $debug; $username = $_SESSION['username']; if ($debug) { debug_msg("Debugging enabled for user $username."); } else { log_entry("DEBUG: Debugging disabled for user $username."); } } elseif (isset($_SESSION["debug"])) { $debug = $_SESSION["debug"]; } // Get user data for the session $userId = $_SESSION['user']; $userRights = $_SESSION['rights']; // Output session variables to debug window #debug_var ("User details", get_user_name ($userId)); debug_var ("Session variables", $_SESSION); debug_var ("Server variables", $_SERVER); // Log session if it hasn't been logged yet #if (!$_SESSION['logged']) { # log_session ("login"); #} ?>
function debug_die($var) { debug_var($var); die; }
$vars = $element->tpl->getVars(); $innerElements = $vars["elements"]; unset($vars["elements"]); htmlspecialchars_arr($vars); echo "<h3>Variables that can be used in '{$element->templateFileName}'</h3>"; debug_var($vars, $debugStyle); } else { $innerElements = $element->tpl->elements; } if (count($innerElements)) { foreach ($innerElements as $innerElement) { $vars = $innerElement->tpl->getVars(); unset($vars["elements"]); htmlspecialchars_arr($vars); echo "<h3>Variables that can be used in '{$innerElement->templateFileName}'</h3>"; debug_var($vars, $debugStyle); } } } ?> <?php function debug_var($vars, $style = "simple") { if ($style == "simple") { debug_var_simple($vars); } else { debug_var_expandable("", print_r($vars, TRUE)); } } function htmlspecialchars_arr(&$arr)
function sanitize_input($inputString,$type) { // Types // 1: regular input // 2: username // 3: numeric // 4: alpha only // 5: alphanumeric if ($type == 1) { // Regular input // Replace special characters with HTML version $cleanString = str_replace ("'", "´", $inputString); $cleanString = str_replace ("\"", """, $cleanString); $cleanString = str_replace ("&", "&", $cleanString); $cleanString = str_replace ("<", "<", $cleanString); $cleanString = str_replace (">", ">", $cleanString); $cleanString = addslashes($cleanString); } elseif ($type == 2) { // Username input // usernames may contain the following characters: // @ - email address format (username@domain.com) // . - e.g. firstname.lastname // \ - domain delimiter, such as DOMAIN\username // _ - e.g. firstname_lastname // letters - uppercase or lowercase // numbers $cleanString = preg_replace ("/[^\\\\0-9A-Za-z_\.@]+/","",$inputString); // Remove extra backslashes $cleanString = preg_replace ("/[\\\\]+/","\\",$cleanString); } elseif ($type == 3) { // Numeric data $cleanString = preg_replace ("/[^0-9]+/","",$inputString); } elseif ($type == 4) { // Alpha chars only $cleanString = preg_replace ("/[^A-Za-z]+/","",$inputString); } elseif ($type == 5) { // Numbers and alpha only $cleanString = preg_replace ("/[^0-9A-Za-z]+/","",$inputString); } else { $msg = "sanitize_input(): Invalid type ($type)"; log_entry ($msg); die ($msg); } debug_var ("Sanitize input - Input string", $inputString); debug_var ("Sanitize input - Clean string", $cleanString); return $cleanString; }