예제 #1
0
    }
    exit;
}
if (isset($_REQUEST['bind'])) {
    $class_name = addslashes(trim($_REQUEST['bind']));
    checkClass($class_name);
    require FANWE_ROOT . "login/" . $class_name . ".php";
    if (class_exists($class_name)) {
        $module = new $class_name();
        $module->bindJump();
    }
    exit;
}
if (isset($_REQUEST['unbind'])) {
    $class_name = addslashes(trim($_REQUEST['unbind']));
    checkClass($class_name);
    require FANWE_ROOT . "login/" . $class_name . ".php";
    if (class_exists($class_name)) {
        $module = new $class_name();
        $module->unBind();
    }
    exit;
}
//同步微博
if (isset($_REQUEST['loop'])) {
    $uid = intval($_REQUEST['uid']);
    echo syn_weibo($uid);
}
function syn_weibo($uid)
{
    global $_FANWE;
 $dropMasterStmt->execute(array($department));
 $insertMasterString = "";
 $insertUserString = "";
 $badFormatUsers = [];
 $badClassUsers = [];
 $badEmailUsers = [];
 //Arrays to hold query values
 $insertMasterArray = array();
 $insertUserArray = array();
 //process each user
 foreach ($fileLines as $user) {
     $userData = explode(",", $user);
     // userData should have format <*****@*****.**>,<firstName>,<lastName>,<type>
     if (4 == sizeof($userData)) {
         // userData has expected number of elements
         if (checkClass($userData[3])) {
             // type is expected format; "Student" | "Faculty" | "Admin"
             // TODO: check length and format of elements
             $netid = getNetId($userData[0]);
             if ($netid) {
                 //$netid != false
                 // ('id', 'department')
                 $insertMasterString .= "(?, ?), ";
                 array_push($insertMasterArray, $netid, $department);
                 $curUserInfo = getCurUserInfo($db, $netid);
                 // check if user is already in User table. If they are, update their personal info if it's different
                 // if they are not in the User table, add them.
                 if (empty($curUserInfo)) {
                     //user not in User table, add them to user table
                     //('uID', 'firstName', 'lastName', 'class', 'curWeekHrs', 'nextWeekHrs', 'thirdWeekHrs', 'hasBookingDurationRestriction')
                     $insertUserString .= "(?, ?, ?, ?, ?, ?, ?, ?), ";