Example #1
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);
Example #2
0
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    </head>
    <body>
        <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>';
Example #3
0
      `km`=[value-8]
     */
     XDb::xSql("UPDATE `cache_moved` SET `date`= ? WHERE log_id = ?", date('Y-m-d H:i:s', mktime($log_date_hour, $log_date_min, 0, $log_date_month, $log_date_day, $log_date_year)), $log_id);
 }
 //store?
 if (isset($_POST['submitform']) && $date_not_ok == false && $logtype_not_ok == false && $pw_not_ok == false) {
     //store changed data
     // The following code will update last_modified and edit_count even
     // if nothing else is changed in cache_logs. For the case this
     // is to be optimized so that last_modified and edit_count are updated
     // only if there is a real modification, don't forget to update it also
     // if just a recommendation ("rating") is added or withdrawn (which is
     // stored in another table)! This is also necessary for proper OKAPI
     // replication of log entries
     // (see https://github.com/opencaching/okapi/issues/383).
     XDb::xSql("UPDATE `cache_logs`\n                        SET `type`=?, `date`=?, `text`=?, `text_html`=?, `text_htmledit`=?, `last_modified`=NOW(),\n                            `edit_by_user_id` = ?, `edit_count`= edit_count + 1\n                        WHERE `id`=?", $log_type, date('Y-m-d H:i:s', mktime($log_date_hour, $log_date_min, 0, $log_date_month, $log_date_day, $log_date_year)), userInputFilter::purifyHtmlString($descMode != 1 ? $log_text : nl2br($log_text)), 1, 1, $usr['userid'], $log_id);
     //update user-stat if type changed
     if ($log_record['logtype'] != $log_type) {
         $user_rs = XDb::xSql("SELECT `founds_count`, `notfounds_count`, `log_notes_count` FROM `user`\n                            WHERE `user_id`=? ", $log_record['user_id']);
         $user_record = XDb::xFetchArray($user_rs);
         XDb::xFreeResults($user_rs);
         if ($log_record['logtype'] == 1 || $log_record['logtype'] == 7) {
             $user_record['founds_count']--;
             // recalc scores for this cache
             XDb::xSql("DELETE FROM `scores` WHERE `user_id` = ? AND `cache_id` = ?", $log_record['user_id'], $log_record['cache_id']);
             $liczba = XDb::xMultiVariableQueryValue("SELECT count(*) FROM scores WHERE cache_id=:1", 0, $log_record['cache_id']);
             $suma = XDb::xMultiVariableQueryValue("SELECT SUM(score) FROM scores WHERE cache_id=:1", 0, $log_record['cache_id']);
             // obliczenie nowej sredniej
             if ($liczba != 0) {
                 $srednia = $suma / $liczba;
             } else {
Example #4
0
 if (isset($_POST['submitform']) && $log_type == 4) {
     /*
      `longitude`=[value-6],
      `latitude`=[value-7],
      `km`=[value-8]
     */
     sql("UPDATE `cache_moved` SET\n                                 `date`='&1'\n                                 WHERE log_id = &2", date('Y-m-d H:i:s', mktime($log_date_hour, $log_date_min, 0, $log_date_month, $log_date_day, $log_date_year)), $log_id);
 }
 //store?
 if (isset($_POST['submitform']) && $date_not_ok == false && $logtype_not_ok == false && $pw_not_ok == false) {
     //store changed data
     //START: edit by FelixP - 2013'10
     $curr_edit_count = sqlValue("SELECT `edit_count` FROM `cache_logs` WHERE `id`=" . $log_id, 0);
     //requires ALTER TABLE `cache_logs` ADD `edit_by_user_id` INT NULL , ADD `edit_count` INT NOT NULL DEFAULT '0';
     $curr_edit_count++;
     sql("UPDATE `cache_logs` SET `type`='&1',\n                                                     `date`='&2',\n                                                     `text`='&3',\n                                                     `text_html`='&4',\n                                                     `text_htmledit`='&5',\n                                                     `last_modified`=NOW(),\n                                                     `edit_by_user_id` = " . $usr['userid'] . " ,\n                                                     `edit_count`={$curr_edit_count}\n                                               WHERE `id`='&6'", $log_type, date('Y-m-d H:i:s', mktime($log_date_hour, $log_date_min, 0, $log_date_month, $log_date_day, $log_date_year)), userInputFilter::purifyHtmlString($descMode != 1 ? $log_text : nl2br($log_text)), 1, 1, $log_id);
     //requires ALTER TABLE `cache_logs` ADD `edit_by_user_id` INT NULL , ADD `edit_count` INT NOT NULL DEFAULT '0';
     //END: edit by FelixP - 2013'10
     //update user-stat if type changed
     if ($log_record['logtype'] != $log_type) {
         $user_rs = sql("SELECT `founds_count`, `notfounds_count`, `log_notes_count` FROM `user` WHERE `user_id`='&1'", $log_record['user_id']);
         $user_record = sql_fetch_array($user_rs);
         mysql_free_result($user_rs);
         if ($log_record['logtype'] == 1 || $log_record['logtype'] == 7) {
             $user_record['founds_count']--;
             // recalc scores for this cache
             sql("DELETE FROM `scores` WHERE `user_id` = '&1' AND `cache_id` = '&2'", $log_record['user_id'], $log_record['cache_id']);
             $sql = "SELECT count(*) FROM scores WHERE cache_id='" . sql_escape($log_record['cache_id']) . "'";
             $liczba = mysql_result(mysql_query($sql), 0);
             $sql = "SELECT SUM(score) FROM scores WHERE cache_id='" . sql_escape($log_record['cache_id']) . "'";
             $suma = @mysql_result(@mysql_query($sql), 0) + 0;