Ejemplo n.º 1
0
function print_form($db, $smarty, $print_ad = 0)
{
    // функция вывода формы
    $add_query = get_ad($db, $print_ad);
    $row = mysqli_fetch_assoc($add_query);
    $smarty->assign('print_ad', $row);
    $add = array();
    $add_query = get_all($db);
    while ($row = mysqli_fetch_assoc($add_query)) {
        $add[$row['id']] = $row;
    }
    $smarty->assign('add', $add);
    $smarty->assign('cities', get_cities($db));
    $smarty->assign('category', get_category($db));
    $smarty->display('dz9-form.tpl');
}
Ejemplo n.º 2
0
    if (empty($errors)) {
        if ($_POST['show_preview'] == 'true') {
            $smarty->assign('show_preview', true);
        } else {
            escape($_POST, array('description'));
            $data = array('company' => $company, 'url' => $url, 'title' => $title, 'summary' => $summary, 'city_id' => $city_id, 'category_id' => $category_id, 'type_id' => $type_id, 'description' => $description, 'location_outside_ro_where' => $isCitySelected ? '' : $location_outside_ro_where, 'apply' => '', 'poster_email' => $poster_email, 'apply_online' => $apply_online);
            if ($id != 0) {
                $job->Edit($data);
            } else {
                // a job posted by the admin is active from the beginning
                $data['is_temp'] = 0;
                $data['is_active'] = 1;
                $data['spotlight'] = 0;
                if ($jobId = $job->Create($data)) {
                    Subscriber::sendJob($jobId);
                }
            }
            $category = get_category_by_id($category_id);
            redirect_to(BASE_URL . URL_JOBS . '/' . $category['var_name'] . '/');
            exit;
        }
    } else {
        $smarty->assign('errors', $errors);
    }
}
$smarty->assign('job', $jobToEdit);
$smarty->assign('categories', get_categories());
$smarty->assign('types', get_types());
$smarty->assign('cities', get_cities());
$html_title = $translations['jobs']['title_edit'] . ' / ' . SITE_NAME;
$template = 'edit-post.tpl';
Ejemplo n.º 3
0
<?php

/* -- DEFINED VARIABLE -- */
// REQUEST
$category_id = $_REQUEST['cat_id'];
// CALL FUNCTION
$category = get_city($category_id);
$check = count_job($category_id);
$city = get_cities();
//$category_name =
if (isset($_POST['btn_detail_store_job'])) {
    // DEFINED VARIABLE
    $active = '1';
    $visibility = $_POST['visibility_status'];
    $city_name = stripslashes($_POST['category_name']);
    $cat_id = $_POST['cat_id'];
    $category = $_POST['category_department'];
    $desc = stripslashes($_POST['career_description']);
    $map = stripslashes($_POST['category_maps']);
    if ($_POST['btn_detail_job'] == 'Delete') {
        delete($cat_id);
        $_SESSION['alert'] = 'success';
        $_SESSION['msg'] = 'Item has been successfully deleted.';
    } else {
        update($city_name, $category, $desc, $map, $visibility, $cat_id);
        $_SESSION['alert'] = 'success';
        $_SESSION['msg'] = 'Item has been successfully saved.';
    }
}
Ejemplo n.º 4
0
 public function GetJobsCountPerCity()
 {
     global $db;
     $jobsCountPerCity = array();
     $sql = 'SELECT city_id, COUNT(id) AS total FROM ' . DB_PREFIX . 'jobs WHERE is_temp = 0 AND is_active = 1 and city_id IS NOT NULL GROUP BY city_id';
     $result = $db->query($sql);
     while ($row = $result->fetch_assoc()) {
         $jobsCountPerCity[$row['city_id']] = $row['total'];
     }
     $cities = get_cities();
     $result = array();
     foreach ($cities as $city) {
         $numberOfJobsInCity = 0;
         // this check is needed because we don't have an entry if there are no jobs for a city
         if (isset($jobsCountPerCity[$city['id']])) {
             $numberOfJobsInCity = $jobsCountPerCity[$city['id']];
         }
         $result[] = array('city_name' => $city['name'], 'jobs_in_city' => $numberOfJobsInCity, 'city_ascii_name' => $city['ascii_name']);
     }
     return $result;
 }
Ejemplo n.º 5
0
// 0-новое, 1-исправление, 2-просмотр
$ads = array();
// Массив объявлений
$ad = array();
// Массив с объявлением для отображения
$err_msg = false;
$ini_file_name = 'db.ini';
if (!($ini_array = get_params_from_ini_file($ini_file_name))) {
    echo 'Отсутствует ' . $ini_file_name . ' файл. Перейдите к <a href="install.php">установке</a>';
    exit;
}
$db = DbSimple_Generic::connect('mysqli://' . $ini_array['UserName'] . ':' . $ini_array['Password'] . '@' . $ini_array['ServerName'] . '/' . $ini_array['Database']);
//$db = DbSimple_Generic::connect('mysqli://*****:*****@localhost/tet');
$db->setErrorHandler('databaseErrorHandler');
$db->setLogger('myLogger');
$cities = get_cities($db);
// Загрузка данных для селектора "Города"
$metro_stations = get_metro($db);
// Загрузка данных для селектора "Метро"
$categories = get_categories($db);
// Загрузка данных для селектора "Категории"
$msg_ad_status = '';
// Информационная строка, которая будет выводиться перед формой, и будет уведомлять пользователя о том сохранено ли его объявление
if (isset($_POST['seller_name'])) {
    // Кнопка 'Отправить' нажата?
    $post = $_POST;
    $err_msg = ad_check_n_view_errors($post);
    if ($err_msg) {
        // Заполнены ли все необходимые поля?
        $ad_flag = 1;
        // Установка флага в значение 1: не заполнены нужные поля, пользователь должен внести все необходимые данные
Ejemplo n.º 6
0
 * @package Example-application
 */
require './settings.php';
if (!empty($_POST)) {
    $id = isset($_POST['id']) ? $_POST['id'] : '';
    $currads = selectAll();
    if (isset($_GET['action']) && $_GET['action'] == 'update' && isset($currads[$id])) {
        $data = prepareData($_POST);
        updateInDb($id, $data);
    } else {
        $data = prepareData($_POST);
        insertToDb($data);
    }
} elseif (isset($_GET['del'])) {
    deleteFromDb((int) $_GET['del']);
} elseif (isset($_GET['edit']) && !isset($_GET['action'])) {
    $data = selectById($_GET['edit']);
    $formParam = prepareData($data);
}
if (!isset($formParam)) {
    $formParam = prepareData();
}
$cities = get_cities();
$categories = get_categories();
$ads = selectAll();
$smarty->assign("cities", $cities);
$smarty->assign("categories", $categories);
// assoc array group => array
$smarty->assign("formParam", $formParam);
$smarty->assign("allads", $ads);
$smarty->display('index.tpl');
Ejemplo n.º 7
0
function generate_sitemap($type)
{
    global $db;
    $sanitizer = new Sanitizer();
    // Get all links
    $result = $db->query('SELECT url FROM ' . DB_PREFIX . 'links');
    while ($row = $result->fetch_assoc()) {
        if (!strstr($row['url'], 'http://')) {
            $sitemap[BASE_URL . $row['url'] . '/'] = 1;
        }
    }
    // Get all custom pages
    $result = $db->query('SELECT url FROM ' . DB_PREFIX . 'pages');
    while ($row = $result->fetch_assoc()) {
        $sitemap[BASE_URL . $row['url'] . '/'] = 1;
    }
    // Get all categories
    $categories = get_categories();
    $i = 0;
    while ($i < count($categories)) {
        $sitemap[BASE_URL . URL_JOBS . '/' . $categories[$i]['var_name'] . '/'] = 1;
        $i++;
    }
    // Get all cities
    $cities = get_cities();
    $i = 0;
    while ($i < count($cities)) {
        $sitemap[BASE_URL . URL_JOBS_IN_CITY . '/' . $cities[$i]['ascii_name'] . '/'] = 1;
        $i++;
    }
    // Get all companies
    $result = $db->query('SELECT company FROM ' . DB_PREFIX . 'jobs WHERE is_temp = 0 AND is_active = 1 GROUP BY company');
    while ($row = $result->fetch_assoc()) {
        $sitemap[BASE_URL . URL_JOBS_AT_COMPANY . '/' . $sanitizer->sanitize_title_with_dashes($row['company']) . '/'] = 1;
    }
    // Get all active Jobs
    $result = $db->query('SELECT id, title, company FROM ' . DB_PREFIX . 'jobs WHERE is_active = 1 AND is_temp = 0');
    while ($row = $result->fetch_assoc()) {
        $sitemap[BASE_URL . URL_JOB . '/' . $row['id'] . '/' . $sanitizer->sanitize_title_with_dashes($row['title'])] = 1;
    }
    // Generate output
    if ($type == 'xml') {
        header('Content-Type: text/xml; charset="utf-8"');
        echo '<?xml version="1.0" encoding="UTF-8"?>';
        echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
        foreach ($sitemap as $url => $value) {
            echo '<url><loc>' . $url . '</loc></url>';
        }
        echo '</urlset>';
    } else {
        foreach ($sitemap as $url => $value) {
            echo $url . '<br />';
        }
    }
}
    } else {
        return true;
    }
}
$run_environment = 'prod';
// either 'dev' or 'prod'
$max_records = 3;
// only used for testing
if ($run_environment == 'dev') {
    error_reporting(E_ALL);
    ini_set('display_errors', 'On');
    require 'scraperwiki.php';
}
require 'scraperwiki/simple_html_dom.php';
$city_directory = "http://www.mrsc.org/cityprofiles/citylist.aspx";
$cities = get_cities($city_directory);
$count = 1;
foreach ($cities as $city) {
    if ($run_environment == 'prod') {
        scraperwiki::save_sqlite(array('data_url'), $city, $table_name = 'city');
        get_city_data($city['name'], $city['officials_url']);
    } else {
        $reps = get_city_data($city['name'], $city['officials_url']);
        $alldata[] = array('city' => $city, 'reps' => $reps);
    }
    $count++;
    if ($run_environment == 'dev' && $count > $max_records) {
        break;
    }
}
if ($run_environment == 'prod') {
Ejemplo n.º 9
0
        <script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
        <script src="bootstrap/js/bootstrap.js" ></script>       
        <script src="bootstrap/js/bootstrap-datepicker.js"></script>
    </head>
    <body>
        <div class="container">
            <ul class="nav nav-tabs">
                <li ><a href="index.php">Internal</a></li>
                <li class="active"><a href="external.php">External</a></li>
            </ul>
            <div class="col-lg-8 col-lg-offset-2">
                <form method="POST" action="list.php">
                <div class="form-group">
                    <label for="from" class="control-label col-sm-2" >From :</label>    
                    <?php 
$internal = get_cities();
?>
                    <select name="from" >
                        <?php 
foreach ($internal as $city) {
    ?>
                            <option value="<?php 
    echo $city['iata'];
    ?>
" ><?php 
    echo $city['name'];
    ?>
</option>                    
                        <?php 
}
?>
Ejemplo n.º 10
0
                    <textarea class="form-control" rows="4" name="gfirm-info"></textarea>
                </div>
            </div>
            <div class="form-group">
                <label for="estd" class="col-sm-2 control-label">Estd</label>
                <div class="col-sm-10 col-md-4">
                    <input type="text" class="form-control" id="estd" name="estd" placeholder="e.g. 1999" value="">
                </div>
                
            </div>
            <div class="form-group required">
                <label for="category" class="col-sm-2 control-label">City</label>
                <div class="col-sm-10 col-md-4">
                    <select class="form-control" name="city">
                        <?php 
foreach (get_cities() as $city) {
    ?>
                            <option value="<?php 
    echo $city['ID'];
    ?>
"><?php 
    echo $city['name'];
    ?>
</option>
                            
                            <?php 
}
?>
                    </select>
                </div>
                <label for="subcategory" class="col-sm-2 control-label">Area</label>
Ejemplo n.º 11
0
$mysqli = new mysqli($ini_array['ServerName'], $ini_array['UserName'], $ini_array['Password']);
if (mysqli_connect_errno()) {
    echo 'Невозможно установить соединение. Перейдите к <a href="install.php">установке</a>';
    $mysqli->close();
    exit;
}
if (!$mysqli->select_db($ini_array['Database'])) {
    echo 'БД не найдена. Перейдите к <a href="install.php">установке</a>';
    $mysqli->close();
    exit;
}
$ini_string = 'SET NAMES utf8';
if (!$mysqli->query($ini_string)) {
    die('Ошибка при выполении инструкции. ' . $ini_string . ' ' . mysqli_connect_error());
}
$cities = get_cities($mysqli);
// Загрузка данных для селектора "Города"
$metro_stations = get_metro($mysqli);
// Загрузка данных для селектора "Метро"
$subcategory = get_subcategories($mysqli);
// Загрузка данных для селектора "Категории"
$msg_ad_status = '';
// Информационная строка, которая будет выводиться перед формой, и будет уведомлять пользователя о том сохранено ли его объявление
if (isset($_POST['seller_name'])) {
    // Кнопка 'Отправить' нажата?
    $err_msg = ad_check_n_view_errors();
    if ($err_msg) {
        // Заполнены ли все необходимые поля?
        $ad = $_POST;
        $ad_flag = 1;
        // Установка флага в значение 1: не заполнены нужные поля, пользователь должен внести все необходимые данные
Ejemplo n.º 12
0
 /**
  * @param $country_id
  * @param $region_id
  * @param $lang
  * @param $offset
  * @param $city_values
  * @param Grabber $grabber
  * @throws \Exception
  */
 protected static function getCities($country_id, $region_id, $lang, $offset, &$city_values, $grabber)
 {
     try {
         foreach ($grabber->getCities($country_id, $region_id, $offset) as $city) {
             if (!isset($city_values[$city['id']])) {
                 $city_values[$city['id']] = ['city_id' => (int) $city['id'], 'country_id' => (int) $country_id, 'region_id' => (int) $region_id, 'important' => (int) $city['important'], 'name_' . $lang => $city['title']];
             } else {
                 $city_values[$city['id']]['name_' . $lang] = $city['title'];
             }
         }
     } catch (\Exception $c) {
         if (in_array((int) $c->getCode(), [1, 10, 6])) {
             sleep(2);
             get_cities($country_id, $region_id, $lang, $offset, $city_values, $grabber);
         }
         throw new \Exception($c->getMessage(), $c->getCode());
     }
 }