Teknik is a suite of services with attractive and functional interfaces. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

profile.php 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <?php
  2. require_once('../includes/config.php');
  3. include('../templates/'.$CONF['template'].'/header.php');
  4. if (isset($_GET['id']))
  5. {
  6. if ($userTools->checkUsernameExists($_GET['id']))
  7. {
  8. $own_profile = false;
  9. $Profile_User = $userTools->getUser($_GET['id']);
  10. if ($Profile_User->id == $user->id && $logged_in == true)
  11. {
  12. $own_profile = true;
  13. }
  14. ?>
  15. <div class="container">
  16. <div class="row">
  17. <div class="col-sm-3<?php if(!$Profile_User->about && !$own_profile) { echo " col-sm-offset-4"; } ?>"><h1><?php echo $Profile_User->username; ?></h1></div>
  18. </div>
  19. <div class="row">
  20. <div class="col-sm-3<?php if(!$Profile_User->about && !$own_profile) { echo " col-sm-offset-4"; } ?>"><!--left col-->
  21. <ul class="list-group">
  22. <li class="list-group-item text-muted">Profile</li>
  23. <li class="list-group-item text-right"><span class="pull-left"><strong>Joined</strong></span> <?php echo $Profile_User->join_date; ?></li>
  24. <?php if ($own_profile) { ?>
  25. <li class="list-group-item text-right"><span class="pull-left"><strong>Last Seen</strong></span> <?php echo $Profile_User->last_seen; ?></li>
  26. <?php } ?>
  27. <li class="list-group-item text-right"><span class="pull-left"><strong>Email</strong></span> <a href="mailto:<?php echo $Profile_User->username; ?>@teknik.io"><?php echo $Profile_User->username; ?>@teknik.io</a></li>
  28. <?php if ($Profile_User->blog_title) { ?>
  29. <li class="list-group-item text-right"><span class="pull-left"><strong>Blog</strong></span> <a href="<?php echo get_page_url('blog', $CONF).'/'.$Profile_User->username; ?>" id="blog_title"><?php echo $Profile_User->blog_title; ?></a></li>
  30. <?php } ?>
  31. <?php if ($own_profile) { ?>
  32. <li class="list-group-item text-center"><button type="button" class="btn btn-danger" id="delete_account">Delete Account</button></li>
  33. <?php } ?>
  34. </ul>
  35. <?php if($Profile_User->website) { ?>
  36. <div class="panel panel-default">
  37. <div class="panel-heading">Website <i class="fa fa-link fa-1x"></i></div>
  38. <div class="panel-body"><a href="<?php echo $Profile_User->website; ?>" id="website"><?php echo $Profile_User->website; ?></a></div>
  39. </div>
  40. <?php } ?>
  41. <?php if($Profile_User->quote) { ?>
  42. <div class="panel panel-default">
  43. <div class="panel-heading">Quote <i class="fa fa-quote-right fa-1x"></i></div>
  44. <div class="panel-body" id="quote"><?php echo $Profile_User->quote; ?></div>
  45. </div>
  46. <?php } ?>
  47. </div><!--/col-3-->
  48. <div class="col-sm-9">
  49. <?php if($Profile_User->about && $own_profile) { ?>
  50. <ul class="nav nav-tabs" id="myTab">
  51. <?php if($Profile_User->about) { ?>
  52. <li <?php if(!$own_profile) { echo 'class="active"'; }?>><a href="#about" data-toggle="tab">About Myself</a></li>
  53. <?php } ?>
  54. <?php if($own_profile) { ?>
  55. <li class="active"><a href="#settings" data-toggle="tab">Settings</a></li>
  56. <?php } ?>
  57. </ul>
  58. <?php } ?>
  59. <div class="tab-content">
  60. <?php if($Profile_User->about) { ?>
  61. <div class="tab-pane <?php if(!$own_profile) { echo "active"; }?>" id="about">
  62. <script>
  63. $(document).ready(function() {
  64. var converter = new Markdown.getSanitizingConverter();
  65. <?php if($Profile_User->blog_title) { ?>
  66. // Blog Title Conversion
  67. var old_html = $("#blog_title").text();
  68. var new_html = converter.makeHtml(old_html);
  69. $("#blog_title").html(new_html);
  70. <?php } ?>
  71. <?php if($Profile_User->website) { ?>
  72. // Website Conversion
  73. var old_html = $("#website").text();
  74. var new_html = converter.makeHtml(old_html);
  75. $("#website").html(new_html);
  76. <?php } ?>
  77. <?php if($Profile_User->quote) { ?>
  78. // Quote Conversion
  79. var old_html = $("#quote").text();
  80. var new_html = converter.makeHtml(old_html);
  81. $("#quote").html(new_html);
  82. <?php } ?>
  83. <?php if($Profile_User->about) { ?>
  84. // About Conversion
  85. var old_about = $("#markdown_body").text();
  86. var new_about = converter.makeHtml(old_about);
  87. $("#markdown_body").html(new_about);
  88. <?php } ?>
  89. });
  90. </script>
  91. <div class="col-sm-12" id="markdown_body"><?php echo $Profile_User->about; ?></div>
  92. </div><!--/tab-pane-->
  93. <?php } ?>
  94. <?php if($own_profile) { ?>
  95. <div class="tab-pane active" id="settings">
  96. <form class="form" action="##" method="post" id="updateForm">
  97. <input name="update_userid" id="update_userid" type="hidden" value="<?php echo $Profile_User->id; ?>" />
  98. <!-- Profile Settings -->
  99. <div class="row">
  100. <div class="col-sm-12 text-center">
  101. <h3>Profile Settings</h3>
  102. </div>
  103. </div>
  104. <hr>
  105. <div class="row">
  106. <div class="form-group col-sm-4">
  107. <label for="update_password_current"><h4>Current Password</h4></label>
  108. <input class="form-control" name="update_password_current" id="update_password_current" placeholder="current password" title="enter your current password." type="password" />
  109. </div>
  110. <div class="form-group col-sm-4">
  111. <label for="update_password"><h4>New Password</h4></label>
  112. <input class="form-control" name="update_password" id="update_password" placeholder="new password" title="enter your password." type="password" />
  113. </div>
  114. <div class="form-group col-sm-4">
  115. <label for="update_password_confirm"><h4>Verify New Password</h4></label>
  116. <input class="form-control" name="update_password_confirm" id="update_password_confirm" placeholder="new password confirmed" title="enter your password again." type="password" />
  117. </div>
  118. </div>
  119. <div class="row">
  120. <div class="form-group col-sm-4">
  121. <label for="update_theme"><h4>Site Theme</h4></label>
  122. <br />
  123. <select id="update_theme" name="update_theme" class="selectpicker">
  124. <?php
  125. // Show all themes.
  126. foreach ($CONF['themes'] as $theme=>$name)
  127. {
  128. $sel=($theme==$user->theme)?'selected="selected"':' ';
  129. if (in_array($theme, $CONF['themes']))
  130. {
  131. $sel="";
  132. }
  133. echo '<option ' . $sel . 'value="' . $theme . '">' . $name . '</option>';
  134. }
  135. ?>
  136. </select>
  137. </div>
  138. <div class="form-group col-sm-4">
  139. <label for="update_website"><h4>Website</h4></label>
  140. <input class="form-control" id="update_website" name="update_website" placeholder="http://www.noneofyourbusiness.com/" title="enter your website" type="text" value="<?php echo $Profile_User->website; ?>" />
  141. </div>
  142. <div class="form-group col-sm-4">
  143. <label for="update_quote"><h4>Quote</h4></label>
  144. <input class="form-control" id="update_quote" name="update_quote" placeholder="I have a dream!" title="enter a memorable quote" type="text" value="<?php echo $Profile_User->quote; ?>" maxlength="140" />
  145. </div>
  146. </div>
  147. <div class="row">
  148. <div class="form-group col-sm-12">
  149. <label for="update_about"><h4>About Yourself</h4></label>
  150. <textarea class="form-control" name="update_about" id="update_about" placeholder="I'm awesome" title="enter any information you want to share with the world." data-provide="markdown" rows="10"><?php echo $Profile_User->about; ?></textarea>
  151. </div>
  152. </div>
  153. <iframe style="border: 0; height: 200px; width: 600px;" src="https://stats.teknik.io/index.php?module=CoreAdminHome&action=optOut&language=en"></iframe>
  154. <!-- Minecraft Settings
  155. <div class="row">
  156. <div class="col-sm-12 text-center">
  157. <h3>Minecraft Settings</h3>
  158. </div>
  159. </div>
  160. <hr>
  161. <div class="row">
  162. <div class="form-group col-sm-6">
  163. <label for="update_minecraft"><h4>Username</h4></label>
  164. <input class="form-control" id="update_minecraft" name="update_minecraft" placeholder="super_miner64" title="enter your minecraft username" type="text" value="<?php echo $Profile_User->minecraft_user; ?>" />
  165. </div>
  166. </div>
  167. -->
  168. <!-- Git Settings -->
  169. <div class="row">
  170. <div class="col-sm-12 text-center">
  171. <h3>Git Settings</h3>
  172. </div>
  173. </div>
  174. <hr>
  175. <div class="row">
  176. <div class="col-sm-12">
  177. <h4>Public Key(s)</h4>
  178. <input id="update_public_key" name="update_public_key" type="hidden" value="<?php echo $Profile_User->public_key; ?>" />
  179. </div>
  180. </div>
  181. <div class="row">
  182. <div class="col-sm-12" id="public_key_list">
  183. <?php
  184. $keyList = array_filter(explode(",", $Profile_User->public_key));
  185. $index = 1;
  186. foreach ($keyList as $key)
  187. {
  188. ?>
  189. <div class="public_key_<?php echo $index; ?>"><div class="input-group"><input type="text" class="form-control" id="public_key_input_<?php echo $index; ?>" value="<?php echo $key; ?>" readonly><span class="input-group-btn"><button class="btn btn-danger public_key_delete" type="button" id="<?php echo $index; ?>">Remove</button></span></div><br /></div>
  190. <?php
  191. $index++;
  192. }
  193. ?>
  194. </div>
  195. </div>
  196. <div class="row">
  197. <div class="col-sm-12">
  198. <button class="btn btn-md btn-primary" id="add_public_key"><i class="glyphicon glyphicon-plus"></i> Add Key</button>
  199. </div>
  200. </div>
  201. <!-- Blog Settings -->
  202. <div class="row">
  203. <div class="col-sm-12 text-center">
  204. <h3>Blog Settings</h3>
  205. </div>
  206. </div>
  207. <hr>
  208. <div class="row">
  209. <div class="form-group col-sm-6">
  210. <label for="update_blog_title"><h4>Title</h4></label>
  211. <input class="form-control" id="update_blog_title" name="update_blog_title" placeholder="click bait" title="enter your blog's title" type="text" value="<?php echo $Profile_User->blog_title; ?>" />
  212. </div>
  213. <div class="form-group col-sm-6">
  214. <label for="update_blog_description"><h4>Description</h4></label>
  215. <input class="form-control" id="update_blog_description" name="update_blog_description" placeholder="This blog is not worth reading." title="enter your blog's description" type="text" value="<?php echo $Profile_User->blog_desc; ?>" />
  216. </div>
  217. </div>
  218. <div class="row">
  219. <div class="form-group col-sm-12">
  220. <br />
  221. <button class="btn btn-lg btn-success" id="update_submit" type="submit"><i class="glyphicon glyphicon-ok-sign"></i> Save</button>
  222. <button class="btn btn-lg" type="reset"><i class="glyphicon glyphicon-repeat"></i> Reset</button>
  223. </div>
  224. </div>
  225. </form>
  226. </div><!--/tab-pane-->
  227. <?php } ?>
  228. </div><!--/tab-content-->
  229. </div><!--/col-9-->
  230. </div><!--/row-->
  231. </div>
  232. <?php
  233. set_page_title($Profile_User->username . " - Teknik");
  234. }
  235. else
  236. {
  237. set_page_title("Teknik");
  238. ?>
  239. <div class="container">
  240. <div class="row">
  241. <div class="col-sm-12 text-center">
  242. <h2>Sorry, but I couldn't find that user.</h2>
  243. </div>
  244. </div>
  245. </div>
  246. <?php
  247. }
  248. }
  249. else
  250. {
  251. redirect(get_page_url("home", $CONF));
  252. }
  253. include('../templates/'.$CONF['template'].'/footer.php');
  254. ?>