Browse Source

Merge branch 'release-1.1'

Added support for adding multiple public keys.
Added automatic git repository creation and viewing.
Added support for using different url generation based on config.
Added web.config files to main repository.
pull/24/head v1.1
Teknikode 8 years ago
parent
commit
df25ee2401
  1. 44
      about/main.php
  2. 9
      about/web.config
  3. 4
      admin/index.php
  4. 10
      api/api.php
  5. 45
      api/web.config
  6. 4
      blog/get_post.php
  7. 2
      blog/main.php
  8. 4
      blog/view_post.php
  9. 33
      blog/web.config
  10. 9
      contact/web.config
  11. 4
      errors/403.php
  12. 4
      errors/404.php
  13. 33
      errors/web.config
  14. 21
      git/help.php
  15. 6
      git/index.php
  16. 40
      git/web.config
  17. 6
      help/main.php
  18. 9
      help/web.config
  19. 12
      home/profile.php
  20. 21
      home/web.config
  21. 5
      includes/Git.php
  22. 18
      includes/classes/UserTools.class.php
  23. 50
      includes/common.php
  24. 47
      includes/config.php.default
  25. 2
      includes/get_comment.php
  26. 4
      includes/process_login.php
  27. 2
      includes/process_logout.php
  28. 39
      includes/process_registration.php
  29. 22
      includes/update_profile.php
  30. 2
      mail/help.php
  31. 6
      paste/main.php
  32. 32
      paste/web.config
  33. 6
      podcast/get_post.php
  34. 2
      podcast/main.php
  35. 6
      podcast/view_post.php
  36. 17
      podcast/web.config
  37. 8
      ricehalla/main.php
  38. 6
      ricehalla/view_image.php
  39. 20
      ricehalla/web.config
  40. 8
      rss/index.php
  41. 25
      rss/web.config
  42. 17
      stats/web.config
  43. 2
      templates/default/footer.php
  44. 58
      templates/default/header.php
  45. 20
      templates/web.config
  46. 4
      transparency/main.php
  47. 6
      upload/delete_upload.php
  48. 2
      upload/generate_delete_link.php
  49. 2
      upload/lib/download.php
  50. 4
      upload/main.php
  51. 36
      upload/web.config
  52. 20
      web.config

44
about/main.php

@ -46,32 +46,32 @@ @@ -46,32 +46,32 @@
Teknik was created to provide our users free services that they can trust. All of our services are treated with the utmost care to provide you with the best experience possible, and the best security with your data that we can give.
</p>
<p>
You can view our complete activity and statistics by visiting the <a href="<?php echo get_subdomain_full_url("transparency", $CONF); ?>" target="_blank">Transparency</a> page.
You can view our complete activity and statistics by visiting the <a href="<?php echo get_page_url("transparency", $CONF); ?>" target="_blank">Transparency</a> page.
</p>
<h2 class="text-center">What we Offer</h2>
<hr>
<div class="row">
<div class="col-sm-4 col-sm-offset-2 text-center">
<h4><a href="<?php echo get_subdomain_full_url("paste", $CONF); ?>" target="_blank">Fast and Secure Pastebin</a></h4>
<h4><a href="<?php echo get_subdomain_full_url("upload", $CONF); ?>" target="_blank">Encrypted File Uploads</a></h4>
<h4><a href="<?php echo get_subdomain_full_url("mail", $CONF); ?>" target="_blank">Free Email Address</a></h4>
<h4><a href="<?php echo get_subdomain_full_url("api", $CONF); ?>" target="_blank">Easy to Use API</a></h4>
<h4><a href="<?php echo get_page_url("paste", $CONF); ?>" target="_blank">Fast and Secure Pastebin</a></h4>
<h4><a href="<?php echo get_page_url("upload", $CONF); ?>" target="_blank">Encrypted File Uploads</a></h4>
<h4><a href="<?php echo get_page_url("mail", $CONF); ?>" target="_blank">Free Email Address</a></h4>
<h4><a href="<?php echo get_page_url("api", $CONF); ?>" target="_blank">Easy to Use API</a></h4>
</div>
<div class="col-sm-4 text-center">
<h4><a href="<?php echo get_subdomain_full_url("blog", $CONF); if ($logged_in) { echo "/".$user->username; }?>" target="_blank">Personal Blog</a></h4>
<h4><a href="<?php echo get_subdomain_full_url("podcast", $CONF); ?>" target="_blank">Entertaining Podcasts</a></h4>
<h4><a href="<?php echo get_subdomain_full_url("help", $CONF); ?>#mumble" target="_blank">Mumble Server</a></h4>
<h4><a href="<?php echo get_subdomain_full_url("transparency", $CONF); ?>" target="_blank">Full Transparency</a></h4>
<h4><a href="<?php echo get_page_url("blog", $CONF); if ($logged_in) { echo "/".$user->username; }?>" target="_blank">Personal Blog</a></h4>
<h4><a href="<?php echo get_page_url("podcast", $CONF); ?>" target="_blank">Entertaining Podcasts</a></h4>
<h4><a href="<?php echo get_page_url("help", $CONF); ?>#mumble" target="_blank">Mumble Server</a></h4>
<h4><a href="<?php echo get_page_url("transparency", $CONF); ?>" target="_blank">Full Transparency</a></h4>
</div>
</div>
<h2 class="text-center">How can I help?</h2>
<hr>
<p>
Teknik hosts an open <a href="<?php echo get_subdomain_full_url("git", $CONF); ?>">Git Repository</a> for all our internal tools projects. This is open to all registered users so feel free to add to it!
Teknik hosts an open <a href="<?php echo get_page_url("git", $CONF); ?>">Git Repository</a> for all our internal tools projects. This is open to all registered users so feel free to add to it!
<br />
<br />
Have a cool suggestion for the site? Just submit it using the <a href="<?php echo get_subdomain_full_url("contact", $CONF); ?>">Feedback Form</a>!
Have a cool suggestion for the site? Just submit it using the <a href="<?php echo get_page_url("contact", $CONF); ?>">Feedback Form</a>!
</p>
<div class="alert alert-info">
<div class="text-center">
@ -91,10 +91,10 @@ @@ -91,10 +91,10 @@
qrcode : false,
auto_show : false,
decimals : 6,
imgSource : '<?php echo get_subdomain_full_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/img/',
cssSource : '<?php echo get_subdomain_full_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/css/',
jsSource : '<?php echo get_subdomain_full_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/js/coin/',
phpSource : '<?php echo get_subdomain_full_url($CONF['sub'], $CONF); ?>/includes/'
imgSource : '<?php echo get_page_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/img/',
cssSource : '<?php echo get_page_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/css/',
jsSource : '<?php echo get_page_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/js/coin/',
phpSource : '<?php echo get_page_url($CONF['page'], $CONF); ?>/includes/'
});
</script>
<script>
@ -110,10 +110,10 @@ @@ -110,10 +110,10 @@
qrcode : false,
auto_show : false,
decimals : 6,
imgSource : '<?php echo get_subdomain_full_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/img/',
cssSource : '<?php echo get_subdomain_full_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/css/',
jsSource : '<?php echo get_subdomain_full_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/js/coin/',
phpSource : '<?php echo get_subdomain_full_url($CONF['sub'], $CONF); ?>/includes/'
imgSource : '<?php echo get_page_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/img/',
cssSource : '<?php echo get_page_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/css/',
jsSource : '<?php echo get_page_url("cdn", $CONF); ?>/<?php echo $CONF['template']; ?>/js/coin/',
phpSource : '<?php echo get_page_url($CONF['page'], $CONF); ?>/includes/'
});
</script>
</div>
@ -176,7 +176,7 @@ @@ -176,7 +176,7 @@
?>
<div class="col-md-6">
<div class="blockquote-box blockquote-danger clearfix">
<a href="<?php echo get_subdomain_full_url("www", $CONF); ?>/<?php echo $founderuser->username; ?>">
<a href="<?php echo get_page_url("home", $CONF); ?>/<?php echo $founderuser->username; ?>">
<div class="square pull-left">
<span class="glyphicon glyphicon-tower glyphicon-lg"></span>
</div>
@ -210,7 +210,7 @@ @@ -210,7 +210,7 @@
?>
<div class="col-md-6">
<div class="blockquote-box blockquote-primary clearfix">
<a href="<?php echo get_subdomain_full_url("www", $CONF); ?>/<?php echo $adminuser->username; ?>">
<a href="<?php echo get_page_url("home", $CONF); ?>/<?php echo $adminuser->username; ?>">
<div class="square pull-left">
<span class="glyphicon glyphicon-star glyphicon-lg"></span>
</div>
@ -244,7 +244,7 @@ @@ -244,7 +244,7 @@
?>
<div class="col-md-6">
<div class="blockquote-box blockquote-success clearfix">
<a href="<?php echo get_subdomain_full_url("www", $CONF); ?>/<?php echo $moduser->username; ?>">
<a href="<?php echo get_page_url("home", $CONF); ?>/<?php echo $moduser->username; ?>">
<div class="square pull-left">
<span class="glyphicon glyphicon-star-empty glyphicon-lg"></span>
</div>

9
about/web.config

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" path="http://error.teknik.io/404" responseMode="Redirect" />
</httpErrors>
</system.webServer>
</configuration>

4
admin/index.php

@ -19,11 +19,11 @@ if ($logged_in) @@ -19,11 +19,11 @@ if ($logged_in)
}
else
{
header('Location: '.get_subdomain_full_url('error', $CONF).'/403');
header('Location: '.get_page_url('error', $CONF).'/403');
}
}
else
{
header('Location: '.get_subdomain_full_url('error', $CONF).'/403');
header('Location: '.get_page_url('error', $CONF).'/403');
}
?>

10
api/api.php

@ -63,7 +63,7 @@ if (isset($_GET['component'])) @@ -63,7 +63,7 @@ if (isset($_GET['component']))
array('paste' =>
array(
'id' => $id,
'url' => get_subdomain_full_url("p", $CONF).'/'.$id,
'url' => get_page_url("p", $CONF).'/'.$id,
'title' => $post['title'],
'format' => $post['format'],
'expiration' => $post['expires'],
@ -131,8 +131,8 @@ if (isset($_GET['component'])) @@ -131,8 +131,8 @@ if (isset($_GET['component']))
array_push($jsonArray, array('image' =>
array(
'id' => $row_id,
'url' => get_subdomain_full_url("ricehalla", $CONF).'/'.$row_id,
'image_src' => get_subdomain_full_url("u", $CONF).'/'.$filename,
'url' => get_page_url("ricehalla", $CONF).'/'.$row_id,
'image_src' => get_page_url("u", $CONF).'/'.$filename,
'votes' => 1,
'owner' => $user->username,
'date_posted' => $date_added,
@ -245,8 +245,8 @@ if (isset($_GET['component'])) @@ -245,8 +245,8 @@ if (isset($_GET['component']))
array_push($result_array, array('image' =>
array(
'id' => $id,
'url' => get_subdomain_full_url("ricehalla", $CONF).'/'.$id,
'image_src' => get_subdomain_full_url("u", $CONF).'/'.$image_src,
'url' => get_page_url("ricehalla", $CONF).'/'.$id,
'image_src' => get_page_url("u", $CONF).'/'.$image_src,
'votes' => $user_vote,
'owner' => $username,
'date_posted' => $date_posted,

45
api/web.config

@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/errors/api_404.php" responseMode="ExecuteURL" />
</httpErrors>
<rewrite>
<rules>
<rule name="RedirectUserFriendlyURL1" stopProcessing="true">
<match url="^api\.php$" />
<conditions>
<add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
<add input="{QUERY_STRING}" pattern="^component=([^=&amp;]+)&amp;action=([^=&amp;]+)$" />
</conditions>
<action type="Redirect" url="{C:1}/{C:2}" appendQueryString="false" />
</rule>
<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
<match url="^([^/]+)/([^/]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="api.php?component={R:1}&amp;action={R:2}" />
</rule>
<rule name="RedirectUserFriendlyURL2" stopProcessing="true">
<match url="^api\.php$" />
<conditions>
<add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
<add input="{QUERY_STRING}" pattern="^component=([^=&amp;]+)$" />
</conditions>
<action type="Redirect" url="{C:1}" appendQueryString="false" />
</rule>
<rule name="RewriteUserFriendlyURL2" stopProcessing="true">
<match url="^([^/]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="api.php?component={R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

4
blog/get_post.php

@ -60,9 +60,9 @@ if(isset($_POST)) @@ -60,9 +60,9 @@ if(isset($_POST))
<div class="row">
<div class="col-sm-10 col-sm-offset-1 blog-main">
<div class="blog-post">
<h2 class="blog-post-title text-center"><a href="<?php echo get_subdomain_full_url("blog", $CONF); ?>/<?php echo $author->username; ?>/<?php echo $post_id; ?>" id="title_<?php echo $post_id; ?>"><?php echo $title; ?></a></h2>
<h2 class="blog-post-title text-center"><a href="<?php echo get_page_url("blog", $CONF); ?>/<?php echo $author->username; ?>/<?php echo $post_id; ?>" id="title_<?php echo $post_id; ?>"><?php echo $title; ?></a></h2>
<p class="blog-post-meta text-center text-muted">
Posted on <?php echo date("F d, Y",strtotime($date)); ?> by <a href="<?php echo get_subdomain_full_url("www", $CONF); ?>/<?php echo $author->username; ?>"><?php echo $author->username; ?></a><?php echo $reply_msg; ?>
Posted on <?php echo date("F d, Y",strtotime($date)); ?> by <a href="<?php echo get_page_url("home", $CONF); ?>/<?php echo $author->username; ?>"><?php echo $author->username; ?></a><?php echo $reply_msg; ?>
<?php
if ($own_blog)
{

2
blog/main.php

@ -68,7 +68,7 @@ set_page_title($title_bar); @@ -68,7 +68,7 @@ set_page_title($title_bar);
<div class="row">
<div class="col-sm-12 text-center">
<p>
<a href="<?php echo get_subdomain_full_url('rss', $CONF).'/blog/'.$blog_author; ?>"><i class="fa fa-rss fa-2x fa-border"></i></a>
<a href="<?php echo get_page_url('rss', $CONF).'/blog/'.$blog_author; ?>"><i class="fa fa-rss fa-2x fa-border"></i></a>
</p>
</div>
</div>

4
blog/view_post.php

@ -78,9 +78,9 @@ if (isset($_GET['post'])) @@ -78,9 +78,9 @@ if (isset($_GET['post']))
<div class="row">
<div class="col-sm-10 col-sm-offset-1 blog-main">
<div class="blog-post">
<h2 class="blog-post-title text-center"><a href="<?php echo get_subdomain_full_url("blog", $CONF); ?>/<?php echo $author->username; ?>/<?php echo $post_id; ?>" id="title_<?php echo $post_id; ?>"><?php echo $title; ?></a></h2>
<h2 class="blog-post-title text-center"><a href="<?php echo get_page_url("blog", $CONF); ?>/<?php echo $author->username; ?>/<?php echo $post_id; ?>" id="title_<?php echo $post_id; ?>"><?php echo $title; ?></a></h2>
<p class="blog-post-meta text-center text-muted">
Posted on <?php echo date("F d, Y",strtotime($date)); ?> by <a href="<?php echo get_subdomain_full_url("www", $CONF); ?>/<?php echo $author->username; ?>"><?php echo $author->username; ?></a>
Posted on <?php echo date("F d, Y",strtotime($date)); ?> by <a href="<?php echo get_page_url("home", $CONF); ?>/<?php echo $author->username; ?>"><?php echo $author->username; ?></a>
<?php
if ($own_blog)
{

33
blog/web.config

@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="RedirectUserFriendlyURL1" stopProcessing="true">
<match url="^index\.php$" />
<conditions>
<add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
<add input="{QUERY_STRING}" pattern="^author=([^=&amp;]+)$" />
</conditions>
<action type="Redirect" url="{C:1}" appendQueryString="false" />
</rule>
<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
<match url="^([^/]+)?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?author={R:1}" />
</rule>
<rule name="RewriteUserFriendlyURL2" stopProcessing="true">
<match url="^([^/]+)/([0-9^/]+){1,}?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="view_post.php?post={R:2}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

9
contact/web.config

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="http://error.teknik.io/404" responseMode="Redirect" />
</httpErrors>
</system.webServer>
</configuration>

4
errors/403.php

@ -8,8 +8,8 @@ @@ -8,8 +8,8 @@
You aren't allowed to see this!
</div>
<div class="error-actions">
<a href="<?php echo get_subdomain_full_url("www", $CONF); ?>" class="btn btn-primary btn-lg"><span class="glyphicon glyphicon-home"></span>
Take Me Home </a><a href="<?php echo get_subdomain_full_url("contact", $CONF); ?>" class="btn btn-default btn-lg"><span class="glyphicon glyphicon-envelope"></span> Contact Support </a>
<a href="<?php echo get_page_url("home", $CONF); ?>" class="btn btn-primary btn-lg"><span class="glyphicon glyphicon-home"></span>
Take Me Home </a><a href="<?php echo get_page_url("contact", $CONF); ?>" class="btn btn-default btn-lg"><span class="glyphicon glyphicon-envelope"></span> Contact Support </a>
</div>
</div>
</div>

4
errors/404.php

@ -8,8 +8,8 @@ @@ -8,8 +8,8 @@
Sorry, an error has occured, Requested page not found!
</div>
<div class="error-actions">
<a href="<?php echo get_subdomain_full_url("www", $CONF); ?>" class="btn btn-primary btn-lg"><span class="glyphicon glyphicon-home"></span>
Take Me Home </a><a href="<?php echo get_subdomain_full_url("contact", $CONF); ?>" class="btn btn-default btn-lg"><span class="glyphicon glyphicon-envelope"></span> Contact Support </a>
<a href="<?php echo get_page_url("home", $CONF); ?>" class="btn btn-primary btn-lg"><span class="glyphicon glyphicon-home"></span>
Take Me Home </a><a href="<?php echo get_page_url("contact", $CONF); ?>" class="btn btn-default btn-lg"><span class="glyphicon glyphicon-envelope"></span> Contact Support </a>
</div>
</div>
</div>

33
errors/web.config

@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<outboundRules>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
<rules>
<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
<match url="^([^/]+)?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?error={R:1}" />
</rule>
</rules>
</rewrite>
<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="http://error.teknik.io/404" responseMode="Redirect" />
</httpErrors>
<defaultDocument>
<files>
<add value="404.php" />
</files>
</defaultDocument>
</system.webServer>
</configuration>

21
git/help.php

@ -7,10 +7,10 @@ @@ -7,10 +7,10 @@
<div name="GitRepositoryAccess" data-unique="GitRepositoryAccess"></div>
<h3>Git Repository Access</h3>
<p>
Every user is given the option to add their public key to the authorised users list to access the Teknik git repository.
Every user is given the option to add public keys to the authorised users list to access their git repositories, and also access the main Teknik repositories.
<br />
<br />
To add your public key, just login, click your username on the top navbar and click 'Profile'. This will bring you to your profile page where you can add your public key or edit your existing one.
To add a public key, just login, click your username on the top navbar and click 'Profile'. This will bring you to your profile page where you can add your public key or edit your existing one.
<br />
<br />
<div class="bs-callout bs-callout-warning">
@ -21,12 +21,23 @@ @@ -21,12 +21,23 @@
</p>
</div>
</p>
<h3>Examples</h3>
<h3>Creating a Git Repository</h3>
<p>
Once you have a public key added, you will have the ability to create a repo. To do so, you just need to clone the repo you want to create, and the repo will be created.
<br />
<br />
<code>~$git clone git@teknik.io:u/[username]/[repository_name]</code>
</p>
<h3>Viewing a user's git repositories</h3>
<p>
Once you have your key added, you will be able to access the git repository via ssh access
You can also view a list of the git repo's a user has by visiting: <code><?php echo get_page_url('git', $CONF); ?>/u/[username]/</code>
<br />
</p>
<h3>Examples</h3>
<p>
<b>Clone a Repo (Git Daemon):</b> <code>~$git clone git://teknik.io/u/[username]/[repository_name]</code>
<br />
<b>Clone a Repo:</b> <code>~$git clone ssh://git@teknik.io/~/[repository_name]</code>
<b>Clone a Repo (SSH):</b> <code>~$git clone git@teknik.io:u/[username]/[repository_name]</code>
</p>
</div>
</div>

6
git/index.php

@ -20,7 +20,7 @@ if(!preg_match($pattern, $url)) @@ -20,7 +20,7 @@ if(!preg_match($pattern, $url))
set_page_title("Teknik Git");
?>
<script src="<?php echo get_subdomain_full_url($CONF['sub'], $CONF); ?>/templates/<?php echo $CONF['template']; ?>/js/codemirror/codemirror.js"></script>
<script src="<?php echo get_page_url($CONF['page'], $CONF); ?>/templates/<?php echo $CONF['template']; ?>/js/codemirror/codemirror.js"></script>
<?php
}
@ -35,7 +35,7 @@ if (!is_writable(__DIR__ . DIRECTORY_SEPARATOR . 'cache')) { @@ -35,7 +35,7 @@ if (!is_writable(__DIR__ . DIRECTORY_SEPARATOR . 'cache')) {
require 'vendor/autoload.php';
$config = GitList\Config::fromFile('config.ini');
$config->set('app', 'clone_url', 'ssh://git@teknik.io:');
$config->set('app', 'clone_url', 'git://teknik.io/');
if ($_GET['user'])
{
if ($userTools->checkUsernameExists($_GET['user']))
@ -46,7 +46,7 @@ if ($_GET['user']) @@ -46,7 +46,7 @@ if ($_GET['user'])
$config->set('git', 'repositories', array('G:\\Repositories\\u\\'.$_GET['user']));
$config->set('git', 'hidden', array(''));
$config->set('app', 'path_prefix', '/u/'.$_GET['user']);
$config->set('app', 'clone_url', 'ssh://git@teknik.io:u/'.$_GET['user'].'/');
$config->set('app', 'clone_url', 'git://teknik.io/u/'.$_GET['user'].'/');
$app = require 'boot.php';
$app->run();
}

40
git/web.config

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="UserRepositories" enabled="true" stopProcessing="false">
<match url="^/?u/([^/]+)/?(.*)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?user={R:1}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 1" enabled="true" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{UNENCODED_URL}" pattern="^/?u/([^/]+)(.*)?$" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" appendQueryString="false" />
</rule>
</rules>
<outboundRules>
<preConditions>
<preCondition name="isUserSpecific">
<add input="{REQUEST_URI}" pattern="^/u/([^/]+)(.*)$" />
</preCondition>
<preCondition name="isHTML">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" ignoreCase="false" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="http://error.teknik.io/404" responseMode="Redirect" />
</httpErrors>
</system.webServer>
</configuration>

6
help/main.php

@ -6,11 +6,11 @@ @@ -6,11 +6,11 @@
<h3>Important Links</h3>
<dl class="dl-horizontal">
<dt><a href="<?php echo get_subdomain_full_url("transparency", $CONF); ?>" target="_blank">Site Transparency</a></dt>
<dt><a href="<?php echo get_page_url("transparency", $CONF); ?>" target="_blank">Site Transparency</a></dt>
<dd>All the site's transactions, statistics, and data effecting actions.</dd>
<dt><a href="<?php echo get_subdomain_full_url("privacy", $CONF); ?>" target="_blank">Privacy Policy</a></dt>
<dt><a href="<?php echo get_page_url("privacy", $CONF); ?>" target="_blank">Privacy Policy</a></dt>
<dd>Everything about how we handle your privacy.</dd>
<dt><a href="<?php echo get_subdomain_full_url("stats", $CONF); ?>" target="_blank">Server Statistics</a></dt>
<dt><a href="<?php echo get_page_url("stats", $CONF); ?>" target="_blank">Server Statistics</a></dt>
<dd>The current Server Hardware statistics that Teknik is running on.</dd>
</dl>
</div>

9
help/web.config

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="http://error.teknik.io/404" responseMode="Redirect" />
</httpErrors>
</system.webServer>
</configuration>

12
home/profile.php

@ -30,7 +30,7 @@ if (isset($_GET['id'])) @@ -30,7 +30,7 @@ if (isset($_GET['id']))
<?php } ?>
<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>
<?php if ($Profile_User->blog_title) { ?>
<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>
<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>
<?php } ?>
<?php if ($own_profile) { ?>
<li class="list-group-item text-center"><button type="button" class="btn btn-danger" id="delete_account">Delete Account</button></li>
@ -189,13 +189,13 @@ if (isset($_GET['id'])) @@ -189,13 +189,13 @@ if (isset($_GET['id']))
<div class="row">
<div class="col-sm-12" id="public_key_list">
<?php
$keyList = explode(",", $Profile_User->public_key);
$keyList = array_filter(explode(",", $Profile_User->public_key));
$index = 1;
foreach ($keyList as $key)
{
?>
<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>
<?php
?>
<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>
<?php
$index++;
}
?>
@ -257,7 +257,7 @@ if (isset($_GET['id'])) @@ -257,7 +257,7 @@ if (isset($_GET['id']))
}
else
{
redirect(get_subdomain_full_url("www", $CONF));
redirect(get_page_url("home", $CONF));
}
include('../templates/'.$CONF['template'].'/footer.php');
?>

21
home/web.config

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
<match url="^([^/]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="profile.php?id={R:1}" />
</rule>
</rules>
</rewrite>
<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="http://error.teknik.io/404" responseMode="Redirect" />
</httpErrors>
</system.webServer>
</configuration>

5
includes/Git.php

@ -286,9 +286,7 @@ class GitRepo { @@ -286,9 +286,7 @@ class GitRepo {
} else {
$env = array_merge($_ENV, $this->envopts);
}
foreach($_ENV as $val) {
echo $val;
}
$cwd = $this->repo_path;
$resource = proc_open($command, $descriptorspec, $pipes, $cwd, $env);
$stdout = stream_get_contents($pipes[1]);
@ -296,7 +294,6 @@ class GitRepo { @@ -296,7 +294,6 @@ class GitRepo {
foreach ($pipes as $pipe) {
fclose($pipe);
}
$status = trim(proc_close($resource));
if ($status) throw new Exception($stderr);
//exec($command, $stdout);

18
includes/classes/UserTools.class.php

@ -13,14 +13,14 @@ class UserTools { @@ -13,14 +13,14 @@ class UserTools {
//username and password match a row in the database.
//If it is successful, set the session variables
//and store the user object within.
public function login($username, $password, $remember_me)
public function login($username, $password, $remember_me, $CONF)
{
$result = $this->db->select("users", "username=? AND password=?", array($username, $password));
if($result)
{
$user = new User($result);
$_SESSION["user"] = serialize($user);
$_SESSION["logged_in"] = 1;
$_SESSION[$CONF['session_prefix']."user"] = serialize($user);
$_SESSION[$CONF['session_prefix']."logged_in"] = 1;
if ($remember_me)
{
$identifier = hashPassword($username, $this->conf);
@ -32,7 +32,7 @@ class UserTools { @@ -32,7 +32,7 @@ class UserTools {
"timeout" => date("Y-m-d H:i:s",time() + 60 * 60 * 24 * 7)
);
$this->db->insert($data, "sessions");
setcookie('auth', "$identifier:$token", time() + 60 * 60 * 24 * 7, '/', '.'.$this->conf['host']);
setcookie($CONF['session_prefix'].'auth', "$identifier:$token", time() + 60 * 60 * 24 * 7, '/', '.'.$this->conf['host']);
}
return true;
}else{
@ -52,17 +52,17 @@ class UserTools { @@ -52,17 +52,17 @@ class UserTools {
}
//Log the user out. Destroy the session variables.
public function logout()
public function logout($CONF)
{
if (isset($_COOKIE['auth']))
{
$user = unserialize($_SESSION['user']);
$user = unserialize($_SESSION[$CONF['session_prefix'].'user']);
list($identifier, $token) = explode(':', $_COOKIE['auth']);
$this->db->delete("sessions", "user_id=?", array($user->id));
setcookie('auth', false, time() + 60 * 60 * 24 * 7, '/', '.'.$this->conf['host']);
setcookie($CONF['session_prefix'].'auth', false, time() + 60 * 60 * 24 * 7, '/', '.'.$this->conf['host']);
}
unset($_SESSION['user']);
unset($_SESSION['logged_in']);
unset($_SESSION[$CONF['session_prefix'].'user']);
unset($_SESSION[$CONF['session_prefix'].'logged_in']);
session_destroy();
}

50
includes/common.php

@ -1,5 +1,25 @@ @@ -1,5 +1,25 @@
<?php
function get_subdomain_full_url($sub_part, $CONF)
function get_page_url($page, $CONF, $full = true)
{
$full_url = get_http($CONF).$CONF['host'];
switch ($CONF['url_type'])
{
case 'sub':
if ($page == $CONF['default_page'])
{
$page = 'www';
}
$full_url = get_subdomain_full($page, $CONF);
break;
case 'page':
$cur_sub = get_subdomain($CONF);
$full_url = get_http($CONF).$cur_sub.".".$CONF['host']."/".$page;
break;
}
return $full_url;
}
function get_subdomain_full($sub_part, $CONF)
{
$url = get_http($CONF).$sub_part.".".$CONF['host'];
return $url;
@ -25,16 +45,23 @@ function extract_subdomains($domain) @@ -25,16 +45,23 @@ function extract_subdomains($domain)
return $subdomains;
}
function get_subdomain()
function get_subdomain($CONF)
{
$sub = extract_subdomains($_SERVER['HTTP_HOST']);
if ($sub == "")
{
$sub = "www";
$sub = $CONF['default_page'];
}
return $sub;
}
function get_page()
{
$url_array = explode("/",$_SERVER["REQUEST_URI"]);
return ltrim($url_array[1], "/");
}
function get_http($CONF)
{
if ($CONF['https'] != "on")
@ -48,10 +75,19 @@ function get_http($CONF) @@ -48,10 +75,19 @@ function get_http($CONF)
return $http;
}
function get_active($page)
function get_active($page, $CONF)
{
$sub = get_subdomain();
if ($sub == $page)
$cur_page = '';
switch ($CONF['url_type'])
{
case 'sub':
$cur_page = get_subdomain($CONF);
break;
case 'page':
$cur_page = get_page();
break;
}
if ($cur_page == $page)
{
return 'active';
}
@ -161,7 +197,7 @@ function upload($files, $CONF, $db) @@ -161,7 +197,7 @@ function upload($files, $CONF, $db)
);
$db->insert($data, 'uploads');
$_SESSION[$targetFile] = $targetFile;
return array('results' => array('file' => array('name' => $targetFile, 'url' => get_subdomain_full_url("u", $CONF).'/'.$targetFile, 'type' => $file_type, 'size' => $filesize)));
return array('results' => array('file' => array('name' => $targetFile, 'url' => get_page_url("u", $CONF).'/'.$targetFile, 'type' => $file_type, 'size' => $filesize)));
}
return array('error' => $CONF['errors']['InvFile']);
}

47
includes/config.php.default

@ -19,6 +19,9 @@ require_once('Minifier.php'); @@ -19,6 +19,9 @@ require_once('Minifier.php');
$CONF=array();
// Determines whether the current website is the development server or not
$CONF['dev_env'] = FALSE;
// Database Information
$CONF['db_name'] = 'name';
$CONF['db_user'] = 'user';
@ -41,6 +44,16 @@ $CONF['siteowner'] = "Example Owner"; @@ -41,6 +44,16 @@ $CONF['siteowner'] = "Example Owner";
// Site Host
$CONF['host'] = 'example.com';
// Default Page - The page used for the www and default site.
$CONF['default_page'] = 'home';
// The method to use for generating the url's for the site
// --OPTIONS--
// sub => Each service is a subdomain. ie: /about/ is about.$CONF['host']
// page => Each service is a page in the url. ie: /about/ is $CONF['host']/about/
$CONF['url_type'] = 'sub';
// Internal Variable for whether the user is using https or not
$CONF['https'] = $_SERVER['HTTPS'];
// What is the name of the template you want to use for the frontend (the folder name as displayed in /templates/)
@ -61,8 +74,18 @@ $CONF['themes']=array( @@ -61,8 +74,18 @@ $CONF['themes']=array(
'superhero'=>'Superhero'
);
// Current Subdomain
$CONF['sub'] = get_subdomain();
// Current Page
$cur_page = '';
switch ($CONF['url_type'])
{
case 'sub':
$cur_page = get_subdomain();
break;
case 'page':
$cur_page = get_page();
break;
}
$CONF['page'] = $cur_page;
$CONF['salt'] = "aaaaaaaaaaaa";
$CONF['salt_2'] = hash("sha256","bbbbbbbb");
@ -325,6 +348,12 @@ $CONF['errors'] = array( @@ -325,6 +348,12 @@ $CONF['errors'] = array(
'NoAuth' => array('code' => 44, 'message' => 'Not Authorized')
);
$CONF['session_prefix'] = '';
if ($CONF['dev_env'])
{
$CONF['session_prefix'] = 'dev_';
}
/*
Class initilization
*/
@ -347,24 +376,24 @@ ini_set('session.cookie_domain', '.'.$CONF['host']); @@ -347,24 +376,24 @@ ini_set('session.cookie_domain', '.'.$CONF['host']);
session_start();
//Set session if cookie present and valid
if (isset($_COOKIE['auth']))
if (isset($_COOKIE[$CONF['session_prefix'].'auth']))
{
list($identifier, $token) = explode(':', $_COOKIE['auth']);
$result = $db->select("sessions", "identifier=? AND token=?", array($identifier, $token));
if(isset($result['user_id']))
{
$_SESSION['user'] = serialize($userTools->get($result['user_id']));
$_SESSION['logged_in'] = 1;
$_SESSION[$CONF['session_prefix'].'user'] = serialize($userTools->get($result['user_id']));
$_SESSION[$CONF['session_prefix'].'logged_in'] = 1;
}
}
//refresh session variables if logged in
if (isset($_SESSION['logged_in']))
if (isset($_SESSION[$CONF['session_prefix'].'logged_in']))
{
$user = unserialize($_SESSION['user']);
$_SESSION['user'] = serialize($userTools->get($user->id));
if ($_SESSION['logged_in'] == 1)
if ($_SESSION[$CONF['session_prefix'].'logged_in'] == 1)
{
$user = unserialize($_SESSION[$CONF['session_prefix'].'user']);
$_SESSION[$CONF['session_prefix'].'user'] = serialize($userTools->get($user->id));
$logged_in = true;
}
else

2
includes/get_comment.php

@ -44,7 +44,7 @@ if(isset($_POST)) @@ -44,7 +44,7 @@ if(isset($_POST))
<div class="col-sm-8 col-sm-offset-2">
<div class="post-comment">
<p class="post-comment-meta text-muted">
<a href="<?php echo get_subdomain_full_url("www", $CONF); ?>/<?php echo $author->username; ?>"><?php echo $author->username; ?></a> replied at <?php echo date("g:i:s a",strtotime($date)); ?> on <?php echo date("F d, Y",strtotime($date)); ?>
<a href="<?php echo get_page_url("home", $CONF); ?>/<?php echo $author->username; ?>"><?php echo $author->username; ?></a> replied at <?php echo date("g:i:s a",strtotime($date)); ?> on <?php echo date("F d, Y",strtotime($date)); ?>
<?php
if ($own_comment && $logged_in)
{

4
includes/process_login.php

@ -17,9 +17,9 @@ if(isset($_POST)) @@ -17,9 +17,9 @@ if(isset($_POST))
{
$remember = true;
}
if ($userTools->login($username, hashPassword($password, $CONF), $remember))
if ($userTools->login($username, hashPassword($password, $CONF), $remember, $CONF))
{
$user = unserialize($_SESSION['user']);
$user = unserialize($_SESSION[$CONF['session_prefix'].'user']);
$user->save($db);
//successful login, redirect them to a page
echo "true";

2
includes/process_logout.php

@ -4,7 +4,7 @@ require_once('config.php'); @@ -4,7 +4,7 @@ require_once('config.php');
//check to see that the form has been submitted
if(isset($_POST))
{
$userTools->logout();
$userTools->logout($CONF);
echo "true";
}
else

39
includes/process_registration.php

@ -15,10 +15,13 @@ if(isset($_POST)) @@ -15,10 +15,13 @@ if(isset($_POST))
$password = rawurldecode($_POST['password']);
$password_confirm = rawurldecode($_POST['password_confirm']);
$obBaseApp = new COM("hMailServer.Application");
$obBaseApp->Connect();
$obBaseApp->Authenticate($CONF['mail_admin_user'], $CONF['mail_admin_pass']);
$domain = $obBaseApp->Domains->ItemByName($CONF['host']);
if (!$CONF['dev_env'])
{
$obBaseApp = new COM("hMailServer.Application");
$obBaseApp->Connect();
$obBaseApp->Authenticate($CONF['mail_admin_user'], $CONF['mail_admin_pass']);
$domain = $obBaseApp->Domains->ItemByName($CONF['host']);
}
//initialize variables for form validation
$success = true;
@ -45,10 +48,13 @@ if(isset($_POST)) @@ -45,10 +48,13 @@ if(isset($_POST))
$success = false;
}
if($success && $userTools->checkEmailExists($domain, $username . "@" . $CONF['host']))
if (!$CONF['dev_env'])
{
$error = "The email for that username is already taken.";
$success = false;
if($success && $userTools->checkEmailExists($domain, $username . "@" . $CONF['host']))
{
$error = "The email for that username is already taken.";
$success = false;
}
}
if($success && !$password)
@ -78,14 +84,17 @@ if(isset($_POST)) @@ -78,14 +84,17 @@ if(isset($_POST))
//save the new user to the database
$newUser->save($db, true);
//Create an email for the user
$account = $domain->Accounts->Add();
$account->Address = $email;
$account->Password = $password;
$account->Active = True;
$account->MaxSize = 1000;
$account->Save();
if (!$CONF['dev_env'])
{
//Create an email for the user
$account = $domain->Accounts->Add();
$account->Address = $email;
$account->Password = $password;
$account->Active = True;
$account->MaxSize = 1000;
$account->Save();
}
//log them in
$userTools->login($username, hashPassword($password, $CONF), false);

22
includes/update_profile.php

@ -129,13 +129,12 @@ if(isset($_POST)) @@ -129,13 +129,12 @@ if(isset($_POST))
}
// Add the user's keys to his git account
/*
if ($public_key != $user->public_key)
{
$Git = new Git();
$Git->windows_mode();
$repo = $Git->open($CONF['git_repo_path'][0].'gitolite-admin\\');
$repo->setenv("HOME", "/home/git");
$repo->setenv('HOME', '/home/iusr');
$repo->pull('origin', 'master');
if (is_dir($CONF['git_repo_path'][0].'gitolite-admin\\keydir\\u\\'.$user->username))
@ -155,19 +154,22 @@ if(isset($_POST)) @@ -155,19 +154,22 @@ if(isset($_POST))
foreach ($keys as $key)
{
preg_match($pattern, $key, $matches);
$key = "ssh-rsa " . $matches[2];
$keyFileName = $CONF['git_repo_path'][0].'gitolite-admin\\keydir\\u\\'.$user->username."\\".$user->username."@Key".$index.".pub";
$fileHandle = fopen($keyFileName, 'w');
fwrite($fileHandle, $key);
fclose($fileHandle);
$index++;
if (trim($matches[2]) != "")
{
$key = "ssh-rsa " . $matches[2];
$keyFileName = $CONF['git_repo_path'][0].'gitolite-admin\\keydir\\u\\'.$user->username."\\".$user->username."@Key".$index.".pub";
$fileHandle = fopen($keyFileName, 'w');
fwrite($fileHandle, $key);
fclose($fileHandle);
$index++;
}
}
$repo->add('.');
$repo->commit('Modified keys for '.$user->username);
$repo->push('origin', 'master');
}
*/
/*
if ($minecraft != $user->minecraft_user)
{

2
mail/help.php

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
<h3>Mail Server Settings</h3>
<p>
At registration, each user is given an email address with <b>1 GB</b> of storage space.
You can either access your email via the <a href="<?php echo get_subdomain_full_url("mail", $CONF); ?>" target="_blank">Web Client</a> or by using a client of your choosing with support for IMAP or POP3.
You can either access your email via the <a href="<?php echo get_page_url("mail", $CONF); ?>" target="_blank">Web Client</a> or by using a client of your choosing with support for IMAP or POP3.
</p>
<div class="row">
<div class="col-sm-5">

6
paste/main.php

@ -213,8 +213,8 @@ if (!(isset($pass) && (sha1($postPass) !== $pass)) || $pass == "EMPTY") {?> @@ -213,8 +213,8 @@ if (!(isset($pass) && (sha1($postPass) !== $pass)) || $pass == "EMPTY") {?>
<small class="pull-right"><?php echo $entry['agefmt'];?></small>
<p class="no-margin"><i class="icon-code"></i>
<?php if ( $mod_rewrite == true ) {
echo '<a href="'. get_subdomain_full_url('p', $CONF) . '/' . $entry['pid'] . '">' . $entry['title'] . '</a>'; } else {
echo '<a href="'. get_subdomain_full_url('p', $CONF) . '/' .'?paste='. $entry['pid'].'">' . $entry['title'] . '</a>'; } ?>
echo '<a href="'. get_page_url('p', $CONF) . '/' . $entry['pid'] . '">' . $entry['title'] . '</a>'; } else {
echo '<a href="'. get_page_url('p', $CONF) . '/' .'?paste='. $entry['pid'].'">' . $entry['title'] . '</a>'; } ?>
</p>
</div>
<?php } ?>
@ -226,5 +226,5 @@ if (!(isset($pass) && (sha1($postPass) !== $pass)) || $pass == "EMPTY") {?> @@ -226,5 +226,5 @@ if (!(isset($pass) && (sha1($postPass) !== $pass)) || $pass == "EMPTY") {?>
<?php } ?>
<p class="text-center">
Tools: <a href="<?php echo get_subdomain_full_url('git', $CONF); ?>/Tools.git/blob/master/Paste/paste.sh">Bash Paste Script</a>
Tools: <a href="<?php echo get_page_url('git', $CONF); ?>/Tools.git/blob/master/Paste/paste.sh">Bash Paste Script</a>
</p>

32
paste/web.config

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
<match url="^([^/]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="?paste={R:1}" />
</rule>
</rules>
<outboundRules>
<rule name="OutboundRewriteUserFriendlyURL1" preCondition="ResponseIsHtml1" enabled="false">
<match filterByTags="A, Form, Img" pattern="^(.*/)\?paste=([^=&amp;]+)$" />
<action type="Rewrite" value="{R:1}/{R:2}/" />
</rule>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="http://error.teknik.io/404" responseMode="Redirect" />
</httpErrors>
</system.webServer>
</configuration>

6
podcast/get_post.php

@ -43,7 +43,7 @@ if(isset($_POST)) @@ -43,7 +43,7 @@ if(isset($_POST))
<div class="row">
<div class="col-sm-10 col-sm-offset-1 podcast-main">
<div class="podcast-post">
<h2 class="podcast-post-title text-center"><a href="<?php echo get_subdomain_full_url("podcast", $CONF); ?>/<?php echo $post_id; ?>" id="title_<?php echo $post_id; ?>"><?php echo $title; ?></a></h2>
<h2 class="podcast-post-title text-center"><a href="<?php echo get_page_url("podcast", $CONF); ?>/<?php echo $post_id; ?>" id="title_<?php echo $post_id; ?>"><?php echo $title; ?></a></h2>
<p class="podcast-post-meta text-center text-muted">
Posted on <?php echo date("F d, Y",strtotime($date)); ?><?php echo $reply_msg; ?>
<?php
@ -62,7 +62,7 @@ if(isset($_POST)) @@ -62,7 +62,7 @@ if(isset($_POST))
<?php
foreach ($files as $filename)
{
$file_path = get_subdomain_full_url("podcast", $CONF).'/Podcasts/'.$title.'/'.$filename;
$file_path = get_page_url("podcast", $CONF).'/Podcasts/'.$title.'/'.$filename;
$direct_path = $CONF['podcast_dir'].$title.'/'.$filename;
if (file_exists($direct_path))
{
@ -80,7 +80,7 @@ if(isset($_POST)) @@ -80,7 +80,7 @@ if(isset($_POST))
<?php
foreach ($files as $filename)
{
$file_path = get_subdomain_full_url("podcast", $CONF).'/Podcasts/'.$title.'/'.$filename;
$file_path = get_page_url("podcast", $CONF).'/Podcasts/'.$title.'/'.$filename;
$direct_path = $CONF['podcast_dir'].$title.'/'.$filename;
if (file_exists($direct_path))
{

2
podcast/main.php

@ -22,7 +22,7 @@ set_page_title($podcast_title); @@ -22,7 +22,7 @@ set_page_title($podcast_title);
<div class="row">
<div class="col-sm-12 text-center">
<p>
<a href="<?php echo get_subdomain_full_url('rss', $CONF).'/podcast/'; ?>"><i class="fa fa-rss fa-2x fa-border"></i></a>
<a href="<?php echo get_page_url('rss', $CONF).'/podcast/'; ?>"><i class="fa fa-rss fa-2x fa-border"></i></a>
</p>
</div>
</div>

6
podcast/view_post.php

@ -80,7 +80,7 @@ if (isset($_GET['post'])) @@ -80,7 +80,7 @@ if (isset($_GET['post']))
<div class="row">
<div class="col-sm-10 col-sm-offset-1 podcast-main">
<div class="podcast-post">
<h2 class="podcast-post-title text-center"><a href="<?php echo get_subdomain_full_url("podcast", $CONF); ?>/<?php echo $post_id; ?>" id="title_<?php echo $post_id; ?>"><?php echo $title; ?></a></h2>
<h2 class="podcast-post-title text-center"><a href="<?php echo get_page_url("podcast", $CONF); ?>/<?php echo $post_id; ?>" id="title_<?php echo $post_id; ?>"><?php echo $title; ?></a></h2>
<p class="podcast-post-meta text-center text-muted">
Posted on <?php echo date("F d, Y",strtotime($date)); ?>
<?php
@ -99,7 +99,7 @@ if (isset($_GET['post'])) @@ -99,7 +99,7 @@ if (isset($_GET['post']))
<?php
foreach ($files as $filename)
{
$file_path = get_subdomain_full_url("podcast", $CONF).'/Podcasts/'.$title.'/'.$filename;
$file_path = get_page_url("podcast", $CONF).'/Podcasts/'.$title.'/'.$filename;
$direct_path = $CONF['podcast_dir'].$title.'/'.$filename;
if (file_exists($direct_path))
@ -118,7 +118,7 @@ if (isset($_GET['post'])) @@ -118,7 +118,7 @@ if (isset($_GET['post']))
<?php
foreach ($files as $filename)
{
$file_path = get_subdomain_full_url("podcast", $CONF).'/Podcasts/'.$title.'/'.$filename;
$file_path = get_page_url("podcast", $CONF).'/Podcasts/'.$title.'/'.$filename;
$direct_path = $CONF['podcast_dir'].$title.'/'.$filename;
if (file_exists($direct_path))

17
podcast/web.config

@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
<match url="^([^/]+)?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="view_post.php?post={R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

8
ricehalla/main.php

@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
{
$username = $userTools->get($result['user_id'])->username;
$thumbnail_src = "../uploads/thumbnails/150_150_" . $result['url'];
$image_src = get_subdomain_full_url("u", $CONF).'/' . $result['url'];
$image_src = get_page_url("u", $CONF).'/' . $result['url'];
$user_vote = $db->select('votes', 'table_name=? AND row_id=? AND user_id=? ORDER BY id DESC LIMIT 1', array('ricehalla', $result['id'], $user->id));
$thumb_up = "btn-hover";
$thumb_down = "btn-hover";
@ -71,7 +71,7 @@ @@ -71,7 +71,7 @@
(<?php echo $result['TotalPoints']; ?>)
</div>
<div class="col-sm-3">
<a href="<?php echo get_subdomain_full_url("ricehalla", $CONF).'/'.$result['id']; ?>" target="_blank" class="btn btn-sm btn-hover btn-primary"><span class="glyphicon glyphicon-link"></span></a>
<a href="<?php echo get_page_url("ricehalla", $CONF).'/'.$result['id']; ?>" target="_blank" class="btn btn-sm btn-hover btn-primary"><span class="glyphicon glyphicon-link"></span></a>
</div>
<?php
if ($logged_in)
@ -96,7 +96,7 @@ @@ -96,7 +96,7 @@
?>
</div>
<div class="col-sm-2 filter-col">
<a href="<?php echo get_subdomain_full_url("www", $CONF); ?>/<?php echo $username; ?>"><?php echo $username; ?></a>
<a href="<?php echo get_page_url("home", $CONF); ?>/<?php echo $username; ?>"><?php echo $username; ?></a>
</div>
<div class="col-sm-2 filter-col">
<?php echo $result['date_added']; ?>
@ -146,7 +146,7 @@ @@ -146,7 +146,7 @@
});
</script>
<div class="col-sm-2 filter-col">
<a href="#" class="modalButton" data-toggle="modal" data-img="<?php echo $image_src; ?>" data-url="<?php echo get_subdomain_full_url("u", $CONF).'/'.$result['url']; ?>" data-user="<?php echo $username; ?>" data-target="#viewCreation">
<a href="#" class="modalButton" data-toggle="modal" data-img="<?php echo $image_src; ?>" data-url="<?php echo get_page_url("u", $CONF).'/'.$result['url']; ?>" data-user="<?php echo $username; ?>" data-target="#viewCreation">
<img src="<?php echo $thumbnail_src; ?>" width="150" class="img-responsive img-rounded" alt="">
</a>
</div>

6
ricehalla/view_image.php

@ -19,7 +19,7 @@ if (isset($_GET['id'])) @@ -19,7 +19,7 @@ if (isset($_GET['id']))
if ($result)
{
$username = $userTools->get($result['user_id'])->username;
$image_src = get_subdomain_full_url("u", $CONF).'/'.$result['url'];
$image_src = get_page_url("u", $CONF).'/'.$result['url'];
$user_vote = $db->select('votes', 'table_name=? AND row_id=? AND user_id=? ORDER BY id DESC LIMIT 1', array('ricehalla', $result['id'], $user->id));
$thumb_up = "btn-hover";
$thumb_down = "btn-hover";
@ -132,7 +132,7 @@ if (isset($_GET['id'])) @@ -132,7 +132,7 @@ if (isset($_GET['id']))
<div class="container">
<div class="row text-center">
<div class="col-sm-12 view_image" style="overflow: hidden;">
<a href="<?php echo get_subdomain_full_url("u", $CONF).'/'.$result['url']; ?>" value="<?php echo $image_src; ?>" target="_blank">
<a href="<?php echo get_page_url("u", $CONF).'/'.$result['url']; ?>" value="<?php echo $image_src; ?>" target="_blank">
<img src="<?php echo $image_src; ?>" class="img-responsive img-thumbnail" alt="">
</a>
</div>
@ -160,6 +160,6 @@ if (isset($_GET['id'])) @@ -160,6 +160,6 @@ if (isset($_GET['id']))
}
else
{
redirect(get_subdomain_full_url("www", $CONF));
redirect(get_page_url("home", $CONF));
}
?>

20
ricehalla/web.config

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="view_desktop" stopProcessing="true">
<match url="^([0-9]+)$" />
<action type="Rewrite" url="view_image.php?id={R:1}" appendQueryString="false" />
<conditions>
<add input="{REQUEST_URI}" pattern="(.+)" />
</conditions>
</rule>
</rules>
</rewrite>
<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="http://error.teknik.io/404" responseMode="Redirect" />
</httpErrors>
</system.webServer>
</configuration>

8
rss/index.php

@ -38,7 +38,7 @@ if ($_GET['content']) @@ -38,7 +38,7 @@ if ($_GET['content'])
$rssfeed .= '<rss version="2.0">';
$rssfeed .= '<channel>';
$rssfeed .= '<title><![CDATA['.$rss_title.']]></title>';
$rssfeed .= '<link>'.get_subdomain_full_url($rss_content, $CONF).'/'.$rss_author.'</link>';
$rssfeed .= '<link>'.get_page_url($rss_content, $CONF).'/'.$rss_author.'</link>';
$rssfeed .= '<description><![CDATA['.$rss_desc.']]></description>';
$rssfeed .= '<language>en-us</language>';
$rssfeed .= '<copyright>Copyright (C) 2013-'.date('Y', time()).' Teknik.io';
@ -81,7 +81,7 @@ if ($_GET['content']) @@ -81,7 +81,7 @@ if ($_GET['content'])
$rssfeed .= '<item>';
$rssfeed .= '<title><![CDATA[' . $title . ']]></title>';
$rssfeed .= '<description><![CDATA[' . $post . ']]></description>';
$rssfeed .= '<link>' . get_subdomain_full_url("blog", $CONF) .'/'. $author->username .'/'. $post_id . '</link>';
$rssfeed .= '<link>' . get_page_url("blog", $CONF) .'/'. $author->username .'/'. $post_id . '</link>';
$rssfeed .= '<pubDate>' . date("D, d M Y H:i:s O",strtotime($date)) . '</pubDate>';
$rssfeed .= '</item>';
}
@ -121,14 +121,14 @@ if ($_GET['content']) @@ -121,14 +121,14 @@ if ($_GET['content'])
foreach ($files as $filename)
{
$file_path = get_subdomain_full_url("podcast", $CONF).'/Podcasts/'.$title.'/'.$filename;
$file_path = get_page_url("podcast", $CONF).'/Podcasts/'.$title.'/'.$filename;
$direct_path = $CONF['podcast_dir'].$title.'/'.$filename;
$file_type = mime_content_type($direct_path);
$file_length = filesize($direct_path);
$rssfeed .= '<enclosure url="'.$file_path.'" length="'.$file_length.'" type="'.$file_type.'" />';
}
$rssfeed .= '<link>' . get_subdomain_full_url("podcast", $CONF) .'/' . $post_id . '</link>';
$rssfeed .= '<link>' . get_page_url("podcast", $CONF) .'/' . $post_id . '</link>';
$rssfeed .= '<pubDate>' . date("D, d M Y H:i:s O",strtotime($date)) . '</pubDate>';
$rssfeed .= '</item>';
}

25
rss/web.config

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
<match url="^([^/]+)/([^/]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?content={R:1}&amp;author={R:2}" />
</rule>
<rule name="RewriteUserFriendlyURL2" stopProcessing="true">
<match url="^([^/]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?content={R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

17
stats/web.config