Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* FUNCTIONS */
- function go($url) {
- header("Location: $url");
- exit();
- }
- function goDelay($url, $wait = 0) {
- return '<script type="text/javascript">setTimeout("location.href=\''.$url.'\';", '.($wait*1000).');</script>';
- }
- function alertSuccess($text, $padding = true) {
- if ($padding == false) {
- return '<div class="alert alert-success mb-0"><i class="fa fa-check-circle d-none d-md-inline-block"></i> '.$text.'</div>';
- }
- else {
- return '<div class="alert alert-success"><i class="fa fa-check-circle d-none d-md-inline-block"></i> '.$text.'</div>';
- }
- }
- function alertError($text, $padding = true) {
- if ($padding == false) {
- return '<div class="alert alert-danger mb-0"><i class="fa fa-times-circle d-none d-md-inline-block"></i> '.$text.'</div>';
- }
- else {
- return '<div class="alert alert-danger"><i class="fa fa-times-circle d-none d-md-inline-block"></i> '.$text.'</div>';
- }
- }
- function alertWarning($text, $padding = true) {
- if ($padding == false) {
- return '<div class="alert alert-warning mb-0"><i class="fa fa-bell d-none d-md-inline-block"></i> '.$text.'</div>';
- }
- else {
- return '<div class="alert alert-warning"><i class="fa fa-bell d-none d-md-inline-block"></i> '.$text.'</div>';
- }
- }
- function minecraftHeadURL($avatarAPI = 1, $username = null, $size = 20) {
- if ($avatarAPI == 1) {
- return "https://minotar.net/avatar/$username/$size.png";
- }
- else if ($avatarAPI == 2) {
- return "https://cravatar.eu/avatar/$username/$size.png";
- }
- else {
- return "https://minotar.net/avatar/$username/$size.png";
- }
- }
- function minecraftHead($avatarAPI = 1, $username = null, $size = 20, $extraClass = null) {
- $apiURL = minecraftHeadURL($avatarAPI, $username, $size);
- return '<img class="rounded-circle lazyload ' . $extraClass . '" data-src="' . $apiURL . '" src="/apps/main/public/assets/img/loaders/head.png" alt="Oyuncu - ' . $username . '" width="' . $size . '" height="' . $size . '">';
- }
- function showEmoji($text) {
- $emojiPath = "/apps/main/public/assets/img/emojis";
- $emojiText = array(
- ":D",
- ";)",
- ":)",
- "<3",
- ":(",
- ":O",
- ":o",
- ":P",
- ":')",
- ":8",
- "-_-",
- "(y)"
- );
- $emojiImage = array(
- '<img src="'.$emojiPath.'/1.png" width="18px" />',
- '<img src="'.$emojiPath.'/2.png" width="18px" />',
- '<img src="'.$emojiPath.'/3.png" width="18px" />',
- '<img src="'.$emojiPath.'/4.png" width="18px" />',
- '<img src="'.$emojiPath.'/5.png" width="18px" />',
- '<img src="'.$emojiPath.'/6.png" width="18px" />',
- '<img src="'.$emojiPath.'/6.png" width="18px" />',
- '<img src="'.$emojiPath.'/7.png" width="18px" />',
- '<img src="'.$emojiPath.'/8.png" width="18px" />',
- '<img src="'.$emojiPath.'/9.png" width="18px" />',
- '<img src="'.$emojiPath.'/10.png" width="18px" />',
- '<img src="'.$emojiPath.'/11.png" width="18px" />'
- );
- return str_ireplace($emojiText, $emojiImage, $text);
- }
- function post($parameter) {
- if (isset($_POST[$parameter])) {
- return htmlspecialchars(trim(strip_tags($_POST[$parameter])));
- }
- else {
- return false;
- }
- }
- function get($parameter) {
- if (isset($_GET[$parameter])) {
- return strip_tags(trim(addslashes($_GET[$parameter])));
- }
- else {
- return false;
- }
- }
- function filteredContent($content) {
- $contentBadHTMLTags = array('<script>', '</script>');
- return str_replace($contentBadHTMLTags, '', $content);
- }
- function limitedContent($content, $limit = 0) {
- $newsContentLength = strlen($content);
- if ($newsContentLength > $limit) {
- return mb_substr($content, 0, $limit, 'utf-8').'...';
- }
- else {
- return $content;
- }
- }
- function verifiedCircle($permission) {
- if ($permission == 1) {
- return '<i class="fa fa-check-circle theme-color text-primary" data-toggle="tooltip" data-placement="top" title="Yönetici"></i>';
- }
- if ($permission == 2) {
- return '<i class="fa fa-check-circle theme-color text-primary" data-toggle="tooltip" data-placement="top" title="Moderatör"></i>';
- }
- if ($permission == 3) {
- return '<i class="fa fa-check-circle theme-color text-primary" data-toggle="tooltip" data-placement="top" title="Görevli" ></i>';
- }
- if ($permission == 4) {
- return '<i class="fa fa-check-circle theme-color text-primary" data-toggle="tooltip" data-placement="top" title="Yazar" ></i>';
- }
- if ($permission == 5) {
- return '<i class="fa fa-check-circle theme-color text-primary" data-toggle="tooltip" data-placement="top" title="Destek" ></i>';
- }
- if ($permission == 6) {
- return '<i class="fa fa-check-circle theme-color text-primary" data-toggle="tooltip" data-placement="top" title="YouTuber" ></i>';
- }
- }
- function permissionTag($permission) {
- if ($permission == 0) {
- return '<span class="badge badge-pill badge-secondary">Üye</span>';
- }
- else if ($permission == 1) {
- return '<span class="badge badge-pill badge-danger">Yönetici</span>';
- }
- else if ($permission == 2) {
- return '<span class="badge badge-pill badge-warning">Moderatör</span>';
- }
- else if ($permission == 3) {
- return '<span class="badge badge-pill badge-info">Görevli</span>';
- }
- else if ($permission == 4) {
- return '<span class="badge badge-pill badge-success">Yazar</span>';
- }
- else if ($permission == 5) {
- return '<span class="badge badge-pill badge-primary">Destek</span>';
- }
- else if ($permission == 6) {
- return '<span class="badge badge-pill badge-secondary">YouTuber</span>';
- }
- else {
- return '<span class="badge badge-pill badge-danger">HATA!</span>';
- }
- }
- function generateSalt($length) {
- $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
- $randomString = '';
- for ($i = 0; $i < $length; $i++) {
- $randomString .= $characters[rand(0, strlen($characters) - 1)];
- }
- return $randomString;
- }
- function createSHA256($password){
- $salt = generateSalt(16);
- $hash = '$SHA$'.$salt.'$'.hash('sha256', hash('sha256', $password).$salt);
- ...............................................................................
- ..........................................
- .....................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement