예제 #1
0
function index()
{
    modTitle('Planit | Recheche');
    if (!isCO()) {
        setAlert('Veuillez vous connecter pour faire une recherche', 'warning');
    }
    loadModel('villes');
    $k['villes'] = getAllVille();
    set($k);
    if (!empty($_POST)) {
        $ok = 0;
        foreach ($_POST as $post) {
            if (!empty($post)) {
                $ok = 1;
                break;
            }
        }
        if ($ok) {
            loadModel('recherche');
            $v['result'] = search_result($_POST);
            if (empty($v['result'])) {
                setAlert('Aucun resultat trouve', 'warning');
            }
            set($v);
        } else {
            setAlert('Remplir au moins un champs', 'danger');
        }
    }
    render();
}
예제 #2
0
파일: logout.php 프로젝트: kasuke5/planit
function index()
{
    modTitle('Planit | Deconnexion');
    setAlert('Vous êtes bien déconnecté, redirection vers la page d\'accueil dans 5 secondes', 'danger');
    deco();
    render();
}
예제 #3
0
    public static function notLoggedIn()
    {
        //**********Not Logged In**********//
        setAlert('danger', 'Not Logged In', 'You are not currently logged in, and cannot access this page. Please log in.');
        ?>
		    <div class="container">
		    	<div class="page-header" style="margin-top: -25px">
		    		<h1>Access Denied</h1>
		    	</div>
		    	<?php 
        showAlerts();
        ?>
		    </div> <!-- /container -->
		<?php 
    }
예제 #4
0
/**
 * Loads the correct core include file based on the requested page and action, and returns a full array of requests
 * @access public
 * @return array
 */
function regsec_load()
{
    /** Getting the raw HTTP Request Header and breaking it up into a request array */
    $raw_http_request = explode("/", trim($_SERVER['REQUEST_URI'], "/"));
    $request_array = array();
    /** Setting default values of False for all request_array key values */
    $request_array['page'] = false;
    $request_array['action'] = false;
    $request_array['value_1'] = false;
    $request_array['value_2'] = false;
    /** Assigning the first URI option to the Page array key */
    if (isset($raw_http_request[0])) {
        $request_array['page'] = $raw_http_request[0];
    }
    /** Assigning the second URI option to the Action array key */
    if (isset($raw_http_request[1])) {
        $request_array['action'] = $raw_http_request[1];
    }
    /** Assigning the third URI option to the Value 1 array key */
    if (isset($raw_http_request[2])) {
        $request_array['value_1'] = $raw_http_request[2];
    }
    /** Assigning the fourth URI option to the Value 2 array key */
    if (isset($raw_http_request[3])) {
        $request_array['value_2'] = $raw_http_request[3];
    }
    /** Loading the correct page */
    if (!$request_array['page']) {
        /** The visitor is not requesting any specific page, so we're loading the main page instead */
        require_once INCPATH . "dashboard.inc.php";
    } elseif (file_exists(INCPATH . $request_array['page'])) {
        /** The visitor is requesting a core include file, so we're loading that */
        require_once INCPATH . $request_array['page'];
    } elseif (file_exists(ABSPATH . "plugins/" . $request_array['page'])) {
        /** The page they're requesting can only be provided by a plugin, so we're serving that now */
        require_once ABSPATH . "plugins/" . $request_array['page'];
    } else {
        /** We cannot find the page they are requesting, so we're serving the main page with an error notice */
        require_once INCPATH . "dashboard.inc.php";
        setAlert('danger', 'Page Not Found', 'The page you have requested could not be found. Please ensure the page has been spelled correctly and try again.');
    }
    /** Returning our HTTP Request array */
    return $request_array;
}
예제 #5
0
 public function register()
 {
     if (post('register')) {
         $pengguna = ['username' => post('username'), 'email' => post('email'), 'level' => 0, 'aktif' => 1];
         $pelanggan = ['nama_lengkap' => post('nama'), 'alamat' => post('alamat'), 'kota' => post('kota'), 'telp' => post('telp')];
         if (post('password') == post('passconf')) {
             $pengguna['password'] = md5(post('password'));
         }
         if ($userId = User::add($pengguna)) {
             $pelanggan['id_pengguna'] = $userId;
             if (Customer::add($pelanggan)) {
                 setAlert('success', 'Registrasi berhasil, silahkan login ke akun yang baru saja anda buat');
                 redirect('login');
             } else {
                 setAlert('error', 'Maaf registrasi gagal');
                 redirect('register');
             }
         }
     }
     return $this->render('form-register', ['heading' => 'Silahkan register']);
 }
예제 #6
0
파일: user.php 프로젝트: kasuke5/planit
function connexion()
{
    if (isCo()) {
        redirect();
    }
    modTitle('Planit | Connexion');
    if (!empty($_POST)) {
        loadModel('user');
        if (empty($_POST['pseudo']) || empty($_POST['password'])) {
            setAlert('Merci de remplir tous les champs', 'danger');
        } else {
            if (user_exist($_POST['pseudo'], $_POST['password'])) {
                $_SESSION['pseudo'] = $_POST['pseudo'];
                redirect();
            } else {
                setAlert('Mot de passe ou pseudo incorrect', 'danger');
            }
        }
    }
    render('connexion');
}
예제 #7
0
 public function categories($do = '', $id = '')
 {
     $this->data['heading'] = 'Administrasi: Kategori';
     switch ($do) {
         case 'form':
             if (post('submit')) {
                 $data = ['nama' => post('nama'), 'alias' => post('alias'), 'keterangan' => post('keterangan')];
                 if (Category::save($data, $id)) {
                     if ($id) {
                         setAlert('success', 'Berhasil memperbarui data kategori <b>' . $data['nama'] . '</b>');
                     } else {
                         setAlert('success', 'Berhasil menambahkan kategori <b>' . $data['nama'] . '</b>');
                     }
                     return redirect('admin-shop/categories');
                 }
                 setAlert('error', 'Terjadi kesalahan dalam penyimpanan kategori <b>' . $data['nama'] . '</b>');
                 return redirect($this->uri->path());
             } else {
                 if ($id) {
                     $this->data['data'] = Category::show([Category::primary() => $id])->fetchOne();
                 }
                 return $this->render('category-form', $this->data);
             }
             break;
         case 'delete':
             if (Category::del([Category::primary() => $id])) {
                 setAlert('success', 'Kategori berhasil terhapus');
             } else {
                 setAlert('error', 'Terjadi kesalahan dalam penghapusan kategori');
             }
             return redirect('admin-shop/categories');
             break;
         default:
             $this->data['data'] = Category::show();
             return $this->render('category-table', $this->data);
             break;
     }
 }
예제 #8
0
 /**
  * New Password Method
  *
  * This method is called to set a new user password within the database
  *
  * @param int $userid
  * @param string $newPassword
  */
 public function setNewPassword($userid, $newPassword)
 {
     /** Setting the password hashing cost */
     $options = ['cost' => HASH_COST];
     /** Hashing the password */
     $hash = password_hash($newPassword, PASSWORD_BCRYPT, $options);
     /** Updating the password in the database */
     $stmt = $db->prepare("UPDATE user_accounts SET password = ? WHERE userid = ?");
     $stmt->execute(array($hash, $userid));
     setAlert('success', LANG_PASSWORD_UPDATED, LANG_PASSWORD_UPDATED_SUBTEXT);
 }
예제 #9
0
		</div>
	</div>
	<?php 
} else {
    if ($user->getDirectorAccess()) {
        if ($request['value_2'] == 'addfit') {
            Fitting::addFitting($request['value'], $_POST['fitting_raw'], $_POST['fitting_role'], $_POST['fitting_priority'], $_POST['fitting_notes'], $user->getGroup(), $user);
        } elseif ($request['value_2'] == 'deletefit') {
            $stmt = $db->prepare('DELETE FROM doctrines_fittingmods WHERE fittingid = ?');
            $stmt->execute(array($_POST['fitting_id']));
            $stmt = $db->prepare('DELETE FROM doctrines_fits WHERE fittingid = ?');
            $stmt->execute(array($_POST['fitting_id']));
        } elseif ($request['value_2'] == 'editfit') {
            $stmt = $db->prepare('UPDATE doctrines_fits SET fitting_name = ?, fitting_role = ?, fitting_priority = ?, fitting_notes = ? WHERE fittingid = ?');
            $stmt->execute(array($_POST['fitting_name'], $_POST['fitting_role'], $_POST['fitting_priority'], $_POST['fitting_notes'], $_POST['fitting_id']));
            setAlert('success', 'Fitting Updated', 'The ' . $_POST['fitting_name'] . ' fit has been successfully edited.');
        } elseif ($request['value_2'] == 'editdoctrine') {
            $stmt = $db->prepare('UPDATE doctrines SET doctrine_name = ?, doctrine_use = ?, doctrine_requirement = ?, doctrine_owner = ?, doctrine_staging = ? WHERE doctrineid = ?');
            $stmt->execute(array($_POST['doctrine_name'], $_POST['doctrine_use'], $_POST['doctrine_requirement'], $_POST['doctrine_owner'], $_POST['doctrine_staging'], $_POST['doctrine_id']));
        }
    }
    $fittings = array();
    $fitting_prerequsites = array();
    $stmt = $db->prepare('SELECT * FROM doctrines WHERE doctrineid = ? AND gid = ? LIMIT 1');
    $stmt->execute(array($request['value'], $user->getGroup()));
    $doctrine = $stmt->fetch(PDO::FETCH_ASSOC);
    $stmt = $db->prepare('SELECT * FROM doctrines_fits WHERE doctrineid = ? AND fitting_role = "Logistics" AND gid = ? ORDEr BY fitting_priority DESC');
    $stmt->execute(array($request['value'], $user->getGroup()));
    $fittings['logistics'] = $stmt->fetchAll(PDO::FETCH_ASSOC);
    $stmt = $db->prepare('SELECT * FROM doctrines_fits WHERE doctrineid = ? AND fitting_role = "Mainline" AND gid = ? ORDEr BY fitting_priority DESC');
    $stmt->execute(array($request['value'], $user->getGroup()));
예제 #10
0
 function doErrorFromServer($message)
 {
     setAlert('Error from server: ' . $message);
 }
예제 #11
0
        ?>
				<div class="col-md-offset-3 col-md-6 col-sm-offset-2 col-sm-8 mobile-reconfig" style="padding-right: 0px">
					<?php 
        showAlerts();
        ?>
					<div class="col-md-12 opaque-section" style="padding: 0px">
						<div class="row box-title-section">
							<h3 class="eve-text" style="text-align: center; font-size: 250%"><?php 
        echo SITE_NAME;
        ?>
</h3>
						</div>
						<div class="row" style="padding-left: 10px; padding-right: 10px; text-align: center">
							<p class="eve-text" style="font-size: 150%; text-align: center">Your account has been successfully created.</p>
							<a href="/dashboard/" class="btn btn-primary eve-text" style="font-size: 125%; text-align: center; margin-bottom: 15px">Click Here To Log In</a>
						</div>
					</div>
				</div>
				<?php 
    } else {
        // The character is being used, setting a warning and heading back to Step 1
        setAlert('danger', 'Registration Failed', 'The Main Character you have selected is already in use. Please contact your recruiter for assistance.');
        ?>
<META http-equiv="refresh" content="0;URL=/register/1/"><?php 
    }
}
?>
		</div>
	</div>
<?php 
require 'includes/footer.php';
예제 #12
0
$requestURI = explode('/', $_SERVER['REQUEST_URI']);
$scriptName = explode('/', $_SERVER['SCRIPT_NAME']);
for ($i = 0; $i < sizeof($scriptName); $i++) {
    if ($requestURI[$i] == $scriptName[$i]) {
        unset($requestURI[$i]);
    }
}
$requestURI = array_values($requestURI);
@($action = $requestURI[0]);
$params = array_slice($requestURI, 1);
if (empty($action)) {
    $action = "home";
}
if (($action == 'game' || $action == 'go') && !User::isConnected()) {
    //if not connected he can see only home
    setAlert('warning', 'in order to play please sign in first');
    header('location: /home');
    exit(0);
}
//why not, i  think he should be able to see home if he's connected...
if ($action == 'gameMaker') {
    //it looks ugly but hey, it works
    require_once "./php/gameMaker.php";
    exit(0);
}
?>
<!DOCTYPE HTML>
<html>
  <head>
    <meta http-equiv="content-type" content="text/html;charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
예제 #13
0
 public function checkout()
 {
     if (!User::current('id')) {
         redirect('login');
     }
     if ($items = session('cart-items')) {
         $userId = User::current('id');
         $userKey = User::primary();
         $custKey = Customer::primary();
         $pelanggan = Customer::show([$userKey => $userId])->fetchOne();
         $order = [$userKey => $userId, $custKey => $pelanggan->{$custKey}, 'tanggal' => date('Y-m-d'), 'produk' => $items, 'belanja' => post('belanja'), 'kurir' => post('kurir'), 'ongkir' => post('ongkir'), 'bayar' => 0, 'kembali' => 0];
         if (!$order['ongkir'] && !$order['kurir']) {
             setAlert('error', 'Estimasi ongkos kirim belum ada, pastikan field kurir sudah diisi.');
             return redirect('cart');
         }
         $order['total'] = $order['belanja'] + $order['ongkir'];
         if ($return = Order::add($order)) {
             session('cart-items', '');
             setAlert('success', ['Terima kasih telah berbelanja di ' . conf('app.title') . '.', 'Segeralah melakukan pembayaran agar pesanan anda dapat secepatnya kami proses.']);
         } else {
             setAlert('error', 'Terjadi kesalahan dalam penghapusan order');
             return redirect('cart');
         }
     }
     if (User::loggedin()) {
         return redirect('admin-shop/orders/form/' . $return);
     }
     return redirect('shop');
 }
예제 #14
0
    if (isset($_POST['operation_fittings'])) {
        foreach ($_POST['operation_fittings'] as $fitting) {
            $fittingArray[$i] = $fitting;
            $i++;
        }
        $fittingsList = implode(',', $fittingArray);
    } else {
        $fittingsList = 'No fittings or doctrines requested';
    }
    $stmt = $db->prepare('INSERT INTO group_operations (gid,operation_name,operation_type,operation_fc,operation_rally,operation_comms,operation_timestamp,operation_fittings,operation_details) VALUES (?,?,?,?,?,?,?,?,?)');
    $stmt->execute(array($user->getGroup(), $_POST['operation_name'], $_POST['operation_type'], $_POST['operation_fc'], $_POST['operation_rally'], $_POST['operation_comms'], $operationTimestamp, $fittingsList, $_POST['operation_details']));
    if ($settings->getSlackIntegration()) {
        sendComplexSlackNotification($settings->getSlackAuthToken(), $settings->getGroupTicker() . ' Operations Calendar', $settings->getSlackOpsChannel(), 'New Fleet Op Posted: ' . $_POST['operation_name'] . ' - ' . $_POST['operation_date'] . ' @ ' . $_POST['operation_time'] . ' FCed by ' . $_POST['operation_fc'] . '. Form up in ' . $_POST['operation_rally'] . ' on ' . $_POST['operation_comms'], 'squirrel', 'chat.postMessage');
        setAlert('success', 'New Operation Created and Posted To Slack', '');
    } else {
        setAlert('success', 'New Operation Created', '');
    }
}
$stmt = $db->prepare('SELECT * FROM group_operations WHERE gid = ? AND operation_timestamp >= ? ORDER BY operation_timestamp');
$stmt->execute(array($user->getGroup(), time()));
$operations = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<div class="opaque-container">

    <div class="row" style="width: 100%; margin-top: 20px; margin-bottom: 20px">
		<div class="col-md-12 opaque-section" style="padding: 0px">
			<div class="row box-title-section">
				<h1 style="text-align: center">Operations Calendar<h1>
			</div>
			<div class="row" style="padding-left: 10px; padding-right: 10px">
		      		<?php 
예제 #15
0
 public static function getModuleSlot($moduleID)
 {
     global $db;
     $stmt = $db->prepare('SELECT * FROM dgmTypeEffects WHERE typeID = ? AND (effectID = 11 OR effectID = 12 OR effectID = 13 OR effectID = 2663 OR effectID = 3772)');
     $stmt->execute(array($moduleID));
     $slotID = $stmt->fetch();
     switch ($slotID['effectID']) {
         case 11:
             $moduleSlot = 'Low';
             break;
         case 12:
             $moduleSlot = 'High';
             break;
         case 13:
             $moduleSlot = 'Mid';
             break;
         case 2663:
             $moduleSlot = 'Rig';
             break;
         case 3772:
             $moduleSlot = 'Subsystem';
             break;
         default:
             $moduleSlot = 'Drone';
             break;
     }
     if ($moduleSlot == NULL) {
         setAlert('danger', 'Internal Server Error FC-01', 'An internal server error has occured. Please submit a bug detailing exactly what you have done or attempted to do that caused this error.');
     }
     return $moduleSlot;
 }
예제 #16
0
function index()
{
    modTitle('Planit | Ajouter vol');
    if (!isCo()) {
        redirect('user/connexion');
    }
    if (!empty($_POST)) {
        $ok = 1;
        foreach ($_POST as $k => $v) {
            if (empty($v)) {
                setAlert('Merci de remplir tous le champs', 'danger');
                $ok = 0;
                break;
            }
            $_POST[$k] = htmlentities($v);
        }
        if ($ok) {
            extract($_POST);
            //verif compagnie
            if (empty($compagnie)) {
                setAlert('Veuillez choisir une compagnie', 'danger');
                $ok = 0;
            } else {
                $num_vols = $compagnie . rand(100, 9999);
            }
            /* Verification provenance */
            if (empty($provenance)) {
                setAlert('Remplir la provenance', 'danger');
                $ok = 0;
            }
            if ($provenance == $destination) {
                setAlert('Faites attention, vous avez les même destination/provenance', 'danger');
                $ok = 0;
            }
            //destination
            if (empty($destination)) {
                setAlert('Remplir la destination', 'danger');
                $ok = 0;
            }
            //Verif passager
            if ($nb_passagers <= 1) {
                setAlert('Veuillez modifier le nombre de passagers', 'danger');
                $ok = 0;
            }
            /* Verif heure depart/arrivee */
            if (empty($heure_depart)) {
                setAlert('Selectionnez une heure', 'danger');
                $ok = 0;
            }
            //check les heures qu'elles soient pas pareil ou wtf || HOUR($heure_depart) >= HOUR($heure_arrivee un truc ds le genre
            if (empty($heure_arrivee)) {
                setAlert('Pas bon l\'heure', 'danger');
                $ok = 0;
            }
            //verification de la date
            if (empty($date_depart)) {
                setAlert('Selectionnez une date', 'danger');
                $ok = 0;
            }
            //pareil check la date || $date_depart >= $date_arrivee)
            if ($date_arrivee < $date_depart) {
                setAlert('Pas bon la date', 'danger');
                $ok = 0;
            }
            if ($ok) {
                loadModel('ajouter_vol');
                //Relation sql
                if (!add_vol($num_vols, $nb_passagers, $heure_depart, $heure_arrivee, $date_depart, $date_arrivee, $provenance, $destination)) {
                    setAlert('Erreur', 'danger');
                } else {
                    setAlert('Vol bien ajouté', 'success');
                }
            }
        }
    }
    loadModel('compagnies');
    loadModel('villes');
    $q['villes'] = getAllVille();
    $q['compagnies'] = getAllCompagnies();
    set($q);
    render();
}
예제 #17
0
 public function setNewPassword($uid, $newPassword)
 {
     $options = ['cost' => HASH_COST];
     $hash = password_hash($newPassword, PASSWORD_BCRYPT, $options);
     if ($hash !== FALSE and $hash !== NULL) {
         $stmt = $this->db->prepare("UPDATE user_accounts SET password = ? WHERE uid = ?");
         $stmt->execute(array($hash, $uid));
         setAlert('success', 'Password Updated', 'Your password has been updated. That is pretty awesome.');
     } else {
         setAlert('danger', 'Internal Server Error - P101', 'Password update failed, please contact the site Administrator');
     }
 }
예제 #18
0
<?php

if (isset($_POST['action'])) {
    if ($_POST['action'] == 'refresh' or $_POST['action'] == 'add') {
        $keyID = $_POST['keyID'];
        $vCode = $_POST['vCode'];
        $key = new ApiKey($keyID, $vCode, $user, $db);
        $keyUpdate = $key->refreshAPIKey();
        if ($keyUpdate and $_POST['action'] == 'refresh') {
            setAlert('success', 'API Key Updated', 'The selected API Key has been refreshed, and all character information updated.');
        } elseif ($keyUpdate and $_POST['action'] == 'add') {
            setAlert('success', 'API Key Added', 'The API Key has been successfully added to the account');
        }
    } elseif ($_POST['action'] == 'delete') {
        ApiKey::deleteKey($_POST['keyID'], $user);
    }
}
$stmt = $db->prepare('SELECT * FROM user_apikeys WHERE uid = ? ORDER BY userid ASC');
$stmt->execute(array($user->getUID()));
$apiKeys = $stmt->fetchAll(PDO::FETCH_ASSOC);
require_once 'includes/header.php';
?>
<div class="opaque-container" role="tablist" aria-multiselectable="true">

    <div class="row" style="width: 100%; margin-top: 20px; margin-bottom: 20px">
		<div class="col-md-12 opaque-section" style="padding: 0px">
			<div class="row box-title-section">
				<a class="box-title-link" style="text-decoration: none" >
					<h1 class="eve-text" style="margin-top: 10px; text-align: center; font-size: 200%; font-weight: 700">API Key Management</h1>
				</a>
			</div>
예제 #19
0
 /**
  * Lookup method for Alliance CREST Endpoint
  * @param $typeID int ccp-provided typeID integer
  * @access public
  * @return array
  */
 public function Alliance($typeID)
 {
     if (isset($typeID)) {
         $raw_data = $this->fetchData('alliances/', '150097440');
     } else {
         // Error ID# 1001 - Blank or null $typeID
         setAlert('danger', 'Internal Server Error', 'Please contact your administrator and reference Error ID# 1001');
     }
 }
예제 #20
0
<?php

if (!isset($isIndex)) {
    die('');
}
User::signout();
setAlert('success', 'you are now logged out');
redirect('/');
예제 #21
0
 if ($request['value'] == 'refresh') {
     $key = new ApiKey($_POST['keyID'], $_POST['vCode'], $_POST['uid'], $db);
     if ($key->getKeyStatus() == 1 and $key->getAccessMask() & MINIMUM_API) {
         $update = $key->updateApiKey();
         if ($update) {
             foreach ($key->getCharacters() as $character) {
                 $char = new Character($character['characterID'], $key->getKeyID(), $key->getVCode(), $key->getAccessMask(), $db, $user);
                 if ($char->getExistance() or $char->getExistance() == FALSE) {
                     $char->updateCharacterInfo();
                 }
             }
             $refresh = $key->refreshAPIKey();
             setAlert('success', 'API Key Refreshed', 'The API key has been successfully refreshed.');
         }
     } elseif (!($key->getAccessMask() & MINIMUM_API) and $key->getKeyStatus() == 1) {
         setAlert('danger', 'The API Key Does Not Meet Minimum Requirements', 'The required minimum Access Mask for API keys is ' . MINIMUM_API . '. Please create a new key using the Create Key link.');
     }
 }
 // We're doing API compliance
 $compliance_type = "API";
 // Getting a full API-pulled member list
 $pheal = new Pheal($settings->getCorpUserID(), $settings->getCorpVCode(), 'corp');
 $response = $pheal->MemberTracking(array("extended" => 1));
 $memberList = array();
 foreach ($response->members as $member) {
     $memberList[$member->name]['name'] = $member->name;
     $memberList[$member->name]['id'] = $member->characterID;
 }
 ksort($memberList, SORT_NATURAL | SORT_FLAG_CASE);
 // Working through the member list
 $stmt = $db->prepare('SELECT * FROM characters WHERE charid = ?');
예제 #22
0
 public function refreshAPIKey($type)
 {
     global $settings;
     if ($this->keyStatus == 1 and $this->accessMask == MINIMUM_API and $this->expires == 'No Expiration' and $this->keyType == 'Account') {
         $update = $this->updateAPIKey();
         if ($update) {
             if ($settings->getSlackIntegration() and $settings->getSlackAPINotifications() and $type == 'new') {
                 sendComplexSlackNotification($settings->getSlackAuthToken(), $settings->getGroupTicker() . ' Auth Notifications', $settings->getSlackAPIChannel(), 'New API Key submitted by ' . User::fetchUserName($this->uid) . '.', 'aura', 'chat.postMessage');
             }
             $character_array = array();
             foreach ($this->getCharacters() as $character) {
                 $character_array[$character['characterID']] = $character['characterID'];
                 $char = new Character($character['characterID'], $this->keyID, $this->vcode, $this->accessMask, $this->db, $this->uid);
                 if ($char->getExistance() or $char->getExistance() == FALSE) {
                     $char->updateCharacterInfo();
                     $char->updateCharacterSkills();
                 }
             }
             $stmt = $this->db->prepare('UPDATE core_cron SET cron_updated = 1 WHERE api_keyID = ?');
             $stmt->execute(array($this->keyID));
             $this->removeOrphanedCharacter($this->keyID, $this->uid, $character_array);
             return TRUE;
         }
     } elseif ($this->keyStatus != 1 and $type == 'new') {
         if ($settings->getSlackIntegration() and $settings->getSlackAPINotifications()) {
             sendComplexSlackNotification($settings->getSlackAuthToken(), $settings->getGroupTicker() . ' Auth Notifications', $settings->getSlackAPIChannel(), 'API Key submitted by ' . User::fetchUserName($this->uid) . ' has been rejected as it is invalid.', 'aura', 'chat.postMessage');
         }
         setAlert('danger', 'The API Key Is Invalid', 'The API Key provided is invalid and cannot be used. Please create a new API key, and ensure you have copied the keyID and verification code correctly.');
     } elseif (!($this->accessMask == MINIMUM_API) and $this->getKeyStatus() == 1 and $type == "new") {
         if ($settings->getSlackIntegration() and $settings->getSlackAPINotifications()) {
             sendComplexSlackNotification($settings->getSlackAuthToken(), $settings->getGroupTicker() . ' Auth Notifications', $settings->getSlackAPIChannel(), 'API Key submitted by ' . User::fetchUserName($this->uid) . ' has been rejected due to an incorrect access mask.', 'aura', 'chat.postMessage');
         }
         setAlert('danger', 'The API Key Does Not Meet Minimum Requirements', 'The required minimum Access Mask for API keys is ' . MINIMUM_API . '. Please create a new key using the Create Key link.');
     } elseif ($this->expires != 'No Expiration' and $type == "new") {
         if ($settings->getSlackIntegration() and $settings->getSlackAPINotifications()) {
             sendComplexSlackNotification($settings->getSlackAuthToken(), $settings->getGroupTicker() . ' Auth Notifications', $settings->getSlackAPIChannel(), 'API Key submitted by ' . User::fetchUserName($this->uid) . ' has been rejected because it has an expiration.', 'aura', 'chat.postMessage');
         }
         setAlert('danger', 'The API Key Expires', 'The provided API Key has an expiration set. Please create a new key using the Create Key link and ensure you select the No Expiration checkbox.');
     } elseif ($this->keyType != 'Account' and $type == "new") {
         if ($settings->getSlackIntegration() and $settings->getSlackAPINotifications()) {
             sendComplexSlackNotification($settings->getSlackAuthToken(), $settings->getGroupTicker() . ' Auth Notifications', $settings->getSlackAPIChannel(), 'API Key submitted by ' . User::fetchUserName($this->uid) . ' has been rejected because it is a single character key.', 'aura', 'chat.postMessage');
         }
         setAlert('danger', 'The API Key Provided is Single-Character', 'All API Keys must be account-wide. Please create a new key using the Create Key link, and do not change the key from an Account Key to a Single Character key.');
     }
 }
예제 #23
0
<?php

if (!isset($isIndex)) {
    die('');
}
require_once './php/GameMaker.class.php';
if ($params[0] == 'queue') {
    //player started search
    if (GameMaker::queue(array('link' => $link, 'subjects' => $_POST['subjects']))) {
        echo "success";
    } else {
        setAlert('danger', 'could not queue for a game!');
        echo "error";
    }
} else {
    if ($params[0] == 'unqueue') {
        GameMaker::unqueue(array('link' => $link));
        echo "unqueued";
    } else {
        if ($params[0] == 'status') {
            //fetching status to play
            if (!empty(GameMaker::getQueueId())) {
                if (!User::isPlaying(array('link' => $link))) {
                    if (GameMaker::findOpponent(array('link' => $link))) {
                        //okey we found an oponent
                        echo "opponentFound";
                    } else {
                        echo "opponentNotFound";
                    }
                } else {
                    //player already playing
예제 #24
0
 /**
  * Menghapus data pada $table
  *
  * @param   string  $table  Nama Tabel
  * @param   array   $where  Kondisi
  * @return  bool
  */
 public function delete($table, $where = [])
 {
     $wheres = $this->_parseWhere($where);
     try {
         return $this->query("DELETE FROM `%s` %s", $table, $wheres);
     } catch (Exception $e) {
         setAlert('error', $e->getMessage());
         return false;
     }
 }
예제 #25
0
    $email = $_POST['email'];
    //TODO clean input
    $password = $_POST['password'];
    //TODO clean input
    $password2 = $_POST['password2'];
    //TODO clean input
    if (strlen($email) < 5 || strlen($email) > 60) {
        setAlert('danger', 'email length should be between 5 and 60.');
        redirect('/home');
    } else {
        if (strlen($password) < 5 || strlen($password) > 20 || strlen($password2) < 5 || strlen($password2) > 20) {
            setAlert('danger', 'password length should be between 5 and 20.');
            redirect('/home');
        } else {
            if ($password != $password2) {
                setAlert('danger', 'password don' . "'" . "t match");
                redirect('/home');
            }
        }
    }
    if (User::signup(array('email' => $email, 'password' => $password, 'link' => $link))) {
        setAlert('success', 'hello ' . User::getFullName() . ', Welcome aboard!');
        redirect('/go');
    } else {
        setAlert('danger', 'could not connect with the given credentials.');
        redirect('/home');
    }
} else {
    setAlert('danger', 'Please fill in all the fields.');
    redirect('/home');
}
예제 #26
0
    echo "ooopes";
    $i++;
}
/*
echo "subjects: ";
print_r($subjects);

echo "</br>".$description."</br>";
echo "answer: ".$answer."</br>";
echo "other options: </br>";
print_r($options);
*/
//we create a question first
$link->query("INSERT INTO questions(description) values('" . $description . "')");
$questionID = $link->insert_id;
//now tag the question to related subjects
foreach ($subjects as $subject) {
    $link->query("INSERT INTO questionrelated(idQuestion,idSubject) values('" . $questionID . "','" . $subject . "')");
}
//insert correct answer
$link->query("INSERT INTO questionoptions(idQuestion,answer) values('" . $questionID . "','" . $answer . "')");
$correctAnswerID = $link->insert_id;
//insert other options
foreach ($options as $option) {
    //if(isset($option) && !empty($option))
    $link->query("INSERT INTO questionoptions(idQuestion,answer) values('" . $questionID . "','" . $option . "')");
}
//now update the question and point idAnswer to $correctAnswerID :D
$link->query("UPDATE questions SET idAnswer='" . $correctAnswerID . "' WHERE id='" . $questionID . "'");
setAlert('success', 'well, i think everything went well.i hope :p');
redirect('add');
예제 #27
0
 public function users($do = '', $id = '')
 {
     $data = ['heading' => 'Administrasi: Pengguna'];
     switch ($do) {
         case 'form':
             if (post('submit')) {
                 $data = ['username' => post('username'), 'email' => post('email')];
                 if (User::is('admin')) {
                     $data['level'] = post('level');
                 }
                 if ($password = post('password') and $password == post('passconf')) {
                     $data['password'] = $password;
                 }
                 if (User::save($data, $id)) {
                     if ($id) {
                         setAlert('success', 'Berhasil memperbarui data pengguna <b>' . $data['username'] . '</b>');
                     } else {
                         setAlert('success', 'Berhasil menambahkan <b>' . $data['username'] . '</b> sebagai pengguna');
                     }
                     return redirect('admin/users');
                 }
                 setAlert('error', 'Terjadi kesalahan dalam penyimpanan pengguna <b>' . $data['username'] . '</b>');
                 return redirect($this->uri->path());
             }
             if ($id) {
                 $data['data'] = User::show([User::primary() => $id])->fetchOne();
             }
             return $this->render('user-form', $data);
             break;
         case 'delete':
             if (User::del([User::primary() => $id])) {
                 setAlert('success', 'Pengguna berhasil terhapus');
             } else {
                 setAlert('error', 'Terjadi kesalahan dalam penghapusan pengguna');
             }
             return redirect('admin/users');
             break;
         default:
             $data['data'] = User::show();
             return $this->render('user-table', $data);
             break;
     }
 }
예제 #28
0
function index()
{
    modTitle('Planit | Inscription');
    if (!empty($_POST)) {
        $ok = 1;
        foreach ($_POST as $k => $v) {
            if (empty($v)) {
                setAlert('Merci de remplir tous le champs', 'danger');
                $ok = 0;
                break;
            }
            $_POST[$k] = htmlentities($v);
        }
        if ($ok) {
            loadModel('user');
            extract($_POST);
            /* Verification pseudo */
            if (!ctype_alnum($pseudo)) {
                setAlert('Le pseudo doit etre alpha-numeric', 'danger');
                $ok = 0;
            } else {
                if (user_exist($pseudo)) {
                    setAlert('Le pseudo est deja utilise', 'danger');
                    $ok = 0;
                }
            }
            //verif sexe
            if (!in_array($sexe, ['homme', 'femme'])) {
                setAlert('le sexe n\'est pas valide, tu as essayé d\'escroquer salopard', 'danger');
                $ok = 0;
            }
            /* Verification nom/prenom */
            if (empty($prenom) || empty($nom)) {
                setAlert('Le nom et le prénom doivent contenir des lettres', 'danger');
                $ok = 0;
            }
            //Verif date de naissance
            if ($jour == 1 && $mois == 01 && $annee == 2015 || !checkdate($mois, $jour, $annee) || time() - mktime(0, 0, 0, $mois, $jour, $annee) < 0) {
                setAlert('Veuillez modifier la date de naissance', 'danger');
                $ok = 0;
            }
            /* Verif email */
            if (!filter_var($mail, FILTER_VALIDATE_EMAIL)) {
                setAlert('Email non valide', 'danger');
                $ok = 0;
            } else {
                if (mail_exist($mail)) {
                    setAlert('Adresse mail existe déjà', 'danger');
                    $ok = 0;
                }
            }
            //verification que les mots de passe correspondent
            if ($mdp !== $cmdp) {
                setAlert('Les mots de passe ne correspondent pas', 'danger');
                $ok = 0;
            }
            if ($mdp <= "4" && $cmdp <= "4") {
                setAlert('Le mot de passe doit faire 4 caractère minimum.', 'danger');
                $ok = 0;
            }
            if ($ok) {
                //Requete sql
                $mdp = md5($mdp);
                if (!add_user($sexe, $nom, $prenom, $pseudo, $mail, $mdp, $annee . '-' . $mois . '-' . $jour)) {
                    setAlert('Erreur', 'danger');
                } else {
                    setAlert('Vous êtes bien inscrit.', 'success');
                    $_SESSION['pseudo'] = $pseudo;
                    header('Refresh:5; url=home');
                }
            }
        }
    }
    render('inscription', 'user');
}
예제 #29
0
<?php

require_once 'includes/header.php';
if (isset($_POST['slack_email'])) {
    $sendSlackInvite = sendSlackInvite($_POST['slack_email'], $user->getUsername(), $settings->getSlackAuthToken());
    if ($sendSlackInvite) {
        setAlert('success', 'Slack Invitation Sent', 'Check your email for your Slack invite, and remember to register with your Auth username (replacing spaces with underscores).');
    }
}
?>
<div class="opaque-container">

    <div class="row" style="width: 100%; margin-top: 20px; margin-bottom: 20px">
		<div class="col-md-12 opaque-section" style="padding: 0px">
			<div class="row box-title-section">
				<h1 style="text-align: center">External Services Authentication</h1>
			</div>
			<?php 
showAlerts();
?>
			<div class="row" style="padding-left: 10px; padding-right: 10px; padding-top: 15px; padding-bottom: 15px">
				<!-- Voice Comms -->
				<div class="col-md-4 col-sm-12">
					<div class="row opaque-section" style="background-image: none; background-color: transparent">
						<div class="row box-title-section">
							<h3 style="text-align: center"><?php 
echo $settings->getGroupTicker() . ' ' . $settings->getVoiceCommunications();
?>
</h3>
							<h4 style="text-align: center; color: #01b43a">Synced</h4>
						</div>
예제 #30
0
 public function testAPIKeyStatus($exception)
 {
     // Testing the exception text to see if it was a connection error to the API server
     if (strpos($exception, 'ConnectionException') !== FALSE) {
         // Setting the alert to indicate the error exists
         setAlert('danger', 'API Server Unavailable', 'Unable to connect to the API server to fetch information for ' . $this->characterID);
         // Taking the current time and subtracting 45 minutes from it to make ALL cronjobs wait 15 minutes before attempting to connect again.
         $delayedCronTime = time() - 2700;
         // Updating the cron to push back checking all keys by 15 minutes.
         $stmt = $this->db->prepare('UPDATE core_cron SET cron_updated = ? WHERE 1=1');
         $stmt->execute(array($delayedCronTime));
         return FALSE;
     } else {
         // Updating the cronjob to not pull this again
         $stmt = $this->db->prepare('UPDATE core_cron SET cron_status = 0 WHERE api_keyID = ?');
         $stmt->execute(array($this->keyID));
         // Disabling the key.
         $stmt = $this->db->prepare('UPDATE user_apikeys SET keystatus = 0 WHERE userid = ?');
         $stmt->execute(array($this->keyID));
         // Adding the error output to our error_logging DB table
         $stmt = $this->db->prepare('INSERT INTO error_logging (userid,characters,errortext) VALUES (?,?,?) ON DUPLICATE KEY UPDATE errortext=VALUES(errortext)');
         $stmt->execute(array($this->keyID, $this->characterID, $exception));
         setAlert('danger', 'Error Processing Character', 'There has been an error processing one of the characters on this API Key. Please see your Admin/CEO for correction.');
         return FALSE;
     }
 }