fix login to use goo
This commit is contained in:
parent
014e9011b9
commit
87410d5f09
93
api2.php
93
api2.php
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$TESTSITE = 1;
|
$TESTSITE = 1;
|
||||||
|
|
||||||
if ($TESTSITE) {
|
if ($TESTSITE) {
|
||||||
$DBUser = 'phowell'; $DBServer = '192.168.1.6';
|
$DBUser = 'phowell'; $DBServer = '192.168.1.6';
|
||||||
|
|
@ -55,94 +55,7 @@ function multi_row_1d($qry) { global $c;
|
||||||
return $savedArray; }
|
return $savedArray; }
|
||||||
|
|
||||||
|
|
||||||
// _____ _____ _ _ _____ _ ______ _ ____ _ _
|
include('single_sign_on.php');
|
||||||
// / ____|_ _| \ | |/ ____| | | ____| (_) / __ \| \ | |
|
|
||||||
// | (___ | | | \| | | __| | | |__ ___ _ __ _ _ __ | | | | \| |
|
|
||||||
// \___ \ | | | . ` | | |_ | | | __| / __| |/ _` | '_ \ | | | | . ` |
|
|
||||||
// ____) |_| |_| |\ | |__| | |____| |____ \__ \ | (_| | | | | | |__| | |\ |
|
|
||||||
// |_____/|_____|_| \_|\_____|______|______| |___/_|\__, |_| |_| \____/|_| \_|
|
|
||||||
// __/ |
|
|
||||||
// |___/
|
|
||||||
// SSO
|
|
||||||
//
|
|
||||||
// Set GLOBAL VARS corresponding to current logged in user.
|
|
||||||
// They may only edit their own dir info.
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ( $server == 'intranet1.gavilan.edu' ) { // The SSO check should have happened on the actual page. If it gets
|
|
||||||
// // stuck on an api call the app will break.
|
|
||||||
if ( session_id() == '' ) { // session_status() == PHP_SESSION_ACTIVE // newer php uses this
|
|
||||||
require 'mAuth.php';
|
|
||||||
$USER_TYPE = $attributes['http://wso2.org/claims/Roles'][0];
|
|
||||||
$USER_GOO = $attributes['http://wso2.org/claims/uid'][0];
|
|
||||||
$USER_EMAIL = $attributes['http://wso2.org/claims/emailaddress'][0];
|
|
||||||
?>
|
|
||||||
<!--
|
|
||||||
<?php print_r($attributes); ?>
|
|
||||||
-->
|
|
||||||
<?php
|
|
||||||
session_start();
|
|
||||||
$_SESSION['USER_TYPE'] = $USER_TYPE;
|
|
||||||
$_SESSION['USER_GOO'] = $USER_GOO;
|
|
||||||
$_SESSION['USER_EMAIL'] = $USER_EMAIL;
|
|
||||||
} else { // already logged in....
|
|
||||||
$USER_TYPE = $_SESSION['USER_TYPE'];
|
|
||||||
$USER_GOO = $_SESSION['USER_GOO'];
|
|
||||||
$USER_EMAIL = $_SESSION['USER_EMAIL'];
|
|
||||||
}
|
|
||||||
} else { // just testing on a different server...
|
|
||||||
$USER_TYPE = 'FACULTY'; $USER_GOO = 'G00102586'; $USER_EMAIL = 'phowell@gavilan.edu';
|
|
||||||
session_start();
|
|
||||||
$_SESSION['USER_TYPE'] = $USER_TYPE;
|
|
||||||
$_SESSION['USER_GOO'] = $USER_GOO;
|
|
||||||
$_SESSION['USER_EMAIL'] = $USER_EMAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// No email? Might be a problem. Look up by goo
|
|
||||||
if (! $USER_EMAIL) {
|
|
||||||
$goo = substr($USER_GOO, 3);
|
|
||||||
$q0 = "SELECT email,name FROM conf_users WHERE goo='{$goo}'";
|
|
||||||
$temp_usr = single_row_select($q0,0);
|
|
||||||
$USER_NAME = '';
|
|
||||||
|
|
||||||
// Is this a "MISSING USER?" Create an account for them.
|
|
||||||
if (is_null($temp_usr)) {
|
|
||||||
$LC_EMAIL = strtolower($USER_EMAIL);
|
|
||||||
$result = single_row_insert("INSERT INTO conf_users (goo, email, name) VALUES ('{$goo}','{$LC_EMAIL}','{$USER_NAME}');");
|
|
||||||
//echo "INSERT INTO conf_users (goo, email, name) VALUES ('{$goo}','{$LC_EMAIL}','{$USER_NAME}');";
|
|
||||||
//print_r($result);
|
|
||||||
//$logaction = log_it("Made a new conf_users row for {$USER_NAME} / {$LC_EMAIL} / {$USER_GOO}");
|
|
||||||
}
|
|
||||||
$USER_NAME = $temp_usr['name'];
|
|
||||||
$USER_EMAIL = strtolower($temp_usr['email']);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Set up user global
|
|
||||||
$usr_qry = "SELECT id AS conf_id, goo AS conf_goo, email AS conf_email, name AS conf_name, active AS conf_active FROM conf_users WHERE LOWER(email)='{$USER_EMAIL}'";
|
|
||||||
$USER = single_row_select($usr_qry, 0);
|
|
||||||
|
|
||||||
// Check again for missing user entry. Create an account for them.
|
|
||||||
if (is_null($USER)) {
|
|
||||||
$LC_EMAIL = strtolower($USER_EMAIL);
|
|
||||||
$goo = substr($USER_GOO, 3);
|
|
||||||
$USER_NAME = '';
|
|
||||||
$result = single_row_insert("INSERT INTO conf_users (goo, email, name) VALUES ('{$goo}','{$LC_EMAIL}','{$USER_NAME}');");
|
|
||||||
//echo "INSERT INTO conf_users (goo, email, name) VALUES ('{$goo}','{$LC_EMAIL}','{$USER_NAME}');";
|
|
||||||
//print_r($result);
|
|
||||||
//$logaction = log_it("Made a new conf_users row for {$USER_NAME} / {$LC_EMAIL} / {$USER_GOO}");
|
|
||||||
$usr_qry = "SELECT id AS conf_id, goo AS conf_goo, email AS conf_email, name AS conf_name, active AS conf_active FROM conf_users WHERE LOWER(email)='{$USER_EMAIL}'";
|
|
||||||
$USER = single_row_select($usr_qry, 0);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -361,7 +274,7 @@ function set_sessioninfo() {
|
||||||
$q = substr($q, 0, -2);
|
$q = substr($q, 0, -2);
|
||||||
$q .= $WHERECLAUSE;
|
$q .= $WHERECLAUSE;
|
||||||
single_row_update($q,0);
|
single_row_update($q,0);
|
||||||
echo json_encode( array("rawvalstr"=>$_REQUEST['vals'], "result"=>"success","action"=>"updated", "query"=>$q,"err"=>mysqli_error($c2)));
|
echo json_encode( array("rawvalstr"=>$_REQUEST['vals'], "result"=>"success","action"=>"updated", "query"=>$q,"err"=>mysqli_error($c)));
|
||||||
} else {
|
} else {
|
||||||
echo json_encode( array("result"=>"fail", "err"=>"no activity id specified") ); }
|
echo json_encode( array("result"=>"fail", "err"=>"no activity id specified") ); }
|
||||||
exit();
|
exit();
|
||||||
|
|
|
||||||
472
dir_api.php
472
dir_api.php
|
|
@ -11,48 +11,30 @@ $DEBUG = 0;
|
||||||
// \__|_| |_|\___| |_____/_/ \_\_/_/ \_\_.__/ \__,_|___/\___|
|
// \__|_| |_|\___| |_____/_/ \_\_/_/ \_\_.__/ \__,_|___/\___|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// DATABASE
|
|
||||||
//
|
|
||||||
// Yes, there's two different databases.
|
|
||||||
//
|
|
||||||
// $c = gavi_db
|
|
||||||
// $c2 = PeterDB
|
|
||||||
//
|
|
||||||
// Why? Just to keep you on your toes.
|
|
||||||
//
|
|
||||||
// also, there's 3 different tables that have people/users. Why? Reasons. Which mostly no longer apply.
|
|
||||||
// I recommend combining conf_users and gavi_personnel_ext so at least there's
|
|
||||||
// one less opportunity to get out of sync.
|
|
||||||
//
|
|
||||||
//
|
//
|
||||||
// The $j argument is true for a json result, or false for a raw db object result.
|
// The $j argument is true for a json result, or false for a raw db object result.
|
||||||
//
|
//
|
||||||
|
|
||||||
$TESTSITE = 1;
|
$TESTSITE = 1;
|
||||||
|
|
||||||
if ($TESTSITE) {
|
if ($TESTSITE) {
|
||||||
$DBServer = '192.168.1.6'; $DBUser = 'phowell';
|
$DBUser2 = 'phowell'; $DBServer = '192.168.1.6';
|
||||||
$DBPass = 'rolley34'; $DBName = 'db';
|
|
||||||
|
|
||||||
$DBUser2 = 'phowell';
|
|
||||||
$DBPass2 = 'rolley34'; $DBName2 = 'db';
|
$DBPass2 = 'rolley34'; $DBName2 = 'db';
|
||||||
} else {
|
} else {
|
||||||
$DBServer = 'localhost'; $DBUser = 'www';
|
$DBUser2 = 'phowell'; $DBServer = 'localhost';
|
||||||
$DBPass = '@$df'; $DBName = 'gavi_db';
|
|
||||||
|
|
||||||
$DBUser2 = 'phowell';
|
|
||||||
$DBPass2 = 'p^howell'; $DBName2 = 'PeterDB';
|
$DBPass2 = 'p^howell'; $DBName2 = 'PeterDB';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* # not using www account anymore
|
||||||
$c = new mysqli($DBServer, $DBUser, $DBPass, $DBName);
|
$c = new mysqli($DBServer, $DBUser, $DBPass, $DBName);
|
||||||
if ($c->connect_error) { die('Database connection failed: ' . $c->connect_error ); }
|
if ($c->connect_error) { die('Database connection failed: ' . $c->connect_error ); }
|
||||||
if (!mysqli_select_db($c, $DBName)) { die("Uh oh, couldn't select database $DBName"); }
|
if (!mysqli_select_db($c, $DBName)) { die("Uh oh, couldn't select database $DBName"); }
|
||||||
|
*/
|
||||||
|
|
||||||
$c2 = new mysqli($DBServer, $DBUser2, $DBPass2, $DBName2);
|
$c = new mysqli($DBServer, $DBUser2, $DBPass2, $DBName2);
|
||||||
if ($c2->connect_error) { die('Database connection failed: ' . $c2->connect_error ); }
|
if ($c->connect_error) { die('Database connection failed: ' . $c->connect_error ); }
|
||||||
if (!mysqli_select_db($c2, $DBName2)) { die("Uh oh, couldn't select database 'PeterDB'"); }
|
if (!mysqli_select_db($c, $DBName2)) { die("Uh oh, couldn't select database 'PeterDB'"); }
|
||||||
mysqli_set_charset($c, 'utf8');
|
mysqli_set_charset($c, 'utf8');
|
||||||
mysqli_set_charset($c2, 'utf8');
|
|
||||||
|
|
||||||
include('underscore.php');
|
include('underscore.php');
|
||||||
$_ = new __();
|
$_ = new __();
|
||||||
|
|
@ -82,18 +64,18 @@ function logout() { session_destroy(); }
|
||||||
|
|
||||||
$server = $_SERVER['SERVER_NAME'];
|
$server = $_SERVER['SERVER_NAME'];
|
||||||
$options_query = "SELECT label,value FROM `conf_uinforecord` WHERE id>1";
|
$options_query = "SELECT label,value FROM `conf_uinforecord` WHERE id>1";
|
||||||
$options_array = multi_row_select($options_query, 0, $c2);
|
$options_array = multi_row_select($options_query, 0);
|
||||||
|
|
||||||
$OPTIONS = array_reduce($options_array, function ($result, $item) {
|
$OPTIONS = array_reduce($options_array, function ($result, $item) {
|
||||||
$result[$item["label"]] = $item["value"];
|
$result[$item["label"]] = $item["value"];
|
||||||
return $result; }, array());
|
return $result; }, array());
|
||||||
|
|
||||||
$default_ay_query = "SELECT begin,end FROM conf_academicyears ca JOIN conf_uinforecord cu ON cu.value=ca.id WHERE cu.label='default_ay';";
|
$default_ay_query = "SELECT begin,end FROM conf_academicyears ca JOIN conf_uinforecord cu ON cu.value=ca.id WHERE cu.label='default_ay';";
|
||||||
$AY = single_row_select($default_ay_query,0, $c2);
|
$AY = single_row_select($default_ay_query,0);
|
||||||
$OPTIONS['year'] = $AY;
|
$OPTIONS['year'] = $AY;
|
||||||
|
|
||||||
$conf_query = "SELECT semester,date1,date2,title FROM conf_conferences cc JOIN conf_uinforecord cu ON cu.value=cc.id WHERE cu.label='default_conference';";
|
$conf_query = "SELECT semester,date1,date2,title FROM conf_conferences cc JOIN conf_uinforecord cu ON cu.value=cc.id WHERE cu.label='default_conference';";
|
||||||
$CONF = single_row_select($conf_query,0, $c2);
|
$CONF = single_row_select($conf_query,0);
|
||||||
$OPTIONS['conf'] = $CONF;
|
$OPTIONS['conf'] = $CONF;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -109,7 +91,7 @@ function name_to_file($fn,$ln) {
|
||||||
|
|
||||||
|
|
||||||
// 1. lookups, like a username
|
// 1. lookups, like a username
|
||||||
function single_row_select($qry, $j, $c) {
|
function single_row_select($qry, $j) { global $c;
|
||||||
$r = mysqli_query($c, $qry); d_err($qry);
|
$r = mysqli_query($c, $qry); d_err($qry);
|
||||||
$e = mysqli_error($c); if($e) { d_err("sql error: " . $e ); }
|
$e = mysqli_error($c); if($e) { d_err("sql error: " . $e ); }
|
||||||
if (!$r) { return $r; }
|
if (!$r) { return $r; }
|
||||||
|
|
@ -119,7 +101,7 @@ function single_row_select($qry, $j, $c) {
|
||||||
if (! $j) { return $a; } return json_encode($a); }
|
if (! $j) { return $a; } return json_encode($a); }
|
||||||
|
|
||||||
// 1a. inserts
|
// 1a. inserts
|
||||||
function single_row_insert($qry, $j, $c) {
|
function single_row_insert($qry, $j) { global $c;
|
||||||
$r = mysqli_query($c, $qry);
|
$r = mysqli_query($c, $qry);
|
||||||
//d_err($qry);
|
//d_err($qry);
|
||||||
//$e = mysqli_error($c); if($e) { d_err("sql error: " . $e ); }
|
//$e = mysqli_error($c); if($e) { d_err("sql error: " . $e ); }
|
||||||
|
|
@ -131,25 +113,25 @@ function single_row_insert($qry, $j, $c) {
|
||||||
if (! $j) { return $a; } return json_encode($a); } */
|
if (! $j) { return $a; } return json_encode($a); } */
|
||||||
|
|
||||||
// 1b. updates
|
// 1b. updates
|
||||||
function single_row_update($qry, $j, $c) {
|
function single_row_update($qry, $j) { global $c;
|
||||||
$r = mysqli_query($c, $qry);
|
$r = mysqli_query($c, $qry);
|
||||||
return 1; }
|
return 1; }
|
||||||
|
|
||||||
// 2. grid or fancier joins, like get all sessions, rosters, todos, etc
|
// 2. grid or fancier joins, like get all sessions, rosters, todos, etc
|
||||||
function multi_row_select($qry, $j, $db) {
|
function multi_row_select($qry, $j) { global $c;
|
||||||
$rows = array();
|
$rows = array();
|
||||||
$result = mysqli_query($db, $qry);
|
$result = mysqli_query($c, $qry);
|
||||||
while($r = mysqli_fetch_assoc($result)) { $rows[] = $r; }
|
while($r = mysqli_fetch_assoc($result)) { $rows[] = $r; }
|
||||||
if (! $j) { return $rows; } return json_encode( $rows); }
|
if (! $j) { return $rows; } return json_encode( $rows); }
|
||||||
|
|
||||||
// 3. Check if an entry exists
|
// 3. Check if an entry exists
|
||||||
function does_exist($qry, $full_record, $db) { global $c, $c2;
|
function does_exist($qry, $full_record) { global $c;
|
||||||
$r = mysqli_query($db, $qry);
|
$r = mysqli_query($c, $qry);
|
||||||
$a = mysqli_num_rows($r);
|
$a = mysqli_num_rows($r);
|
||||||
if (! $a ) { return 0; }
|
if (! $a ) { return 0; }
|
||||||
$row = mysqli_fetch_array($r, MYSQLI_NUM);
|
$row = mysqli_fetch_array($r, MYSQLI_NUM);
|
||||||
$id = $row[0]; // getting the id of that which exists... assuming first column has it.
|
$id = $row[0]; // getting the id of that which exists... assuming first column has it.
|
||||||
$e = mysqli_error($db); if($e) { d_err("sql error: " . $e); }
|
$e = mysqli_error($c); if($e) { d_err("sql error: " . $e); }
|
||||||
if ($a && $full_record) { return $row; } if ($a) { return $id; } return 0; }
|
if ($a && $full_record) { return $row; } if ($a) { return $id; } return 0; }
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -160,14 +142,14 @@ function does_exist($qry, $full_record, $db) { global $c, $c2;
|
||||||
// //
|
// //
|
||||||
// // Enter or get browser log entry
|
// // Enter or get browser log entry
|
||||||
function insert_or_get_browser($b) {
|
function insert_or_get_browser($b) {
|
||||||
global $c2;
|
global $c;
|
||||||
$BROWSER = ok($b);
|
$BROWSER = ok($b);
|
||||||
$existing = does_exist( "SELECT id FROM www_browsers WHERE string='$BROWSER'", 0, $c2);
|
$existing = does_exist( "SELECT id FROM www_browsers WHERE string='$BROWSER'", 0);
|
||||||
if ($existing) { return $existing;
|
if ($existing) { return $existing;
|
||||||
} else {
|
} else {
|
||||||
$q = "INSERT INTO www_browsers (string) VALUES ('$BROWSER')";
|
$q = "INSERT INTO www_browsers (string) VALUES ('$BROWSER')";
|
||||||
single_row_insert($q,0,$c2);
|
single_row_insert($q,0,$c);
|
||||||
return does_exist( "SELECT id FROM www_browsers WHERE string='$BROWSER'",0,$c2); } }
|
return does_exist( "SELECT id FROM www_browsers WHERE string='$BROWSER'",0,$c); } }
|
||||||
|
|
||||||
function dumpit($var) {
|
function dumpit($var) {
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
@ -176,25 +158,6 @@ function dumpit($var) {
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
return $a;
|
return $a;
|
||||||
}
|
}
|
||||||
// //
|
|
||||||
// // Log everything!
|
|
||||||
function log_it($action) {
|
|
||||||
global $USER, $USER_GOO, $USER_EMAIL, $c2;
|
|
||||||
//echo("\n<!--\n" . json_encode($USER) . "\n-->\n\n");
|
|
||||||
|
|
||||||
if (! $USER) {
|
|
||||||
$USER = array( 'user_id'=>'unknown', 'id'=>-1 ); }
|
|
||||||
$user_browser = $_SERVER['HTTP_USER_AGENT'];
|
|
||||||
$user_ip = $_SERVER['REMOTE_ADDR'];
|
|
||||||
|
|
||||||
$BROWSER = insert_or_get_browser($user_browser);
|
|
||||||
$ACTION = ok($action) . " / " . dumpit($USER) . " / " . $USER_GOO . " / " . $USER_EMAIL;
|
|
||||||
|
|
||||||
//$persid = $USER->id;
|
|
||||||
//if (! $persid) { $persid = -1; }
|
|
||||||
$qupdate = "INSERT INTO gavi_logs SET action='{$ACTION}', " /*personnel_id='{$persid}',name='{$USER->user_id}', */ . "browser=$BROWSER, ip='$user_ip'";
|
|
||||||
single_row_insert($qupdate,0,$c2);
|
|
||||||
return array("result"=>"success","action"=>"logged","query"=>$qupdate,"err"=>mysqli_error($c2)); }
|
|
||||||
|
|
||||||
|
|
||||||
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // //
|
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // //
|
||||||
|
|
@ -248,151 +211,8 @@ function check_dir_photo($fn,$ln) { global $USER;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////
|
|
||||||
/////
|
|
||||||
//
|
|
||||||
// Insert new user
|
|
||||||
//
|
|
||||||
// For whatever reason, we haven't seen this person before. Insert their conf_user row
|
|
||||||
// so they can have their choices recorded.
|
|
||||||
//
|
|
||||||
function insert_new_user() { global $USER, $USER_EMAIL, $USER_GOO, $USER_NAME, $USER_PERS_ID, $USER_CONF_U_ID, $USER_PERS_EXT_ID, $c, $c2;
|
|
||||||
$LC_EMAIL = strtolower($USER_EMAIL);
|
|
||||||
single_row_insert("INSERT INTO conf_users (goo, email, name) VALUES ('{$USER_GOO}','{$LC_EMAIL}','{$USER_NAME}');", 1, $c2);
|
|
||||||
$logaction = log_it("Made a new conf_users row for {$USER_NAME} / {$LC_EMAIL} / {$USER_GOO}");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // //
|
|
||||||
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // //
|
|
||||||
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // //
|
|
||||||
//
|
|
||||||
// Fetching a person's records
|
|
||||||
//
|
|
||||||
// 1. use their email to lookup PERSONNEL
|
|
||||||
// - basic directory info
|
|
||||||
//
|
|
||||||
// 2. use their email to lookup CONF_USERS
|
|
||||||
// - flex app, workshop signups
|
|
||||||
//
|
|
||||||
// 3. use conf_users.id to lookup in gavi_personnel_ext.c_users
|
|
||||||
// - goo, depts, job title, image active
|
|
||||||
//
|
|
||||||
// 4. use personnel.id to lookup [webpages, welcomepages, etc]
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Ultimately the user's data goes into the global $USER
|
|
||||||
|
|
||||||
function user_record() { global $USER, $USER_EMAIL, $USER_GOO, $USER_NAME, $USER_PERS_ID, $USER_CONF_U_ID, $USER_PERS_EXT_ID, $c, $c2;
|
|
||||||
$LC_EMAIL = strtolower($USER_EMAIL);
|
|
||||||
|
|
||||||
if (! $USER_EMAIL) {
|
|
||||||
$goo = substr($USER_GOO, 3);
|
|
||||||
$q0 = "SELECT email FROM conf_users WHERE goo='{$goo}'";
|
|
||||||
$temp_usr = single_row_select($q0,0,$c2);
|
|
||||||
|
|
||||||
if (is_null($temp_usr)) {
|
|
||||||
// we have a new user here...
|
|
||||||
// and the missing email might be a problem....
|
|
||||||
insert_new_user();
|
|
||||||
}
|
|
||||||
//echo($goo);
|
|
||||||
//print_r($temp_usr);
|
|
||||||
//echo($temp_usr->email);
|
|
||||||
//echo("\n");
|
|
||||||
$LC_EMAIL = strtolower($temp_usr['email']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$usr_check = single_row_select("SELECT id FROM conf_users WHERE LOWER(email)='{$LC_EMAIL}';",0,$c2);
|
|
||||||
if (is_null($usr_check)) {
|
|
||||||
// we have a new user here...
|
|
||||||
insert_new_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
//$q1 = "SELECT last_name, first_name, department, extension, phone_number, email, room, user_id, time_updated, id, web_on, status FROM personnel WHERE LOWER(email)='{$LC_EMAIL}'";
|
|
||||||
//$usr_dir = single_row_select($q1, 0, $c);
|
|
||||||
|
|
||||||
$q2 = "SELECT id AS conf_id, goo AS conf_goo, email AS conf_email, name AS conf_name, active AS conf_active FROM conf_users WHERE LOWER(email)='{$LC_EMAIL}'";
|
|
||||||
$USER = single_row_select($q2, 0, $c2);
|
|
||||||
//$mega = $_->extend( (object) $usr_dir, (object) $usr_conf );
|
|
||||||
|
|
||||||
//$q3 = 'SELECT id AS ext_id, personnel AS personnel_id, role, goo_short, c_users AS c_users_id_ext, ilearn_id, sched_alias, dept1, dept2, gtitle, active, use_dir_photo, general_photo_release, etc, espanol, zoom, preferred_contact FROM gavi_personnel_ext WHERE personnel=' . $mega->id . ';'; // c_users={$mega->conf_id}';
|
|
||||||
//$usr_ext = single_row_select($q3,0,$c2);
|
|
||||||
//$mega = $_->extend( (object) $mega, (object) $usr_ext );
|
|
||||||
|
|
||||||
//$q4 = 'SELECT person, officehours, title, picture, education, bio, courses, personal_page, changed FROM webpages WHERE person=' . $mega->id . ';'; // '{$mega->id}'"; // personnel=1');
|
|
||||||
//$usr_web = single_row_select($q4,0,$c);
|
|
||||||
//$mega = $_->extend( (object) $mega, (object) $usr_web );
|
|
||||||
//$USER = $mega;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// _____ _____ _ _ _____ _ ______ _ ____ _ _
|
|
||||||
// / ____|_ _| \ | |/ ____| | | ____| (_) / __ \| \ | |
|
|
||||||
// | (___ | | | \| | | __| | | |__ ___ _ __ _ _ __ | | | | \| |
|
|
||||||
// \___ \ | | | . ` | | |_ | | | __| / __| |/ _` | '_ \ | | | | . ` |
|
|
||||||
// ____) |_| |_| |\ | |__| | |____| |____ \__ \ | (_| | | | | | |__| | |\ |
|
|
||||||
// |_____/|_____|_| \_|\_____|______|______| |___/_|\__, |_| |_| \____/|_| \_|
|
|
||||||
// __/ |
|
|
||||||
// |___/
|
|
||||||
// SSO
|
|
||||||
//
|
|
||||||
// Set GLOBAL VARS corresponding to current logged in user.
|
|
||||||
// They may only edit their own dir info.
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ( $server == 'intranet1.gavilan.edu' ) { // The SSO check should have happened on the actual page. If it gets
|
|
||||||
// // stuck on an api call the app will break.
|
|
||||||
if ( session_id() == '' ) { // session_status() == PHP_SESSION_ACTIVE // newer php uses this
|
|
||||||
require 'mAuth.php';
|
|
||||||
$USER_TYPE = $attributes['http://wso2.org/claims/Roles'][0];
|
|
||||||
$USER_GOO = $attributes['http://wso2.org/claims/uid'][0];
|
|
||||||
$USER_EMAIL = $attributes['http://wso2.org/claims/emailaddress'][0];
|
|
||||||
?>
|
|
||||||
<!--
|
|
||||||
<?php print_r($attributes); ?>
|
|
||||||
-->
|
|
||||||
<?php
|
|
||||||
session_start();
|
|
||||||
$_SESSION['USER_TYPE'] = $USER_TYPE;
|
|
||||||
$_SESSION['USER_GOO'] = $USER_GOO;
|
|
||||||
$_SESSION['USER_EMAIL'] = $USER_EMAIL;
|
|
||||||
} else { // already logged in....
|
|
||||||
$USER_TYPE = $_SESSION['USER_TYPE'];
|
|
||||||
$USER_GOO = $_SESSION['USER_GOO'];
|
|
||||||
$USER_EMAIL = $_SESSION['USER_EMAIL']; }
|
|
||||||
} else { // just testing on a different server...
|
|
||||||
$USER_TYPE = 'FACULTY'; $USER_GOO = 'G00102586'; $USER_EMAIL = 'phowell@gavilan.edu'; }
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Did the user AUTHENTICATE? ... then put their info into a global
|
|
||||||
//
|
|
||||||
|
|
||||||
if ($USER_GOO) {
|
|
||||||
user_record();
|
|
||||||
//check_dir_photo($USER->first_name, $USER->last_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
include('single_sign_on.php');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -504,20 +324,20 @@ function check_permission( $acting_user, $target_id, $table ) {
|
||||||
// Helper tables
|
// Helper tables
|
||||||
//
|
//
|
||||||
// JOB TITLES LIST
|
// JOB TITLES LIST
|
||||||
function job_titles() { global $c2;
|
function job_titles() { global $c;
|
||||||
return multi_row_select("SELECT DISTINCT id, name FROM gavi_titles ORDER BY name",1, $c2); }
|
return multi_row_select("SELECT DISTINCT id, name FROM gavi_titles ORDER BY name",1, $c); }
|
||||||
if (isset($_REQUEST['a']) && $_REQUEST['a']=='get/jobtitles') {
|
if (isset($_REQUEST['a']) && $_REQUEST['a']=='get/jobtitles') {
|
||||||
echo job_titles(); exit(); }
|
echo job_titles(); exit(); }
|
||||||
|
|
||||||
// all SUB MENUS
|
// all SUB MENUS
|
||||||
//
|
//
|
||||||
function sub_menus() { global $c2;
|
function sub_menus() { global $c;
|
||||||
$ddd = multi_row_select('SELECT * FROM gavi_departments ORDER BY name',0, $c2);
|
$ddd = multi_row_select('SELECT * FROM gavi_departments ORDER BY name',0, $c);
|
||||||
$ttt = multi_row_select('SELECT * FROM gavi_titles ORDER BY name',0, $c2);
|
$ttt = multi_row_select('SELECT * FROM gavi_titles ORDER BY name',0, $c);
|
||||||
$rrr = multi_row_select("SELECT * FROM gavi_roles ORDER BY 'descr'",0, $c2);
|
$rrr = multi_row_select("SELECT * FROM gavi_roles ORDER BY 'descr'",0, $c);
|
||||||
$ccc = multi_row_select('SELECT * FROM gavi_committees ORDER BY name',0, $c2);
|
$ccc = multi_row_select('SELECT * FROM gavi_committees ORDER BY name',0, $c);
|
||||||
$sss = multi_row_select('SELECT * FROM conf_sessiontypes ORDER BY id',0, $c2);
|
$sss = multi_row_select('SELECT * FROM conf_sessiontypes ORDER BY id',0, $c);
|
||||||
$ppp = multi_row_select("SELECT * FROM `conf_sessions` WHERE `type` = '20' OR `type` = '21' ORDER BY starttime",0, $c2);
|
$ppp = multi_row_select("SELECT * FROM `conf_sessions` WHERE `type` = '20' OR `type` = '21' ORDER BY starttime",0, $c);
|
||||||
|
|
||||||
|
|
||||||
return json_encode( array( 'departments'=>$ddd, 'titles'=>$ttt, 'roles'=>$rrr, 'committees'=>$ccc, 'sessiontypes'=>$sss, 'parents'=>$ppp ) ); }
|
return json_encode( array( 'departments'=>$ddd, 'titles'=>$ttt, 'roles'=>$rrr, 'committees'=>$ccc, 'sessiontypes'=>$sss, 'parents'=>$ppp ) ); }
|
||||||
|
|
@ -528,9 +348,9 @@ if (isset($_REQUEST['a']) && $_REQUEST['a']=='menus') { echo sub_menus(); exit()
|
||||||
// all NAMES
|
// all NAMES
|
||||||
//
|
//
|
||||||
function get_names() {
|
function get_names() {
|
||||||
global $c2, $AY, $USER;
|
global $c, $AY, $USER;
|
||||||
$q = "SELECT u.id, u.name FROM conf_users AS u ORDER BY u.name";
|
$q = "SELECT u.id, u.name FROM conf_users AS u ORDER BY u.name";
|
||||||
echo json_encode( array("users"=>multi_row_select($q,0,$c2), "result"=>"success","err"=>mysqli_error($c2)));
|
echo json_encode( array("users"=>multi_row_select($q,0,$c), "result"=>"success","err"=>mysqli_error($c)));
|
||||||
exit(); }
|
exit(); }
|
||||||
|
|
||||||
if (isset($_GET['a']) && $_GET['a'] == 'get/names') { get_names(); }
|
if (isset($_GET['a']) && $_GET['a'] == 'get/names') { get_names(); }
|
||||||
|
|
@ -539,8 +359,8 @@ if (isset($_GET['a']) && $_GET['a'] == 'get/names') { get_names(); }
|
||||||
// get most RECENT LOGS
|
// get most RECENT LOGS
|
||||||
//
|
//
|
||||||
function get_recent_logs() {
|
function get_recent_logs() {
|
||||||
global $c2, $USER;
|
global $c, $USER;
|
||||||
$my_sessions = multi_row_select("SELECT * FROM `gavi_logs` ORDER BY `id` DESC LIMIT 150",0,$c2);
|
$my_sessions = multi_row_select("SELECT * FROM `gavi_logs` ORDER BY `id` DESC LIMIT 150",0,$c);
|
||||||
echo json_encode($my_sessions);
|
echo json_encode($my_sessions);
|
||||||
exit(); }
|
exit(); }
|
||||||
if (isset($_GET['a']) && $_GET['a'] == 'get/logs') { get_recent_logs(); }
|
if (isset($_GET['a']) && $_GET['a'] == 'get/logs') { get_recent_logs(); }
|
||||||
|
|
@ -549,7 +369,7 @@ if (isset($_GET['a']) && $_GET['a'] == 'get/logs') { get_recent_logs(); }
|
||||||
// gavilan college EVENTS
|
// gavilan college EVENTS
|
||||||
//
|
//
|
||||||
function get_events() { global $c;
|
function get_events() { global $c;
|
||||||
echo json_encode( multi_row_select("SELECT * FROM events WHERE date >= CURDATE() AND visible='1' ORDER BY time LIMIT 6;",0, $c)); }
|
echo json_encode( multi_row_select("SELECT * FROM events WHERE date >= CURDATE() AND visible='1' ORDER BY time LIMIT 6;",0)); }
|
||||||
if (isset($_GET['a']) && $_GET['a'] == 'get/gavevents') { get_events(); exit(); }
|
if (isset($_GET['a']) && $_GET['a'] == 'get/gavevents') { get_events(); exit(); }
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -628,8 +448,8 @@ if (isset($_REQUEST['a']) && $_REQUEST['a']=='signups') {
|
||||||
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // //
|
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // //
|
||||||
//
|
//
|
||||||
// Courses in a semester
|
// Courses in a semester
|
||||||
function semester_sections() { global $c2;
|
function semester_sections() { global $c;
|
||||||
return multi_row_select("SELECT * FROM `gavi_sections` s WHERE s.sem='fa21' ORDER BY s.teacher_id",1, $c2); }
|
return multi_row_select("SELECT * FROM `gavi_sections` s WHERE s.sem='fa21' ORDER BY s.teacher_id",1, $c); }
|
||||||
if (isset($_REQUEST['a']) && $_REQUEST['a']=='list/semester') {
|
if (isset($_REQUEST['a']) && $_REQUEST['a']=='list/semester') {
|
||||||
echo semester_sections(); exit(); }
|
echo semester_sections(); exit(); }
|
||||||
|
|
||||||
|
|
@ -658,16 +478,16 @@ if (isset($_REQUEST['a']) && $_REQUEST['a']=='list/staffsemester') {
|
||||||
//
|
//
|
||||||
// SEARCH AN INSTRUCTOR BY NAME IN SCHEDULE
|
// SEARCH AN INSTRUCTOR BY NAME IN SCHEDULE
|
||||||
//
|
//
|
||||||
function get_instructor() { global $c2;
|
function get_instructor() { global $c;
|
||||||
$i = ok($_REQUEST['inst']);
|
$i = ok($_REQUEST['inst']);
|
||||||
echo json_encode( single_row_select("SELECT * FROM gavi_personnel_ext WHERE sched_alias='{$i}';",0, $c2));
|
echo json_encode( single_row_select("SELECT * FROM gavi_personnel_ext WHERE sched_alias='{$i}';",0));
|
||||||
exit(); }
|
exit(); }
|
||||||
if (isset($_REQUEST['a']) && $_REQUEST['a'] == 'get/instructor/name' ) { get_instructor(); }
|
if (isset($_REQUEST['a']) && $_REQUEST['a'] == 'get/instructor/name' ) { get_instructor(); }
|
||||||
|
|
||||||
function get_instructor_fuzzy() {
|
function get_instructor_fuzzy() {
|
||||||
global $c2;
|
global $c;
|
||||||
$i = ok($_REQUEST['inst']);
|
$i = ok($_REQUEST['inst']);
|
||||||
echo json_encode( single_row_select("SELECT * FROM gavi_personnel_ext WHERE sched_alias LIKE '{$i}';",0, $c2));
|
echo json_encode( single_row_select("SELECT * FROM gavi_personnel_ext WHERE sched_alias LIKE '{$i}';",0));
|
||||||
exit(); }
|
exit(); }
|
||||||
if (isset($_REQUEST['a']) && $_REQUEST['a'] == 'get/instructor/fuzzyname' ) { get_instructor_fuzzy(); }
|
if (isset($_REQUEST['a']) && $_REQUEST['a'] == 'get/instructor/fuzzyname' ) { get_instructor_fuzzy(); }
|
||||||
|
|
||||||
|
|
@ -678,7 +498,7 @@ if (isset($_REQUEST['a']) && $_REQUEST['a'] == 'get/instructor/fuzzyname' ) { ge
|
||||||
//
|
//
|
||||||
function get_sections($semester) { global $c;
|
function get_sections($semester) { global $c;
|
||||||
$semester = ok($semester);
|
$semester = ok($semester);
|
||||||
return multi_row_select("SELECT s.id,s.code,s.name,s.descr,s.teacher_id,s.days,s.start_date,s.end_date,s.units,s.ztc,s.location,s.delivery,s.status,s.pnp,s.note,s.crn,s.sem,p.personnel AS personnel_id,p.use_dir_photo,p.dir_photo_path,d.last_name,d.first_name,d.phone_number,d.email,d.room,d.web_on,s.sem FROM PeterDB.gavi_sections s LEFT JOIN PeterDB.gavi_personnel_ext p ON s.teacher_id=p.id LEFT JOIN personnel d ON d.id=p.personnel WHERE sem='{$semester}' ORDER BY code;",0, $c); }
|
return multi_row_select("SELECT s.id,s.code,s.name,s.descr,s.teacher_id,s.days,s.start_date,s.end_date,s.units,s.ztc,s.location,s.delivery,s.status,s.pnp,s.note,s.crn,s.sem,p.personnel AS personnel_id,p.use_dir_photo,p.dir_photo_path,d.last_name,d.first_name,d.phone_number,d.email,d.room,d.web_on,s.sem FROM PeterDB.gavi_sections s LEFT JOIN PeterDB.gavi_personnel_ext p ON s.teacher_id=p.id LEFT JOIN personnel d ON d.id=p.personnel WHERE sem='{$semester}' ORDER BY code;",0); }
|
||||||
if (isset($_REQUEST['a']) && preg_match('/^get\/sections\/(\w\w\d\d)$/', $_REQUEST['a'], $matches)) { echo json_encode( get_sections( $matches[1] ) ); exit(); }
|
if (isset($_REQUEST['a']) && preg_match('/^get\/sections\/(\w\w\d\d)$/', $_REQUEST['a'], $matches)) { echo json_encode( get_sections( $matches[1] ) ); exit(); }
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -687,7 +507,7 @@ if (isset($_REQUEST['a']) && preg_match('/^get\/sections\/(\w\w\d\d)$/', $_REQUE
|
||||||
// all COURSE SECTIONS by semester and crn only
|
// all COURSE SECTIONS by semester and crn only
|
||||||
//
|
//
|
||||||
function get_all_sections() { global $c;
|
function get_all_sections() { global $c;
|
||||||
echo json_encode( multi_row_select("SELECT s.id,s.code,s.crn,s.sem,s.teacher_id,s.delivery,s.status,p.personnel AS personnel_id,d.last_name,d.first_name FROM PeterDB.gavi_sections s LEFT JOIN PeterDB.gavi_personnel_ext p ON s.teacher_id=p.id LEFT JOIN personnel d ON d.id=p.personnel ORDER BY sem,code;",0, $c));
|
echo json_encode( multi_row_select("SELECT s.id,s.code,s.crn,s.sem,s.teacher_id,s.delivery,s.status,p.personnel AS personnel_id,d.last_name,d.first_name FROM PeterDB.gavi_sections s LEFT JOIN PeterDB.gavi_personnel_ext p ON s.teacher_id=p.id LEFT JOIN personnel d ON d.id=p.personnel ORDER BY sem,code;",0));
|
||||||
exit(); }
|
exit(); }
|
||||||
if (isset($_REQUEST['a']) && $_REQUEST['a'] == 'get/sections') { get_all_sections(); }
|
if (isset($_REQUEST['a']) && $_REQUEST['a'] == 'get/sections') { get_all_sections(); }
|
||||||
|
|
||||||
|
|
@ -700,7 +520,7 @@ if (isset($_REQUEST['a']) && $_REQUEST['a'] == 'get/sections') { get_all_section
|
||||||
//
|
//
|
||||||
function get_instructor_sections($teacherid) {
|
function get_instructor_sections($teacherid) {
|
||||||
global $c;
|
global $c;
|
||||||
echo json_encode( multi_row_select("SELECT s.id,s.code,s.name,s.descr,s.teacher_id,s.days,s.times,s.link,s.start_date,s.end_date,s.units,s.ztc,s.location,s.delivery,s.xlist_to,s.status,s.pnp,s.note,s.crn,s.sem,s.year FROM PeterDB.gavi_sections s WHERE s.teacher_id='{$teacherid}' ORDER BY s.sem,s.code;",0, $c));
|
echo json_encode( multi_row_select("SELECT s.id,s.code,s.name,s.descr,s.teacher_id,s.days,s.times,s.link,s.start_date,s.end_date,s.units,s.ztc,s.location,s.delivery,s.xlist_to,s.status,s.pnp,s.note,s.crn,s.sem,s.year FROM PeterDB.gavi_sections s WHERE s.teacher_id='{$teacherid}' ORDER BY s.sem,s.code;",0));
|
||||||
exit(); }
|
exit(); }
|
||||||
if (isset($_REQUEST['a']) && preg_match('/^get\/sections\/(\d+)$/', $_REQUEST['a'], $matches)) {
|
if (isset($_REQUEST['a']) && preg_match('/^get\/sections\/(\d+)$/', $_REQUEST['a'], $matches)) {
|
||||||
get_instructor_sections( $matches[1] ); }
|
get_instructor_sections( $matches[1] ); }
|
||||||
|
|
@ -714,19 +534,19 @@ if (isset($_REQUEST['a']) && preg_match('/^get\/sections\/(\d+)$/', $_REQUEST['a
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
function get_section($sem,$crn) {
|
function get_section($sem,$crn) {
|
||||||
global $c, $c2;
|
global $c, $c;
|
||||||
$sem = ok($sem);
|
$sem = ok($sem);
|
||||||
$crn = ok($crn);
|
$crn = ok($crn);
|
||||||
$sched_id = 0;
|
$sched_id = 0;
|
||||||
|
|
||||||
$sched_entry = single_row_select( "SELECT * FROM PeterDB.gavi_sections gs WHERE sem='{$sem}' AND crn='{$crn}';",0, $c2);
|
$sched_entry = single_row_select( "SELECT * FROM PeterDB.gavi_sections gs WHERE sem='{$sem}' AND crn='{$crn}';",0);
|
||||||
if ($sched_entry) {
|
if ($sched_entry) {
|
||||||
$sched_id = $sched_entry['id']; }
|
$sched_id = $sched_entry['id']; }
|
||||||
else {
|
else {
|
||||||
echo json_encode( array( "result"=>"fail", "reason"=>"no row for that section {$sem} {$crn}.") );
|
echo json_encode( array( "result"=>"fail", "reason"=>"no row for that section {$sem} {$crn}.") );
|
||||||
exit(); }
|
exit(); }
|
||||||
|
|
||||||
$wl_entry = single_row_select( "SELECT s.id,s.code,s.name,s.descr,s.teacher_id,s.days,s.start_date,s.end_date,s.units,s.ztc,s.location,s.delivery,s.status,s.pnp,s.note,s.crn,s.sem,w.id AS wl_id,w.photo_path,w.format,w.length,w.course_desc,w.what_expect,w.assessments,w.textbook,w.other_info,w.introduction,w.additional_resources FROM PeterDB.gavi_welcome_letters w LEFT JOIN PeterDB.gavi_sections s ON w.section_id=s.id WHERE w.section_id='{$sched_id}';",0, $c2);
|
$wl_entry = single_row_select( "SELECT s.id,s.code,s.name,s.descr,s.teacher_id,s.days,s.start_date,s.end_date,s.units,s.ztc,s.location,s.delivery,s.status,s.pnp,s.note,s.crn,s.sem,w.id AS wl_id,w.photo_path,w.format,w.length,w.course_desc,w.what_expect,w.assessments,w.textbook,w.other_info,w.introduction,w.additional_resources FROM PeterDB.gavi_welcome_letters w LEFT JOIN PeterDB.gavi_sections s ON w.section_id=s.id WHERE w.section_id='{$sched_id}';",0);
|
||||||
|
|
||||||
if ($wl_entry) {
|
if ($wl_entry) {
|
||||||
echo json_encode($wl_entry);
|
echo json_encode($wl_entry);
|
||||||
|
|
@ -745,11 +565,11 @@ function get_section($sem,$crn) {
|
||||||
$default->additional_resources = okh($default->additional_resources);
|
$default->additional_resources = okh($default->additional_resources);
|
||||||
|
|
||||||
$q = "INSERT INTO PeterDB.gavi_welcome_letters (section_id,format,length,text_title,course_desc,what_expect,assessments,textbook,other_info,introduction,additional_resources) VALUES ('{$sched_id}', '', '', '', '', '{$default->what_expect}', '{$default->assessments}', '{$default->textbook}', '{$default->other_info}', '{$default->introduction}', '{$default->additional_resources}');";
|
$q = "INSERT INTO PeterDB.gavi_welcome_letters (section_id,format,length,text_title,course_desc,what_expect,assessments,textbook,other_info,introduction,additional_resources) VALUES ('{$sched_id}', '', '', '', '', '{$default->what_expect}', '{$default->assessments}', '{$default->textbook}', '{$default->other_info}', '{$default->introduction}', '{$default->additional_resources}');";
|
||||||
$new_id = single_row_insert($q,0,$c2);
|
$new_id = single_row_insert($q,0,$c);
|
||||||
|
|
||||||
$q4 = "SELECT s.id,s.code,s.name,s.descr,s.teacher_id,s.days,s.start_date,s.end_date,s.units,s.ztc,s.location,s.delivery,s.status,s.pnp,s.note,s.crn,s.sem,w.id AS wl_id, w.photo_path,w.format,w.length,w.course_desc,w.what_expect,w.assessments,w.textbook,w.other_info,w.introduction,w.additional_resources FROM PeterDB.gavi_welcome_letters w LEFT JOIN PeterDB.gavi_sections s ON w.section_id=s.id WHERE w.id=" . $new_id . ";";
|
$q4 = "SELECT s.id,s.code,s.name,s.descr,s.teacher_id,s.days,s.start_date,s.end_date,s.units,s.ztc,s.location,s.delivery,s.status,s.pnp,s.note,s.crn,s.sem,w.id AS wl_id, w.photo_path,w.format,w.length,w.course_desc,w.what_expect,w.assessments,w.textbook,w.other_info,w.introduction,w.additional_resources FROM PeterDB.gavi_welcome_letters w LEFT JOIN PeterDB.gavi_sections s ON w.section_id=s.id WHERE w.id=" . $new_id . ";";
|
||||||
|
|
||||||
$wl_entry = single_row_select( $q4, 0, $c2);
|
$wl_entry = single_row_select( $q4, 0);
|
||||||
echo json_encode($wl_entry);
|
echo json_encode($wl_entry);
|
||||||
exit();
|
exit();
|
||||||
} }
|
} }
|
||||||
|
|
@ -764,7 +584,7 @@ if (isset($_REQUEST['a']) && preg_match('/^get\/section\/(\w\w\d\d)\/(\d+)$/', $
|
||||||
//
|
//
|
||||||
// update a course section record
|
// update a course section record
|
||||||
/*function update_section($update=1) {
|
/*function update_section($update=1) {
|
||||||
global $USER, $c2;
|
global $USER, $c;
|
||||||
$WHERECLAUSE = "";
|
$WHERECLAUSE = "";
|
||||||
$START = "INSERT INTO gavi_sections SET ";
|
$START = "INSERT INTO gavi_sections SET ";
|
||||||
$action = "inserted";
|
$action = "inserted";
|
||||||
|
|
@ -789,9 +609,9 @@ if (isset($_REQUEST['a']) && preg_match('/^get\/section\/(\w\w\d\d)\/(\d+)$/', $
|
||||||
$q = substr($q, 0, -2);
|
$q = substr($q, 0, -2);
|
||||||
$q .= $WHERECLAUSE;
|
$q .= $WHERECLAUSE;
|
||||||
|
|
||||||
single_row_insert($q,0,$c2);
|
single_row_insert($q,0,$c);
|
||||||
echo json_encode( array("rawvalstr"=>$_REQUEST['vals'], "result"=>"success","action"=>$action,
|
echo json_encode( array("rawvalstr"=>$_REQUEST['vals'], "result"=>"success","action"=>$action,
|
||||||
"logaction"=>$logaction, "query"=>$q,"err"=>mysqli_error($c2)));
|
"logaction"=>$logaction, "query"=>$q,"err"=>mysqli_error($c)));
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -808,7 +628,7 @@ if (isset($_REQUEST['a']) && $_REQUEST['a']=='add/section') { update_section(0);
|
||||||
// update a WELCOME LETTER
|
// update a WELCOME LETTER
|
||||||
//
|
//
|
||||||
/*function update_welcome_letter($update=1) {
|
/*function update_welcome_letter($update=1) {
|
||||||
global $USER, $c2, $_;
|
global $USER, $c, $_;
|
||||||
$WHERECLAUSE = "";
|
$WHERECLAUSE = "";
|
||||||
$START = "INSERT INTO gavi_welcome_letters SET ";
|
$START = "INSERT INTO gavi_welcome_letters SET ";
|
||||||
$action = "inserted";
|
$action = "inserted";
|
||||||
|
|
@ -833,9 +653,9 @@ if (isset($_REQUEST['a']) && $_REQUEST['a']=='add/section') { update_section(0);
|
||||||
$q = substr($q, 0, -2);
|
$q = substr($q, 0, -2);
|
||||||
$q .= $WHERECLAUSE;
|
$q .= $WHERECLAUSE;
|
||||||
|
|
||||||
single_row_insert($q,0,$c2);
|
single_row_insert($q,0,$c);
|
||||||
echo json_encode( array("rawvalstr"=>$_REQUEST['vals'], "result"=>"success","action"=>$action,
|
echo json_encode( array("rawvalstr"=>$_REQUEST['vals'], "result"=>"success","action"=>$action,
|
||||||
"logaction"=>$logaction, "query"=>$q,"err"=>mysqli_error($c2)));
|
"logaction"=>$logaction, "query"=>$q,"err"=>mysqli_error($c)));
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -871,13 +691,13 @@ if (isset($_REQUEST['a']) && $_REQUEST['a']=='add/letter') { update_welcome_lett
|
||||||
//
|
//
|
||||||
// GET LIST OF ALL SESSIONS / WORKSHOPS / EVENTS
|
// GET LIST OF ALL SESSIONS / WORKSHOPS / EVENTS
|
||||||
//
|
//
|
||||||
function get_sessions() { global $c2, $AY;
|
function get_sessions() { global $c, $AY;
|
||||||
return multi_row_select("SELECT c.id,c.title,c.desc,c.length,c.starttime,c.track,c.location,c.location_irl,c.mode,c.gets_survey,c.category,c.parent,c.recording,c.instructions,c.image_url,c.is_flex_approved,c.cal_uid,sst.type AS typeStr, sst.id AS type, GROUP_CONCAT(ctg.tag) AS tags FROM conf_sessions c LEFT JOIN conf_sessiontypes sst ON c.type=sst.id LEFT JOIN conf_tagmember ct ON c.id=ct.session LEFT JOIN conf_tags ctg ON ctg.id=ct.tag WHERE c.starttime BETWEEN CAST('{$AY['begin']}' AS DATE) AND CAST('{$AY['end']}' AS DATETIME) GROUP BY c.id ORDER BY c.track, c.starttime;",0, $c2); }
|
return multi_row_select("SELECT c.id,c.title,c.desc,c.length,c.starttime,c.track,c.location,c.location_irl,c.mode,c.gets_survey,c.category,c.parent,c.recording,c.instructions,c.image_url,c.is_flex_approved,c.cal_uid,sst.type AS typeStr, sst.id AS type, GROUP_CONCAT(ctg.tag) AS tags FROM conf_sessions c LEFT JOIN conf_sessiontypes sst ON c.type=sst.id LEFT JOIN conf_tagmember ct ON c.id=ct.session LEFT JOIN conf_tags ctg ON ctg.id=ct.tag WHERE c.starttime BETWEEN CAST('{$AY['begin']}' AS DATE) AND CAST('{$AY['end']}' AS DATETIME) GROUP BY c.id ORDER BY c.track, c.starttime;",0); }
|
||||||
|
|
||||||
if (isset($_GET['a']) && $_GET['a'] == 'get/sessions') { echo json_encode(get_sessions()); exit(); }
|
if (isset($_GET['a']) && $_GET['a'] == 'get/sessions') { echo json_encode(get_sessions()); exit(); }
|
||||||
|
|
||||||
|
|
||||||
function multi_row_1d($qry, $c) {
|
function multi_row_1d($qry) { global $c;
|
||||||
$savedQuery = mysqli_query($c, $qry);
|
$savedQuery = mysqli_query($c, $qry);
|
||||||
while($savedResult = mysqli_fetch_array($savedQuery)) {
|
while($savedResult = mysqli_fetch_array($savedQuery)) {
|
||||||
$savedArray[] = $savedResult[0]; }
|
$savedArray[] = $savedResult[0]; }
|
||||||
|
|
@ -890,17 +710,17 @@ function multi_row_1d($qry, $c) {
|
||||||
//
|
//
|
||||||
// GET LIST OF ALL SESSIONS + HOSTS
|
// GET LIST OF ALL SESSIONS + HOSTS
|
||||||
//
|
//
|
||||||
function get_ses_hosts() { global $c2, $AY;
|
function get_ses_hosts() { global $c, $AY;
|
||||||
return multi_row_select("select s.id, s.title, s.starttime, u.name, u.email, u.id AS hostid from conf_sessions as s LEFT OUTER JOIN conf_hosts as h ON h.session=s.id LEFT OUTER JOIN conf_users AS u ON h.host=u.id WHERE s.id>1319 ORDER BY u.name;",1, $c2); }
|
return multi_row_select("select s.id, s.title, s.starttime, u.name, u.email, u.id AS hostid from conf_sessions as s LEFT OUTER JOIN conf_hosts as h ON h.session=s.id LEFT OUTER JOIN conf_users AS u ON h.host=u.id WHERE s.id>1319 ORDER BY u.name;",1); }
|
||||||
//return multi_row_1d("select DISTINCT(u.email) from conf_sessions as s LEFT OUTER JOIN conf_hosts as h ON h.session=s.id LEFT OUTER JOIN conf_users AS u ON h.host=u.id WHERE s.id>1319 ORDER BY u.name;", $c2); }
|
//return multi_row_1d("select DISTINCT(u.email) from conf_sessions as s LEFT OUTER JOIN conf_hosts as h ON h.session=s.id LEFT OUTER JOIN conf_users AS u ON h.host=u.id WHERE s.id>1319 ORDER BY u.name;"); }
|
||||||
|
|
||||||
if (isset($_GET['a']) && $_GET['a'] == 'get/hosts') { echo get_ses_hosts(); exit(); }
|
if (isset($_GET['a']) && $_GET['a'] == 'get/hosts') { echo get_ses_hosts(); exit(); }
|
||||||
|
|
||||||
//
|
//
|
||||||
// ALL HOST ENTRIES
|
// ALL HOST ENTRIES
|
||||||
//
|
//
|
||||||
/*function get_all_hosts() { global $c2, $_;
|
/*function get_all_hosts() { global $c, $_;
|
||||||
$hh = multi_row_select("select host,session FROM conf_hosts ORDER BY host;",0, $c2);
|
$hh = multi_row_select("select host,session FROM conf_hosts ORDER BY host;",0);
|
||||||
$byhost = $_->groupBy($hh, function($n) { return $n['host']; });
|
$byhost = $_->groupBy($hh, function($n) { return $n['host']; });
|
||||||
$_->map( $byhost, function($v,$k) use (&$allhost) { global $_;
|
$_->map( $byhost, function($v,$k) use (&$allhost) { global $_;
|
||||||
$allhost[$k] = $_->pluck($v,'session');
|
$allhost[$k] = $_->pluck($v,'session');
|
||||||
|
|
@ -915,8 +735,8 @@ if (isset($_GET['a']) && $_GET['a'] == 'get/allhosts') { echo json_encode(get_al
|
||||||
//
|
//
|
||||||
// LIST THE CURRENT USER'S SIGNED UP, (OR HOSTING,) SESSIONS / WORKSHOPS / EVENTS
|
// LIST THE CURRENT USER'S SIGNED UP, (OR HOSTING,) SESSIONS / WORKSHOPS / EVENTS
|
||||||
//
|
//
|
||||||
function get_user_sessions() { global $c2, $AY, $USER;
|
function get_user_sessions() { global $c, $AY, $USER;
|
||||||
$my_sessions = multi_row_select("SELECT c.id,c.title,c.desc,c.length,c.starttime,c.track,c.location,c.location_irl,c.mode,c.gets_survey,c.category,c.parent,c.recording,c.instructions,c.image_url,c.is_flex_approved,sst.type,sst.id AS typeId, GROUP_CONCAT(ctg.tag) AS tags FROM conf_sessions c JOIN conf_signups as sup on c.id=sup.session LEFT JOIN conf_hosts as h ON h.session=c.id JOIN conf_sessiontypes sst ON c.type=sst.id LEFT JOIN conf_tagmember ct ON c.id=ct.session LEFT JOIN conf_tags ctg ON ctg.id=ct.tag WHERE (h.host='{$USER->conf_id}' OR sup.user='{$USER->conf_id}') AND c.starttime BETWEEN CAST('{$AY['begin']}' AS DATE) AND CAST('{$AY['end']}' AS DATETIME) GROUP BY c.id ORDER BY c.track, c.starttime;",0,$c2);
|
$my_sessions = multi_row_select("SELECT c.id,c.title,c.desc,c.length,c.starttime,c.track,c.location,c.location_irl,c.mode,c.gets_survey,c.category,c.parent,c.recording,c.instructions,c.image_url,c.is_flex_approved,sst.type,sst.id AS typeId, GROUP_CONCAT(ctg.tag) AS tags FROM conf_sessions c JOIN conf_signups as sup on c.id=sup.session LEFT JOIN conf_hosts as h ON h.session=c.id JOIN conf_sessiontypes sst ON c.type=sst.id LEFT JOIN conf_tagmember ct ON c.id=ct.session LEFT JOIN conf_tags ctg ON ctg.id=ct.tag WHERE (h.host='{$USER->conf_id}' OR sup.user='{$USER->conf_id}') AND c.starttime BETWEEN CAST('{$AY['begin']}' AS DATE) AND CAST('{$AY['end']}' AS DATETIME) GROUP BY c.id ORDER BY c.track, c.starttime;",0,$c);
|
||||||
echo json_encode($my_sessions);
|
echo json_encode($my_sessions);
|
||||||
exit(); }
|
exit(); }
|
||||||
if (isset($_GET['a']) && $_GET['a'] == 'get/mysessions') { get_user_sessions(); }
|
if (isset($_GET['a']) && $_GET['a'] == 'get/mysessions') { get_user_sessions(); }
|
||||||
|
|
@ -925,7 +745,7 @@ if (isset($_GET['a']) && $_GET['a'] == 'get/mysessions') { get_user_sessions();
|
||||||
//
|
//
|
||||||
// GET ROSTERS OF ALL SESSIONS
|
// GET ROSTERS OF ALL SESSIONS
|
||||||
function get_rosters() {
|
function get_rosters() {
|
||||||
global $AY, $c2;
|
global $AY, $c;
|
||||||
|
|
||||||
/* "SELECT i.user, i.session, i.timestamp, u.goo, u.email, u.name, s.title, s.track, s.starttime, s.location, s.id AS sesid FROM conf_signups as i LEFT JOIN conf_users as u ON i.user=u.id RIGHT JOIN conf_sessions as s ON i.session=s.id WHERE s.starttime BETWEEN CAST('{$AY['begin']}' AS DATE) AND CAST('{$AY['end']}' AS DATETIME) {$where} ORDER BY sesid;" */
|
/* "SELECT i.user, i.session, i.timestamp, u.goo, u.email, u.name, s.title, s.track, s.starttime, s.location, s.id AS sesid FROM conf_signups as i LEFT JOIN conf_users as u ON i.user=u.id RIGHT JOIN conf_sessions as s ON i.session=s.id WHERE s.starttime BETWEEN CAST('{$AY['begin']}' AS DATE) AND CAST('{$AY['end']}' AS DATETIME) {$where} ORDER BY sesid;" */
|
||||||
|
|
||||||
|
|
@ -934,7 +754,7 @@ function get_rosters() {
|
||||||
$ID = ok($_REQUEST['id']);
|
$ID = ok($_REQUEST['id']);
|
||||||
$where = "AND s.id={$ID}"; }
|
$where = "AND s.id={$ID}"; }
|
||||||
return multi_row_select(
|
return multi_row_select(
|
||||||
"SELECT i.user, i.session, u.goo, u.email, u.name, s.id AS sesid FROM conf_signups as i LEFT JOIN conf_users as u ON i.user=u.id RIGHT JOIN conf_sessions as s ON i.session=s.id WHERE s.starttime BETWEEN CAST('{$AY['begin']}' AS DATE) AND CAST('{$AY['end']}' AS DATETIME) {$where} ORDER BY sesid;",0,$c2); }
|
"SELECT i.user, i.session, u.goo, u.email, u.name, s.id AS sesid FROM conf_signups as i LEFT JOIN conf_users as u ON i.user=u.id RIGHT JOIN conf_sessions as s ON i.session=s.id WHERE s.starttime BETWEEN CAST('{$AY['begin']}' AS DATE) AND CAST('{$AY['end']}' AS DATETIME) {$where} ORDER BY sesid;",0,$c); }
|
||||||
|
|
||||||
if (isset($_GET['a']) && $_GET['a'] == 'get/rosters') { echo json_encode(get_rosters()); exit(); }
|
if (isset($_GET['a']) && $_GET['a'] == 'get/rosters') { echo json_encode(get_rosters()); exit(); }
|
||||||
|
|
||||||
|
|
@ -943,13 +763,13 @@ if (isset($_GET['a']) && $_GET['a'] == 'get/rosters') { echo json_encode(get_ros
|
||||||
//
|
//
|
||||||
// GET ALL SIGNUPS
|
// GET ALL SIGNUPS
|
||||||
function get_signups() {
|
function get_signups() {
|
||||||
global $AY, $c2;
|
global $AY, $c;
|
||||||
$where = '';
|
$where = '';
|
||||||
if (isset($_REQUEST['id'])) {
|
if (isset($_REQUEST['id'])) {
|
||||||
$ID = ok($_REQUEST['id']);
|
$ID = ok($_REQUEST['id']);
|
||||||
$where = "WHERE s.id={$ID}"; }
|
$where = "WHERE s.id={$ID}"; }
|
||||||
return multi_row_select(
|
return multi_row_select(
|
||||||
"SELECT i.id, i.user, i.session, i.timestamp, i.certified_at, i.badged_at, i.not_flex FROM conf_signups AS i JOIN conf_sessions AS s ON i.session=s.id WHERE s.starttime BETWEEN CAST('{$AY['begin']}' AS DATE) AND CAST('{$AY['end']}' AS DATETIME) {$where} ORDER BY i.id DESC;",0,$c2); }
|
"SELECT i.id, i.user, i.session, i.timestamp, i.certified_at, i.badged_at, i.not_flex FROM conf_signups AS i JOIN conf_sessions AS s ON i.session=s.id WHERE s.starttime BETWEEN CAST('{$AY['begin']}' AS DATE) AND CAST('{$AY['end']}' AS DATETIME) {$where} ORDER BY i.id DESC;",0,$c); }
|
||||||
|
|
||||||
if (isset($_GET['a']) && $_GET['a'] == 'get/signups') { echo json_encode(get_signups()); exit(); }
|
if (isset($_GET['a']) && $_GET['a'] == 'get/signups') { echo json_encode(get_signups()); exit(); }
|
||||||
|
|
||||||
|
|
@ -958,9 +778,9 @@ if (isset($_GET['a']) && $_GET['a'] == 'get/signups') { echo json_encode(get_sig
|
||||||
//
|
//
|
||||||
// GET ALL USERS
|
// GET ALL USERS
|
||||||
function get_users() {
|
function get_users() {
|
||||||
global $AY, $c2;
|
global $AY, $c;
|
||||||
return multi_row_select(
|
return multi_row_select(
|
||||||
"SELECT * FROM conf_users AS u ORDER BY u.email;",0,$c2); }
|
"SELECT * FROM conf_users AS u ORDER BY u.email;",0,$c); }
|
||||||
|
|
||||||
if (isset($_GET['a']) && $_GET['a'] == 'get/users') { echo json_encode(get_users()); exit(); }
|
if (isset($_GET['a']) && $_GET['a'] == 'get/users') { echo json_encode(get_users()); exit(); }
|
||||||
|
|
||||||
|
|
@ -968,9 +788,9 @@ if (isset($_GET['a']) && $_GET['a'] == 'get/users') { echo json_encode(get_users
|
||||||
//
|
//
|
||||||
// GET ALL HOSTS
|
// GET ALL HOSTS
|
||||||
function get_hosttable() {
|
function get_hosttable() {
|
||||||
global $AY, $c2;
|
global $AY, $c;
|
||||||
return multi_row_select(
|
return multi_row_select(
|
||||||
"SELECT * FROM conf_hosts;",0,$c2); }
|
"SELECT * FROM conf_hosts;",0,$c); }
|
||||||
|
|
||||||
if (isset($_GET['a']) && $_GET['a'] == 'get/hosttable') { echo json_encode(get_hosttable()); exit(); }
|
if (isset($_GET['a']) && $_GET['a'] == 'get/hosttable') { echo json_encode(get_hosttable()); exit(); }
|
||||||
|
|
||||||
|
|
@ -985,8 +805,8 @@ if (isset($_GET['a']) && $_GET['a'] == 'get/hosttable') { echo json_encode(get_h
|
||||||
// all years
|
// all years
|
||||||
//
|
//
|
||||||
function get_anyuser_sessions($usr) {
|
function get_anyuser_sessions($usr) {
|
||||||
global $c2, $AY, $USER;
|
global $c, $AY, $USER;
|
||||||
$my_sessions = multi_row_select("SELECT c.id,c.title,c.desc,c.length,c.starttime,c.track,c.location,c.location_irl,c.mode,c.gets_survey,c.category,c.parent,c.recording,c.instructions,c.image_url,c.is_flex_approved,sst.type,sst.id AS typeId, GROUP_CONCAT(ctg.tag) AS tags FROM conf_sessions c JOIN conf_signups as sup on c.id=sup.session LEFT JOIN conf_hosts as h ON h.session=c.id JOIN conf_sessiontypes sst ON c.type=sst.id LEFT JOIN conf_tagmember ct ON c.id=ct.session LEFT JOIN conf_tags ctg ON ctg.id=ct.tag WHERE (h.host='{$usr}' OR sup.user='{$usr}') GROUP BY c.id ORDER BY c.starttime LIMIT 150;",0,$c2);
|
$my_sessions = multi_row_select("SELECT c.id,c.title,c.desc,c.length,c.starttime,c.track,c.location,c.location_irl,c.mode,c.gets_survey,c.category,c.parent,c.recording,c.instructions,c.image_url,c.is_flex_approved,sst.type,sst.id AS typeId, GROUP_CONCAT(ctg.tag) AS tags FROM conf_sessions c JOIN conf_signups as sup on c.id=sup.session LEFT JOIN conf_hosts as h ON h.session=c.id JOIN conf_sessiontypes sst ON c.type=sst.id LEFT JOIN conf_tagmember ct ON c.id=ct.session LEFT JOIN conf_tags ctg ON ctg.id=ct.tag WHERE (h.host='{$usr}' OR sup.user='{$usr}') GROUP BY c.id ORDER BY c.starttime LIMIT 150;",0,$c);
|
||||||
// AND c.starttime BETWEEN CAST('{$AY['begin']}' AS DATE) AND CAST('{$AY['end']}' AS DATETIME)
|
// AND c.starttime BETWEEN CAST('{$AY['begin']}' AS DATE) AND CAST('{$AY['end']}' AS DATETIME)
|
||||||
|
|
||||||
return $my_sessions; }
|
return $my_sessions; }
|
||||||
|
|
@ -994,25 +814,25 @@ if (isset($_GET['a']) && preg_match('/get\/sessions\/(\d+)$/', $_GET['a'], $matc
|
||||||
|
|
||||||
|
|
||||||
// MY Survey ANSWERS
|
// MY Survey ANSWERS
|
||||||
function get_questions() { global $c2, $USER;
|
function get_questions() { global $c, $USER;
|
||||||
//return $USER->id;
|
//return $USER->id;
|
||||||
return multi_row_select( "SELECT ses.id as ses_id, sup.id as sup_id, sup.certified_at as cert, sup.surveyed_at as surveyed, cus.id as user, qset.order, qq.id, qq.question, qq.type, qq.id as qid, ans.answer FROM conf_sessions as ses JOIN conf_signups as sup on ses.id = sup.session JOIN conf_users as cus on cus.id = sup.user JOIN conf_q_set as qset on ses.gets_survey = qset.q_set RIGHT JOIN conf_questions as qq on qset.question = qq.id LEFT OUTER JOIN conf_answers as ans on ans.user = sup.user AND ans.question = qq.id AND ans.session = ses.id WHERE (cus.id='{$USER->conf_id}') ORDER BY ses.starttime, ses.track asc, qset.order", 0, $c2); }
|
return multi_row_select( "SELECT ses.id as ses_id, sup.id as sup_id, sup.certified_at as cert, sup.surveyed_at as surveyed, cus.id as user, qset.order, qq.id, qq.question, qq.type, qq.id as qid, ans.answer FROM conf_sessions as ses JOIN conf_signups as sup on ses.id = sup.session JOIN conf_users as cus on cus.id = sup.user JOIN conf_q_set as qset on ses.gets_survey = qset.q_set RIGHT JOIN conf_questions as qq on qset.question = qq.id LEFT OUTER JOIN conf_answers as ans on ans.user = sup.user AND ans.question = qq.id AND ans.session = ses.id WHERE (cus.id='{$USER['conf_id']}') ORDER BY ses.starttime, ses.track asc, qset.order", 0); }
|
||||||
|
|
||||||
if (isset($_GET['a']) && $_GET['a'] == 'get/questions') { echo json_encode(get_questions()); exit(); }
|
if (isset($_GET['a']) && $_GET['a'] == 'get/questions') { echo json_encode(get_questions()); exit(); }
|
||||||
|
|
||||||
|
|
||||||
// Single session QUESTIONS and possibly ansers
|
// Single session QUESTIONS and possibly ansers
|
||||||
function get_session_questions($id) { global $c2, $USER;
|
function get_session_questions($id) { global $c, $USER;
|
||||||
//print_r($USER); exit();
|
//print_r($USER); exit();
|
||||||
$u = $USER->conf_id;
|
$u = $USER['conf_id'];
|
||||||
return multi_row_select( "SELECT ses.title, {$u} AS user, ses.id as session, q.id AS qid, q.question, q.type, ans.answer FROM conf_sessions AS ses JOIN conf_q_set AS qset ON ses.gets_survey=qset.q_set JOIN conf_questions AS q ON q.id=qset.question LEFT OUTER JOIN conf_answers AS ans ON ans.user={$u} AND ans.question=q.id AND ans.session=ses.id WHERE ses.id={$id}", 0, $c2); }
|
return multi_row_select( "SELECT ses.title, {$u} AS user, ses.id as session, q.id AS qid, q.question, q.type, ans.answer FROM conf_sessions AS ses JOIN conf_q_set AS qset ON ses.gets_survey=qset.q_set JOIN conf_questions AS q ON q.id=qset.question LEFT OUTER JOIN conf_answers AS ans ON ans.user={$u} AND ans.question=q.id AND ans.session=ses.id WHERE ses.id={$id}", 0); }
|
||||||
|
|
||||||
if (isset($_GET['a'])&& preg_match('/get\/questions\/(\d+)$/', $_GET['a'], $matches)) { echo json_encode(get_session_questions($matches[1])); exit(); }
|
if (isset($_GET['a'])&& preg_match('/get\/questions\/(\d+)$/', $_GET['a'], $matches)) { echo json_encode(get_session_questions($matches[1])); exit(); }
|
||||||
|
|
||||||
|
|
||||||
// ALL Survey ANSWERS
|
// ALL Survey ANSWERS
|
||||||
function get_answers_all() { global $c2;
|
function get_answers_all() { global $c;
|
||||||
return multi_row_select( "SELECT ses.id AS ses_id, ses.title as s_title, ses.starttime, qq.id as q_id, qq.question as question, qq.type as type, ans.answer AS answer FROM conf_sessions AS ses JOIN conf_signups as sup on ses.id = sup.session JOIN conf_users as cus on cus.id = sup.user JOIN conf_q_set as qset on ses.gets_survey = qset.q_set RIGHT JOIN conf_questions as qq on qset.question = qq.id LEFT OUTER JOIN conf_answers as ans on ans.user = sup.user AND ans.question = qq.id AND ans.session = ses.id WHERE ans.answer is not null ORDER BY ses.starttime, ses.track asc, qset.order", 0, $c2); }
|
return multi_row_select( "SELECT ses.id AS ses_id, ses.title as s_title, ses.starttime, qq.id as q_id, qq.question as question, qq.type as type, ans.answer AS answer FROM conf_sessions AS ses JOIN conf_signups as sup on ses.id = sup.session JOIN conf_users as cus on cus.id = sup.user JOIN conf_q_set as qset on ses.gets_survey = qset.q_set RIGHT JOIN conf_questions as qq on qset.question = qq.id LEFT OUTER JOIN conf_answers as ans on ans.user = sup.user AND ans.question = qq.id AND ans.session = ses.id WHERE ans.answer is not null ORDER BY ses.starttime, ses.track asc, qset.order", 0); }
|
||||||
|
|
||||||
if (isset($_GET['a']) && $_GET['a'] == 'get/answers/all') { echo json_encode(get_answers_all()); exit(); }
|
if (isset($_GET['a']) && $_GET['a'] == 'get/answers/all') { echo json_encode(get_answers_all()); exit(); }
|
||||||
|
|
||||||
|
|
@ -1021,24 +841,24 @@ if (isset($_GET['a']) && $_GET['a'] == 'get/answers/all') { echo json_encode(get
|
||||||
|
|
||||||
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // //
|
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // //
|
||||||
|
|
||||||
function set_answers() { global $c, $c2;
|
function set_answers() { global $c;
|
||||||
$ses_id = ok($_REQUEST['session']);
|
$ses_id = ok($_REQUEST['session']);
|
||||||
$u = ok($_REQUEST['user']);
|
$u = ok($_REQUEST['user']);
|
||||||
$q = ok($_REQUEST['qid']);
|
$q = ok($_REQUEST['qid']);
|
||||||
$answer = ok($_REQUEST['answer']);
|
$answer = ok($_REQUEST['answer']);
|
||||||
|
|
||||||
$existing = does_exist( "select * from `conf_answers` where `user`='$u' and `session`='$ses_id' and `question`='$q';",0,$c2 );
|
$existing = does_exist( "select * from `conf_answers` where `user`='$u' and `session`='$ses_id' and `question`='$q';",0,$c );
|
||||||
|
|
||||||
if ($existing) {
|
if ($existing) {
|
||||||
$qupdate = "UPDATE conf_answers SET answer='$answer' WHERE session=$ses_id AND user=$u AND question=$q";
|
$qupdate = "UPDATE conf_answers SET answer='$answer' WHERE session=$ses_id AND user=$u AND question=$q";
|
||||||
single_row_update($qupdate,0, $c2);
|
single_row_update($qupdate,0);
|
||||||
$logaction = log_it("updated answer for session: $ses_id");
|
$logaction = log_it("updated answer for session: $ses_id");
|
||||||
} else {
|
} else {
|
||||||
$qupdate = "INSERT INTO conf_answers SET user='$u', question='$q', session='$ses_id', answer='$answer'";
|
$qupdate = "INSERT INTO conf_answers SET user='$u', question='$q', session='$ses_id', answer='$answer'";
|
||||||
single_row_insert($qupdate,0,$c2);
|
single_row_insert($qupdate,0,$c);
|
||||||
$logaction = log_it("Saved answer for session: $ses_id");
|
$logaction = log_it("Saved answer for session: $ses_id");
|
||||||
}
|
}
|
||||||
echo json_encode( array("result"=>"success", "logaction"=>$logaction, "action"=>"save survey answer","query"=>$qupdate,"err"=>mysqli_error($c2)));
|
echo json_encode( array("result"=>"success", "logaction"=>$logaction, "action"=>"save survey answer","query"=>$qupdate,"err"=>mysqli_error($c)));
|
||||||
exit(); }
|
exit(); }
|
||||||
|
|
||||||
if (isset($_REQUEST['a']) && $_REQUEST['a']=='update/answers') { set_answers(); }
|
if (isset($_REQUEST['a']) && $_REQUEST['a']=='update/answers') { set_answers(); }
|
||||||
|
|
@ -1049,15 +869,15 @@ if (isset($_REQUEST['a']) && $_REQUEST['a']=='update/answers') { set_answers();
|
||||||
|
|
||||||
function set_cert() {
|
function set_cert() {
|
||||||
#echo "saving";
|
#echo "saving";
|
||||||
global $USER, $c2;
|
global $USER, $c;
|
||||||
$ses_id = ok($_REQUEST['ses_id']);
|
$ses_id = ok($_REQUEST['ses_id']);
|
||||||
$cert = ok($_REQUEST['cert']);
|
$cert = ok($_REQUEST['cert']);
|
||||||
$date = "'" . date('Y-m-d H:i:s') . "'";
|
$date = "'" . date('Y-m-d H:i:s') . "'";
|
||||||
if ($cert=="null") { $date = "NULL"; }
|
if ($cert=="null") { $date = "NULL"; }
|
||||||
$qupdate = "UPDATE conf_signups SET `certified_at`=$date where `user`='$USER' and `session`='$ses_id'";
|
$qupdate = "UPDATE conf_signups SET `certified_at`=$date where `user`='$USER' and `session`='$ses_id'";
|
||||||
single_row_update($qupdate, 0, $c2);
|
single_row_update($qupdate, 0);
|
||||||
$logaction = log_it("updated certified state for session: $ses_id");
|
$logaction = log_it("updated certified state for session: $ses_id");
|
||||||
echo json_encode( array("result"=>"success", "logaction"=>$logaction, "action"=>"save cert","query"=>$qupdate,"err"=>mysqli_error($c2)));
|
echo json_encode( array("result"=>"success", "logaction"=>$logaction, "action"=>"save cert","query"=>$qupdate,"err"=>mysqli_error($c)));
|
||||||
//print_r($_POST);
|
//print_r($_POST);
|
||||||
exit(); }
|
exit(); }
|
||||||
|
|
||||||
|
|
@ -1072,7 +892,7 @@ if (isset($_REQUEST['a']) && $_REQUEST['a']=='set/cert') { set_cert(); }
|
||||||
// SIGNUP for (possibly overlapping time) session ... /// id_c_users
|
// SIGNUP for (possibly overlapping time) session ... /// id_c_users
|
||||||
//
|
//
|
||||||
function signup() {
|
function signup() {
|
||||||
global $c2, $AY, $USER;
|
global $c, $AY, $USER;
|
||||||
preg_match('/signup\/(\d+)$/', $_GET['a'], $matches);
|
preg_match('/signup\/(\d+)$/', $_GET['a'], $matches);
|
||||||
$ses = $matches[1];
|
$ses = $matches[1];
|
||||||
$ts = date("Y-m-d H:i:s");
|
$ts = date("Y-m-d H:i:s");
|
||||||
|
|
@ -1082,16 +902,16 @@ function signup() {
|
||||||
if (isset($_SESSION)) { $sesh = $_SESSION; }
|
if (isset($_SESSION)) { $sesh = $_SESSION; }
|
||||||
|
|
||||||
$existing = does_exist(
|
$existing = does_exist(
|
||||||
"SELECT i.id FROM conf_signups AS i JOIN conf_sessions AS s ON i.session=s.id WHERE s.id={$ses} AND i.user=" . $USER->conf_id,0,$c2);
|
"SELECT i.id FROM conf_signups AS i JOIN conf_sessions AS s ON i.session=s.id WHERE s.id={$ses} AND i.user=" . $USER['conf_id'],0,$c);
|
||||||
if ($existing) {
|
if ($existing) {
|
||||||
$qupdate = "UPDATE conf_signups SET session={$ses}, timestamp='{$ts}' WHERE session={$ses} AND user=" . $USER->conf_id;
|
$qupdate = "UPDATE conf_signups SET session={$ses}, timestamp='{$ts}' WHERE session={$ses} AND user=" . $USER['conf_id'];
|
||||||
single_row_select($qupdate,1,$c2);
|
single_row_select($qupdate,1,$c);
|
||||||
echo json_encode( array("result"=>"success","action"=>"updated","logaction"=>$logaction, "query"=>$qupdate,"err"=>mysqli_error($c2)));
|
echo json_encode( array("result"=>"success","action"=>"updated","logaction"=>$logaction, "query"=>$qupdate,"err"=>mysqli_error($c)));
|
||||||
} else {
|
} else {
|
||||||
$q = "INSERT INTO conf_signups (session,user,timestamp) VALUES ({$ses}," . $USER->conf_id . ",'{$ts}')";
|
$q = "INSERT INTO conf_signups (session,user,timestamp) VALUES ({$ses}," . $USER['conf_id'] . ",'{$ts}')";
|
||||||
single_row_insert($q,1,$c2);
|
single_row_insert($q,1,$c);
|
||||||
echo json_encode( array( /* "userglobal"=>$USER, */ "result"=>"success","action"=>"inserted", /* "logaction"=>$logaction, */
|
echo json_encode( array( /* "userglobal"=>$USER, */ "result"=>"success","action"=>"inserted", /* "logaction"=>$logaction, */
|
||||||
"ses"=>$sesh,"query"=>$q,"err"=>mysqli_error($c2)));
|
"ses"=>$sesh,"query"=>$q,"err"=>mysqli_error($c)));
|
||||||
} exit(); }
|
} exit(); }
|
||||||
|
|
||||||
if (isset($_GET['a']) && preg_match('/signup\/(\d+)$/', $_GET['a'], $matches)) { signup(); }
|
if (isset($_GET['a']) && preg_match('/signup\/(\d+)$/', $_GET['a'], $matches)) { signup(); }
|
||||||
|
|
@ -1103,14 +923,14 @@ if (isset($_GET['a']) && preg_match('/signup\/(\d+)$/', $_GET['a'], $matches)) {
|
||||||
// CANCEL a signup
|
// CANCEL a signup
|
||||||
//
|
//
|
||||||
function signdown() {
|
function signdown() {
|
||||||
global $c2, $AY, $USER;
|
global $c, $AY, $USER;
|
||||||
preg_match('/signdown\/(\d+)$/', $_GET['a'], $matches);
|
preg_match('/signdown\/(\d+)$/', $_GET['a'], $matches);
|
||||||
$ses = $matches[1];
|
$ses = $matches[1];
|
||||||
$q = "DELETE FROM conf_signups WHERE session={$ses} AND user=" . $USER->conf_id;
|
$q = "DELETE FROM conf_signups WHERE session={$ses} AND user=" . $USER['conf_id'];
|
||||||
single_row_update($q,1,$c2);
|
single_row_update($q,1);
|
||||||
$logaction = log_it("Canceled signup for session: $ses");
|
$logaction = log_it("Canceled signup for session: $ses");
|
||||||
|
|
||||||
echo json_encode( array("result"=>"success","action"=>"deleted","logaction"=>$logaction, "query"=>$q,"err"=>mysqli_error($c2)));
|
echo json_encode( array("result"=>"success","action"=>"deleted","logaction"=>$logaction, "query"=>$q,"err"=>mysqli_error($c)));
|
||||||
exit(); }
|
exit(); }
|
||||||
|
|
||||||
if (isset($_GET['a']) && preg_match('/signdown\/(\d+)$/', $_GET['a'], $matches)) { signdown(); }
|
if (isset($_GET['a']) && preg_match('/signdown\/(\d+)$/', $_GET['a'], $matches)) { signdown(); }
|
||||||
|
|
@ -1122,14 +942,14 @@ if (isset($_GET['a']) && preg_match('/signdown\/(\d+)$/', $_GET['a'], $matches))
|
||||||
// add a HOST for a session ...
|
// add a HOST for a session ...
|
||||||
//
|
//
|
||||||
function addhost($sesid,$hostid) {
|
function addhost($sesid,$hostid) {
|
||||||
global $c2;
|
global $c;
|
||||||
$sesid = ok($sesid); $hostid = ok($hostid);
|
$sesid = ok($sesid); $hostid = ok($hostid);
|
||||||
$existing = does_exist("SELECT h.host, h.session FROM conf_hosts AS h WHERE h.host={$hostid} AND h.session={$sesid}",0,$c2);
|
$existing = does_exist("SELECT h.host, h.session FROM conf_hosts AS h WHERE h.host={$hostid} AND h.session={$sesid}",0,$c);
|
||||||
if ($existing) { return array("result"=>"success","action"=>"already a host"); }
|
if ($existing) { return array("result"=>"success","action"=>"already a host"); }
|
||||||
else {
|
else {
|
||||||
$qupdate = "INSERT INTO conf_hosts SET session='{$sesid}', host='{$hostid}';";
|
$qupdate = "INSERT INTO conf_hosts SET session='{$sesid}', host='{$hostid}';";
|
||||||
$new_id = single_row_insert($qupdate,0,$c2);
|
$new_id = single_row_insert($qupdate,0,$c);
|
||||||
$e = mysqli_error($c2);
|
$e = mysqli_error($c);
|
||||||
if ($new_id) { $success = " with new id {$new_id}"; }
|
if ($new_id) { $success = " with new id {$new_id}"; }
|
||||||
else { $success = " -- error: {$e}"; }
|
else { $success = " -- error: {$e}"; }
|
||||||
$logaction = log_it("Added host {$hostid} to session: {$sesid}");
|
$logaction = log_it("Added host {$hostid} to session: {$sesid}");
|
||||||
|
|
@ -1144,11 +964,11 @@ if (isset($_GET['a']) && preg_match('/add\/host\/(\d+)\/(\d+)$/', $_GET['a'], $m
|
||||||
// REMOVE a HOST for a session ...
|
// REMOVE a HOST for a session ...
|
||||||
//
|
//
|
||||||
function removehost($sesid,$hostid) {
|
function removehost($sesid,$hostid) {
|
||||||
global $c2;
|
global $c;
|
||||||
$sesid = ok($sesid); $hostid = ok($hostid);
|
$sesid = ok($sesid); $hostid = ok($hostid);
|
||||||
$qupdate = "DELETE FROM conf_hosts WHERE session='{$sesid}' AND host='{$hostid}';";
|
$qupdate = "DELETE FROM conf_hosts WHERE session='{$sesid}' AND host='{$hostid}';";
|
||||||
$new_id = single_row_update($qupdate,0,$c2);
|
$new_id = single_row_update($qupdate,0);
|
||||||
$e = mysqli_error($c2);
|
$e = mysqli_error($c);
|
||||||
$logaction = log_it("Removed host {$hostid} to session: {$sesid}");
|
$logaction = log_it("Removed host {$hostid} to session: {$sesid}");
|
||||||
return array("result"=>"success","action"=>"removed host","query"=>$qupdate,"err"=>$e); }
|
return array("result"=>"success","action"=>"removed host","query"=>$qupdate,"err"=>$e); }
|
||||||
|
|
||||||
|
|
@ -1166,7 +986,7 @@ if (isset($_GET['a']) && preg_match('/remove\/host\/(\d+)\/(\d+)$/', $_GET['a'],
|
||||||
// NEW SESSION
|
// NEW SESSION
|
||||||
//
|
//
|
||||||
function new_session() {
|
function new_session() {
|
||||||
global $c2, $AY, $USER;
|
global $c, $AY, $USER;
|
||||||
|
|
||||||
|
|
||||||
$title = ok($_POST['title']); $starttime = ok($_POST['starttime']);
|
$title = ok($_POST['title']); $starttime = ok($_POST['starttime']);
|
||||||
|
|
@ -1185,9 +1005,9 @@ function new_session() {
|
||||||
|
|
||||||
$q = "INSERT INTO conf_sessions (`title`,`starttime`,`length`,`track`,`gets_survey`,`is_flex_approved`,`category`,`author`,`is_custom`,`parent`,`desc`,`location`,`mode`,`recording`,`instructions`,`type`,`cal_uid`) VALUES ('{$title}', '{$starttime}', '{$length}', '{$track}', '{$gets_survey}', '{$is_flex_approved}', '{$category}', '{$author}', '{$is_custom}', '{$parent}', '{$desc}', '{$location}', '{$location_irl}', '{$mode}', '{$recording}', '{$instructions}', '{$type}', '{$cal_uid}');";
|
$q = "INSERT INTO conf_sessions (`title`,`starttime`,`length`,`track`,`gets_survey`,`is_flex_approved`,`category`,`author`,`is_custom`,`parent`,`desc`,`location`,`mode`,`recording`,`instructions`,`type`,`cal_uid`) VALUES ('{$title}', '{$starttime}', '{$length}', '{$track}', '{$gets_survey}', '{$is_flex_approved}', '{$category}', '{$author}', '{$is_custom}', '{$parent}', '{$desc}', '{$location}', '{$location_irl}', '{$mode}', '{$recording}', '{$instructions}', '{$type}', '{$cal_uid}');";
|
||||||
|
|
||||||
$ins = single_row_insert($q,0,$c2);
|
$ins = single_row_insert($q,0,$c);
|
||||||
$logaction = log_it("created new session id: {$ins}: {$title}");
|
$logaction = log_it("created new session id: {$ins}: {$title}");
|
||||||
echo json_encode( array( /*"all_args"=>$_POST,*/ "result"=>"success","action"=>"inserted new session","new_id"=>$ins, "query"=>$q,"logaction"=>$logaction,"err"=>mysqli_error($c2)));
|
echo json_encode( array( /*"all_args"=>$_POST,*/ "result"=>"success","action"=>"inserted new session","new_id"=>$ins, "query"=>$q,"logaction"=>$logaction,"err"=>mysqli_error($c)));
|
||||||
exit(); }
|
exit(); }
|
||||||
if (isset($_REQUEST['a']) && $_REQUEST['a']=='set/newsession') { new_session(); }
|
if (isset($_REQUEST['a']) && $_REQUEST['a']=='set/newsession') { new_session(); }
|
||||||
|
|
||||||
|
|
@ -1204,7 +1024,7 @@ if (isset($_REQUEST['a']) && $_REQUEST['a']=='set/newsession') { new_session();
|
||||||
function reducer ($memo, $a) { return $memo . "`" . ok($a[0]) . "` = '" . okh($a[1]) . "', "; }
|
function reducer ($memo, $a) { return $memo . "`" . ok($a[0]) . "` = '" . okh($a[1]) . "', "; }
|
||||||
|
|
||||||
function set_sessioninfo() {
|
function set_sessioninfo() {
|
||||||
global $c, $c2, $AY, $USER, $_;
|
global $c, $AY, $USER, $_;
|
||||||
$table = 'conf_sessions';
|
$table = 'conf_sessions';
|
||||||
|
|
||||||
$DO_CHECKING = 0;
|
$DO_CHECKING = 0;
|
||||||
|
|
@ -1226,8 +1046,8 @@ function set_sessioninfo() {
|
||||||
$q = array_reduce($cv, 'reducer', "UPDATE `{$table}` SET ");
|
$q = array_reduce($cv, 'reducer', "UPDATE `{$table}` SET ");
|
||||||
$q = substr($q, 0, -2);
|
$q = substr($q, 0, -2);
|
||||||
$q .= $WHERECLAUSE;
|
$q .= $WHERECLAUSE;
|
||||||
single_row_update($q,0,$c2);
|
single_row_update($q,0);
|
||||||
echo json_encode( array("rawvalstr"=>$_REQUEST['vals'], "result"=>"success","action"=>"updated", "query"=>$q,"err"=>mysqli_error($c2)));
|
echo json_encode( array("rawvalstr"=>$_REQUEST['vals'], "result"=>"success","action"=>"updated", "query"=>$q,"err"=>mysqli_error($c)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo json_encode( array("result"=>"fail", "err"=>"no activity id specified") ); }
|
echo json_encode( array("result"=>"fail", "err"=>"no activity id specified") ); }
|
||||||
|
|
@ -1248,8 +1068,8 @@ if (isset($_REQUEST['a']) && $_REQUEST['a']=='update/activity') { set_sessioninf
|
||||||
|
|
||||||
//
|
//
|
||||||
// GET
|
// GET
|
||||||
function get_settings() { global $AY, $c2;
|
function get_settings() { global $AY, $c;
|
||||||
return multi_row_select( "SELECT * FROM conf_uinforecord;",0,$c2); }
|
return multi_row_select( "SELECT * FROM conf_uinforecord;",0,$c); }
|
||||||
|
|
||||||
if (isset($_GET['a']) && $_GET['a'] == 'get/settings') { echo json_encode(get_settings()); exit(); }
|
if (isset($_GET['a']) && $_GET['a'] == 'get/settings') { echo json_encode(get_settings()); exit(); }
|
||||||
|
|
||||||
|
|
@ -1257,7 +1077,7 @@ if (isset($_GET['a']) && $_GET['a'] == 'get/settings') { echo json_encode(get_se
|
||||||
|
|
||||||
|
|
||||||
function set_settings() {
|
function set_settings() {
|
||||||
global $c, $c2, $AY, $USER, $_;
|
global $c, $AY, $USER, $_;
|
||||||
$table = 'conf_uinforecord';
|
$table = 'conf_uinforecord';
|
||||||
|
|
||||||
$DO_CHECKING = 0;
|
$DO_CHECKING = 0;
|
||||||
|
|
@ -1279,8 +1099,8 @@ function set_settings() {
|
||||||
$q = array_reduce($cv, 'reducer', "UPDATE `{$table}` SET ");
|
$q = array_reduce($cv, 'reducer', "UPDATE `{$table}` SET ");
|
||||||
$q = substr($q, 0, -2);
|
$q = substr($q, 0, -2);
|
||||||
$q .= $WHERECLAUSE;
|
$q .= $WHERECLAUSE;
|
||||||
single_row_update($q,0,$c2);
|
single_row_update($q,0);
|
||||||
echo json_encode( array("rawvalstr"=>$_REQUEST['vals'], "result"=>"success","action"=>"updated", "query"=>$q,"err"=>mysqli_error($c2)));
|
echo json_encode( array("rawvalstr"=>$_REQUEST['vals'], "result"=>"success","action"=>"updated", "query"=>$q,"err"=>mysqli_error($c)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo json_encode( array("result"=>"fail", "err"=>"no activity id specified") ); }
|
echo json_encode( array("result"=>"fail", "err"=>"no activity id specified") ); }
|
||||||
|
|
@ -1515,11 +1335,13 @@ function handle_pic_upload() { global $USER;
|
||||||
|
|
||||||
}
|
}
|
||||||
//if (isset($_REQUEST['file'])) { handle_pic_upload(); }
|
//if (isset($_REQUEST['file'])) { handle_pic_upload(); }
|
||||||
|
|
||||||
|
/*
|
||||||
if (isset($_FILES['file'])) { handle_pic_upload(); }
|
if (isset($_FILES['file'])) { handle_pic_upload(); }
|
||||||
|
|
||||||
function get_a_user_by_pid($user_pid) { global $c, $c2, $_;
|
function get_a_user_by_pid($user_pid) { global $c, $_;
|
||||||
$q1 = "SELECT last_name, first_name, department, extension, phone_number, email, room, user_id, time_updated, id, web_on FROM personnel WHERE id='{$user_pid}'";
|
$q1 = "SELECT last_name, first_name, department, extension, phone_number, email, room, user_id, time_updated, id, web_on FROM personnel WHERE id='{$user_pid}'";
|
||||||
$usr_dir = single_row_select($q1, 0, $c);
|
$usr_dir = single_row_select($q1, 0);
|
||||||
$q2 = "SELECT id AS id_c_users, goo, email AS email_c_users, name, active FROM conf_users WHERE email='{$usr_dir['email']}'";
|
$q2 = "SELECT id AS id_c_users, goo, email AS email_c_users, name, active FROM conf_users WHERE email='{$usr_dir['email']}'";
|
||||||
$usr_conf = single_row_select($q2, 0, $c2);
|
$usr_conf = single_row_select($q2, 0, $c2);
|
||||||
$mega = $_->extend( (object) $usr_dir, (object) $usr_conf );
|
$mega = $_->extend( (object) $usr_dir, (object) $usr_conf );
|
||||||
|
|
@ -1532,7 +1354,7 @@ function get_a_user_by_pid($user_pid) { global $c, $c2, $_;
|
||||||
|
|
||||||
// ?????
|
// ?????
|
||||||
|
|
||||||
|
*/
|
||||||
/* if (!isset($mega->use_dir_photo)) {
|
/* if (!isset($mega->use_dir_photo)) {
|
||||||
$mega->pic_exists = check_dir_photo($mega->first_name, $mega->last_name);
|
$mega->pic_exists = check_dir_photo($mega->first_name, $mega->last_name);
|
||||||
if ($mega->pic_exists) {
|
if ($mega->pic_exists) {
|
||||||
|
|
@ -1547,18 +1369,21 @@ function get_a_user_by_pid($user_pid) { global $c, $c2, $_;
|
||||||
elseif ($mega->id && ! $mega->personnel_id) {
|
elseif ($mega->id && ! $mega->personnel_id) {
|
||||||
$mega->aaqueryfix = "UPDATE gavi_personnel_ext SET personnel='{$mega->id}' WHERE id='{$mega->ext_id}'"; }
|
$mega->aaqueryfix = "UPDATE gavi_personnel_ext SET personnel='{$mega->id}' WHERE id='{$mega->ext_id}'"; }
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
echo json_encode( $mega );
|
echo json_encode( $mega );
|
||||||
exit();
|
exit();
|
||||||
|
|
||||||
}
|
}
|
||||||
if (isset($_REQUEST['a']) && preg_match('/^get\/user\/(\d+)$/', $_REQUEST['a'], $matches)) { get_a_user_by_pid( $matches[1] ); }
|
if (isset($_REQUEST['a']) && preg_match('/^get\/user\/(\d+)$/', $_REQUEST['a'], $matches)) { get_a_user_by_pid( $matches[1] ); }
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
function get_a_user($user_email) { global $c, $c2, $_;
|
function get_a_user($user_email) { global $c, $c2, $_;
|
||||||
$q1 = "SELECT last_name, first_name, department, extension, phone_number, email, room, user_id, time_updated, id, web_on FROM personnel WHERE email='" . $user_email . "'";
|
$q1 = "SELECT last_name, first_name, department, extension, phone_number, email, room, user_id, time_updated, id, web_on FROM personnel WHERE email='" . $user_email . "'";
|
||||||
//p2($q1);
|
//p2($q1);
|
||||||
$usr_dir = single_row_select($q1, 0, $c);
|
$usr_dir = single_row_select($q1, 0);
|
||||||
//p2($usr_dir);
|
//p2($usr_dir);
|
||||||
|
|
||||||
$q2 = "SELECT id AS id_c_users, goo, email AS email_c_users, name, active FROM conf_users WHERE email='" . $user_email . "'";
|
$q2 = "SELECT id AS id_c_users, goo, email AS email_c_users, name, active FROM conf_users WHERE email='" . $user_email . "'";
|
||||||
|
|
@ -1567,19 +1392,19 @@ function get_a_user($user_email) { global $c, $c2, $_;
|
||||||
//p2($usr_conf);
|
//p2($usr_conf);
|
||||||
$mega = $_->extend( (object) $usr_dir, (object) $usr_conf );
|
$mega = $_->extend( (object) $usr_dir, (object) $usr_conf );
|
||||||
|
|
||||||
$q3 = 'SELECT id AS ext_id, personnel AS personnel_id, goo_short, c_users AS c_users_id_ext, ilearn_id, sched_alias, dept1, dept2, gtitle, active, use_dir_photo, etc FROM gavi_personnel_ext WHERE personnel=' . $mega->id;
|
$q3 = 'SELECT id AS ext_id, personnel AS personnel_id, goo_short, c_users AS c_users_id_ext, ilearn_id, sched_alias, dept1, dept2, gtitle, active, use_dir_photo, etc FROM gavi_personnel_ext WHERE personnel=' . $mega['id'];
|
||||||
//p2($q3);
|
//p2($q3);
|
||||||
$usr_ext = single_row_select($q3,0,$c2);
|
$usr_ext = single_row_select($q3,0,$c2);
|
||||||
//p2($usr_ext);
|
//p2($usr_ext);
|
||||||
$mega = $_->extend( (object) $mega, (object) $usr_ext );
|
$mega = $_->extend( (object) $mega, (object) $usr_ext );
|
||||||
|
|
||||||
$q4 = 'SELECT person, officehours, title, picture, education, bio, courses, personal_page, changed FROM webpages WHERE person=' . $mega->id; // personnel=1');
|
$q4 = 'SELECT person, officehours, title, picture, education, bio, courses, personal_page, changed FROM webpages WHERE person=' . $mega['id']; // personnel=1');
|
||||||
//p2($q3);
|
//p2($q3);
|
||||||
$usr_web = single_row_select($q4,0,$c);
|
$usr_web = single_row_select($q4,0,$c);
|
||||||
//p2($usr_ext);
|
//p2($usr_ext);
|
||||||
$mega = $_->extend( (object) $mega, (object) $usr_web );
|
$mega = $_->extend( (object) $mega, (object) $usr_web );
|
||||||
|
|
||||||
/*
|
|
||||||
if (!isset($mega->use_dir_photo)) {
|
if (!isset($mega->use_dir_photo)) {
|
||||||
$mega->pic_exists = check_dir_photo($mega->first_name, $mega->last_name);
|
$mega->pic_exists = check_dir_photo($mega->first_name, $mega->last_name);
|
||||||
if ($mega->pic_exists) {
|
if ($mega->pic_exists) {
|
||||||
|
|
@ -1588,20 +1413,23 @@ function get_a_user($user_email) { global $c, $c2, $_;
|
||||||
} else {
|
} else {
|
||||||
$mega->bbqueryfix = "UPDATE gavi_personnel_ext SET use_dir_photo=0 WHERE id='{$mega->ext_id}'";
|
$mega->bbqueryfix = "UPDATE gavi_personnel_ext SET use_dir_photo=0 WHERE id='{$mega->ext_id}'";
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
if (! isset($mega->ext_id)) {
|
if (! isset($mega['ext_id'])) {
|
||||||
$mega->aaqueryfix = "INSERT INTO gavi_personnel_ext (personnel) VALUES('{$mega->id}')"; }
|
$mega->aaqueryfix = "INSERT INTO gavi_personnel_ext (personnel) VALUES('{$mega['id']}')"; }
|
||||||
elseif ($mega->id && ! $mega->personnel_id) {
|
elseif ($mega->id && ! $mega->personnel_id) {
|
||||||
$mega->aaqueryfix = "UPDATE gavi_personnel_ext SET personnel='{$mega->id}' WHERE id='{$mega->ext_id}'"; }
|
$mega->aaqueryfix = "UPDATE gavi_personnel_ext SET personnel='{$mega['id']}' WHERE id='{$mega['ext_id']}'"; }
|
||||||
|
|
||||||
|
|
||||||
return $mega; }
|
return $mega; }
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
function insert_c2($q) {
|
function insert_c2($q) {
|
||||||
global $c2;
|
global $c2;
|
||||||
$result = single_row_insert($q,0,$c2);
|
$result = single_row_insert($q,0,$c2);
|
||||||
return $result; }
|
return $result; }
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
function merge_tables() { global $c, $_;
|
function merge_tables() { global $c, $_;
|
||||||
$all_personnel = multi_row_select('SELECT first_name,last_name,department,room,phone_number,email,web_on,id FROM personnel WHERE status IS null OR status=1',0, $c);
|
$all_personnel = multi_row_select('SELECT first_name,last_name,department,room,phone_number,email,web_on,id FROM personnel WHERE status IS null OR status=1',0, $c);
|
||||||
|
|
@ -1636,14 +1464,14 @@ function fetch_personnel_dir() { global $c;
|
||||||
exit(); }
|
exit(); }
|
||||||
if (isset($_REQUEST['personnel'])) { fetch_personnel_dir(); }
|
if (isset($_REQUEST['personnel'])) { fetch_personnel_dir(); }
|
||||||
|
|
||||||
function fetch_conf_users() { global $c2;
|
function fetch_conf_users() { global $c;
|
||||||
$all_personnel = multi_row_select('SELECT * FROM conf_users',0, $c2);
|
$all_personnel = multi_row_select('SELECT * FROM conf_users',0, $c);
|
||||||
echo json_encode($all_personnel);
|
echo json_encode($all_personnel);
|
||||||
exit(); }
|
exit(); }
|
||||||
if (isset($_REQUEST['users'])) { fetch_conf_users(); }
|
if (isset($_REQUEST['users'])) { fetch_conf_users(); }
|
||||||
|
|
||||||
function fetch_personnel_ext() { global $c2;
|
function fetch_personnel_ext() { global $c;
|
||||||
$all_personnel = multi_row_select('SELECT * FROM gavi_personnel_ext',0, $c2);
|
$all_personnel = multi_row_select('SELECT * FROM gavi_personnel_ext',0, $c);
|
||||||
echo json_encode($all_personnel);
|
echo json_encode($all_personnel);
|
||||||
exit(); }
|
exit(); }
|
||||||
if (isset($_REQUEST['personnelext'])) { fetch_personnel_ext(); }
|
if (isset($_REQUEST['personnelext'])) { fetch_personnel_ext(); }
|
||||||
|
|
@ -1696,10 +1524,10 @@ function navigation($user) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function test_sso() { global $c2;
|
function test_sso() { global $c;
|
||||||
$goo = "102586"; //"123456";
|
$goo = "102586"; //"123456";
|
||||||
$q0 = "SELECT email FROM conf_users WHERE goo='{$goo}'";
|
$q0 = "SELECT email FROM conf_users WHERE goo='{$goo}'";
|
||||||
$temp_usr = single_row_select($q0,0,$c2);
|
$temp_usr = single_row_select($q0,0,$c);
|
||||||
echo '<pre>';
|
echo '<pre>';
|
||||||
var_dump($temp_usr);
|
var_dump($temp_usr);
|
||||||
echo '</pre>';
|
echo '</pre>';
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
|
|
@ -918,7 +918,7 @@ const ActivityList = Vue.component('activitylist', {
|
||||||
data: function () {
|
data: function () {
|
||||||
return { activities:[], mysessions:[], search:'', sortby:'starttime', reversed:false, my_ses_ids:[], my_host_ids:[],
|
return { activities:[], mysessions:[], search:'', sortby:'starttime', reversed:false, my_ses_ids:[], my_host_ids:[],
|
||||||
show_filters: 'all', expanded: 1, editing: -1, active:-1, hosts:{},
|
show_filters: 'all', expanded: 1, editing: -1, active:-1, hosts:{},
|
||||||
hosts_by_sesid: {}, options:{}, conference:{}, ay:{}, conf:-1, survey_on:0, zoom_on:0, } },
|
hosts_by_sesid: {}, options:{}, conference:{}, ay:{}, conf:-1, survey_on:0, zoom_on:1, } },
|
||||||
mounted: function() {
|
mounted: function() {
|
||||||
this.fetch_myevents()
|
this.fetch_myevents()
|
||||||
},
|
},
|
||||||
|
|
@ -939,21 +939,23 @@ const ActivityList = Vue.component('activitylist', {
|
||||||
else { this.reversed = false; this.sortby = ss } },
|
else { this.reversed = false; this.sortby = ss } },
|
||||||
swapme: function(x) { this.editing = x },
|
swapme: function(x) { this.editing = x },
|
||||||
done_edit: function(id) { this.editing = -1 },
|
done_edit: function(id) { this.editing = -1 },
|
||||||
am_editing: function(id) { return 1 },
|
am_editing: function(id) { return 0 },
|
||||||
fetch_myevents: function() {
|
fetch_myevents: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
basic_get('api2.php?query=app',
|
basic_get('api2.php?query=app',
|
||||||
function(r2) {
|
function(r2) {
|
||||||
self.mysessions = r2.mysessions
|
self.mysessions = r2.mysessions
|
||||||
|
self.my_ses_ids = _.pluck(r2.mysessions, 'id')
|
||||||
self.activities = r2.sessions
|
self.activities = r2.sessions
|
||||||
self.my_host_ids = r2.host
|
if (r2.host != null) { self.my_host_ids = r2.host }
|
||||||
|
else { self.my_host_ids = [] }
|
||||||
self.options = r2.options
|
self.options = r2.options
|
||||||
self.conference = r2.conference
|
self.conference = r2.conference
|
||||||
self.ay = r2.ay
|
self.ay = r2.ay
|
||||||
self.active = 1
|
|
||||||
|
|
||||||
self.survey_on = parseInt( _.findWhere(self.options, { label:'survey_on' }).value )
|
self.survey_on = parseInt( _.findWhere(self.options, { label:'survey_on' }).value )
|
||||||
self.zoom_on = parseInt( _.findWhere(self.options, { label:'zoom_on' }).value )
|
self.zoom_on = parseInt( _.findWhere(self.options, { label:'zoom_on' }).value )
|
||||||
|
self.active = 1
|
||||||
self.$forceUpdate();
|
self.$forceUpdate();
|
||||||
|
|
||||||
} )
|
} )
|
||||||
|
|
@ -1012,19 +1014,7 @@ const ActivityList = Vue.component('activitylist', {
|
||||||
var self=this; return _.groupBy(self.mysessions_filtered, function(x) { return self.month_year(x.starttime) } ); }, },
|
var self=this; return _.groupBy(self.mysessions_filtered, function(x) { return self.month_year(x.starttime) } ); }, },
|
||||||
watch: { },
|
watch: { },
|
||||||
template: `<div class="activitylist">
|
template: `<div class="activitylist">
|
||||||
|
<div>
|
||||||
<div v-if="am_editing">
|
|
||||||
<div v-for="items,mmyy in activities_g_filtered">
|
|
||||||
<div class="pure-g">
|
|
||||||
<div class="day_title pure-u-1-1">{{mmyy}} {{get_day_title(mmyy)}}</div>
|
|
||||||
</div>
|
|
||||||
<div v-for="a in items" class="activitylist">
|
|
||||||
<activityinlineedit :which="a.id"></activityinlineedit>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-else>
|
|
||||||
<div v-if="itineraryview" class="itn_now">
|
<div v-if="itineraryview" class="itn_now">
|
||||||
Current time is: {{ current_time }}. Return here for the ZOOM links on the day of your sessions.
|
Current time is: {{ current_time }}. Return here for the ZOOM links on the day of your sessions.
|
||||||
<br />
|
<br />
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ if (isset($_REQUEST['y']) ) { $y = $_REQUEST['y']; }
|
||||||
|
|
||||||
$day = $y . "-" . $m . "-" . $d;
|
$day = $y . "-" . $m . "-" . $d;
|
||||||
|
|
||||||
|
date_default_timezone_set('America/Los_Angeles');
|
||||||
$dateObj = DateTime::createFromFormat('!m', $m);
|
$dateObj = DateTime::createFromFormat('!m', $m);
|
||||||
$monthName = $dateObj->format('F'); // March
|
$monthName = $dateObj->format('F'); // March
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,106 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// _____ _____ _ _ _____ _ ______ _ ____ _ _
|
||||||
|
// / ____|_ _| \ | |/ ____| | | ____| (_) / __ \| \ | |
|
||||||
|
// | (___ | | | \| | | __| | | |__ ___ _ __ _ _ __ | | | | \| |
|
||||||
|
// \___ \ | | | . ` | | |_ | | | __| / __| |/ _` | '_ \ | | | | . ` |
|
||||||
|
// ____) |_| |_| |\ | |__| | |____| |____ \__ \ | (_| | | | | | |__| | |\ |
|
||||||
|
// |_____/|_____|_| \_|\_____|______|______| |___/_|\__, |_| |_| \____/|_| \_|
|
||||||
|
// __/ |
|
||||||
|
// |___/
|
||||||
|
// SSO
|
||||||
|
//
|
||||||
|
// Set GLOBAL VARS corresponding to current logged in user.
|
||||||
|
// They may only edit their own dir info.
|
||||||
|
//
|
||||||
|
|
||||||
|
date_default_timezone_set('America/Los_Angeles');
|
||||||
|
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Log everything!
|
||||||
|
function log_it($action) {
|
||||||
|
global $USER, $USER_GOO, $USER_EMAIL, $c;
|
||||||
|
|
||||||
|
if (! $USER) {
|
||||||
|
$USER = array( 'user_id'=>'unknown', 'id'=>-1 ); }
|
||||||
|
$user_browser = $_SERVER['HTTP_USER_AGENT'];
|
||||||
|
$user_ip = $_SERVER['REMOTE_ADDR'];
|
||||||
|
|
||||||
|
$BROWSER = ''; // insert_or_get_browser($user_browser);
|
||||||
|
$ACTION = ok($action) . " / " . dumpit($USER) . " / " . $USER_GOO . " / " . $USER_EMAIL;
|
||||||
|
|
||||||
|
//$persid = $USER->id;
|
||||||
|
//if (! $persid) { $persid = -1; }
|
||||||
|
$qupdate = "INSERT INTO gavi_logs SET action='{$ACTION}', " /*personnel_id='{$persid}',name='{$USER['user_id']}', */ . "browser=$BROWSER, ip='$user_ip'";
|
||||||
|
single_row_insert($qupdate,0,$c);
|
||||||
|
return array("result"=>"success","action"=>"logged","query"=>$qupdate,"err"=>mysqli_error($c)); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ( $server == 'intranet1.gavilan.edu' ) { // The SSO check should have happened on the actual page. If it gets
|
||||||
|
// // stuck on an api call the app will break.
|
||||||
|
if ( session_id() == '' ) { // session_status() == PHP_SESSION_ACTIVE // newer php uses this
|
||||||
|
require 'mAuth.php';
|
||||||
|
$USER_TYPE = $attributes['http://wso2.org/claims/Roles'][0];
|
||||||
|
$USER_GOO = $attributes['http://wso2.org/claims/uid'][0];
|
||||||
|
$USER_EMAIL = $attributes['http://wso2.org/claims/emailaddress'][0];
|
||||||
|
session_start();
|
||||||
|
$_SESSION['USER_TYPE'] = $USER_TYPE;
|
||||||
|
$_SESSION['USER_GOO'] = $USER_GOO;
|
||||||
|
$_SESSION['USER_EMAIL'] = $USER_EMAIL;
|
||||||
|
} else { // already logged in....
|
||||||
|
$USER_TYPE = $_SESSION['USER_TYPE'];
|
||||||
|
$USER_GOO = $_SESSION['USER_GOO'];
|
||||||
|
$USER_EMAIL = $_SESSION['USER_EMAIL'];
|
||||||
|
}
|
||||||
|
} else { // just testing on a different server...
|
||||||
|
$USER_TYPE = 'FACULTY'; $USER_GOO = 'G00102586'; $USER_EMAIL = 'phowell@my.gavilan.edu';
|
||||||
|
session_start();
|
||||||
|
$_SESSION['USER_TYPE'] = $USER_TYPE;
|
||||||
|
$_SESSION['USER_GOO'] = $USER_GOO;
|
||||||
|
$_SESSION['USER_EMAIL'] = $USER_EMAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No email? Might be a problem. Look up by goo
|
||||||
|
if (! $USER_EMAIL) {
|
||||||
|
$goo = substr($USER_GOO, 3);
|
||||||
|
$q0 = "SELECT email,name FROM conf_users WHERE goo='{$goo}'";
|
||||||
|
$temp_usr = single_row_select($q0,0);
|
||||||
|
$USER_NAME = '';
|
||||||
|
|
||||||
|
// Is this a "MISSING USER?" Create an account for them.
|
||||||
|
if (is_null($temp_usr)) {
|
||||||
|
$LC_EMAIL = strtolower($USER_EMAIL);
|
||||||
|
$result = single_row_insert("INSERT INTO conf_users (goo, email, name) VALUES ('{$goo}','{$LC_EMAIL}','{$USER_NAME}');");
|
||||||
|
//echo "INSERT INTO conf_users (goo, email, name) VALUES ('{$goo}','{$LC_EMAIL}','{$USER_NAME}');";
|
||||||
|
//print_r($result);
|
||||||
|
//$logaction = log_it("Made a new conf_users row for {$USER_NAME} / {$LC_EMAIL} / {$USER_GOO}");
|
||||||
|
}
|
||||||
|
$USER_NAME = $temp_usr['name'];
|
||||||
|
$USER_EMAIL = strtolower($temp_usr['email']);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Set up user global
|
||||||
|
$goo = substr($USER_GOO, 3);
|
||||||
|
$usr_qry = "SELECT id AS conf_id, goo AS conf_goo, email AS conf_email, name AS conf_name, active AS conf_active FROM conf_users WHERE goo='{$goo}'";
|
||||||
|
$USER = single_row_select($usr_qry, 0);
|
||||||
|
|
||||||
|
// Check again for missing user entry. Create an account for them.
|
||||||
|
if (is_null($USER)) {
|
||||||
|
$LC_EMAIL = strtolower($USER_EMAIL);
|
||||||
|
$goo = substr($USER_GOO, 3);
|
||||||
|
$USER_NAME = '';
|
||||||
|
$result = single_row_insert("INSERT INTO conf_users (goo, email, name) VALUES ('{$goo}','{$LC_EMAIL}','{$USER_NAME}');");
|
||||||
|
//echo "INSERT INTO conf_users (goo, email, name) VALUES ('{$goo}','{$LC_EMAIL}','{$USER_NAME}');";
|
||||||
|
//print_r($result);
|
||||||
|
//$logaction = log_it("Made a new conf_users row for {$USER_NAME} / {$LC_EMAIL} / {$USER_GOO}");
|
||||||
|
$usr_qry = "SELECT id AS conf_id, goo AS conf_goo, email AS conf_email, name AS conf_name, active AS conf_active FROM conf_users WHERE LOWER(email)='{$USER_EMAIL}'";
|
||||||
|
$USER = single_row_select($usr_qry, 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue