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 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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 (is_dir("B:\\Repositories\\Teknik\\".$Profile_User->username)) { ?>
  32. <li class="list-group-item text-right"><span class="pull-left"><strong>Git</strong></span> <a href="<?php echo get_page_url('git', $CONF).'/'.$Profile_User->username; ?>">Public Repos</a></li>
  33. <?php } ?>
  34. <?php if ($own_profile) { ?>
  35. <li class="list-group-item text-center"><button type="button" class="btn btn-danger" id="delete_account">Delete Account</button></li>
  36. <?php } ?>
  37. </ul>
  38. <?php if($Profile_User->website) { ?>
  39. <div class="panel panel-default">
  40. <div class="panel-heading">Website <i class="fa fa-link fa-1x"></i></div>
  41. <div class="panel-body"><a href="<?php echo $Profile_User->website; ?>" id="website"><?php echo $Profile_User->website; ?></a></div>
  42. </div>
  43. <?php } ?>
  44. <?php if($Profile_User->quote) { ?>
  45. <div class="panel panel-default">
  46. <div class="panel-heading">Quote <i class="fa fa-quote-right fa-1x"></i></div>
  47. <div class="panel-body" id="quote"><?php echo $Profile_User->quote; ?></div>
  48. </div>
  49. <?php } ?>
  50. </div><!--/col-3-->
  51. <div class="col-sm-9">
  52. <?php if($Profile_User->about && $own_profile) { ?>
  53. <ul class="nav nav-tabs" id="myTab">
  54. <?php if($Profile_User->about) { ?>
  55. <li <?php if(!$own_profile) { echo 'class="active"'; }?>><a href="#about" data-toggle="tab">About Myself</a></li>
  56. <?php } ?>
  57. <?php if($own_profile) { ?>
  58. <li class="active"><a href="#settings" data-toggle="tab">Settings</a></li>
  59. <li><a href="#privacy" data-toggle="tab">Privacy</a></li>
  60. <?php } ?>
  61. </ul>
  62. <?php } ?>
  63. <div class="tab-content">
  64. <?php if($Profile_User->about) { ?>
  65. <div class="tab-pane <?php if(!$own_profile) { echo "active"; }?>" id="about">
  66. <script>
  67. $(document).ready(function() {
  68. var converter = new Markdown.getSanitizingConverter();
  69. <?php if($Profile_User->blog_title) { ?>
  70. // Blog Title Conversion
  71. var old_html = $("#blog_title").text();
  72. var new_html = converter.makeHtml(old_html);
  73. $("#blog_title").html(new_html);
  74. <?php } ?>
  75. <?php if($Profile_User->website) { ?>
  76. // Website Conversion
  77. var old_html = $("#website").text();
  78. var new_html = converter.makeHtml(old_html);
  79. $("#website").html(new_html);
  80. <?php } ?>
  81. <?php if($Profile_User->quote) { ?>
  82. // Quote Conversion
  83. var old_html = $("#quote").text();
  84. var new_html = converter.makeHtml(old_html);
  85. $("#quote").html(new_html);
  86. <?php } ?>
  87. <?php if($Profile_User->about) { ?>
  88. // About Conversion
  89. var old_about = $("#markdown_body").text();
  90. var new_about = converter.makeHtml(old_about);
  91. $("#markdown_body").html(new_about);
  92. <?php } ?>
  93. });
  94. </script>
  95. <div class="col-sm-12" id="markdown_body"><?php echo $Profile_User->about; ?></div>
  96. </div><!--/tab-pane-->
  97. <?php } ?>
  98. <?php if($own_profile) { ?>
  99. <div class="tab-pane active" id="settings">
  100. <form class="form" action="##" method="post" id="updateForm">
  101. <input name="update_userid" id="update_userid" type="hidden" value="<?php echo $Profile_User->id; ?>" />
  102. <!-- Profile Settings -->
  103. <div class="row">
  104. <div class="col-sm-12 text-center">
  105. <h3>Profile Settings</h3>
  106. </div>
  107. </div>
  108. <hr>
  109. <div class="row">
  110. <div class="form-group col-sm-4">
  111. <label for="update_password_current"><h4>Current Password</h4></label>
  112. <input class="form-control" name="update_password_current" id="update_password_current" placeholder="current password" title="enter your current password." type="password" />
  113. </div>
  114. <div class="form-group col-sm-4">
  115. <label for="update_password"><h4>New Password</h4></label>
  116. <input class="form-control" name="update_password" id="update_password" placeholder="new password" title="enter your password." type="password" />
  117. </div>
  118. <div class="form-group col-sm-4">
  119. <label for="update_password_confirm"><h4>Verify New Password</h4></label>
  120. <input class="form-control" name="update_password_confirm" id="update_password_confirm" placeholder="new password confirmed" title="enter your password again." type="password" />
  121. </div>
  122. </div>
  123. <div class="row">
  124. <div class="form-group col-sm-4">
  125. <label for="update_theme"><h4>Site Theme</h4></label>
  126. <br />
  127. <select id="update_theme" name="update_theme" class="selectpicker">
  128. <?php
  129. // Show all themes.
  130. foreach ($CONF['themes'] as $theme=>$name)
  131. {
  132. $sel=($theme==$user->theme)?'selected="selected"':' ';
  133. if (in_array($theme, $CONF['themes']))
  134. {
  135. $sel="";
  136. }
  137. echo '<option ' . $sel . 'value="' . $theme . '">' . $name . '</option>';
  138. }
  139. ?>
  140. </select>
  141. </div>
  142. <div class="form-group col-sm-4">
  143. <label for="update_website"><h4>Website</h4></label>
  144. <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; ?>" />
  145. </div>
  146. <div class="form-group col-sm-4">
  147. <label for="update_quote"><h4>Quote</h4></label>
  148. <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" />
  149. </div>
  150. </div>
  151. <div class="row">
  152. <div class="form-group col-sm-12">
  153. <label for="update_about"><h4>About Yourself</h4></label>
  154. <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>
  155. </div>
  156. </div>
  157. <!-- Minecraft Settings
  158. <div class="row">
  159. <div class="col-sm-12 text-center">
  160. <h3>Minecraft Settings</h3>
  161. </div>
  162. </div>
  163. <hr>
  164. <div class="row">
  165. <div class="form-group col-sm-6">
  166. <label for="update_minecraft"><h4>Username</h4></label>
  167. <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; ?>" />
  168. </div>
  169. </div>
  170. -->
  171. <!-- Git Settings -->
  172. <div class="row">
  173. <div class="col-sm-12 text-center">
  174. <h3>Git Settings</h3>
  175. </div>
  176. </div>
  177. <hr>
  178. <div class="row">
  179. <div class="col-sm-12">
  180. <h4>Public Key(s)</h4>
  181. <input id="update_public_key" name="update_public_key" type="hidden" value="<?php echo $Profile_User->public_key; ?>" />
  182. </div>
  183. </div>
  184. <div class="row">
  185. <div class="col-sm-12" id="public_key_list">
  186. <?php
  187. $keyList = array_filter(explode(",", $Profile_User->public_key));
  188. $index = 1;
  189. foreach ($keyList as $key)
  190. {
  191. ?>
  192. <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>
  193. <?php
  194. $index++;
  195. }
  196. ?>
  197. </div>
  198. </div>
  199. <div class="row">
  200. <div class="col-sm-12">
  201. <button class="btn btn-md btn-primary" id="add_public_key"><i class="glyphicon glyphicon-plus"></i> Add Key</button>
  202. </div>
  203. </div>
  204. <!-- Blog Settings -->
  205. <div class="row">
  206. <div class="col-sm-12 text-center">
  207. <h3>Blog Settings</h3>
  208. </div>
  209. </div>
  210. <hr>
  211. <div class="row">
  212. <div class="form-group col-sm-6">
  213. <label for="update_blog_title"><h4>Title</h4></label>
  214. <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; ?>" />
  215. </div>
  216. <div class="form-group col-sm-6">
  217. <label for="update_blog_description"><h4>Description</h4></label>
  218. <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; ?>" />
  219. </div>
  220. </div>
  221. <div class="row">
  222. <div class="form-group col-sm-12">
  223. <br />
  224. <button class="btn btn-lg btn-success" id="update_submit" type="submit"><i class="glyphicon glyphicon-ok-sign"></i> Save</button>
  225. <button class="btn btn-lg" type="reset"><i class="glyphicon glyphicon-repeat"></i> Reset</button>
  226. </div>
  227. </div>
  228. </form>
  229. </div><!--/tab-pane-->
  230. <div class="tab-pane" id="privacy">
  231. <div class="row">
  232. <div class="col-sm-12 text-center">
  233. <iframe style="border: 0; width: 100%;" src="https://stats.teknik.io/index.php?module=CoreAdminHome&action=optOut&language=en"></iframe>
  234. </div>
  235. </div>
  236. </div>
  237. <?php } ?>
  238. </div><!--/tab-content-->
  239. </div><!--/col-9-->
  240. </div><!--/row-->
  241. </div>
  242. <?php
  243. set_page_title($Profile_User->username . " - Teknik");
  244. }
  245. else
  246. {
  247. set_page_title("Teknik");
  248. ?>
  249. <div class="container">
  250. <div class="row">
  251. <div class="col-sm-12 text-center">
  252. <h2>Sorry, but I couldn't find that user.</h2>
  253. </div>
  254. </div>
  255. </div>
  256. <?php
  257. }
  258. }
  259. else
  260. {
  261. redirect(get_page_url("home", $CONF));
  262. }
  263. include('../templates/'.$CONF['template'].'/footer.php');
  264. ?>