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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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_subdomain_full_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. <!-- Minecraft Settings
  154. <div class="row">
  155. <div class="col-sm-12 text-center">
  156. <h3>Minecraft Settings</h3>
  157. </div>
  158. </div>
  159. <hr>
  160. <div class="row">
  161. <div class="form-group col-sm-6">
  162. <label for="update_minecraft"><h4>Username</h4></label>
  163. <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; ?>" />
  164. </div>
  165. </div>
  166. -->
  167. <!-- Git Settings -->
  168. <div class="row">
  169. <div class="col-sm-12 text-center">
  170. <h3>Git Settings</h3>
  171. </div>
  172. </div>
  173. <hr>
  174. <div class="row">
  175. <div class="col-sm-12">
  176. <h4>Public Key(s)</h4>
  177. <input id="update_public_key" name="update_public_key" type="hidden" value="<?php echo $Profile_User->public_key; ?>" />
  178. </div>
  179. </div>
  180. <div class="row">
  181. <div class="col-sm-12" id="public_key_list">
  182. <?php
  183. $keyList = explode(",", $Profile_User->public_key);
  184. $index = 1;
  185. foreach ($keyList as $key)
  186. {
  187. ?>
  188. <div class="input-group public_key_<?php echo $index; ?>"><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 />
  189. <?php
  190. $index++;
  191. }
  192. ?>
  193. </div>
  194. </div>
  195. <div class="row">
  196. <div class="col-sm-12">
  197. <button class="btn btn-md btn-primary" id="add_public_key"><i class="glyphicon glyphicon-plus"></i> Add Key</button>
  198. </div>
  199. </div>
  200. <!-- Blog Settings -->
  201. <div class="row">
  202. <div class="col-sm-12 text-center">
  203. <h3>Blog Settings</h3>
  204. </div>
  205. </div>
  206. <hr>
  207. <div class="row">
  208. <div class="form-group col-sm-6">
  209. <label for="update_blog_title"><h4>Title</h4></label>
  210. <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; ?>" />
  211. </div>
  212. <div class="form-group col-sm-6">
  213. <label for="update_blog_description"><h4>Description</h4></label>
  214. <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; ?>" />
  215. </div>
  216. </div>
  217. <div class="row">
  218. <div class="form-group col-sm-12">
  219. <br />
  220. <button class="btn btn-lg btn-success" id="update_submit" type="submit"><i class="glyphicon glyphicon-ok-sign"></i> Save</button>
  221. <button class="btn btn-lg" type="reset"><i class="glyphicon glyphicon-repeat"></i> Reset</button>
  222. </div>
  223. </div>
  224. </form>
  225. </div><!--/tab-pane-->
  226. <?php } ?>
  227. </div><!--/tab-content-->
  228. </div><!--/col-9-->
  229. </div><!--/row-->
  230. </div>
  231. <?php
  232. set_page_title($Profile_User->username . " - Teknik");
  233. }
  234. else
  235. {
  236. set_page_title("Teknik");
  237. ?>
  238. <div class="container">
  239. <div class="row">
  240. <div class="col-sm-12 text-center">
  241. <h2>Sorry, but I couldn't find that user.</h2>
  242. </div>
  243. </div>
  244. </div>
  245. <?php
  246. }
  247. }
  248. else
  249. {
  250. redirect(get_subdomain_full_url("www", $CONF));
  251. }
  252. include('../templates/'.$CONF['template'].'/footer.php');
  253. ?>