diff options
| author | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-04-17 12:12:22 +0300 |
|---|---|---|
| committer | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-04-17 12:12:22 +0300 |
| commit | 68fc9e55e538e03f94509731ab41a0c8cf96710f (patch) | |
| tree | 3edb1e81864ac3eb35ba0fe8087ed24da1b812bf /html/app/extends | |
| parent | 84b2da85a1b452922dadb6a609533b9945afe51d (diff) | |
| download | classroom-68fc9e55e538e03f94509731ab41a0c8cf96710f.tar.gz classroom-68fc9e55e538e03f94509731ab41a0c8cf96710f.tar.bz2 classroom-68fc9e55e538e03f94509731ab41a0c8cf96710f.zip | |
setup a real server environment (apache DocumentRoot=/var/www/public)
Diffstat (limited to 'html/app/extends')
| -rw-r--r-- | html/app/extends/Classroom_manager.php | 106 | ||||
| -rw-r--r-- | html/app/extends/Classroom_user.php | 88 | ||||
| -rw-r--r-- | html/app/extends/Send_mail.php | 190 |
3 files changed, 0 insertions, 384 deletions
diff --git a/html/app/extends/Classroom_manager.php b/html/app/extends/Classroom_manager.php deleted file mode 100644 index 4d38ba3..0000000 --- a/html/app/extends/Classroom_manager.php +++ /dev/null @@ -1,106 +0,0 @@ -<?php -namespace app\extends; - -use UserManager; -use Registry; - - -/** ClassUserManager - * - * extends (anom's) UserManager - * - * this way it specializes the UserManagement - * according to this app's special rules - * - */ -class Classroom_manager extends UserManager -{ - - private $index_key = 'email'; // identifing user field (username, email, etc ) - - protected $user; - - public function __construct() - { - parent::__construct(); - } - - - /** register user - * - * register into database; - * send OTP for account confirmation - * - * @param (void) : user properties passed via REQUEST->POST - * - */ - public function register_user() - { - $req = Registry::get('REQUEST'); - $register = User_model::registerUser($req->POST); - - if ($register['success']) { - - //create OTP; - $otp = $this->create_OPT($register['id']); - - // send for account confirmation - - - } else { - print_r($register); - } - - } - - - public function login_user() - { - - } - - - /** forgot password - * - * send an otp - * (then verify) - * - */ - public function forgot_password() - { - - } - - - /** create OTP - * - * create a random OTP - * keep it into User's database Table - * - * @param $id (int): user id - * - */ - public function create_OTP($id) - { - $otp = rand(100000,999999); - User_model::set_OTP($id, $otp); - - return true; - } - - - /** Verify Account - * - * check if posted OTP matched the one sent to the user - * - * @param $identity (array): pair of [index_key => identity_value] - * example: [ 'email' => 'geo@roptron.gr' ] - * - */ - public function verify_otp($identity, $otp) - { - - } - - -}
\ No newline at end of file diff --git a/html/app/extends/Classroom_user.php b/html/app/extends/Classroom_user.php deleted file mode 100644 index 1c26e73..0000000 --- a/html/app/extends/Classroom_user.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php -namespace app\extends; - -use User; -use Registry; - - -/** Classroom_user - * - * extends (anom's) User - * - * this way it specializes the UserManagement - * according to this app's special rules - * - * Add privileges concept - * --- - * A Class_user has privileges (which are deferent than Roles) - * In fact, privileges extend the authorization requirements for users - * - * Authorized content is marked with some 'minimum Privilege' - * So the content is available to the READER(s) that have certain Privileges - * - */ -class Classroom_user extends User -{ - - /** user id - * @var int - */ - private $id; - - /** user privileges - * @var array - */ - private $privileges = []; - - - /** SETTERS AND GETTERS - * for id and privileges attributes - * ------------------------------------------------------------------------- - */ - - /** getID - * @return int - */ - public function getID(): int - { - return $this->id; - } - - /** setID() - * - * @param int : user id - * - * @return User - */ - public function setID(int $id): self - { - $this->id = $id; - return $this; - } - - - - /** getPrivileges - * - * @return privileges (array) - */ - public function getPrivileges(): array - { - return $this->privileges; - } - - - /** setPrivileges() - * - * @param array $privileges - * - * @return User - */ - public function setPrivileges(array $privileges): self - { - $this->privileges = $privileges; - return $this; - } - - -}
\ No newline at end of file diff --git a/html/app/extends/Send_mail.php b/html/app/extends/Send_mail.php deleted file mode 100644 index fa0d8d3..0000000 --- a/html/app/extends/Send_mail.php +++ /dev/null @@ -1,190 +0,0 @@ -<?php -namespace app\extends; - -use PHPMailer\PHPMailer\PHPMailer; -use PHPMailer\PHPMailer\SMTP; -use PHPMailer\PHPMailer\Exception; - - -class Send_mail -{ - - private static function init_mail() - { - $mail = new PHPMailer(); - - // setup smpt - $mail->SMTPDebug = 3; - $mail->IsSMTP(); - $mail->Host = MAIL_HOST; - $mail->SMPTAuth = false; - $mail->SMTPSecure = MAIL_ENCRYPTION; - // $mail->Protocol = 'mail'; - - $mail->Mailer = MAIL_MAILER; - $mail->Port = MAIL_PORT; - $mail->Username = MAIL_USERNAME; - $mail->Password = MAIL_PASSWORD; - - return $mail; - } - - - /** - * - */ - private static function init_slack() - { - - } - - - /** - * - * @param $envelope (array): mail from/to and activation code - * - * TODO: - * check for email templating: - * + https://stackoverflow.com/questions/2391171/how-to-get-output-from-local-script-in-php - * + https://stackoverflow.com/questions/171318/how-do-i-capture-php-output-into-a-variable - */ - public static function send_activation_code($envelope) - { - $mail = self::init_mail(); - - // setup format - $mail->CharSet = 'utf-8'; - $mail->IsHTML(true); - - // setup THE mail - // --- -- -- - - - - // It's important not to use the submitter's address as the from address as it's forgery, - // which will cause your messages to fail SPF checks. - // Use an address in your own domain as the from address, put the submitter's address in a reply-to - $mail->setFrom(NO_REPLY_EMAIL, MAIL_FROM_NAME); - $mail->addAddress($envelope['email'], $envelope['name']); - $mail->addReplyTo(REPLY_TO_EMAIL, MAIL_FROM_NAME); - $mail->Subject = 'Εγγραφή στο Classroom'; - $mail->Body = "Χαίρετε,<br> - το παρόν αυτοποιημένο email σάς έχει σταλεί γιατί έχει γίνει αίτημα εγγραφής σας στο Classroom.<br> - <br> - Όνομα επαφής: <b>". $envelope['name'] ."</b><br> - Email : <b>". $envelope['email'] ."</b><br> - <br> - Για να ενεργοποιήσετε την πρόσβασή σας στο site θα πρέπει να παρακαλώ πατήστε στον - παρακάτω σύνδεσμο url - <a href=\"https://eaadhsy.roptron.gr/account/activate?ticket=". $envelope['code'] ."\">. - <br> - <br> - Μετά την ενεργοποίηση θα έχετε πρόσσβαση στο περιεχόμενο του site.<br> - <br> - Μην απαντήσετε στο email γιατί δεν υπάρχει φυσική επαφή η οποία να λαμβάνει τυχόν replies.<br>"; - if (!$mail->send()) { - return false; - } else { - return true; - } - - } - - - - -} - - - - - -/** - * - * - -Optimization per concept alternative technologies ---- -- -- - - - - -## Session -File Session -Database Session -Redis Session -Memcached Session - ---- - -## Cache -File Cache -Database Cache -Redis Cache -Memcashed Cache - ---- - -## Log -File Log -Database Log -Log event to Slack -Log event to Email - - * - * - */ - -/** custom email api - * - * host : https://api.roptron.gr - * apikey : md5(hash)-substring(0,5, md5(service)) 8668d1c4a8f5aba236a8f821d148340f-0c83f - * message : serialize([ - * from[email] => from name - * replyTo[email] => reply-to-Name - * to => [ - * email => email-name - * secondemail => another email name - * ] - * type => html - * charset => utf8 - * subject => mail subject - * mailBody => html string - * ]) - * - */ - -/** Several custom APIs - * - * Mailer - * - * sendpulse - * rU8WEmcHsRcEQaH - * rU8WEmcHsRcEQaH - * - * mailjet - * piipiis@g - * EN6Xg8!99ZTKaYp7 - * - * - * sendGrid - * piipiis - * EN6Xg899ZTKU8WEmcHsR54321 - * - * - * time4vps... - * https://community.time4vps.com/discussion/75/are-any-ports-blocked-by-time4vps - * - * test activation code: - * ca42d68cfba5fbbafeacc010b8e3a551 - * - * - * - * MAIL API - * --- -- -- - - - - * client = ip/mp5(IP) or domain/md5(ref_domain) - * token = md5(client + timestamp + rand(0,10000)) - * - * api : auth_content : client : token - * --- : --- : --- : --- - * mail : ip|domain : md5(*) : md5(...) -> send an email - * image : ip|domain : md5(*) : md5(...) -> proccess an image (resize|crop|convert) - * slack : ip|domain : md5(*) : md5(...) -> send a slack message to channel - * database : ip|domain : md5(*) : md5(...) -> - * - */ -
\ No newline at end of file |
