Exemplo n.º 1
0
function fresh_media($query, $domain_qry, $mysql_table_prefix, $catid, $db_slv)
{
    global $db_con, $case_sensitive, $debug, $category, $search_id3, $mysql_charset;
    global $sort_media, $thumb_dir, $delim, $debug_user, $use_cache, $mediacache_dir;
    global $case_sensitive, $vowels, $noacc_el, $translit_el, $greek, $type;
    global $cat_sel, $cat_sel0, $cat_sel0a, $cat_sel1, $cat_sel2, $cat_sel3, $cat_sel4, $cat_sel_all;
    $all_media = array();
    $this_media = array();
    $sort = "title, id3";
    if (!$category) {
        $category = '-1';
    }
    //  define order of result listing
    if ($sort_media == "1") {
        $sort = "title, id3";
    }
    if ($sort_media == "2") {
        $sort = "size_x DESC, size_y DESC, title, id3";
    }
    if ($sort_media == "3") {
        $sort = "last_query DESC, title, id3";
    }
    if ($sort_media == "4") {
        $sort = "click_counter DESC, title, id3";
    }
    if ($sort_media == "5") {
        $sort = "suffix, title";
    }
    if ($query == '') {
        $query = ' ';
    }
    //    prevent blank results for media search
    if ($query == 'media:') {
        $query = '%';
    }
    //    search for all media files in database /category
    if ($case_sensitive == '0') {
        $query = lower_case(lower_ent($query));
    }
    if ($vowels || $greek) {
        $query = remove_acc($query, '0');
        //  remove Latin accents
    }
    if ($noacc_el) {
        $query = remove_acc_el($query, '0');
        //  remove Greek accents
    }
    if ($translit_el) {
        $query = translit_el($query);
    }
    //  OR search, but only for multiple query words
    if ($type == "or" && strpos($query, " ")) {
        $known_id = array();
        $all = explode(" ", $query);
        //  build an array from all query words
        foreach ($all as $query) {
            //  try to get results for any query word
            if ($search_id3 == '1') {
                // search in name, title, EXIF and ID3 info
                $sql_query = "SELECT * from " . $mysql_table_prefix . "media\n                                                    where title like LOWER('%" . $db_con->real_escape_string($query) . "%') {$domain_qry}\n                                                    OR name like LOWER('%" . $db_con->real_escape_string($query) . "%') {$domain_qry}\n                                                    OR (id3 like '%" . $db_con->real_escape_string($query) . "%') {$domain_qry}\n                                                    ORDER BY {$sort} ";
                $result = $db_con->query($sql_query);
                if ($debug && $db_con->errno) {
                    $err_row = __LINE__ - 2;
                    printf("<p><span class='red'>&nbsp;MySQL failure: %s&nbsp;\n<br /></span></p>", $db_con->error);
                    if (__FUNCTION__) {
                        printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;&nbsp;in function():&nbsp;" . __FUNCTION__ . "&nbsp;<br /></span></p>");
                    } else {
                        printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;<br /></span></p>");
                    }
                    printf("<p><span class='red'>&nbsp;Script execution aborted.&nbsp;<br /></span>");
                    printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>");
                    echo "<p> {$sql_query} </p>";
                    exit;
                }
            } else {
                //  search only in media name and title
                $sql_query = "SELECT * from " . $mysql_table_prefix . "media\n                                                   where (CONVERT(LOWER(title)USING UTF8) like '%" . $db_con->real_escape_string($query) . "%') {$domain_qry}\n                                                   OR (CONVERT(LOWER(name)USING UTF8) like '%" . $db_con->real_escape_string($query) . "%') {$domain_qry}\n                                                   ORDER BY {$sort} ";
                $result = $db_con->query($sql_query);
                if ($debug && $db_con->errno) {
                    $err_row = __LINE__ - 2;
                    printf("<p><span class='red'>&nbsp;MySQL failure: %s&nbsp;\n<br /></span></p>", $db_con->error);
                    if (__FUNCTION__) {
                        printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;&nbsp;in function():&nbsp;" . __FUNCTION__ . "&nbsp;<br /></span></p>");
                    } else {
                        printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;<br /></span></p>");
                    }
                    printf("<p><span class='red'>&nbsp;Script execution aborted.&nbsp;<br /></span>");
                    printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>");
                    echo "<p> {$sql_query} </p>";
                    exit;
                }
            }
            //  collect all results, but only for different links
            while ($row = $result->fetch_array(MYSQLI_NUM)) {
                $new_id = $row[0];
                if (count($all_media) > 0) {
                    foreach ($all_media as $this_media) {
                        if (!in_array($row[0], $known_id)) {
                            $all_media[] = $row;
                            //  add the unknown media result
                            $known_id[] = $row[0];
                        }
                    }
                } else {
                    $all_media[] = $row;
                    //  get the first media result
                    $known_id[] = $row[0];
                    //  remember this media_id
                }
            }
        }
    } else {
        //  AND, PHRASE and TOL search
        $query = str_replace(" ", "%", $query);
        if ($search_id3 == '1') {
            // search in name, title, EXIF and ID3 info
            $sql_query = "SELECT * from " . $mysql_table_prefix . "media\n                                                where title like LOWER('%" . $db_con->real_escape_string($query) . "%') {$domain_qry}\n                                                OR media_link like LOWER('%" . $db_con->real_escape_string($query) . "%') {$domain_qry}\n                                                OR (id3 like '%" . $db_con->real_escape_string($query) . "%') {$domain_qry}\n                                                ORDER BY {$sort} ";
            $result = $db_con->query($sql_query);
            if ($debug && $db_con->errno) {
                $err_row = __LINE__ - 2;
                printf("<p><span class='red'>&nbsp;MySQL failure: %s&nbsp;\n<br /></span></p>", $db_con->error);
                if (__FUNCTION__) {
                    printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;&nbsp;in function():&nbsp;" . __FUNCTION__ . "&nbsp;<br /></span></p>");
                } else {
                    printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;<br /></span></p>");
                }
                printf("<p><span class='red'>&nbsp;Script execution aborted.&nbsp;<br /></span>");
                printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>");
                echo "<p> {$sql_query} </p>";
                exit;
            }
        } else {
            //  search only in media name and title
            $sql_query = "SELECT * from " . $mysql_table_prefix . "media\n                                               where (CONVERT(LOWER(title)USING UTF8) like '%" . $db_con->real_escape_string($query) . "%') {$domain_qry}\n                                               OR (CONVERT(LOWER(media_link)USING UTF8) like '%" . $db_con->real_escape_string($query) . "%') {$domain_qry}\n                                               ORDER BY {$sort} ";
            $result = $db_con->query($sql_query);
            if ($debug && $db_con->errno) {
                $err_row = __LINE__ - 2;
                printf("<p><span class='red'>&nbsp;MySQL failure: %s&nbsp;\n<br /></span></p>", $db_con->error);
                if (__FUNCTION__) {
                    printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;&nbsp;in function():&nbsp;" . __FUNCTION__ . "&nbsp;<br /></span></p>");
                } else {
                    printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;<br /></span></p>");
                }
                printf("<p><span class='red'>&nbsp;Script execution aborted.&nbsp;<br /></span>");
                printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>");
                echo "<p> {$sql_query} </p>";
                exit;
            }
        }
        //      if query did not match any media object
        if ($result->num_rows == 0) {
            return $all_media;
            //      return blank array, otherwise array_merge() will not work in PHP5
        }
        //  collect all results
        while ($this_array = $result->fetch_array(MYSQLI_NUM)) {
            $all_media[] = $this_array;
        }
    }
    $fresh_media = array();
    //  if necessary, reduce to single category valid links
    if ($category != '-1') {
        while (list($key, $value) = each($all_media)) {
            $sql_query = "SELECT site_id from " . $mysql_table_prefix . "links\n                                                where url = '{$value['2']}'";
            //  get site_id corresponding to this page
            $result = $db_con->query($sql_query);
            if ($debug && $db_con->errno) {
                $err_row = __LINE__ - 2;
                printf("<p><span class='red'>&nbsp;MySQL failure: %s&nbsp;\n<br /></span></p>", $db_con->error);
                if (__FUNCTION__) {
                    printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;&nbsp;in function():&nbsp;" . __FUNCTION__ . "&nbsp;<br /></span></p>");
                } else {
                    printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;<br /></span></p>");
                }
                printf("<p><span class='red'>&nbsp;Script execution aborted.&nbsp;<br /></span>");
                printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>");
                echo "<p> {$sql_query} </p>";
                exit;
            }
            $site_id = $result->fetch_array(MYSQLI_NUM);
            //  check for valid catid
            $sql_query = "SELECT * from " . $mysql_table_prefix . "site_category\n                                                where site_id = '{$site_id['0']}' AND category_id ='{$catid}'";
            $result = $db_con->query($sql_query);
            if ($debug && $db_con->errno) {
                $err_row = __LINE__ - 2;
                printf("<p><span class='red'>&nbsp;MySQL failure: %s&nbsp;\n<br /></span></p>", $db_con->error);
                if (__FUNCTION__) {
                    printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;&nbsp;in function():&nbsp;" . __FUNCTION__ . "&nbsp;<br /></span></p>");
                } else {
                    printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;<br /></span></p>");
                }
                printf("<p><span class='red'>&nbsp;Script execution aborted.&nbsp;<br /></span>");
                printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>");
                echo "<p> {$sql_query} </p>";
                exit;
            }
            //  add valid link to result array
            if ($result->num_rows) {
                $fresh_media[] = $value;
            }
        }
    } else {
        $fresh_media = $all_media;
        //  no category search
    }
    if (!$cat_sel0) {
        $cat_sel0 = $cat_sel_all;
    }
    if (!$cat_sel1) {
        $cat_sel1 = $cat_sel_all;
    }
    if (!$cat_sel2) {
        $cat_sel2 = $cat_sel_all;
    }
    if (!$cat_sel3) {
        $cat_sel3 = $cat_sel_all;
    }
    if (!$cat_sel4) {
        $cat_sel4 = $cat_sel_all;
    }
    //  enter here for multiple category search and, if necessary, reduce results
    if ($cat_sel0 != $cat_sel_all || $cat_sel1 != $cat_sel_all || $cat_sel2 != $cat_sel_all || $cat_sel3 != $cat_sel_all || $cat_sel4 != $cat_sel_all) {
        $temp_array = $fresh_media;
        $fresh_media = array();
        while (list($key, $value) = each($all_media)) {
            $cat_to_find = '1';
            //  get site_id for this link_id
            $sql_query = "SELECT site_id from " . $mysql_table_prefix . "links\n                                                where url = '{$value['2']}'";
            $res0 = $db_con->query($sql_query);
            if ($debug && $db_con->errno) {
                $err_row = __LINE__ - 2;
                printf("<p><span class='red'>&nbsp;MySQL failure: %s&nbsp;\n<br /></span></p>", $db_con->error);
                if (__FUNCTION__) {
                    printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;&nbsp;in function():&nbsp;" . __FUNCTION__ . "&nbsp;<br /></span></p>");
                } else {
                    printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;<br /></span></p>");
                }
                printf("<p><span class='red'>&nbsp;Script execution aborted.&nbsp;<br /></span>");
                printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>");
                echo "<p> {$sql_query} </p>";
                exit;
            }
            $site_id = $res0->fetch_array(MYSQLI_NUM);
            //  get category_id for this site
            $sql_query = "SELECT category_id from " . $mysql_table_prefix . "site_category where site_id = '{$site_id['0']}'";
            $res1 = $db_con->query($sql_query);
            if ($debug && $db_con->errno) {
                $err_row = __LINE__ - 2;
                printf("<p><span class='red'>&nbsp;MySQL failure: %s&nbsp;\n<br /></span></p>", $db_con->error);
                if (__FUNCTION__) {
                    printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;&nbsp;in function():&nbsp;" . __FUNCTION__ . "&nbsp;<br /></span></p>");
                } else {
                    printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;<br /></span></p>");
                }
                printf("<p><span class='red'>&nbsp;Script execution aborted.&nbsp;<br /></span>");
                printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>");
                echo "<p> {$sql_query} </p>";
                exit;
            }
            $category_id = $res1->fetch_array(MYSQLI_NUM);
            //  check, whether  this category_id corresponds with cat_selector 0
            //  and try to find results for all active category selections
            if ($category_id) {
                if ($cat_sel0 == $cat_sel_all) {
                    $cat_sel0 = "%";
                }
                if ($cat_sel0a == $cat_sel_all) {
                    $cat_sel0a = "%";
                }
                if ($cat_sel1 == $cat_sel_all) {
                    $cat_sel1 = "%";
                }
                if ($cat_sel2 == $cat_sel_all) {
                    $cat_sel2 = "%";
                }
                if ($cat_sel3 == $cat_sel_all) {
                    $cat_sel3 = "%";
                }
                if ($cat_sel4 == $cat_sel_all) {
                    $cat_sel4 = "%";
                }
                if ($cat_sel0 != "%") {
                    $sql_query = "SELECT * from " . $mysql_table_prefix . "categories where category_id = '{$category_id['0']}' and category >= '{$cat_sel0}' and category <= '{$cat_sel0a}' and group_sel0 like '{$cat_sel1}' and group_sel1 like '{$cat_sel2}' and group_sel2 like '{$cat_sel3}' and group_sel3 like '{$cat_sel4}'";
                    $res_cat = $db_con->query($sql_query);
                    if ($debug && $db_con->errno) {
                        $err_row = __LINE__ - 2;
                        printf("<p><span class='red'>&nbsp;MySQL failure: %s&nbsp;\n<br /></span></p>", $db_con->error);
                        if (__FUNCTION__) {
                            printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;&nbsp;in function():&nbsp;" . __FUNCTION__ . "&nbsp;<br /></span></p>");
                        } else {
                            printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;<br /></span></p>");
                        }
                        printf("<p><span class='red'>&nbsp;Script execution aborted.&nbsp;<br /></span>");
                        printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>");
                        echo "<p> {$sql_query} </p>";
                        exit;
                    }
                } else {
                    $sql_query = "SELECT * from " . $mysql_table_prefix . "categories where category_id = '{$category_id['0']}' and group_sel0 like '{$cat_sel1}' and group_sel1 like '{$cat_sel2}' and group_sel2 like '{$cat_sel3}' and group_sel3 like '{$cat_sel4}'";
                    $res_cat = $db_con->query($sql_query);
                    if ($debug && $db_con->errno) {
                        $err_row = __LINE__ - 2;
                        printf("<p><span class='red'>&nbsp;MySQL failure: %s&nbsp;\n<br /></span></p>", $db_con->error);
                        if (__FUNCTION__) {
                            printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;&nbsp;in function():&nbsp;" . __FUNCTION__ . "&nbsp;<br /></span></p>");
                        } else {
                            printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;<br /></span></p>");
                        }
                        printf("<p><span class='red'>&nbsp;Script execution aborted.&nbsp;<br /></span>");
                        printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>");
                        echo "<p> {$sql_query} </p>";
                        exit;
                    }
                }
                if ($res_cat->num_rows) {
                } else {
                    $cat_to_find = '0';
                }
                //  if found in all active category selctions, add the ccurrent link to the result array
                if ($cat_to_find) {
                    $fresh_media[] = $value;
                }
            }
        }
        //  restore the original $cat_sel_all
        $cat_sel0 = str_replace("%", $cat_sel_all, $cat_sel0);
        $cat_sel0a = str_replace("%", $cat_sel_all, $cat_sel0a);
        $cat_sel1 = str_replace("%", $cat_sel_all, $cat_sel1);
        $cat_sel2 = str_replace("%", $cat_sel_all, $cat_sel2);
        $cat_sel3 = str_replace("%", $cat_sel_all, $cat_sel3);
        $cat_sel4 = str_replace("%", $cat_sel_all, $cat_sel4);
    }
    $i = 0;
    $title = '';
    $this_media = array();
    //  reset, because used a second time
    if ($use_cache) {
        $thumb_dir = $mediacache_dir;
        //  store new thumbnail in folder for media cache
    }
    foreach ($fresh_media as $this_media[$i]) {
        if ($this_media[$i][6] == 'image') {
            //  build thumbnail to be displayed in result listing
            $name = basename($this_media[$i][3]);
            //  extract file name
            $title = substr($this_media[$i][5], 0, strpos($this_media[$i][5], $delim));
            //  get basic part of the title
            //  add folder path, db, table-prefix, remove original suffix and add own suffix
            $file = utf8_decode("" . $thumb_dir . "/db" . $db_slv . "_" . $mysql_table_prefix . "_" . substr($name, 0, strrpos($name, ".")) . ".gif");
            if (!($handle = fopen($file, "ab"))) {
                if ($debug_user == '1') {
                    print "Unable to open {$file} ";
                }
            }
            if (!fwrite($handle, $this_media[$i][4])) {
                if ($debug_user == '1') {
                    print "Unable to write the file {$file}. No thumbnails will be presented";
                }
            }
            fclose($handle);
            $this_media[$i][4] = $file;
            //  replace content of thumbnail  with path to thumbnail
            $this_media[$i][5] = $title;
            //  the title up to delimeter
            $i++;
        }
    }
    //echo "\r\n\r\n<br>this_media Array0:<br><pre>";print_r($this_media);echo "</pre>\r\n";
    return $this_media;
}
Exemplo n.º 2
0
     }
     $id3_trans = remove_acc_el($id3_trans, '0');
     if ($id3_trans != $id3_rem) {
         $id3_string .= " " . $id3_trans . "";
         //  add new words to EXIF info
     }
 }
 //  transliterate into Greek language
 if ($translit_el) {
     $title_rem = $title_trans;
     $id3_rem = $id3_trans;
     $title_trans = translit_el($title_trans, '0');
     if ($title_trans != $title_rem) {
         $title .= " " . $title_trans . "";
     }
     $id3_trans = translit_el($id3_trans, '0');
     if ($id3_trans != $id3_rem) {
         $id3_string .= " " . $id3_trans . "";
         //  add new words to EXIF info
     }
 }
 $size_x = '';
 $size_y = '';
 $size_x = str_replace("<", '', substr($id3_string, strpos($id3_string, "n_x ;;") + 6, 6));
 $size_y = str_replace("<", '', substr($id3_string, strpos($id3_string, "n_y ;;") + 6, 6));
 //      store all information about actual video
 $title = $db_con->real_escape_string($title);
 $link = str_replace(" ", "%20", $link);
 //      replace invalid blanks in URL
 mysqltest();
 $sql_query = "INSERT into " . $mysql_table_prefix . "media (link_id, link_addr, media_link, title, type, size_x, size_y, id3, md5sum, name, suffix) values ('{$link_id}', '{$url}', '{$link}', '{$title}', '{$element}', '{$size_x}', '{$size_y}', '{$id3_string}', '{$new_md5}', '{$my_name}', '{$suffix}')";
Exemplo n.º 3
0
function get_textsuggests($keyword, $type, $category, $category_list, $mysql_table_prefix)
{
    global $db_con, $suggest_history, $suggest_rows, $suggest_phrases, $case_sensitive, $suggest_keywords, $home_charset;
    global $vowels, $noacc_el, $translit_el;
    $values = array();
    //  will contain all suggested keywords
    if ($suggest_history == '1') {
        $sql_query = "SELECT \tquery as keyword, max(results) as results\n                                                FROM {$mysql_table_prefix}query_log\n                                                WHERE results > 0 AND (query LIKE '{$keyword}%' OR query LIKE '\"{$keyword}%')\n                                                GROUP BY query ORDER BY results DESC\n                                                LIMIT {$suggest_rows}";
        $result = $db_con->query($sql_query);
        if ($result->num_rows) {
            while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
                $values[$row['keyword']] = $row['result'];
            }
        }
    }
    //      ******      for 'phrase' search enter here
    if ($suggest_phrases && $type == 'phrase') {
        $values = fetch_phrasuggests($keyword, $category, $mysql_table_prefix, $category_list);
        /*
                     if ($translit_el == '1'){    //  try to find a keyword transliterated into Greek
                     $el_values  = array();
                     $keyword    = translit_el($keyword);
        
                     $el_values  = fetch_phrasuggests($keyword, $category, $mysql_table_prefix);
        
                     if (is_array($el_values)) {
                     $values = array_merge($values, $el_values);
                     }
                     }
        */
    } elseif ($suggest_keywords) {
        //  ********      for single keyword search  enter here
        $values = fetch_txtsuggests($keyword, $category, $mysql_table_prefix, $category_list);
        if ($vowels == '1') {
            //  try to find a keyword without accents
            $acc_values = array();
            $keyword = remove_acc($keyword);
            $acc_values = fetch_txtsuggests($keyword, $category, $mysql_table_prefix, $category_list);
            if ($values && $acc_values) {
                $values = array_merge($values, $acc_values);
            } else {
                $values = $acc_values;
            }
        }
        if ($noacc_el == '1') {
            //  try to find a keyword without Greek accents
            $nel_values = array();
            $keyword = remove_acc_el($keyword);
            $nel_values = fetch_txtsuggests($keyword, $category, $mysql_table_prefix, $category_list);
            if ($nel_values) {
                $values = array_merge($values, $nel_values);
            }
        }
        if ($translit_el == '1') {
            //  try to find a keyword transliterated into Greek
            if (!is_array($values)) {
                //if nothing found up to now
                $values = array();
            }
            $el_values = array();
            $keyword = translit_el($keyword);
            $el_values = fetch_txtsuggests($keyword, $category, $mysql_table_prefix, $category_list);
            if (is_array($el_values)) {
                $values = array_merge($values, $el_values);
            }
        }
    }
    return $values;
}