/**
  * 生成API的token
  * @access	public
  * @param	string $prefix 请求应用接口名
  * @return	string|boolean
  */
 public function apiAccessToken($prefix = '')
 {
     $token = create_uuid($prefix);
     $second = 7500;
     $start_time = time();
     $end_time = $start_time + $second;
     $data = array('token' => $token, 'expires_in' => $second, 'expires_start' => $start_time, 'expires_end' => $end_time);
     $id = M('api_token')->add($data);
     if ($id) {
         return $token;
     } else {
         return false;
     }
 }
Exemple #2
0
 public function action_gif()
 {
     header('Content-Type: image/gif');
     //header('P3P: CP=CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR');
     if (!empty($_COOKIE['r'])) {
         exit;
     }
     setcookie('r', 1, time() + 1);
     if (empty($_COOKIE['UUID'])) {
         $uuid = create_uuid();
         setcookie('UUID', $uuid, strtotime('+1 year'));
     } else {
         $uuid = $_COOKIE['UUID'];
     }
     $time = date('Y-m-d H:i:s');
     $ip = get_client_ip();
     $ua = $_SERVER['HTTP_USER_AGENT'];
     $allowed = array('domain', 'url', 'title', 'referrer', 'sw', 'sh', 'lang');
     $params = array_intersect_key($_REQUEST, array_flip($allowed));
     array_unshift($params, $time, $uuid, $ip, $ua);
     include APPPATH . 'media/1.gif';
     error_log(implode("\t", $params) . "\n", 3, "D:/tmp/a_" . date('Ymd') . ".txt");
     exit;
 }
 if ($sel_region == -1) {
     $sel_region = $default_region;
 }
 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';
 /**
  * 6 months from last
  * @param type $rs
  */
 private function archiveGeocache($rs)
 {
     /* @var $db dataBase */
     $db = \lib\Database\DataBaseSingleton::Instance();
     $statusSqlQuery = "REPLACE INTO cache_arch (cache_id, step) VALUES ( :1, :2 )";
     $archSqlQuery = "UPDATE caches SET status = 3 WHERE cache_id= :1 ";
     $logSqlQuery = "INSERT INTO cache_logs (cache_id, uuid, user_id, type, date, last_modified, date_created, text, owner_notified, node) VALUES ( :1, :2, '-1', 9,NOW(),NOW(), NOW(), :3, 1, 2)";
     $db->beginTransaction();
     $db->multiVariableQuery($statusSqlQuery, (int) $rs['cache_id'], $this->step["ARCH_COMPLETE"]);
     $db->multiVariableQuery($archSqlQuery, (int) $rs['cache_id']);
     $db->multiVariableQuery($logSqlQuery, (int) $rs['cache_id'], create_uuid(), tr('autoArchive_12'));
     $transactionResult = $db->commit();
     if ($transactionResult) {
         $this->sendEmail($this->step["AFTER_SECOND_MAIL_SENT"], $rs['cache_id']);
     }
 }
Exemple #5
0
 }
 // if it is first log "cache mooved" then move start coordinates from table caches
 // to table cache_moved and create log type cache_moved, witch description
 // "depart point" or something like this.
 //$count = mysql_result($result, 0);
 $is_any_cache_movedlog = mysql_result(sql("SELECT COUNT(*) FROM `cache_moved` WHERE `cache_id` ='&1'", sql_escape($cache_id)), 0);
 if ($is_any_cache_movedlog == 0) {
     $tmp_move_query = sql("SELECT `user_id`, `longitude`, `latitude`, `date_hidden` FROM `caches` WHERE `cache_id` ='&1'", sql_escape($cache_id));
     $tmp_move_data = mysql_fetch_array($tmp_move_query);
     // create initial log in cache_logs and copy coords to table caches
     $init_log_desc = tr('log_mobile_init');
     $init_log_latitude = $tmp_move_data['latitude'];
     $init_log_longitude = $tmp_move_data['longitude'];
     $init_log_userID = $tmp_move_data['user_id'];
     $init_log_date = $tmp_move_data['date_hidden'];
     $init_log_uuid = create_uuid();
     sql("INSERT INTO `cache_logs` (`id`, `cache_id`, `user_id`, `type`, `date`, `text`, `text_html`, `text_htmledit`, `date_created`, `last_modified`, `uuid`, `node`)\n                                      VALUES                   ('',   '&1',       '&2',      '&3',   '&4',   '&5',   '&6',        '&7',             NOW(),           NOW(),          '&8',   '&9')", $cache_id, $init_log_userID, 4, $init_log_date, $init_log_desc, 0, 0, $init_log_uuid, $oc_nodeid);
     $last_id_4_init_log = mysql_insert_id();
     // print $init_log_longitude; exit;
     sql("INSERT INTO `cache_moved`(\n                                                     `cache_id`,\n                                                     `user_id`,\n                                                     `log_id`,\n                                                     `date`,\n                                                     `longitude`,\n                                                     `latitude`,\n                                                     `km`)\n                                             VALUES (\n                                                     '&1',\n                                                     '&2',\n                                                     '&3',\n                                                     '&4',\n                                                     '&5',\n                                                     '&6',\n                                                     '0'\n                                                    )", sql_escape($cache_id), $init_log_userID, $last_id_4_init_log, $init_log_date, $init_log_longitude, $init_log_latitude);
     $dystans = sprintf("%.2f", calcDistance($init_log_latitude, $init_log_longitude, $wspolrzedneNS, $wspolrzedneWE));
 } else {
     // $log_date - data+czas logu
     // calculate distance from piervous
     $ostatnie_dane_mobilniaka = mysql_fetch_array(mysql_query("\n                                      SELECT\n                                              `id`,\n                                              `user_id`,\n                                              `log_id`,\n                                              `date`,\n                                              `longitude`,\n                                              `latitude`,\n                                              `km`\n                                        FROM  `cache_moved`\n                                        WHERE `cache_id` = '{$cache_id}'\n\n                                        ORDER BY id DESC\n                                        LIMIT 1\n                                        "));
     // jeśli beżący (właśnie wpisywany) log jest ostatnim,
     // dystans zostanie wpisany do bazy. w przeciwnym wypadku
     // zmienna zostanie zastąpiona w if-ie
     $dystans = sprintf("%.2f", calcDistance($ostatnie_dane_mobilniaka['latitude'], $ostatnie_dane_mobilniaka['longitude'], $wspolrzedneNS, $wspolrzedneWE));
     // check if log date is beetwen, or last
     if ($log_date <= $ostatnie_dane_mobilniaka['date']) {
Exemple #6
0
function savequery($queryid, $queryname, $saveas, $submit, $saveas_queryid)
{
    global $usr, $tplname;
    global $error_empty_name, $nosaveastext, $saveastext, $error_queryname_exists;
    $displayform = $submit == false;
    $error_no_name = false;
    $error_duplicate_name = false;
    // ok ... checken, ob die query uns gehört und dann speichern
    $rs = sql("SELECT `user_id` FROM `queries` WHERE `id`='&1' AND (`user_id`=0 OR `user_id`='&2')", $queryid, $usr['userid']);
    if (mysql_num_rows($rs) == 0) {
        echo 'fatal error: query not found or permission denied';
        exit;
    }
    mysql_free_result($rs);
    if ($saveas == false) {
        if ($displayform == false && $queryname == '') {
            $displayform = true;
            $error_no_name = true;
        } else {
            // prüfen ob name bereits vorhanden
            $rs = sql("SELECT COUNT(*) `c` FROM `queries` WHERE `user_id`='&1' AND `name`='&2'", $usr['userid'], $queryname);
            $r = sql_fetch_array($rs);
            mysql_free_result($rs);
            if ($r['c'] > 0) {
                $displayform = true;
                $error_duplicate_name = true;
            }
        }
    } else {
        if ($saveas_queryid == 0) {
            $displayform = true;
        } else {
            // prüfen ob saveas_queryid existiert und uns gehört
            $rs = sql("SELECT `user_id` FROM `queries` WHERE `id`='&1' AND (`user_id`=0 OR `user_id`='&2')", $saveas_queryid, $usr['userid']);
            if (mysql_num_rows($rs) == 0) {
                echo 'fatal error: saveas_query not found or permission denied';
                exit;
            }
            mysql_free_result($rs);
        }
    }
    if ($displayform == true) {
        // abfrageform für name
        $tplname = 'savequery';
        if ($error_no_name == true) {
            tpl_set_var('nameerror', $error_empty_name);
        } else {
            if ($error_duplicate_name == true) {
                tpl_set_var('nameerror', $error_queryname_exists);
            } else {
                tpl_set_var('nameerror', '');
            }
        }
        tpl_set_var('queryname', htmlspecialchars($queryname, ENT_COMPAT, 'UTF-8'));
        tpl_set_var('queryid', htmlspecialchars($queryid, ENT_COMPAT, 'UTF-8'));
        // oldqueries auslesen
        $options = '';
        $rs = sql("SELECT `id`, `name` FROM `queries` WHERE `user_id`='&1' ORDER BY `name` ASC", $usr['userid']);
        if (mysql_num_rows($rs) == 0) {
            tpl_set_var('selecttext', $nosaveastext);
            tpl_set_var('oldqueries', '');
        } else {
            tpl_set_var('selecttext', $saveastext);
            while ($r = sql_fetch_array($rs)) {
                if ($r['id'] == $queryid) {
                    $options .= '<option value="' . $r['id'] . '" selected="selected">' . htmlspecialchars($r['name'], ENT_COMPAT, 'UTF-8') . '</option>' . "\n";
                } else {
                    $options .= '<option value="' . $r['id'] . '">' . htmlspecialchars($r['name'], ENT_COMPAT, 'UTF-8') . '</option>' . "\n";
                }
            }
            mysql_free_result($rs);
            tpl_set_var('oldqueries', $options);
        }
        tpl_BuildTemplate();
        exit;
    }
    $rs = sql("SELECT `options` FROM `queries` WHERE `id`='&1'", $queryid);
    $r = sql_fetch_array($rs);
    mysql_free_result($rs);
    // ok, speichern
    if ($saveas == true) {
        sql("UPDATE `queries` SET `options`='&1', `last_queried`=NOW() WHERE `id`='&2'", $r['options'], $saveas_queryid);
    } else {
        sql("INSERT INTO `queries` (`user_id`, `last_queried`, `name`, `uuid`, `options`) VALUES ( '&1', NOW(), '&2', '&3', '&4')", $usr['userid'], $queryname, create_uuid(), $r['options']);
    }
    tpl_redirect('query.php?action=view');
}
function notifyOwner($cacheid, $msgType)
{
    // msgType - 0 = cache accepted, 1 = cache declined (=archived)
    global $stylepath, $usr, $octeam_email, $site_name, $absolute_server_URI, $octeamEmailsSignature;
    $user_id = getCacheOwnerId($cacheid);
    $cachename = getCachename($cacheid);
    if ($msgType == 0) {
        $email_content = file_get_contents($stylepath . '/email/activated_cache.email');
    } else {
        $email_content = file_get_contents($stylepath . '/email/archived_cache.email');
    }
    $email_headers = "Content-Type: text/plain; charset=utf-8\r\n";
    $email_headers .= "From: {$site_name} <{$octeam_email}>\r\n";
    $email_headers .= "Reply-To: {$octeam_email}\r\n";
    $email_content = mb_ereg_replace('{server}', $absolute_server_URI, $email_content);
    $email_content = mb_ereg_replace('{cachename}', $cachename, $email_content);
    $email_content = mb_ereg_replace('{cacheid}', $cacheid, $email_content);
    $email_content = mb_ereg_replace('{octeamEmailsSignature}', $octeamEmailsSignature, $email_content);
    $email_content = mb_ereg_replace('{cacheArchived_01}', tr('cacheArchived_01'), $email_content);
    $email_content = mb_ereg_replace('{cacheArchived_02}', tr('cacheArchived_02'), $email_content);
    $email_content = mb_ereg_replace('{cacheArchived_03}', tr('cacheArchived_03'), $email_content);
    $email_content = mb_ereg_replace('{cacheArchived_04}', tr('cacheArchived_04'), $email_content);
    $email_content = mb_ereg_replace('{cacheArchived_05}', tr('cacheArchived_05'), $email_content);
    $email_content = mb_ereg_replace('{Cacheactivated_01}', tr('Cacheactivated_01'), $email_content);
    $email_content = mb_ereg_replace('{Cacheactivated_02}', tr('Cacheactivated_02'), $email_content);
    $email_content = mb_ereg_replace('{Cacheactivated_03}', tr('Cacheactivated_03'), $email_content);
    $email_content = mb_ereg_replace('{Cacheactivated_04}', tr('Cacheactivated_04'), $email_content);
    $email_content = mb_ereg_replace('{Cacheactivated_05}', tr('Cacheactivated_05'), $email_content);
    $owner_email = XDb::xMultiVariableQueryValue("SELECT `email` FROM `user` WHERE `user_id`= :1 LIMIT 1", '', $user_id);
    if ($msgType == 0) {
        //send email to owner
        mb_send_mail($owner_email['email'], tr('viewPending_01') . ": " . $cachename, $email_content, $email_headers);
        //send email to approver
        mb_send_mail($usr['email'], tr('viewPending_01') . ": " . $cachename, tr('viewPending_02') . ":\n" . $email_content, $email_headers);
        // generate automatic log about status cache
        $log_text = tr("viewPending_03");
        $log_uuid = create_uuid();
        XDb::xSql("INSERT INTO `cache_logs`\n                (`id`, `cache_id`, `user_id`, `type`, `date`, `text`, `text_html`, `text_htmledit`, `date_created`, `last_modified`, `uuid`, `node`,`encrypt`)\n            VALUES ('', ?, ?, '12', NOW(), ?, '0', '0', NOW(), NOW(), ?, '2', '0')", $cacheid, $usr['userid'], $log_text, $log_uuid);
    } else {
        //send email to owner
        mb_send_mail($owner_email['email'], tr('viewPending_04') . ": " . $cachename, $email_content, $email_headers);
        //send email to approver
        mb_send_mail($usr['email'], tr('viewPending_04') . ": " . $cachename, tr('viewPending_05') . ":\n" . $email_content, $email_headers);
        // generate automatic log about status cache
        $log_text = tr("viewPending_06");
        $log_uuid = create_uuid();
        XDb::xSql("INSERT INTO `cache_logs`\n                (`id`, `cache_id`, `user_id`, `type`, `date`, `text`, `text_html`, `text_htmledit`, `date_created`, `last_modified`, `uuid`, `node`,`encrypt`)\n            VALUES ('', ?, ?, ?, NOW(), ?, ?, ?, NOW(), NOW(), ?, ?, ?)", $cacheid, $usr['userid'], 12, $log_text, 0, 0, $log_uuid, 2, 0);
    }
}
Exemple #8
0
function create_uuid($prefix = "")
{
    //可以指定前缀
    $str = md5(uniqid(mt_rand(), true));
    $uuid = substr($str, 0, 8) . '-';
    $uuid .= substr($str, 8, 4) . '-';
    $uuid .= substr($str, 12, 4) . '-';
    $uuid .= substr($str, 16, 4) . '-';
    $uuid .= substr($str, 20, 12);
    return $prefix . $uuid;
}
if (isset($_GET["artist"]) && strlen($_GET["artist"]) > 0) {
    $value = trim($value);
    $GLOBAL_TYPE_PARAM = "d7bd83313b5b444";
    $GLOBAL_TIANLAI_KEY = "6ae993829ca5410e888f5e97b73ee4a810bb242149fd46ada5777edf587b4225";
    $rawr = '{"common":{"talkdeviceid":"3e3fb9ac4463b26204698da6c2e737b36","uuid":"","reqkey":"' . create_uuid() . '","updatechannel":"2","apiversion":"3.2.0","devicetype":"Android","userid":0,"imei":"1eb4acb9813301ef","systemversion":"21","login":0,"clientversion":"3.3.9","nettype":"wifi","resolution":"720X1280","language":1,"clienttype":"Android","channel":"TLKG01","imsi":null,"model":"AppRuntimeforChromeDev","product":"KALAOK"},"maxSize":100,"firstSize":0,"type":2,"keyWord":"' . $value . '"}';
    $request = base64_encode($rawr);
    $sign = md5($request . $GLOBAL_TIANLAI_KEY);
    $url = "http://sns.audiocn.org/tlcysns/content/search.action?request=" . $request . "&sign=" . $sign . "&type=" . $GLOBAL_TYPE_PARAM;
    $html = file_get_contents($url);
    ?>

<ul data-role="listview" data-split-icon="gear" id="searchlist" data-split-theme="a" data-inset="true">

<?php 
    $ret = json_decode($html, true);
    if (isset($ret["songs"])) {
        foreach ($ret["songs"] as $idx => $song) {
            mysql_query("INSERT IGNORE INTO `songs` SET `id` = {$song['id']},`name` = \"{$song['name']}\",`artist`=\"{$song['artist']}\",`imageurl`=\"{$song['singer_image']}\";");
            echo "<li><a href=\"order.php?songid=" . $song["id"] . "\" data-rel=\"dialog\" data-transition=\"pop\"><img src=\"" . $song["singer_image"] . "\"><h2>" . $song["name"] . "</h2><p>" . $song["artist"] . "</p></a></li> ";
        }
     tpl_set_var('message_end', '');
     tpl_set_var('message', $message_wrongext);
     tpl_BuildTemplate();
     exit;
 }
 // Datei zu groĂź?
 if ($_FILES['file']['size'] > $maxpicsize) {
     $tplname = 'message';
     tpl_set_var('messagetitle', $message_title_toobig);
     tpl_set_var('message_start', '');
     tpl_set_var('message_end', '');
     tpl_set_var('message', $message_toobig);
     tpl_BuildTemplate();
     exit;
 }
 $uuid = create_uuid();
 // datei verschieben und in DB eintragen
 move_uploaded_file($_FILES['file']['tmp_name'], $picdir . '/' . $uuid . '.' . $extension);
 /*
  * [EN] add EXIF (GPS info) to image
  *
  * [PL] dodanie tagów EXIF (kordów)
  */
 if ($type == 2) {
     //PHP EXIF Library
     require_once 'lib/pel/gps.php';
     // pobranie danych EXIF z obrazka
     $exif = @exif_read_data($picdir . '/' . $uuid . '.' . $extension);
     // sprawdzenie czy są już wpisane kordy
     if (@(!isset($exif["GPSLatitude"]))) {
         // addGpsInfo(file,description,comment,artist,make,model,longitude,latitude)
$date_alg = $start_date_alg;
$dStart = new DateTime($dataMax);
$dEnd = new DateTime($date_alg);
$dDiff = $dStart->diff($dEnd);
$securityPeriod = 0;
if ($titled_cache_period_prefix == "week") {
    $securityPeriod = 7;
}
if ($titled_cache_period_prefix == "month") {
    $securityPeriod = 28;
}
if ($dDiff->days < $securityPeriod) {
    exit;
}
$queryS = "\n    select\n    top.cacheId, top.cacheName, top.cacheRegion, ifnull( nrT.nrTinR, 0) nrTinR,\n    top.RATE, top.ratio,\n    top.cRating, top.cFounds, top.cNrDays, top.cDateCrt\n\n    from\n    (\n    SELECT caches.cache_id cacheId , caches.name cacheName, adm3 cacheRegion,\n    user.user_id userId, user.username userName,\n\n    round((r.rating/f.nr_founds) + DATEDIFF(caches.date_created, :1 )/5000,4) RATE,\n            round((r.rating/f.nr_founds), 4) ratio,\n\n    r.rating cRating, f.nr_founds cFounds, caches.date_created cDateCrt,\n    DATEDIFF(caches.date_created, :1 ) cNrDays\n\n    FROM `caches`\n\n    JOIN\n    (\n    SELECT lcaches.cache_id cid, count(*) rating\n    FROM `caches` lcaches\n    INNER JOIN `cache_logs` ON `cache_logs`.`cache_id` = lcaches .`cache_id`\n    JOIN cache_rating ON `cache_rating`.`cache_id` = `cache_logs`.`cache_id`\n    AND `cache_rating`.`user_id` = `cache_logs`.user_id\n    where\n    `cache_logs`.`deleted` =0 AND `cache_logs`.`type` =1\n    and cache_logs.date_created < :1\n\n    group by 1\n    )\n    as r ON r.cid = caches.cache_id\n\n    JOIN\n    (\n    SELECT fcaches.cache_id cid, count(*) nr_founds\n    FROM\n    caches fcaches\n    JOIN cache_logs ON cache_logs.cache_id = fcaches.cache_id\n\n    where\n    cache_logs.deleted=0 AND cache_logs.type=1\n    and cache_logs.date_created < :1\n\n    group by 1\n    )\n    as f ON f.cid = caches.cache_id\n\n    JOIN user ON `caches`.`user_id` = `user`.`user_id`\n    JOIN `cache_location` ON `caches`.`cache_id` = `cache_location`.`cache_id`\n    left JOIN cache_titled ON cache_titled.cache_id = caches.cache_id\n\n    WHERE\n    `status` =1\n    AND `caches`.`type` <>4 AND `caches`.`type` <>5 AND caches.type <>6\n    and f.nr_founds >= :2 and caches.date_created < :1\n    and cache_titled.cache_id is NULL\n\n    ORDER BY RATE DESC, founds DESC, caches.date_created DESC\n    LIMIT 30) as top\n\n    left join\n    (\n    select adm3 cacheRegion, count(*) nrTinR from cache_titled\n    JOIN cache_location ON cache_titled.cache_id = cache_location.cache_id\n    group by adm3\n    ) as nrT on top.cacheRegion = nrT.cacheRegion\n    order by nrTinR, cFounds DESC, cDateCrt, RATE DESC\n    ";
$s = $dbc->multiVariableQuery($queryS, $date_alg, $titled_cache_nr_found);
$rec = $dbc->dbResultFetch($s);
$queryL = "\n    SELECT i.id logId\n    FROM\n    (select cache_logs.id, cache_logs.cache_id from\n        cache_logs\n        where\n        cache_logs.cache_id = :1 and\n        cache_logs.id =\n            (select id from cache_logs cl\n            JOIN cache_rating ON `cache_rating`.`cache_id` = cl.`cache_id`\n            AND `cache_rating`.`user_id` = cl.user_id\n            where cl.cache_id = cache_logs.cache_id\n            ORDER BY length(cl.text) DESC LIMIT 1 )\n    ) as i";
$s = $dbc->multiVariableQuery($queryL, $rec["cacheId"]);
$recL = $dbc->dbResultFetchOneRowOnly($s);
$queryI = "INSERT INTO cache_titled\n        (cache_id, rate, ratio, rating, found, days, date_alg, log_id)\n        VALUES (:1, :2, :3, :4, :5, :6, :7, :8)";
$dbc->multiVariableQuery($queryI, $rec["cacheId"], $rec["RATE"], $rec["ratio"], $rec["cRating"], $rec["cFounds"], $rec["cNrDays"], $date_alg, $recL["logId"]);
$queryLogI = "INSERT INTO cache_logs\n            (cache_id, user_id, type, date,\n            text, text_html, text_htmledit, last_modified , okapi_syncbase, uuid, picturescount, mp3count,\n            date_created, owner_notified, node, deleted, encrypt,\n            del_by_user_id, last_deleted, edit_by_user_id, edit_count )\n    VALUES ( :1, :2, :3, :4, :5, :6, :7, :8 , :9 , :10, :11, :12, :13, :14, :15, '0', '0', NULL , NULL , NULL , '0' )";
$SystemUser = -1;
$LogType = 12;
//OCTeam
$ntitled_cache = $titled_cache_period_prefix . '_titled_cache_congratulations';
$msgText = tr($ntitled_cache);
$LogUuid = create_uuid();
$dbc->multiVariableQuery($queryLogI, $rec["cacheId"], $SystemUser, $LogType, $date_alg, $msgText, '1', '1', $date_alg, $date_alg, $LogUuid, '0', '0', $date_alg, '0', $oc_nodeid);
unset($dbc);
Exemple #11
0
function save_file($filename, $desdir, $tmpfile)
{
    if (is_required_type(file_exten($filename))) {
        do {
            $upload_file = create_uuid("");
            $upload_file .= "." . file_exten($filename);
            $new_file_name = $upload_file;
            $upload_file = $desdir . $upload_file;
        } while (file_exists($upload_file));
        if (move_uploaded_file($tmpfile, $upload_file)) {
            return $new_file_name;
        }
    }
}
         if (($status_old == $STATUS['READY'] || $status_old == $STATUS['TEMP_UNAVAILABLE'] || $status_old == $STATUS['BLOCKED']) && $status == $STATUS['ARCHIVED']) {
             // generate automatic log about status cache
             $log_text = tr('archived_cache');
             $log_uuid = create_uuid();
             sql("INSERT INTO `cache_logs` (`id`, `cache_id`, `user_id`, `type`, `date`, `text`, `text_html`, `text_htmledit`, `date_created`, `last_modified`, `uuid`, `node`,`encrypt`)\n                                 VALUES ('', '&1', '&2', '&3', NOW(), '&4', '&5', '&6', NOW(), NOW(), '&7', '&8','&9')", $cache_id, $usr['userid'], 9, $log_text, 0, 0, $log_uuid, $oc_nodeid, 0);
         }
         if (($status_old == $STATUS['TEMP_UNAVAILABLE'] || $status_old == $STATUS['ARCHIVED'] || $status_old == $STATUS['BLOCKED']) && $status == $STATUS['READY']) {
             // generate automatic log about status cache
             $log_text = tr('ready_to_search');
             $log_uuid = create_uuid();
             sql("INSERT INTO `cache_logs` (`id`, `cache_id`, `user_id`, `type`, `date`, `text`, `text_html`, `text_htmledit`, `date_created`, `last_modified`, `uuid`, `node`,`encrypt`)\n                                 VALUES ('', '&1', '&2', '&3', NOW(), '&4', '&5', '&6', NOW(), NOW(), '&7', '&8','&9')", $cache_id, $usr['userid'], 10, $log_text, 0, 0, $log_uuid, $oc_nodeid, 0);
         }
         if (($status_old == $STATUS['READY'] || $status_old == $STATUS['TEMP_UNAVAILABLE'] || $status_old == $STATUS['ARCHIVED']) && $status == $STATUS['BLOCKED']) {
             // generate automatic log about status cache
             $log_text = tr('blocked_by_octeam');
             $log_uuid = create_uuid();
             sql("INSERT INTO `cache_logs` (`id`, `cache_id`, `user_id`, `type`, `date`, `text`, `text_html`, `text_htmledit`, `date_created`, `last_modified`, `uuid`, `node`,`encrypt`)\n                                 VALUES ('', '&1', '&2', '&3', NOW(), '&4', '&5', '&6', NOW(), NOW(), '&7', '&8','&9')", $cache_id, $usr['userid'], 12, $log_text, 0, 0, $log_uuid, $oc_nodeid, 0);
         }
         //display cache-page
         tpl_redirect('viewcache.php?cacheid=' . urlencode($cache_id));
         exit;
     }
 } elseif (isset($_POST['show_all_countries_submit'])) {
     $show_all_countries = 1;
 }
 //here we only set up the template variables
 //build countrylist
 $countriesoptions = '';
 //check if selected country is in list_default
 if ($show_all_countries == 0) {
     $rs = sql("SELECT `short` FROM `countries` WHERE (`list_default_" . sql_escape($lang) . "`=1) AND (lower(`short`) = lower('&1'))", $cache_country);
         //foreach(array($oldOwnerId, $usr['userid']) as $key => $user_id){
         //    $params = array();
         //    $params['user_id']['value'] = $user_id;
         //    $params['user_id']['data_type'] = 'string';
         //    $db->paramQuery($sql, $params);
         //}
         // put log into cache logs.
         if ($isCachePublished) {
             $logMessage = tr('adopt_32');
             $oldUserName = '******' . $absolute_server_URI . 'viewprofile.php?userid=' . $oldOwnerId . '">' . getUsername($oldOwnerId) . '</a> ';
             $newUserName = '******' . $absolute_server_URI . 'viewprofile.php?userid=' . $usr['userid'] . '">' . getUsername($usr['userid']) . '</a>';
             $logMessage = str_replace('{oldUserName}', $oldUserName, $logMessage);
             $logMessage = str_replace('{newUserName}', $newUserName, $logMessage);
             $sql = 'INSERT INTO cache_logs(cache_id, user_id, type, date, text, text_html, text_htmledit, date_created, last_modified, uuid, node)
                         VALUES                (:1,       -1,      3,    NOW(), :2,  1,         1,             NOW(),        NOW(),         :3,   :4)';
             $db->multiVariableQuery($sql, $_GET['cacheid'], $logMessage, create_uuid(), $oc_nodeid);
         }
         $db->commit();
         $message = tr('adopt_15');
         $message = str_replace('{cacheName}', getCacheName($_GET['cacheid']), $message);
         tpl_set_var('error_msg', $message . '<br /><br />');
         tpl_set_var("error_msg", "");
         $mailContent = tr('adopt_31');
         $mailContent = str_replace('\\n', "\n", $mailContent);
         $mailContent = str_replace('{userName}', $usr['username'], $mailContent);
         $mailContent = str_replace('{cacheName}', getCacheName($_GET['cacheid']), $mailContent);
         mb_send_mail_2(getUserEmail($oldOwnerId), tr('adopt_18'), $mailContent, emailHeaders());
     }
 }
 if (isset($_GET['accept']) && $_GET['accept'] == 0) {
     // odrzucenie zmiany