コード例 #1
0
ファイル: avatar-upload.php プロジェクト: kgrayjr/ezleague
<?php

session_start();
include '../class-db.php';
include '../objects/class-user.php';
$ez_user = new ezLeague_User();
if (isset($_SESSION['ez_username'])) {
    $profile = $ez_user->get_user($_SESSION['ez_username']);
    $rand = rand('100', '5000');
    $now = strtotime('now');
    $new_file = $now . '-' . $rand;
    $allowedExts = array("jpg", "png", "gif", "bmp", "jpeg", "PNG", "JPG", "JPEG", "GIF", "BMP");
    $temp = explode(".", $_FILES["file"]["name"]);
    $extension = end($temp);
    if (($_FILES["file"]["type"] == "image/gif" || $_FILES["file"]["type"] == "image/jpeg" || $_FILES["file"]["type"] == "image/jpg" || $_FILES["file"]["type"] == "image/pjpeg" || $_FILES["file"]["type"] == "image/x-png" || $_FILES["file"]["type"] == "image/png") && $_FILES["file"]["size"] < 1000000 && in_array($extension, $allowedExts)) {
        if ($_FILES["file"]["error"] > 0) {
            echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
        } else {
            if (file_exists("../../avatars/" . $now . "-" . $_FILES["file"]["name"])) {
                echo $now . "-" . $_FILES["file"]["name"] . " already exists. ";
            } else {
                move_uploaded_file($_FILES["file"]["tmp_name"], "../../avatars/" . $now . "-" . $_FILES["file"]["name"]);
                $filename = $now . "-" . $_FILES["file"]["name"];
                $ez_user->update_avatar($filename, $profile['id']);
                header('Location: ' . $_POST['from']);
            }
        }
    } else {
        echo "Invalid file";
    }
} else {
コード例 #2
0
ファイル: header.php プロジェクト: kgrayjr/ezleague
session_start();
define('EZL_VERSION', '3.5.9');
include 'lib/class-db.php';
include 'lib/class-ezleague.php';
$ez = new ezLeague();
$ez->setup_ezleague();
$ez->test_connection();
$ez_frontend = new ezLeague_Frontend();
$site_settings = $ez_frontend->get_site_settings();
if (!empty($site_settings['timezone'])) {
    date_default_timezone_set('' . $site_settings['timezone'] . '');
} else {
    date_default_timezone_set('UTC');
}
$ez_news = new ezLeague_News();
$ez_users = new ezLeague_User();
$ez_team = new ezLeague_Team();
$ez_league = new ezLeague_League();
$ez_inbox = new ezLeague_Inbox();
$ez_schedule = new ezLeague_Schedule();
$ez_tournament = new ezLeague_Tournament();
if (isset($_SESSION['ez_username'])) {
    $profile = $ez_users->get_user($_SESSION['ez_username']);
}
$site_settings = $ez_frontend->get_site_settings();
$social_networks = $ez_frontend->get_social_networks();
if ($site_settings['handle'] != '') {
    require_once dirname(__FILE__) . '/lib/codebird.php';
    \Codebird\Codebird::setConsumerKey('' . $site_settings['api'] . '', '' . $site_settings['secret'] . '');
    $cb = \Codebird\Codebird::getInstance();
    $cb->setToken('' . $site_settings['token'] . '', '' . $site_settings['token_secret'] . '');
コード例 #3
0
ファイル: submit-user.php プロジェクト: kgrayjr/ezleague
<?php

session_start();
include '../class-db.php';
include '../objects/class-user.php';
$ez_user = new ezLeague_User();
if (isset($_POST['form'])) {
    $form = $_POST['form'];
    switch ($form) {
        case 'update-profile':
            $first_name = $_POST['first'];
            $last_name = $_POST['last'];
            $email = $_POST['email'];
            $website = $_POST['website'];
            $bio = $_POST['bio'];
            $hobbies = $_POST['hobbies'];
            $location = $_POST['from'];
            $occupation = $_POST['occupation'];
            $signature = htmlspecialchars($_POST['signature'], ENT_QUOTES);
            $user_id = $_POST['id'];
            $ez_user->update_profile($first_name, $last_name, $email, $website, $bio, $hobbies, $location, $occupation, $signature, $user_id);
            break;
        case 'update-password':
            $password = $_POST['password'];
            $user_id = $_POST['id'];
            $ez_user->update_password($password, $user_id);
            break;
        case 'forgot-password':
            $username = $_POST['username'];
            $email = $_POST['email'];
            $ez_user->forgot_password($username, $email);
コード例 #4
0
ファイル: submit.php プロジェクト: kgrayjr/ezleague
<?php

session_start();
include 'lib/class-db.php';
include 'lib/objects/class-user.php';
include 'lib/class-frontend.php';
$ez_user = new ezLeague_User();
$ez_frontend = new ezLeague_Frontend();
if (isset($_POST['form'])) {
    $form = $_POST['form'];
    switch ($form) {
        /*
         * LOGIN, REGISTRATION & INSTALLATION
         */
        case 'login':
            $username = $_POST['username'];
            $password = $_POST['password'];
            $ez_user->login($username, $password);
            break;
        case 'register':
            $username = $_POST['username'];
            $password = $_POST['password'];
            $confirm = $_POST['confirm'];
            $email = $_POST['email'];
            $ez_user->register($username, $password, $email);
            break;
        case 'reset_password':
            $email = $_POST['email'];
            $ez->resetPassword($email);
            break;
        case 'new_password':