function artists_search($aQuery, $aFields, $aStart, $aLimit, &$aNumAll, $aWhere = '', $cond = 'AND') { $iaCore =& iaCore::instance(); $iaArtist = $iaCore->factoryPackage('artist', 'lyrics'); $ret = array(); $where = "`title` LIKE '%{$aQuery}%' OR `description` LIKE '%{$aQuery}%'"; $artists = $iaCore->iaDb->all('sql_calc_found_rows `title`, `title_alias`', $where, $aStart, $aLimit, iaArtist::getTable()); $aNumAll += $iaCore->iaDb->foundRows(); foreach ($artists as $artist) { $artist_url = $iaCore->iaSmarty->ia_url(array('item' => $iaArtist->getItemName(), 'data' => $artist, 'type' => 'url')); $ret[] = sprintf('<p><a href="%s">%s</a></p>', $artist_url, $artist['title']); } return $ret; }
$where = array('1 = 1 '); $values = array(); if (isset($_GET['status']) && in_array($_GET['status'], $iaAlbum->_statuses)) { $where[] = "`status` = :status"; $values['status'] = $_GET['status']; } elseif (isset($_SESSION['album_status'])) { $where[] = "`status` = :status"; $values['status'] = $_SESSION['album_status']; } if (isset($_GET['title']) && !empty($_GET['title'])) { $where[] = "`title` LIKE :title"; $values['title'] = '%' . $_GET['title'] . '%'; } if (isset($_GET['artist']) && !empty($_GET['artist'])) { $iaArtist = $iaCore->factoryPackage('artist', IA_CURRENT_PACKAGE, iaCore::ADMIN); $artist_id = $iaArtist->iaDb->one('id', "`title` LIKE '%{$_GET['artist']}%' ", 0, null, iaArtist::getTable()); $where[] = "`id_artist` = :id_artist"; $values['id_artist'] = $artist_id; } $where = implode(" AND ", $where); $iaAlbum->iaDb->mysql_bind($where, $values); $out['data'] = $iaAlbum->getAlbums($where, $start, $limit, $order); $out['total'] = $iaAlbum->getNumAlbums($where); $iaView->assign_all($out); break; default: break; } } // process grid actions if (!isset($out)) {
<?php //##copyright## $iaLyric = $iaCore->factoryPackage('lyric', IA_CURRENT_PACKAGE); $iaArtist = $iaCore->factoryPackage('artist', IA_CURRENT_PACKAGE); $iaAlbum = $iaCore->factoryPackage('album', IA_CURRENT_PACKAGE); // process ajax actions if (iaView::REQUEST_JSON == $iaView->getRequestType()) { // artists return if (isset($_GET['q'])) { $where = "`title` LIKE '{$_GET['q']}%' "; $order = "ORDER BY `title` ASC "; $artists['options'] = $iaDb->onefield('title', $where . $order, 0, 15, iaArtist::getTable()); $iaView->assign($artists); } // albums return if (isset($_GET['artist'])) { // get artist by title $artist = $iaArtist->getArtistByTitle($_GET['artist']); // get artist albums $out['data'] = $iaAlbum->getAlbumsByArtist($artist['id']); $iaView->assign($out); } } if (iaView::REQUEST_HTML == $iaView->getRequestType()) { iaCore::fields(); $iaUtil = $iaCore->factory('util'); $errorFields = array(); $id = isset($iaCore->requestPath[0]) ? (int) $iaCore->requestPath[0] : false; $lyric = $id ? $iaDb->row('*, \'lyrics\' as `item`', "`id`={$id}", 0, 1, iaLyric::getTable()) : array(); if (!empty($id) && empty($lyric)) {
<?php //##copyright## if (iaView::REQUEST_HTML == $iaView->getRequestType()) { // init iaItem class $iaItem = $iaCore->factory('item'); // init main item classes $iaLyric = $iaCore->factoryPackage('lyric', 'lyrics'); $iaArtist = $iaCore->factoryPackage('artist', 'lyrics'); $iaAlbum = $iaCore->factoryPackage('album', 'lyrics'); $defaultLimit = $iaCore->get('lyrics_per_block', 5); // generate sql query to fetch listings $sql = "SELECT t1.`id`, t1.`id_artist`, t1.`title`, t1.`title_alias`, t1.`date_added`, "; $sql .= "t1.`views_num`, t1.`artist_alias`, t1.`album_alias`, t2.`title` `artist_title`"; $sql .= "FROM `" . iaLyric::getTable(true) . "` t1 "; $sql .= "LEFT JOIN `" . iaArtist::getTable(true) . "` AS t2 "; $sql .= "ON t1.`id_artist` = t2.`id` "; $sql .= "WHERE t1.`status`='active' "; // random lyrics if ($iaView->blockExists('random_lyrics')) { $max = (int) $iaDb->one('MAX(`id`) as `max`', null, iaLyric::getTable()); $sql2 = $iaCore->iaDb->orderByRand($max, 't1.`id`') . " ORDER BY RAND() LIMIT 0, " . $defaultLimit; if ($data = $iaDb->getAll($sql . $sql2)) { $iaView->assign('random_lyrics', $data); } } // latest lyrics if ($iaView->blockExists('latest_lyrics')) { $sql2 = "ORDER BY t1.`date_added` DESC LIMIT 0, " . $defaultLimit; $iaView->assign('latest_lyrics', $iaDb->getAll($sql . $sql2)); }