<?PHP
/*
 * T-Rex is Lonely: A web comic?
 * This code is not intended for general consumption, but is available if you
 * want it.
 *
 * Copyright (C) 2009 Gregor Richards
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

require_once("lib/db.php");
require_once(
"lib/src.php");
if (!isset(
$private)) $private false;

?>
<!doctype html>
<html>
<head>
<title>T-Rex is Lonely Comics</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="StyleSheet" href="trilc.css" type="text/css"/>
</head>
<body>
    <p>
        <span class="header">T-Rex is Lonely</span><br/>
        Contributors
    </p>

    <div class="main">
        <p class="notice"><a href="/">Back</a></p>

        <p>
        <?PHP
        $base 
dirname($_SERVER["PHP_SELF"]);
        if (
$base == "/"$base "";
        
openDB();
        
$sql "SELECT creator, COUNT(id) AS count FROM comics" .
            (
$private "" " WHERE postdate <= " time()) .
            
" GROUP BY creator" .
            
" ORDER BY count DESC, creator ASC;";
        
$result $db->query($sql);
        
$curtime time();
        if (
$result !== false) {
            while ((
$row $result->fetchArray(SQLITE3_ASSOC)) !== false) {
                print 
"<a href='$base/archives.php?creator=" urlencode($row["creator"]) . "' style='font-weight: bold'>" .
                      
htmlentities($row["creator"], ENT_COMPAT"UTF-8") .
                      
"</a> (" $row["count"] . ")<br/>";
            }
            
$result->finalize();
        }
        
closeDB();
        
?>
        </p>

        <p>
            Want to contribute? Talk to
            <a href="mailto:Richards@codu.org?subject=T-Rex%20is%20Lonely%20contribution">Gregor Richards</a>
            with a link to the
            <a href="http://codu.org/weird/dinosaurComicMunger.xhtml">munged comic</a>,
            a title, mouseover text, and the name you prefer to contribute
            under (can be a pseudonym). If he finds it hilarious, he may just
            queue it up! You don't have to use the comic munger linked here to
            make it, but if you don't, please include the original comic numbers
            that each frame came from; this site generates its comics
            automatically, so while an attached image is a good reference for
            laffs, it doesn't actually help Gregor to post the comic.
        </p>

        <?PHP srcLink(); ?>
    </div>
</body>
</html>