Пример #1
0
    /**
     * @param             $title
     * @param             $year
     * @param object|null $amazdata
     *
     * @return bool
     */
    public function updateMusicInfo($title, $year, $amazdata = null)
    {
        $gen = new Genres(['Settings' => $this->pdo]);
        $ri = new ReleaseImage($this->pdo);
        $titlepercent = 0;
        $mus = [];
        if ($title != '') {
            $amaz = $this->fetchAmazonProperties($title);
        } else {
            if ($amazdata != null) {
                $amaz = $amazdata;
            } else {
                $amaz = false;
            }
        }
        if (!$amaz) {
            return false;
        }
        if (isset($amaz->Items->Item->ItemAttributes->Title)) {
            $mus['title'] = (string) $amaz->Items->Item->ItemAttributes->Title;
            if (empty($mus['title'])) {
                return false;
            }
        } else {
            return false;
        }
        // Load genres.
        $defaultGenres = $gen->getGenres(Genres::MUSIC_TYPE);
        $genreassoc = [];
        foreach ($defaultGenres as $dg) {
            $genreassoc[$dg['id']] = strtolower($dg['title']);
        }
        // Get album properties.
        $mus['coverurl'] = (string) $amaz->Items->Item->LargeImage->URL;
        if ($mus['coverurl'] != "") {
            $mus['cover'] = 1;
        } else {
            $mus['cover'] = 0;
        }
        $mus['asin'] = (string) $amaz->Items->Item->ASIN;
        $mus['url'] = (string) $amaz->Items->Item->DetailPageURL;
        $mus['url'] = str_replace("%26tag%3Dws", "%26tag%3Dopensourceins%2D21", $mus['url']);
        $mus['salesrank'] = (string) $amaz->Items->Item->SalesRank;
        if ($mus['salesrank'] == "") {
            $mus['salesrank'] = 'null';
        }
        $mus['artist'] = (string) $amaz->Items->Item->ItemAttributes->Artist;
        if (empty($mus['artist'])) {
            $mus['artist'] = (string) $amaz->Items->Item->ItemAttributes->Creator;
            if (empty($mus['artist'])) {
                $mus['artist'] = "";
            }
        }
        $mus['publisher'] = (string) $amaz->Items->Item->ItemAttributes->Publisher;
        $mus['releasedate'] = $this->pdo->escapeString((string) $amaz->Items->Item->ItemAttributes->ReleaseDate);
        if ($mus['releasedate'] == "''") {
            $mus['releasedate'] = 'null';
        }
        $mus['review'] = "";
        if (isset($amaz->Items->Item->EditorialReviews)) {
            $mus['review'] = trim(strip_tags((string) $amaz->Items->Item->EditorialReviews->EditorialReview->Content));
        }
        $mus['year'] = $year;
        if ($mus['year'] == "") {
            $mus['year'] = $mus['releasedate'] != 'null' ? substr($mus['releasedate'], 1, 4) : date("Y");
        }
        $mus['tracks'] = "";
        if (isset($amaz->Items->Item->Tracks)) {
            $tmpTracks = (array) $amaz->Items->Item->Tracks->Disc;
            $tracks = $tmpTracks['Track'];
            $mus['tracks'] = is_array($tracks) && !empty($tracks) ? implode('|', $tracks) : '';
        }
        similar_text($mus['artist'] . " " . $mus['title'], $title, $titlepercent);
        if ($titlepercent < 60) {
            return false;
        }
        $genreKey = -1;
        $genreName = '';
        if (isset($amaz->Items->Item->BrowseNodes)) {
            // Had issues getting this out of the browsenodes obj.
            // Workaround is to get the xml and load that into its own obj.
            $amazGenresXml = $amaz->Items->Item->BrowseNodes->asXml();
            $amazGenresObj = simplexml_load_string($amazGenresXml);
            $amazGenres = $amazGenresObj->xpath("//BrowseNodeId");
            foreach ($amazGenres as $amazGenre) {
                $currNode = trim($amazGenre[0]);
                if (empty($genreName)) {
                    $genreMatch = $this->matchBrowseNode($currNode);
                    if ($genreMatch !== false) {
                        $genreName = $genreMatch;
                        break;
                    }
                }
            }
            if (in_array(strtolower($genreName), $genreassoc)) {
                $genreKey = array_search(strtolower($genreName), $genreassoc);
            } else {
                $genreKey = $this->pdo->queryInsert(sprintf("\n\t\t\t\t\t\t\t\t\t\tINSERT INTO genres (title, type)\n\t\t\t\t\t\t\t\t\t\tVALUES (%s, %d)", $this->pdo->escapeString($genreName), Genres::MUSIC_TYPE));
            }
        }
        $mus['musicgenre'] = $genreName;
        $mus['musicgenreid'] = $genreKey;
        $check = $this->pdo->queryOneRow(sprintf('
				SELECT id
				FROM musicinfo
				WHERE asin = %s', $this->pdo->escapeString($mus['asin'])));
        if ($check === false) {
            $musicId = $this->pdo->queryInsert(sprintf("\n\t\t\t\t\tINSERT INTO musicinfo\n\t\t\t\t\t\t(title, asin, url, salesrank, artist, publisher,\n\t\t\t\t\t\treleasedate, review, year, genre_id, tracks, cover, createddate, updateddate)\n\t\t\t\t\tVALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %d, now(), now())", $this->pdo->escapeString($mus['title']), $this->pdo->escapeString($mus['asin']), $this->pdo->escapeString($mus['url']), $mus['salesrank'], $this->pdo->escapeString($mus['artist']), $this->pdo->escapeString($mus['publisher']), $mus['releasedate'], $this->pdo->escapeString($mus['review']), $this->pdo->escapeString($mus['year']), $mus['musicgenreid'] == -1 ? "null" : $mus['musicgenreid'], $this->pdo->escapeString($mus['tracks']), $mus['cover']));
        } else {
            $musicId = $check['id'];
            $this->pdo->queryExec(sprintf('
					UPDATE musicinfo
					SET title = %s, asin = %s, url = %s, salesrank = %s, artist = %s,
						publisher = %s, releasedate = %s, review = %s, year = %s, genre_id = %s, tracks = %s, cover = %s,
						updateddate = NOW()
					WHERE id = %d', $this->pdo->escapeString($mus['title']), $this->pdo->escapeString($mus['asin']), $this->pdo->escapeString($mus['url']), $mus['salesrank'], $this->pdo->escapeString($mus['artist']), $this->pdo->escapeString($mus['publisher']), $mus['releasedate'], $this->pdo->escapeString($mus['review']), $this->pdo->escapeString($mus['year']), $mus['musicgenreid'] == -1 ? "null" : $mus['musicgenreid'], $this->pdo->escapeString($mus['tracks']), $mus['cover'], $musicId));
        }
        if ($musicId) {
            if ($this->echooutput) {
                $this->pdo->log->doEcho($this->pdo->log->header("\nAdded/updated album: ") . $this->pdo->log->alternateOver("   Artist: ") . $this->pdo->log->primary($mus['artist']) . $this->pdo->log->alternateOver("   Title:  ") . $this->pdo->log->primary($mus['title']) . $this->pdo->log->alternateOver("   Year:   ") . $this->pdo->log->primary($mus['year']));
            }
            $mus['cover'] = $ri->saveImage($musicId, $mus['coverurl'], $this->imgSavePath, 250, 250);
        } else {
            if ($this->echooutput) {
                if ($mus["artist"] == "") {
                    $artist = "";
                } else {
                    $artist = "Artist: " . $mus['artist'] . ", Album: ";
                }
                $this->pdo->log->doEcho($this->pdo->log->headerOver("Nothing to update: ") . $this->pdo->log->primary($artist . $mus['title'] . " (" . $mus['year'] . ")"));
            }
        }
        return $musicId;
    }
Пример #2
0
    /**
     * Process each game, updating game information from Giantbomb
     *
     * @param $gameInfo
     *
     * @return bool
     */
    public function updateGamesInfo($gameInfo)
    {
        $gen = new Genres(['Settings' => $this->pdo]);
        $ri = new ReleaseImage($this->pdo);
        $con = [];
        // Process Steam first before giantbomb
        // Steam has more details
        $this->_gameResults = [];
        $this->_getGame = new Steam();
        $this->_classUsed = "steam";
        $this->_getGame->cookie = $this->cookie;
        $this->_getGame->searchTerm = $gameInfo['title'];
        if ($this->_getGame->search() !== false) {
            $this->_gameResults = $this->_getGame->getAll();
        }
        if (count($this->_gameResults) < 1) {
            $this->_getGame = new Desura();
            $this->_classUsed = "desura";
            $this->_getGame->cookie = $this->cookie;
            $this->_getGame->searchTerm = $gameInfo['title'];
            if ($this->_getGame->search() !== false) {
                $this->_gameResults = $this->_getGame->getAll();
            }
        }
        if (count($this->_gameResults) < 1) {
            $this->_getGame = new Greenlight();
            $this->_classUsed = "gl";
            $this->_getGame->cookie = $this->cookie;
            $this->_getGame->searchTerm = $gameInfo['title'];
            if ($this->_getGame->search() !== false) {
                $this->_gameResults = $this->_getGame->getAll();
            }
        }
        if (count($this->_gameResults) < 1) {
            $this->_gameResults = (array) $this->fetchGiantBombID($gameInfo['title']);
            if ($this->maxHitRequest === true) {
                return false;
            }
        }
        if (empty($this->_gameResults['title'])) {
            return false;
        }
        if (!is_array($this->_gameResults)) {
            return false;
        }
        if (count($this->_gameResults) > 1) {
            $genreName = '';
            switch ($this->_classUsed) {
                case "desura":
                    if (isset($this->_gameResults['cover'])) {
                        $con['coverurl'] = (string) $this->_gameResults['cover'];
                    }
                    if (isset($this->_gameResults['backdrop'])) {
                        $con['backdropurl'] = (string) $this->_gameResults['backdrop'];
                    }
                    $con['title'] = (string) $this->_gameResults['title'];
                    $con['asin'] = $this->_gameResults['desuragameid'];
                    $con['url'] = (string) $this->_gameResults['directurl'];
                    if (isset($this->_gameResults['gamedetails']['Publisher'])) {
                        $con['publisher'] = (string) $this->_gameResults['gamedetails']['Publisher'];
                    } else {
                        $con['publisher'] = "Unknown";
                    }
                    if (isset($this->_gameResults['rating'])) {
                        $con['esrb'] = (string) $this->_gameResults['rating'];
                    } else {
                        $con['esrb'] = "Not Rated";
                    }
                    if (isset($this->_gameResults['description'])) {
                        $con['review'] = trim(strip_tags((string) $this->_gameResults['description']));
                    }
                    if (isset($this->_gameResults['trailer'])) {
                        $con['trailer'] = (string) $this->_gameResults['trailer'];
                    }
                    if (isset($this->_gameResults['gamedetails']['Genre'])) {
                        $genres = (string) $this->_gameResults['gamedetails']['Genre'];
                        $genreName = $this->_matchGenre($genres);
                    }
                    break;
                case "gb":
                    $con['coverurl'] = (string) $this->_gameResults['image']['super_url'];
                    $con['title'] = (string) $this->_gameResults['name'];
                    $con['asin'] = $this->_gameID;
                    $con['url'] = (string) $this->_gameResults['site_detail_url'];
                    if (is_array($this->_gameResults['publishers'])) {
                        while (list($key) = each($this->_gameResults['publishers'])) {
                            if ($key == 0) {
                                $con['publisher'] = (string) $this->_gameResults['publishers'][$key]['name'];
                            }
                        }
                    } else {
                        $con['publisher'] = "Unknown";
                    }
                    if (is_array($this->_gameResults['original_game_rating'])) {
                        $con['esrb'] = (string) $this->_gameResults['original_game_rating'][0]['name'];
                    } else {
                        $con['esrb'] = (string) $this->_gameResults['original_game_rating']['name'];
                    }
                    $con['releasedate'] = (string) $this->_gameResults['original_release_date'];
                    if (isset($this->_gameResults['description'])) {
                        $con['review'] = trim(strip_tags((string) $this->_gameResults['description']));
                    }
                    if (isset($this->_gameResults['genres'][0]['name'])) {
                        $genres = (string) $this->_gameResults['genres'][0]['name'];
                        $genreName = $this->_matchGenre($genres);
                    }
                    break;
                case "gl":
                    if (isset($this->_gameResults['cover'])) {
                        $con['coverurl'] = (string) $this->_gameResults['cover'];
                    }
                    if (isset($this->_gameResults['backdrop'])) {
                        $con['backdropurl'] = (string) $this->_gameResults['backdrop'];
                    }
                    $con['title'] = (string) $this->_gameResults['title'];
                    $con['asin'] = $this->_gameResults['greenlightgameid'];
                    $con['url'] = (string) $this->_gameResults['directurl'];
                    $con['publisher'] = "Unknown";
                    $con['esrb'] = "Not Rated";
                    if (isset($this->_gameResults['description'])) {
                        $con['review'] = trim(strip_tags((string) $this->_gameResults['description']));
                    }
                    if (isset($this->_gameResults['trailer'])) {
                        $con['trailer'] = (string) $this->_gameResults['trailer'];
                    }
                    if (isset($this->_gameResults['gamedetails']['Genre'])) {
                        $genres = (string) $this->_gameResults['gamedetails']['Genre'];
                        $genreName = $this->_matchGenre($genres);
                    }
                    break;
                case "steam":
                    if (isset($this->_gameResults['cover'])) {
                        $con['coverurl'] = (string) $this->_gameResults['cover'];
                    }
                    if (isset($this->_gameResults['backdrop'])) {
                        $con['backdropurl'] = (string) $this->_gameResults['backdrop'];
                    }
                    $con['title'] = (string) $this->_gameResults['title'];
                    $con['asin'] = $this->_gameResults['steamgameid'];
                    $con['url'] = (string) $this->_gameResults['directurl'];
                    if (isset($this->_gameResults['gamedetails']['Publisher'])) {
                        $con['publisher'] = (string) $this->_gameResults['gamedetails']['Publisher'];
                    } else {
                        $con['publisher'] = "Unknown";
                    }
                    if (isset($this->_gameResults['rating'])) {
                        $con['esrb'] = (string) $this->_gameResults['rating'];
                    } else {
                        $con['esrb'] = "Not Rated";
                    }
                    if (!empty($this->_gameResults['gamedetails']['Release Date'])) {
                        $dateReleased = $this->_gameResults['gamedetails']['Release Date'];
                        if (!preg_match('#^\\s*(?P<month>\\w+)\\s+(?P<day>\\d{1,2}),?\\s+(?P<year>\\d{4})\\s*$#', $dateReleased)) {
                            if (preg_match('#^\\s*(?P<month>\\w+)\\s+(?P<year>\\d{4})\\s*$#', $dateReleased, $matches)) {
                                $dateReleased = "{$matches['month']} 1, {$matches['year']}";
                            }
                        }
                        $date = \DateTime::createFromFormat('M/j/Y', $dateReleased);
                        if ($date instanceof \DateTime) {
                            $con['releasedate'] = (string) $date->format('Y-m-d');
                        }
                    }
                    if (isset($this->_gameResults['description'])) {
                        $con['review'] = trim(strip_tags((string) $this->_gameResults['description']));
                    }
                    if (isset($this->_gameResults['trailer'])) {
                        $con['trailer'] = (string) $this->_gameResults['trailer'];
                    }
                    if (isset($this->_gameResults['gamedetails']['Genre'])) {
                        $genres = (string) $this->_gameResults['gamedetails']['Genre'];
                        $genreName = $this->_matchGenre($genres);
                    }
                    break;
                default:
                    return false;
            }
        } else {
            return false;
        }
        // Load genres.
        $defaultGenres = $gen->getGenres(Genres::GAME_TYPE);
        $genreassoc = [];
        foreach ($defaultGenres as $dg) {
            $genreassoc[$dg['id']] = strtolower($dg['title']);
        }
        // Prepare database values.
        if (isset($con['coverurl'])) {
            $con['cover'] = 1;
        } else {
            $con['cover'] = 0;
        }
        if (isset($con['backdropurl'])) {
            $con['backdrop'] = 1;
        } else {
            $con['backdrop'] = 0;
        }
        if (!isset($con['trailer'])) {
            $con['trailer'] = 0;
        }
        if (empty($con['title'])) {
            $con['title'] = $gameInfo['title'];
        }
        if (!isset($con['releasedate'])) {
            $con['releasedate'] = "";
        }
        if ($con['releasedate'] == "''") {
            $con['releasedate'] = "";
        }
        if (!isset($con['review'])) {
            $con['review'] = 'No Review';
        }
        $con['classused'] = $this->_classUsed;
        if (empty($genreName)) {
            $genreName = 'Unknown';
        }
        if (in_array(strtolower($genreName), $genreassoc)) {
            $genreKey = array_search(strtolower($genreName), $genreassoc);
        } else {
            $genreKey = $this->pdo->queryInsert(sprintf("\n\t\t\t\t\tINSERT INTO genres (title, type)\n\t\t\t\t\tVALUES (%s, %d)", $this->pdo->escapeString($genreName), Genres::GAME_TYPE));
        }
        $con['gamesgenre'] = $genreName;
        $con['gamesgenreID'] = $genreKey;
        $check = $this->pdo->queryOneRow(sprintf('
				SELECT id
				FROM gamesinfo
				WHERE asin = %s', $this->pdo->escapeString($con['asin'])));
        if ($check === false) {
            $gamesId = $this->pdo->queryInsert(sprintf("\n\t\t\t\t\tINSERT INTO gamesinfo\n\t\t\t\t\t\t(title, asin, url, publisher, genre_id, esrb, releasedate, review, cover, backdrop, trailer, classused, createddate, updateddate)\n\t\t\t\t\tVALUES (%s, %s, %s, %s, %s, %s, %s, %s, %d, %d, %s, %s, NOW(), NOW())", $this->pdo->escapeString($con['title']), $this->pdo->escapeString($con['asin']), $this->pdo->escapeString($con['url']), $this->pdo->escapeString($con['publisher']), $con['gamesgenreID'] == -1 ? "null" : $con['gamesgenreID'], $this->pdo->escapeString($con['esrb']), $con['releasedate'] != "" ? $this->pdo->escapeString($con['releasedate']) : "null", $this->pdo->escapeString(substr($con['review'], 0, 3000)), $con['cover'], $con['backdrop'], $this->pdo->escapeString($con['trailer']), $this->pdo->escapeString($con['classused'])));
        } else {
            $gamesId = $check['id'];
            $this->pdo->queryExec(sprintf('
					UPDATE gamesinfo
					SET
						title = %s, asin = %s, url = %s, publisher = %s, genre_id = %s,
						esrb = %s, releasedate = %s, review = %s, cover = %d, backdrop = %d, trailer = %s, classused = %s, updateddate = NOW()
					WHERE id = %d', $this->pdo->escapeString($con['title']), $this->pdo->escapeString($con['asin']), $this->pdo->escapeString($con['url']), $this->pdo->escapeString($con['publisher']), $con['gamesgenreID'] == -1 ? "null" : $con['gamesgenreID'], $this->pdo->escapeString($con['esrb']), $con['releasedate'] != "" ? $this->pdo->escapeString($con['releasedate']) : "null", $this->pdo->escapeString(substr($con['review'], 0, 3000)), $con['cover'], $con['backdrop'], $this->pdo->escapeString($con['trailer']), $this->pdo->escapeString($con['classused']), $gamesId));
        }
        if ($gamesId) {
            if ($this->echoOutput) {
                $this->pdo->log->doEcho($this->pdo->log->header("Added/updated game from " . $this->_classUsed . ": ") . $this->pdo->log->alternateOver("   Title:    ") . $this->pdo->log->primary($con['title']));
            }
            if ($con['cover'] === 1) {
                $con['cover'] = $ri->saveImage($gamesId, $con['coverurl'], $this->imgSavePath, 250, 250);
            }
            if ($con['backdrop'] === 1) {
                $con['backdrop'] = $ri->saveImage($gamesId . '-backdrop', $con['backdropurl'], $this->imgSavePath, 1920, 1024);
            }
        } else {
            if ($this->echoOutput) {
                $this->pdo->log->doEcho($this->pdo->log->headerOver("Nothing to update: ") . $this->pdo->log->primary($con['title'] . ' (PC)'));
            }
        }
        return $gamesId;
    }
Пример #3
0
 /**
  * @return array
  */
 protected function _loadGenres()
 {
     $gen = new Genres(['Settings' => $this->pdo]);
     $defaultGenres = $gen->getGenres(Genres::CONSOLE_TYPE);
     $genreassoc = [];
     foreach ($defaultGenres as $dg) {
         $genreassoc[$dg['id']] = strtolower($dg['title']);
     }
     return $genreassoc;
 }
Пример #4
0
}
$catarray = array();
$catarray[] = $category;
$page->smarty->assign('catlist', $mtmp);
$page->smarty->assign('category', $category);
$browsecount = $music->getMusicCount($catarray, -1, $page->userdata['categoryexclusions']);
$offset = isset($_REQUEST['offset']) && ctype_digit($_REQUEST['offset']) ? $_REQUEST['offset'] : 0;
$ordering = $music->getMusicOrdering();
$orderby = isset($_REQUEST['ob']) && in_array($_REQUEST['ob'], $ordering) ? $_REQUEST['ob'] : '';
$results = $musics = array();
$results = $music->getMusicRange($catarray, $offset, ITEMS_PER_COVER_PAGE, $orderby, $page->userdata['categoryexclusions']);
$artist = isset($_REQUEST['artist']) && !empty($_REQUEST['artist']) ? stripslashes($_REQUEST['artist']) : '';
$page->smarty->assign('artist', $artist);
$title = isset($_REQUEST['title']) && !empty($_REQUEST['title']) ? stripslashes($_REQUEST['title']) : '';
$page->smarty->assign('title', $title);
$genres = $gen->getGenres(Genres::MUSIC_TYPE, true);
$tmpgnr = array();
foreach ($genres as $gn) {
    $tmpgnr[$gn['id']] = $gn['title'];
}
foreach ($results as $result) {
    $result['genre'] = $tmpgnr[$result["genre_id"]];
    $musics[] = $result;
}
$genre = isset($_REQUEST['genre']) && array_key_exists($_REQUEST['genre'], $tmpgnr) ? $_REQUEST['genre'] : '';
$page->smarty->assign('genres', $genres);
$page->smarty->assign('genre', $genre);
$years = range(1950, date("Y") + 1);
rsort($years);
$year = isset($_REQUEST['year']) && in_array($_REQUEST['year'], $years) ? $_REQUEST['year'] : '';
$page->smarty->assign('years', $years);
Пример #5
0
    if (!empty($result['review'])) {
        // remove "Overview" from start of review if present
        if (0 === strpos($result['review'], 'Overview')) {
            $result['review'] = substr($result['review'], 8);
        }
        $words = explode(' ', $result['review']);
        if (sizeof($words) > $maxwords) {
            $newwords = array_slice($words, 0, $maxwords);
            $result['review'] = implode(' ', $newwords) . '...';
        }
    }
    $games2[] = $result;
}
$title = isset($_REQUEST['title']) && !empty($_REQUEST['title']) ? stripslashes($_REQUEST['title']) : '';
$page->smarty->assign('title', $title);
$genres = $gen->getGenres(Genres::GAME_TYPE, true);
$tmpgnr = array();
foreach ($genres as $gn) {
    $tmpgnr[$gn['id']] = $gn['title'];
}
$years = range(1903, date("Y") + 1);
rsort($years);
$year = isset($_REQUEST['year']) && in_array($_REQUEST['year'], $years) ? $_REQUEST['year'] : '';
$page->smarty->assign('years', $years);
$page->smarty->assign('year', $year);
$genre = isset($_REQUEST['genre']) && array_key_exists($_REQUEST['genre'], $tmpgnr) ? $_REQUEST['genre'] : '';
$page->smarty->assign('genres', $genres);
$page->smarty->assign('genre', $genre);
$browseby_link = '&amp;title=' . $title . '&amp;year=' . $year;
$page->smarty->assign('pagertotalitems', $results[0]['_totalcount']);
$page->smarty->assign('pageroffset', $offset);
Пример #6
0
foreach ($results as $result) {
    if (!empty($result['review'])) {
        $words = explode(' ', $result['review']);
        if (sizeof($words) > $maxwords) {
            $newwords = array_slice($words, 0, $maxwords);
            $result['review'] = implode(' ', $newwords) . '...';
        }
    }
    $result['failed'] = $fail->getFailedCount($result['grp_release_guid']);
    $consoles[] = $result;
}
$platform = isset($_REQUEST['platform']) && !empty($_REQUEST['platform']) ? stripslashes($_REQUEST['platform']) : '';
$page->smarty->assign('platform', $platform);
$title = isset($_REQUEST['title']) && !empty($_REQUEST['title']) ? stripslashes($_REQUEST['title']) : '';
$page->smarty->assign('title', $title);
$genres = $gen->getGenres(Genres::CONSOLE_TYPE, true);
$tmpgnr = array();
foreach ($genres as $gn) {
    $tmpgnr[$gn['id']] = $gn['title'];
}
$genre = isset($_REQUEST['genre']) && array_key_exists($_REQUEST['genre'], $tmpgnr) ? $_REQUEST['genre'] : '';
$page->smarty->assign('genres', $genres);
$page->smarty->assign('genre', $genre);
$browseby_link = '&amp;title=' . $title . '&amp;platform=' . $platform;
$page->smarty->assign('pagertotalitems', $browsecount);
$page->smarty->assign('pageroffset', $offset);
$page->smarty->assign('pageritemsperpage', ITEMS_PER_COVER_PAGE);
$page->smarty->assign('pagerquerybase', WWW_TOP . "/console?t=" . $category . $browseby_link . "&amp;ob=" . $orderby . "&amp;offset=");
$page->smarty->assign('pagerquerysuffix', "#results");
$pager = $page->smarty->fetch("pager.tpl");
$page->smarty->assign('pager', $pager);
Пример #7
0
    $mus = $music->getMusicInfo($id);
    if (!$mus) {
        $page->show404();
    }
    switch ($action) {
        case 'submit':
            $coverLoc = nZEDb_COVERS . "music/" . $id . '.jpg';
            if ($_FILES['cover']['size'] > 0) {
                $tmpName = $_FILES['cover']['tmp_name'];
                $file_info = getimagesize($tmpName);
                if (!empty($file_info)) {
                    move_uploaded_file($_FILES['cover']['tmp_name'], $coverLoc);
                }
            }
            $_POST['cover'] = file_exists($coverLoc) ? 1 : 0;
            $_POST['salesrank'] = empty($_POST['salesrank']) || !ctype_digit($_POST['salesrank']) ? "null" : $_POST['salesrank'];
            $_POST['releasedate'] = empty($_POST['releasedate']) || !strtotime($_POST['releasedate']) ? $mus['releasedate'] : date("Y-m-d H:i:s", strtotime($_POST['releasedate']));
            $music->update($id, $_POST["title"], $_POST['asin'], $_POST['url'], $_POST["salesrank"], $_POST["artist"], $_POST["publisher"], $_POST["releasedate"], $_POST["year"], $_POST["tracks"], $_POST["cover"], $_POST["genre"]);
            header("Location:" . WWW_TOP . "/music-list.php");
            die;
            break;
        case 'view':
        default:
            $page->title = "Music Edit";
            $page->smarty->assign('music', $mus);
            $page->smarty->assign('genres', $gen->getGenres(Genres::MUSIC_TYPE));
            break;
    }
}
$page->content = $page->smarty->fetch('music-edit.tpl');
$page->render();
Пример #8
0
    $con = $console->getConsoleInfo($id);
    if (!$con) {
        $page->show404();
    }
    switch ($action) {
        case 'submit':
            $coverLoc = nZEDb_COVERS . "console/" . $id . '.jpg';
            if ($_FILES['cover']['size'] > 0) {
                $tmpName = $_FILES['cover']['tmp_name'];
                $file_info = getimagesize($tmpName);
                if (!empty($file_info)) {
                    move_uploaded_file($_FILES['cover']['tmp_name'], $coverLoc);
                }
            }
            $_POST['cover'] = file_exists($coverLoc) ? 1 : 0;
            $_POST['salesrank'] = empty($_POST['salesrank']) || !ctype_digit($_POST['salesrank']) ? "null" : $_POST['salesrank'];
            $_POST['releasedate'] = empty($_POST['releasedate']) || !strtotime($_POST['releasedate']) ? $con['releasedate'] : date("Y-m-d H:i:s", strtotime($_POST['releasedate']));
            $console->update($id, $_POST["title"], $_POST['asin'], $_POST['url'], $_POST["salesrank"], $_POST["platform"], $_POST["publisher"], $_POST["releasedate"], $_POST["esrb"], $_POST["cover"], $_POST["genre"]);
            header("Location:" . WWW_TOP . "/console-list.php");
            die;
            break;
        case 'view':
        default:
            $page->title = "Console Edit";
            $page->smarty->assign('console', $con);
            $page->smarty->assign('genres', $gen->getGenres(Genres::CONSOLE_TYPE));
            break;
    }
}
$page->content = $page->smarty->fetch('console-edit.tpl');
$page->render();
Пример #9
0
                    move_uploaded_file($_FILES['backdrop']['tmp_name'], $backdropLoc);
                }
            }
            $_POST['cover'] = file_exists($coverLoc) ? 1 : 0;
            $_POST['backdrop'] = file_exists($backdropLoc) ? 1 : 0;
            if (is_array($_POST['genre'])) {
                $genre = join(",", $_POST['genre']);
            } else {
                $genre = $_POST['genre'];
            }
            $trailerurl['url'] = $_POST['trailerurl'];
            $trailerurl = serialize($trailerurl);
            $xxxmovie->update($id, $_POST['title'], $_POST['tagline'], $_POST['plot'], $genre, $_POST['director'], $_POST['actors'], $_POST['extras'], $_POST['productinfo'], $trailerurl, $_POST['directurl'], $_POST['classused'], $_POST['cover'], $_POST['backdrop']);
            header("Location:" . WWW_TOP . "/xxx-list.php");
            die;
            break;
        case 'view':
        default:
            $page->title = "XXX Movie Edit";
            if (stristr($xxx['genre'], ",")) {
                $xxx['genre'] = explode(",", $xxx['genre']);
            }
            $xxx['trailers'] = !empty($xxx['trailers']) ? unserialize($xxx['trailers']) : '';
            $xxx['trailers'] = $xxx['trailers']['url'];
            $page->smarty->assign('genres', $gen->getGenres(Category::CAT_PARENT_XXX));
            $page->smarty->assign('xxxmovie', $xxx);
            break;
    }
}
$page->content = $page->smarty->fetch('xxx-edit.tpl');
$page->render();