Advertisement
Guest User

Untitled

a guest
May 5th, 2021
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.48 KB | None | 0 0
  1. <?php
  2.  
  3. /* FUNCTIONS */
  4. function go($url) {
  5. header("Location: $url");
  6. exit();
  7. }
  8.  
  9. function goDelay($url, $wait = 0) {
  10. return '<script type="text/javascript">setTimeout("location.href=\''.$url.'\';", '.($wait*1000).');</script>';
  11. }
  12.  
  13. function alertSuccess($text, $padding = true) {
  14. if ($padding == false) {
  15. return '<div class="alert alert-success mb-0"><i class="fa fa-check-circle d-none d-md-inline-block"></i> '.$text.'</div>';
  16. }
  17. else {
  18. return '<div class="alert alert-success"><i class="fa fa-check-circle d-none d-md-inline-block"></i> '.$text.'</div>';
  19. }
  20. }
  21.  
  22. function alertError($text, $padding = true) {
  23. if ($padding == false) {
  24. return '<div class="alert alert-danger mb-0"><i class="fa fa-times-circle d-none d-md-inline-block"></i> '.$text.'</div>';
  25. }
  26. else {
  27. return '<div class="alert alert-danger"><i class="fa fa-times-circle d-none d-md-inline-block"></i> '.$text.'</div>';
  28. }
  29. }
  30.  
  31. function alertWarning($text, $padding = true) {
  32. if ($padding == false) {
  33. return '<div class="alert alert-warning mb-0"><i class="fa fa-bell d-none d-md-inline-block"></i> '.$text.'</div>';
  34. }
  35. else {
  36. return '<div class="alert alert-warning"><i class="fa fa-bell d-none d-md-inline-block"></i> '.$text.'</div>';
  37. }
  38. }
  39.  
  40. function minecraftHeadURL($avatarAPI = 1, $username = null, $size = 20) {
  41. if ($avatarAPI == 1) {
  42. return "https://minotar.net/avatar/$username/$size.png";
  43. }
  44. else if ($avatarAPI == 2) {
  45. return "https://cravatar.eu/avatar/$username/$size.png";
  46. }
  47. else {
  48. return "https://minotar.net/avatar/$username/$size.png";
  49. }
  50. }
  51.  
  52. function minecraftHead($avatarAPI = 1, $username = null, $size = 20, $extraClass = null) {
  53. $apiURL = minecraftHeadURL($avatarAPI, $username, $size);
  54. 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 . '">';
  55. }
  56.  
  57. function showEmoji($text) {
  58. $emojiPath = "/apps/main/public/assets/img/emojis";
  59. $emojiText = array(
  60. ":D",
  61. ";)",
  62. ":)",
  63. "<3",
  64. ":(",
  65. ":O",
  66. ":o",
  67. ":P",
  68. ":')",
  69. ":8",
  70. "-_-",
  71. "(y)"
  72. );
  73. $emojiImage = array(
  74. '<img src="'.$emojiPath.'/1.png" width="18px" />',
  75. '<img src="'.$emojiPath.'/2.png" width="18px" />',
  76. '<img src="'.$emojiPath.'/3.png" width="18px" />',
  77. '<img src="'.$emojiPath.'/4.png" width="18px" />',
  78. '<img src="'.$emojiPath.'/5.png" width="18px" />',
  79. '<img src="'.$emojiPath.'/6.png" width="18px" />',
  80. '<img src="'.$emojiPath.'/6.png" width="18px" />',
  81. '<img src="'.$emojiPath.'/7.png" width="18px" />',
  82. '<img src="'.$emojiPath.'/8.png" width="18px" />',
  83. '<img src="'.$emojiPath.'/9.png" width="18px" />',
  84. '<img src="'.$emojiPath.'/10.png" width="18px" />',
  85. '<img src="'.$emojiPath.'/11.png" width="18px" />'
  86. );
  87. return str_ireplace($emojiText, $emojiImage, $text);
  88. }
  89.  
  90. function post($parameter) {
  91. if (isset($_POST[$parameter])) {
  92. return htmlspecialchars(trim(strip_tags($_POST[$parameter])));
  93. }
  94. else {
  95. return false;
  96. }
  97. }
  98.  
  99. function get($parameter) {
  100. if (isset($_GET[$parameter])) {
  101. return strip_tags(trim(addslashes($_GET[$parameter])));
  102. }
  103. else {
  104. return false;
  105. }
  106. }
  107.  
  108. function filteredContent($content) {
  109. $contentBadHTMLTags = array('<script>', '</script>');
  110. return str_replace($contentBadHTMLTags, '', $content);
  111. }
  112.  
  113. function limitedContent($content, $limit = 0) {
  114. $newsContentLength = strlen($content);
  115. if ($newsContentLength > $limit) {
  116. return mb_substr($content, 0, $limit, 'utf-8').'...';
  117. }
  118. else {
  119. return $content;
  120. }
  121. }
  122.  
  123. function verifiedCircle($permission) {
  124. if ($permission == 1) {
  125. return '<i class="fa fa-check-circle theme-color text-primary" data-toggle="tooltip" data-placement="top" title="Yönetici"></i>';
  126. }
  127. if ($permission == 2) {
  128. return '<i class="fa fa-check-circle theme-color text-primary" data-toggle="tooltip" data-placement="top" title="Moderatör"></i>';
  129. }
  130. if ($permission == 3) {
  131. return '<i class="fa fa-check-circle theme-color text-primary" data-toggle="tooltip" data-placement="top" title="Görevli" ></i>';
  132. }
  133. if ($permission == 4) {
  134. return '<i class="fa fa-check-circle theme-color text-primary" data-toggle="tooltip" data-placement="top" title="Yazar" ></i>';
  135. }
  136. if ($permission == 5) {
  137. return '<i class="fa fa-check-circle theme-color text-primary" data-toggle="tooltip" data-placement="top" title="Destek" ></i>';
  138. }
  139. if ($permission == 6) {
  140. return '<i class="fa fa-check-circle theme-color text-primary" data-toggle="tooltip" data-placement="top" title="YouTuber" ></i>';
  141. }
  142. }
  143.  
  144. function permissionTag($permission) {
  145. if ($permission == 0) {
  146. return '<span class="badge badge-pill badge-secondary">Üye</span>';
  147. }
  148. else if ($permission == 1) {
  149. return '<span class="badge badge-pill badge-danger">Yönetici</span>';
  150. }
  151. else if ($permission == 2) {
  152. return '<span class="badge badge-pill badge-warning">Moderatör</span>';
  153. }
  154. else if ($permission == 3) {
  155. return '<span class="badge badge-pill badge-info">Görevli</span>';
  156. }
  157. else if ($permission == 4) {
  158. return '<span class="badge badge-pill badge-success">Yazar</span>';
  159. }
  160. else if ($permission == 5) {
  161. return '<span class="badge badge-pill badge-primary">Destek</span>';
  162. }
  163. else if ($permission == 6) {
  164. return '<span class="badge badge-pill badge-secondary">YouTuber</span>';
  165. }
  166. else {
  167. return '<span class="badge badge-pill badge-danger">HATA!</span>';
  168. }
  169. }
  170.  
  171. function generateSalt($length) {
  172. $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  173. $randomString = '';
  174. for ($i = 0; $i < $length; $i++) {
  175. $randomString .= $characters[rand(0, strlen($characters) - 1)];
  176. }
  177. return $randomString;
  178. }
  179.  
  180. function createSHA256($password){
  181. $salt = generateSalt(16);
  182. $hash = '$SHA$'.$salt.'$'.hash('sha256', hash('sha256', $password).$salt);
  183. ...............................................................................
  184. ..........................................
  185. .....................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement