Пример #1
0
 public static function go($email, $traceID = NULL)
 {
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = $traceID != NULL ? array("bool" => 1, "func" => $traceID . ": validEmail") : array("bool" => 1, "func" => ": validEmail");
     //----------------------------------------------------------
     $chk = GenFun::error_CHK(array("email" => $email));
     //----------------------------------------------------------
     $chk = (bool) $chk["bool"] ? self::_validEmail($email, $traceID) : $chk;
     //----------------------------------------------------------
     return $chk;
 }
Пример #2
0
 public static function go($fileName, $content, $fileLocation, $force)
 {
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, "func" => "createFile");
     //----------------------------------------------------------
     $chk = GenFun::error_CHK(array('fileName' => $fileName, 'content' => $content));
     //----------------------------------------------------------
     if (!$chk['bool']) {
         return $chk;
     }
     //----------------------------------------------------------
     $defaultLocation = $_SERVER["DOCUMENT_ROOT"];
     //----------------------------------------------------------
     if (substr($defaultLocation, -1) != "/") {
         $defaultLocation .= "/";
     }
     //----------------------------------------------------------
     $fileLocation = is_null($fileLocation) ? $defaultLocation : $defaultLocation . $fileLocation;
     //----------------------------------------------------------
     if (!is_dir($fileLocation)) {
         if ($force) {
             $fileLocation = GenFun::getPathFromFileLocation($fileLocation);
         }
         //------------------------------------------
         if (!is_dir($fileLocation)) {
             $chk['bool'] = false;
             $chk['message'] = $fileLocation . " directory does not exist";
             return $chk;
         }
     }
     //----------------------------------------------------------
     $file = $fileLocation . $fileName;
     //----------------------------------------------------------
     DupIncluded::createFolderStructure($file);
     //----------------------------------------------------------
     if (file_put_contents($file, $content)) {
         $chk['message'] = $file . " has been successfully created!!!!!";
     } else {
         $chk['bool'] = false;
         $chk['message'] = $file . " was not saved or did not save properly.";
     }
     //----------------------------------------------------------
     return $chk;
 }
Пример #3
0
 public static function chk($username, $accounts_id = NULL)
 {
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, 'traceID' => "session_CFG");
     $userKey;
     //----------------------------------------------------------
     $chk = GenFun::error_CHK(array($username));
     //----------------------------------------------------------
     if ($chk['bool']) {
         if (is_null(Constants::$mysqli)) {
             GenFun::hostConnect();
         }
     } else {
         return $chk;
     }
     //----------------------------------------------------------
     session_start();
     $session_id = GenFun::encrypt(session_id() . self::SALT . $username);
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk = MySQL::getTable(SessionLog_const::TBL, array("session_id" => $session_id, "userKey" => $_COOKIE['user']));
     } else {
         return $chk;
     }
     //----------------------------------------------------------
     $userKey = $username . "-" . rand(0, 13000000);
     setcookie("user", $userKey);
     //----------------------------------------------------------
     if (sizeof($chk['result']) == 0) {
         $chk = InsertINTO::go(array("tableID" => SessionLog_const::TBL, "setArr" => array("userKey" => $userKey, "accounts_id" => $accounts_id, "session_id" => $session_id)));
     } else {
         $chk = Update::go(SessionLog_const::TBL, array("userKey" => $userKey), array("session_id" => $session_id));
         if ($chk['bool']) {
             $chk['message'] = "session for this user has already been established!!!";
         }
     }
     //----------------------------------------------------------
     return $chk;
 }
Пример #4
0
 public function sendLink($email, $message, $url)
 {
     Trace::output($this->traceID, "sendLink");
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, "traceID" => "sendLink");
     //----------------------------------------------------------
     $chk = GenFun::error_CHK($obj);
     //----------------------------------------------------------
     $emailObj = array("emailTo" => $email, 'link' => "http://awwthentic.com/Modules/DOM/uber_src/server/werm/services/Download.php?url={$url}", 'linkTxt' => "Click here to download file.", "message" => $message, "subject" => $subject = $obj['sender'] . " sent you a file!!!");
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk = SendEmail_v0::sendDefault($emailObj);
     } else {
         return $chk;
     }
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk['message'] = "Email was successfully sent to {$email}";
     }
     //----------------------------------------------------------
     return $chk;
 }
Пример #5
0
 public function registerUser($email, $password, $addRowFunction = NULL, $sendConfirmationFunction = NULL, $reDirect = NULL)
 {
     Trace::output($this->traceID, "registerUser");
     //----------------------------------------------------------
     $this->password = $password;
     $this->email = $email;
     is_null($addRowFunction) ? $this->addRowFunction = array($this, "addAccountRow") : ($this->addRowFunction = $addRowFunction);
     $this->tblName = Accounts_const::TBL;
     is_null($addRowFunction) ? $this->addRowFunction = array($this, "registerConfirmationLink") : ($this->sendConfirmationFunction = $sendConfirmationFunction);
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, 'traceID' => "registerUser");
     //----------------------------------------------------------
     $chk = GenFun::error_CHK(array($email, $password));
     //----------------------------------------------------------
     if (!$chk["bool"]) {
         return $chk;
     }
     //----------------------------------------------------------
     /*if(!$this->character_CHK($email)) {
     			$chk['bool'] = false;
     			$chk['message'] = "email must only contain numbers, upper, and lowercase characters!!!";
     		}*/
     //----------------------------------------------------------
     if (!$this->character_CHK($password)) {
         $chk['bool'] = false;
         $chk['message'] = "Password must only contain numbers, upper, and lowercase characters!!!";
     }
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk = MySQL::getTable(Accounts_const::TBL, array("email" => $email));
     } else {
         return $chk;
     }
     //----------------------------------------------------------
     if (!$chk['bool'] || $chk['error']) {
         return $chk;
     }
     //----------------------------------------------------------
     if (sizeof($chk['result']) != 0) {
         $chk['bool'] = false;
         $chk['message'] = "email has already been registered!!!";
     }
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk = $this->start($chk['result'][0], 1, $this->sendConfirmationFunction, $reDirect);
     }
     //----------------------------------------------------------
     return $chk;
 }
Пример #6
0
 public function updateMessages($updateArr, $approve, $close = FALSE)
 {
     Trace::output($this->traceID, "updateMessages");
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, 'function' => "updateMessages");
     //----------------------------------------------------------
     $chk = GenFun::error_CHK(array($updateArr, $approve));
     //----------------------------------------------------------
     if ($chk[bool]) {
         $chk = $this->_updateMessages($updateArr, $approve, $close = FALSE);
     } else {
         return $chk;
     }
     //----------------------------------------------------------
     return $chk;
 }
Пример #7
0
 public function _registerUser($set, $addRowFunction = NULL, $sendConfirmationFunction = NULL, $reDirect = NULL)
 {
     Trace::output($this->traceID, "_registerUser", func_get_args());
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, 'traceID' => "registerUser");
     //----------------------------------------------------------
     $this->set = $set;
     $this->set['accountType'] = 3;
     //----------------------------------------------------------
     $this->password = $this->set['password'];
     $this->email = $this->set['email'];
     //----------------------------------------------------------
     $chk = GenFun::error_CHK(array($this->email, $this->password));
     //----------------------------------------------------------
     $this->set['password'] = $this->password = GenFun::encrypt($this->password . $this->salt);
     //----------------------------------------------------------
     $chk = ValidateEmail::go($this->email);
     //----------------------------------------------------------
     if (!$chk["bool"]) {
         return $chk;
     }
     //----------------------------------------------------------
     $this->confirmLinkType = "1";
     //----------------------------------------------------------
     is_null($addRowFunction) ? $this->addRowFunction = array($this, "addAccountRow") : ($this->addRowFunction = $addRowFunction);
     //----------------------------------------------------------
     //$this->tblName = Accounts_const::TBL;
     //----------------------------------------------------------
     is_null($sendConfirmationFunction) ? $this->sendConfirmationFunction = array($this, "registerConfirmationLink") : ($this->sendConfirmationFunction = $sendConfirmationFunction);
     //----------------------------------------------------------
     if (!$chk["bool"]) {
         return $chk;
     }
     //----------------------------------------------------------
     /*if(!$this->character_CHK($this->email)) {
     			$chk['bool'] = false;
     			$chk['message'] = "email must only contain numbers, upper, and lowercase characters!!!";
     		}*/
     //----------------------------------------------------------
     if (!$this->character_CHK($this->password)) {
         $chk['bool'] = false;
         $chk['message'] = "Password must only contain numbers, upper, and lowercase characters!!!";
     }
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk = $this->chkForEmail($this->email);
     } else {
         return $chk;
     }
     //----------------------------------------------------------
     if (!$chk['bool'] || $chk['error']) {
         return $chk;
     }
     //----------------------------------------------------------
     if (sizeof($chk['result']) != 0) {
         $chk['bool'] = false;
         $chk['message'] = "email has already been registered!!!";
     }
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk = $this->start($chk['result'][0], 1, $this->sendConfirmationFunction, $reDirect);
     }
     //----------------------------------------------------------
     return $chk;
 }
Пример #8
0
 public function un_subscribe($email, $categoryID, $type, $categoryName = NULL)
 {
     Trace::output($this->traceID, "subscribe");
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, 'traceID' => "subscribe");
     $linkHash;
     $subscription;
     //----------------------------------------------------------
     $this->type = $type;
     $this->categoryName = $categoryName;
     //----------------------------------------------------------
     $chk = GenFun::error_CHK(array($categoryID, $email));
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk = $subscription = $this->getSubscription($email, $categoryID);
     }
     //----------------------------------------------------------
     if ($chk['error']) {
         return $chk;
     }
     //----------------------------------------------------------
     if ($chk['bool']) {
         $confirm = $this->subscriptionConfirm_CHK($chk['result']);
         if ($this->type == 1) {
             if ($confirm['bool']) {
                 $confirm['message'] = 'You have already subscribed to "' . $categoryName . '"';
                 $confirm['bool'] = false;
                 return $confirm;
             }
             if (!$confirm['bool']) {
                 $chk = $this->confirmLink->getConfirmLink($subscription['result']['id'], NULL, $this->type);
             } else {
                 $chk = $confirm;
             }
         } else {
             if ($subscription['result']['confirmed'] == 0) {
                 $chk['bool'] = false;
                 $chk['message'] = 'You are not subscribed to "' . $categoryName . '"';
                 return $chk;
             } else {
                 if ($confirm['bool']) {
                     $chk = $this->confirmLink->getConfirmLink($subscription['result']['id'], NULL, $this->type);
                 } else {
                     $chk = $confirm;
                 }
             }
         }
         //----------------------------------------------------------
         if ($chk['error']) {
             return $chk;
         }
         if (!$chk['bool']) {
             $chk = $this->confirmLink->confirmLink_CFG($subscription['result']['id'], $this->type);
         }
         if ($chk['bool']) {
             $linkHash = $chk['result']['hash'];
         }
     } else {
         if ($this->type == 1) {
             $chk = $this->addSubsciption($email, $categoryID);
             //------------------------------------------------------
             if (!$chk['bool']) {
                 return $chk;
             }
             //------------------------------------------------------
             if ($chk['bool']) {
                 $chk = $this->confirmLink->confirmLink_CFG(GlobalMas::$mysqli->insert_id, $this->type);
             }
             if ($chk['bool']) {
                 $linkHash = $chk['result']['hash'];
             }
         } else {
             $chk['bool'] = false;
             $chk['message'] = 'You are not subscribed to "' . $categoryName . '"';
         }
     }
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk = $this->sendConfirmation($email, $categoryID, $linkHash, $this->type);
     } else {
         return $chk;
     }
     //----------------------------------------------------------
     if ($chk['bool'] && $this->type == 1) {
         $chk['message'] = "Please check your email and follow the directions to successfully complete the subscription process. Thank you.";
     }
     //----------------------------------------------------------
     if ($chk['bool'] && $this->type == 0) {
         $chk['message'] = "Please check your email and follow the directions to successfully unsubscibe. Thank you.";
     }
     //----------------------------------------------------------
     return $chk;
 }
Пример #9
0
 public function confirm($linkHash = NULL, $confirmTbl = NULL)
 {
     Trace::output($this->traceID, "confirm");
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $row = NULL;
     $confirmLink;
     $tbl = NULL;
     $this->confirmTbl = $confirmTbl;
     //----------------------------------------------------------
     if ($linkHash == NULL && isset($_GET['hash'])) {
         $linkHash = $_GET['hash'];
     }
     //----------------------------------------------------------
     $chk = array("bool" => true, "traceID" => "confirm");
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk = GenFun::error_CHK(array($linkHash, $this->confirmTbl));
     } else {
         return $chk;
     }
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk = $this->getConfirmLink(NULL, $linkHash);
     } else {
         return $chk;
     }
     //----------------------------------------------------------
     $confirmLink = $chk['result'][0];
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk = $this->exp_CHK($confirmLink);
     } else {
         return $chk;
     }
     //----------------------------------------------------------
     if ($confirmLink['type'] == 1) {
         if (!$chk['bool']) {
             $chk = GetTable::go($this->confirmTbl, array("id" => $confirmLink['confirming_id']));
         } else {
             return $chk;
         }
         //------------------------------------------------------
         $tbl = $chk['result'][0];
         //------------------------------------------------------
         if ($chk['bool']) {
             $chk = $this->tblConfirm_CHK($tbl);
         } else {
             return $chk;
         }
         //------------------------------------------------------
         if (!$chk['bool']) {
             $chk = $this->confirmSubscription($tbl['id'], $confirmLink['type']);
         } else {
             return $chk;
         }
         //------------------------------------------------------
     } else {
         if ($confirmLink['type'] == 0) {
             if (!$chk['bool']) {
                 $chk = $this->disableSubscription($confirmLink['confirming_id']);
             } else {
                 return $chk;
             }
         }
     }
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk = $this->disableConfirmLink($linkHash);
     } else {
         return $chk;
     }
     //----------------------------------------------------------
     if ($chk['bool'] && $confirmLink['type'] == 0) {
         $chk['message'] = $email . " has successfully unsubscried to " . $tbl['categories_id'];
     }
     //----------------------------------------------------------
     if ($chk['bool'] && $confirmLink['type'] == 1) {
         $chk['message'] = $email . " has successfully subscried to " . $tbl['categories_id'];
         $chk['type'] = 0;
     }
     //----------------------------------------------------------
     $chk['confirmLink'] = $confirmLink;
     //----------------------------------------------------------
     return $chk;
 }
Пример #10
0
 public function newTeam($team_name)
 {
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $logo_images_id = "DEFAULT";
     $chk = array("bool" => true, 'traceID' => "newTeam");
     //----------------------------------------------------------
     if ($chk['bool'] && sizeof($_FILES) > 0) {
         $this->uploadClass = new UploadHandler(false);
         //------------------------------------------------------
         $chk = GenFun::error_CHK(array($team_name));
         //------------------------------------------------------
         $result = $this->uploadClass->post(false);
         //------------------------------------------------------
         if (is_null($result["files"][0]->error)) {
             $chk = InsertINTO::go(array("tableID" => "images", "setArr" => array('url' => $result['files'][0]->url, 'accounts_id' => GlobalMas::$loggedIN['accounts_id'], "uploadresult" => "'" . json_encode($result["files"]) . "'")));
         }
         //------------------------------------------------------
         if (is_null($result["files"][0]->error)) {
             $logo_images_id = GlobalMas::$mysqli->insert_id;
         }
     }
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk = InsertINTO::go(array("tableID" => "teams", "setArr" => array("name" => $team_name, 'logo_images_id' => $logo_images_id, "team_organizer_accounts_id" => GlobalMas::$loggedIN['accounts_id'])));
     }
     //----------------------------------------------------------
     $chk['result']['team_name'] = $team_name;
     $chk['result']['team_id'] = GlobalMas::$mysqli->insert_id;
     //----------------------------------------------------------
     return $chk;
 }
Пример #11
0
 public function sendLink($obj)
 {
     Trace::output($this->traceID, "sendLink");
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, "traceID" => "sendLink");
     //----------------------------------------------------------
     //$arr = explode("#v-", $obj['url']);
     //----------------------------------------------------------
     $chk = GenFun::error_CHK($obj);
     //----------------------------------------------------------
     $chk = InsertInto::go('suggestions', array('hash' => $obj['hash'], 'sender' => $obj['sender'], "broken" => $obj['broken'], "subject" => $subject, 'message' => $obj['message']));
     //----------------------------------------------------------
     if (!empty($chk['duplicate'])) {
         $chk['message'] = "This video has already been suggested to you by '" . $chk["duplicate"]['result'][0]["sender"] . "'.";
     }
     //----------------------------------------------------------
     $emailObj = array("emailTo" => GlobalMas::EMAIL, 'link' => $obj['url'] . "?suggestion_id=" . GlobalMas::$mysqli->insert_id, 'linkTxt' => "Click here to see video", "message" => $obj['message'], "subject" => $subject = $obj['sender'] . " sent you a youtube link!!!");
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk = SendEmail_v0::sendDefault($emailObj);
     } else {
         return $chk;
     }
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk = GenFun::errorKey_CHK($obj, array("url", "sender"));
     } else {
         return $chk;
     }
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk['message'] = "Link was successfully sent to Wilmer";
     }
     //----------------------------------------------------------
     if ($chk['bool']) {
         $this->resetQueries();
     }
     //----------------------------------------------------------
     return $chk;
 }