コード例 #1
0
function genStatPieUrl()
{
    $startDate = mktime(0, 0, 0, 1, 1, 2006);
    global $lang;
    if (checkField('cache_type', $lang)) {
        $lang_db = $lang;
    } else {
        $lang_db = "en";
    }
    // Get data
    $rsTypes = sql('SELECT COUNT(`caches`.`type`) `count`, `cache_type`.`&1` AS `type`, `cache_type`.`color` FROM `caches` INNER JOIN `cache_type` ON (`caches`.`type`=`cache_type`.`id`) WHERE `status`=1 GROUP BY `caches`.`type` ORDER BY `count` DESC', $lang_db);
    $yData = array();
    $xData = array();
    $colors = array();
    $url = "http://chart.apis.google.com/chart?chs=550x200&chd=t:";
    $sum = 0;
    while ($rTypes = mysql_fetch_array($rsTypes)) {
        $yData[] = ' (' . $rTypes['count'] . ') ' . $rTypes['type'];
        $xData[] = $rTypes['count'];
        $colors[] = substr($rTypes['color'], 1);
        $sum += $rTypes['count'];
    }
    mysql_free_result($rsTypes);
    foreach ($xData as $count) {
        $url .= normTo100($count, $sum) . ",";
    }
    $url = substr($url, 0, -1);
    $url .= "&cht=p3&chl=";
    foreach ($yData as $label) {
        $url .= urlencode($label) . "|";
    }
    $url = substr($url, 0, -1);
    $url .= "&chco=";
    foreach ($colors as $color) {
        $url .= urlencode($color) . ",";
    }
    return $url = substr($url, 0, -1);
}
コード例 #2
0
ファイル: region.php プロジェクト: pawelzielak/opencaching-pl
        $adm4 = sqlValue("SELECT `name` FROM `nuts_codes` WHERE `code`='{$sCode}'", 0);
        $sCode = mb_substr($sCode, 0, 4);
    }
    if (mb_strlen($sCode) == 4) {
        $code3 = $sCode;
        $adm3 = sqlvalue("SELECT `name` FROM `nuts_codes` WHERE `code`='{$sCode}'", 0);
        $sCode = mb_substr($sCode, 0, 3);
    }
    if (mb_strlen($sCode) == 3) {
        $code2 = $sCode;
        $adm2 = sqlvalue("SELECT `name` FROM `nuts_codes` WHERE `code`='{$sCode}'", 0);
        $sCode = mb_substr($sCode, 0, 2);
    }
    if (mb_strlen($sCode) == 2) {
        $code1 = $sCode;
        if (checkField('countries', 'list_default_' . $lang)) {
            $lang_db = $lang;
        } else {
            $lang_db = "en";
        }
        // try to get localised name first
        $adm1 = sqlvalue("SELECT `countries`.`{$lang}`\n                     FROM `countries`\n                    WHERE `countries`.`short`='{$sCode}'", 0);
        if ($adm1 == null) {
            $adm1 = sqlvalue("SELECT `name` FROM `nuts_codes` WHERE `code`='{$sCode}'", 0);
        }
    }
    tpl_set_var('country', $adm1);
    tpl_set_var('region', $adm3);
} else {
    tpl_set_var('country', "");
    tpl_set_var('region', "");
コード例 #3
0
     $db->multiVariableQuery('INSERT INTO user_settings (user_id, newcaches_no_limit) VALUES (:2, :1) ON DUPLICATE KEY UPDATE newcaches_no_limit = :1', $newIgnoreFoundLimit, $user->getUserId());
     $db->reset();
     unset($user);
     $user = new \lib\Objects\User\User(array('userId' => $_REQUEST['userid']));
     $user->loadExtendedSettings();
 }
 if (isset($_GET['is_active_flag']) && $_GET['is_active_flag'] == 1 && $usr['admin']) {
     $sql = "UPDATE user SET is_active_flag = 1 - is_active_flag, `activation_code`='' WHERE user_id = " . intval($user_id);
     mysql_query($sql);
 }
 if ($usr['userid'] == $super_admin_id) {
     tpl_set_var('remove_all_logs', '<p><img src="tpl/stdstyle/images/blue/arrow2.png" alt="" align="middle" />&nbsp;&nbsp;<a href="removelog.php?userid=' . $user_id . '"><font color="#ff0000">' . tr('admin_users_remove_logs') . '</font></a>&nbsp;<img src="' . $stylepath . '/images/blue/atten-red.png" align="top" alt="" /></p>');
 } else {
     tpl_set_var('remove_all_logs', '');
 }
 if (checkField('countries', $lang)) {
     $lang_db = $lang;
 } else {
     $lang_db = "en";
 }
 $rsuser = sql("SELECT hidden_count, founds_count, log_notes_count, notfounds_count,last_login,\n                                username, date_created,description, email,is_active_flag,\n                                stat_ban,activation_code,hide_flag,countries.{$lang_db} country, verify_all\n                                FROM `user` LEFT JOIN countries ON (user.country=countries.short) WHERE user_id=&1 ", $user_id);
 $record = sql_fetch_array($rsuser);
 if (!$record['activation_code']) {
     tpl_set_var('activation_codes', tr('account_is_actived'));
 } else {
     tpl_set_var('activation_codes', $record['activation_code']);
 }
 if ($record['last_login'] == "0000-00-00 00:00:00") {
     $userlogin = tr('NoDataAvailable');
 } else {
     $userlogin = strftime("%d-%m-%Y", strtotime($record['last_login']));
コード例 #4
0
ファイル: caches.inc.php プロジェクト: kojoty/opencaching-pl
function cache_status_from_id($id, $lang)
{
    global $cache_status;
    if (checkField('cache_status', $lang)) {
        $lang_db = $lang;
    } else {
        $lang_db = "en";
    }
    foreach ($cache_status as $status) {
        if ($status['id'] == $id) {
            return $status[$lang_db];
        }
    }
}
コード例 #5
0
ファイル: search.php プロジェクト: pawelzielak/opencaching-pl
function outputSearchForm($options)
{
    global $stylepath, $usr, $error_plz, $error_locidnocoords, $error_ort, $error_noort, $error_nofulltext;
    global $default_lang, $search_all_countries, $cache_attrib_jsarray_line, $cache_attrib_img_line;
    global $lang, $language, $config;
    //simple mode (only one easy filter)
    $filters = read_file($stylepath . '/search.simple.tpl.php');
    tpl_set_var('filters', $filters, false);
    tpl_set_var('formmethod', 'get');
    // checkboxes
    if (isset($options['sort'])) {
        $bBynameChecked = $options['sort'] == 'byname';
    } else {
        $bBynameChecked = $usr['userid'] == 0;
    }
    tpl_set_var('byname_checked', $bBynameChecked == true ? ' checked="checked"' : '');
    if (isset($options['sort'])) {
        $bBydistanceChecked = $options['sort'] == 'bydistance';
    } else {
        $bBydistanceChecked = $usr['userid'] != 0;
    }
    tpl_set_var('bydistance_checked', $bBydistanceChecked == true ? ' checked="checked"' : '');
    if (isset($options['sort'])) {
        $bBycreatedChecked = $options['sort'] == 'bycreated';
    } else {
        $bBycreatedChecked = $usr['userid'] == 0;
    }
    tpl_set_var('bycreated_checked', $bBycreatedChecked == true ? ' checked="checked"' : '');
    tpl_set_var('hidopt_sort', $options['sort']);
    tpl_set_var('f_inactive_checked', $options['f_inactive'] == 1 ? ' checked="checked"' : '');
    tpl_set_var('hidopt_inactive', $options['f_inactive'] == 1 ? '1' : '0');
    tpl_set_var('f_ignored_disabled', $usr['userid'] == 0 ? ' disabled="disabled"' : '');
    if ($usr['userid'] != 0) {
        tpl_set_var('f_ignored_disabled', $options['f_ignored'] == 1 ? ' checked="checked"' : '');
    }
    tpl_set_var('hidopt_ignored', $options['f_ignored'] == 1 ? '1' : '0');
    tpl_set_var('f_userfound_disabled', $usr['userid'] == 0 ? ' disabled="disabled"' : '');
    if ($usr['userid'] != 0) {
        tpl_set_var('f_userfound_disabled', $options['f_userfound'] == 1 ? ' checked="checked"' : '');
    }
    tpl_set_var('hidopt_userfound', $options['f_userfound'] == 1 ? '1' : '0');
    tpl_set_var('f_userowner_disabled', $usr['userid'] == 0 ? ' disabled="disabled"' : '');
    if ($usr['userid'] != 0) {
        tpl_set_var('f_userowner_disabled', $options['f_userowner'] == 1 ? ' checked="checked"' : '');
    }
    tpl_set_var('hidopt_userowner', $options['f_userowner'] == 1 ? '1' : '0');
    tpl_set_var('f_watched_disabled', $usr['userid'] == 0 ? ' disabled="disabled"' : '');
    if ($usr['userid'] != 0) {
        tpl_set_var('f_watched_disabled', $options['f_watched'] == 1 ? ' checked="checked"' : '');
    }
    tpl_set_var('hidopt_watched', $options['f_watched'] == 1 ? '1' : '0');
    tpl_set_var('f_geokret_checked', $options['f_geokret'] == 1 ? ' checked="checked"' : '');
    tpl_set_var('hidopt_geokret', $options['f_geokret'] == 1 ? '1' : '0');
    if (isset($options['cacherating'])) {
        tpl_set_var('all_caches_checked', $options['cacherating'] == 0 ? ' checked="checked"' : '');
        tpl_set_var('recommended_caches_checked', $options['cacherating'] > 0 ? ' checked="checked"' : '');
        tpl_set_var('cache_min_rec', $options['cacherating'] > 0 ? $options['cacherating'] : 0);
        tpl_set_var('min_rec_caches_disabled', $options['cacherating'] == 0 ? ' disabled="disabled"' : '');
    }
    if (isset($options['cacherating'])) {
        tpl_set_var('cacherating', htmlspecialchars($options['cacherating'], ENT_COMPAT, 'UTF-8'));
    } else {
        tpl_set_var('cacherating', '');
    }
    if (isset($options['region'])) {
        tpl_set_var('region', htmlspecialchars($options['region'], ENT_COMPAT, 'UTF-8'));
    } else {
        tpl_set_var('region', '');
    }
    if (isset($options['country'])) {
        tpl_set_var('country', htmlspecialchars($options['country'], ENT_COMPAT, 'UTF-8'));
    } else {
        tpl_set_var('country', '');
    }
    if (isset($options['cachetype'])) {
        tpl_set_var('cachetype', htmlspecialchars($options['cachetype'], ENT_COMPAT, 'UTF-8'));
    } else {
        tpl_set_var('cachetype', '');
    }
    if (isset($options['cachesize_1'])) {
        tpl_set_var('cachesize_1', htmlspecialchars($options['cachesize_1'], ENT_COMPAT, 'UTF-8'));
    } else {
        tpl_set_var('cachesize_1', '');
    }
    if (isset($options['cachesize_2'])) {
        tpl_set_var('cachesize_2', htmlspecialchars($options['cachesize_2'], ENT_COMPAT, 'UTF-8'));
    } else {
        tpl_set_var('cachesize_2', '');
    }
    if (isset($options['cachesize_3'])) {
        tpl_set_var('cachesize_3', htmlspecialchars($options['cachesize_3'], ENT_COMPAT, 'UTF-8'));
    } else {
        tpl_set_var('cachesize_3', '');
    }
    if (isset($options['cachesize_4'])) {
        tpl_set_var('cachesize_4', htmlspecialchars($options['cachesize_4'], ENT_COMPAT, 'UTF-8'));
    } else {
        tpl_set_var('cachesize_4', '');
    }
    if (isset($options['cachesize_5'])) {
        tpl_set_var('cachesize_5', htmlspecialchars($options['cachesize_5'], ENT_COMPAT, 'UTF-8'));
    } else {
        tpl_set_var('cachesize_5', '');
    }
    if (isset($options['cachesize_6'])) {
        tpl_set_var('cachesize_6', htmlspecialchars($options['cachesize_6'], ENT_COMPAT, 'UTF-8'));
    } else {
        tpl_set_var('cachesize_6', '');
    }
    if (isset($options['cachesize_7'])) {
        tpl_set_var('cachesize_7', htmlspecialchars($options['cachesize_7'], ENT_COMPAT, 'UTF-8'));
    } else {
        tpl_set_var('cachesize_7', '');
    }
    if (isset($options['cachevote_1']) && isset($options['cachevote_2'])) {
        tpl_set_var('cachevote_1', htmlspecialchars($options['cachevote_1'], ENT_COMPAT, 'UTF-8'));
        tpl_set_var('cachevote_2', htmlspecialchars($options['cachevote_2'], ENT_COMPAT, 'UTF-8'));
    } else {
        tpl_set_var('cachevote_1', '');
        tpl_set_var('cachevote_2', '');
    }
    if (isset($options['cachenovote'])) {
        tpl_set_var('cachenovote', htmlspecialchars($options['cachenovote'], ENT_COMPAT, 'UTF-8'));
    } else {
        tpl_set_var('cachenovote', '');
    }
    if (isset($options['cachedifficulty_1']) && isset($options['cachedifficulty_2'])) {
        tpl_set_var('cachedifficulty_1', htmlspecialchars($options['cachedifficulty_1'], ENT_COMPAT, 'UTF-8'));
        tpl_set_var('cachedifficulty_2', htmlspecialchars($options['cachedifficulty_2'], ENT_COMPAT, 'UTF-8'));
    } else {
        tpl_set_var('cachedifficulty_1', '');
        tpl_set_var('cachedifficulty_2', '');
    }
    if (isset($options['cacheterrain_1']) && isset($options['cacheterrain_2'])) {
        tpl_set_var('cacheterrain_1', htmlspecialchars($options['cacheterrain_1'], ENT_COMPAT, 'UTF-8'));
        tpl_set_var('cacheterrain_2', htmlspecialchars($options['cacheterrain_2'], ENT_COMPAT, 'UTF-8'));
    } else {
        tpl_set_var('cacheterrain_1', '');
        tpl_set_var('cacheterrain_2', '');
    }
    // cachename
    tpl_set_var('cachename', isset($options['cachename']) ? htmlspecialchars($options['cachename'], ENT_COMPAT, 'UTF-8') : '');
    // koordinaten
    if (!isset($options['lat_h'])) {
        if ($usr !== false) {
            $rs = sql('SELECT `latitude`, `longitude` FROM `user` WHERE `user_id`=\'' . sql_escape($usr['userid']) . '\'');
            $record = sql_fetch_array($rs);
            $lon = $record['longitude'];
            $lat = $record['latitude'];
            mysql_free_result($rs);
            if ($lon < 0) {
                tpl_set_var('lonE_sel', '');
                tpl_set_var('lonW_sel', ' selected="selected"');
                $lon = -$lon;
            } else {
                tpl_set_var('lonE_sel', ' selected="selected"');
                tpl_set_var('lonW_sel', '');
            }
            if ($lat < 0) {
                tpl_set_var('latN_sel', '');
                tpl_set_var('latS_sel', ' selected="selected"');
                $lat = -$lat;
            } else {
                tpl_set_var('latN_sel', ' selected="selected"');
                tpl_set_var('latS_sel', '');
            }
            $lon_h = floor($lon);
            $lat_h = floor($lat);
            $lon_min = ($lon - $lon_h) * 60;
            $lat_min = ($lat - $lat_h) * 60;
            tpl_set_var('lat_h', $lat_h);
            tpl_set_var('lon_h', $lon_h);
            tpl_set_var('lat_min', sprintf("%02.3f", $lat_min));
            tpl_set_var('lon_min', sprintf("%02.3f", $lon_min));
        } else {
            tpl_set_var('lat_h', '00');
            tpl_set_var('lon_h', '000');
            tpl_set_var('lat_min', '00.000');
            tpl_set_var('lon_min', '00.000');
            tpl_set_var('latN_sel', ' selected="selected"');
            tpl_set_var('latS_sel', '');
            tpl_set_var('lonE_sel', ' selected="selected"');
            tpl_set_var('lonW_sel', '');
        }
    } else {
        tpl_set_var('lat_h', isset($options['lat_h']) ? $options['lat_h'] : '00');
        tpl_set_var('lon_h', isset($options['lon_h']) ? $options['lon_h'] : '000');
        tpl_set_var('lat_min', isset($options['lat_min']) ? $options['lat_min'] : '00.000');
        tpl_set_var('lon_min', isset($options['lon_min']) ? $options['lon_min'] : '00.000');
        if ($options['lonEW'] == 'W') {
            tpl_set_var('lonE_sel', '');
            tpl_set_var('lonW_sel', 'selected="selected"');
        } else {
            tpl_set_var('lonE_sel', 'selected="selected"');
            tpl_set_var('lonW_sel', '');
        }
        if ($options['latNS'] == 'S') {
            tpl_set_var('latS_sel', 'selected="selected"');
            tpl_set_var('latN_sel', '');
        } else {
            tpl_set_var('latS_sel', '');
            tpl_set_var('latN_sel', 'selected="selected"');
        }
    }
    tpl_set_var('distance', isset($options['distance']) ? $options['distance'] : 20);
    if (!isset($options['unit'])) {
        $options['unit'] = 'km';
    }
    if ($options['unit'] == 'km') {
        tpl_set_var('sel_km', 'selected="selected"');
        tpl_set_var('sel_sm', '');
        tpl_set_var('sel_nm', '');
    } else {
        if ($options['unit'] == 'sm') {
            tpl_set_var('sel_km', '');
            tpl_set_var('sel_sm', 'selected="selected"');
            tpl_set_var('sel_nm', '');
        } else {
            if ($options['unit'] == 'nm') {
                tpl_set_var('sel_km', '');
                tpl_set_var('sel_sm', '');
                tpl_set_var('sel_nm', 'selected="selected"');
            }
        }
    }
    // plz
    tpl_set_var('plz', isset($options['plz']) ? htmlspecialchars($options['plz'], ENT_COMPAT, 'UTF-8') : '');
    tpl_set_var('ort', isset($options['ort']) ? htmlspecialchars($options['ort'], ENT_COMPAT, 'UTF-8') : '');
    // owner
    tpl_set_var('owner', isset($options['owner']) ? htmlspecialchars($options['owner'], ENT_COMPAT, 'UTF-8') : '');
    // finder
    tpl_set_var('finder', isset($options['finder']) ? htmlspecialchars($options['finder'], ENT_COMPAT, 'UTF-8') : '');
    //countryoptions
    $countriesoptions = $search_all_countries;
    $rs = sql('SELECT `short` FROM `countries` WHERE `short` IN (SELECT DISTINCT `country` FROM `caches`) ');
    for ($i = 0; $i < mysql_num_rows($rs); $i++) {
        $record = sql_fetch_array($rs);
        if ($record['short'] == $options['country']) {
            $countriesoptions .= '<option value="' . htmlspecialchars($record['short'], ENT_COMPAT, 'UTF-8') . '" selected="selected">' . htmlspecialchars(tr($record['short']), ENT_COMPAT, 'UTF-8') . '</option>';
        } else {
            $countriesoptions .= '<option value="' . htmlspecialchars($record['short'], ENT_COMPAT, 'UTF-8') . '">' . htmlspecialchars(tr($record['short']), ENT_COMPAT, 'UTF-8') . '</option>';
        }
        $countriesoptions .= "\n";
    }
    tpl_set_var('countryoptions', $countriesoptions);
    //regionoptions
    $regionsoptions = '<option value="" selected="selected">' . tr('all_regions') . '</option>';
    tpl_set_var('regionoptions', $regionsoptions);
    // Typ skrzynki
    $cachetype_options = '';
    if (checkField('cache_type', $lang)) {
        $lang_db = $lang;
    } else {
        $lang_db = "en";
    }
    $rs = sql('SELECT `id`, `&1`, `icon_large` FROM `cache_type` ORDER BY `sort`', $lang_db);
    for ($i = 0; $i < mysql_num_rows($rs); $i++) {
        $record = sql_fetch_array($rs);
        /*
        if ($record['id'] == $options['cachetype'])
            $cachetype_options .= '<option value="' . htmlspecialchars($record['id'], ENT_COMPAT, 'UTF-8') . '" selected="selected">' . htmlspecialchars($record[$default_lang], ENT_COMPAT, 'UTF-8') . '</option>';
        else
            $cachetype_options .= '<option value="' . htmlspecialchars($record['id'], ENT_COMPAT, 'UTF-8') . '">' . htmlspecialchars($record[$default_lang], ENT_COMPAT, 'UTF-8') . '</option>';
        */
        $c_rec_id = $record['id'] - 1;
        $cachetype_icon = $record['icon_large'];
        //      if ($options['cachetype'][$c_rec_id] == '1') {
        //          $cachetype_options .= '<input type="checkbox" name="cachetype_' . htmlspecialchars($record['id'], ENT_COMPAT, 'UTF-8') . '" value="1" id="l_cachetype_' . htmlspecialchars($record['id'], ENT_COMPAT, 'UTF-8') . '" class="checkbox" onclick="javascript:sync_options(this)" checked="checked" /><label for="l_cachetype_' . htmlspecialchars($record['id'], ENT_COMPAT, 'UTF-8') . '">' . htmlspecialchars($record[$default_lang], ENT_COMPAT, 'UTF-8') . '</label>';
        //      } else {
        //          $cachetype_options .= '<input type="checkbox" name="cachetype_' . htmlspecialchars($record['id'], ENT_COMPAT, 'UTF-8') . '" value="1" id="l_cachetype_' . htmlspecialchars($record['id'], ENT_COMPAT, 'UTF-8') . '" class="checkbox" onclick="javascript:sync_options(this)" /><label for="l_cachetype_' . htmlspecialchars($record['id'], ENT_COMPAT, 'UTF-8') . '">' . htmlspecialchars($record[$default_lang], ENT_COMPAT, 'UTF-8') . '</label>';
        //      }
        $cachetype_icon = str_replace("mystery", "quiz", $cachetype_icon);
        // mystery is an outdated name, we use 'quiz' now :-)
        $cachetype_icon_bw = $cachetype_icon;
        $cachetype_icon = str_replace(".png", "-i.png", $cachetype_icon);
        $cachetype_icon_bw = str_replace(".png", "-i-bw.png", $cachetype_icon_bw);
        $cachetype_icon = str_replace(".gif", "-i.png", $cachetype_icon);
        $cachetype_icon_bw = str_replace(".gif", "-i-bw.png", $cachetype_icon_bw);
        $hidden_css = "position: absolute; visibility: hidden;";
        // css required to hide an image
        // this marks saved user preference for searching, if 1, the cache is by default searched
        // and thus making the colour image visibile
        if (isset($options['cachetype'][$c_rec_id]) && $options['cachetype'][$c_rec_id] == '1') {
            $icon_hidden = "";
            $icon_bw_hidden = $hidden_css;
        } else {
            $icon_hidden = $hidden_css;
            $icon_bw_hidden = "";
        }
        $hidden_css = "position: absolute; visibility: hidden;";
        $cachetype_options .= '<img id="cachetype_' . htmlspecialchars($record['id'], ENT_COMPAT, 'UTF-8') . '"    src="' . htmlspecialchars($stylepath . "/images/" . $cachetype_icon, ENT_COMPAT, 'UTF-8') . '" title="' . htmlspecialchars($record[$lang_db], ENT_COMPAT, 'UTF-8') . '" alt="' . htmlspecialchars($record[$lang_db], ENT_COMPAT, 'UTF-8') . '" onmousedown="javascript:switchCacheType(\'cachetype_' . htmlspecialchars($record['id'], ENT_COMPAT, 'UTF-8') . '\')" style="cursor: pointer;' . $icon_hidden . '" />';
        $cachetype_options .= '<img id="cachetype_' . htmlspecialchars($record['id'], ENT_COMPAT, 'UTF-8') . '_bw" src="' . htmlspecialchars($stylepath . "/images/" . $cachetype_icon_bw, ENT_COMPAT, 'UTF-8') . '" title="' . htmlspecialchars($record[$lang_db], ENT_COMPAT, 'UTF-8') . '" alt="' . htmlspecialchars($record[$lang_db], ENT_COMPAT, 'UTF-8') . '" onmousedown="javascript:switchCacheType(\'cachetype_' . htmlspecialchars($record['id'], ENT_COMPAT, 'UTF-8') . '\')" style="cursor: pointer;' . $icon_bw_hidden . '" />';
        if ($i == 2) {
            $cachetype_options .= '&nbsp;&nbsp;&nbsp;';
        }
        $cachetype_options .= "\n";
    }
    tpl_set_var('cachetype_options', $cachetype_options);
    //Rozmiar skrzynki
    $cachesize_options = '';
    if (checkField('cache_size', $lang)) {
        $lang_db = $lang;
    } else {
        $lang_db = "en";
    }
    $rs = sql('SELECT `id`, `&1` FROM `cache_size` ORDER BY `id`', $lang_db);
    for ($i = 0; $i < mysql_num_rows($rs); $i++) {
        $record = sql_fetch_array($rs);
        $cachesize_options .= '<input type="checkbox" name="cachesize_' . htmlspecialchars($record['id'], ENT_COMPAT, 'UTF-8') . '" value="1" id="l_cachesize_' . htmlspecialchars($record['id'], ENT_COMPAT, 'UTF-8') . '" class="checkbox" onclick="javascript:sync_options(this)" checked="checked" /><label for="l_cachesize_' . htmlspecialchars($record['id'], ENT_COMPAT, 'UTF-8') . '">' . htmlspecialchars($record[$lang_db], ENT_COMPAT, 'UTF-8') . '</label>';
        $cachesize_options .= "\n";
    }
    tpl_set_var('cachesize_options', $cachesize_options);
    // gpxlogLimit
    if ($options['gpxLogLimit'] == false) {
        tpl_set_var('gpxLogLimitUserChoice', 5);
    } else {
        tpl_set_var('gpxLogLimitUserChoice', $options['gpxLogLimit']);
    }
    function attr_jsline($tpl, $options, $id, $textlong, $iconlarge, $iconno, $iconundef, $category)
    {
        $line = $tpl;
        $line = mb_ereg_replace('{id}', $id, $line);
        if (array_search($id, $options['cache_attribs']) === false) {
            if (array_search($id, $options['cache_attribs_not']) === false) {
                $line = mb_ereg_replace('{state}', 0, $line);
            } else {
                $line = mb_ereg_replace('{state}', 2, $line);
            }
        } else {
            $line = mb_ereg_replace('{state}', 1, $line);
        }
        $line = mb_ereg_replace('{text_long}', addslashes($textlong), $line);
        $line = mb_ereg_replace('{icon}', $iconlarge, $line);
        $line = mb_ereg_replace('{icon_no}', $iconno, $line);
        $line = mb_ereg_replace('{icon_undef}', $iconundef, $line);
        $line = mb_ereg_replace('{category}', $category, $line);
        return $line;
    }
    function attr_image($tpl, $options, $id, $textlong, $iconlarge, $iconno, $iconundef, $category)
    {
        $line = $tpl;
        $line = mb_ereg_replace('{id}', $id, $line);
        $line = mb_ereg_replace('{text_long}', $textlong, $line);
        if (array_search($id, $options['cache_attribs']) === false) {
            if (array_search($id, $options['cache_attribs_not']) === false) {
                $line = mb_ereg_replace('{icon}', $iconundef, $line);
            } else {
                $line = mb_ereg_replace('{icon}', $iconno, $line);
            }
        } else {
            $line = mb_ereg_replace('{icon}', $iconlarge, $line);
        }
        return $line;
    }
    // cache-attributes
    $attributes_jsarray = '';
    $attributes_img = '';
    $attributesCat2_img = '';
    // select attributes depend on specified language.
    $database = new dataBase(false);
    $query = "SELECT `id`, `text_long`, `icon_large`, `icon_no`, `icon_undef`, `category` FROM `cache_attrib` WHERE `language` LIKE :1 ORDER BY `id`";
    $database->multiVariableQuery($query, strtoupper($lang));
    // if specified language is in database
    if ($database->rowCount() <= 0) {
        // if we have not specified language in db, just use english.
        $database->multiVariableQuery($query, 'EN');
    }
    $rs = $database->dbResultFetchAll();
    unset($database);
    foreach ($rs as $record) {
        // icon specified
        $line = attr_jsline($cache_attrib_jsarray_line, $options, $record['id'], $record['text_long'], $record['icon_large'], $record['icon_no'], $record['icon_undef'], $record['category']);
        if ($attributes_jsarray != '') {
            $attributes_jsarray .= ",\n";
        }
        $attributes_jsarray .= $line;
        $line = attr_image($cache_attrib_img_line, $options, $record['id'], $record['text_long'], $record['icon_large'], $record['icon_no'], $record['icon_undef'], $record['category']);
        if ($record['category'] != 1) {
            $attributesCat2_img .= $line;
        } else {
            $attributes_img .= $line;
        }
    }
    $line = attr_jsline($cache_attrib_jsarray_line, $options, "99", tr("with_password"), $config['search-attr-icons']['password'][0], $config['search-attr-icons']['password'][1], $config['search-attr-icons']['password'][2], 0);
    $attributes_jsarray .= ",\n" . $line;
    $line = attr_image($cache_attrib_img_line, $options, "99", tr("with_password"), $config['search-attr-icons']['password'][0], $config['search-attr-icons']['password'][1], $config['search-attr-icons']['password'][2], 0);
    $attributes_img .= $line;
    tpl_set_var('cache_attrib_list', $attributes_img);
    tpl_set_var('cache_attribCat2_list', $attributesCat2_img);
    tpl_set_var('attributes_jsarray', $attributes_jsarray);
    tpl_set_var('hidopt_attribs', implode(';', $options['cache_attribs']));
    tpl_set_var('hidopt_attribs_not', implode(';', $options['cache_attribs_not']));
    tpl_set_var('fulltext', '');
    tpl_set_var('ft_name_checked', 'checked="checked"');
    tpl_set_var('ft_desc_checked', '');
    tpl_set_var('ft_logs_checked', '');
    tpl_set_var('ft_pictures_checked', '');
    // fulltext options
    if ($options['searchtype'] == 'byfulltext') {
        if (!isset($options['fulltext'])) {
            $options['fulltext'] = '';
        }
        tpl_set_var('fulltext', htmlspecialchars($options['fulltext'], ENT_COMPAT, 'UTF-8'));
        if (isset($options['ft_name']) && $options['ft_name'] == 1) {
            tpl_set_var('ft_name_checked', 'checked="checked"');
        } else {
            tpl_set_var('ft_name_checked', '');
        }
        if (isset($options['ft_desc']) && $options['ft_desc'] == 1) {
            tpl_set_var('ft_desc_checked', 'checked="checked"');
        } else {
            tpl_set_var('ft_desc_checked', '');
        }
        if (isset($options['ft_logs']) && $options['ft_logs'] == 1) {
            tpl_set_var('ft_logs_checked', 'checked="checked"');
        } else {
            tpl_set_var('ft_logs_checked', '');
        }
        if (isset($options['ft_pictures']) && $options['ft_pictures'] == 1) {
            tpl_set_var('ft_pictures_checked', 'checked="checked"');
        } else {
            tpl_set_var('ft_pictures_checked', '');
        }
    }
    // errormeldungen
    tpl_set_var('ortserror', '');
    if (isset($options['error_plz'])) {
        tpl_set_var('ortserror', $error_plz);
    } else {
        if (isset($options['error_ort'])) {
            tpl_set_var('ortserror', $error_ort);
        } else {
            if (isset($options['error_locidnocoords'])) {
                tpl_set_var('ortserror', $error_locidnocoords);
            } else {
                if (isset($options['error_noort'])) {
                    tpl_set_var('ortserror', $error_noort);
                }
            }
        }
    }
    tpl_set_var('fulltexterror', isset($options['error_nofulltext']) ? $error_nofulltext : '');
    tpl_BuildTemplate();
    exit;
}
コード例 #6
0
ファイル: upgrade.php プロジェクト: TitanKing/PHPDevShell
function checkFields()
{
    global $data, $errors;
    checkField('db_name', _('Please supply the Database Name.'), 'phpdevdbname');
    checkField('db_username', _('Please supply the Database Username.'), 'phpdev');
    checkField('db_password', _('Please supply the Database Password.'), 'phpdev');
    checkField('db_server', _('Please supply the Database Server Address.'), 'localhost');
    checkField('db_prefix', _('Please supply theDatabase Prefix.'), 'pds_');
    checkField('config_file', _('Please supply the Config File.'), 'single-site.config.php');
    return count($errors) == 0;
}
コード例 #7
0
ファイル: ii.write.php プロジェクト: bluecat/iiwork-php
/** 댓글 수정
 * @class write
 * @param
		$data: 댓글 data, 이미 check와 가공이 끝난 데이터여야 함
		$board_data: 게시판 설정 data
		-id: 게시판 아이디. 게시판 설정 data가 없을 때 아이디를 토대로 설정을 로드한다.
		-no: 대상 댓글번호 지정. (댓글 번호를 지정할 수 있다. 없다면 data에 저장되어 있는 자료를 수정)
		-is_update: 회원정보 업데이트 여부
		-is_ex: 이전정보 로드 여부
		-is_check: 입력변수 체크 여부
  */
function editCmt(&$data, $board_data = '', $param = '')
{
    global $mini;
    $param = param($param);
    iss($param['id']);
    iss($param['no']);
    iss($data['no']);
    def($param['is_update'], 1);
    def($param['is_ex'], 1);
    def($param['is_check'], 1);
    $trackback = $trackback_excerpt = $trackback_charset = '';
    if (!empty($data['trackback'])) {
        $trackback = $data['trackback'];
    }
    if (!empty($data['trackback_excerpt'])) {
        $trackback_excerpt = $data['trackback_excerpt'];
    }
    if (!empty($data['trackback_charset'])) {
        $trackback_charset = $data['trackback_charset'];
    }
    $is_saveImage = !empty($data['saveImage']) ? 1 : 0;
    unset($data['pass']);
    unset($data['target_member']);
    unset($data['report']);
    unset($data['ip']);
    unset($data['vote']);
    unset($data['hate']);
    unset($data['download']);
    unset($data['date']);
    unset($data['date_last']);
    unset($data['parent']);
    unset($data['history_vote']);
    unset($data['point_count']);
    unset($data['point_sum']);
    if (empty($mini['member']['level_admin'])) {
        unset($data['is_del']);
        unset($data['trackback']);
        unset($data['ment_advice']);
        unset($data['is_lock']);
        unset($data['admit_file']);
        unset($data['admit_post']);
    }
    //// 게시판 설정
    if (!is_array($board_data)) {
        if ($param['id']) {
            $board_data = getBoard($param['id'], 1);
        } else {
            __error('게시판 설정이 없습니다');
        }
    }
    //// 게시물 번호
    $no = $param['no'] ? $param['no'] : $data['no'];
    unset($data['no']);
    check($no, "type:num, name:댓글번호");
    //// 데이터 로드
    if ($param['is_ex']) {
        $data_ex = sql("SELECT * FROM {$board_data['table_cmt']} WHERE no={$no}");
        if (!is_array($data_ex)) {
            __error('해당 댓글이 존재하지 않습니다');
        }
    }
    //// 잠긴댓글
    if (empty($mini['member']['level_admin']) && !empty($data_ex['is_lock'])) {
        __error('댓글이 잠겨 있어 수정, 삭제를 할 수 없습니다');
    }
    //// 회원정보 로드
    if (!empty($data_ex['target_member'])) {
        $mdata = sql("SELECT * FROM {$mini['name']['member']} WHERE no={$data_ex['target_member']}");
        // 회원정보 업데이트 여부
        if ($param['is_update'] && $param['is_ex'] && $data_ex['target_member']) {
            if (is_array($mdata)) {
                parseMember($mdata);
                $data['name'] = $mdata['name'];
            } else {
                $data_ex['target_member'] = $data['target_member'] = 0;
                $data['pass'] = md5();
            }
        }
    }
    //// 권한 체크
    if (empty($data_ex['trackback'])) {
        if (!empty($data_ex['target_member'])) {
            if (empty($mini['log'])) {
                __error('권한이 없습니다. [로그인이 필요합니다]');
            }
            if (empty($mini['member']['level_admin']) && $mdata['no'] != $mini['member']['no']) {
                __error('권한이 없습니다. [자신이 쓴 댓글만 수정할 수 있습니다]');
            }
            if (!empty($mini['member']['level_admin']) && $mdata['no'] != $mini['member']['no'] && $mdata['level_admin'] >= $mini['member']['level_admin']) {
                __error('권한이 없습니다. [자신보다 높거나 같은 권한의 관리자가 쓴 댓글 입니다]');
            }
        } else {
            if (empty($mini['member']['level_admin'])) {
                if (empty($data['pass_encode'])) {
                    __error('비밀번호가 없습니다');
                }
                if (!empty($mini['log']) && empty($mini['member']['level_admin'])) {
                    __error('권한이 없습니다. [비회원이 쓴댓글 입니다]');
                }
                if (empty($mini['member']['level_admin']) && $data['pass_encode'] != md5("{$data_ex['pass']}|{$mini['ip']}|" . session_id())) {
                    __error("권한이 없습니다. [비밀번호가 일치하지 않습니다]");
                }
            }
        }
    }
    //// 추가필드 권한 체크
    if (!empty($board_data['field'])) {
        foreach ($board_data['field'] as $key => $val) {
            if (!empty($data['field'][$key]) && !empty($val['is_admin']) && empty($mini['member']['level_admin'])) {
                __error("[{$val['name']}]은 관리자만 입력하실 수 있습니다");
            }
            if (empty($data['field'][$key]) && !empty($val['is_req'])) {
                __error("[{$val['name']}]을 입력해 주세요");
            }
        }
    }
    //// 수정 시간제한
    if (!empty($board_data['limit_edit_comment']) && empty($mini['member']['level_admin'])) {
        if (!empty($data_ex) && strtotime($data_ex['date']) + $board_data['limit_edit_comment'] * 60 < $mini['time']) {
            __error("작성 후 {$board_data['limit_edit_comment']}분이 지난 댓글을 수정할 수 없습니다");
        }
    }
    //// 대상 게시물 정보 로드
    check($data['target_post'], "type:num, name:대상게시물번호");
    $data_post = sql("SELECT * FROM {$board_data['table']} WHERE no={$data['target_post']}");
    //// 답변 댓글일 때 원본 댓글 정보 로드
    if (!empty($data_ex['parent'])) {
        $data_reply = sql("SELECT * FROM {$board_data['table_cmt']} WHERE no=" . end(getStr($data_ex['parent'])));
        if (is_array($data_reply)) {
            // 원본 댓글이 비밀일 때 답변들도 비밀 유지
            if (!empty($data_reply['secret'])) {
                $data['secret'] = 1;
            }
            // 공지댓글에 댓글 금지
            if (!empty($data_reply['notice'])) {
                __error('공지댓글에는 댓글을 달 수 없습니다');
            }
        }
    }
    //// 입력정보 체크
    if (isset($data['name'])) {
        check($data['name'], "min:1, max:16, name:이름");
    }
    if (isset($data['mail'])) {
        check($data['mail'], "type:mail, name:메일, is_not:1");
    }
    //// 입력변수 체크
    if ($param['is_check']) {
        // 입력변수 체크
        checkField($data, $board_data['table_cmt'], $param);
        // 글 가공
        checkPost($data, $board_data, 'cmt');
    }
    //// 직접 수정이 안되는 정보는 제외시킨다
    unset($data['no']);
    unset($data['reply']);
    unset($data['pass']);
    unset($data['vote']);
    unset($data['hate']);
    unset($data['ip']);
    unset($data['date']);
    unset($data['target_member']);
    //// trackback
    if (!empty($param['trackback'])) {
        $data['trackback'] = $param['trackback'];
    }
    //+ 권한별로 제외하는 필드를 지정한다. (이를테면 target_member 같은거 바꿀 수 없으니깐)
    //// 쿼리
    sql("UPDATE {$board_data['table_cmt']} SET " . query($data, 'update') . " WHERE no={$no}");
    $data['no'] = $data_ex['no'];
    //// 검색어 수정
    if ($param['is_ex']) {
        if (!empty($data['ment']) && $data_ex['ment'] != $data['ment']) {
            $data_ex['ment'] = $data['ment'];
        }
        if (!empty($data['name']) && $data_ex['name'] != $data['name']) {
            $data_ex['name'] = $data['name'];
        }
        if (!empty($data['tag']) && $data_ex['tag'] != $data['tag']) {
            $data_ex['tag'] = $data['tag'];
        }
        delIndex($data_post['num'], $data_ex['no']);
        addIndex($data_ex, "\n\t\t\t\tid: {$board_data['no']}\n\t\t\t\tnum: {$data_post['num']}\n\t\t\t\tcmt_no: {$data_ex['no']}\n\t\t\t\tdate: {$data_ex['date']}\n\t\t\t\tip: {$data_ex['ip']}\n\t\t\t");
    }
    //// 트랙백 댓글 주소 설정
    if (!empty($data_reply) && !empty($data_reply['trackback'])) {
        $tmp_data = getSocket("\n\t\t\t\turl: {$data_reply['trackback']}\n\t\t\t\tskip_header: 1\n\t\t\t");
        if (!empty($tmp_data) && strpos($tmp_data, "<rdf:RDF") !== false) {
            preg_match("/\\<rdf\\:Description.+trackback\\:ping\\=\"([^\"]+)\" \\/\\>/is", $tmp_data, $mat);
            if (!empty($mat[1])) {
                $trackback = $mat[1];
            }
        }
    }
    //// 트랙백 보내기
    if (!empty($trackback)) {
        $result = '';
        $result = sendTrackback($trackback, $trackback_excerpt, $trackback_charset, $data, $board_data, 'cmt');
        if ($result) {
            __error("댓글 수정에 성공했지만 트랙백을 보내지 못했습니다. ({$result})");
        }
    }
    //// 이미지 치환
    if (!empty($is_saveImage) && !empty($data['ment'])) {
        $data['ment'] = saveImage($data_ex['no'], $data['ment'], $board_data, 'cmt');
        sql("UPDATE {$board_data['table_cmt']} SET ment='{$data['ment']}' WHERE no={$data_ex['no']}");
    }
}
コード例 #8
0
 function run()
 {
     global $dblink, $lang;
     /* begin db connect */
     db_connect();
     if ($dblink === false) {
         echo 'Unable to connect to database';
         exit;
     }
     /* end db connect */
     //      global $opt;
     $rsCache = sql("SELECT `caches`.`cache_id`, `caches`.`latitude`, `caches`.`longitude` FROM `caches` LEFT JOIN `cache_location` ON `caches`.`cache_id`=`cache_location`.`cache_id` WHERE ISNULL(`cache_location`.`cache_id`) UNION SELECT `caches`.`cache_id`, `caches`.`latitude`, `caches`.`longitude` FROM `caches` INNER JOIN `cache_location` ON `caches`.`cache_id`=`cache_location`.`cache_id` WHERE `caches`.`country`!='PL' AND `caches`.`last_modified`>`cache_location`.`last_modified`");
     while ($rCache = mysql_fetch_assoc($rsCache)) {
         $sCode = '';
         $rsLayers = sql("SELECT `level`, `code`, AsText(`shape`) AS `geometry` FROM `nuts_layer` WHERE WITHIN(GeomFromText('&1'), `shape`) ORDER BY `level` DESC", 'POINT(' . $rCache['longitude'] . ' ' . $rCache['latitude'] . ')');
         while ($rLayers = mysql_fetch_assoc($rsLayers)) {
             if (gis::ptInLineRing($rLayers['geometry'], 'POINT(' . $rCache['longitude'] . ' ' . $rCache['latitude'] . ')')) {
                 $sCode = $rLayers['code'];
                 break;
             }
         }
         mysql_free_result($rsLayers);
         if ($sCode != '') {
             $adm1 = null;
             $code1 = null;
             $adm2 = null;
             $code2 = null;
             $adm3 = null;
             $code3 = null;
             $adm4 = null;
             $code4 = null;
             if (mb_strlen($sCode) > 5) {
                 $sCode = mb_substr($sCode, 0, 5);
             }
             if (mb_strlen($sCode) == 5) {
                 $code4 = $sCode;
                 $adm4 = sqlValue("SELECT `name` FROM `nuts_codes` WHERE `code`='{$sCode}'", 0);
                 $sCode = mb_substr($sCode, 0, 4);
             }
             if (mb_strlen($sCode) == 4) {
                 $code3 = $sCode;
                 $adm3 = sqlvalue("SELECT `name` FROM `nuts_codes` WHERE `code`='{$sCode}'", 0);
                 $sCode = mb_substr($sCode, 0, 3);
             }
             if (mb_strlen($sCode) == 3) {
                 $code2 = $sCode;
                 $adm2 = sqlvalue("SELECT `name` FROM `nuts_codes` WHERE `code`='{$sCode}'", 0);
                 $sCode = mb_substr($sCode, 0, 2);
             }
             if (mb_strlen($sCode) == 2) {
                 $code1 = $sCode;
                 if (checkField('countries', 'list_default_' . $lang)) {
                     $lang_db = $lang;
                 } else {
                     $lang_db = "en";
                 }
                 // try to get localised name first
                 $adm1 = sqlvalue("SELECT `countries`.`{$lang}`\n                     FROM `countries`\n                    WHERE `countries`.`short`='{$sCode}'", 0);
                 if ($adm1 == null) {
                     $adm1 = sqlvalue("SELECT `name` FROM `nuts_codes` WHERE `code`='{$sCode}'", 0);
                 }
             }
             $sql = sql("INSERT INTO `cache_location` (`cache_id`, `adm1`, `adm2`, `adm3`, `adm4`, `code1`, `code2`, `code3`, `code4`) VALUES ('&1', '&2', '&3', '&4', '&5', '&6', '&7', '&8', '&9') ON DUPLICATE KEY UPDATE `adm1`='&2', `adm2`='&3', `adm3`='&4', `adm4`='&5', `code1`='&6', `code2`='&7', `code3`='&8', `code4`='&9'", $rCache['cache_id'], $adm1, $adm2, $adm3, $adm4, $code1, $code2, $code3, $code4);
             mysql_query($sql);
         } else {
             if (checkField('countries', 'list_default_' . $lang)) {
                 $lang_db = $lang;
             } else {
                 $lang_db = "en";
             }
             $sCountry = sqlvalue("SELECT `countries`.`pl`\n                                         FROM `caches`\n                                   INNER JOIN `countries` ON `caches`.`country`=`countries`.`short`\n                                        WHERE `caches`.`cache_id`='{$rCache['cache_id']}'", 0);
             $sCode1 = sqlvalue("SELECT `caches`.`country` FROM `caches` WHERE `caches`.`cache_id`='&1'", null, $rCache['cache_id']);
             $sql = sql("INSERT INTO `cache_location` (`cache_id`, `adm1`, `code1`) VALUES ('&1', '&2', '&3') ON DUPLICATE KEY UPDATE `adm1`='&2', `adm2`=NULL, `adm3`=NULL, `adm4`=NULL, `code1`='&3', `code2`=NULL, `code3`=NULL, `code4`=NULL", $rCache['cache_id'], $sCountry, $sCode1);
             mysql_query($sql);
         }
     }
     mysql_free_result($rsCache);
     db_disconnect();
 }
コード例 #9
0
         tpl_set_var('hidemp3_start', '');
         tpl_set_var('hidemp3_end', '');
     } else {
         tpl_set_var('mp3files', $nomp3);
         tpl_set_var('def_seq_m', 1);
         //set default sequence to 1 for add mp3 link (in case there is no mp3 at all yet))
         tpl_set_var('hidemp3_start', '');
         tpl_set_var('hidemp3_end', '');
     }
 } else {
     tpl_set_var('mp3files', '<br />');
     tpl_set_var('hidemp3_start', '<!--');
     tpl_set_var('hidemp3_end', '-->');
 }
 //Add Waypoint
 if (checkField('waypoint_type', $lang)) {
     $lang_db = $lang;
 } else {
     $lang_db = "en";
 }
 $cache_type = $cache_record['type'];
 if ($cache_type != GeoCache::TYPE_MOVING) {
     tpl_set_var('waypoints_start', '');
     tpl_set_var('waypoints_end', '');
     $wp_rs = sql("SELECT `wp_id`, `type`, `longitude`, `latitude`,  `desc`, `status`, `stage`, `waypoint_type`.`&1` wp_type, waypoint_type.icon wp_icon FROM `waypoints` INNER JOIN waypoint_type ON (waypoints.type = waypoint_type.id) WHERE `cache_id`='&2' ORDER BY `stage`,`wp_id`", $lang_db, $cache_id);
     if (mysql_num_rows($wp_rs) != 0) {
         $waypoints = '<table id="gradient" cellpadding="5" width="97%" border="1" style="border-collapse: collapse; font-size: 11px; line-height: 1.6em; color: #000000; ">';
         $waypoints .= '<tr>';
         if ($cache_type == GeoCache::TYPE_OTHERTYPE || $cache_type == GeoCache::TYPE_MULTICACHE || $cache_type == GeoCache::TYPE_QUIZ) {
             $waypoints .= '<th align="center" valign="middle" width="30"><b>' . tr('stage_wp') . '</b></th>';
         }
コード例 #10
0
//prepare the templates and include all neccessary
//  require_once('./lib/common.inc.php');
//Preprocessing
if ($error == false) {
    require "../lib/jpgraph/src/jpgraph.php";
    require "../lib/jpgraph/src/jpgraph_pie.php";
    require "../lib/jpgraph/src/jpgraph_pie3d.php";
    $year = '';
    // check for old-style parameters
    if (isset($_REQUEST['userid']) && isset($_REQUEST['t'])) {
        $user_id = $_REQUEST['userid'];
        $tit = $_REQUEST['t'];
    }
    $y = array();
    $x = array();
    if (checkField('cache_type', $lang)) {
        $lang_db = $lang;
    } else {
        $lang_db = "en";
    }
    if ($tit == "cc") {
        // Ustawic sprawdzanie jezyka  w cache_type.pl !!!!
        $rsCreateCachesYear = sql("SELECT COUNT(`caches`.`type`) `count`, `cache_type`.`&1` `type` FROM `caches` INNER JOIN `cache_type` ON (`caches`.`type`=`cache_type`.`id`) WHERE `user_id`=&2 AND status <> 4 AND status <>5 GROUP BY `caches`.`type` ORDER BY `count` DESC", $lang_db, $user_id);
        if ($rsCreateCachesYear !== false) {
            $xtitle = "";
            while ($ry = mysql_fetch_array($rsCreateCachesYear)) {
                $y[] = $ry['count'];
                $x[] = $ry['type'];
            }
        }
        mysql_free_result($rsCreateCachesYear);
コード例 #11
0
ファイル: DbKffd.php プロジェクト: GuessWho/don-t-enter
 $file = file("{$fn}");
 //делаю из файла массив
 echo ' оличество записей в KFFD - ';
 echo count($file) . '<br />';
 foreach ($file as $k => $item) {
     $item = explode('', $item);
     //разбиваю ¤чейки массива на массивы
     array_shift($item);
     //удал¤ю из второго массива 3 первых ¤чейки
     //array_shift($item);
     //array_shift($item);
     $author = mysql_real_escape_string(checkField($item, "100", "author"));
     //присваеваю переменным значени¤ ¤чеек второго массива
     $title = mysql_real_escape_string(checkField($item, "245", "title"));
     $rubric = mysql_real_escape_string(checkField($item, "650", "rubric"));
     $keyword = mysql_real_escape_string(checkField($item, "653", "keyword"));
     $rubric = str_replace('a', '; ', $rubric);
     //мен¤ю символы на розделительные знаки
     $rubric = str_replace('x', '-', $rubric);
     $rubric = str_replace('z', ' ', $rubric);
     $rubric = str_replace('y', ' ', $rubric);
     $title = str_replace('b', ' ', $title);
     $title = str_replace('h', ' ', $title);
     $keyword = str_replace('a', ' ', $keyword);
     $person = str_replace('x', ' ', $person);
     $person = str_replace('z', ' ', $person);
     $sql = "INSERT INTO kffd (author, title, rubric, keyword)\n\t\t\t\t\t\t\tVALUES ('{$author}', '{$title}', '{$rubric}', '{$keyword}')";
     //формирую запросс бд
     mysql_query($sql) or die('Add error!');
 }
 mysql_close();
コード例 #12
0
function db_CountryFromShort($countrycode)
{
    global $dblink, $lang;
    //no databse connection?
    if ($dblink === false) {
        return false;
    }
    //select the right record
    if (checkField('cache_status', $lang)) {
        $lang_db = $lang;
    } else {
        $lang_db = "en";
    }
    $rs = sql("SELECT `short`, `&1` FROM `countries` WHERE `short`='&2'", $lang_db, $countrycode);
    if (mysql_num_rows($rs) > 0) {
        $record = sql_fetch_array($rs);
        //return the country
        return $record[$lang_db];
    } else {
        //country not found
        return false;
    }
}
コード例 #13
0
ファイル: DbMethod_inc.php プロジェクト: GuessWho/don-t-enter
 foreach ($file as $k => $item) {
     $item = strip_tags($item);
     $item = explode('&#30;', $item);
     //разбиваю ¤чейки массива на массивы
     array_shift($item);
     //удал¤ю из второго массива 3 первых ¤чейки
     array_shift($item);
     array_shift($item);
     $author = mysql_real_escape_string(checkField($item, "100", "author"));
     //присваеваю переменным значени¤ ¤чеек второго массива
     $title = mysql_real_escape_string(checkField($item, "245", "title"));
     $rubric = mysql_real_escape_string(checkField($item, "650", "rubric"));
     $keyword = mysql_real_escape_string(checkField($item, "653", "keyword"));
     $person = mysql_real_escape_string(checkField($item, "600", "person"));
     $geograf = mysql_real_escape_string(checkField($item, "651", "geograf"));
     $sourse = mysql_real_escape_string(checkField($item, "773", "sourse"));
     $rubric = str_replace('&#31;a', '; ', $rubric);
     //мен¤ю символы на розделительные знаки
     $rubric = str_replace('&#31;x', '-', $rubric);
     $rubric = str_replace('&#31;z', ' ', $rubric);
     $rubric = str_replace('&#31;y', ' ', $rubric);
     $title = str_replace('&#31;b', ' ', $title);
     $title = str_replace('&#31;h', ' ', $title);
     $keyword = str_replace('&#31;a', ' ', $keyword);
     $person = str_replace('&#31;x', ' ', $person);
     $person = str_replace('&#31;z', ' ', $person);
     $geograf = str_replace('&#31;x', ' ', $geograf);
     $geograf = str_replace('&#31;z', ' ', $geograf);
     $sourse = str_replace('&#31;d', '.-', $sourse);
     $sourse = str_replace('&#31;g', '.-', $sourse);
     $person = str_replace('31;a', '', $person);
コード例 #14
0
ファイル: install.php プロジェクト: TitanKing/PHPDevShell
function checkFields()
{
    global $data, $errors;
    checkField('application_name', _('Please supply the Application Name.'), _('Your Application Name V-1.0.0'));
    checkField('admin_username', _('Please supply the Admin Login Username.'), _('root'));
    checkField('admin_password', _('Please supply the Admin Login Password.'), _('root'));
    checkField('admin_email', _('Please supply the Admin Email.'), _('*****@*****.**'));
    checkField('db_name', _('Please supply the Database Name.'), 'phpdevdbname');
    checkField('db_username', _('Please supply the Database Username.'), 'phpdev');
    checkField('db_password', _('Please supply the Database Password.'), 'phpdev');
    checkField('db_server', _('Please supply the Database Server Address.'), 'localhost');
    checkField('db_prefix', _('Please supply the Database Prefix.'), 'pds_');
    checkField('config_file', _('Please supply the Config File.'), 'single-site.config.php');
    if (filter_var($data['admin_email'], FILTER_VALIDATE_EMAIL) == FALSE) {
        addError('admin_email', _('Your email address seems to be invalid. Please make sure you entered your email address correctly.'));
    }
    return count($errors) == 0;
}
コード例 #15
0
         $record_logs = sql_fetch_array($rs_caches2);
         $tmp_cache = $cache_line;
         $tmp_cache = mb_ereg_replace('{cacheimage}', icon_cache_status($record_logs['status'], $record_logs['cache_status_text']), $tmp_cache);
         $tmp_cache = mb_ereg_replace('{cachestatus}', htmlspecialchars($record_logs['cache_status_text'], ENT_COMPAT, 'UTF-8'), $tmp_cache);
         $tmp_cache = mb_ereg_replace('{cacheid}', htmlspecialchars(urlencode($record_logs['cache_id']), ENT_COMPAT, 'UTF-8'), $tmp_cache);
         $tmp_cache = mb_ereg_replace('{date}', $record_logs['date'], $tmp_cache);
         $tmp_cache = mb_ereg_replace('{cachename}', htmlspecialchars($record_logs['name'], ENT_COMPAT, 'UTF-8'), $tmp_cache);
         $tmp_cache = mb_ereg_replace('{wpname}', htmlspecialchars($record_logs['wp_name'], ENT_COMPAT, 'UTF-8'), $tmp_cache);
         $content .= "\n" . $tmp_cache;
     }
     mysql_free_result($rs_caches2);
     $content .= '</ul></div>';
 }
 //get blocked caches by OC Team
 //get last hidden caches
 if (checkField('cache_status', $lang)) {
     $lang_db = $lang;
 } else {
     $lang_db = "en";
 }
 $rs_caches3 = sql(" SELECT  `cache_id`, `name`, DATE_FORMAT(`date_hidden`,'%d-%m-%Y') AS `date`, `status`,\n                            `cache_status`.`id` AS `cache_status_id`, `cache_status`.`&1` AS `cache_status_text`, `caches`.`wp_oc` AS `wp_name`\n                        FROM `caches`, `cache_status`\n                        WHERE `user_id`='&2'\n                          AND `cache_status`.`id`=`caches`.`status`\n                          AND `caches`.`status` = 6\n                        ORDER BY `date_hidden` DESC, `caches`.`date_created` DESC", $lang_db, $user_id);
 if (mysql_num_rows($rs_caches3) != 0) {
     $content .= '<br /><p><span class="content-title-noshade txt-blue08">' . tr('caches_blocked') . ':</span></p><br /><div><ul style="margin: -0.9em 0px 0.9em 0px; padding: 0px 0px 0px 10px; list-style-type: none; line-height: 1.2em; font-size: 115%;">';
     for ($i = 0; $i < mysql_num_rows($rs_caches3); $i++) {
         $record_logs = sql_fetch_array($rs_caches3);
         $tmp_cache = $cache_line;
         $tmp_cache = mb_ereg_replace('{cacheimage}', icon_cache_status($record_logs['status'], $record_logs['cache_status_text']), $tmp_cache);
         $tmp_cache = mb_ereg_replace('{cachestatus}', htmlspecialchars($record_logs['cache_status_text'], ENT_COMPAT, 'UTF-8'), $tmp_cache);
         $tmp_cache = mb_ereg_replace('{cacheid}', htmlspecialchars(urlencode($record_logs['cache_id']), ENT_COMPAT, 'UTF-8'), $tmp_cache);
         $tmp_cache = mb_ereg_replace('{date}', $record_logs['date'], $tmp_cache);
         $tmp_cache = mb_ereg_replace('{cachename}', htmlspecialchars($record_logs['name'], ENT_COMPAT, 'UTF-8'), $tmp_cache);
コード例 #16
0
require '../lib/common.inc.php';
global $lang;
//prepare the templates and include all neccessary
//  require_once('./lib/common.inc.php');
//Preprocessing
if ($error == false) {
    require "../lib/jpgraph/src/jpgraph.php";
    require "../lib/jpgraph/src/jpgraph_pie.php";
    require "../lib/jpgraph/src/jpgraph_pie3d.php";
    // check for old-style parameters
    if (isset($_REQUEST['cacheid'])) {
        $cache_id = $_REQUEST['cacheid'];
    }
    $y = array();
    $x = array();
    if (checkField('log_types', $lang)) {
        $lang_db = $lang;
    } else {
        $lang_db = "en";
    }
    // Ustawic sprawdzanie jezyka  w cache_type.pl !!!!
    $rsCSF = sql("SELECT COUNT(`cache_logs`.`type`) `count`, `log_types`.`&2` AS `type` FROM `cache_logs` INNER JOIN `log_types` ON (`cache_logs`.`type`=`log_types`.`id`) WHERE type=1 AND cache_logs.deleted=0 AND cache_logs.cache_id=&1 GROUP BY `cache_logs`.`type` ORDER BY `log_types`.`pl` ASC", $cache_id, $lang_db);
    if ($rsCSF !== false) {
        $xtitle = "";
        $ry = mysql_fetch_array($rsCSF);
        $y[] = $ry['count'];
        $x[] = $ry['type'];
    } else {
        $x[] = tr("found");
    }
    $rsCSNF = sql("SELECT COUNT(`cache_logs`.`type`) `count`, `log_types`.`&2` AS `type` FROM `cache_logs` INNER JOIN `log_types` ON (`cache_logs`.`type`=`log_types`.`id`) WHERE type=2 AND cache_logs.deleted=0 AND cache_logs.cache_id=&1 GROUP BY `cache_logs`.`type` ORDER BY `log_types`.`pl` ASC", $cache_id, $lang_db);
コード例 #17
0
<?php

// Form Submit
//On form submit contact form should be shown
$showForm = isset($_GET["contactForm"]) && $_GET["contactForm"] !== null ? "style='top: -2em;' " : "style='top: -70em;'";
$who = $why = $what = null;
//Form Fields
//Check if submitted via submit button
$mailCheck;
if ($_POST["submit"] === "Submit") {
    $where = "*****@*****.**";
    $who = checkField($_POST["user-email"]);
    $why = checkField($_POST["user-subject"]);
    $what = checkField($_POST["user-message"]);
    $what = "From " . $who . ":\r\n\r\n" . $what;
    $headers = 'From: webmaster@example.com' . "\r\n";
    $headers .= 'Reply-To: webmaster@example.com' . "\r\n";
    // $headers .= 'X-Mailer: PHP/' . phpversion();
    $mail = mail($where, $why, $what);
    //Adding the headers are not working for the moment
    $mailResult = "Your Address: " . $who . "<br/>The Subject: " . $why . "<br/>Your Message: " . $what . ".";
    if ($mail) {
        $mailCheck = "Your message has been received. I will get back to you during business hours.";
    } else {
        $mailCheck = "There was an problem and your message was not sent, if the problem persists you may email me directly at emgo.development@gmail.com";
    }
} else {
}
?>

<!-- Frame of Form -->