<?php include "helpers.php"; header('Content-Type: text/html; charset=utf-8'); $lyricsLink = $_POST["songUrl"]; // Get the lyrics and credits $lyricsPage = getCURLOutput($lyricsLink); $lyricsPage = str_replace('<br />', '###', $lyricsPage); $lyricsXpath = getDOMXPath($lyricsPage); $lyricsQuery = $lyricsXpath->query('//div[@class="lyricbox"]/text()'); $creditsQuery = $lyricsXpath->query('//div[@class="song-credit-box"]/text()'); $metaQuery = $lyricsXpath->query('//div[@class="header-column header-title"]/h1/text()'); $songAttrTitle = $metaQuery->item(0)->nodeValue; $songAttrTitle = str_replace(" Lyrics", "", $songAttrTitle); $artistName = substr($songAttrTitle, 0, strrpos($songAttrTitle, ":")); $songName = substr($songAttrTitle, strrpos($songAttrTitle, ":") + 1); $lyrics = $lyricsQuery->item($i)->nodeValue; $lyrics = delete_all_between("(", ")", $lyrics); $lyrics = str_replace("'", "’", $lyrics); if (isset($lyricsLink) && isset($songName) && isset($artistName) && isset($lyrics)) { $arr = array('url' => $lyricsLink, 'titre' => $songName, 'auteur' => $artistName, 'lyrics' => $lyrics); echo json_encode($arr); } else { echo "Erreur"; }
array_push($feed, $item); } $limit = count($feed); $image = $rss->getElementsByTagName('url'); for ($x = 0; $x < $limit; $x++) { $title = str_replace(' & ', ' & ', $feed[$x]['title']); $newtitle = truncate($string = $title, $length = 50); $link = $feed[$x]['link']; $rawdate = new DateTime($feed[$x]['date'], new DateTimeZone('Pacific/Auckland')); $date = $rawdate->format('l, jS F'); $rawdate = $feed[$x]['date']; $EpochDate = strtotime($rawdate); $randomno = mt_rand(0, count($fallbackimages) - 1); $image = $fallbackimages[$randomno]; $rawdescription = $feed[$x]['description']; $description = delete_all_between("<![CDATA[", "]]>", $rawdescription); //print_r($_GET); //print_r($_POST); $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $rawtitlesql = mysqli_real_escape_string($conn, $title); $postlink = mysqli_real_escape_string($conn, $link); echo "DELETE FROM `podcasts` WHERE URL='{$postlink}';"; $sql = "DELETE FROM `podcasts` WHERE URL='{$postlink}';"; if ($conn->query($sql) === TRUE) { echo "standing-room-only Duplicate Cleared \n"; } else { die("standing-room-only Duplicate Not Cleared \n" . $conn->error);
$fields = array('Title', 'Description'); $clause = new KORA_Clause('Title', 'like', $search); $results = KORA_Search(token, projectID, Essays, $clause, $fields, array(array('field' => 'Order', 'direction' => SORT_ASC))); foreach ($results as $result) { $title = $result['Title']; $descriptions = $result['Description']; $descriptions = explode("\n", $descriptions); echo "<h2>" . $title . "</h2>"; foreach ($descriptions as $description) { if (getBetween($description, "[", "]")) { $pic_kid = getBetween($description, "[", "]"); $pic_kid = str_replace('PUTIMAGEHERE', '', $pic_kid); $pos_pic = array_search($pic_kid, $pics_kid); echo "<div class='about_imageContainer'>\n\t\t\t\t\t\t\t\t\t\t<img src='{$file[$pos_pic]}' width='1000' height='1000 style='vertical-align:left'/>\n\t\t\t\t\t\t\t\t\t\t\t<div class='about_caption'>\n\t\t\t\t\t\t\t\t\t\t\t\t<p><strong>{$pic_photographer[$pos_pic]}</strong> {$pic_title[$pos_pic]}</p>\n\t\t\t\t\t\t\t\t\t\t\t\t<p>{$pic_date_string[$pos_pic]} // {$pic_location[$pos_pic]}</p>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>"; //var_dump($pic_kid); $text_desc = delete_all_between('[', ']', $description); echo "<p>" . $text_desc . "</p><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>"; } else { echo "<p>" . $description . "</p>"; } } if ($_GET['title'] == 'PhotographyinMali') { echo "<div class='about_imageContainer' id='map'>\n\t\t\t\t\t\t\t\t<a class='fancybox map' href='img/Mali-Map.png'><img src='img/Mali-Map.png' width='1009' height='757' alt='Map of Mali' /></a>\n\t\t\t\t\t\t\t\t<div class='about_caption'>\n\t\t\t\t\t\t\t\t\t<p>Click map to view fullscreen</p>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>"; } } } ?> </div> </div> <?php
function get_news_by_keywords_from_mysources($keyword_id, $udid, $start, $offset) { $user_obj = new User(); //$uid = $user_obj->get_uid_by_udid($udid); $synonyms = get_synonyms_by_keyword_id($keyword_id); $keyword_for_search = "title like ('%swdsd323232322232sdaahskjas%') or "; foreach ($synonyms as $synonym) { $synonym = str_replace('_', '\\_', $synonym); $keyword_for_search .= "title like ('% {$synonym} %') or "; //$keyword_for_search .= "title = '$synonym' or "; } $keyword_for_search = substr($keyword_for_search, 0, strlen($keyword_for_search) - 4); //$my_sources = get_my_sources($uid); // if ($my_sources == '') $my_sources = '79,'; // $my_sources = substr($my_sources, 0, (strlen($my_sources)-1) ); global $conn; $start = $start * $offset; /*$query = "select c2.parent, articles_html.id, title, image, client_id, added_by, date_added, cid, views, pg_rated_id, section, updated_date, updated_by from articles_html inner join article_categories on article_categories.aid = articles_html.id inner join categories c1 on c1.id = article_categories.cid inner join categories c2 on c2.id = c1.parent where ( $keyword_for_search ) and cid in ($my_sources) and client_id = '47' order by id desc limit $start, $offset"; */ $query = "select c2.parent, articles_html.id, articles_html.body, title, image, client_id, added_by, date_added, cid, views, pg_rated_id, section, updated_date, updated_by\n from articles_html \n inner join article_categories on article_categories.aid = articles_html.id\n inner join categories c1 on c1.id = article_categories.cid\n inner join categories c2 on c2.id = c1.parent\n where (\n {$keyword_for_search}\n ) \n and client_id = '47' \n group by title\n order by id desc limit {$start}, {$offset}"; //echo($query); $res = $conn->db_query($query); $all_articles = array(); $helper_obj = new Helper(); $count = $start; while ($row = $res->fetch_assoc()) { $row['date_added'] = "منذ " . $helper_obj->time_elapsed_string($row['date_added']); $sd = delete_all_between("<style", "</style>", $row['body']); $row['body'] = trim(mb_substr(strip_tags($sd), 0, 85, 'UTF-8')); $row['title'] = trim(mb_substr($row['title'], 0, 140, 'UTF-8')); $count++; $row['count'] = $count; $all_articles[] = $row; } $json = ''; $json .= json_encode($all_articles); return $json; }
for ($x = 0; $x < $limit; $x++) { $title = str_replace(' & ', ' & ', $feed[$x]['title']); $newtitle = truncate($string = $title, $length = 50); $link = $feed[$x]['link']; $rawdescription = $feed[$x]['description']; $description = truncate($string = $rawdescription); $rawdate = new DateTime($feed[$x]['date'], new DateTimeZone('Pacific/Auckland')); $date = $rawdate->format('l, jS F'); $rawdate = $feed[$x]['date']; $EpochDate = strtotime($rawdate); $url = $link; $html = file_get_html($url); $randomno = mt_rand(0, count($fallbackimages) - 1); $image = $fallbackimages[$randomno]; $articlebodyraw = $html->find('div.newsbody', 0); $articlebody = delete_all_between("<h3>Related", "</h3>", $articlebodyraw); $imgid = 0; foreach ($html->find('div.photo-captioned') as $element) { $img = $element; foreach ($img->find('img') as $imgelement) { if ($imgid == 0) { $imgid = 1; $image = "http://radionz.co.nz"; $image .= $imgelement->src; } } } //print_r($_GET); //print_r($_POST); $conn = new mysqli($servername, $username, $password, $dbname); // Check connection