Example #1
0
 function keyword($word, $class)
 {
     $word = htmlEntities($word);
     if ($this->last_class == $class) {
         return $word;
     } else {
         $close = $this->close_url;
         if (isset($this->help_pages[$class])) {
             $prefix = sprintf($this->help_pages[$class], $word);
             $this->close_url = '</a>';
         } else {
             $prefix = '';
             $this->close_url = '';
         }
         if ($this->last_class == null) {
             $this->last_class = $class;
             return $prefix . '<span class="' . $class . '">' . $word;
         }
         $this->last_class = $class;
         if ($class == null) {
             return '</span>' . $close . $word;
         }
         return '</span>' . $close . $prefix . '<span class="' . $class . '">' . $word;
     }
 }
Example #2
0
 /**
  *	Cleans a URL so it's safe to print to the browser without issues.
  *	@param uri		String		The URL to parse
  *	@return			String		The clean URL to print
  */
 public static function cleanUrl($uri)
 {
     $result = null;
     $url = htmlEntities($uri, ENT_QUOTES, 'utf-8');
     $parse = parse_url($url);
     $result = "{$parse['scheme']}://";
     $parse['path'] = ltrim($parse['path'], '/');
     foreach (array('user', 'pass', 'path', 'query', 'fragment') as $p) {
         if (isset($parse[$p])) {
             $parse[$p] = urlEncode($parse[$p]);
         }
     }
     if (!empty($parse['user'])) {
         $result .= "{$parse['user']}";
         if (empty($parse['pass'])) {
             $result .= '@';
         } else {
             $result .= ":{$parse['pass']}@";
         }
     }
     $result .= "{$parse['host']}/{$parse['path']}";
     if (!empty($parse['query'])) {
         $result .= "?{$parse['query']}";
     }
     if (!empty($parse['fragment'])) {
         $result .= "#{$parse['fragment']}";
     }
     return $result;
 }
 /** 
  * decorate
  * 
  * @access  protected
  * @return  mixed
  * @param   mixed   $value
  */
 function decorate($value)
 {
     if (is_string($value)) {
         return htmlEntities($value, ENT_QUOTES, $this->list->getEncoding());
     } elseif (is_array($value)) {
         return array_map(array(&$this, 'decorate'), $value);
     }
     return $value;
 }
 protected function renderCardDetails($data)
 {
     /* may be overriden in child class */
     $str = null;
     if ($this->showCardDescription == 1) {
         $str .= '<br>' . htmlEntities($data[TableCard::FIELD_DESCRIPTION]);
     }
     // if
     return $str;
 }
function showResults()
{
    #----------------------------------------------------------------------
    global $chosenEventId, $chosenRegionId, $chosenYears, $chosenShow, $chosenSingle, $chosenAverage;
    #--- Try the cache
    tryCache('event', $chosenEventId, preg_replace('/ /', '', $chosenRegionId), $chosenYears, preg_replace('/ /', '', $chosenShow), $chosenSingle, $chosenAverage);
    #------------------------------
    # Prepare stuff for the query.
    #------------------------------
    $eventCondition = eventCondition();
    $yearCondition = yearCondition();
    $regionCondition = regionCondition('result');
    $limitCondition = '';
    if (preg_match('/^10+/', $chosenShow, $matches)) {
        $limitNumber = $matches[0];
        $limitCondition = 'LIMIT ' . 2 * $limitNumber;
    }
    $valueSource = $chosenAverage ? 'average' : 'best';
    $valueName = $chosenAverage ? 'Average' : 'Single';
    #------------------------------
    # Get results from database.
    #------------------------------
    if ($chosenShow == 'By Region') {
        require 'includes/events_regions.php';
        return;
    }
    if ($chosenShow == '100 Results' || $chosenShow == '1000 Results') {
        require 'includes/events_results.php';
    } else {
        require 'includes/events_persons.php';
    }
    #------------------------------
    # Show the table.
    #------------------------------
    startTimer();
    $event = getEvent($chosenEventId);
    tableBegin('results', 6);
    tableCaption(true, spaced(array($event['name'], chosenRegionName(), $chosenYears, $chosenShow)));
    $headerSources = $chosenAverage ? 'Result Details' : '';
    tableHeader(explode('|', "Rank|Person|Result|Citizen of|Competition|{$headerSources}"), array(0 => "class='r'", 2 => "class='R2'", 5 => 'class="f"'));
    $ctr = 0;
    foreach ($results as $result) {
        extract($result);
        $ctr++;
        $no = isset($previousValue) && $value == $previousValue ? '&nbsp;' : $ctr;
        if ($limitCondition && $no > $limitNumber) {
            break;
        }
        tableRow(array($no, personLink($personId, $personName), formatValue($value, $event['format']), htmlEntities($countryName), competitionLink($competitionId, $competitionName), formatAverageSources($chosenAverage, $result, $event['format'])));
        $previousValue = $value;
    }
    tableEnd();
    stopTimer("printing the table");
}
Example #6
0
 /**
  *	Renders this form for HTML viewing.
  *	@param view		Zend_View_Interface		A view controller to incorporate into
  *											the rendering scheme.
  *	@return			String					The rendered form
  */
 public function render(Zend_View_Interface $view = null)
 {
     $attribs = null;
     foreach ($this->_attribs as $key => $attrib) {
         $attrib = htmlEntities($attrib, ENT_QUOTES, 'utf-8');
         $attribs .= (empty($attribs) ? null : chr(32)) . "{$key}='{$attrib}'";
     }
     $result = "\n\t\t\t\t\t<form method='{$this->getMethod()}'{$attribs}>\n";
     foreach ($this->_elements as $element) {
         $result .= $element->render($view);
     }
     return "{$result}\n\t\t\t\t\t</form>\n\t\t\t\t";
 }
Example #7
0
 function keyword($word, $class)
 {
     $word = htmlEntities($word, ENT_COMPAT, 'UTF-8');
     if ($this->last_class == $class) {
         return $word;
     } else {
         if ($this->last_class == null) {
             $this->last_class = $class;
             return '<span class="' . $class . '">' . $word;
         }
         $this->last_class = $class;
         if ($class == null) {
             return '</span>' . $word;
         }
         return '</span><span class="' . $class . '">' . $word;
     }
 }
function choice($id, $caption, $options, $chosenOption)
{
    #----------------------------------------------------------------------
    $result = "<label for='{$id}'>";
    $result .= $caption ? "{$caption}:<br />" : '';
    $result .= "<select class='drop' id='{$id}' name='{$id}'>\n";
    $chosen = urlEncode($chosenOption);
    foreach ($options as $option) {
        $nick = urlEncode($option[0]);
        $text = htmlEntities($option[1], ENT_QUOTES, "UTF-8");
        $selected = $chosen && $nick == $chosen ? " selected='selected'" : "";
        $result .= "<option value='{$nick}'{$selected}>{$text}</option>\n";
    }
    $result .= "</select>";
    $result .= "</label>";
    return $result;
}
 public static function renderImg($src, $title, $htmlClass, $onclick = null)
 {
     /* src needs to be an absolute path */
     $str = '<img ';
     $str .= 'src="' . OpfApplicationConfig::APP_CALLBACK_URL . '/' . $src . '" ';
     if (!is_null($title)) {
         $str .= ' title="' . htmlEntities($title) . '" ';
     }
     // if
     if (!is_null($htmlClass)) {
         $str .= ' class="' . $htmlClass . '" ';
     }
     // if
     if (!is_null($onclick)) {
         $str .= 'style="cursor: pointer;" onclick="' . $onclick . '" ';
     }
     // if
     $str .= '>';
     return $str;
 }
Example #10
0
function outputDir($directory, $prefix = "")
{
    global $currentTest, $currentTestPath, $currentTestName, $currentDirPath;
    $list = scandir($directory);
    foreach ($list as $listItem) {
        if ($listItem[0] == ".") {
            continue;
        }
        $name = $listItem;
        $listItemPath = $directory . $listItem;
        $listItem = $prefix . $listItem;
        if (is_dir($directory . "/" . $listItem)) {
            $listItem .= "/";
            $listItemPath .= "/";
            $href = "?test=" . urlencode($listItem);
            $hrefAll = "?all&test=" . urlencode($listItem);
            if (substr($currentTest, 0, strlen($listItem)) != $listItem) {
                echo '<a href="' . $hrefAll . '" class="test-set-group-all">(all)</a>';
                echo '<a href="' . $href . '" class="test-set-group-name">' . htmlentities($name) . '</a>';
            } else {
                echo '<a href="' . $hrefAll . '" class="test-set-group-all">(all)</a>';
                echo '<span class="test-set-group-name selected">' . htmlentities($name) . '</span>';
                echo '<div class="test-set-group">';
                $currentTestName .= $name . " / ";
                $currentDirPath = $listItemPath;
                outputDir($listItemPath, $listItem);
                echo '</div>';
            }
        } elseif (substr($listItem, strlen($listItem) - 3) == ".js") {
            $name = substr($name, 0, strlen($name) - 3);
            if ($listItem == $currentTest) {
                $currentTestPath = $listItemPath;
                $currentTestName .= $name;
                echo '<span class="test-set selected">' . htmlEntities($name) . '</span>';
            } else {
                $href = "?test=" . urlencode($listItem);
                echo '<a href="' . $href . '" class="test-set">' . htmlEntities($name) . '</a>';
            }
        }
    }
}
Example #11
0
/**
 * Output debug data
 * Input var $debug_input_data must be an array
 * Recommended usage:
 * wddump( array(basename(__FILE__), $debugdata) );
 */
function wddump($debug_input_data = false)
{
    if (!WDFAQ_DEBUG or !$debug_input_data) {
        return false;
    } else {
        foreach ($debug_input_data as $debug_data) {
            echo '<div class="wdfaq-debugdata"><pre>';
            if (is_array($debug_data)) {
                echo '<ul>';
                foreach ($debug_data as $key => $value) {
                    echo '<li>Key: ' . htmlEntities($key) . '<br />Value: ' . htmlEntities($value) . '</li>';
                }
                echo '</ul>';
            } else {
                var_dump($debug_data);
            }
            echo '</pre></div>';
        }
        return true;
    }
}
 function getDynaDescription($text = '', $excerpt_length = 25)
 {
     global $modx;
     $text = str_replace(']]>', ']]&gt;', $text);
     /* remove line breaks */
     $text = str_replace("\n", ' ', $text);
     $text = str_replace("\r", ' ', $text);
     /* entify chars */
     $text = htmlEntities($text);
     /* remove special MODx tags - chunks, snippets, etc.
      * If we don't do this they'll end up expanded in the description.
      */
     $text = $modx->stripTags($text);
     $words = preg_split("/\\s+/", $text, $excerpt_length + 1);
     if (count($words) > $excerpt_length) {
         array_pop($words);
         array_push($words, '...');
         $text = implode(' ', $words);
     }
     return trim(stripslashes($text));
 }
Example #13
0
/**
 * @brief Prints build table.
 *
 * @param buildsets Array of buildsets to display.
 * @param builders Array of builders (arrays of builds per buildset).
 */
function printBuildTable($buildsets, $builders)
{
    // sort builders by their name
    uksort($builders, "builderCmp");
    // output table header
    print '<table class="dashboard"><tr><td></td>' . "\n";
    foreach ($buildsets as $buildset) {
        $ts = gmdate('Y-m-d H:i:s', $buildset->timestamp) . ' UTC';
        print "<td class='revision' title='{$ts}'>";
        print '#' . htmlentities($buildset->buildsetid) . ': ';
        print htmlentities($buildset->revision);
        print "<br/><span class='name'>" . htmlentities($buildset->name) . '</span>';
        print "</td>\n";
    }
    foreach ($builders as $buildername => $builderinfo) {
        print "<tr>\n";
        print '<td>' . htmlentities($buildername) . "</td>\n";
        foreach ($buildsets as $buildset) {
            $buildsetid = $buildset->buildsetid;
            if (array_key_exists($buildsetid, $builderinfo)) {
                $status = $builderinfo[$buildsetid]->status;
            } else {
                $status = '-';
            }
            if (statusHasOutput($status)) {
                // FIXME: might need some kind of escaping here
                $build_url = htmlEntities(WEB_ROOT . "/builds/{$buildsetid}/{$buildername}", ENT_QUOTES);
                $cell = "<a href='{$build_url}'>{$status}</a>";
            } else {
                $cell = $status;
            }
            $class = classFromStatus($status);
            print "<td class='{$class}'>{$cell}</td>\n";
        }
        print "</tr>\n";
    }
    print "</table>\n";
}
Example #14
0
function Kizano_View_Escape($input)
{
    $result = htmlEntities($input, ENT_QUOTES, 'utf-8');
    return $result;
}
Example #15
0
<?php

$titre = "Connexion";
include_once "connexion_base.php";
include_once "utile.php";
include_once "header.php";
$probleme = "";
if (isset($_POST["send"])) {
    if (isset($_POST["pseudo"]) && isset($_POST["motDePasse"]) && !empty($_POST["pseudo"]) && !empty($_POST["motDePasse"])) {
        //recuperation des données du formulaire
        $pseudo = addslashes(htmlEntities($_POST["pseudo"]));
        $motDePasse = md5(addslashes(htmlEntities($_POST["motDePasse"])));
        //requete
        $sql = "SELECT Pseudo, Nom, Prenom, Avatar, Aires, CalculsElementaires, ChangementDunites, Configurations, EcrituresLitterales, Equations, FonctionLineaire, Grandeurs, Inequations, NombresEntiers, NombresRationnels, NotionDeFonction, NotionDeProbabilite, Statistique, Volumes, Score FROM individu WHERE Pseudo='{$pseudo}' and MotDePasse='{$motDePasse}'";
        //envoi de la requete
        $resultat1 = $connexion->query($sql);
        if ($resultat1->rowCount() > 0) {
            //l'utilisateur existe
            session_start();
            $resultat2 = $resultat1->fetchALL(PDO::FETCH_ASSOC);
            foreach ($resultat2[0] as $k => $v) {
                $_SESSION[$k] = $v;
            }
            header("Location:index.php");
        } else {
            echo "<script type=\"text/javascript\">";
            echo "alert('Erreur de pseudo ou de mot de passe');";
            echo "window.history.back();";
            echo "</script>";
        }
    }
function dbDebug ( $query ) {
#----------------------------------------------------------------------

  echo "<table border='1'>";
  foreach ( dbQuery( $query ) as $row ) {
    echo "<tr>";
    foreach ( array_values( $row ) as $value )
      echo "<td>" . htmlEntities( $value ) . "</td>"; 
    echo "</tr>";
  }
  echo "</table>";
}
Example #17
0
 private function _formatKeyValue($key, $value)
 {
     return '<input type="hidden" name="' . $key . '" value="' . htmlEntities($value) . '"/>';
 }
Example #18
0
 protected function renderPleaseWaitDivInString($visible = 0)
 {
     $msg = $this->lookUpLocale(OpfLocalization::MSG_PLEASE_WAIT);
     $str = '<div id="' . $this->responseDivId . '"';
     if ($visible == 0) {
         $str .= ' style="display:none">';
     } else {
         if ($visible == 1) {
             $str .= ' style="display">';
         }
     }
     // else if
     $str .= '<img src="' . OpfApplicationConfig::APP_CALLBACK_URL . OpfConfig::IMAGES_DIRECTORY . '/' . OpfConfig::INPROGRESS_GIF . '">' . htmlEntities($msg) . '</div>';
     $this->pleaseWaitDiv = $str;
     return $str;
 }
function clean_text($text, $strip_tags = true, $limit = 2000)
{
    $text = trim($text);
    if ($strip_tags) {
        $text = strip_tags($text);
    }
    // strip excess whitespace
    $text = preg_replace('/\\s\\s+/', ' ', $text);
    $text = substr($text, 0, $limit);
    $text = str_replace(';', '', $text);
    // No semicolons makes for injection-free MySQL statements.
    $text = str_replace("'", "&#8217;", $text);
    $text = htmlEntities($text, ENT_QUOTES);
    return $text;
}
Example #20
0
	<div class="container">
		<h1>
			Quiz v<?php 
echo QUIZ_VERSION;
?>
 :: Edit quiz
		</h1>

		<form id="quizEditForm" action="" method="POST">
			<div id="quiz">
				<label for="quizData"><?php 
echo $quizTitle;
?>
 quiz content</label>
				<textarea id="quizData" name="quizData" class="quizData"><?php 
echo htmlEntities($quizData);
?>
</textarea>

				<label for="quizPassword">Update quiz password</label>
				<input type="password" id="quizPassword" name="quizPassword" value=""/>
			</div>

			<div class="buttonContainer">
				<div class="button submit">Save quiz</div>
			</div>
		</form>
	</div>
	<div class="footer">
		<?php 
if ($quizTimestamp) {
Example #21
0
 public function e($text)
 {
     return htmlEntities($text, ENT_QUOTES);
 }
Example #22
0
<?php

session_start();
if (!isset($_SESSION['login_id'])) {
    die("<br/><h1>Access Forbidden</h1>");
}
include "../config_db25788.php";
$qn = htmlentities(addslashes($_POST['qn']));
$id = htmlentities(addslashes($_SESSION['login_id']));
$ans = htmlEntities(addslashes($_POST["ans"]));
if (!isset($_POST['sep'])) {
    $o = mysql_query("select * from discussion_forum where query_no='{$qn}'");
    $r = mysql_fetch_array($o);
    $u_branch = $r['user_branch'];
    $su_q = mysql_query("insert into discuss_ans values('{$qn}','" . $r["user_id"] . "','{$id}','{$ans}',CURRENT_TIMESTAMP,1)") or die(mysql_error());
    $ans = htmlentities($_POST['ans']);
    if ($su_q) {
        echo <<<s
\t
\t
\t\t<strong>{$id}</strong>
\t\t{$ans}
\t\t<p>Just Now...</p>
\t\t<script type="text/javascript">
\t\t\tdocument.getElementById('resp_no_{$qn}').innerHTML=parseInt(document.getElementById('resp_no_{$qn}').innerHTML)+1;
\t\t</script>
s;
    }
} else {
    $cat = htmlentities(addslashes($_POST['sep']));
    $o = mysql_query("select * from discussion_gcg where query_no='{$qn}'");
Example #23
0
    if (!$verif_caracteres && !empty($_POST['pseudo'])) {
        $msg .= "<div class='erreur'>Caractères acceptés : A à Z et de 0 à 9</div>";
    }
    if (strlen($_POST['pseudo']) < 3 || strlen($_POST['pseudo']) > 15) {
        $msg .= "<div class='erreur'>Le pseudo doit être compris entre 4 et 14 caractères</div>";
    }
    if (strlen($_POST['mdp']) < 3 || strlen($_POST['mdp']) > 32) {
        $msg .= "<div class='erreur'>Le mot de passe doit être compris entre 4 et 14 caractères</div>";
    }
    if (empty($msg)) {
        $membre = executerequete("SELECT * FROM membre WHERE pseudo='{$_POST['pseudo']}'");
        if ($membre->num_rows > 0) {
            $msg .= "<div class='erreur'>Pseudo indisponible</div>";
        } else {
            foreach ($_POST as $indices => $valeurs) {
                $_POST[$indices] = htmlEntities(addslashes($valeurs));
            }
            executeRequete("INSERT INTO membre (pseudo,mdp,nom,prenom,email,sexe,ville,cp,adresse,statut) VALUES ('{$_POST['pseudo']}','{$_POST['mdp']}','{$_POST['nom']}','{$_POST['prenom']}','{$_POST['email']}','{$_POST['sexe']}','{$_POST['ville']}','{$_POST['cp']}','{$_POST['adresse']}','1')");
            $msg .= "<div class='validation'>Création d'un nouvel administrateur effectué.</div>";
        }
    }
}
echo '<div id="creation_admin" style="display:none;">';
echo $msg;
?>
	<h1>Création d'un nouvel administrateur</h1>
		
      <form method="post" action="gestion_membre.php" id="form_newAdmin">
        <label for="pseudo" class="gras">Pseudo</label>
        <input type="text" id="pseudo" name="pseudo" value="" maxlength="14" data-tooltip-stickto="right" data-tooltip="caractères acceptés : a-zA-Z0-9_." required="required" class="design_input"><br>
Example #24
0
function htmlEnt($string)
{
    return htmlEntities($string, ENT_COMPAT | ENT_HTML401, ini_get("default_charset"), false);
}
Example #25
0
:
				</label>
			</td>
			<td>
				<?php 
$editor = JFactory::getEditor();
echo $editor->display('message', htmlspecialchars($this->item->message, ENT_COMPAT, 'UTF-8'), '550', '400', '60', '20', array('pagebreak'));
?>
            </td>

		</tr>
	</table>
	</fieldset>
</div>
<div class="clr"></div>

<input type="hidden" name="option" value="com_fss" />
<input type="hidden" name="identifier" value="<?php 
echo $this->item->identifier;
?>
" />
<input type="hidden" name="task" value="save" />
<input type="hidden" name="controller" value="helptext" />
<input type="hidden" name="translation" id="translation" value="<?php 
echo htmlEntities($this->item->translation, ENT_QUOTES, "utf-8");
?>
" />

</form>

Example #26
0
 function showlog()
 {
     echo '<PRE>';
     foreach ($this->log as $line) {
         echo htmlEntities($line) . "\n";
     }
     echo '</PRE>';
 }
 /** @nodoc */
 function _zetDB($bibtex_filenames)
 {
     $db = null;
     // Check if magic_quotes_runtime is active
     if (get_magic_quotes_runtime()) {
         // Deactivate
         // otherwise it does not work
         set_magic_quotes_runtime(false);
     }
     // default bib file, if no file is specified in the query string.
     if (!isset($bibtex_filenames) || $bibtex_filenames == "") {
         default_message();
         exit;
     }
     // first does the bibfiles exist:
     // $bibtex_filenames can be urlencoded for instance if they contain slashes
     // so we decode it
     $bibtex_filenames = urldecode($bibtex_filenames);
     // ---------------------------- HANDLING unexistent files
     foreach (explode(MULTIPLE_BIB_SEPARATOR, $bibtex_filenames) as $bib) {
         // get file extension to only allow .bib files
         $ext = pathinfo($bib, PATHINFO_EXTENSION);
         // this is a security protection
         if (BIBTEXBROWSER_LOCAL_BIB_ONLY && (!file_exists($bib) || strcasecmp($ext, 'bib') != 0)) {
             // to automate dectection of faulty links with tools such as webcheck
             header('HTTP/1.1 404 Not found');
             // escape $bib to prevent XSS
             $escapedBib = htmlEntities($bib, ENT_QUOTES);
             die('<b>the bib file ' . $escapedBib . ' does not exist !</b>');
         }
     }
     // end for each
     // ---------------------------- HANDLING HTTP If-modified-since
     // testing with $ curl -v --header "If-Modified-Since: Fri, 23 Oct 2010 19:22:47 GMT" "... bibtexbrowser.php?key=wasylkowski07&bib=..%252Fstrings.bib%253B..%252Fentries.bib"
     // and $ curl -v --header "If-Modified-Since: Fri, 23 Oct 2000 19:22:47 GMT" "... bibtexbrowser.php?key=wasylkowski07&bib=..%252Fstrings.bib%253B..%252Fentries.bib"
     // save bandwidth and server cpu
     // (imagine the number of requests from search engine bots...)
     $bib_is_unmodified = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']);
     foreach (explode(MULTIPLE_BIB_SEPARATOR, $bibtex_filenames) as $bib) {
         $bib_is_unmodified = $bib_is_unmodified && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) > filemtime($bib);
     }
     // end for each
     if ($bib_is_unmodified && !headers_sent()) {
         header("HTTP/1.1 304 Not Modified");
         exit;
     }
     // ---------------------------- HANDLING caching of compiled bibtex files
     // for sake of performance, once the bibtex file is parsed
     // we try to save a "compiled" in a txt file
     $compiledbib = 'bibtexbrowser_' . md5($bibtex_filenames) . '.dat';
     $parse = filemtime(__FILE__) > @filemtime($compiledbib);
     // do we have a compiled version ?
     if (is_file($compiledbib) && is_readable($compiledbib) && filesize($compiledbib) > 0) {
         $f = fopen($compiledbib, 'r+');
         // some Unix seem to consider flock as a writing operation
         //we use a lock to avoid that a call to bibbtexbrowser made while we write the object loads an incorrect object
         if (flock($f, LOCK_EX)) {
             $s = filesize($compiledbib);
             $ser = fread($f, $s);
             $db = @unserialize($ser);
             flock($f, LOCK_UN);
         } else {
             die('could not get the lock');
         }
         fclose($f);
         // basic test
         // do we have an correct version of the file
         if (!is_a($db, 'BibDataBase')) {
             unlink($compiledbib);
             if (BIBTEXBROWSER_DEBUG) {
                 die('$db not a BibDataBase. please reload.');
             }
             $parse = true;
         }
     } else {
         $parse = true;
     }
     // we don't have a compiled version
     if ($parse) {
         //echo '<!-- parsing -->';
         // then parsing the file
         $db = createBibDataBase();
         foreach (explode(MULTIPLE_BIB_SEPARATOR, $bibtex_filenames) as $bib) {
             $db->load($bib);
         }
     }
     $updated = false;
     // now we may update the database
     if (!file_exists($compiledbib)) {
         @touch($compiledbib);
         $updated = true;
         // limit case
     } else {
         foreach (explode(MULTIPLE_BIB_SEPARATOR, $bibtex_filenames) as $bib) {
             // is it up to date ? wrt to the bib file and the script
             // then upgrading with a new version of bibtexbrowser triggers a new compilation of the bib file
             if (filemtime($bib) > filemtime($compiledbib) || filemtime(__FILE__) > filemtime($compiledbib)) {
                 //       echo "updating  ".$bib;
                 $db->update($bib);
                 $updated = true;
             }
         }
     }
     //   echo var_export($parse);
     //   echo var_export($updated);
     $saved = false;
     // are we able to save the compiled version ?
     // note that the compiled version is saved in the current working directory
     if (($parse || $updated) && is_writable($compiledbib)) {
         // we use 'a' because the file is not locked between fopen and flock
         $f = fopen($compiledbib, 'a');
         //we use a lock to avoid that a call to bibbtexbrowser made while we write the object loads an incorrect object
         if (flock($f, LOCK_EX)) {
             //       echo '<!-- saving -->';
             ftruncate($f, 0);
             fwrite($f, serialize($db));
             flock($f, LOCK_UN);
             $saved = true;
         } else {
             die('could not get the lock');
         }
         fclose($f);
     }
     // end saving the cached verions
     //else echo '<!-- please chmod the directory containing the bibtex file to be able to keep a compiled version (much faster requests for large bibtex files) -->';
     return array(&$db, $parse, $updated, $saved);
 }
 function dbDebug($query)
 {
     echo "<table border='1'>";
     foreach ($this->dbQuery($query) as $result) {
         echo "<tr>";
         foreach (get_object_vars($result) as $property => $value) {
             echo "<td>" . htmlEntities($value) . "</td>";
         }
         echo "</tr>";
     }
     echo "</table>";
 }
Example #29
0
<?php

require '../../config.php';
$oData = $oRequestData = $_POST ? $_POST : $_GET;
if (!$oData['codigo_producto']) {
    echo false;
    exit;
}
$sql = "SELECT t1.id_producto,t1.codigo_producto,\n\tCONCAT (t2.tipo_producto, ' ' , \n\t\tCASE\n                    WHEN t1.id_marca != 1 THEN CONCAT(t3.nombre_marca,' ') ELSE ''\n\t\tEND \n\t\t,t1.detalle_producto) AS detalle,t1.precio_final_producto,t1.stock_actual_producto,t1.id_registro_estado\n        FROM productos t1\n        INNER JOIN tipo_producto t2 ON t1.id_tipo_producto = t2.id_tipo_producto\n        INNER JOIN marcas t3 ON t1.id_marca = t3.id_marca \n        WHERE codigo_producto=" . $oData['codigo_producto'];
$result = mysql_query($sql);
if (mysql_num_rows($result)) {
    if ($row = mysql_fetch_array($result)) {
        echo $row["id_producto"] . "|" . htmlEntities($row["detalle"]) . "|" . $row["precio_final_producto"] . "|" . $row["stock_actual_producto"] . "|" . $row["id_registro_estado"];
    }
} else {
    echo false;
}
Example #30
0
 /**
  * Show internal log
  *
  * @param	string 		which log to log show, 'raw' or 'xml'
  *
  * @param	string		format to display: 'html' (default) or 'raw'
  *
  */
 function showLog($log, $format = 'html')
 {
     echo '<PRE>';
     foreach ($this->log[$log] as $line) {
         switch ($format) {
             case 'raw':
                 echo $line . "\n";
                 break;
             case 'html':
             default:
                 echo htmlEntities($line) . "\n";
                 break;
         }
     }
     echo '</PRE>';
 }