public function ucitaj_vesti($auto = 0)
 {
     $brojac = 0;
     $rss_array = $this->link_rss();
     foreach ($rss_array as $rss) {
         $raw_rss = file_get_contents($rss["link_rss"]);
         $xml_rss = new SimpleXMLElement($raw_rss);
         foreach ($xml_rss->channel->item as $news) {
             $title = $news->title->__toString();
             $desc = $news->description->__toString();
             $link = $news->link->__toString();
             $vr = $news->pubDate->__toString();
             $vr = strtotime($vr);
             $vreme = date("Y-m-d H:i:s", $vr);
             if (Vest::da_li_postoji($title)) {
                 continue;
             }
             $id = Vest::ubaci_vest($title, $link, 1, $vreme, $desc, $this->id_novina, $auto);
             $brojac++;
             $vest = new Vest($id);
             $reci = $vest->get_words();
             foreach ($reci as $rec) {
                 $rez = Vest::find_city($rec);
                 if ($rez['status'] == 'OK') {
                     $vest->dodaj_grad($rez['lat'], $rez['lng'], $rez['naziv'], $rez['partial']);
                 } else {
                     if ($rez['status'] == 'ZERO_RESULTS') {
                         continue;
                     } else {
                         trigger_error($rez['status'], E_USER_ERROR);
                     }
                 }
             }
         }
     }
     return $brojac;
 }
<?php

/**
 * Created by PhpStorm.
 * User: Stefan
 * Date: 29.7.2015
 * Time: 20:03
 */
require_once "core/init.php";
if (!isset($_SESSION["id_korisnika"])) {
    header("Location:index.php");
    die;
} else {
    $id_korisnika = $_SESSION["id_korisnika"];
}
if (isset($_GET["q"]) && isset($_GET["lat"]) && isset($_GET["lng"]) && isset($_GET["naziv"])) {
    $id = sanitize($_GET["q"]);
    $lat = sanitize($_GET["lat"]);
    $lng = sanitize($_GET["lng"]);
    $naziv = sanitize($_GET["naziv"]);
    $n = new Vest($id);
    $id_n_g = $n->dodaj_grad($lat, $lng, $naziv, 0);
    if ($n->postavi_grad($id_n_g) == 1) {
        echo "Lokacija promenjena";
    } else {
        echo "Greska tokom promene lokacije";
    }
} else {
    echo 'Doslo je do greske (GET)';
}