Example #1
0
function getlicheck() {
	$fileid = check_arg("fileid", "integer", $_REQUEST);
	handle_errors();
	
	$upload = core_getupload($fileid);
	
	if(array_key_exists("type", $_REQUEST)) {
		if($upload->type() != $_REQUEST["type"]) {
			exit;
		}
	}
	return $upload;
}
Example #2
0
function process_login_form($smarty)
{
    global $Link;
    $errors = array();
    global $username;
    global $password;
    $Query = 'SELECT * FROM ' . USER . ' WHERE eMail = "' . $username . '" AND password = "******" AND accessLevel > 0';
    $Results = mysql_query($Query, $Link) or die("sp_clubs (Line " . __LINE__ . "): " . mysql_errno() . ": " . mysql_error());
    $num_rows = mysql_num_rows($Results);
    if ($num_rows == 1 && ($row = mysql_fetch_array($Results))) {
        // OK to Enter;
        // set userdata;
        $_SESSION['logged_in'] = true;
        $_SESSION['userid'] = $row['userID'];
        $_SESSION['playerid'] = $row['playerId'];
        $_SESSION['username'] = $row['eMail'];
        $_SESSION['firstname'] = $row['firstName'];
        $_SESSION['lastname'] = $row['lastName'];
        $_SESSION['email'] = $row['eMail'];
        $_SESSION['site_access'] = $row['accessLevel'];
        session_write_close();
        set_cookie($row);
        //TODO: Setup where the user goes once login is verified
        if (true) {
            // User
            header("Location: account.php");
        } else {
            // Disabled Account
            header("Location: logout.php");
        }
    } else {
        $errors[] = "Access Not Permitted:<br />Username / Password Error";
        handle_errors($errors);
        handle_reposts();
    }
}
Example #3
0
 * Load all available News
 */
require_once '../config/autoload.php';
require_once EMC_PARENT_DIR . 'layout/header.php';
/* Prepare and execute the request */
$lib = new News();
$module_version = '3.0.0';
$module_platform = 'prestashop';
$lib->loadNews($module_platform, $module_version);
echo "<h3>API News :</h3>";
if (!$lib->curl_error && !$lib->resp_error) {
    // If you want to recieve order's status changes or documents, check for "url_push" param in samples/make_order.php
    echo '<pre>' . print_r($lib->news, true) . '</pre>';
} else {
    echo '<div class="alert alert-danger">';
    handle_errors($lib);
    echo '</div>';
}
?>
<div class="well well-sm">
    <button type="button" class="btn btn-xs btn-default" id="toogleDebug">
        Toggle Debug
    </button>
    <pre id="debug" style="display: none">
        <?php 
print_r(array_merge($lib->getApiParam(), array('API response :' => $lib->news)));
?>
    </pre>
</div>
<?php 
require_once EMC_PARENT_DIR . 'layout/footer.php';
Example #4
0
$PAYMENT_DATE_3 = '';
$PAYMENT_DATE_4 = '';
initialize_payment_dates($SEASON);
$smarty->assign('daysToFirstPayment', get_payment_date_difference(1));
$smarty->assign('daysToSecondPayment', get_payment_date_difference(2));
$smarty->assign('daysToThirdPayment', get_payment_date_difference(3));
$smarty->assign('daysToFourthPayment', get_payment_date_difference(4));
if (isset($_POST['action']) && $_POST['action'] == "Edit Payments") {
    // If form does not validate, we need to return with errors.
    if ($errors = validate_payments_form()) {
        handle_errors($errors);
        handle_reposts();
    } else {
        // If errors occur while trying to create user, we need to return with errors.
        if ($errors = process_payments_form()) {
            handle_errors($errors);
            handle_reposts();
        } else {
            header("Location: editpaymentplan4.php?id={$P4_ID}&success=yes");
        }
    }
} else {
    populateFieldsFromDatabase();
}
format_date_fields();
$smarty->assign('P4_AUDIT', $P4_AUDIT);
$smarty->assign('P4_NAME', $P4_NAME);
$smarty->assign('P4_ID', $P4_ID);
$smarty->assign('P4_PAY1_PROCESS', $P4_PAY1_PROCESS);
$smarty->assign('P4_PAY1_DATE_SELECT', $P4_PAY1_DATE_SELECT);
$smarty->assign('P4_PAY1_DATE', $P4_PAY1_DATE);
Example #5
0
function handle_data($data, $is_sock = False, $auth = False, $exec = False)
{
    global $buckets;
    global $alias_locks;
    global $dest_overrides;
    global $admin_accounts;
    global $admin_data;
    global $admin_is_sock;
    global $admin_aliases;
    global $exec_errors;
    global $exec_list;
    global $throttle_time;
    global $ignore_list;
    if ($auth == False) {
        echo "" . date("Y-m-d H:i:s", microtime(True)) . " > {$data}";
        handle_errors($data);
    } else {
        term_echo("*** auth = true");
    }
    $items = parse_data($data);
    if ($items !== False) {
        write_out_buffer_data($items);
        if ($items["destination"] == DEBUG_CHAN) {
            return;
        }
        if ($auth == False and $is_sock == True) {
            log_items($items);
        }
        if (in_array($items["nick"], $ignore_list) == True) {
            return;
        }
        if (isset($buckets[BUCKET_IGNORE_NEXT]) == True and $items["nick"] == get_bot_nick()) {
            unset($buckets[BUCKET_IGNORE_NEXT]);
            return;
        }
        if ($items["prefix"] == IRC_HOST and strpos(strtolower($items["trailing"]), "throttled") !== False) {
            term_echo("*** THROTTLED BY SERVER - REFUSING ALL OUTGOING MESSAGES TO SERVER FOR " . THROTTLE_LOCKOUT_TIME . " SECONDS ***");
            $throttle_time = microtime(True);
            return;
        }
        if ($items["cmd"] == 330) {
            authenticate($items);
        }
        if ($items["cmd"] == 376) {
            dojoin(INIT_CHAN_LIST);
        }
        if ($items["cmd"] == "NOTICE" and $items["nick"] == "NickServ" and $items["trailing"] == NICKSERV_IDENTIFY_PROMPT) {
            if (file_exists(PASSWORD_FILE) == True and NICKSERV_IDENTIFY === "1") {
                rawmsg("NickServ IDENTIFY " . trim(file_get_contents(PASSWORD_FILE)), True);
            }
            startup();
        }
        $args = explode(" ", $items["trailing"]);
        if (in_array($args[0], $admin_aliases) == True or has_account_list($args[0]) == True) {
            if ($auth == False and $is_sock == True) {
                term_echo("authenticating \"" . $args[0] . "\"...");
                $admin_data = $items["data"];
                $admin_is_sock = $is_sock;
                rawmsg("WHOIS " . $items["nick"]);
                return;
            }
        }
        $alias = $args[0];
        handle_events($items);
        switch ($alias) {
            case ALIAS_ADMIN_NICK:
                if (count($args) == 2) {
                    rawmsg(":" . get_bot_nick() . " NICK :" . trim($args[1]));
                    set_bot_nick(trim($args[1]));
                }
                break;
            case ALIAS_ADMIN_QUIT:
                if (count($args) == 1) {
                    write_out_buffer_command($items, "quit");
                    process_scripts($items, ALIAS_QUIT);
                }
                break;
            case ALIAS_ADMIN_PS:
                if (count($args) == 1) {
                    write_out_buffer_command($items, "ps");
                    ps($items);
                }
                break;
            case ALIAS_ADMIN_KILL:
                if (count($args) == 2) {
                    write_out_buffer_command($items, "kill");
                    kill($items, $args[1]);
                }
                break;
            case ALIAS_ADMIN_KILLALL:
                if (count($args) == 1) {
                    write_out_buffer_command($items, "killall");
                    killall($items);
                }
                break;
            case ALIAS_LIST:
                if (check_nick($items, $alias) == True) {
                    if (count($args) == 1) {
                        write_out_buffer_command($items, "list");
                        get_list($items);
                    }
                }
                break;
            case ALIAS_LIST_AUTH:
                if (check_nick($items, $alias) == True) {
                    if (count($args) == 1) {
                        write_out_buffer_command($items, "listauth");
                        get_list_auth($items);
                    }
                }
                break;
            case ALIAS_LOCK:
                if (check_nick($items, $alias) == True) {
                    if (count($args) == 2) {
                        write_out_buffer_command($items, "lock");
                        $alias_locks[$items["nick"]][$items["destination"]] = $args[1];
                        privmsg($items["destination"], $items["nick"], "alias \"" . $args[1] . "\" locked for nick \"" . $items["nick"] . "\" in \"" . $items["destination"] . "\"");
                    } else {
                        privmsg($items["destination"], $items["nick"], "syntax: " . ALIAS_LOCK . " <alias>");
                    }
                }
                break;
            case ALIAS_UNLOCK:
                if (check_nick($items, $alias) == True and isset($alias_locks[$items["nick"]][$items["destination"]]) == True) {
                    write_out_buffer_command($items, "unlock");
                    privmsg($items["destination"], $items["nick"], "alias \"" . $alias_locks[$items["nick"]][$items["destination"]] . "\" unlocked for nick \"" . $items["nick"] . "\" in \"" . $items["destination"] . "\"");
                    unset($alias_locks[$items["nick"]][$items["destination"]]);
                }
                break;
            case ALIAS_ADMIN_DEST_OVERRIDE:
                if (count($args) == 2) {
                    write_out_buffer_command($items, "dest_override");
                    privmsg($items["destination"], $items["nick"], "destination override \"" . $args[1] . "\" set for nick \"" . $items["nick"] . "\" in \"" . $items["destination"] . "\"");
                    $dest_overrides[$items["nick"]][$items["destination"]] = $args[1];
                } else {
                    privmsg($items["destination"], $items["nick"], "syntax: " . ALIAS_ADMIN_DEST_OVERRIDE . " <dest>");
                }
                break;
            case ALIAS_ADMIN_DEST_CLEAR:
                if (isset($dest_overrides[$items["nick"]][$items["destination"]]) == True) {
                    write_out_buffer_command($items, "dest_clear");
                    $override = $dest_overrides[$items["nick"]][$items["destination"]];
                    unset($dest_overrides[$items["nick"]][$items["destination"]]);
                    privmsg($items["destination"], $items["nick"], "destination override \"{$override}\" cleared for nick \"" . $items["nick"] . "\" in \"" . $items["destination"] . "\"");
                }
                break;
            case ALIAS_ADMIN_IGNORE:
                if (count($args) == 2) {
                    if (in_array($args[1], $ignore_list) == False) {
                        write_out_buffer_command($items, "ignore");
                        privmsg($items["destination"], $items["nick"], get_bot_nick() . " set to ignore " . $args[1]);
                        $ignore_list[] = $args[1];
                        if (file_put_contents(IGNORE_FILE, implode("\n", $ignore_list)) === False) {
                            privmsg($items["destination"], $items["nick"], "error saving ignore file");
                        }
                    }
                } else {
                    privmsg($items["destination"], $items["nick"], "syntax: " . ALIAS_ADMIN_IGNORE . " <nick>");
                }
                break;
            case ALIAS_ADMIN_UNIGNORE:
                if (count($args) == 2) {
                    if (in_array($args[1], $ignore_list) == True) {
                        $i = array_search($args[1], $ignore_list);
                        if ($i !== False) {
                            write_out_buffer_command($items, "unignore");
                            privmsg($items["destination"], $items["nick"], get_bot_nick() . " set to listen to " . $args[1]);
                            unset($ignore_list[$i]);
                            $ignore_list = array_values($ignore_list);
                            if (file_put_contents(IGNORE_FILE, implode("\n", $ignore_list)) === False) {
                                privmsg($items["destination"], $items["nick"], "error saving ignore file");
                            }
                        } else {
                            privmsg($items["destination"], $items["nick"], $args[1] . " not found in " . get_bot_nick() . " ignore list");
                        }
                    }
                } else {
                    privmsg($items["destination"], $items["nick"], "syntax: " . ALIAS_ADMIN_UNIGNORE . " <nick>");
                }
                break;
            case ALIAS_ADMIN_LIST_IGNORE:
                if (count($ignore_list) > 0) {
                    write_out_buffer_command($items, "ignorelist");
                    privmsg($items["destination"], $items["nick"], get_bot_nick() . " ignore list: " . implode(", ", $ignore_list));
                } else {
                    privmsg($items["destination"], $items["nick"], get_bot_nick() . " isn't ignoring anyone");
                }
                break;
            case ALIAS_ADMIN_REHASH:
                if (count($args) == 1) {
                    if (exec_load() === False) {
                        privmsg($items["destination"], $items["nick"], "error reloading exec file");
                        doquit();
                    } else {
                        write_out_buffer_command($items, "rehash");
                        process_exec_helps();
                        process_exec_inits();
                        process_exec_startups();
                        $users = get_users();
                        foreach ($users[get_bot_nick()]["channels"] as $channel => $timestamp) {
                            rawmsg("NAMES {$channel}");
                        }
                        privmsg($items["destination"], $items["nick"], "successfully reloaded exec file (" . count($exec_list) . " aliases)");
                    }
                }
                break;
            case ALIAS_ADMIN_BUCKETS_DUMP:
                if (count($args) == 1) {
                    write_out_buffer_command($items, "buckets_dump");
                    buckets_dump($items);
                }
                break;
            case ALIAS_ADMIN_BUCKETS_SAVE:
                if (count($args) == 1) {
                    write_out_buffer_command($items, "buckets_save");
                    buckets_save($items);
                }
                break;
            case ALIAS_ADMIN_BUCKETS_LOAD:
                if (count($args) == 1) {
                    write_out_buffer_command($items, "buckets_load");
                    buckets_load($items);
                }
                break;
            case ALIAS_ADMIN_BUCKETS_FLUSH:
                if (count($args) == 1) {
                    write_out_buffer_command($items, "buckets_flush");
                    buckets_flush($items);
                }
                break;
            case ALIAS_ADMIN_BUCKETS_LIST:
                if (count($args) == 1) {
                    write_out_buffer_command($items, "buckets_list");
                    buckets_list($items);
                }
                break;
            case ALIAS_INTERNAL_RESTART:
                if (count($args) == 1 and $items["cmd"] == CMD_INTERNAL) {
                    define("RESTART", True);
                    process_scripts($items, ALIAS_QUIT);
                }
                break;
            case ALIAS_ADMIN_RESTART:
                if (count($args) == 1) {
                    write_out_buffer_command($items, "restart");
                    define("RESTART", True);
                    process_scripts($items, ALIAS_QUIT);
                }
                break;
            case ALIAS_ADMIN_EXEC_CONFLICTS:
                if (count($args) == 1) {
                    # TODO
                    # $admin_aliases $reserved_aliases
                }
                break;
            case ALIAS_ADMIN_EXEC_LIST:
                if (count($args) == 1) {
                    # TODO
                }
                break;
            case ALIAS_ADMIN_EXEC_TIMERS:
                if (count($args) == 1) {
                    # TODO
                }
                break;
            case ALIAS_ADMIN_EXEC_ERRORS:
                if (count($args) == 1) {
                    $n = count($exec_errors);
                    if ($n > 0) {
                        write_out_buffer_command($items, "exec_load_errors");
                        privmsg($items["destination"], $items["nick"], "exec load errors:");
                        $i = 0;
                        foreach ($exec_errors as $filename => $messages) {
                            if ($i == $n - 1) {
                                privmsg($items["destination"], $items["nick"], "  └─" . $filename);
                                for ($j = 0; $j < count($messages); $j++) {
                                    if ($j == count($messages) - 1) {
                                        privmsg($items["destination"], $items["nick"], "     └─" . $messages[$j]);
                                    } else {
                                        privmsg($items["destination"], $items["nick"], "     ├─" . $messages[$j]);
                                    }
                                }
                            } else {
                                privmsg($items["destination"], $items["nick"], "  ├─" . $filename);
                                for ($j = 0; $j < count($messages); $j++) {
                                    if ($j == count($messages) - 1) {
                                        privmsg($items["destination"], $items["nick"], "  │  └─" . $messages[$j]);
                                    } else {
                                        privmsg($items["destination"], $items["nick"], "  │  ├─" . $messages[$j]);
                                    }
                                }
                            }
                            $i++;
                        }
                    } else {
                        privmsg($items["destination"], $items["nick"], "no errors");
                    }
                }
                break;
            default:
                process_scripts($items, "");
                # execute scripts occurring for a specific alias
                process_scripts($items, ALIAS_ALL);
                # process scripts occuring for every line (* alias)
        }
    }
}
Example #6
0
if (isset($_GET['id']) && $_GET['id'] > 0) {
    $registration = new Registration($_GET['id']);
    $registration->formPreLoad($smarty);
    $smarty->assign('id', $registration->get_registrationID());
} else {
    if (isset($_POST['action']) && $_POST['action'] == "Edit Registration") {
        $registration = new Registration($_POST['id']);
        $smarty->assign('id', $registration->get_registrationID());
        // If form does not validate, we need to return with errors.
        if ($registration->formValidation()) {
            handle_errors($registration->get_formErrors());
            $registration->formReposts($smarty);
        } else {
            // If errors occur while trying to create user, we need to return with errors.
            if ($registration->formProcessUpdate()) {
                handle_errors($registration->get_formErrors());
                $registration->formReposts($smarty);
            } else {
                $registration->formPreLoad($smarty);
                handle_success($registration->get_formSuccess());
            }
        }
    } else {
        header("Location: manageregistrations.php");
    }
}
$smarty->assign('page_name', 'Edit ' . $registration->get_fName() . ' ' . $registration->get_lName() . '\'s Season Registration');
$smarty->assign('type', 'EDIT');
// Build the page
require 'global_begin.php';
$smarty->display('admin/editregistration.tpl');
Example #7
0
                // If errors occur while trying to update team, we need to return with errors.
                if ($team->formProcessUpdate()) {
                    handle_errors($team->get_teamFormErrors());
                    $team->formReposts($smarty);
                } else {
                    handle_success($team->get_teamFormSuccess());
                }
            }
        }
    }
}
// if GET request to Delete team
if (isset($_GET['teamID']) && $_GET['teamID'] > 0 && $_GET['delete'] == 1) {
    $team = new Team($_GET['teamID']);
    if ($team->formProcessDelete()) {
        handle_errors($team->get_teamFormErrors());
        $team->formReposts($smarty);
    } else {
        handle_success($team->get_teamFormSuccess());
    }
}
// Build list of teams
$Teams = new Teams();
$TeamsArray = $Teams->get_TeamArray(0);
if (count($TeamsArray) > 0) {
    $count = 0;
    $smarty->assign('teamID', array());
    $smarty->assign('teamName', array());
    $smarty->assign('teamShortName', array());
    $smarty->assign('teamFGColor', array());
    $smarty->assign('teamBGColor', array());
Example #8
0
	/**
	 * @method resetsubscription
	 *
	 * Reset your subscription to a thread. New posts made to the thread after this call will cause the subscription to become active again.
	 *
	 * @param threadid integer required Reset the subscription to this thread.
	 * @return true if reset, false if no subscription or upload does not exist.
	 * @example threadid=309779
	 * @see subscribe
	 * @see unreadcomments
	 */
	function api_resetsubscription() {
		$threadid = check_arg("threadid", "integer");
		handle_errors();
		
		send(id(new Upload($threadid))->clearSubscription());
	}
Example #9
0
                // If errors occur while trying to create board member, we need to return with errors.
                if ($boardMember->formProcessUpdate()) {
                    handle_errors($boardMember->get_boardMemberFormErrors());
                    $boardMember->formReposts($smarty);
                } else {
                    handle_success($boardMember->get_boardMemberFormSuccess());
                }
            }
        }
    }
}
// if GET request to Delete board member
if (isset($_GET['boardMemberID']) && $_GET['boardMemberID'] > 0 && $_GET['delete'] == 1) {
    $boardMember = new BoardMember($_GET['boardMemberID']);
    if ($boardMember->formProcessDelete()) {
        handle_errors($boardMember->get_boardMemberFormErrors());
        $boardMember->formReposts($smarty);
    } else {
        handle_success($boardMember->get_boardMemberFormSuccess());
    }
}
// Build list of board members
$BoardMembers = new BoardMembers();
$BoardMembersArray = $BoardMembers->get_BoardMemberArray(0);
if (count($BoardMembersArray) > 0) {
    $count = 0;
    $smarty->assign('boardMemberID', array());
    $smarty->assign('boardMemberName', array());
    $smarty->assign('boardMemberFirstName', array());
    $smarty->assign('boardMemberLastName', array());
    $smarty->assign('boardMemberEmail', array());
Example #10
0
function process_registration_form($smarty)
{
    global $Link;
    $errors = array();
    $fname = format_uppercase_text($_POST['firstname']);
    $lname = format_uppercase_text($_POST['lastname']);
    $email = format_trim(strtolower($_POST['email']));
    $pass = md5($_POST['password']);
    $verificationKey = createVerificationKey($email);
    //Check if user exists with accessLevel > 0.  If true, then we will just error out registration and explain that user exists.
    $query = 'SELECT email, accessLevel FROM ' . USER . ' WHERE email = "' . $email . '" AND accessLevel > 0';
    $result = mysql_query($query, $Link) or die("sp_clubs (Line " . __LINE__ . "): " . mysql_errno() . ": " . mysql_error());
    if ($result && mysql_num_rows($result) > 0) {
        $errors[] = 'User already exists.  If you forgot your password, <a href="resetpassword.php">click here</a> to have it reset.';
        handle_errors($errors);
        handle_reposts();
    }
    if (count($errors) == 0) {
        //Check if user exists with accessLevel 0.  If true, then we will just resend validation email
        $query = 'SELECT email, accessLevel, verificationKey FROM ' . USER . ' WHERE email = "' . $email . '" AND accessLevel = 0';
        $result = mysql_query($query, $Link) or die("sp_clubs (Line " . __LINE__ . "): " . mysql_errno() . ": " . mysql_error());
        if ($result && mysql_num_rows($result) > 0 && ($row = mysql_fetch_array($result))) {
            $verificationKey = $row['verificationKey'];
            send_validation_email($email, $verificationKey);
            header("Location: pending.php");
        } else {
            // Insert new user query
            $query = "INSERT INTO " . USER . " (firstname, lastname, email, password, verificationKey) ";
            $query .= "VALUES ('{$fname}', '{$lname}', '{$email}', '{$pass}', '{$verificationKey}')";
            $result = mysql_query($query, $Link) or die("sp_clubs (Line " . __LINE__ . "): " . mysql_errno() . ": " . mysql_error());
            if ($result) {
                send_validation_email($email, $verificationKey);
                send_admin_email();
            } else {
                $errors[] = "No user was created.";
            }
        }
        // End of else
    }
    // if (!errors)
    return $errors;
}