Esempio n. 1
0
function sidebar()
{
    $return .= "\n\t<h4>Music Library</h4>\n\t<dl>\n\t\t<dt>Tracks</dt>\n\t\t<dd>" . number_format(Tracks::get_total_tracks()) . "</dd>\n\t\t<dt>Artists</dt>\n\t\t<dd>" . number_format(Artists::count()) . "</dd>\n\t\t<dt>Albums</dt>\n\t\t<dd>" . number_format(Albums::count()) . "</dd>\n\t</dl>";
    function bytes($a)
    {
        $unim = array("B", "KB", "MB", "GB", "TB", "PB");
        $c = 0;
        while ($a >= 1024) {
            $c++;
            $a = $a / 1024;
        }
        return number_format($a, $c ? 2 : 0, ".", ",") . " " . $unim[$c];
    }
    $return .= "\n\t<h4>Archive Storage</h4>\n\t<dl>";
    foreach (Archives::get_all() as $archive) {
        $pc = (int) (100 - $archive->get_free_space() / $archive->get_total_space() * 100);
        if ($archive->get_free_space() > 536870912000.0) {
            $colour = "success";
        } else {
            if ($archive->get_free_space() > 214748364800.0) {
                $colour = "warning";
            } else {
                $colour = "danger";
            }
        }
        $return .= "\n\t\t<dt>" . $archive->get_name() . "</dt>\n\t\t<dd><div class=\"progress\" style=\"margin: 3px 0px; \"><div class=\"progress-bar progress-bar-" . $colour . "\" style=\"width: " . $pc . "%;\"></div></div></dd>\n\t\t<dd>" . bytes($archive->get_free_space()) . " free of " . bytes($archive->get_total_space()) . "</dd>";
    }
    $return .= "</dl>";
    return $return;
}
 public function actionArtistas()
 {
     $this->pageTitle = 'Artistas - ' . $this->pageTitle;
     $this->pageDescription = 'Ven y disfruta en familia de lo mejor de la salsa, el merengue, el vallenato y mucho más en las ferias de Duitama 2016.';
     $this->tagImage = '/images/facebook-artistas.png';
     $artists = Artists::model()->findAllByAttributes(array('status_artist' => 1));
     $this->render('artistas', array('artists' => $artists));
 }
 public function loadModel($id)
 {
     $model = Artists::model()->findByAttributes(array('id_artist' => $id, 'status_artist' => 1));
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Esempio n. 4
0
 public function del_artists($artists)
 {
     if (!is_array($artists)) {
         $tmp = $artists;
         $artists = array($tmp);
     }
     foreach ($artists as $artist) {
         $object = Artists::get_by_name($artist);
         $object->del_from_track($this);
     }
 }
Esempio n. 5
0
 public function index()
 {
     //Set keyword to proper format using Str::lower - it's the same as strtolower
     $keyword = Str::lower(Input::get('keyword'));
     //Use Query builder to look for the keyword in various category
     $data['comics'] = Comicbooks::where('book_name', 'LIKE', '%' . $keyword . '%')->select('book_name')->distinct()->get();
     $data['characters'] = Characters::where('character_name', 'LIKE', '%' . $keyword . '%')->select('character_name')->distinct()->get();
     $data['authors'] = Authors::where('author_name', 'LIKE', '%' . $keyword . '%')->select('author_name')->distinct()->get();
     $data['artists'] = Artists::where('artist_name', 'LIKE', '%' . $keyword . '%')->select('artist_name')->distinct()->get();
     $data['publishers'] = Publishers::where('publisher_name', 'LIKE', '%' . $keyword . '%')->select('publisher_name')->distinct()->get();
     $this->layout->content = View::make('search', $data);
 }
Esempio n. 6
0
function loadLogos($dir)
{
    if (!is_dir($dir)) {
        echo "Invalid directory";
    } else {
        global $nbInsert;
        global $_PATH;
        if ($handle = opendir($dir)) {
            while (($file = readdir($handle)) !== false) {
                ///---Extraction
                $parts = explode('.', $file);
                $ext = array_pop($parts);
                ///---Valid formats
                if (!($ext == 'gif' || $ext == 'jpg' || $ext == 'png')) {
                    continue;
                }
                ///---Name repack
                $name = join(".", $parts);
                $name = str_replace('__', '.', $name);
                $name = str_replace('_', '%', $name);
                ///---Extra Validations
                //Check for special caracters not encoded
                if (strpos($name, '_') !== false || strpos($name, ' ') !== false) {
                    echo "<b>" . $name . " sould be rename to " . str_replace(array('_', ' '), array('+', '+'), $name) . ".</b><br/>";
                    continue;
                } else {
                    if (strpos($name, '%') === false) {
                        $nameCheck = urlencode(str_replace(array('+'), array(''), $name));
                        //Char excludes
                        //Some caracter are not support yet
                        if (strpos($nameCheck, '%') !== false) {
                            echo "<b>" . $name . " is not properly parse.</b><br/>";
                            continue;
                        }
                    }
                }
                $prev = $name;
                ///---Insert in db
                if (artistExist($name)) {
                    continue;
                }
                echo $name . " - ";
                $newDate = filemtime(Config::FOLDER_LOGOS . $file);
                //Date of modification (new file)
                $newArtist = new Artist($name, $file, "", -1, $newDate);
                Artists::addArtist($newArtist);
                $nbInsert++;
            }
            closedir($handle);
        }
    }
}
 /**
  * Output the image with the logos of each artist
  */
 public function show()
 {
     if (count($this->artists) == 0) {
         throw new Exception("Missing some informations (artists).");
     }
     $totalHeight = array(self::$marginTop, self::$marginTop);
     $listImageRessources = array(array(), array());
     $forcedWidth = self::$width / 2 - self::$seperation / 2;
     foreach ($this->artists as $name) {
         if (count($listImageRessources[0]) + count($listImageRessources[1]) == $this->nbArtists) {
             break;
         }
         $a = Artists::getArtistByName($name);
         if ($a != null) {
             $image = Artists::imageFromArtist($a);
             if (isset($image)) {
                 $i = $totalHeight[1] < $totalHeight[0] ? 1 : 0;
                 $x = imagesx($image);
                 $y = imagesy($image);
                 $newHeight = floor($y * $forcedWidth / $x);
                 $totalHeight[$i] += $newHeight + self::$seperation;
                 array_push($listImageRessources[$i], $image);
             }
         }
     }
     $container = imagecreatetruecolor(self::$width, max($totalHeight));
     //Some colors needed
     $colWhite = imagecolorallocate($container, 255, 255, 255);
     //Background color
     imagefilledrectangle($container, 0, 0, self::$width, max($totalHeight), $colWhite);
     $currentHeight = array(self::$marginTop, self::$marginTop);
     for ($l = 0; $l < count($listImageRessources); $l++) {
         $list = $listImageRessources[$l];
         foreach ($list as $image) {
             $x = imagesx($image);
             $y = imagesy($image);
             $newHeight = floor($y * $forcedWidth / $x);
             $resized = imagecreatetruecolor($forcedWidth, $newHeight);
             imagecopyresampled($resized, $image, 0, 0, 0, 0, $forcedWidth, $newHeight, $x, $y);
             imagecopymerge($container, $resized, ($forcedWidth + self::$seperation) * $l, $currentHeight[$l], 0, 0, $forcedWidth, $newHeight, 100);
             //echo $currentHeight[$l] . "-";
             $currentHeight[$l] += $newHeight + self::$seperation;
         }
     }
     ImageUtil::applyFilter($container, $this->color);
     imagepng($container);
 }
Esempio n. 8
0
 /**
  * Output the image with the logos of each artist
  */
 public function show()
 {
     if (count($this->artists) == 0) {
         throw new Exception("Missing some informations (artists).");
     }
     $totalHeight = 0;
     $listImageRessources = array();
     foreach ($this->artists as $name) {
         if (count($listImageRessources) == $this->nbArtists) {
             break;
         }
         $a = Artists::getArtistByName($name);
         if ($a != null) {
             $image = Artists::imageFromArtist($a);
             if (isset($image)) {
                 $totalHeight += imagesy($image) + self::$seperation;
                 array_push($listImageRessources, $image);
             }
         }
     }
     //echo $totalHeight;
     $totalHeight += self::$marginTop;
     $container = imagecreatetruecolor(self::$width, $totalHeight);
     //Some colors needed
     $colWhite = imagecolorallocate($container, 255, 255, 255);
     //Background color
     imagefilledrectangle($container, 0, 0, self::$width, $totalHeight, $colWhite);
     $expectWidth = self::$width - 2 * self::$marginSide;
     $currentHeight = self::$marginTop;
     foreach ($listImageRessources as $image) {
         $widthImg = imagesx($image);
         //echo $this->width."-2 * ".self::$marginSide);
         //echo $widthImg."--".$expectWidth."<br/>";
         imagecopymerge($container, $image, self::$marginSide + ($widthImg < $expectWidth ? ($expectWidth - $widthImg) * 0.5 : 0), $currentHeight, 0, 0, imagesx($image), imagesy($image), 100);
         $currentHeight += imagesy($image) + self::$seperation;
     }
     ImageUtil::applyFilter($container, $this->color);
     imagepng($container);
 }
Esempio n. 9
0
 public function getBrowse($category)
 {
     //Get browse category
     $category_filtered = strtoupper(trim($category));
     //Page Title
     $data['title'] = $category_filtered;
     //Switch to get appropriate data, redirect to error if options aren't listed
     switch ($category_filtered) {
         case 'SERIES':
             $data['comics'] = Comicbooks::orderBy('book_name', 'asc')->get();
             break;
         case 'AUTHORS':
             $data['comics'] = Authors::select('author_name')->orderBy('author_name', 'asc')->distinct()->get();
             break;
         case 'ARTISTS':
             $data['comics'] = Artists::select('artist_name')->orderBy('artist_name', 'asc')->distinct()->get();
             break;
         case 'CHARACTERS':
             $data['comics'] = Characters::select('character_name')->orderBy('character_name', 'asc')->distinct()->get();
             break;
         case 'PUBLISHERS':
             $data['comics'] = Publishers::select('publisher_name')->orderBy('publisher_name', 'asc')->distinct()->get();
             break;
         case 'GENRES':
             $data['comics'] = Genres::orderBy('genre_name', 'asc')->get();
             break;
         case 'YEARS':
             //This needed to be a raw query because of the date
             $data['comics'] = Comicissues::select(DB::raw('year(published_date) as year'))->orderBy('published_date', 'asc')->distinct()->get();
             break;
         default:
             return Redirect::to('error');
             break;
     }
     $this->layout->content = View::make('browse', $data);
 }
Esempio n. 10
0
function generate_torrent_json($Caption, $Tag, $Details, $Limit)
{
    global $LoggedUser, $Categories;
    $results = array();
    foreach ($Details as $Detail) {
        list($TorrentID, $GroupID, $GroupName, $GroupCategoryID, $WikiImage, $TorrentTags, $Format, $Encoding, $Media, $Scene, $HasLog, $HasCue, $LogScore, $Year, $GroupYear, $RemasterTitle, $Snatched, $Seeders, $Leechers, $Data, $ReleaseType, $Size) = $Detail;
        $Artist = Artists::display_artists(Artists::get_artist($GroupID), false, true);
        $TruncArtist = substr($Artist, 0, strlen($Artist) - 3);
        $TagList = array();
        if ($TorrentTags != '') {
            $TorrentTags = explode(' ', $TorrentTags);
            foreach ($TorrentTags as $TagKey => $TagName) {
                $TagName = str_replace('_', '.', $TagName);
                $TagList[] = $TagName;
            }
        }
        // Append to the existing array.
        $results[] = array('torrentId' => (int) $TorrentID, 'groupId' => (int) $GroupID, 'artist' => $TruncArtist, 'groupName' => $GroupName, 'groupCategory' => (int) $GroupCategory, 'groupYear' => (int) $GroupYear, 'remasterTitle' => $RemasterTitle, 'format' => $Format, 'encoding' => $Encoding, 'hasLog' => $HasLog == 1, 'hasCue' => $HasCue == 1, 'media' => $Media, 'scene' => $Scene == 1, 'year' => (int) $Year, 'tags' => $TagList, 'snatched' => (int) $Snatched, 'seeders' => (int) $Seeders, 'leechers' => (int) $Leechers, 'data' => (int) $Data, 'size' => (int) $Size);
    }
    return array('caption' => $Caption, 'tag' => $Tag, 'limit' => (int) $Limit, 'results' => $results);
}
Esempio n. 11
0
if (check_paranoia_here('snatched')) {
    $DB->query("\n\t\tSELECT\n\t\t\tg.ID,\n\t\t\tg.Name,\n\t\t\tg.WikiImage\n\t\tFROM xbt_snatched AS s\n\t\t\tINNER JOIN torrents AS t ON t.ID = s.fid\n\t\t\tINNER JOIN torrents_group AS g ON t.GroupID = g.ID\n\t\tWHERE s.uid = '{$UserID}'\n\t\t\tAND g.CategoryID = '1'\n\t\t\tAND g.WikiImage != ''\n\t\tGROUP BY g.ID\n\t\tORDER BY s.tstamp DESC\n\t\tLIMIT {$Limit}");
    $RecentSnatches = $DB->to_array(false, MYSQLI_ASSOC);
    $Artists = Artists::get_artists($DB->collect('ID'));
    foreach ($RecentSnatches as $Key => $SnatchInfo) {
        $RecentSnatches[$Key]['artists'][] = $Artists[$SnatchInfo['ID']];
        $RecentSnatches[$Key]['ID'] = (int) $RecentSnatches[$Key]['ID'];
    }
    $Results['snatches'] = $RecentSnatches;
} else {
    $Results['snatches'] = "hidden";
}
if (check_paranoia_here('uploads')) {
    $DB->query("\n\t\tSELECT\n\t\t\tg.ID,\n\t\t\tg.Name,\n\t\t\tg.WikiImage\n\t\tFROM torrents_group AS g\n\t\t\tINNER JOIN torrents AS t ON t.GroupID = g.ID\n\t\tWHERE t.UserID = '{$UserID}'\n\t\t\tAND g.CategoryID = '1'\n\t\t\tAND g.WikiImage != ''\n\t\tGROUP BY g.ID\n\t\tORDER BY t.Time DESC\n\t\tLIMIT {$Limit}");
    $RecentUploads = $DB->to_array(false, MYSQLI_ASSOC);
    $Artists = Artists::get_artists($DB->collect('ID'));
    foreach ($RecentUploads as $Key => $UploadInfo) {
        $RecentUploads[$Key]['artists'][] = $Artists[$UploadInfo['ID']];
        $RecentUploads[$Key]['ID'] = (int) $RecentUploads[$Key]['ID'];
    }
    $Results['uploads'] = $RecentUploads;
} else {
    $Results['uploads'] = "hidden";
}
json_die("success", $Results);
function check_paranoia_here($Setting)
{
    global $Paranoia, $Class, $UserID, $Preview;
    if ($Preview == 1) {
        return check_paranoia($Setting, $Paranoia, $Class);
    } else {
Esempio n. 12
0
        default:
            error(0);
    }
}
$DownloadsQ = $DB->query("\n\tSELECT\n\t\tt.ID AS TorrentID,\n\t\tDATE_FORMAT({$Month}, '%Y - %m') AS Month,\n\t\tt.GroupID,\n\t\tt.Media,\n\t\tt.Format,\n\t\tt.Encoding,\n\t\tIF(t.RemasterYear = 0, tg.Year, t.RemasterYear) AS Year,\n\t\ttg.Name,\n\t\tt.Size\n\tFROM torrents AS t\n\t\tJOIN torrents_group AS tg ON t.GroupID = tg.ID\n\t{$SQL}\n\tGROUP BY TorrentID");
$Collector = new TorrentsDL($DownloadsQ, "{$Username}'s " . ucfirst($_GET['type']));
while (list($Downloads, $GroupIDs) = $Collector->get_downloads('TorrentID')) {
    $Artists = Artists::get_artists($GroupIDs);
    $TorrentIDs = array_keys($GroupIDs);
    $TorrentFilesQ = $DB->query('
		SELECT TorrentID, File
		FROM torrents_files
		WHERE TorrentID IN (' . implode(',', $TorrentIDs) . ')', false);
    if (is_int($TorrentFilesQ)) {
        // Query failed. Let's not create a broken zip archive
        foreach ($TorrentIDs as $TorrentID) {
            $Download =& $Downloads[$TorrentID];
            $Download['Artist'] = Artists::display_artists($Artists[$Download['GroupID']], false, true, false);
            $Collector->fail_file($Download);
        }
        continue;
    }
    while (list($TorrentID, $TorrentFile) = $DB->next_record(MYSQLI_NUM, false)) {
        $Download =& $Downloads[$TorrentID];
        $Download['Artist'] = Artists::display_artists($Artists[$Download['GroupID']], false, true, false);
        $Collector->add_file($TorrentFile, $Download, $Download['Month']);
        unset($Download);
    }
}
$Collector->finalize(false);
define('SKIP_NO_CACHE_HEADERS', 1);
Esempio n. 13
0
 /**
  * Adding a comicbook series into the database
  * GET /content/store
  *
  * @return Response
  */
 public function store()
 {
     //Get string inputs
     $inputs = Input::only('book_name', 'publisher_name', 'author_name', 'artist_name');
     //Trim string inputs
     Input::merge(array_map('trim', $inputs));
     //Create session
     $this->createSession();
     //Set validation rules
     $rules = array('book_name' => 'required|alpha_num|unique:comicdb_books', 'publisher_name' => 'required|alpha_num|min:1', 'book_description' => 'max:2000', 'genres' => 'min:1', 'author_name' => 'required|alpha_num|min:1', 'artist_name' => 'required|alpha_num|min:1', 'published_date' => 'required|date_format:yy-m-d', 'cover_image' => 'required|image', 'characters' => 'min:1', 'issue_summary' => 'max:2000');
     //Laravel Validation class and make method takes the inputs in the first argument
     //then the rules on the data in the second
     $validator = Validator::make(Input::all(), $rules);
     //Validator instance use the pass method to continue
     if ($validator->passes()) {
         dd($validator->passes());
         //Instance of Comicbook model
         $comic = new Comicbooks();
         //Instance of Publisher model
         $publishers = new Publishers();
         //Setting variables
         $publisher = strtolower(Input::get('publisher_name'));
         $author = strtolower(Input::get('author_name'));
         $artist = strtolower(Input::get('artist_name'));
         $publisherExists = $publishers->where('publisher_name', $publisher)->select('id')->first();
         $authorExists = Authors::where('author_name', $author)->select('id')->first();
         $artistExists = Artists::where('artist_name', $artist)->select('id')->first();
         //Check if publisher already exist in the database
         if (isset($publisherExists->id)) {
             //if it does get the id
             $publisher_id = $publisherExists->id;
         } else {
             //else create it in the Publisher table using the instance of publisher model
             $publisher_id = $publishers->insertGetId(array('publisher_name' => $publisher));
         }
         //Check if author already exist in the database
         if (isset($authorExists)) {
             //if they do get the id
             $author_id = $authorExists->id;
         } else {
             //else create it in the Authors table using the instance of author model
             $author_id = Authors::insertGetId(array('author_name' => $author));
         }
         //Check if artist already exist in the database
         if (isset($artistExists)) {
             //if they do get the id
             $artist_id = $artistExists->id;
         } else {
             //else create it in the Artists table using the instance of artist model
             $artist_id = Artists::insertGetId(array('artist_name' => $artist));
         }
         //Add book series information to comicdb_books
         $comic->book_name = strtolower(Input::get('book_name'));
         $comic->book_description = Input::get('book_description');
         $comic->publisher_id_FK = $publisher_id;
         $comic->save();
         //Add genre and book ids in the comicdb_genrebook using Query Builder
         foreach (Input::get('genres') as $key => $genre) {
             DB::table('comicdb_genrebook')->insert(array('book_id_FK' => $comic->id, 'genre_id_FK' => $genre));
         }
         //Add cover image to local file and set location string into database
         if (Input::hasFile('cover_image')) {
             $fileName = strtolower(Input::get('book_name')) . '01_Cov_' . Str::random(10) . '.' . Input::file('cover_image')->getClientOriginalExtension();
             $cover_image = Input::file('cover_image')->move('public/img/comic_covers/', $fileName);
         }
         //Add issue character information into the comicdb_character table and keys into the comicdb_characterbook table using Query Builder
         foreach (Input::get('characters') as $key => $character) {
             $character_id = Characters::insertGetId(array('character_name' => $character));
             DB::table('comicdb_characterbook')->insert(array('book_id_FK' => $comic->id, 'character_id_FK' => $character_id));
         }
         //Add issues information to comicdb_issues
         Comicissues::insert(array('book_id' => $comic->id, 'issue_id' => 1, 'artist_id_FK' => $artist_id, 'author_id_FK' => $author_id, 'summary' => Input::get('issue_summary'), 'published_date' => Input::get('published_date'), 'cover_image' => 'img/comic_covers/' . $fileName, 'created_at' => date('Y-m-d H:i:s', time())));
         $this->destorySession();
         return Redirect::to('browse')->with('postMsg', 'Thanks for submiting!');
     } else {
         return Redirect::to('content/series')->with('postMsg', 'Whoops! Looks like you got some errors.')->withErrors($validator);
     }
 }
Esempio n. 14
0
        echo number_format($Torrent['Leechers']);
        ?>
</td>
			</tr>
<?php 
    }
    $TorrentTable .= ob_get_clean();
    // Album art
    ob_start();
    $DisplayName = '';
    if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
        unset($ExtendedArtists[2]);
        unset($ExtendedArtists[3]);
        $DisplayName .= Artists::display_artists($ExtendedArtists, false);
    } elseif (count($GroupArtists) > 0) {
        $DisplayName .= Artists::display_artists(array('1' => $GroupArtists), false);
    }
    $DisplayName .= $GroupName;
    if ($GroupYear > 0) {
        $DisplayName = "{$DisplayName} [{$GroupYear}]";
    }
    $Tags = display_str($TorrentTags->format());
    $PlainTags = implode(', ', $TorrentTags->get_tags());
    ?>
				<li class="image_group_<?php 
    echo $GroupID;
    ?>
">
					<a href="torrents.php?id=<?php 
    echo $GroupID;
    ?>
Esempio n. 15
0
				<ul>
					<li><?php 
    echo Artists::display_artists($Artists[$OldGroupID], true, false);
    ?>
 - <a href="torrents.php?id=<?php 
    echo $OldGroupID;
    ?>
"><?php 
    echo $Name;
    ?>
</a></li>
				</ul>
				<h3>Into the group:</h3>
				<ul>
					<li><?php 
    echo Artists::display_artists($Artists[$GroupID], true, false);
    ?>
 - <a href="torrents.php?id=<?php 
    echo $GroupID;
    ?>
"><?php 
    echo $NewName;
    ?>
</a></li>
				</ul>
				<input type="submit" value="Confirm" />
			</form>
		</div>
	</div>
<?php 
    View::show_footer();
Esempio n. 16
0
authorize();
$UserID = $LoggedUser['ID'];
$GroupID = db_string($_POST['groupid']);
$Importances = $_POST['importance'];
$AliasNames = $_POST['aliasname'];
if (!is_number($GroupID) || !$GroupID) {
    error(0);
}
$DB->query("\n\tSELECT Name\n\tFROM torrents_group\n\tWHERE ID = {$GroupID}");
if (!$DB->has_results()) {
    error(404);
}
list($GroupName) = $DB->next_record(MYSQLI_NUM, false);
$Changed = false;
for ($i = 0; $i < count($AliasNames); $i++) {
    $AliasName = Artists::normalise_artist_name($AliasNames[$i]);
    $Importance = $Importances[$i];
    if ($Importance != '1' && $Importance != '2' && $Importance != '3' && $Importance != '4' && $Importance != '5' && $Importance != '6' && $Importance != '7') {
        break;
    }
    if (strlen($AliasName) > 0) {
        $DB->query("\n\t\t\tSELECT AliasID, ArtistID, Redirect, Name\n\t\t\tFROM artists_alias\n\t\t\tWHERE Name = '" . db_string($AliasName) . "'");
        while (list($AliasID, $ArtistID, $Redirect, $FoundAliasName) = $DB->next_record(MYSQLI_NUM, false)) {
            if (!strcasecmp($AliasName, $FoundAliasName)) {
                if ($Redirect) {
                    $AliasID = $Redirect;
                }
                break;
            }
        }
        if (!$AliasID) {
Esempio n. 17
0
					<?php 
            echo Artists::display_artist($Artist);
            ?>
				</li>
<?php 
        }
    }
    if (!empty($ArtistForm[7]) && count($ArtistForm[7]) > 0) {
        ?>
				<li class="artists_producer"><strong>Produced by:</strong></li>
<?php 
        foreach ($ArtistForm[7] as $Artist) {
            ?>
				<li class="artists_remix">
					<?php 
            echo Artists::display_artist($Artist);
            ?>
				</li>
<?php 
        }
    }
    ?>
			</ul>
		</div>
<?php 
}
?>
		<div class="box box_tags">
			<div class="head"><strong>Tags</strong></div>
			<ul class="stats nobullet">
<?php 
Esempio n. 18
0
    if ($FormatList && $FormatList != 'Any' && !Misc::search_joined_string($FormatList, $Format)) {
        $Err = "{$Format} is not an allowed format for this request.";
    }
    if ($MediaList && $MediaList != 'Any' && !Misc::search_joined_string($MediaList, $Media)) {
        $Err = "{$Media} is not allowed media for this request.";
    }
}
// Fill request
if (!empty($Err)) {
    error($Err);
}
//We're all good! Fill!
$DB->query("\n\tUPDATE requests\n\tSET FillerID = {$FillerID},\n\t\tTorrentID = {$TorrentID},\n\t\tTimeFilled = '" . sqltime() . "'\n\tWHERE ID = {$RequestID}");
if ($CategoryName === 'Music') {
    $ArtistForm = Requests::get_artists($RequestID);
    $ArtistName = Artists::display_artists($ArtistForm, false, true);
    $FullName = $ArtistName . $Title;
} else {
    $FullName = $Title;
}
$DB->query("\n\tSELECT UserID\n\tFROM requests_votes\n\tWHERE RequestID = {$RequestID}");
$UserIDs = $DB->to_array();
foreach ($UserIDs as $User) {
    list($VoterID) = $User;
    Misc::send_pm($VoterID, 0, "The request \"{$FullName}\" has been filled", 'One of your requests&#8202;&mdash;&#8202;[url=' . site_url() . "requests.php?action=view&amp;id={$RequestID}]{$FullName}" . '[/url]&#8202;&mdash;&#8202;has been filled. You can view it here: [url]' . site_url() . "torrents.php?torrentid={$TorrentID}" . '[/url]');
}
$RequestVotes = Requests::get_votes_array($RequestID);
Misc::write_log("Request {$RequestID} ({$FullName}) was filled by user {$FillerID} ({$FillerUsername}) with the torrent {$TorrentID} for a " . Format::get_size($RequestVotes['TotalBounty']) . ' bounty.');
// Give bounty
$DB->query("\n\tUPDATE users_main\n\tSET Uploaded = (Uploaded + " . $RequestVotes['TotalBounty'] . ")\n\tWHERE ID = {$FillerID}");
$Cache->delete_value("user_stats_{$FillerID}");
Esempio n. 19
0
$TorrentID = (int) $_GET['torrentid'];
$DB->query("\n\tSELECT last_action, LastReseedRequest, UserID, Time, GroupID\n\tFROM torrents\n\tWHERE ID = '{$TorrentID}'");
list($LastActive, $LastReseedRequest, $UploaderID, $UploadedTime, $GroupID) = $DB->next_record();
if (!check_perms('users_mod')) {
    if (time() - strtotime($LastReseedRequest) < 864000) {
        error('There was already a re-seed request for this torrent within the past 10 days.');
    }
    if ($LastActive == '0000-00-00 00:00:00' || time() - strtotime($LastActive) < 345678) {
        error(403);
    }
}
$DB->query("\n\tUPDATE torrents\n\tSET LastReseedRequest = NOW()\n\tWHERE ID = '{$TorrentID}'");
$Group = Torrents::get_groups(array($GroupID));
extract(Torrents::array_group($Group[$GroupID]));
$Name = Artists::display_artists(array('1' => $Artists), false, true);
$Name .= $GroupName;
$usersToNotify = array();
$DB->query("\n\tSELECT s.uid AS id, MAX(s.tstamp) AS tstamp\n\tFROM xbt_snatched as s\n\tINNER JOIN users_main as u\n\tON s.uid = u.ID\n\tWHERE s.fid = '{$TorrentID}'\n\tAND u.Enabled = '1'\n\tGROUP BY s.uid\n       ORDER BY tstamp DESC\n\tLIMIT 100");
if ($DB->has_results()) {
    $Users = $DB->to_array();
    foreach ($Users as $User) {
        $UserID = $User['id'];
        $TimeStamp = $User['tstamp'];
        $usersToNotify[$UserID] = array("snatched", $TimeStamp);
    }
}
$usersToNotify[$UploaderID] = array("uploaded", strtotime($UploadedTime));
foreach ($usersToNotify as $UserID => $info) {
    $Username = Users::user_info($UserID)['Username'];
    list($action, $TimeStamp) = $info;
Esempio n. 20
0
     }
     //foreach ($Top10 as $Torrent)
     // Send warnings to uploaders of torrents that will be deleted this week
     $DB->query("\n\t\t\tSELECT\n\t\t\t\tt.ID,\n\t\t\t\tt.GroupID,\n\t\t\t\ttg.Name,\n\t\t\t\tt.Format,\n\t\t\t\tt.Encoding,\n\t\t\t\tt.UserID\n\t\t\tFROM torrents AS t\n\t\t\t\tJOIN torrents_group AS tg ON tg.ID = t.GroupID\n\t\t\t\tJOIN users_info AS u ON u.UserID = t.UserID\n\t\t\tWHERE t.last_action < NOW() - INTERVAL 20 DAY\n\t\t\t\tAND t.last_action != 0\n\t\t\t\tAND u.UnseededAlerts = '1'\n\t\t\tORDER BY t.last_action ASC");
     $TorrentIDs = $DB->to_array();
     $TorrentAlerts = array();
     foreach ($TorrentIDs as $TorrentID) {
         list($ID, $GroupID, $Name, $Format, $Encoding, $UserID) = $TorrentID;
         if (array_key_exists($UserID, $InactivityExceptionsMade) && time() < $InactivityExceptionsMade[$UserID]) {
             // don't notify exceptions
             continue;
         }
         if (!array_key_exists($UserID, $TorrentAlerts)) {
             $TorrentAlerts[$UserID] = array('Count' => 0, 'Msg' => '');
         }
         $ArtistName = Artists::display_artists(Artists::get_artist($GroupID), false, false, false);
         if ($ArtistName) {
             $Name = "{$ArtistName} - {$Name}";
         }
         if ($Format && $Encoding) {
             $Name .= " [{$Format} / {$Encoding}]";
         }
         $TorrentAlerts[$UserID]['Msg'] .= "\n[url=" . site_url() . "torrents.php?torrentid={$ID}]" . $Name . "[/url]";
         $TorrentAlerts[$UserID]['Count']++;
     }
     foreach ($TorrentAlerts as $UserID => $MessageInfo) {
         Misc::send_pm($UserID, 0, 'Unseeded torrent notification', $MessageInfo['Count'] . " of your uploads will be deleted for inactivity soon. Unseeded torrents are deleted after 4 weeks. If you still have the files, you can seed your uploads by ensuring the torrents are in your client and that they aren't stopped. You can view the time that a torrent has been unseeded by clicking on the torrent description line and looking for the \"Last active\" time. For more information, please go [url=" . site_url() . "wiki.php?action=article&amp;id=663]here[/url].\n\nThe following torrent" . ($MessageInfo['Count'] > 1 ? 's' : '') . ' will be removed for inactivity:' . $MessageInfo['Msg'] . "\n\nIf you no longer wish to receive these notifications, please disable them in your profile settings.");
     }
 }
 $DB->query("\n\t\tUPDATE staff_pm_conversations\n\t\tSET Status = 'Resolved', ResolverID = '0'\n\t\tWHERE Date < NOW() - INTERVAL 1 MONTH\n\t\t\tAND Status = 'Open'\n\t\t\tAND AssignedToUser IS NULL");
 Donations::schedule();
Esempio n. 21
0
						<td>
							<strong>Added</strong>
						</td>
					</tr>
<?php 
        $Row = 'a';
        $Requests = Requests::get_requests(array_keys($SphRequests));
        foreach ($SphRequests as $RequestID => $SphRequest) {
            $Request = $Requests[$RequestID];
            $VotesCount = $SphRequest['votes'];
            $Bounty = $SphRequest['bounty'] * 1024;
            // Sphinx stores bounty in kB
            $CategoryName = $Categories[$Request['CategoryID'] - 1];
            if ($CategoryName == 'Music') {
                $ArtistForm = Requests::get_artists($RequestID);
                $ArtistLink = Artists::display_artists($ArtistForm, true, true);
                $FullName = "{$ArtistLink}<a href=\"requests.php?action=view&amp;id={$RequestID}\">{$Request['Title']} [{$Request['Year']}]</a>";
            } elseif ($CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') {
                $FullName = "<a href=\"requests.php?action=view&amp;id={$RequestID}\">{$Request['Title']} [{$Request['Year']}]</a>";
            } else {
                $FullName = "<a href=\"requests.php?action=view&amp;id={$RequestID}\">{$Request['Title']}</a>";
            }
            ?>
					<tr class="row<?php 
            echo $Row === 'b' ? 'a' : 'b';
            ?>
">
						<td>
							<?php 
            echo $FullName;
            ?>
Esempio n. 22
0
         $TotalSnatched += $T['Snatched'];
     }
 } else {
     $Torrents = array($Result['id'] => $GroupInfo['Torrents'][$Result['id']]);
 }
 $TagList = explode(' ', str_replace('_', '.', $GroupInfo['TagList']));
 $JsonArtists = array();
 if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
     unset($ExtendedArtists[2]);
     unset($ExtendedArtists[3]);
     $DisplayName = Artists::display_artists($ExtendedArtists, false, false, true);
     foreach ($ExtendedArtists[1] as $Artist) {
         $JsonArtists[] = array('id' => (int) $Artist['id'], 'name' => $Artist['name'], 'aliasid' => (int) $Artist['id']);
     }
 } elseif (!empty($Artists)) {
     $DisplayName = Artists::display_artists(array(1 => $Artists), false, false, true);
     foreach ($Artists as $Artist) {
         $JsonArtists[] = array('id' => (int) $Artist['id'], 'name' => $Artist['name'], 'aliasid' => (int) $Artist['id']);
     }
 } else {
     $DisplayName = '';
 }
 if ($GroupResults && (count($Torrents) > 1 || isset($GroupedCategories[$CategoryID - 1]))) {
     // These torrents are in a group
     $LastRemasterYear = '-';
     $LastRemasterTitle = '';
     $LastRemasterRecordLabel = '';
     $LastRemasterCatalogueNumber = '';
     $LastMedia = '';
     $EditionID = 0;
     unset($FirstUnknown);
Esempio n. 23
0
                ?>
&amp;importance=3'); this.parentNode.parentNode.style.display = 'none';" class="brackets tooltip" title="Remove artist">X</a></span>
<?php 
            }
            ?>
				</li>
<?php 
        }
    }
    if (!empty($Artists[7]) && count($Artists[7]) > 0) {
        print '				<li class="artists_producer"><strong class="artists_label">Produced by:</strong></li>';
        foreach ($Artists[7] as $Artist) {
            ?>
				<li class="artists_producer">
					<?php 
            echo Artists::display_artist($Artist) . ' &lrm;';
            if (check_perms('torrents_edit')) {
                $DB->query("\n\t\t\t\t\tSELECT AliasID\n\t\t\t\t\tFROM artists_alias\n\t\t\t\t\tWHERE ArtistID = " . $Artist['id'] . "\n\t\t\t\t\t\tAND ArtistID != AliasID\n\t\t\t\t\t\tAND Name = '" . db_string($Artist['name']) . "'");
                list($AliasID) = $DB->next_record();
                if (empty($AliasID)) {
                    $AliasID = $Artist['id'];
                }
                ?>
				(<span class="tooltip" title="Artist alias ID"><?php 
                echo $AliasID;
                ?>
</span>)&nbsp;
					<span class="remove remove_artist"><a href="javascript:void(0);" onclick="ajax.get('torrents.php?action=delete_alias&amp;auth=' + authkey + '&amp;groupid=<?php 
                echo $GroupID;
                ?>
&amp;artistid=<?php 
Esempio n. 24
0
        $Artists = Artists::get_artists($GroupIDs);
        $Number = 0;
        foreach ($GroupIDs as $GroupID) {
            if (!isset($TorrentList[$GroupID])) {
                continue;
            }
            $Group = $TorrentList[$GroupID];
            extract(Torrents::array_group($Group));
            $DisplayName = '';
            $TorrentTags = new Tags($TagList);
            if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
                unset($ExtendedArtists[2]);
                unset($ExtendedArtists[3]);
                $DisplayName .= Artists::display_artists($ExtendedArtists);
            } elseif (count($Artists) > 0) {
                $DisplayName .= Artists::display_artists(array('1' => $Artists));
            }
            $DisplayName .= "<a href=\"torrents.php?id={$GroupID}\" class=\"tooltip\" title=\"View torrent group\" dir=\"ltr\">{$GroupName}</a>";
            if ($GroupYear > 0) {
                $DisplayName = "{$DisplayName} [{$GroupYear}]";
            }
            if ($GroupVanityHouse) {
                $DisplayName .= ' [<abbr class="tooltip" title="This is a Vanity House release">VH</abbr>]';
            }
            $SnatchedGroupClass = $GroupFlags['IsSnatched'] ? ' snatched_group' : '';
            // Start an output buffer, so we can store this output in $TorrentTable
            ob_start();
            if (count($Torrents) > 1 || $GroupCategoryID == 1) {
                ?>
			<tr class="group discog<?php 
                echo $SnatchedGroupClass;
Esempio n. 25
0
<?php

// Get an existing artist
$artist = Artists::findFirst('name = "Shinichi Osawa"');
// Create an album
$album = new Albums();
$album->name = 'The One';
$album->artist = $artist;
$songs = array();
// Create a first song
$songs[0] = new Songs();
$songs[0]->name = 'Star Guitar';
$songs[0]->duration = '5:54';
// Create a second song
$songs[1] = new Songs();
$songs[1]->name = 'Last Days';
$songs[1]->duration = '4:29';
// Assign the songs array
$album->songs = $songs;
// Save the album + its songs
$album->save();
Esempio n. 26
0
 public function getAdmin()
 {
     //Get info
     $data['users'] = User::paginate(5);
     $data['recent_books'] = Comicbooks::select('book_name', 'updated_at')->orderBy('updated_at', 'desc')->paginate(3);
     $data['user_count'] = User::where('id', '>', 0)->count();
     $data['publisher_count'] = Publishers::where('id', '>', 0)->count();
     $data['books_count'] = Comicbooks::where('id', '>', 0)->count();
     $data['issue_count'] = Comicissues::where('issue_id', '>', 0)->where('book_id', '>', 0)->count();
     $data['artist_count'] = Artists::count();
     $data['author_count'] = Authors::count();
     $data['books_created'] = Comicbooks::select(DB::raw('count(*) as count'), 'created_at')->groupby(DB::raw('date_format(created_at, "%b %Y")'))->orderby('created_at', 'asc')->get();
     $data['issues_created'] = Comicissues::select(DB::raw('count(*) as count'), 'created_at')->groupby(DB::raw('date_format(created_at, "%b %Y")'))->orderby('created_at', 'asc')->get();
     //Check if there are any comicbook series
     if (count($data['books_created']) > 0) {
         //Get the count of books per the month/year then return the json encoded string
         foreach ($data['books_created'] as $created) {
             $created_books[] = $created->count;
             $created_books_date[] = date_format($created->created_at, "M Y");
         }
         $data['created_books'] = json_encode($created_books);
     }
     //Check if there are any comicbook issue
     if (count($data['issues_created']) > 0) {
         //Get the count of issues per the month/year then return the json encoded string
         foreach ($data['issues_created'] as $created) {
             $created_issues[] = $created->count;
             $created_issues_date[] = date_format($created->created_at, "M Y");
         }
         $data['created_issues'] = json_encode($created_issues);
     }
     //Merge dates from comicbook series and issues created then return the json encoded string
     $data['created_dates'] = json_encode(array_unique(array_merge($created_issues_date, $created_books_date)));
     $this->layout->content = View::make('admin.index', $data);
 }
Esempio n. 27
0
 /**
  * Return the display string for a given torrent group $GroupID.
  * @param int $GroupID
  * @return string
  */
 public static function display_string($GroupID, $Mode = self::DISPLAYSTRING_DEFAULT)
 {
     global $ReleaseTypes;
     // I hate this
     $GroupInfo = self::get_groups(array($GroupID), true, true, false)[$GroupID];
     $ExtendedArtists = $GroupInfo['ExtendedArtists'];
     if ($Mode & self::DISPLAYSTRING_ARTISTS) {
         if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
             unset($ExtendedArtists[2], $ExtendedArtists[3]);
             $DisplayName = Artists::display_artists($ExtendedArtists, $Mode & self::DISPLAYSTRING_LINKED);
         } else {
             $DisplayName = '';
         }
     }
     if ($Mode & self::DISPLAYSTRING_LINKED) {
         $DisplayName .= "<a href=\"torrents.php?id={$GroupID}\" class=\"tooltip\" title=\"View torrent group\" dir=\"ltr\">{$GroupInfo['Name']}</a>";
     } else {
         $DisplayName .= $GroupInfo['Name'];
     }
     if ($Mode & self::DISPLAYSTRING_YEAR && $GroupInfo['Year'] > 0) {
         $DisplayName .= " [{$GroupInfo['Year']}]";
     }
     if ($Mode & self::DISPLAYSTRING_VH && $GroupInfo['VanityHouse']) {
         if ($Mode & self::DISPLAYSTRING_HTML) {
             $DisplayName .= ' [<abbr class="tooltip" title="This is a Vanity House release">VH</abbr>]';
         } else {
             $DisplayName .= ' [VH]';
         }
     }
     if ($Mode & self::DISPLAYSTRING_RELEASETYPE && $GroupInfo['ReleaseType'] > 0) {
         $DisplayName .= ' [' . $ReleaseTypes[$GroupInfo['ReleaseType']] . ']';
     }
     return $DisplayName;
 }
Esempio n. 28
0
    $DB->query("\n\t\tSELECT 1\n\t\tFROM users_downloads\n\t\tWHERE UserID = {$UserID}\n\t\t\tAND TorrentID = {$TorrentID}\n\t\tLIMIT 4");
    if ($DB->record_count() === 4) {
        error('You have already downloaded this torrent file four times. If you need to download it again, please do so from your browser.', true);
        die;
    }
}
$Info = $Cache->get_value('torrent_download_' . $TorrentID);
if (!is_array($Info) || !array_key_exists('PlainArtists', $Info) || empty($Info[10])) {
    $DB->query("\n\t\tSELECT\n\t\t\tt.Media,\n\t\t\tt.Format,\n\t\t\tt.Encoding,\n\t\t\tIF(t.RemasterYear = 0, tg.Year, t.RemasterYear),\n\t\t\ttg.ID AS GroupID,\n\t\t\ttg.Name,\n\t\t\ttg.WikiImage,\n\t\t\ttg.CategoryID,\n\t\t\tt.Size,\n\t\t\tt.FreeTorrent,\n\t\t\tt.info_hash\n\t\tFROM torrents AS t\n\t\t\tINNER JOIN torrents_group AS tg ON tg.ID = t.GroupID\n\t\tWHERE t.ID = '" . db_string($TorrentID) . "'");
    if (!$DB->has_results()) {
        error(404);
    }
    $Info = array($DB->next_record(MYSQLI_NUM, array(4, 5, 6, 10)));
    $Artists = Artists::get_artist($Info[0][4], false);
    $Info['Artists'] = Artists::display_artists($Artists, false, true);
    $Info['PlainArtists'] = Artists::display_artists($Artists, false, true, false);
    $Cache->cache_value("torrent_download_{$TorrentID}", $Info, 0);
}
if (!is_array($Info[0])) {
    error(404);
}
list($Media, $Format, $Encoding, $Year, $GroupID, $Name, $Image, $CategoryID, $Size, $FreeTorrent, $InfoHash) = array_shift($Info);
// used for generating the filename
$Artists = $Info['Artists'];
// If he's trying use a token on this, we need to make sure he has one,
// deduct it, add this to the FLs table, and update his cache key.
if ($_REQUEST['usetoken'] && $FreeTorrent == '0') {
    if (isset($LoggedUser)) {
        $FLTokens = $LoggedUser['FLTokens'];
        if ($LoggedUser['CanLeech'] != '1') {
            error('You cannot use tokens while leech disabled.');
Esempio n. 29
0
            // No vanity.house tag.
            $Tags = explode(' ', str_replace('_', '.', $TagList));
            $TagLinks = array();
            foreach ($Tags as $Tag) {
                if ($Tag == 'vanity.house') {
                    continue;
                }
                $TagLinks[] = "<a href=\"torrents.php?action=basic&amp;taglist={$Tag}\">{$Tag}</a> ";
            }
            $TagStr = "<br />\n<div class=\"tags\">" . implode(', ', $TagLinks) . '</div>';
        }
        ?>
			<tr>
				<td>
					<?php 
        echo Artists::display_artists($Recommend_artists[$GroupID]);
        ?>
					<a href="torrents.php?id=<?php 
        echo $GroupID;
        ?>
"><?php 
        echo $GroupName;
        ?>
</a> (by <?php 
        echo Users::format_username($UserID, false, false, false);
        ?>
)
					<?php 
        echo $TagStr;
        ?>
				</td>
Esempio n. 30
0
            if ($CategoryName == 'Music') {
                $Links .= Artists::display_artists(Requests::get_artists($Result['PageID'])) . '<a href="requests.php?action=view&amp;id=' . $Result['PageID'] . '" dir="ltr">' . $Request['Title'] . " [" . $Request['Year'] . "]</a>";
            } elseif ($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
                $Links .= '<a href="requests.php?action=view&amp;id=' . $Result['PageID'] . '" dir="ltr">' . $Request['Title'] . " [" . $Request['Year'] . "]</a>";
            } else {
                $Links .= '<a href="requests.php?action=view&amp;id=' . $Result['PageID'] . '">' . $Request['Title'] . "</a>";
            }
            $JumpLink = 'requests.php?action=view&amp;id=' . $Result['PageID'] . '&amp;postid=' . $Result['PostID'] . '#post' . $Result['PostID'];
            break;
        case 'torrents':
            if (!isset($TorrentGroups[$Result['PageID']])) {
                // Deleted or moved torrent group
                continue 2;
            }
            $GroupInfo = $TorrentGroups[$Result['PageID']];
            $Links = 'Torrent: ' . Artists::display_artists($GroupInfo['ExtendedArtists']) . '<a href="torrents.php?id=' . $GroupInfo['ID'] . '" dir="ltr">' . $GroupInfo['Name'] . '</a>';
            if ($GroupInfo['Year'] > 0) {
                $Links .= " [" . $GroupInfo['Year'] . "]";
            }
            if ($GroupInfo['ReleaseType'] > 0) {
                $Links .= " [" . $ReleaseTypes[$GroupInfo['ReleaseType']] . "]";
            }
            $JumpLink = 'torrents.php?id=' . $GroupInfo['ID'] . '&postid=' . $Result['PostID'] . '#post' . $Result['PostID'];
            break;
        default:
            continue 2;
    }
    ?>
	<table class="forum_post box vertical_margin noavatar">
		<tr class="colhead_dark notify_<?php 
    echo $Result['Page'];