Esempio n. 1
0
function getList($name, $db, $mail)
{
    $t = loadLists($db, "");
    foreach ($t["list"] as $list) {
        if (strcasecmp($list["name"], $name) == 0) {
            return $list["id"];
        }
    }
    $newList = addList($db, $name);
    if (!$newList['total'] || $newList['total'] < 1) {
        err("error creating new list.", $mail);
    }
    return $newList['list'][0]['id'];
}
function showResults()
{
    #----------------------------------------------------------------------
    #--- Output the page header.
    echo "<h1>Fun Statistics</h1>\n\n<br>";
    echo "<p style='padding-left:20px;padding-right:20px;font-weight:bold'>Here you see a selection of fun statistics, based on official WCA competition results.</p>";
    echo "<p style='padding-left:20px;padding-right:20px;font-weight:bold'>There are also three separate statistics pages: <a href='misc/evolution/'>Evolution of Records</a>, <a href='misc/sum_of_ranks/'>Sum of Ranks</a>, and <a href='misc/missing_averages/'>Missing Averages</a>.</p>";
    echo "<p style='padding-left:20px;padding-right:20px;color:gray;font-size:10px'>Generated on " . wcaDate() . ".</p>";
    #--- Get all the list definitions.
    defineAllLists();
    global $lists;
    #--- Output the links to the individual lists.
    echo "<ul style='padding-left:20px'>\n";
    foreach ($lists as $list) {
        echo "<li style='padding-bottom:5px'><a style='color:#33C;font-weight:normal' href='#{$list['0']}'>{$list['1']}</a></li>\n";
    }
    echo "</ul>\n\n";
    #--- Output the lists.
    $ctr = 0;
    foreach ($lists as $list) {
        addList($list, ++$ctr);
    }
}
function showResults () {
#----------------------------------------------------------------------
  
  #--- Output the page header.
  echo "<h1>Fun Statistics</h1>\n\n";
  echo "<p style='padding-left:20px;padding-right:20px;font-weight:bold'>Here you see a selection of fun statistics, based on official WCA competition results.</p>";
  echo "<p style='padding-left:20px;padding-right:20px;color:gray;font-size:10px'>Generated on " . wcaDate() . ".</p>";

  #--- Get all the list definitions.
  defineAllLists();
  global $lists;

  #--- Output the links to the individual lists.  
  echo "<ul style='padding-left:20px'>\n";
  foreach( $lists as $list )
    echo "<li style='padding-bottom:5px'><a style='color:#33C;font-weight:normal' href='#$list[0]'>$list[1]</a></li>\n";
  echo "</ul>\n\n";

  #--- Output the lists.
  $ctr = 0;
  foreach( $lists as $list )
    addList( $list, ++$ctr );
}
Esempio n. 4
0
<?php

require '../core/sessions.php';
require '../core/functions.php';
getGetVar();
require_once '../core/db.php';
startSession();
getPersonalList($id);
getUserToken($id);
if ($_COOKIE['online'] == $id) {
    if (isset($_POST['list_name_submit']) && !empty($_POST['list_name_submit'])) {
        if (empty($_POST['list_name'])) {
            $_SESSION['temp_msg'] = 'Please enter a list name';
            header('Location: ../edit-list.php?id=' . $id . '&success=false');
            exit;
        }
        $listName = $_POST['list_name'];
        addList($userID, $listName);
        $_SESSION['temp_msg'] = $listAdded_success;
        header('Location: ../edit-list.php?id=' . $id . '&success=true');
        exit;
    }
}
?>

Esempio n. 5
0
<?php

/** Use this file to add another list into the database. 
	The given filename is assumed to be in the correct order
	$listname should be the organzation that produced the list
	such as afi, or imdb **/
require_once "scrape.php";
require_once "addict_database.php";
$ad = new AddictDatabase();
$afi100 = readList("lists/afi_ids.txt");
addList($afi100);
function addList($list)
{
    global $ad;
    $current = $ad->getMovies();
    $ad->resetAFIRank();
    foreach ($list as $movie) {
        if (in_array($movie['id'], array_keys($current))) {
            $ad->updateAFIRank($movie['id'], $movie['rank']);
            echo "Updated " . $movie['id'] . " to #" . $movie['rank'] . "<br>";
        } else {
            $ad->addMovie($movie['id'], $movie['title'], NULL, $movie['rank']);
            echo "Added " . $movie['id'] . " as #" . $movie['rank'] . "<br>";
        }
    }
}
function readList($filename)
{
    $fp = fopen($filename, "r");
    $movies = array();
    $count = 1;
Esempio n. 6
0
<?php

header('Content-Type: text/xml; charset=utf-8');
require_once "../includes/session.php";
require_once "../includes/functions.php";
require_once "../includes/connect.php";
if (isset($_GET['item'])) {
    addList();
} else {
    if (isset($_GET['delete'])) {
        deleteList();
        showList();
    } else {
        showList();
    }
}
function addList()
{
    global $connection;
    $day = $_GET['day'];
    $sql = "SELECT id, name FROM food WHERE id IN (" . $_GET['item'] . ")";
    $result_set = mysql_query($sql, $connection);
    confirm_query($result_set);
    if (mysql_num_rows($result_set) >= 1) {
        echo "<foods>";
        while ($foods = mysql_fetch_array($result_set)) {
            $sql = "INSERT INTO food_day (food_id, date) VALUES(" . $foods['id'] . ", '" . get_date_of_day($day) . "')";
            $results = mysql_query($sql, $connection);
            confirm_query($results);
            echo "<food id='" . mysql_insert_id($connection) . "'>" . $foods['name'] . "</food>";
        }
Esempio n. 7
0
<?php

require_once 'config.php';
require_once 'functions.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (!empty($_POST['list_title']) and !empty($_POST['list_paragraph'])) {
        addList($_POST['list_title'], $_POST['list_paragraph'], $conn);
    }
}
Esempio n. 8
0
    $qmin = min($ac);
    if ($count >= 10) {
        $grades = 10;
    } else {
        $grades = $count;
    }
    $step = ($qmax - $qmin) / $grades;
    foreach ($at as $i => $tag) {
        $t['cloud'][] = array('tag' => htmlarray($tag['name']), 'id' => (int) $tag['id'], 'w' => tag_size($qmin, $ac[$i], $step));
    }
    $t['total'] = $count;
    jsonExit($t);
} elseif (isset($_GET['addList'])) {
    check_write_access();
    stop_gpc($_POST);
    $t = addList($db, _post('name'));
    jsonExit($t);
} elseif (isset($_GET['renameList'])) {
    check_write_access();
    stop_gpc($_POST);
    $t = array();
    $t['total'] = 0;
    $id = (int) _post('list');
    $name = str_replace(array('"', "'", '<', '>', '&'), array('', '', '', '', ''), trim(_post('name')));
    $db->dq("UPDATE {$db->prefix}lists SET name=?,d_edited=? WHERE id={$id}", array($name, time()));
    $t['total'] = $db->affected();
    $r = $db->sqa("SELECT * FROM {$db->prefix}lists WHERE id={$id}");
    $t['list'][] = prepareList($r);
    jsonExit($t);
} elseif (isset($_GET['deleteList'])) {
    check_write_access();