コード例 #1
0
ファイル: logo-upload.php プロジェクト: kgrayjr/ezleague
session_start();
include '../class-db.php';
include '../objects/class-settings.php';
$ez_settings = new ezAdmin_Settings();
if (isset($_SESSION['ez_admin'])) {
    $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("../../../logos/" . $now . "-" . $_FILES["file"]["name"])) {
                echo $now . "-" . $_FILES["file"]["name"] . " already exists. ";
            } else {
                move_uploaded_file($_FILES["file"]["tmp_name"], "../../../logos/" . $now . "-" . $_FILES["file"]["name"]);
                $filename = $now . "-" . $_FILES["file"]["name"];
                $ez_settings->update_site_settings('logo', $filename);
                header('Location: ../../settings.php?page=site ');
            }
        }
    } else {
        echo "Invalid file";
    }
} else {
    echo "admins only.";
}
コード例 #2
0
ファイル: submit-settings.php プロジェクト: kgrayjr/ezleague
 case 'update-twitter':
     $twitter = $_POST['twitter'];
     $ez_settings->update_social_network('twitter', $twitter);
     break;
 case 'update-youtube':
     $youtube = $_POST['youtube'];
     $ez_settings->update_social_network('youtube', $youtube);
     break;
 case 'update-google':
     $google = $_POST['google'];
     $ez_settings->update_social_network('google', $google);
     break;
 case 'update-settings':
     $setting = $_POST['setting'];
     $value = $_POST['value'];
     $ez_settings->update_site_settings($setting, $value);
     break;
 case 'delete-admin':
     $user_id = $_POST['user_id'];
     $ez_settings->delete_admin($user_id);
     break;
 case 'update-twitter-app':
     $count = $_POST['count'];
     $handle = $_POST['handle'];
     $api = $_POST['api'];
     $secret = $_POST['secret'];
     $token = $_POST['token'];
     $token_secret = $_POST['token_secret'];
     $ez_settings->update_twitter_app_settings($count, $handle, $api, $secret, $token, $token_secret);
     break;
 case 'update-mandrill':
コード例 #3
0
ファイル: fav-icon-upload.php プロジェクト: kgrayjr/ezleague
session_start();
include '../class-db.php';
include '../objects/class-settings.php';
$ez_settings = new ezAdmin_Settings();
if (isset($_SESSION['ez_admin'])) {
    $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("../../../logos/" . $now . "-" . $_FILES["file"]["name"])) {
                echo $now . "-" . $_FILES["file"]["name"] . " already exists. ";
            } else {
                move_uploaded_file($_FILES["file"]["tmp_name"], "../../../logos/" . $now . "-" . $_FILES["file"]["name"]);
                $filename = $now . "-" . $_FILES["file"]["name"];
                $ez_settings->update_site_settings('fav_icon', $filename);
                header('Location: ../../settings.php?page=site ');
            }
        }
    } else {
        echo "Invalid file";
    }
} else {
    echo "admins only.";
}