protected static function handler() { try { $found_a_match = false; foreach (self::$_urlpatterns as $apps) { if (self::patterns($apps[0]) == false) { continue; } else { $found_a_match = true; } return; } if ($found_a_match === false) { throw new PhxException('404'); } } catch (Exception $e) { switch ($e->getMessage()) { case '404': $v = new Views(new Template('error', '404.phtml')); $v->display(); break; default: echo "<h3>Error</h3>"; echo "<p>{$e->getMessage()}</p>"; die; } } }
/** * Init scan process. * Solution for realtime output find on: http://stackoverflow.com/questions/1281140/run-process-with-realtime-output-in-php * Maybe ugly, but sometimes at 3AM it's only what is getting out of head ;-) */ public function initScan() { $view = new Views('templates/head.tpl.php'); $view->set('class', 'scanner'); print $view->render(); set_time_limit(0); $handle = popen(PHP . " scanner.php " . $this->project_id, "r"); if (ob_get_level() == 0) { ob_start(); } while (!feof($handle)) { $buffer = fgets($handle); $buffer = trim(htmlspecialchars($buffer)); $data = explode(';', $buffer); switch ($data[0]) { case 'FOUND': print "<div class=\"infobox\"><h3>Found something</h3><p><strong>Time:</strong> " . $data[1] . "<br><strong>Filter name:</strong> " . $data[2] . "<br><strong>Line:</strong> " . $data[3] . "<br><strong>File:</strong> " . $data[4] . "</p><a href=\"/report/" . $data[5] . "\" target=\"_blank\"><span class=\"button warning_button\" style=\"\">Show report</span></a></div>"; break; case 'NOT_FOUND': print "<div class=\"infobox\"><h3>WOW!</h3><p>Scanner didn't found anything. So your project is sooo secure. You are security mastah, or the filters are too weak ;-) Anyway, I recommend to do a manual code review, to be 100% sure ;-)</p></div>"; break; case 'SCANNED': print "<div class=\"infobox\"><h3>Hmmmm...</h3><p>Your project has been scanned before. Please go to project to check your reports. <br><a href=\"/show/" . $this->project_id . "\" target=\"_parent\"><span class=\"button\">Go to project page</span></a></p></div>"; break; } ob_flush(); flush(); time_nanosleep(0, 10000000); } pclose($handle); ob_end_flush(); }
private function send_password_reset_email($token, $email, $login) { $v = new Views(); $v->username = $login; $v->link = HOST . 'esqueci-minha-senha/' . $token . '/'; $message = $v->render('mail/password_change_request.phtml'); Phalanx::loadExtension('phpmailer'); $mail = new PHPMailer(true); $mail->IsSMTP(); $mail_status = true; try { $mail->AddReplyTo(MAIL_FROM, MAIL_ALIAS); $mail->AddAddress($email, $login); $mail->Subject = 'SkyNerd: Troca de senha'; $mail->MsgHTML($message); $mail->Send(); } catch (phpmailerException $e) { $mail_status = false; var_dump($mail); } if ($mail_status) { $this->session->message = 'PasswordChangeEmailSent'; } else { $this->session->message = 'PasswordChangeEmailNOTSent'; } Request::redirect(HOST . 'login'); }
public function login() { $uid = $this->session->user->id; $token = md5(date('Ymd') . $this->session->user->id . $this->session->user->login . $this->session->user->login . 'HAHAAHAVOACABARCOMISSOJAJA'); $v = new Views(); $v->username = $this->session->user->login; $v->link = HOST . "meu-perfil/redes-sociais/nerdtrack/callback/?uid={$uid}&token={$token}"; $message = $v->render('mail/nerdtrack-link-account.phtml'); Phalanx::loadExtension('phpmailer'); $mail = new PHPMailer(true); $mail->IsSMTP(); $mail_status = true; try { $mail->AddReplyTo(MAIL_FROM, MAIL_ALIAS); $mail->AddAddress($this->post->email_address, $this->session->user->login); $mail->Subject = 'SkyNerd: Vínculo de conta da Nerdtrack'; $mail->MsgHTML($message); $mail->Send(); } catch (phpmailerException $e) { $mail_status = false; } header("Content-type: text/html; charset=utf-8"); if ($mail_status) { Phalanx::loadClasses('SocialNetwork'); SocialNetwork::link_account($this->session->user->id, NERDTRACK, $this->post->email_address, false); die('SUCCESS'); } else { die('FAIL'); } }
public function action_search() { //var_dump($_POST); //Складываем в массив выбранные параметры сортировки $arr = []; foreach ($_POST as $key => $val) { if ($val != '0') { $arr[$key] = $val; } } //Если параметры не выбраны - редирект на главную if (empty($arr)) { header('Location: http://naitidruzei.ru'); } else { // Количество статей на страницу. $count = isset($_GET['count']) ? $_GET['count'] : 5; // Смещение для БД $start = isset($_GET['start']) ? $_GET['start'] : 0; $worker = new News(); //Получаем кол-во строк по нашей выборке $all = $worker->getNumRowsSearch($arr); // Получаем результат запрса по нашей выборке $items = $worker->selectLimitSearch($count, $start, $arr); // Создаем блок ссылок с постраничной навигацией: $pagenav = new SimPageNav(); // Формирурем шаблон вывода $viewer = new Views(); $viewer->items = $items; $viewer->pagenav = $pagenav->getLinks($all, $count, $start, 10, 'start'); $viewer->display('all_views'); } }
function main() { session_start(); $views = new Views(); $models = new Models('localhost', 'hallas', '40352246', 'thehallas'); $route = new Route($_SERVER['REQUEST_URI']); require_once CONTROLLERS . '/' . $route->getParam(1) . '.php'; $controller = eval('return new ' . $route->getParam(1) . '($views, $models, $route);'); if (!$route->getParam(2)) { $controller->index(); } else { eval('$controller->' . $route->getParam(2) . '();'); } $views->render(); }
private function tos() { $this->getOutput()->addModules('skins.settlein.special.tos'); $this->getOutput()->setPageTitle('Terms and conditions | SettleIn'); $data = array(); $html = Views::forge('tos_new', $data); $this->getOutput()->addHTML($html); }
public function UserCard() { Phalanx::loadController("LoginController"); $loginController = new LoginController(); $status = $loginController->isLoggedIn(); if ($status) { $v = new Views(); $v->login = $this->session->user->login; $v->avatar = $this->session->user->other_data->avatar; $v->experience = Profile::experience($this->session->user->id); $v->badges = Badges::from_user($this->session->user->id, 4); echo $v->render("user_mini_card.phtml"); } else { $v = new Views(); echo $v->render("user_mini_card_login.phtml"); } }
function __construct($layout = "default/layout_main") { parent::__construct(); //$this->obj =& get_instance(); $this->layout = $layout; $this->load->config('site_settings', TRUE); $this->siteconfig = $this->config->item('site_settings'); $this->siteconfig['charset'] = $this->config->item('charset'); }
function display($view = '') { if ($view == 'get_presence') { $this->{$view}(); } elseif ($view == 'export_muc_logs') { $this->{$view}(); } else { parent::display($view); } }
function main() { session_start(); $views = new Views(); $models = new Models('localhost', 'fadl', 'vaip', 'fadl'); $route = new Route($_SERVER['REQUEST_URI']); if ($route->getParam(1)) { require_once CONTROLLERS . '/' . $route->getParam(1) . '.php'; $controller = eval('return new ' . $route->getParam(1) . '($views, $models, $route);'); } else { header('location: /Welcome/'); } if (!$route->getParam(2)) { $controller->index(); } else { eval('$controller->' . $route->getParam(2) . '();'); } $views->render(); }
public function action_update() { Controller_admin::check_user(); $items = News::get_one($_GET['id']); $viewer = new Views(); $viewer->items = $items; $viewer->display('edit_views'); if (!empty($_POST['delete'])) { $delete = new Controller_add(); $delete->deleteNews(); } if (!empty($_POST['title'])) { $article = new Add(); $article->title = $_POST['title']; $article->content = $_POST['content']; $article->id_article = $_GET['id']; $article->save(); } }
public function action_one() { // Получаем все комментарии для указанной статьи $comments = Comments::getComments($_GET['id']); // Получаем статью $items = News::get_one($_GET['id']); // Формируем шаблон вывода $viewer = new Views(); $viewer->items = $items; $viewer->comments = $comments; // Если был отправлен комментарий к статье - запускаем функуцию обработчик if (!empty($_POST)) { $viewer->name = $_POST['name']; $viewer->email = $_POST['email']; $viewer->text = $_POST['text']; $viewer->error = Controller_comment::newComment(); } // Выводим $viewer->display('articles_views'); }
function display($view = '') { switch ($view) { case 'ajax_projects': $this->{$view}(); break; case 'browse': $this->_searchPlugins(); default: parent::display($view); } }
public function DisplayWordpressPost() { Phalanx::loadController('LoginController'); $loginController = new LoginController(); $this->isLoggedIn = $loginController->isLoggedIn(); Phalanx::loadClasses('public.Posts', 'public.PostComments'); $post = Posts::GetWPPostData($this->get->post_id, $this->session->user->id, true); $slug = mb_strtolower(preg_replace('/--+/u', '-', preg_replace('/[^\\w\\-]+/u', '-', $post->content->post_title))); if ($slug != $this->get->slug) { Request::redirect_301(HOST . "site/post/{$this->get->post_id}-{$slug}"); } $v = new Views(); $v->title = $post->content->post_title; $v->content = $post->content->post_content; $v->comments = $post->comments; $v->comments_array = PostComments::get($post->post_id); $v->replies = $post->replies; $v->post_id = $post->post_id; $v->rating = $post->rating; $v->when = Date::RelativeTime($post->content->post_date); $v->my_rating = $p->my_rating; $v->current_user = $this->session->user->login; $v->is_favorite = $p->is_favorite; $content = $v->render("post_body_wp.phtml"); $template = new Template("default"); $template->og = new stdClass(); $template->og->title = $v->title; $template->og->description = substr(strip_tags($content), 0, 250); //$template->og->img = MEDIA_DIR . 'images/avatar/big/' . $profile_data->aditional_info->avatar; if (!$this->isLoggedIn) { $template->show_login_bar = true; } $v = new Views($template); $v->data = new stdClass(); $v->data->post = $content; $v->display("single_post_display.phtml"); }
/** * Handle the request */ public static function handle() { if (empty(self::$request)) { self::$request = 'default'; } $req = array('page' => self::$request, 'url' => Config::instance()->get('baseurl') . '/' . self::$request, 'time' => $GLOBALS['numbat_start_time'], 'error' => false); try { $item = new Item(self::$request); Views::load($item, $req); } catch (NumbatDBError $e) { numbat_primative_die($e->getMessage(), 'db', $e->getConfig()); } catch (Numbat404 $e) { $req['error'] = true; $item = new Item('error/404'); Views::load($item, $req); } }
public function run() { $response = Router::get(); if (is_array($response)) { $Class = $response['class']; $method = $response['method']; require_once $_SERVER['DOCUMENT_ROOT'] . '/views/' . $Class . '.php'; $Class = sprintf('\\KeyZ\\%s', $Class); Models::connect(); Session::start(); // Запускаем обработчик запроса и получаем от него данные для отображения // Выводим данные на экран через шаблонизатор Views::display($Class::$method($response['params'])); } else { printf("<b>Error 404:</b> Page not found"); exit; } }
<?php include "models/Views.php"; include "helpers/db.php"; //must be above the Post.php - order of operation include "models/Posts.php"; include "models/Users.php"; include "models/Image.php"; include "models/Items.php"; $myview = new Views(); //$posts = new Posts(); $image = new Image(); $items = new Items(); session_start(); $captchaString = md5(microtime()); $randomCaptcha = substr($captchaString, 0, 6); $image->msg($randomCaptcha); $_SESSION["captcha"] = $randomCaptcha; $myview->getView("views/header.html", array()); if (!empty($_GET["controller"])) { header("Location: controllers/post.php"); } else { ?> <div id="content"> <?php //$myview->getView("views/formLogin.html"); //$myview->getView("views/formRegister.html"); //echo("<hr />"); class Items2 extends db { public function getEntry($entryId)
<?php include "application/models/views.php"; $views = new Views(); if (!empty($_GET['action'])) { class showtimes extends Controller { function showtimes() { $views->getViews("application/views/head.php"); $views->getViews("application/views/nav.php"); $views->getViews("application/views/showtimes.php"); $views->getViews("application/views/footer.php"); } } } else { $views->getViews("application/views/head.php"); $views->getViews("application/views/nav.php"); $views->getViews("application/views/home.php"); $views->getViews("application/views/footer.php"); }
<?php //include "/lab/ssl/Views.php"; include "../models/Views.php"; $myview = new Views(); $myview->getView("../views/header.html"); ?> <div id="content"> <?php $myview->getView("../views/user-authentication-form.html"); //var_dump($_POST["username"]); //echo($_POST["username"]); if (!empty($_POST["username"])) { echo $_POST["username"] . "<br />"; } else { echo "<br />Please fill in the Username<br />"; } if (empty($_POST["password"])) { echo "Please fill in the password field<br />"; } elseif (strlen($_POST["password"]) < 8) { echo "Please use eight characters in the password<br />"; } else { echo $_POST["password"] . "<br />"; } if (empty($_POST["email"])) { echo "Please fill in a valid email"; } elseif (!preg_match("^[\\w-]+(\\.[\\w-]+)*@([a-z0-9-]+(\\.[a-z0-9-]+)*?\\.[a-z]{2,6}|(\\d{1,3}\\.){3}\\d{1,3})(:\\d{4})?\$^", $_POST["email"])) { echo "Please provide a valid email"; } else { echo $_POST["email"]; }
<?php include "../models/Views.php"; include "../helpers/db.php"; include "../models/Posts.php"; $myview = new Views(); $posts = new Posts(); session_start(); if (isset($_SESSION["loggedin"])) { //var_dump($_SESSION); echo "<br /> post's session start is working"; } else { header("Location: http://localhost/websites/ssl/day7/main.php"); } if (!isset($_SESSION["loggedin"])) { header("Location: http://localhost/websites/ssl/day7/main.php"); } if (!empty($_GET["action"])) { if ($_GET["action"] == "getAll") { $data = $posts->readPosts(); $myview->getView("../views/body.php", $data); } elseif ($_GET["action"] == "readPost") { $data = $posts->readPost($_GET["postId"]); $myview->getView("../views/blogPost.php", $data); } elseif ($_GET["action"] == "updatePost") { $data = $posts->readPost($_GET["postId"]); $myview->getView("../views/formUpdate.html", $data); } elseif ($_GET["action"] == "changePost") { $posts->updatePost($_POST["title"], $_POST["detail"], $_POST["postId"]); $data = $posts->readPosts(); $myview->getView("../views/body.php", $data);
<?php $tmpUser = new User(sUserMgr()->getCurrentUserID()); $tmpUserInfo = $tmpUser->get(); $adminAllowed = $tmpUser->checkPermission('RVIEWS'); if ($adminAllowed) { $viewMgr = new Views(); $views = $viewMgr->getList(); } $empty_info = array('NAME' => '', 'ID' => '__NEW__', 'WIDTH' => '0', 'HEIGHT' => '0', 'WIDTHCROP' => 0, 'HEIGHTCROP' => 0, 'CONSTRAINHEIGHT' => 0, 'CONSTRAINWIDTH' => 0); $user = new User(sUserMgr()->getCurrentUserID()); $smarty->assign("RVIEWS", $user->checkPermission("RVIEWS")); $smarty->assign('views', $views); $smarty->assign('empty_info', $empty_info); $smarty->assign('win_no', $this->request->parameters['win_no']); $smarty->display('file:' . $this->page_template);
public function Render($data) { Phalanx::loadClasses('Profile'); $posts = array(); foreach ($data as $key => $each) { $v = new Views(); $v->accept_nsfw = Profile::acceptNSFW($this->session->user->id); $v->original_id = $each->original_id; $v->reblog_count = $each->reblog_count; $v->is_reblogged = $each->is_reblogged; $v->current_user = $this->session->user->login; $v->user = $each->user; $v->title = $each->title; $v->name = $each->name; $v->when = $each->when ? $each->when : $each->date; $v->content = $each->content; $v->via = $each->via; $v->comments = $each->comments; $v->replies = $each->replies; $v->rating = $each->rating; $v->my_rating = $each->my_rating; $v->post_id = $each->id; $v->avatar = $each->avatar; $v->categories = $each->categories; $v->is_favorite = $each->is_favorite; $v->is_reblogged = $each->is_reblogged; $v->its_mine = $each->user_id == $this->session->user->id ? true : false; $v->user_points = $each->user_points; $v->promoted = (bool) $each->promoted; if (!empty($each->original_id)) { //Se o post for um reblog, então o conteúdo dele deve ser o do reblogado, mostrando as ações $originalPost = Posts::from_user(false, $v->original_id); $originalPost = reset($originalPost); $v->content = $originalPost->content; $v->title = $originalPost->title; $v->reblogged_from = $originalPost->user; $v->reblog_avatar = $originalPost->avatar; $v->reblog_points = $originalPost->user_points; $v->original_date = $originalPost->date; $v->comments = $originalPost->comments; $v->replies = $originalPost->replies; $v->is_favorite = $originalPost->is_favorite; $v->categories = $originalPost->categories; $v->rating = $originalPost->rating; $v->id = $v->post_id; $v->post_id = $originalPost->id; } $content = $v->render("post_body.phtml"); $posts[] = $content; } return $posts; }
/** * header - public * * Display Wiki Service header */ function header() { $this->html_params['stylesheet'][] = PHPWIKI_PLUGIN_BASE_URL . '/themes/Codendi/phpwiki-codendi.css'; parent::header(); $this->displayMenu(); }
<?php session_start(); // Controller "includes" & reads all of your database connections // & business logic for this app // include "models/Views.Class.php"; include "models/CreateData.Class.php"; include "models/ReadData.Class.php"; include "models/UpdateData.Class.php"; include "models/DeleteData.Class.php"; include "models/Login.Class.php"; include "models/DBCredentials.php"; // Instantiate and make new copies of you Classes inside files above // Store in variables so that we can work with them later $views = new Views(); $create = new CreateData(); $read = new ReadData(); $update = new UpdateData(); $delete = new DeleteData(); $login = new Login(); // Controller starts routing the user based on the form "action" from Views; //Process if the action is not empty, if so move to next if statement //if statements act like switches for when a neccesary model is called upon from user at view //selected action can be seen in url // ! its important to have consistent $salt phrase unless database connection won't work for retrival if (!empty($_GET["action"])) { if ($_GET["action"] == "home") { //Shows Header & Both Forms; Then, show footer $views->getView("views/header.php"); $views->getView("views/signup_form.php");
/** * header - public * * Display Wiki Service header */ function header() { $this->html_params['stylesheet'][] = '/wiki/themes/Codendi/phpwiki-codendi.css'; parent::header(); $this->displayMenu(); }
<?php include "../models/Views.php"; include "../helpers/db.php"; //must be above the Post.php - order of operation include "../models/Users.php"; $myview = new Views(); $users = new Users(); ?> <!--<link href="/day4/css/site.css" rel="stylesheet" />--> <!--dirrect path - can use this due to the ../ paths--> <?php if (!empty($_GET["action"])) { if ($_GET["action"] == "updateUser") { $data = $users->readUser($_GET["userId"]); $myview->getView("../views/formUpdate.php", $data); } elseif ($_GET["action"] == "changeUser") { $users->updateUser($_POST["userName"], $_POST["password"], $_POST["email"], $_POST["userId"]); $data = $users->readUsers(); $myview->getView("../views/body.php", $data); } elseif ($_GET["action"] == "deleteUser") { $users->deleteUser($_GET["userId"]); $data = $users->readUsers(); $myview->getView("../views/body.php", $data); } elseif ($_GET["action"] == "createUser") { $users->createUser($_POST["userName"], $_POST["password"], $_POST["email"]); $data = $users->readUsers(); $myview->getView("../views/body.php", $data); } } elseif (empty($_GET["userId"])) { $data = $users->readUsers(); $myview->getView("../views/body.php", $data);
<?php include "Views.php"; $myview = new Views(); $myview->getView("../views/header.html"); $myview->getView("../views/index.html"); $myview->getView("../views/footer.html");
public function Export() { Phalanx::loadClasses('Profile', 'Badges'); $profile = Profile::get_profile($this->session->user->login, 0, 0, 0, 0, 1, 1, 1); $profile->badges = Badges::from_user($this->sessio->user->id, false); $t = new Template("export"); $t->show_login_bar = true; $userPosts = Posts::exportFromUser($this->session->user->id); $postsImages = array(); $avatarImages = array(); $posts = array(); Phalanx::loadExtension('simple_html_dom'); foreach ($userPosts as $key => $each) { $html = str_get_html($each->content); /* * Em alguns casos o objeto não está sendo criado, gerando um fatal error. * Conteúdo vazio? Estranho, ainda não sei o que está rolando. * Isso aqui resolve. * */ if (is_object($html)) { $images = $html->find('img'); foreach ($images as &$image) { if (stripos($image, HOST)) { $postsImages[] = basename($image->src); $image->src = "./images/posts/" . basename($image->src); } } $each->content = $html; } $avatarImages[] = $each->avatar; $v = new Views(); $v->accept_nsfw = Profile::acceptNSFW($this->session->user->id); $v->current_user = $this->session->user->login; $v->user = $each->user; $v->name = $each->name; $v->when = $each->date; $v->title = $each->title; $v->content = $each->content; $v->comments = $each->comments; $v->comments_array = $each->comments_array; $v->replies = $each->replies; $v->post_id = $each->id; $v->original_id = $each->original_id; $v->is_reblogged = $each->is_reblogged; $v->avatar = $each->avatar; $v->rating = $each->rating; $v->my_rating = $each->my_rating; $v->categories = $each->categories; $v->its_mine = $profile_data->id == $this->session->user->id ? true : false; $v->is_favorite = $each->is_favorite; $v->user_points = $each->user_points; foreach ($each->comments_array as $eachComment) { $avatarImages[] = $eachComment->user->avatar; foreach ($eachComment->replies as $eachReply) { $avatarImages[] = $eachReply->user->avatar; } } if (!empty($each->original_id)) { //Se o post for um reblog, então o conteúdo dele deve ser o do reblogado, mostrando as ações $originalPost = Posts::from_user(false, $v->original_id); $originalPost = reset($originalPost); $v->content = $originalPost->content; $v->title = $originalPost->title; $v->reblogged_from = $originalPost->user; $v->reblog_avatar = $originalPost->avatar; $v->reblog_points = $originalPost->user_points; $v->original_date = $originalPost->date; $v->comments = $originalPost->comments; $v->replies = $originalPost->replies; $v->is_favorite = $originalPost->is_favorite; $v->categories = $originalPost->categories; $v->rating = $originalPost->rating; $v->id = $v->post_id; $v->post_id = $originalPost->id; } $content = $v->render("export/post_body.phtml"); $posts[] = $content; } $v = new Views($t); $v->data = $profile; $v->data->timeline = $posts; ob_start(); $v->display("export/profile.phtml"); $profile_html_data = ob_get_contents(); ob_end_clean(); if (!is_dir(TMP_DIR . DIRECTORY_SEPARATOR . 'export')) { mkdir(TMP_DIR . DIRECTORY_SEPARATOR . 'export', 0755, true); } $dirname = TMP_DIR . DIRECTORY_SEPARATOR . 'export' . DIRECTORY_SEPARATOR . $this->session->user->login . DIRECTORY_SEPARATOR; if (!is_dir($dirname)) { mkdir($dirname, 0755, true); } $filename = "perfil-{$this->session->user->login}.html"; file_put_contents($dirname . $filename, $profile_html_data); $zip = new ZipArchive(); if ($zip->open("{$dirname}data.zip", ZipArchive::CREATE) === TRUE) { $zip->addEmptyDir('css'); foreach (glob(TEMPLATE_DIR . '/export/css/*') as $file) { $zip->addFile($file, "/css/" . basename($file)); } $zip->addEmptyDir('js'); foreach (glob(TEMPLATE_DIR . '/export/js/*') as $file) { $zip->addFile($file, "/js/" . basename($file)); } $zip->addEmptyDir('fonts'); $zip->addEmptyDir('fonts/Engschrift'); foreach (glob(TEMPLATE_DIR . '/export/fonts/Engschrift/*') as $file) { $zip->addFile($file, "/fonts/Engschrift/" . basename($file)); } $zip->addEmptyDir('images'); foreach (glob(TEMPLATE_DIR . '/export/images/*.*') as $file) { $zip->addFile($file, "/images/" . basename($file)); } $zip->addEmptyDir('images/socialnetworks'); foreach (glob(TEMPLATE_DIR . '/export/images/socialnetworks/*') as $file) { $zip->addFile($file, "/images/socialnetworks/" . basename($file)); } $zip->addEmptyDir('images/images'); foreach (glob(TEMPLATE_DIR . '/export/images/images/*') as $file) { $zip->addFile($file, "/images/images/" . basename($file)); } $zip->addEmptyDir('images/avatar'); $zip->addEmptyDir('images/avatar/big'); $zip->addEmptyDir('images/avatar/small'); $zip->addEmptyDir('images/avatar/square'); foreach ($avatarImages as $avatar) { $zip->addFile(AVATAR_UPLOAD_DIR . "/big/{$avatar}", "/images/avatar/big/{$avatar}"); $zip->addFile(AVATAR_UPLOAD_DIR . "/small/{$avatar}", "/images/avatar/small/{$avatar}"); $zip->addFile(AVATAR_UPLOAD_DIR . "/square/{$avatar}", "/images/avatar/square/{$avatar}"); } $zip->addEmptyDir('images/posts'); foreach ($postsImages as $image) { $zip->addFile(POST_IMAGES_UPLOAD_DIR . "/{$image}", "/images/posts/{$image}"); } $zip->addEmptyDir('images/badges'); foreach (glob(ROOT . PROJECT_DIR . '/media/images/badges/*') as $file) { $zip->addFile($file, "/images/badges/" . basename($file)); } $zip->addFile("{$dirname}{$filename}", "/{$filename}"); } $zip->close(); header("Content-disposition: attachment; filename={$this->session->user->login}.zip"); header("Content-type: application/zip"); readfile("{$dirname}data.zip"); $t = new Template("export", "thankyou.phtml"); $v = new Views($t); $v->display(""); $c = new Cookies(); $c->setExpire(strtotime("+15 days")); $c->data_exported = 1; }
public function avatar_upload_frame() { $v = new Views(); echo $v->render("iframe_avatar_upload_fallback.phtml"); }