Exemplo n.º 1
0
function generate_ini($server_cfg)
{
    global $ip;
    $game = get_game();
    $game_cfg = load_game_config($game);
    if ($game == null or empty($game_cfg) or !in_array($game, $server_cfg["auto_ini_games"]) or !ip_in_candidates($ip, $server_cfg, $game)) {
        send_fail("ini generation criteria not satisfied");
        return;
    }
    $ini_file_path = sprintf($server_cfg['ini_file_path'], $game);
    $ini = file_get_contents($ini_file_path);
    if (empty($ini)) {
        send_fail("Could not read ini file at {$ini_file_path}");
        return;
    }
    $md5_digest = md5($ini);
    $ini_header = sprintf(INI_HEADER_TEMPLATE, $md5_digest);
    send_ini($ini_header, $ini);
}
Exemplo n.º 2
0
$mail_server = UPLOAD_MAIL_SERVER;
$username = UPLOAD_MAIL_USER;
$password = UPLOAD_MAIL_PASSWORD;
$mail_image = new MailImage($mail_server, $username, $password);
$mail_image->fetch(true);
foreach ($mail_image->messages as $message) {
    //make a new uplaod key
    $upload_key = md5(uniqid(rand(), true));
    //get the various bits and bobs out of the message
    $postcode = $message['postcode'];
    $file_type = $message['file_type'];
    $images = $message['images'];
    $from_name = $message['from_name'];
    $from_email = $message['from_email'];
    if (count($images) <= 0) {
        send_fail($from_email);
    } else {
        foreach ($images as $image) {
            //create a new item in the uplaod que
            $image_que = factory::create('image_que');
            $image_que->upload_key = $upload_key;
            $image_que->image_key = md5(uniqid(rand(), true));
            $image_que->name = $from_name;
            $image_que->email = $from_email;
            //save the images to disc in temp folder, then trigger the resize and save the image que item
            $temp_file = TEMP_DIR . '/' . md5(uniqid(rand(), true));
            if ($file_type == 'gif') {
                imagepng($image, $temp_file, 100);
            } else {
                imagejpeg($image, $temp_file, 100);
            }