function generate_profile_image($q) { // Get image file name. $black_ribbon = "ribbon.png"; $white_transparant = "white_transparant.png"; $profile_image = $q; // Get image info. $black_ribbon_info = getimagesize($black_ribbon); $profile_image_info = getimagesize($profile_image); // Define flag image object. $black_ribbon_obj = imagecreatefrompng($black_ribbon); imagealphablending($black_ribbon_obj, true); $white_transparant_obj = imagecreatefrompng($white_transparant); // Check valid image or not. if ($profile_image_info === FALSE) { $content = "<p><span class=\"text text-success\">Your uploaded file is not image file.</span><br />Pleaes try again</p>" . form(); return page_template($content); } // Define profile image object. switch ($profile_image_info[2]) { case IMAGETYPE_GIF: $profile_image_obj = imagecreatefromgif($profile_image); break; case IMAGETYPE_JPEG: $profile_image_obj = imagecreatefromjpeg($profile_image); break; case IMAGETYPE_PNG: $profile_image_obj = imagecreatefrompng($profile_image); break; } imagealphablending($profile_image_obj, true); // Get new sizes of flag base on profile image. list($width, $height) = $black_ribbon_info; list($newwidth, $newheight) = $profile_image_info; list($profile_image_width, $profile_image_height) = $profile_image_info; echo "{$newwidth}||{$newheight}"; if ($newwidth < $newheight) { $newheight = $newwidth / $width * $height; } else { $newwidth = $newheight / $height * $width; } // Resizse news flag. $new_resize_image = imagecreatetruecolor($newwidth, $newheight); imagealphablending($new_resize_image, false); imagesavealpha($new_resize_image, true); imagecopyresized($new_resize_image, $black_ribbon_obj, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); imagesavealpha($new_resize_image, true); $black_ribbon_obj = $new_resize_image; // Combine two image $destination_img_obj = $profile_image_obj; $source_img_obj = $black_ribbon_obj; imagecopy($destination_img_obj, $white_transparant_obj, 0, 0, 0, 0, $profile_image_width, $profile_image_height); imagecopy($destination_img_obj, $source_img_obj, 0, 0, 0, 0, $newwidth, $newheight); imagesavealpha($destination_img_obj, true); $img_name = microtime(true); imagepng($destination_img_obj, "./images/{$img_name}.png"); $content = "\n <p>\n <img src=\"./images/{$img_name}.png\" class=\"img-responsive\">\n <div class=\"clearfix\"></div>\n <span class=\"text text-success\">Your image save successfully.</span><br />\n Try with new another photo again\n </p>" . form(); return page_template($content); }
function generate_profile_image($q) { // Get image file name. $pride_flag = "pride_flag.png"; $profile_image = $q; // Get image info. $pride_flag_info = getimagesize($pride_flag); $profile_image_info = getimagesize($profile_image); // Check valid image or not. if ($profile_image_info === FALSE) { $content = "<p><span class=\"text text-success\">Your uploaded file is not image file.</span><br />Pleaes try again</p>" . form(); return page_template($content); } // Define flag image object. $pride_flag_obj = imagecreatefrompng($pride_flag); // Define profile image object. switch ($profile_image_info[2]) { case IMAGETYPE_GIF: $profile_image_obj = imagecreatefromgif($profile_image); break; case IMAGETYPE_JPEG: $profile_image_obj = imagecreatefromjpeg($profile_image); break; case IMAGETYPE_PNG: $profile_image_obj = imagecreatefrompng($profile_image); break; } // Get new sizes of flag base on profile image. list($width, $height) = $pride_flag_info; list($newwidth, $newheight) = $profile_image_info; // Resizse news flag. $new_resize_image = imagecreatetruecolor($newwidth, $newheight); $source = $pride_flag_obj; imagecopyresized($new_resize_image, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); // Set pride_flag_obj as new image. $pride_flag_obj = $new_resize_image; // Image marge imagealphablending($pride_flag_obj, false); imagesavealpha($pride_flag_obj, true); imagecopymerge($pride_flag_obj, $profile_image_obj, 0, 0, 0, 0, $newwidth, $newheight, 50); imagepng($pride_flag_obj, "profile.png"); $content = " \n <p>\n <img src=\"profile.png\" class=\"img-responsive\">\n <div class=\"clearfix\"></div>\n <span class=\"text text-success\">Your image save successfully.</span><br />\n Try with new anotjer again\n </p>" . form(); return page_template($content); }
} $vals['id'] = $res; if (!empty($vals['post'])) { $p->touch($vals['post']); } if ($vals['subscribe'] == 'Subscribe me to this forum thread.') { if (!$vals['post']) { $vals['post'] = $res; } db_execute('insert into siteforum_subscribe (id, post_id, user_id) values (null, ?, ?)', $vals['post'], session_username()); } $ae = appconf('admin_email'); if ($ae) { @mail($ae, intl_get('Forum Posting Notice'), template_simple('post_email.spt', $vals), 'From: ' . appconf('forum_name') . '@' . site_domain()); } $exempt = explode(',', $ae); $res = db_fetch_array('select distinct u.email, u.username from sitellite_user u, siteforum_subscribe s where s.user_id = u.username and s.post_id = ?', $vals['post']); foreach ($res as $row) { if (in_array($row->email, $exempt)) { continue; } $vals['user_id'] = $row->username; @mail($row->email, intl_get('Forum Posting Notice'), template_simple('post_email_subscriber.spt', $vals), 'From: ' . appconf('forum_name') . '@' . site_domain()); } page_title(intl_get('Message Posted')); echo template_simple('post_submitted.spt', $vals); } } if (appconf('template')) { page_template(appconf('template')); }
<?php // BEGIN KEEPOUT CHECKING // Add these lines to the very top of any file you don't want people to // be able to access directly. if (!defined('SAF_VERSION')) { header('HTTP/1.1 404 Not Found'); echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n" . "<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n" . "The requested URL " . $PHP_SELF . " was not found on this server.<p>\n<hr>\n" . $_SERVER['SERVER_SIGNATURE'] . "</body></html>"; exit; } // END KEEPOUT CHECKING global $session, $site; if (isset($parameters['template'])) { page_template($parameters['template']); } if (!empty($parameters['username'])) { sleep(2); } if ($session->valid) { if (!empty($parameters['goto'])) { header('Location: ' . $site->url . '/index/' . $parameters['goto']); exit; } elseif (session_admin()) { header('Location: ' . $site->url . '/index/cms-app'); exit; } else { page_title(intl_get('Members')); echo template_simple('user/login/home.spt', $parameters); } } else { switch ($box['context']) {
<?php // This is where app-level variables can be centrally stored. This file is // automatically included when the first call to your app is made. Use the // appconf_set ('name', 'value'); function to add values here. $conf = ini_parse('inc/app/sitewiki/conf/settings.php', false); foreach ($conf as $k => $v) { if ($k == 'template' && $context == 'action') { page_template($v); } else { appconf_set($k, $v); } } appconf_set('default_page', 'HomePage'); appconf_set('date_format', 'F j, Y g:i A'); appconf_set('levels', array('0' => intl_get('Anyone'), '1' => intl_get('Registered Users Only'), '2' => intl_get('Admin-Level Users Only'), '3' => intl_get('Owner Only'))); appconf_set('yesno', array('0' => intl_get('No'), '1' => intl_get('Yes'))); //page_template ('full'); page_add_link('alternate', 'application/rss+xml', site_url() . '/index/sitewiki-feeds-short-action'); page_add_link('alternate', 'application/rss+xml', site_url() . '/index/sitewiki-feeds-full-action');
$b->setValues(intl_get('Cancel')); $b->extra = 'onclick="return xed_window_cancel (this.form)"'; } function show() { echo '<script language="javascript" type="text/javascript"> function xed_window_submit (f) { opener.document.forms[f.elements["form_name"].value].elements[f.elements["field_name"].value].value = xed_get_source ("body"); window.close (); return false; } function xed_window_cancel (f) { window.close (); return false; } </script>'; return parent::show(); } function onSubmit($vals) { echo '<script language="javascript" type="text/javascript">window.close ()</script>'; exit; } } global $cgi; page_title(intl_get('WYSIWYG Mode')); if (isset($cgi->template)) { page_template($cgi->template); } $form = new WysiwygEditorForm(); echo $form->run();
ob_implicit_flush ();*/ loader_import('xed.Cleaners'); if (!empty($parameters['data'])) { $original = $parameters['data']; $parameters['data'] = the_cleaners($parameters['data']); } else { $original = ''; } if (!empty($parameters['ifname'])) { // called as an rpc service, return the cleaned data via saf.Misc.RPC //loader_import ('saf.Misc.RPC'); //echo rpc_response ($parameters['ifname'], $parameters['data']); $parameters['data'] = the_cleaners($parameters[$parameters['ifname']]); $parameters['data'] = preg_replace("/(\r\n|\n\r|\r|\n)/", "'\n\t\t+ '\\n", addslashes($parameters['data'])); $parameters['data'] = str_replace('</script>', '</\' + \'script>', $parameters['data']); page_template('dialog'); page_title(intl_get('Document has been cleaned.')); page_add_script(template_simple('clean_reply.spt', $parameters)); echo '<p><a href="#" onclick="window.close ()">' . intl_get('Close Window') . '</a></p>'; return; } elseif ($parameters['ws'] == 'true') { // called as a web service, return the cleaned data only echo $parameters['data']; exit; } echo '<h1>Cleaners Test</h1> <form method="post"> <p>Please enter some HTML to clean:</p> <p><textarea name="data" cols="100" rows="20">' . htmlentities_compat($original) . '</textarea></p> <p><input type="submit" value="Clean!" /></p>'; if (!empty($parameters['data'])) {
$page = new StdClass(); $page->user = $user; $page->title = intl_get('Your Homepage'); $page->template = appconf('homepage_default_template'); $page->body = intl_get('Edit your homepage to change this text.'); } else { $page = new StdClass(); $page->user = $user; $page->title = $user . '\'s ' . intl_get('Homepage'); $page->template = appconf('homepage_default_template'); $page->body = intl_get('This user has not yet created a home page.'); } } if ($context == 'action') { page_title($page->title); if (!empty($page->template)) { page_template($page->template); } $default_template = appconf('homepage_template'); if ($default_template) { page_template($default_template); } } if ($self && session_allowed('sitellite_homepage', 'w', 'resource')) { echo '<p><a href="' . site_prefix() . '/index/sitemember-homepage-form?user='******'">' . intl_get('Edit Homepage') . '</a></p>'; } if ($context != 'action') { echo '<p><strong>' . intl_get('Title') . ': ' . $page->title . '</strong></p>'; } $GLOBALS['page']->body_parts = preg_split('|<hr[^>]*>|is', $page->body); echo $page->body;