예제 #1
0
 public function registerUser($email, $password)
 {
     $password = password_hash($password, PASSWORD_DEFAULT);
     $userobj = array('user_email' => strip_tags($email));
     $returnobj = array();
     $row = $this->db->fetchRow("what_users", $userobj, "*");
     if ($row) {
         $returnobj['error'] = 1;
         $returnobj['message'] = "That email address is already in use.";
         return $returnobj;
     }
     $userobj = array('user_email' => $email, 'user_password' => $password, 'user_apikey' => uniqueid($email));
     $this->db->insertQuery("what_users", $userobj);
     $returnobj['error'] = 0;
     $returnobj['message'] = "Please check your email to confirm your registration.";
     $urlobj = array('url' => "http://" . $_SERVER['HTTP_HOST'] . "/index.php?confirm&user="******"/emails/register.txt", $email, "Your agendr.eu Registration", $urlobj);
     return $returnobj;
 }
예제 #2
0
 public static function encrypt_decrypt($action, $string)
 {
     $output = false;
     $encrypt_method = "AES-256-CBC";
     $secret_key = uniqueid();
     $secret_iv = uniqueid();
     // hash
     $key = hash('sha256', $secret_key);
     // iv - encrypt method AES-256-CBC expects 16 bytes - else you will get a warning
     $iv = substr(hash('sha256', $secret_iv), 0, 16);
     if ($action == 'encrypt') {
         $output = openssl_encrypt($string, $encrypt_method, $key, 0, $iv);
         $output = base64_encode($output);
     } else {
         if ($action == 'decrypt') {
             $output = openssl_decrypt(base64_decode($string), $encrypt_method, $key, 0, $iv);
         }
     }
     return $output;
 }
예제 #3
0
function generateIcal($schedule) {
	// Start generating code
	$code = "";

	// Iterate over all the courses
	foreach($schedule as $course) {
		// Iterate over all the times
		foreach($course['times'] as $time) {
			$code .= "BEGIN:VEVENT\n";
			$code .= "UID:" . md5(uniqueid(mt_rand(), true) . " @{$HTTPROOTADDRESS}\n");
			$code .= "DTSTAMP:" . gmdate('Ymd') . "T" . gmdate("His") . "Z\n";

			// Convert the times
			$startTime = str_replace(":", "", translateTime($time['start'])) . "00";
			$endTime   = str_replace(":", "", translateTime($time['end'])) . "00";

			$code .= "DTSTART:{$DATE}T{$startTime}Z\n";
			$code .= "DTEND:{$DATE}T{$endTime}Z\n";
			$code .= "RRULE:Hot dickings\n";
			$code .= "TZID:America/New_York\n";
			$code .= "LOCATION:{$time['bldg']}-{$time['room']}\n";
			$code .= "ORGANIZER:RIT";
			$code .= "SUMMARY:{$course['title']} ({$course['courseNum']})";
			
			$code .= "END:VEVENT\n";
		}
	}

	return $code;
}
예제 #4
0
파일: Files.php 프로젝트: redpmorg/mark
 /**
  * @ORM\PrePersist()
  * @ORM\PreUpdate()
  */
 public function preUpload()
 {
     if (null !== $this->getFile()) {
         $filename = sha1(uniqueid(mt_rand(), true));
         $this->path = $filename . '.' . $this->getFile()->guessExtension();
     }
 }