protected function performActions(array $data) { $_filesystem = Config::getFileSystem(true); switch ($data[self::$ACTION]) { case self::A_RESIZE_PROFILE_IMAGE: $this->resizeProfileImage($_filesystem, $data["user_id"]); break; } if (method_exists($_filesystem, "disconnect")) { $_filesystem->disconnect(); } unset($_filesystem); }
public function getEmailHtml(\string $template_name, User $to_user, \string $view_key) : \string { $base_path = __DIR__ . self::$FOLDER_PATH . DIRECTORY_SEPARATOR . $template_name . DIRECTORY_SEPARATOR; $body_html = file_get_contents($base_path . self::$HTML_FILE_NAME); $query = "SELECT * FROM email_log WHERE view_key = :v AND template = :t AND user_id = :u"; $data = $this->_pdo->fetchOne($query, ["v" => $view_key, "t" => $template_name, "u" => $to_user->getId()]); if (!$data) { return ""; } $data = unserialize($data["vars"]); foreach ($data as $key => $var) { $body_html = str_replace("#!" . $key . "!#", $var, $body_html); } return str_replace("#!BASE_URL!#", Config::getBaseUrl(), $body_html); }
<?php require_once __DIR__ . "/../../FMA/autoload.php"; error_reporting(0); $_pdo = new \FMA\PDO\MySQL_PDO(); $_auth = new \FMA\Auth\SessionAuth($_pdo); $router = new AltoRouter([], "/image"); $_fs = \FMA\Config::getFileSystem(); $router->map("GET", "/profile/[small|medium|large:size]/[i:id]/", function ($size, $id) use($_pdo, $_fs, $_auth) { $user = \FMA\User\User::find($_pdo, $id); if (is_null($user)) { return; } $img = $user->getImageFile($_fs); $file_name = strtolower($user->getNameFirst() . "-" . $user->getNameLast() . "." . $img->getExtension()); header("Content-Disposition: inline; filename=\"" . $file_name . "\""); if (is_null($img) || !$img->isImage()) { return; } $_im = \FMA\Image\GDImageManipulator::read($img); if ($size == "medium") { $_im->resize("50%", "50%"); } else { if ($size == "small") { $_im->resize("25%", "25%"); } } $_im->output($img->getExtension()); }); $match = $router->match(); if ($match && !is_callable($match["target"])) {
<?php require_once __DIR__ . "/../../FMA/autoload.php"; $_pdo = new \FMA\PDO\MySQL_PDO(); $_auth = new \FMA\Auth\SessionAuth($_pdo); $_auth->validate(); $_user = \FMA\User\User::find($_pdo, $_GET["id"]); if (is_null($_user)) { header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found"); exit; } $vCard = new \JeroenDesloovere\VCard\VCard(); $vCard->addName($_user->getNameLast(), $_user->getNameFirst()); $vCard->addPhoneNumber($_user->getPhoneNumber()); $vCard->addEmail($_user->getEmailUniversity()); $vCard->addCompany($_user->isBrother() ? "" : "Associate"); $vCard->addPhoto("http://" . \FMA\Config::getBaseUrl() . "/image/profile/large/" . $_user->getId()); $vCard->download();
public static function isDevServer() : bool { return Utility::stringContains(Config::getEnvironment(), ["dev", "test"], false); }
private function sendChapterMeetingEmail(\int $event_id) { $_event = Event::find($this->_pdo, $event_id); $this->_mailer->sendChapterMeetingEmail($_event, Config::getFileSystem()); }
require_once __DIR__ . "/../FMA/autoload.php"; $_pdo = new \FMA\PDO\MySQL_PDO(); $in_string = file_get_contents(__DIR__ . "/../config/query_log.sql"); preg_match_all('/-- START\\s-- DATE:\\s([^\\s]*)\\s([\\S\\s]*?)\\s-- END/i', $in_string, $m, PREG_SET_ORDER); $matches = []; foreach ($m as $key => $match) { if (isset($matches[$match[1]])) { $matches[$match[1]] = $match[2] . "\n\n" . $matches[$match[1]]; } else { $matches[$match[1]] = $match[2]; } } unset($m, $match, $key); $matches = array_reverse($matches); foreach ($matches as $key => $value) { $matches[$key] = preg_split('/;(\\s*)/', $value); } $last_update = \FMA\Utility::getDateTimeFromMySQLDate(\FMA\Config::getLastUpdate()); foreach ($matches as $date => $queries) { $date = \FMA\Utility::getDateTimeFromMySQLDate($date); if ($date <= $last_update) { continue; } foreach ($queries as $query) { $_pdo->perform($query); } } end($matches); \FMA\Config::setLastUpdate(key($matches));