Ejemplo n.º 1
0
/**
 * Возвращает select со списком городов указанной страны в для фильтра регионов в каталоге фрилансеров.
 * 
 * @param int   $country название страны транслит
 * @param array $attr    опционально. атрибуты select например: array('name'=>'pf_city', 'class'=>'flt-p-sel',...);
 *
 * @return unknown
 */
function RFGetCitysByCid($country, $attr = array())
{
    $objResponse = new xajaxResponse();
    if (!$attr) {
        $attr = array('name' => 'pf_city', 'class' => 'b-select__select');
    }
    $sAttr = '';
    foreach ($attr as $key => $val) {
        $sAttr .= ' ' . $key . '="' . $val . '"';
    }
    if ($country) {
        $cities = city::GetCities(country::getCountryIDByTranslit($country));
    }
    $objResponse->script('$("b-select__city").set("html","");');
    $objResponse->script('new Element("option", { value: "0", text: "Все города" }).inject($("b-select__city"));');
    $js = '';
    if ($cities) {
        foreach ($cities as $cityid => $city) {
            $js .= 'new Element("option", { value: "' . translit(strtolower($city)) . '", text: "' . $city . '" }).inject($("b-select__city"));' . "\n";
        }
    }
    if ($js) {
        $objResponse->script($js);
    }
    return $objResponse;
}
Ejemplo n.º 2
0
/**
 * Формирует список городов для выбранной страны.
 *
 * @param integer $country_id код страны
 * @param integer $city_id    код города
 */
function ChangeCity($country_id, $city_id)
{
    $objResponse = new xajaxResponse();
    //  $countries = country::GetCountries();
    $cities = city::GetCities($country_id);
    $select = '<select name="ff_city" id="ff_city" ';
    $select .= 'style="width:254px;">';
    $select .= '<option value="0"';
    if ($city_id == 0) {
        $select .= ' selected';
    }
    $select .= '>Все города</option>';
    if ($cities) {
        foreach ($cities as $id => $city) {
            $select .= '<option value="' . $id . '"';
            if ($id == $city_id) {
                $select .= ' selected';
            }
            $select .= '>' . $city . '</option>';
        }
        $select .= '</select>';
    }
    $objResponse->assign('city_select', 'innerHTML', $select);
    return $objResponse;
}
Ejemplo n.º 3
0
/**
 * Формирует список городов для выбранной страны.
 *
 * @param integer $country_id код страны
 * @param integer $city_id код города
 */
function ChangeCity($country_id, $city_id)
{
    $objResponse = new xajaxResponse();
    //  $countries = country::GetCountries();
    $cities = city::GetCities($country_id);
    $select = "<select name=\"ff_city\" id=\"ff_city\" ";
    $select .= "style=\"width:254px;\">";
    $select .= "<option value=\"0\"";
    if ($city_id == 0) {
        $select .= " selected";
    }
    $select .= ">Все города</option>";
    if ($cities) {
        foreach ($cities as $id => $city) {
            $select .= "<option value=\"" . $id . "\"";
            if ($id == $city_id) {
                $select .= " selected";
            }
            $select .= ">" . $city . "</option>";
        }
        $select .= "</select>";
    }
    $objResponse->assign("city_select", "innerHTML", $select);
    return $objResponse;
}
Ejemplo n.º 4
0
 public function getCitys()
 {
     $citys = city::getCity(Tools::getValue());
     foreach ($citys as $city) {
         $this->citys[] = array('id' => $city['id_egms_city'], 'name' => $city['cityname1']);
     }
 }
Ejemplo n.º 5
0
function GetCities($country, $city)
{
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/city.php';
    $response = new xajaxResponse();
    $cities = city::GetCities(intval($country));
    /*$html = '<option value="0">Все города</option>';
      foreach ($cities as $id=>$val) {
          $html .= '<option value="'.$id.'">'.htmlspecialchars($val).'</option>';
      }*/
    $script = "document.getElementById('cities').options.length = 0; \n";
    $script .= "document.getElementById('cities').options[0] = new Option('Все города', 0); \n";
    $i = 1;
    foreach ($cities as $id => $val) {
        $script .= "document.getElementById('cities').options[{$i}] = new Option('" . htmlspecialchars($val) . "', {$id}); \n";
        ++$i;
    }
    $response->assign('cities', 'innerHTML', $html);
    $response->assign('cities', 'disabled', false);
    $script .= "document.getElementById('btnAddLocation').onclick = function() { locations.add(); return false; }; \n";
    if ($city) {
        $script .= "\n\t\t\tfor (var i=0; i<document.getElementById('cities').options.length; i++) {\n\t\t\t\tif (document.getElementById('cities').options[i].value == {$city}) {\n\t\t\t\t\tdocument.getElementById('cities').selectedIndex = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\t\n\t\t\t} \n\n\t\t";
    }
    $script .= 'if (spam.busy > 1) { spam.busy = 0;	spam.send(); } spam.busy = 0;';
    $response->script($script);
    return $response;
}
Ejemplo n.º 6
0
 public function getFieldsValues()
 {
     $id_egms_city = Tools::getValue('id_egms_city');
     if ($id_egms_city != false) {
         $row = city::getCity($id_egms_city);
     }
     return array('id_egms_city' => $id_egms_city, 'cityname1' => $row[0]['cityname1'], 'cityname2' => $row[0]['cityname2'], 'cityname3' => $row[0]['cityname3'], 'psyname' => $row[0]['psyname'], 'alias' => $row[0]['alias']);
 }
Ejemplo n.º 7
0
 function setupNewUser()
 {
     global $db;
     require_once dirname(__FILE__) . '/connectDB.php';
     mysql_query("INSERT INTO server_data (server_id,user_id,`key`,value) VALUES (" . $this->server->getID() . ",{$this->userid},'gold'," . $this->server->getInitialGold() . ")", $db) or die(mysql_error());
     $this->gold = $this->server->getInitialGold();
     mysql_query("INSERT INTO server_data (server_id,user_id,`key`,value) VALUES (" . $this->server->getID() . ",{$this->userid},'city_count',0)", $db) or die(mysql_error());
     mysql_query("INSERT INTO server_data (server_id,user_id,`key`,value) VALUES (" . $this->server->getID() . ",{$this->userid},'last_online',0)", $db) or die(mysql_error());
     mysql_query("INSERT INTO server_data (server_id,user_id,`key`,value) VALUES (" . $this->server->getID() . ",{$this->userid},'rank',0)", $db) or die(mysql_error());
     for ($i = 0; $i < $this->server->getInitialCityCount(); $i++) {
         city::build_city($this, $this->server, false);
     }
     //end for $i < $this->server->getInitialCities()
 }
Ejemplo n.º 8
0
function GetCitysByCid($country_id)
{
    $objResponse = new xajaxResponse();
    if ($country_id) {
        $cities = city::GetCities($country_id);
    }
    $out_text = '<select name="city" class="apf-select"><option value="0">Не выбрано</option>';
    if ($cities) {
        foreach ($cities as $cityid => $city) {
            $out_text .= '<option value=' . $cityid . '>' . $city . '</option>';
        }
    }
    $out_text .= '</select>';
    $objResponse->assign('frm_city', 'innerHTML', $out_text);
    return $objResponse;
}
Ejemplo n.º 9
0
function GetCitysByCid($country_id)
{
    $objResponse = new xajaxResponse();
    if ($country_id) {
        $cities = city::GetCities($country_id);
    }
    $out_text = "<select name=\"city\" class=\"apf-select\"><option value=\"0\">Не выбрано</option>";
    if ($cities) {
        foreach ($cities as $cityid => $city) {
            $out_text .= "<option value=" . $cityid . ">" . $city . "</option>";
        }
    }
    $out_text .= "</select>";
    $objResponse->assign("frm_city", "innerHTML", $out_text);
    return $objResponse;
}
 public function run()
 {
     $user = $this->order[$this->is_emp ? 'freelancer' : 'employer'];
     //получаем общее кол-во отзывов
     $oplinks = NULL;
     $opcount = opinions::GetCounts($user['uid'], array('total'));
     if (array_sum($opcount['total']) > 0) {
         $oplinks = array('p' => getSortOpinionLinkEx('frl', "total", 1, $user['login'], zin($opcount['total']['p']), null, 0), 'n' => getSortOpinionLinkEx('frl', "total", 2, $user['login'], zin($opcount['total']['n']), null, 0), 'm' => getSortOpinionLinkEx('frl', "total", 3, $user['login'], zin($opcount['total']['m']), null, 0));
     }
     //город юзера
     $city_id = $this->order['is_meet'] == 't' && $this->order['city'] > 0 ? $this->order['city'] : $user['city'];
     $user['place_title'] = '';
     if ($city_id > 0) {
         $user['place_title'] = city::getCountryName($city_id) . ', ' . city::getCityName($city_id);
     }
     //собираем шаблон
     $this->render('t-service-order-user-profile', array('user' => $user, 'oplinks' => $oplinks));
 }
Ejemplo n.º 11
0
 public function getInformationUser($uid = false)
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/employer.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/freelancer.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/country.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/city.php";
     if (!$uid) {
         $uid = $_SESSION['uid'];
     }
     if (is_emp()) {
         $user = new employer();
     } else {
         $user = new freelancer();
     }
     $user->GetUserByUID($uid);
     $this->setFieldInfo('uname', $user->uname);
     $this->setFieldInfo('usurname', $user->usurname);
     $this->setFieldInfo('birthday', $user->birthday);
     $this->setFieldInfo('country', $user->country);
     $this->setFieldInfo('country_name', country::GetCountryName($user->country));
     $this->setFieldInfo('city', $user->city);
     $this->setFieldInfo('city_name', city::GetCityName($user->city));
     $this->setFieldInfo('sex', $user->sex == 't' ? 1 : ($user->sex == 'f' ? 0 : -1));
     $this->setFieldInfo('info_for_reg', unserialize($user->info_for_reg));
 }
Ejemplo n.º 12
0
    echo '<b>' . $message . '</b>';
} elseif ($_POST['attack_id']) {
    echo '<b>Troop movements started!</b>';
}
if (!$tocity) {
    echo '<h2>Select a City to Attack/Move to</h2><ul>';
    if ($fromcity) {
        $close_upper_bound = intval($fromcity->getValue('id')) + 25000;
        $dbcities = mysql_query("SELECT user_id,city_id FROM server_cities WHERE server_id=" . $server->getID() . " AND city_id < {$close_upper_bound} ORDER BY city_id DESC LIMIT 50", $db) or die(mysql_error());
    } else {
        $dbcities = mysql_query("SELECT user_id,city_id FROM server_cities WHERE server_id=" . $server->getID() . " ORDER BY user_id LIMIT 50", $db) or die(mysql_error());
    }
    //end if-else fromcity
    while ($city = mysql_fetch_assoc($dbcities)) {
        $user = new user($city['user_id'], $server);
        $city = new city($city['city_id']);
        echo '<li>';
        echo '<a href="/server/' . $server->getID() . '/attack/' . $city->getValue('id') . '+' . $cities[1] . '">';
        if ($city->getValue('name')) {
            echo htmlentities($city->getValue('name')) . ' / ';
        }
        echo 'Location: ' . str_pad($city->getValue('id'), 6, '0', STR_PAD_LEFT);
        echo '</a>';
        echo ' / Population: ' . $city->getValue('population') . ' / Defense: ' . (intval($city->getValue('defense')) + 1) . ' / User: <a href="/server/' . $server->getID() . '/user/' . $user->getValue('userid') . '">' . htmlentities($user->getValue('nickname')) . '</a>';
        $can_access = $city->getValue('user_' . $LOGIN_DATA['user_id'] . '_access');
        $can_access = $can_access === true || intval($can_access) > time();
        if ($can_access) {
            echo ' - <a href="/server/' . $server->getID() . '/city/' . $city->getValue('id') . '">view</a>';
        }
        echo '</li>';
    }
Ejemplo n.º 13
0
/**
 * Проверка данных из формы.
 */
function tu_validation(&$tservice, $is_exist_feedbacks = 0)
{
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/city.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/tservices/tservices_categories.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/tservices/validation.php';
    $errors = array();
    $validator = new validation();
    $tservices_categories = new tservices_categories();
    //---
    //$tservice->title = trim(htmlspecialchars(InPost('title'),ENT_QUOTES,'cp1251'));
    //$tservice->title = antispam(__paramInit('string', NULL, 'name', NULL, 60, TRUE));
    $tservice->title = sentence_case(__paramInit('html', null, 'title', null, 100, true));
    $title = trim(stripslashes(InPost('title')));
    if (!$validator->required($title)) {
        $errors['title'] = validation::VALIDATION_MSG_REQUIRED;
    } elseif (!$validator->symbols_interval($title, 4, 100)) {
        $errors['title'] = sprintf(validation::VALIDATION_MSG_SYMBOLS_INTERVAL, 4, 100);
    }
    //---
    $tservice->price = intval(trim(InPost('price')));
    if (!$validator->is_natural_no_zero($tservice->price)) {
        $errors['price'] = validation::VALIDATION_MSG_REQUIRED_PRICE;
    } elseif (!$validator->greater_than_equal_to($tservice->price, 300)) {
        $errors['price'] = sprintf(validation::VALIDATION_MSG_PRICE_GREATER_THAN_EQUAL_TO, '300 р.');
    } elseif (!$validator->less_than_equal_to($tservice->price, 999999)) {
        $errors['price'] = sprintf(validation::VALIDATION_MSG_PRICE_LESS_THAN_EQUAL_TO, '999 999 р.');
    }
    //---
    $days_db_id = intval(trim(InPost('days_db_id')));
    if (!$validator->is_natural_no_zero($days_db_id) || !in_array($days_db_id, array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 14, 21, 30, 45, 60, 90))) {
        $errors['days'] = validation::VALIDATION_MSG_FROM_LIST;
        $days_db_id = 1;
    }
    $tservice->days = $days_db_id;
    //---
    //Если есть отзывы то не даем изменить категорию
    if (!(InPost('action') == 'save' && $is_exist_feedbacks > 0)) {
        $category_id = intval(trim(InPost('category_db_id')));
        $parent_category_id = $tservices_categories->getCategoryParentId($category_id);
        if ($parent_category_id === false) {
            $errors['category'] = validation::VALIDATION_MSG_CATEGORY_FROM_LIST;
        } else {
            $tservice->category_id = $category_id;
            //$this->property()->parent_category_id = $parent_category_id;
        }
    }
    //---
    $str_tags = trim(preg_replace('/\\s+/s', ' ', strip_tags(InPost('tags'))));
    $tags = strlen($str_tags) > 0 ? array_unique(array_map('trim', explode(',', $str_tags))) : array();
    $tags = array_filter($tags, function ($el) {
        $len = strlen(stripslashes($el));
        return $len < 80 && $len > 2;
    });
    $tags_cnt = count(array_unique(array_map('strtolower', $tags)));
    $tags = array_map(function ($value) {
        return htmlspecialchars($value, ENT_QUOTES, 'cp1251');
    }, $tags);
    $tservice->tags = $tags;
    if (!$validator->required($str_tags)) {
        $errors['tags'] = validation::VALIDATION_MSG_REQUIRED;
    } elseif ($tags_cnt > 10) {
        $errors['tags'] = sprintf(validation::VALIDATION_MSG_MAX_TAGS, 10);
    }
    //---
    $videos = __paramInit('array', null, 'videos', array());
    $videos = is_array($videos) ? array_values($videos) : array();
    if (count($videos)) {
        $tservice->videos = null;
        foreach ($videos as $key => $video) {
            if ($validator->required($video)) {
                $_video_data = array('url' => $video, 'video' => false, 'image' => false);
                //$_video = $validator->video_validate($video);
                $_video = $validator->video_validate($video);
                $is_error = true;
                if ($_video) {
                    $_video_data['url'] = $_video;
                    if ($_video_meta = $validator->video_validate_with_thumbs($_video, 0)) {
                        $_video_data = array_merge($_video_data, $_video_meta);
                        $is_error = false;
                    }
                }
                if ($is_error) {
                    $errors['videos'][$key] = validation::VALIDATION_MSG_BAD_LINK;
                }
                $tservice->videos[$key] = $_video_data;
            }
        }
    }
    //---
    //$tservice->description = trim(htmlspecialchars(InPost('description'),ENT_QUOTES, "cp1251"));
    //$description = trim(InPost('description'));
    $tservice->description = trim(__paramInit('html', null, 'description', null, 5000, true));
    $description = trim(stripslashes(InPost('description')));
    if (!$validator->required($description)) {
        $errors['description'] = validation::VALIDATION_MSG_REQUIRED;
    } elseif (!$validator->symbols_interval($description, 4, 5000)) {
        $errors['description'] = sprintf(validation::VALIDATION_MSG_SYMBOLS_INTERVAL, 4, 5000);
    }
    //---
    //$tservice->requirement = trim(htmlspecialchars(InPost('requirement'),ENT_QUOTES, "cp1251"));
    //$requirement = trim(InPost('requirement'));
    $tservice->requirement = trim(__paramInit('html', null, 'requirement', null, 5000, true));
    $requirement = trim(stripslashes(InPost('requirement')));
    if (!$validator->required($requirement)) {
        $errors['requirement'] = validation::VALIDATION_MSG_REQUIRED;
    } elseif (!$validator->symbols_interval($requirement, 4, 5000)) {
        $errors['requirement'] = sprintf(validation::VALIDATION_MSG_SYMBOLS_INTERVAL, 4, 5000);
    }
    //---
    $extra = __paramInit('array', null, 'extra', array());
    $extra = is_array($extra) ? array_values($extra) : array();
    $total_extra_price = 0;
    if (count($extra)) {
        $key = 0;
        $tservice->extra = null;
        foreach ($extra as $el) {
            if (isset($el['title'], $el['price'], $el['days_db_id'])) {
                $el['title'] = stripslashes($el['title']);
                $title = trim(htmlspecialchars($el['title'], ENT_QUOTES, 'cp1251'));
                $title_native = trim($el['title']);
                $price = trim($el['price']);
                if (!$validator->required($title_native) && !$validator->required($price)) {
                    continue;
                }
                $is_title = $validator->min_length($title_native, 4) && $validator->max_length($title_native, 255);
                $is_price = $validator->is_integer_no_zero($price) && $validator->numeric_interval($price, -999999, 999999);
                if (!$is_price) {
                    $errors['extra'][$key]['price'] = validation::VALIDATION_MSG_REQUIRED_PRICE;
                }
                if (!$is_title) {
                    $errors['extra'][$key]['title'] = sprintf(validation::VALIDATION_MSG_SYMBOLS_INTERVAL, 4, 255);
                }
                $days = trim($el['days_db_id']);
                $is_days = $validator->is_natural($days) && $validator->less_than_equal_to($days, 5);
                if (!$is_days) {
                    $errors['extra'][$key]['days'] = sprintf(validation::VALIDATION_MSG_INTERVAL, '0', '5 дней');
                    $days = 1;
                }
                $price = intval($price);
                $days = intval($days);
                $tservice->extra[$key] = array('title' => $title, 'price' => $price, 'days' => $days);
                ++$key;
                if ($price < 0) {
                    $total_extra_price += $price;
                }
            }
        }
    }
    //---
    $tservice->is_express = 'f';
    $tservice->express_price = 0;
    $tservice->express_days = 1;
    if (InPost('express_activate') == 1 && $tservice->days > 1) {
        $express = InPost('express');
        $price = trim($express['price']);
        if (!$validator->is_natural_no_zero($price) || !$validator->less_than_equal_to($price, 999999)) {
            $errors['express']['price'] = validation::VALIDATION_MSG_REQUIRED_PRICE;
        }
        $days_db_id = intval(trim($express['days_db_id']));
        if (!$validator->is_natural_no_zero($days_db_id) || !in_array($days_db_id, array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 14, 21, 30, 45, 60, 90))) {
            $errors['express']['days'] = validation::VALIDATION_MSG_FROM_LIST;
            $days_db_id = 1;
        }
        $tservice->is_express = 't';
        $tservice->express_price = intval($price);
        $tservice->express_days = $days_db_id;
    }
    //---
    //Проверка общей суммы с учетом скидок, опций (срочность не учитываю так как она выбирается по желанию)
    if (!isset($errors['price']) && !$validator->greater_than_equal_to($tservice->price + $total_extra_price, 300)) {
        $errors['price'] = sprintf(validation::VALIDATION_MSG_PRICE_MIN_TOTAL, '300 р.');
    }
    //---
    //TODO: Есть проблема с контроллом выпадающего списка
    // он не отрабатывает новое значение укзанное по умолчанию
    if (!in_array(intval(InPost('distance')), array(1, 2))) {
        $errors['distance'] = validation::VALIDATION_MSG_FROM_RADIO;
    } elseif (intval(InPost('distance')) == 2) {
        $city_db_id = intval(InPost('city_db_id'));
        $city = new city();
        if ($city_db_id <= 0 || !$city->getCityName($city_db_id)) {
            $errors['distance'] = validation::VALIDATION_MSG_CITY_FROM_LIST;
        } else {
            $tservice->city = intval(InPost('city_db_id'));
            $tservice->is_meet = 't';
        }
    } else {
        $tservice->is_meet = 'f';
    }
    //---
    $tservice->agree = InPost('agree') == 1 ? 't' : 'f';
    if ($tservice->agree === 'f') {
        $errors['agree'] = validation::VALIDATION_MSG_ONE_REQUIRED;
    }
    //---
    if (in_array(InPost('active'), array(0, 1))) {
        $tservice->active = intval(InPost('active')) == 1 ? 't' : 'f';
        if ($tservice->is_angry) {
            $tservice->active = 't';
        }
    }
    //---
    //Вырезаем слеши если ошибка
    if (count($errors) > 0) {
        $attrs = array('title', 'description', 'requirement', 'tags');
        foreach ($attrs as $attr) {
            if (is_array($tservice->{$attr})) {
                foreach ($tservice->{$attr} as &$value) {
                    $value = stripslashes($value);
                }
            } else {
                $tservice->{$attr} = stripslashes($tservice->{$attr});
            }
        }
    }
    return $errors;
}
Ejemplo n.º 14
0
<?php

require 'components/get_listview_referrer.php';
require 'subclasses/city.php';
$dbh_city = new city();
$dbh_city->set_where("city_id='" . quote_smart($city_id) . "'");
if ($result = $dbh_city->make_query()->result) {
    $data = $result->fetch_assoc();
    extract($data);
}
Ejemplo n.º 15
0
 public function getAddresssave(Request $request, $id = 0)
 {
     $request->session()->reflash();
     $user = $request->user();
     $locations = $user->locationDetected();
     $citys = city::apiGet();
     $userCity = City::showCity($locations['city']);
     $TITLE = '添加地址';
     $address = '';
     if ($id) {
         $TITLE = '修改地址';
         $address = Address::apiFind($id);
     }
     return view('auth.account.addressave', ['TITLE' => $TITLE, 'META_KEYWORDS' => META_KEYWORDS, 'META_DESC' => META_DESC, 'PAGE_CODE' => 'auth.account.addressave', 'user' => $user, 'citys' => $citys, 'userCity' => $userCity, 'address' => $address, 'id' => $id]);
 }
Ejemplo n.º 16
0
/**
 * Отдает HTML для Редактирование проектов и конкурсов
 * 
 * @param  object $objResponse xajaxResponse
 * @param  string $rec_id идентификатор записи
 * @param  string $rec_type тип записи
 * @param  array $aParams дополнительные параметры с UID отправителя. остальные - опционально
 * @return string
 */
function _admEditProjectsParseForm(&$objResponse, $rec_id = '', $rec_type = '', $aParams = array())
{
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/city.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/country.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/professions.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/attachedfiles.php';
    $sTmpKey = md5(uniqid($_SESSION['uid']));
    $tmpPrj = new tmp_project($sTmpKey);
    $prj = $tmpPrj->init(1, $rec_id);
    $tmpPrj->fix();
    // $aFolders   = projects::getUserFolders( $prj['user_id'] ); // папки
    $remTPeriod = $tmpPrj->getRemainingTopPeriod($remTD, $remTH, $remTM, $remtverb);
    // закрепление
    // страны и города
    $countries = country::GetCountries();
    if ($prj['country']) {
        $cities = city::GetCities($prj['country']);
    }
    // разделы
    $categories = professions::GetAllGroupsLite();
    $professions = professions::GetAllProfessions();
    array_group($professions, 'groupid');
    $professions[0] = array();
    $project_categories = new_projects::getSpecs($rec_id);
    if (empty($project_categories)) {
        $project_categories[] = array('category_id' => 0, 'subcategory_id' => 0);
    }
    ob_start();
    include_once $_SERVER['DOCUMENT_ROOT'] . '/user/adm_edit_tpl/projects.php';
    $sHtml = ob_get_contents();
    ob_end_clean();
    // текст
    $sOnReady = "if(document.getElementById('adm_edit_descr')) \n        document.getElementById('adm_edit_descr').value = (\$('adm_edit_descr_source')? \$('adm_edit_descr_source').value : null);";
    // аттачи
    $sAttach = getAttachedFilesJs(projects::GetAllAttach($rec_id), tmp_project::MAX_FILE_COUNT, tmp_project::MAX_FILE_SIZE, 'project');
    $objResponse->assign('h4_adm_edit', 'innerHTML', 'Редактировать ' . ($rec_type == '7' ? 'конкурс' : 'проект'));
    $objResponse->assign('div_adm_edit', 'innerHTML', $sHtml);
    $objResponse->script("\$('div_adm_reason').setStyle('display', 'none');");
    $objResponse->script("adm_edit_content.editMenuItems = ['', 'Основное', 'Файлы', 'Платные услуги'];");
    $objResponse->script('adm_edit_content.edit();');
    $objResponse->script($sAttach);
    $objResponse->script($sOnReady);
    $objResponse->script("var mx = new MultiInput('adm_edit_professions','category_line'); mx.init();");
    $objResponse->script('xajax_getAdmEditReasons(' . admin_log::ACT_ID_EDIT_PROJECTS . ');');
    // для конкурса даты окончания и определения победителей
    if ($prj['kind'] == 7) {
        $objResponse->script("new tcal ({ 'formname': 'adm_edit_frm', 'controlname': 'adm_edit_end_date', 'iconId': 'end_date_btn', 'clickEvent': function(){ adm_edit_content.hideError('end_date'); } });");
        $objResponse->script("new tcal ({ 'formname': 'adm_edit_frm', 'controlname': 'adm_edit_win_date', 'iconId': 'win_date_btn', 'clickEvent': function(){ adm_edit_content.hideError('win_date'); } });");
    }
}
Ejemplo n.º 17
0
<?php

$city = city::select()->where("`name` = '?'", $parts[1])->one();
if ($city === false) {
    return 404;
}
$smarty->contentType('text', 'json');
$venues = venue::select()->where(isset($parts[2]) ? array($city, 'type' => $parts[2]) : $city)->order_by('title')->many();
echo '{"license": "Copyright, All Rights Reserved, Usage of this data without explicit permission is strictly forbidden!", "name": "' . $city->name . '", "title": "' . $city->title . '", "data": [';
foreach ($venues as $key => $venue) {
    if ($key > 0) {
        echo ",";
    }
    $data = $venue->get_row();
    $hours = hours::select()->where($venue)->many();
    unset($data['id']);
    unset($data['city_id']);
    $data['hours'] = array(null, null, null, null, null, null, null);
    foreach ($hours as $hour) {
        foreach (explode(',', $hour->weekday) as $day) {
            switch ($day) {
                case 'mon':
                    $data['hours'][0] = array($hour->open, $hour->close);
                    break;
                case 'tue':
                    $data['hours'][1] = array($hour->open, $hour->close);
                    break;
                case 'wed':
                    $data['hours'][2] = array($hour->open, $hour->close);
                    break;
                case 'thu':
Ejemplo n.º 18
0
			<td><?php 
        echo $cntr['cnt'];
        ?>
</td>
		</tr>
		<?php 
    }
}
?>
		</table>
	</td>
	<td valign="top" style="padding: 5px;">
		<table width="100%" cellspacing="2" cellpadding="2" border="0" class="brd-tbl">
	<?php 
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/city.php';
$citys = city::CountAll(10);
if ($citys) {
    foreach ($citys as $ikey => $city) {
        ?>
		<tr>
			<td width="130"><?php 
        echo $city['city_name'];
        ?>
</td>
			<td><?php 
        echo $city['cnt'];
        ?>
</td>
		</tr>
		<?php 
    }
Ejemplo n.º 19
0
}
require_once dirname(__FILE__) . '/include/connectDB.php';
if (!$LOGIN_DATA['user_id']) {
    die('<head><title>Please log in</title></head><body><h2>Please log in.</h2></body></html>');
}
if (!$server) {
    $server = new server($_REQUEST['server_id']);
}
if (!$current_user) {
    $current_user = new user($LOGIN_DATA['user_id'], $server);
}
if ($_POST['build_city']) {
    if ($_REQUEST['city_name'] == 'City Name (optional)') {
        $_REQUEST['city_name'] = '';
    }
    $message = city::build_city($current_user, $server, true, $_REQUEST['city_name']);
    if (isset($_REQUEST['ajax'])) {
        if ($message) {
            die($message);
        } else {
            exit('City built.');
        }
    }
    //end if ajax
}
//end if build city
?>
	<head>
		<title>The Project - <?php 
echo $server->getName();
?>
Ejemplo n.º 20
0
//****************************************************************************************
//Generated by Cobalt, a rapid application development framework. http://cobalt.jvroig.com
//Cobalt developed by JV Roig (jvroig@jvroig.com)
//****************************************************************************************
require 'path.php';
init_cobalt('Edit city');
if (isset($_GET['city_id'])) {
    $city_id = urldecode($_GET['city_id']);
    require 'form_data_city.php';
}
if (xsrf_guard()) {
    init_var($_POST['btn_cancel']);
    init_var($_POST['btn_submit']);
    require 'components/query_string_standard.php';
    require 'subclasses/city.php';
    $dbh_city = new city();
    $object_name = 'dbh_city';
    require 'components/create_form_data.php';
    extract($arr_form_data);
    if ($_POST['btn_cancel']) {
        log_action('Pressed cancel button');
        redirect("listview_city.php?{$query_string}");
    }
    if ($_POST['btn_submit']) {
        log_action('Pressed submit button');
        $message .= $dbh_city->sanitize($arr_form_data)->lst_error;
        extract($arr_form_data);
        if ($dbh_city->check_uniqueness_for_editing($arr_form_data)->is_unique) {
            //Good, no duplicate in database
        } else {
            $message = "Record already exists with the same primary identifiers!";
 public function completeData($type_role = 1)
 {
     if ($this->isDisable()) {
         header("Location: /wizard/registration/?step=1");
         exit;
     }
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/employer.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/freelancer.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/city.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/country.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/blogs.php";
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/commune.php";
     $themes_blogs = blogs::getRandomThemes(5);
     $themes_commune = commune::getRandomCommunes(3);
     $month = array('1' => 'января', '2' => 'февраля', '3' => 'марта', '4' => 'апреля', '5' => 'мая', '6' => 'июня', '7' => 'июля', '8' => 'августа', '9' => 'сентября', '10' => 'октября', '11' => 'ноября', '12' => 'декабря');
     if ($type_role == step_wizard_registration::TYPE_WIZARD_EMP) {
         $user = new employer();
         $checkPRO = $this->checkWizardPRO(array(step_employer::OP_CODE_PRO));
         $pro_emp = $checkPRO['id'] > 0 ? 1 : 0;
         if ($pro_emp) {
             $week_pro = round($checkPRO['ammount'] / 10);
         }
     } else {
         $user = new freelancer();
         $checkPRO = $this->checkWizardPRO(step_freelancer::getOperationCodePRO());
         $pro_frl = $checkPRO['id'] > 0 ? 1 : 0;
         if ($pro_frl) {
             $op_code = $checkPRO['op_code'];
         }
     }
     $user->GetUserByUID(wizard::getUserIDReg());
     $info_for_reg = unserialize($user->info_for_reg);
     $uname = $user->uname;
     $usurname = $user->usurname;
     $sex = $user->sex == 't' ? 1 : ($user->sex == 'f' ? 0 : -1);
     $birthday = strtotime($user->birthday);
     if ($birthday) {
         $bday = date('d', $birthday);
         $bmonth = (int) date('m', $birthday);
         $bmonth_value = $month[$bmonth];
         $byear = date('Y', $birthday);
     } else {
         $bday = '';
         $bmonth = (int) date('m', $birthday);
         $bmonth_value = $month[$bmonth];
         $byear = '';
     }
     $city = $user->city;
     if ($city) {
         $city_value = city::GetCityName($city);
     }
     $country = $user->country;
     if ($country) {
         $country_value = country::GetCountryName($country);
     }
     if ($type_role == step_wizard_registration::TYPE_WIZARD_EMP) {
         $company = $user->compname;
         $about_company = $user->company;
         $logo_name = $user->logo;
         $dir = "users/" . substr($user->login, 0, 2) . "/" . $user->login . "/logo/";
         $logo_path = WDCPREFIX . "/" . $dir . $user->logo;
     }
     $info['site'] = $this->loadMultiVal('site', 'site', $user);
     $info['email'] = $this->loadMultiVal('second_email', 'email', $user);
     $info['phone'] = $this->loadMultiVal('phone', 'phone', $user);
     $info['icq'] = $this->loadMultiVal('icq', 'icq', $user);
     $info['skype'] = $this->loadMultiVal('skype', 'skype', $user);
     $info['jabber'] = $this->loadMultiVal('jabber', 'jabber', $user);
     $info['lj'] = $this->loadMultiVal('ljuser', 'lj', $user);
     $action = __paramInit('string', null, 'action');
     if ($action == 'upd_info') {
         $info_for_reg = $_POST['info_for_reg'];
         if ($info_for_reg['email_0'] !== null) {
             $info_for_reg['second_email'] = $info_for_reg['email_0'];
             unset($info_for_reg['email_0']);
         }
         if ($info_for_reg['phone_0'] !== null) {
             $info_for_reg['phone'] = $info_for_reg['phone_0'];
             unset($info_for_reg['phone_0']);
         }
         if ($info_for_reg['site_0'] !== null) {
             $info_for_reg['site'] = $info_for_reg['site_0'];
             unset($info_for_reg['site_0']);
         }
         if ($info_for_reg['lj_0'] !== null) {
             $info_for_reg['ljuser'] = $info_for_reg['lj_0'];
             unset($info_for_reg['lj_0']);
         }
         if ($info_for_reg['jabber_0'] !== null) {
             $info_for_reg['jabber'] = $info_for_reg['jabber_0'];
             unset($info_for_reg['jabber_0']);
         }
         if ($info_for_reg['skype_0'] !== null) {
             $info_for_reg['skype'] = $info_for_reg['skype_0'];
             unset($info_for_reg['skype_0']);
         }
         if ($info_for_reg['icq_0'] !== null) {
             $info_for_reg['icq'] = $info_for_reg['icq_0'];
             unset($info_for_reg['icq_0']);
         }
         if ($info_for_reg['compname'] !== null) {
             $info_for_reg['company'] = $info_for_reg['compname'];
             unset($info_for_reg['compname']);
         }
         $info_for_reg = array_map('intval', $info_for_reg);
         $user->info_for_reg = serialize($info_for_reg);
         $uname = __paramInit('string', null, 'uname', null, 21);
         $usurname = __paramInit('string', null, 'usurname', null, 21);
         if ($uname == '') {
             $error['uname'] = "Поле заполнено некорректно";
         }
         if ($usurname == '') {
             $error['usurname'] = "Поле заполнено некорректно";
         }
         if (!preg_match("/^[-a-zA-Zа-яёА-ЯЁ]+\$/", $uname)) {
             $error['uname'] = "Поле заполнено некорректно";
         } else {
             $user->uname = $uname;
         }
         if (!preg_match("/^[-a-zA-Zа-яёА-ЯЁ]+\$/", $usurname)) {
             $error['usurname'] = "Поле заполнено некорректно";
         } else {
             $user->usurname = $usurname;
         }
         $sex = __paramInit('int', null, 'sex', 1);
         // по умолчанию мужской пол
         $user->sex = $sex == 1 ? 't' : 'f';
         $bday = __paramInit('int', null, 'bday', null);
         $bmonth = __paramInit('int', null, 'bmonth_db_id', 1);
         $bmonth_value = __paramInit('string', null, 'bmonth');
         $byear = __paramInit('int', null, 'byear', null);
         if ($bday != null && $byear != null) {
             if (!is_numeric($bday) || !is_numeric($byear) || !checkdate($bmonth, $bday, $byear) || $byear < 1945 || $byear > date('Y')) {
                 $error['birthday'] = "Поле заполнено некорректно";
             } else {
                 $user->birthday = dateFormat("Y-m-d", $byear . "-" . $bmonth . "-" . $bday);
             }
         } else {
             $user->birthday = "1910-01-01";
         }
         if (!$error['birthday'] && $user->birthday && date("Y", strtotime($user->birthday)) >= date("Y")) {
             $error['birthday'] = "Поле заполнено некорректно";
         }
         $city = __paramInit('int', null, 'city_db_id', 0);
         $city_value = __paramInit('string', null, 'city', false);
         $country = __paramInit('int', null, 'country_db_id', 0);
         $country_value = __paramInit('string', null, 'country', false);
         if ($city == 0 && strlen($city_value) != 0) {
             $error['city'] = 'Поле заполнено некорректно';
         }
         if ($country == 0 && strlen($country_value) != 0) {
             $error['country'] = 'Поле заполнено некорректно';
         }
         $user->country = $country;
         $user->city = $city;
         $company = __paramInit('string', null, 'company') ? substr(__paramInit('string', null, 'company'), 0, 64) : '';
         $about_company = __paramInit('string', null, 'about_company');
         $user->compname = $company;
         if (strlen($about_company) > 500) {
             $error['company'] = "Количество знаков в тексте о компании превышает допустимое значение";
         } else {
             $user->company = $about_company;
         }
         $logo_id = __paramInit('int', null, 'logo_company');
         $logo_name = __paramInit('string', null, 'logo_name');
         if ($logo_name) {
             $user->logo = $logo_name;
             $user->Update(wizard::getUserIDReg(), $res);
         }
         $info['site'] = $this->initMultiVal('site');
         $info['email'] = $this->initMultiVal('email');
         $info['phone'] = $this->initMultiVal('phone');
         $info['icq'] = $this->initMultiVal('icq');
         $info['skype'] = $this->initMultiVal('skype');
         $info['jabber'] = $this->initMultiVal('jabber');
         $info['lj'] = $this->initMultiVal('lj');
         if (!empty($info['site'])) {
             foreach ($info['site'] as $i => $value) {
                 $name = 'site' . ($i != 0 ? "_{$i}" : "");
                 if (!url_validate(addhttp($value), true) && trimhttp($value) != '') {
                     $error[$name] = "Поле заполнено некорректно";
                 } else {
                     $user->{$name} = addhttp($value);
                 }
             }
         }
         if (!empty($info['email'])) {
             foreach ($info['email'] as $i => $value) {
                 if ($i == 0) {
                     $name_save = "second_email";
                 } else {
                     $name_save = "email_{$i}";
                 }
                 $name = 'email' . ($i != 0 ? "_{$i}" : "");
                 if (!is_email($value) && $value != '') {
                     $error[$name] = "Поле заполнено некорректно";
                 } else {
                     $user->{$name_save} = $value;
                 }
             }
         }
         if (!empty($info['phone'])) {
             foreach ($info['phone'] as $i => $value) {
                 $name = 'phone' . ($i != 0 ? "_{$i}" : "");
                 if (!preg_match("/^[-+0-9)( #]*\$/", $value)) {
                     $error[$name] = "Поле заполнено некорректно";
                 } else {
                     $user->{$name} = $value;
                 }
             }
         }
         if (!empty($info['icq'])) {
             foreach ($info['icq'] as $i => $value) {
                 $name = 'icq' . ($i != 0 ? "_{$i}" : "");
                 if (!preg_match("/^[-0-9\\s]*\$/", $value) && !is_email($value)) {
                     $error[$name] = "Поле заполнено некорректно";
                 } else {
                     $user->{$name} = $value;
                 }
             }
         }
         if (!empty($info['skype'])) {
             foreach ($info['skype'] as $i => $value) {
                 $name = 'skype' . ($i != 0 ? "_{$i}" : "");
                 $user->{$name} = $value;
             }
         }
         if (!empty($info['jabber'])) {
             foreach ($info['jabber'] as $i => $value) {
                 $name = 'jabber' . ($i != 0 ? "_{$i}" : "");
                 if (strlen($value) > 255) {
                     $error[$name] = "Количество знаков превышает допустимое значение";
                 } else {
                     $user->{$name} = $value;
                 }
             }
         }
         if (!empty($info['lj'])) {
             foreach ($info['lj'] as $i => $value) {
                 if ($i == 0) {
                     $name_save = "ljuser";
                 } else {
                     $name_save = "lj_{$i}";
                 }
                 $name = 'lj' . ($i != 0 ? "_{$i}" : "");
                 if (!preg_match("/^[a-zA-Z0-9_-]*\$/", $value)) {
                     $error[$name] = "Поле заполнено некорректно";
                 } else {
                     $user->{$name_save} = $value;
                 }
             }
         }
         if ($type_role == step_wizard_registration::TYPE_WIZARD_EMP) {
             $pro_emp = __paramInit('int', null, 'pro-emp', false);
             if ($pro_emp) {
                 $week_pro = round(__paramInit('int', null, 'week_pro', 0));
             }
         } else {
             $ammount = 0;
             $pro_frl = __paramInit('int', null, 'pro-frl', false);
             if ($pro_frl) {
                 $pro = __paramInit('string', null, 'pro', -1);
                 switch ($pro) {
                     case "1week":
                         $op_code = 76;
                         $ammount = 7;
                         break;
                     case "1":
                         $op_code = 48;
                         $ammount = 19;
                         break;
                     case "3":
                         $op_code = 49;
                         $ammount = 54;
                         break;
                     case "6":
                         $op_code = 50;
                         $ammount = 102;
                         break;
                     case "12":
                         $op_code = 51;
                         $ammount = 180;
                         break;
                     case "-1":
                     default:
                         $ammount = 0;
                         break;
                 }
             }
         }
         if (!$error && wizard::getUserIDReg()) {
             $error['save'] = $user->Update(wizard::getUserIDReg(), $res);
             if (!$error['save']) {
                 if ($type_role == step_wizard_registration::TYPE_WIZARD_EMP) {
                     $ammount = $week_pro * 10;
                     if ($ammount > 0) {
                         $checkPRO = $this->checkWizardPRO(step_employer::OP_CODE_PRO);
                         if ($checkPRO['id'] > 0) {
                             $update = array("ammount" => $ammount);
                             wizard_billing::editPaidOption($update, $checkPRO['id']);
                         } else {
                             $insert = array("wiz_uid" => step_wizard::getWizardUserID(), "op_code" => step_employer::OP_CODE_PRO, "type" => 3, "ammount" => $ammount, "parent" => wizard::getUserIDReg());
                             wizard_billing::addPaidOption($insert);
                         }
                     } else {
                         $sql = "DELETE FROM wizard_billing WHERE wiz_uid = ? AND op_code = ?";
                         $this->_db->query($sql, step_wizard::getWizardUserID(), step_employer::OP_CODE_PRO);
                     }
                 } else {
                     // Чистим
                     $sql = "DELETE FROM wizard_billing WHERE wiz_uid = ? AND op_code IN (?l)";
                     $this->_db->query($sql, step_wizard::getWizardUserID(), step_freelancer::getOperationCodePRO());
                     if ($ammount > 0) {
                         $insert = array("wiz_uid" => step_wizard::getWizardUserID(), "op_code" => $op_code, "type" => 4, "ammount" => $ammount, "parent" => wizard::getUserIDReg());
                         wizard_billing::addPaidOption($insert);
                     }
                 }
                 $this->parent->setCompliteStep(true);
                 $this->parent->setNextStep($this->parent->getPosition() + 1);
                 header("Location: /wizard/registration/");
                 exit;
             }
         }
         if ($logo_id > 0) {
             $file = new CFile($logo_id);
             $logo_path = WDCPREFIX . "/" . $file->path . $file->name;
         }
     }
     include $_SERVER['DOCUMENT_ROOT'] . "/wizard/registration/steps/tpl.step.info.php";
 }
Ejemplo n.º 22
0
                        &#160;<?php 
            echo $dContent['completed_sbr_cnt'] ? view_sbr_shield() : '';
            ?>
</h4>
                        <p>На сайте: <?php 
            echo ElapsedMnths(strtotime($dContent['reg_date']));
            ?>
</p>
                        <p>
                        <?php 
            if (!$info_for_reg['country'] || get_uid(false)) {
                if (intval($dContent['country']) != 0) {
                    print country::GetCountryName($dContent['country']);
                    if ($dContent['city'] && !$info_for_reg['city'] || get_uid(false)) {
                        if (intval($dContent['city']) != 0) {
                            print ", " . city::GetCityName($dContent['city']);
                        }
                    }
                }
            }
            //else
            ?>
					    </p>
                    </div>
                    <?php 
            if ($n == 3) {
                echo '<div style="clear:both;">&nbsp;</div>';
                $n = 0;
            }
            ?>
                    <?php 
Ejemplo n.º 23
0
    echo $bill->user['email'];
    ?>
">
                        </div>
                    </div>
                </td>
            </tr>
            <tr class="b-layout__tr">
                <td class="b-layout__td b-layout__td_padbot_20">
                    <div class="b-layout__txt b-layout__txt_fontsize_15 b-layout__txt_padtop_3">Город</div>
                </td>
                <td class="b-layout__td b-layout__td_padbot_20 b-layout__td_padleft_10">
                    <div class="b-combo">
                        <div class="b-combo__input b-combo__input_width_280">
                            <input class="b-combo__input-text" name="City" id="City" type="text" size="80" value="<?php 
    echo $bill->user['city'] ? city::getCityName($bill->user['city']) : "";
    ?>
">
                        </div>
                    </div>
                </td>
            </tr>
            <tr class="b-layout__tr">
                <td class="b-layout__td b-layout__td_padbot_20">
                    <div class="b-layout__txt b-layout__txt_fontsize_15 b-layout__txt_padtop_3">Адрес</div>
                </td>
                <td class="b-layout__td b-layout__td_padbot_20 b-layout__td_padleft_10">
                    <div class="b-combo">
                        <div class="b-combo__input b-combo__input_width_280">
                            <input class="b-combo__input-text" name="Address" id="Address" type="text" size="80" value="">
                        </div>
Ejemplo n.º 24
0
     $i = str_replace('"', '"', $i);
     $i = str_replace("'", "\\'", $i);
     $cResult[$k] = "'{$k}' : '{$i}'";
 }
 $result[2] = $cResult;
 //города Беларусии 10
 $rows = city::GetCities(10);
 $cResult = array('0' => "'0' : 'Беларусь'", 'undefined_value' => "'undefined_value' : 'Все города'");
 foreach ($rows as $k => $i) {
     $i = str_replace('"', '"', $i);
     $i = str_replace("'", "\\'", $i);
     $cResult[$k] = "'{$k}' : '{$i}'";
 }
 $result[10] = $cResult;
 //города Казахстана     38
 $rows = city::GetCities(38);
 $cResult = array('0' => "'0' : 'Казахстан'", 'undefined_value' => "'undefined_value' : 'Все города'");
 foreach ($rows as $k => $i) {
     $i = str_replace('"', '"', $i);
     $i = str_replace("'", "\\'", $i);
     $cResult[$k] = "'{$k}' : '{$i}'";
 }
 $result[38] = $cResult;
 $tdata = array();
 foreach ($result as $k => $i) {
     $inner = "'{$i}'";
     $item = "'{$k}' : {$inner}";
     if (is_array($i)) {
         $inner = implode(',', $i);
         //join(",\n\t\t\t",
         $item = "'{$k}' : " . '{' . $inner . '}';
Ejemplo n.º 25
0
require_once dirname(__FILE__) . '/include/processCookie.php';
require_once dirname(__FILE__) . '/include/cron.php';
require_once dirname(__FILE__) . '/include/connectDB.php';
require_once dirname(__FILE__) . '/include/user.php';
require_once dirname(__FILE__) . '/include/server.php';
require_once dirname(__FILE__) . '/include/city.php';
if (!$server) {
    $server = new server($_REQUEST['server_id']);
}
if (!$current_user) {
    $current_user = new user($LOGIN_DATA['user_id'], $server);
}
?>
      <h3>Troop Movements</h3>
      <ul>
      <?php 
$transactions = mysql_query("SELECT unit_count,eta,destination,user_id FROM server_unit_transaction WHERE server_id=" . $server->getID() . " AND user_id=" . $current_user->getValue('userid') . " ORDER BY eta ASC", $db) or die(mysql_query());
while ($transaction = mysql_fetch_assoc($transactions)) {
    $city = new city($transaction['destination']);
    $dest = $city->getValue('name') ? htmlentities($city->getValue('name')) : 'City at ' . str_pad($city->getValue('id'), 6, '0', STR_PAD_LEFT);
    $is_attack = $city->getValue('user')->getValue('userid') != $transaction['user_id'];
    $time_left = round(($transaction['eta'] - time()) / 60, 2);
    if ($time_left > 0) {
        echo "\t\t\t" . '<li>' . ($is_attack ? 'Attacking ' : 'Moving to ') . $dest . ' with ' . $transaction['unit_count'] . ' troops in ' . $time_left . ' minutes </li>' . "\n";
    }
}
//end while unit
?>
      </ul>

Ejemplo n.º 26
0
 <center>

<table style="width:1%">
  <tr>
  		
 
  </tr>
   <tr>
    <td>001</td>
    <td>:</td>
     <td>Masum</td>
      <td>:</td>
    <td>Dhaka</td>		
  
 	

  </tr>
  </center>

<?php 
function __autoload($className)
{
    $fullPath = $className . ".php";
    $finalDis = "/../../../" . str_replace("\\", "/", $fullPath);
    //echo $finalDis;
    include_once $finalDis;
}
use src\Bitm\SEIP117637\city\City;
$city = new city();
$city->update();
echo "<hr>";
Ejemplo n.º 27
0
            <span class="b-icon b-icon__cont b-icon__cont_map b-icon_margleft_-35"></span>
            <?php 
    if ($info_for_reg['country'] && !$uid) {
        ?>
                <?php 
        echo $reg_string;
        ?>
            <?php 
    } elseif ($user->country) {
        ?>
                <?php 
        echo country::GetCountryName($user->country);
        if ($user->city && !($info_for_reg['city'] && !$uid)) {
            ?>
, <?php 
            echo city::GetCityName($user->city);
        }
        ?>
            <?php 
    }
    ?>
       </div>
    </div>
<?php 
}
?>

<style type="text/css">
.b-layout__txt_padleft_25 a.b-layout__link, .b-layout__txt_padleft_25  a.b-post__link { color:#000 !important; text-decoration:none;}
.b-layout__txt_padleft_25 a.b-layout__link:hover, .b-layout__txt_padleft_25 a.b-post__link:hover { color:#000 !important; text-decoration: underline;}
a.b-post__link { line-height:1.2;}
 /**
  * Обрабатывает POST переменную action  и  возвращает null или данные.
  *
  * @return string
  */
 public function processRequest()
 {
     $expire = 1;
     //3600;
     $action = __paramInit('string', '', 'action');
     switch ($action) {
         case 'getdays':
             $days = array(1 => iconv('WINDOWS-1251', 'UTF-8//IGNORE', '1 день'));
             $max = __paramInit('integer', '', 'max', 1);
             $all = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 14, 21, 30, 45, 60, 90);
             if ($max > 1) {
                 $days = array();
                 foreach ($all as $day) {
                     if ($day >= $max) {
                         break;
                     }
                     $days[$day] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $day . ending($day, ' день', ' дня', ' дней'));
                 }
             }
             $days = array(array('parentId' => '0'), $days);
             return json_encode($days);
             break;
         case 'gettucategories':
             $expire = 300;
             //3600;
             $membuf = new memBuff();
             $memkey = 'b-combo-gettucategories';
             $result = $membuf->get($memkey);
             if (!$result) {
                 /*
                  * Получаем из базы иерархию категорий для
                  * типовой услуги
                  */
                 $DB = new DB('master');
                 $sql = 'SELECT 
                             g.id AS gid, 
                             g.title AS gname, 
                             g.ucnt AS gucnt, 
                             p.id AS pid, 
                             p.title AS name,
                             p.ucnt AS pucnt
                          FROM tservices_categories AS g 
                          INNER JOIN tservices_categories AS p ON p.parent_id = g.id 
                          ORDER BY g.ucnt DESC, p.ucnt DESC --gid, pid --g.n_order, p.n_order';
                 $rows = $DB->rows($sql);
                 $result = array();
                 if (count($rows)) {
                     foreach ($rows as $k => $i) {
                         if ($result[$i['gid']] === null) {
                             $result[$i['gid']] = array('0' => array(iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['gname']), $i['gucnt']));
                             if ($i['pid'] !== null) {
                                 $result[$i['gid']][$i['pid']] = array(iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['name']), $i['pucnt']);
                             } else {
                                 $result[$i['gid']] = array(iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['gname']), $i['gucnt']);
                             }
                         } elseif (is_array($result[$i['gid']])) {
                             $result[$i['gid']][$i['pid']] = array(iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['name']), $i['pucnt']);
                         }
                     }
                 }
                 //print_r($result);
                 //exit;
                 $result = json_encode($result);
                 $membuf->add($memkey, $result, $expire);
             }
             return $result;
             break;
         case 'getlettergrouplist':
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/letters.php';
             $lettergroups = letters::getGroups($_POST['word'], (int) $_POST['limit']);
             $result = array();
             $n = 0;
             foreach ($lettergroups as $k => $i) {
                 $result[$n]['uid'] = $i['id'];
                 $result[$n]['uname'] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['title']);
                 $result[$n]['usurname'] = '';
                 $result[$n]['login'] = '';
                 $result[$n]['photo'] = '';
                 $result[$n]['path'] = '';
                 $result[$n]['isContacts'] = '';
                 ++$n;
             }
             $list = array();
             $list['list'] = $result;
             $list['counters']['moreContacts'] = 0;
             $list['counters']['moreUsers'] = 0;
             $list['dav'] = WDCPREFIX;
             return json_encode($list);
             break;
         case 'getlettergroupinfo':
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/letters.php';
             $group = letters::getGroup($_POST['uid']);
             if ($group) {
                 $data = array('record' => array('uid' => $group['id'], 'uname' => iconv('WINDOWS-1251', 'UTF-8//IGNORE', $group['title']), 'usurname' => '', 'login' => '', 'photo' => '', 'path' => '', 'isContacts' => ''), 'found' => 1, 'dav' => WDCPREFIX);
             }
             return json_encode($data);
             break;
         case 'getletterdocinfo':
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/letters.php';
             $doc = letters::getDocument($_POST['uid']);
             if ($doc) {
                 $data = array('record' => array('uid' => $doc['id'], 'uname' => iconv('WINDOWS-1251', 'UTF-8//IGNORE', $doc['id'] . ' ' . htmlspecialchars($doc['group_title']) . ' - ' . htmlspecialchars($doc['title'])), 'usurname' => '', 'login' => '', 'photo' => '', 'path' => '', 'isContacts' => ''), 'found' => 1, 'dav' => WDCPREFIX);
             }
             return json_encode($data);
             break;
         case 'getletterdoclist':
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/letters.php';
             $letterdocs = letters::getDocuments($_POST['word'], (int) $_POST['limit']);
             $result = array();
             $n = 0;
             foreach ($letterdocs as $k => $i) {
                 $result[$n]['uid'] = $i['id'];
                 $result[$n]['uname'] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['id'] . ' ' . htmlspecialchars($i['group_title']) . ' - ' . htmlspecialchars($i['title']));
                 $result[$n]['usurname'] = '';
                 $result[$n]['login'] = '';
                 $result[$n]['photo'] = '';
                 $result[$n]['path'] = '';
                 $result[$n]['isContacts'] = '';
                 ++$n;
             }
             $list = array();
             $list['list'] = $result;
             $list['counters']['moreContacts'] = 0;
             $list['counters']['moreUsers'] = 0;
             $list['dav'] = WDCPREFIX;
             return json_encode($list);
             break;
         case 'getletterdocsearch':
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/letters.php';
             $letterdocs = letters::getSearchDocuments($_POST['word'], (int) $_POST['limit']);
             $result = array();
             $n = 0;
             foreach ($letterdocs as $k => $i) {
                 $result[$n]['uid'] = $i['id'];
                 $result[$n]['uname'] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['id'] . ' ' . htmlspecialchars($i['group_title']) . ' - ' . htmlspecialchars($i['title']));
                 $result[$n]['usurname'] = '';
                 $result[$n]['login'] = '';
                 $result[$n]['photo'] = '';
                 $result[$n]['path'] = '';
                 $result[$n]['isContacts'] = '';
                 ++$n;
             }
             $list = array();
             $list['list'] = $result;
             $list['counters']['moreContacts'] = 0;
             $list['counters']['moreUsers'] = 0;
             $list['dav'] = WDCPREFIX;
             return json_encode($list);
             break;
         case 'getdate':
             return date('Y-m-d');
         case 'getprofgroups':
             $membuf = new memBuff();
             $memkey = 'b-combo-getprofgroups';
             $result = $membuf->get($memkey);
             if (!$result) {
                 $rows = professions::GetAllGroupsLite();
                 $result = array();
                 foreach ($rows as $k => $i) {
                     $result[$i['id']] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['name']);
                 }
                 $membuf->add($memkey, $result, $expire);
             }
             return json_encode($result);
         case 'getprofessionsandgroups':
             $membuf = new memBuff();
             $memkey = 'b-combo-getprofandgroups';
             $result = $membuf->get($memkey);
             if (!$result) {
                 $rows = professions::GetProfessionsAndGroup();
                 $result = array();
                 foreach ($rows as $k => $i) {
                     if ($result[$i['gid']] === null) {
                         $result[$i['gid']] = array($i['gid'] => iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['gname']));
                         if ($i['id'] !== null) {
                             $result[$i['gid']][$i['id']] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['name']);
                         } else {
                             $result[$i['gid']] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['gname']);
                         }
                     } elseif (is_array($result[$i['gid']])) {
                         $result[$i['gid']][$i['id']] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['name']);
                     }
                 }
                 $membuf->add($memkey, $result, $expire);
             }
             return json_encode($result);
         case 'getprofessions':
             $n = __paramInit('integer', '', 'id');
             if ($n !== false) {
                 $membuf = new memBuff();
                 $memkey = "b-combo-getprofbygroup{$n}";
                 $result = $membuf->get($memkey);
                 if (!$result) {
                     $rows = professions::GetProfs($n);
                     $result = array(0 => iconv('WINDOWS-1251', 'UTF-8//IGNORE', 'Все специальности'));
                     foreach ($rows as $k => $i) {
                         $result[$i['id']] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['name']);
                     }
                     $membuf->add($memkey, $result, $expire);
                 }
                 $data = array(array('parentId' => "{$n}"), $result);
                 return json_encode($data);
             }
         case 'get_pro_types':
             $membuf = new memBuff();
             $memkey = 'b-combo-get_pro_type';
             $result = $membuf->get($memkey);
             if (!$result) {
                 $rows = op_codes::getCodes(array(47, 48, 49, 50, 51));
                 $result = array();
                 foreach ($rows as $k => $i) {
                     $result[$i['id']] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['op_name']);
                 }
                 $result[76] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', 'На несколько недель');
                 $membuf->add($memkey, $result, $expire);
             }
             return json_encode($result);
         case 'getcountries':
         case 'getrelevantcountries':
             $membuf = new memBuff();
             $memkey = 'b-combo-getcountriesr';
             $result = $membuf->get($memkey);
             if (!$result) {
                 $rows = country::GetCountriesByCountUser();
                 $result = array();
                 foreach ($rows as $k => $i) {
                     $result[$i['id']] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i['name']);
                 }
                 $membuf->add($memkey, $result, $expire);
             }
             return json_encode($result);
         case 'getcities':
             $n = __paramInit('integer', '', 'id');
             if ($n !== false) {
                 $membuf = new memBuff();
                 $memkey = "b-combo-getcitybycountry{$n}";
                 $result = $membuf->get($memkey);
                 if (!$result) {
                     $rows = city::GetCities($n);
                     $result = array('0' => iconv('WINDOWS-1251', 'UTF-8//IGNORE', 'Все города'));
                     if (is_array($rows)) {
                         foreach ($rows as $k => $i) {
                             $result[$k] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i);
                         }
                     }
                     $membuf->add($memkey, $result, $expire);
                 }
                 $data = array(array('parentId' => "{$n}"), $result);
                 return json_encode($data);
             }
         case 'getcitiesbyid':
             $n = __paramInit('integer', '', 'id');
             if ($n !== false) {
                 $membuf = new memBuff();
                 $memkey = "b-combo-getcitybycountry{$n}";
                 $result = $membuf->get($memkey);
                 if (!$result) {
                     $rows = city::GetCities($n);
                     $result = array('0' => iconv('WINDOWS-1251', 'UTF-8//IGNORE', 'Все города'));
                     foreach ($rows as $k => $i) {
                         $result[$k] = iconv('WINDOWS-1251', 'UTF-8//IGNORE', $i);
                     }
                     $membuf->add($memkey, $result, $expire);
                 }
                 return json_encode($result);
             }
         case 'getuserlistbysbr':
         case 'getuserlistold':
         case 'getuserlist':
             return $this->getUsersList($_POST['word'], (int) $_POST['limit'], (int) $_POST['userType'], (int) $_POST['scope']);
         case 'get_user_info':
             return json_encode(users::GetUserShortInfo((int) $_POST['uid']));
         case 'getusersandcompanies':
             return $this->getUsersAndCompany($_POST['word'], (int) $_POST['limit'], (int) $_POST['userType'], (int) $_POST['scope'], false);
         case 'get_user_or_company_info':
             return $this->getUserOrCompanyRecord();
         case 'getsms':
             require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/registration.php';
             $registration = new registration();
             $registration->listenerAction(__paramInit('string', null, 'action'));
     }
     return false;
 }
Ejemplo n.º 29
0
// $filter_inputs -- дополнительные INPUT-ы в форму.
// $kind -- ид. закладки (если фильтр на главной странице).
// $page -- номер страницы (если фильтр на главной странице).
// Плюс должны быть включены заранее все xajax функции, которые тут используются.
if (!$uid) {
    return 0;
}
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/country.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/city.php";
$has_hidd = TRUE;
$filter_apply = $filter['active'] == "t";
$filter_categories = professions::GetAllGroupsLite(TRUE);
$filter_countries = country::GetCountries();
if ($filter['country']) {
    $filter_cities = city::GetCities($filter['country']);
}
switch ($filter_page) {
    case 1:
        $frm_action = '/proj/?p=list';
        $prmd = '&amp;';
        $has_hidd = FALSE;
        break;
    default:
        $frm_action = '/';
        $prmd = '?';
}
if (!$filter) {
    $filter = array('user_id' => $uid, 'cost_from' => '', 'cost_to' => '', 'currency' => 0, 'wo_cost' => 't', 'only_sbr' => 'f', 'country' => 0, 'city' => 0, 'keywords' => '', 'categories' => array());
}
if ($filter_params && is_array($filter_params)) {
Ejemplo n.º 30
0
                            <div class="b-menu b-menu_line b-menu_relative b-menu_padbot_10 b-menu__cat b-menu_zindex_6" >
                            <?php 
if (false) {
    $region_filter_txt = '<strong>Все</strong>';
    if ($filter_apply) {
        $region_filter_country_id = $mFilter['country'];
        $region_filter_city_id = $mFilter['city'];
    } else {
        $region_filter_country_id = $_SESSION['region_filter_country'];
        $region_filter_city_id = $_SESSION['region_filter_city'];
    }
    $_SESSION['region_filter_country'] = $region_filter_country_id;
    $_SESSION['region_filter_city'] = $region_filter_city_id;
    $region_filter_countries = country::GetCountries();
    if ($region_filter_country_id) {
        $region_filter_cities = city::GetCities($region_filter_country_id);
    }
    if ($region_filter_country_id) {
        foreach ($region_filter_countries as $countid => $country) {
            if ($countid == $region_filter_country_id) {
                $region_filter_country_txt = $country;
            }
        }
        $region_filter_txt = '<strong>' . $region_filter_country_txt . '</strong>';
        if ($region_filter_city_id) {
            foreach ($region_filter_cities as $cityid => $city) {
                if ($cityid == $region_filter_city_id) {
                    $region_filter_city_txt = $city;
                }
            }
            $region_filter_txt .= ', <strong>' . $region_filter_city_txt . '</strong>';