Ejemplo n.º 1
0
 static function getConfig()
 {
     global $debug_page;
     if (self::$config !== null) {
         return self::$config;
     }
     $useCache = !(isset($debug_page) ? $debug_page : false);
     $cache_key = 'HTMLPurifierConfig';
     $result = $useCache ? apc_fetch($cache_key) : false;
     if ($result === false) {
         $result = self::createConfig();
         // finalize and lock the config
         $result->getHTMLDefinition();
         $result->getCSSDefinition();
         $result->getURIDefinition();
         if ($useCache) {
             apc_store($cache_key, $result, 60);
             # cache it for 60 seconds
         }
     }
     return self::$config = $result;
 }
Ejemplo n.º 2
0
 }
 if ($sel_region != "0") {
     $code3 = $sel_region;
     $adm3 = sqlValue("SELECT `name` FROM `nuts_codes` WHERE `code`='" . sql_escape($sel_region) . "'", 0);
 } else {
     $code3 = null;
     $adm3 = null;
 }
 sql("INSERT INTO `cache_location` (cache_id,adm1,adm3,code1,code3) VALUES ('&1','&2','&3','&4','&5')", $cache_id, $adm1, $adm3, $code1, $code3);
 // update cache last modified, it is for work of cache_locations update information
 sql("UPDATE `caches` SET `last_modified`=NOW() WHERE `cache_id`='&1'", $cache_id);
 // waypoint erstellen
 setCacheWaypoint($cache_id, $oc_waypoint);
 $desc_uuid = create_uuid();
 //add record to cache_desc table
 $desc = userInputFilter::purifyHtmlString($desc);
 $query = "INSERT INTO `cache_desc` (\n                                                `cache_id`,\n                                                `language`,\n                                                `desc`,\n                                                `hint`,\n                                                `short_desc`,\n                                                `last_modified`,\n                                                `uuid`,\n                                                `node`\n                                            ) VALUES (:1, :2, :3, :4, :5, NOW(), :6, :7)";
 $db->multiVariableQuery($query, $cache_id, $sel_lang, $desc, nl2br(htmlspecialchars($hints, ENT_COMPAT, 'UTF-8')), $short_desc, $desc_uuid, $oc_nodeid);
 setCacheDefaultDescLang($cache_id);
 // insert cache-attributes
 for ($i = 0; $i < count($cache_attribs); $i++) {
     if ($cache_attribs[$i] + 0 > 0) {
         sql("INSERT INTO `caches_attributes` (`cache_id`, `attrib_id`) VALUES ('&1', '&2')", $cache_id, $cache_attribs[$i] + 0);
     }
 }
 // only if no approval is needed and cache is published NOW or activate_date is in the past
 if (!$needs_approvement && ($publish == 'now' || $publish == 'later' && mktime($activate_hour, 0, 0, $activate_month, $activate_day, $activate_year) <= $today)) {
     //do event handling
     include_once $rootpath . '/lib/eventhandler.inc.php';
     event_notify_new_cache($cache_id + 0);
     event_new_cache($usr['userid'] + 0);
Ejemplo n.º 3
0
     $tmplog_username_aktywnosc = '';
     $tmplog_username = tr('cog_user_name');
 }
 $tmplog = mb_ereg_replace('{username_aktywnosc}', $tmplog_username_aktywnosc, $tmplog);
 // mobile caches by Łza
 if ($record['type'] == 4 && $record['mobile_latitude'] != 0) {
     $tmplog_kordy_mobilnej = mb_ereg_replace(" ", "&nbsp;", htmlspecialchars(help_latToDegreeStr($record['mobile_latitude']), ENT_COMPAT, 'UTF-8')) . '&nbsp;' . mb_ereg_replace(" ", "&nbsp;", htmlspecialchars(help_lonToDegreeStr($record['mobile_longitude']), ENT_COMPAT, 'UTF-8'));
     $tmplog = mb_ereg_replace('{kordy_mobilniaka}', $record['km'] . ' km [<img src="tpl/stdstyle/images/blue/szczalka_mobile.png" title="' . tr('viewlog_kordy') . '" />' . $tmplog_kordy_mobilnej . ']', $tmplog);
 } else {
     $tmplog = mb_ereg_replace('{kordy_mobilniaka}', ' ', $tmplog);
 }
 if ($record['text_html'] == 0) {
     $processed_text = htmlspecialchars($processed_text, ENT_COMPAT, 'UTF-8');
     $processed_text = help_addHyperlinkToURL($processed_text);
 } else {
     $processed_text = userInputFilter::purifyHtmlStringAndDecodeHtmlSpecialChars($processed_text);
 }
 $processed_text = str_replace($smileytext, $smileyimage, $processed_text);
 $tmplog_text = $processed_text . $edit_footer;
 $tmplog = mb_ereg_replace('{show_deleted}', $show_deleted, $tmplog);
 $tmplog = mb_ereg_replace('{username}', $tmplog_username, $tmplog);
 $tmplog = mb_ereg_replace('{userid}', $record['userid'], $tmplog);
 $tmplog = mb_ereg_replace('{date}', $tmplog_date, $tmplog);
 $tmplog = mb_ereg_replace('{type}', $record['text_listing'], $tmplog);
 $tmplog = mb_ereg_replace('{logtext}', $tmplog_text, $tmplog);
 $tmplog = mb_ereg_replace('{logimage}', '<a href="viewlogs.php?logid=' . $record['log_id'] . '">' . icon_log_type($record['icon_small'], $record['log_id']) . '</a>', $tmplog);
 $tmplog = mb_ereg_replace('{log_id}', $record['log_id'], $tmplog);
 //$rating_picture
 if ($record['recommended'] == 1 && $record['type'] == 1) {
     $tmplog = mb_ereg_replace('{ratingimage}', '<img src="images/rating-star.png" alt="' . tr('recommendation') . '" />', $tmplog);
 } else {
Ejemplo n.º 4
0
     }
 }
 //set template vars
 tpl_set_var('cachename', htmlspecialchars($cache_name, ENT_COMPAT, 'UTF-8'));
 tpl_set_var('logtypeoptions', $logtypeoptions);
 tpl_set_var('logmin', htmlspecialchars($log_date_min, ENT_COMPAT, 'UTF-8'));
 tpl_set_var('loghour', htmlspecialchars($log_date_hour, ENT_COMPAT, 'UTF-8'));
 tpl_set_var('logday', htmlspecialchars($log_date_day, ENT_COMPAT, 'UTF-8'));
 tpl_set_var('logmonth', htmlspecialchars($log_date_month, ENT_COMPAT, 'UTF-8'));
 tpl_set_var('logyear', htmlspecialchars($log_date_year, ENT_COMPAT, 'UTF-8'));
 tpl_set_var('cachename', htmlspecialchars($cache_name, ENT_COMPAT, 'UTF-8'));
 tpl_set_var('cacheid', $log_record['cache_id']);
 tpl_set_var('logid', $log_id);
 tpl_set_var('date_message', $date_not_ok == true ? $date_message : '');
 tpl_set_var('bodyMod', ' onload="chkMoved()"');
 $log_text = userInputFilter::purifyHtmlStringAndDecodeHtmlSpecialChars($log_text);
 tpl_set_var('logtext', htmlspecialchars($log_text, ENT_NOQUOTES, 'UTF-8'), true);
 tpl_set_var('descMode', $descMode);
 if ($use_log_pw == true && $log_pw != '') {
     if ($pw_not_ok == true && isset($_POST['submitform'])) {
         tpl_set_var('log_pw_field', $log_pw_field_pw_not_ok);
     } else {
         tpl_set_var('log_pw_field', $log_pw_field);
     }
 } else {
     tpl_set_var('log_pw_field', '');
 }
 // build smilies
 $smilies = '';
 for ($i = 0; $i < count($smileyshow); $i++) {
     if ($smileyshow[$i] == '1') {
Ejemplo n.º 5
0
        <form action="" method="post">
            <textarea cols="100" rows="15" name="html"><?php 
if (isset($_POST['html'])) {
    echo htmlentities($_POST['html'], ENT_NOQUOTES, 'UTF-8');
}
?>
</textarea>
            <br><input type="submit">
        </form>
        <?php 
if (isset($_POST['html'])) {
    $context = array();
    $clean = userInputFilter::purifyHtmlString($_POST['html'], $context);
    $errors = @$context['errors'];
    if (isset($errors)) {
        echo $errors->getHTMLFormatted(userInputFilter::getConfig());
    }
    echo '<pre>';
    echo htmlentities($clean, ENT_NOQUOTES | ENT_HTML401, 'UTF-8');
    echo '</pre>';
    //echo '<hr>';
    //echo '<pre>';
    //echo htmlentities(htmlspecialchars_decode($clean), ENT_NOQUOTES | ENT_HTML401, 'UTF-8');
    //echo '</pre>';
    //echo '<hr>';
    //$clean2 = userInputFilter::purifyHtmlString($clean);
    //if ($clean2 == $clean){
    //    echo '<p>Clean 2 OK</p>';
    //}
    echo '<hr>';
    echo $clean;