Exemple #1
0
 public function getTeamPhotoLink()
 {
     if (file_exists(public_path() . self::PHOTO_PATH . str2url($this->team) . self::PHOTO_TYPE)) {
         return self::PHOTO_PATH . str2url($this->team) . self::PHOTO_TYPE;
     } else {
         return self::DEFAULT_PHOTO;
     }
 }
 public function addParsedGame(GameMlsEntity $gameEntity)
 {
     $gameBO = new GameMlsBO($gameEntity);
     $data = $gameBO->toArray();
     $validator = Validator::make($data, GameRequest::getRules());
     if (!$validator->fails()) {
         $game = Game::where('mls_url', $data['mls_url'])->first();
         if (!$game) {
             $game = Game::create($data);
             if (strpos($data['icon'], 'players-ico.png') === false && $data['icon'] != config('mls.domain')) {
                 copy($data['icon'], public_path() . '/img/team_logos/' . str2url($game->team) . '.png');
             }
             return $game;
         }
     }
     return false;
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $path = public_path('img/team_logos');
     $files = File::allFiles($path);
     $this->info('Files found: ' . count($files));
     foreach ($files as $file) {
         $currentFilePath = $file->getRealPath();
         $ext = '.' . $file->getExtension();
         $filename = basename($currentFilePath, $ext);
         $fileslug = str2url($filename);
         $newfilepath = $path . '/' . $fileslug . $ext;
         if ($currentFilePath != $newfilepath) {
             copy($currentFilePath, $newfilepath);
             $this->info('File updated: ' . $fileslug);
         }
     }
     $this->info('Finished');
 }
             }
         } elseif ($name == 'category') {
             $value = str2url($value);
         } elseif ($name == 'url') {
             $exploded = explode('/', $value);
             $city = explode('.', $exploded[2]);
             $city_translit = str_replace('moskva', 'www', str_replace('sankt-peterburg', 'spb', str2url($city[0])));
             $exploded[2] = str_replace($city[0], $city_translit, $exploded[2]);
             $exploded[6] = str2url($exploded[6]);
             $exploded[7] = str2url($exploded[7]);
             $value = implode('/', $exploded);
             $exploded = explode('&', $value);
             foreach ($exploded as &$one) {
                 if (strpos($one, 'body=') !== FALSE) {
                     $tmp = substr($one, strpos($one, 'body=') + strlen('body='));
                     $translit = str2url($tmp);
                     $one = str_replace($tmp, $translit, $one);
                 }
             }
             $value = implode('&', $exploded);
             $value = str_replace('http://www.', 'http://', $value);
         }
         $writer->startElement($name);
         $writer->text($value);
         $writer->endElement();
     }
     $writer->endElement();
 }
 $writer->endDocument();
 $writer->flush();
 echo "\nFinished";
Exemple #5
0
    if (count($page['tag_ids']) > 1) {
        $page['meta_robots'] = array('noindex' => 1, 'nofollow' => 1);
    }
} elseif ('recent_cats' == $page['section']) {
    $page['meta_robots']['noindex'] = 1;
} elseif ('search' == $page['section']) {
    $page['meta_robots']['nofollow'] = 1;
}
if ($filter['enabled']) {
    $page['meta_robots']['noindex'] = 1;
}
// see if we need a redirect because of a permalink
if ('categories' == $page['section'] and isset($page['category'])) {
    $need_redirect = false;
    if (empty($page['category']['permalink'])) {
        if ($conf['category_url_style'] == 'id-name' and @$page['hit_by']['cat_url_name'] !== str2url($page['category']['name'])) {
            $need_redirect = true;
        }
    } else {
        if ($page['category']['permalink'] !== @$page['hit_by']['cat_permalink']) {
            $need_redirect = true;
        }
    }
    if ($need_redirect) {
        $redirect_url = script_basename() == 'picture' ? duplicate_picture_url() : duplicate_index_url();
        if (!headers_sent()) {
            // this is a permanent redirection
            set_status_header(301);
            redirect_http($redirect_url);
        }
        redirect($redirect_url);
Exemple #6
0
$dates2 = htmlspecialchars($_POST[dates2], ENT_QUOTES);
$bus = htmlspecialchars($_POST[bus], ENT_QUOTES);
$bus2 = htmlspecialchars($_POST[bus2], ENT_QUOTES);
$hotel = htmlspecialchars($_POST[hotel], ENT_QUOTES);
$hotel2 = htmlspecialchars($_POST[hotel2], ENT_QUOTES);
$number = htmlspecialchars($_POST[number], ENT_QUOTES);
$price = htmlspecialchars($_POST[price], ENT_QUOTES);
$cat = htmlspecialchars($_POST[cat], ENT_QUOTES);
$message = htmlspecialchars($_POST[message], ENT_QUOTES);
$message2 = htmlspecialchars($_POST[text], ENT_QUOTES);
$food_ru = htmlspecialchars($_POST[food_ru], ENT_QUOTES);
$food_ro = htmlspecialchars($_POST[food_ro], ENT_QUOTES);
if (empty($title) || empty($title2) || empty($dates) || empty($dates2) || empty($price) || empty($bus) || empty($bus2)) {
    echo "Не все заполнено";
} else {
    $page = str2url($title);
    $page_text = $page . '_text';
    $page_food = $page . '_food';
    $page_dates = $page . '_dates';
    $page_bus = $page . '_bus';
    $page_hotel = $page . '_hotel';
    $file = $_FILES['fl']['tmp_name'];
    $filename = $_FILES['fl']['name'];
    if (!empty($file)) {
        ini_set('memory_limit', '32M');
        $maxsize = "100000000";
        $extentions = array("jpg", "png", "gif", "jpeg");
        $size = filesize($_FILES['fl']['tmp_name']);
        $type = strtolower(substr($filename, 1 + strrpos($filename, ".")));
        $new_name = $page . $visit . '.' . $type;
        $to = '../images/tur/' . $new_name;
function getUrl($item)
{
    global $fuels, $colors, $bodyTypes;
    $subDomain = empty($item['subdomain']) ? '' : $item['subdomain'] . '.';
    $uriParamsString = '';
    $maker = isset($item['maker']) && !empty($item['maker']) ? str2url($item['maker']) : '';
    $model = isset($item['model']) && !empty($item['model']) ? str2url($item['model']) : '';
    if (!empty($maker)) {
        $uriParamsString = '/all/' . $maker . '/' . $model;
    }
    $getParamsString = '';
    $getParamsArray = array('region' => $item['city_translit'] == $item['subdomain'] ? '' : $item['city_translit'], 'region_id' => $item['city_translit'] == $item['subdomain'] ? '' : $item['city_id'], 'body' => !empty($item['body_type']) ? $bodyTypes[mb_strtolower($item['body_type'], 'utf8')] : '', 'new' => isset($item['type']) ? $item['type'] === 'new' ? 1 : 2 : '', 'year' => !empty($item['year']) ? $item['year'] . '-' . $item['year'] : '', 'fuel' => isset($item['fuel']) ? $fuels[mb_strtolower($item['fuel'], 'utf8')] : '', 'color' => isset($item['color']) ? $colors[mb_strtolower(mb_ereg_replace('ё', 'е', $item['color']), 'utf8')] : '');
    $url = 'http://' . $subDomain . BASE_DOMAIN . '/auto/search' . $uriParamsString;
    $delimiter = '?';
    foreach ($getParamsArray as $key => &$param) {
        if (empty($param)) {
            continue;
        }
        if (!empty($getParamsString) && $delimiter === '?') {
            $delimiter = '&';
        }
        $getParamsString .= $delimiter . $key . '=' . $param;
    }
    return $url . $getParamsString;
}
Exemple #8
0
function load_file($file_owner, $owner_id, $url, $dir = 'files')
{
    $pricefile = @$_FILES["pricefile"]["tmp_name"];
    $pricefile_name = @$_FILES["pricefile"]["name"];
    if (!is_file(@$pricefile) || !($filename = @basename($pricefile_name))) {
        $_SESSION['message'] = "Не найден файл!";
        Header("Location: " . $url);
        exit;
    }
    $ext = substr($filename, strrpos($filename, ".") + 1);
    $fn = str2url(substr($filename, 0, strrpos($filename, ".")));
    $filename = $fn . "." . $ext;
    if (file_exists("{$dir}/{$filename}")) {
        $i = 1;
        while (file_exists("{$dir}/{$filename}")) {
            $filename = $fn . "_{$i}." . $ext;
            $i++;
        }
    }
    $filesize = filesize($pricefile) / 1024;
    mysql_query("INSERT INTO " . TABLE_FILE . " SET datetime=NOW(), owner='{$file_owner}', owner_id={$owner_id}, ext='{$filename}', filesize={$filesize}, ord=1") or Error(1, __FILE__, __LINE__);
    $file_id = @mysql_insert_id();
    $big = "{$dir}/{$filename}";
    if (file_exists($big)) {
        unlink($big);
    }
    copy($pricefile, $big);
}
                    $city = explode('.', $exploded[2]);
                    $city_translit = str_replace('moskva', 'www', str_replace('sankt-peterburg', 'spb', str2url($city[0])));
                    $exploded[2] = str_replace($city[0], $city_translit, $exploded[2]);
                    if (in_array(str_replace('_', '/', $exploded[5]), array_keys($l_aCategories))) {
                        $exploded[5] = $l_aCategories[str_replace('_', '/', $exploded[5])];
                    } else {
                        $exploded[5] = 'all';
                    }
                    $value = implode('/', $exploded);
                    $value = str_replace('http://www.', 'http://', $value);
                    if (isset($l_aAssetTypes[$arr['assetType']])) {
                        $delimiter = '?';
                        if (strpos($value, '?') !== FALSE) {
                            $delimiter = '&';
                        }
                        $value .= $delimiter . str2url($arr['assetType']) . '=1';
                    }
                }
                $writer->startElement($name);
                $writer->text($value);
                $writer->endElement();
            }
            $writer->endElement();
        }
        $writer->endDocument();
        $writer->flush();
    } else {
        print "Error fetching groups: " . $mysqli->error;
        exit;
    }
}
Exemple #10
0
    $data['mes'] = "Файл слишком большой. Загружать можно только изображения (gif|png|jpg|jpeg) размером до 2МБ";
    $data['url'] = '';
} else {
    if (!in_array($file['type'][0], $types)) {
        $data['status'] = 'NO';
        $data['mes'] = "Загружать можно только изображения (gif|png|jpg|jpeg) размером до 2МБ";
        $data['url'] = '';
    } else {
        if ($file['error'][0] == 0) {
            // получаем имя файла
            $filename = basename($file['name'][0]);
            // получаем расширение файла
            $extension = pathinfo($file['name'][0], PATHINFO_EXTENSION);
            // перемещаем файл из временной папки в  нужную
            if (move_uploaded_file($file['tmp_name'][0], $uploadDir . str2url($filename) . '.' . $extension)) {
                $data['status'] = 'OK';
                $data['mes'] = "Изображение успешно загружено";
                $data['url'] = $uploadDir . str2url($filename) . '.' . $extension;
                $data['name'] = $filename;
                $data['flag'] = $flag;
            } else {
                $data['status'] = 'NO';
                $data['mes'] = "Возникла неизвестная ошибка при загрузке файла";
                $data['url'] = '';
            }
        }
    }
}
// Выводим результат в JSON и заверщаем в скрипт
echo json_encode($data);
exit;
?>

<script type="text/javascript" src="<?php 
echo $admin_page;
?>
java_admin.js"></script>
<?php 
$title = htmlspecialchars($_POST[title], ENT_QUOTES);
$title2 = htmlspecialchars($_POST[title_ro], ENT_QUOTES);
$link = htmlspecialchars($_POST['link'], ENT_QUOTES);
$fid = htmlspecialchars($_POST['fid'], ENT_QUOTES);
$id = htmlspecialchars($_POST[id], ENT_QUOTES);
if (is_numeric($id) && is_numeric($fid) && !empty($title) && !empty($title2)) {
    $text_ru = $title;
    $text_ro = $title2;
    $title = str2url($title);
    $sql_find = mysql_query("SELECT `id` FROM `translation` WHERE `title`='{$title}' and `lang`='ru'");
    if (mysql_num_rows($sql_find) > 0) {
        $update = mysql_query("UPDATE `translation` SET `text` = '{$text_ru}' WHERE `lang`='ru' and `title`='{$title}'");
        if (!$update) {
            exit(mysql_error());
        }
        $update = mysql_query("UPDATE `translation` SET `text` = '{$text_ro}' WHERE `lang`='ro' and `title`='{$title}'");
        if (!$update) {
            exit(mysql_error());
        }
    } else {
        $ins = mysql_query("INSERT INTO `translation`(`title`,`text`,`lang`)VALUES('{$title}','{$text_ru}','ru')");
        if (!$ins) {
            exit(mysql_error());
        }
Exemple #12
0
function createListing($writer, $arr)
{
    $city = trim($arr['l_geo_city']);
    $city = str2url($city);
    $city = str_replace('sankt-peterburg', 'spb', str_replace('moskva', 'www', $city));
    $url = 'http://' . $city . '.pingola.ru/auto/search/all?s=' . $arr['l_id'];
    $writer->startElement('Listing');
    $writer->startElement('ID');
    $writer->text($arr['l_id']);
    $writer->endElement();
    $writer->startElement('URL');
    $writer->writeCData($url);
    $writer->endElement();
    $writer->startElement('BodyType');
    $writer->writeCData($arr['l_subcategory']);
    $writer->endElement();
    $writer->startElement('Make');
    $writer->writeCData($arr['l_make']);
    $writer->endElement();
    $writer->startElement('Model');
    $writer->writeCData($arr['l_model']);
    $writer->endElement();
    $writer->startElement('Year');
    $writer->text($arr['l_year']);
    $writer->endElement();
    $writer->startElement('Price');
    $writer->text($arr['l_price']);
    $writer->endElement();
    $writer->startElement('Region');
    $writer->writeCData($arr['l_region']);
    $writer->endElement();
    $writer->startElement('City');
    $writer->writeCData($arr['l_geo_city']);
    $writer->endElement();
    $writer->startElement('Street');
    $writer->writeCData($arr['l_geo_street']);
    $writer->endElement();
    $writer->startElement('Metro');
    $writer->writeCData($arr['l_metro']);
    $writer->endElement();
    $writer->startElement('ContactName');
    $writer->writeCData($arr['l_contact_name']);
    $writer->endElement();
    $writer->startElement('ContactPhone');
    $writer->writeCData($arr['l_contact_phone']);
    $writer->endElement();
    $writer->startElement('ContactEmail');
    $writer->writeCData($arr['l_contact_email']);
    $writer->endElement();
    $images = explode(' ', $arr['l_image']);
    for ($ind = 1; $ind <= count($images); $ind++) {
        $writer->startElement('img' . $ind);
        $writer->writeCData($images[$ind - 1]);
        $writer->endElement();
    }
    $writer->startElement('KM');
    $writer->text($arr['l_km']);
    $writer->endElement();
    $writer->startElement('Color');
    $writer->writeCData($arr['l_color']);
    $writer->endElement();
    $writer->startElement('TransmissionType');
    $writer->writeCData($arr['l_trtype']);
    $writer->endElement();
    $writer->startElement('EngineCapacity');
    $writer->text($arr['l_encapacity']);
    $writer->endElement();
    $writer->startElement('FuelType');
    $writer->writeCData($arr['l_fuel']);
    $writer->endElement();
    $writer->startElement('GearType');
    $writer->writeCData($arr['l_gear']);
    $writer->endElement();
    $writer->startElement('Condition');
    $writer->writeCData($arr['l_condition']);
    $writer->endElement();
    $writer->startElement('WheelSide');
    $writer->writeCData($arr['l_wheelside']);
    $writer->endElement();
    $writer->startElement('MoreInfo');
    $writer->writeCData($arr['l_moreinfo']);
    $writer->endElement();
    $writer->startElement('PostDate');
    $writer->text($arr['l_postdate']);
    $writer->endElement();
    $writer->endElement();
}
Exemple #13
0
    }
    //Проверяем 'пустые' страницы и выдаём оповещение
    if ($_GET['page'] > $num_pages) {
        $error = true;
    }
    if ($error == true) {
        $content = 'Ошибка: Публикаций не найдено';
    }
}
if (isset($_GET['add'])) {
    if (isset($_POST['submit'])) {
        $order = array("\r\n", "\n", "\r");
        $replace = '<br>';
        $news = str_replace($order, $replace, $_POST["news"]);
        $fullnews = str_replace($order, $replace, $_POST["fullnews"]);
        $link = str2url($_POST['title']);
        $stmt = $pdo->prepare('INSERT INTO `jre_news` (`date`,`news`,`fullnews`,`title`,`alt_name`) VALUES (:date,:news,:fullnews,:title,:alt_name)');
        $stmt->execute(array('date' => time(), 'news' => $news, 'fullnews' => $fullnews, 'title' => $_POST['title'], 'alt_name' => $link));
        echo 'Новость успешно добавлена';
        echo '<br><a href="/admin.php?do=news"><button class="button" style="width:auto;">Вернутся назад</button></a>';
    } else {
        $content = '<h1>Добавить новость</h1>
        <form class="news" action="" method="POST">
            <span>Заголовок новости</span><br>
            <input class="input" required type="text" name="title"><br>
            <span>Краткое описание</span><br>
            <textarea required style="padding:10px;" class="input" name="news"></textarea>
            <span>Текст новости</span><br>
            <textarea required style="padding:10px;" class="input" name="fullnews"></textarea>
            <input class="button" type="submit" value="Добавить" name="submit">
        </form>';
    $str = rus2translit($str);
    // в нижний регистр
    $str = strtolower($str);
    // заменям все ненужное нам на "-"
    $str = preg_replace('~[^-a-z0-9_]+~u', '-', $str);
    // удаляем начальные и конечные '-'
    $str = trim($str, "-");
    return $str;
}
$title_cat = $_POST['title'];
$find = mysql_query("SELECT id FROM categories WHERE title_lang='{$title_cat}'");
if (mysql_num_rows($find) > 0) {
    $f_id = mysql_fetch_array($find);
    $fid = $f_id[id];
} else {
    $abb = str2url($title_cat);
    $ins = mysql_query("INSERT INTO categories(title_lang,abb)VALUES('{$title_cat}','{$abb}')");
    $sql_2 = mysql_query("SELECT id FROM categories WHERE title_lang='{$title_cat}'");
    $sq = mysql_fetch_array($sql_2);
    $fid = $sq[id];
}
$link = trim($_POST['site']);
$text = curl_get_contents($link);
$text = explode('"about-product-info">', $text);
$text = trim($text[1]);
$title_product = explode("</h1>", $text);
$title_product = explode('">', $title_product[0]);
$title_product = $title_product[1];
$sql_title_pr = mysql_query("SELECT id FROM products WHERE title_lang='{$title_product}'");
if (mysql_num_rows($sql_title_pr) > 0) {
} else {
<?php 
include "lock.php";
?>

<script type="text/javascript" src="<?php 
echo $admin_page;
?>
java_admin.js"></script>
<?php 
$title = htmlspecialchars($_POST[title], ENT_QUOTES);
$title2 = htmlspecialchars($_POST[title_ro], ENT_QUOTES);
$id = htmlspecialchars($_POST[id], ENT_QUOTES);
if (is_numeric($id) && !empty($title) && !empty($title2)) {
    $text_ru = $title;
    $text_ro = $title2;
    $title = str2url($title) . $visit;
    $file = $_FILES['fl']['tmp_name'];
    $filename = $_FILES['fl']['name'];
    if (!empty($file)) {
        ini_set('memory_limit', '32M');
        $maxsize = "100000000";
        $extentions = array("jpg", "png", "gif", "jpeg");
        $size = filesize($_FILES['fl']['tmp_name']);
        $type = strtolower(substr($filename, 1 + strrpos($filename, ".")));
        $new_name = $title . '.' . $type;
        $to = '../images/tur/' . $new_name;
        $dr = $home_url . 'images/tur/' . $new_name;
        if ($size > $maxsize) {
            exit("Файл больше 100 мб. Уменьшите размер вашего файла или загрузите другой. <br><a href='' onClick=window.close();>Закрыть окно</a>");
        } elseif (!in_array($type, $extentions)) {
            exit(' <b>Файл имеет недопустимое расширение <font color="#FF0000">' . $type . '</font></b>. Допустимыми являются форматы изображений. <br>');
Exemple #16
0
/**
 * replace old style #images.keywords by #tags. Requires a big data
 * migration.
 *
 * @return void
 */
function tag_replace_keywords()
{
    // code taken from upgrades 19 and 22
    $query = '
CREATE TABLE ' . PREFIX_TABLE . 'tags (
  id smallint(5) UNSIGNED NOT NULL auto_increment,
  name varchar(255) BINARY NOT NULL,
  url_name varchar(255) BINARY NOT NULL,
  PRIMARY KEY (id)
)
;';
    pwg_query($query);
    $query = '
CREATE TABLE ' . PREFIX_TABLE . 'image_tag (
  image_id mediumint(8) UNSIGNED NOT NULL,
  tag_id smallint(5) UNSIGNED NOT NULL,
  PRIMARY KEY (image_id,tag_id)
)
;';
    pwg_query($query);
    //
    // Move keywords to tags
    //
    // each tag label is associated to a numeric identifier
    $tag_id = array();
    // to each tag id (key) a list of image ids (value) is associated
    $tag_images = array();
    $current_id = 1;
    $query = '
SELECT id, keywords
  FROM ' . PREFIX_TABLE . 'images
  WHERE keywords IS NOT NULL
;';
    $result = pwg_query($query);
    while ($row = pwg_db_fetch_assoc($result)) {
        foreach (preg_split('/[,]+/', $row['keywords']) as $keyword) {
            if (!isset($tag_id[$keyword])) {
                $tag_id[$keyword] = $current_id++;
            }
            if (!isset($tag_images[$tag_id[$keyword]])) {
                $tag_images[$tag_id[$keyword]] = array();
            }
            array_push($tag_images[$tag_id[$keyword]], $row['id']);
        }
    }
    $datas = array();
    foreach ($tag_id as $tag_name => $tag_id) {
        array_push($datas, array('id' => $tag_id, 'name' => $tag_name, 'url_name' => str2url($tag_name)));
    }
    if (!empty($datas)) {
        mass_inserts(PREFIX_TABLE . 'tags', array_keys($datas[0]), $datas);
    }
    $datas = array();
    foreach ($tag_images as $tag_id => $images) {
        foreach (array_unique($images) as $image_id) {
            array_push($datas, array('tag_id' => $tag_id, 'image_id' => $image_id));
        }
    }
    if (!empty($datas)) {
        mass_inserts(PREFIX_TABLE . 'image_tag', array_keys($datas[0]), $datas);
    }
    //
    // Delete images.keywords
    //
    $query = '
ALTER TABLE ' . PREFIX_TABLE . 'images DROP COLUMN keywords
;';
    pwg_query($query);
    //
    // Add useful indexes
    //
    $query = '
ALTER TABLE ' . PREFIX_TABLE . 'tags
  ADD INDEX tags_i1(url_name)
;';
    pwg_query($query);
    $query = '
ALTER TABLE ' . PREFIX_TABLE . 'image_tag
  ADD INDEX image_tag_i1(tag_id)
;';
    pwg_query($query);
    // print_time('tags have replaced keywords');
}
Exemple #17
0
/**
 * @Name: Sofresh CMS v1.0
 * @copyright Copyright &copy; 2011 Sofresh 
 */
defined('_ROOT') or die(__FILE__);
$_GET["id"] = $_GET["id"] > 0 ? $_GET["id"] : 0;
if ($_POST) {
    $data = array();
    if (intval($_POST['delete_image']) > 0) {
        @unlink(_UPLOAD . $_POST['current_image']);
        $_POST['current_image'] = "";
        $image = "";
    }
    if ($_FILES["image"]) {
        $filename = $_POST["detail"]["fullname"] ? str2url($_POST["detail"]["fullname"] . "-" . $_POST["detail"]["keys"]) : time();
        $image = upload('image', _UPLOAD, $filename . '-', $image_exts);
        if ($_POST['delete_image'] || !empty($icon) && trim($_POST['current_image']) != "") {
            @unlink(_UPLOAD . $_POST['current_image']);
        }
        if (is_array($image)) {
            $error .= $image['msg'] . '<br />';
        } else {
            if (empty($image)) {
                $_POST["detail"]["image"] = $_POST['current_image'];
            } else {
                @unlink(_UPLOAD . $_POST['current_image']);
                $_POST["detail"]["image"] = $image;
            }
        }
        /*if($image){
Exemple #18
0
         foreach ($options_array as $options_id) {
             $opts = array('content_id' => intval($lastid), 'options_type' => $options_type, 'options_id' => $options_id, 'page' => 'content');
             $oClass->insertOpt($opts);
         }
     }
 }
 // update _ln
 $ln_req = $cfg_type['required_fields'] ? explode(',', $cfg_type['required_fields']) : array('name');
 if (!$cfg_type['required_fields'] || $_POST[$ln_req[0]]) {
     foreach ($_POST[$ln_req[0]] as $ln => $val) {
         if (!$cfg_type['required_fields'] || $val) {
             $arr_ln = array();
             foreach ($cfg_type['ln_fields'] as $code => $info) {
                 if ($info['chose'] && in_array($code, $ln_fields)) {
                     if ($code == "name") {
                         $arr_ln["name_url"] = $_POST[$code . "_url"][$ln] != "" ? $_POST[$code . "_url"][$ln] : str2url($_POST[$code][$ln]);
                     }
                     $arr_ln[$code] = $_POST[$code][$ln];
                 }
             }
             if (in_array('ln_image', $show_actions)) {
                 // use image
                 if ($cfg_type['ln_main_icon']['chose']) {
                     if (intval($_POST['delete_ln_icon'][$ln]) > 0) {
                         @unlink(_UPLOAD . $_POST['current_ln_icon'][$ln]);
                         $_POST['current_ln_icon'][$ln] = "";
                         $ln_icon = "";
                     }
                     $ln_icon = upload('ln_icon', _UPLOAD, time() . '-', $image_exts, $ln);
                     if ($_POST['delete_ln_icon'][$ln] || !empty($icon) && trim($_POST['current_ln_icon'][$ln]) != "") {
                         @unlink(_UPLOAD . $_POST['current_ln_icon'][$ln]);
/**
 * return the section token of an index or picture URL.
 *
 * Depending on section, other parameters are required (see function code
 * for details)
 *
 * @param array
 * @return string
 */
function make_section_in_url($params)
{
    global $conf;
    $section_string = '';
    $section = @$params['section'];
    if (!isset($section)) {
        $section_of = array('category' => 'categories', 'tags' => 'tags', 'list' => 'list', 'search' => 'search');
        foreach ($section_of as $param => $s) {
            if (isset($params[$param])) {
                $section = $s;
            }
        }
        if (!isset($section)) {
            $section = 'none';
        }
    }
    switch ($section) {
        case 'categories':
            if (!isset($params['category'])) {
                $section_string .= '/categories';
            } else {
                isset($params['category']['name']) or trigger_error('make_section_in_url category name not set', E_USER_WARNING);
                array_key_exists('permalink', $params['category']) or trigger_error('make_section_in_url category permalink not set', E_USER_WARNING);
                $section_string .= '/category/';
                if (empty($params['category']['permalink'])) {
                    $section_string .= $params['category']['id'];
                    if ($conf['category_url_style'] == 'id-name') {
                        $section_string .= '-' . str2url($params['category']['name']);
                    }
                } else {
                    $section_string .= $params['category']['permalink'];
                }
            }
            break;
        case 'tags':
            $section_string .= '/tags';
            foreach ($params['tags'] as $tag) {
                switch ($conf['tag_url_style']) {
                    case 'id':
                        $section_string .= '/' . $tag['id'];
                        break;
                    case 'tag':
                        if (isset($tag['url_name']) and !is_numeric($tag['url_name'])) {
                            $section_string .= '/' . $tag['url_name'];
                            break;
                        }
                    default:
                        $section_string .= '/' . $tag['id'];
                        if (isset($tag['url_name'])) {
                            $section_string .= '-' . $tag['url_name'];
                        }
                }
            }
            break;
        case 'search':
            $section_string .= '/search/' . $params['search'];
            break;
        case 'list':
            $section_string .= '/list/' . implode(',', $params['list']);
            break;
        case 'none':
            break;
        default:
            $section_string .= '/' . $section;
    }
    return $section_string;
}
Exemple #20
0
         $sph->setAttribute('lyear', $arr['year']);
         $sph->setAttribute('lgeocity', $arr1['prop_val']);
         $sph->setFilter($sph->VALUE_RANGE_INT, array('l_postdate', (int) strtotime(date('Y-m-00', strtotime('-30 day'))), (int) strtotime(date('Y-m-00')), FALSE));
         $sph->setOptions($options);
         $res = $sph->search();
         $posted_and_deleted = (int) ($arr1['num'] - $res['total_found']);
         $total_count += $active_in_city;
         $regions[] = array('r_name' => $arr1['prop_val'], 'count' => $active_in_city, 'count_post' => $arr1['num'], 'count_deleted' => $posted_and_deleted);
     }
 }
 $arr['count'] = $total_count;
 foreach ($arr as $name => $value) {
     if ($name == 'url') {
         $exploded = explode('/', $value);
         $exploded[6] = str2url($exploded[6]);
         $exploded[7] = str2url($exploded[7]);
         $value = implode('/', $exploded);
     }
     $writer->startElement($name);
     $writer->text($value);
     $writer->endElement();
 }
 if (!empty($regions)) {
     $writer->startElement('regions');
     foreach ($regions as $region) {
         $writer->startElement('region');
         $writer->startElement('r_name');
         $writer->text($region['r_name']);
         $writer->endElement();
         $writer->startElement('count');
         $writer->text($region['count']);
    echo "\n" . $result;
    usleep(2000);
}
$sql = "SELECT * FROM np_vehicles_pv";
$result = $eyezeek->query($sql);
if ($result === FALSE) {
    die("\nCould not make query. reason: " . mysqli_error());
}
while ($row = $result->fetch_assoc()) {
    $l_aValues[] = $row;
}
foreach ($l_aValues as $l_aValue) {
    $origin = $l_aValue['vpv_value'];
    $utf8_sentence = $origin;
    $utf8_sentence = mb_convert_encoding($utf8_sentence, 'ISO-8859-5', "UTF-8");
    $utf8_sentence = str2url($utf8_sentence);
    $utf8_sentence = mb_convert_encoding($utf8_sentence, 'UTF-8');
    $sql = "INSERT IGNORE INTO {$l_sTargetTable} (`origin`,`translit`) VALUES('" . $origin . "','" . $utf8_sentence . "')";
    echo "\n" . $sql . ": ";
    $result = $eyezeek->query($sql);
    echo "\n" . $result;
    usleep(2000);
}
mysqli_close($eyezeek);
function rus2translit($string)
{
    $converter = array('а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e', 'ё' => 'e', 'ж' => 'zh', 'з' => 'z', 'и' => 'i', 'й' => 'y', 'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'h', 'ц' => 'ts', 'ч' => 'ch', 'ш' => 'sh', 'щ' => 'shch', 'ь' => '', 'ы' => 'i', 'ъ' => '\'', 'э' => 'e', 'ю' => 'yu', 'я' => 'ya', 'А' => 'A', 'Б' => 'B', 'В' => 'V', 'Г' => 'G', 'Д' => 'D', 'Е' => 'E', 'Ё' => 'E', 'Ж' => 'Zh', 'З' => 'Z', 'И' => 'I', 'Й' => 'Y', 'К' => 'K', 'Л' => 'L', 'М' => 'M', 'Н' => 'N', 'О' => 'O', 'П' => 'P', 'Р' => 'R', 'С' => 'S', 'Т' => 'T', 'У' => 'U', 'Ф' => 'F', 'Х' => 'H', 'Ц' => 'Ts', 'Ч' => 'Ch', 'Ш' => 'Sh', 'Щ' => 'Shch', 'Ь' => '', 'Ы' => 'I', 'Ъ' => '\'', 'Э' => 'E', 'Ю' => 'Yu', 'Я' => 'Ya');
    $iso_converter = array();
    foreach ($converter as $key => $val) {
        $key = mb_convert_encoding($key, 'ISO-8859-5', "UTF-8");
        $iso_converter[$key] = $val;