Skip to content

Commit

Permalink
Refactor filenames, and clean up some code
Browse files Browse the repository at this point in the history
  • Loading branch information
cydrobolt committed Dec 28, 2014
1 parent a310530 commit cc6346e
Show file tree
Hide file tree
Showing 42 changed files with 165 additions and 240 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
4 changes: 2 additions & 2 deletions 404.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- polr 404 -->
<?php require_once('header.php');?>
<?php require_once('layout-headerlg.php');?>
<h1>404</h1><br><h2>You step in the stream</h2><h2>But the water has moved on.</h2><h2>This page is not here</h2></div>
<?php require_once('footer.php');?>
<?php require_once('layout-footerlg.php');?>
6 changes: 3 additions & 3 deletions about.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
@(include('config.php')) or header('Location:setup.php');
require_once 'headerpage.php';
require_once 'layout-headermd.php';
require_once('version.php');
?>
<?php
require_once('req.php');
require_once('lib-core.php');
if ($_SESSION['role']=="adm") {
echo "
<h1>About Polr</h1>
Expand Down Expand Up @@ -38,5 +38,5 @@
along with this program. If not, see <a href='http://www.gnu.org/copyleft/gpl.html'>http://www.gnu.org/copyleft/gpl.html</a>.
</div>
<?php
require_once 'footerpage.php';
require_once 'layout-footermd.php';
?>
12 changes: 6 additions & 6 deletions activate.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

require_once 'req.php';
require_once 'lib-core.php';
$ruser = $_GET['user'];
$rusersan = $mysqli->real_escape_string($ruser);
$rkey = $_GET['key'];
Expand All @@ -10,7 +10,7 @@ function noMc($length = 10) {
return substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);
}

//Please read the message concerning the use of NoMC @ registerproc.php
//Please read the message concerning the use of NoMC @ handle-register.php

$nrkey = sha1(noMc(rand(40,60)));
$rkeys = $mysqli->real_escape_string($rkey);
Expand All @@ -24,13 +24,13 @@ function noMc($length = 10) {
if ($iv == $rkey) {
$qr = "UPDATE auth SET valid='1', rkey='{$nrkey}' WHERE username='$rusersan';";
$rr = $mysqli->query($qr) or showerror();
require_once('header.php');
require_once('layout-headerlg.php');
echo "You have successfully activated your account. You may now login (top right)";
require_once('footer.php');
require_once('layout-footerlg.php');
die();
} else {
require_once('header.php');
require_once('layout-headerlg.php');
echo "The key/username you specified is incorrect.";
require_once('footer.php');
require_once('layout-footerlg.php');
die();
}
4 changes: 2 additions & 2 deletions admin/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</ul>
<ul class="nav pull-right navbar-nav">
<?php
require_once('../polrauth.php');
require_once('../lib-auth.php');
$polrauth = new polrauth();
$polrauth->headblock();
?>
Expand All @@ -50,7 +50,7 @@
<a class="dropdown-toggle" href="#" data-toggle="dropdown">Sign In <strong class="caret"></strong></a>
<div class="dropdown-menu" id="dropdown" style="padding: 15px; padding-bottom: 0px; color:white;">
<h2>Login</h2>
<form action="../loginproc.php" method="post" accept-charset="UTF-8">
<form action="../handle-login.php" method="post" accept-charset="UTF-8">
<input id="user_username" style="margin-bottom: 15px;" type="text" name="username" placeholder='Username' size="30" class="form-control">
<input id="user_password" style="margin-bottom: 15px;" type="password" name="password" placeholder='Password' size="30" class="form-control">

Expand Down
4 changes: 2 additions & 2 deletions admin/headerpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</ul>
<ul class="nav pull-right navbar-nav">
<?php
require_once('../polrauth.php');
require_once('../lib-auth.php');
$polrauth = new polrauth();
$polrauth->headblock();
?>
Expand All @@ -50,7 +50,7 @@
<a class="dropdown-toggle" href="#" data-toggle="dropdown">Sign In <strong class="caret"></strong></a>
<div class="dropdown-menu" id="dropdown" style="padding: 15px; padding-bottom: 0px; color:white;">
<h2>Login</h2>
<form action="../loginproc.php" method="post" accept-charset="UTF-8">
<form action="../handle-login.php" method="post" accept-charset="UTF-8">
<input id="user_username" style="margin-bottom: 15px;" type="text" name="username" placeholder='Username' size="30" class="form-control">
<input id="user_password" style="margin-bottom: 15px;" type="password" name="password" placeholder='Password' size="30" class="form-control">

Expand Down
47 changes: 21 additions & 26 deletions admin/index.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

require_once '../req.php';
require_once '../lib-core.php';
require_once 'headerpage.php';
require_once '../polrauth.php';
require_once '../lib-auth.php';
$auth = new polrauth();
$isadmin = $auth->isadminli();
if (!is_array($auth->islogged())) {
echo "<h3>You must login to access this page.</h3><br><a href='index.php'>Home</a>";
require_once '../footer.php';
require_once '../layout-footerlg.php';
die(); //END NOT LOGGED IN PORTION
} else {
$userinfo = $auth->islogged();
Expand All @@ -30,13 +30,12 @@ function fetchurls($lstart = 0) {
}

$linkshtml = fetchurls();
echo "<script src='../js/ucptabs.js'></script>";
echo "<h3>Polr Dashboard</h3><br>";
echo '<ul class="nav nav-tabs" id="tabsb">
<li class="active"><a href="#home" data-toggle="tab">Home</a></li>
<li><a href="#links" data-toggle="tab">My links</a></li>
<li><a href="#messages" data-toggle="tab">Messages</a></li>
<li><a href="#settings" data-toggle="tab">Settings</a></li>';
<li class="active"><a href="#home" data-toggle="tab">Home</a></li>
<li><a href="#links" data-toggle="tab">My links</a></li>
<li><a href="#messages" data-toggle="tab">Messages</a></li>
<li><a href="#settings" data-toggle="tab">Settings</a></li>';
if ($isadmin == true) {
echo '<li><a href="#adminpanel" data-toggle="tab">Admin Panel</a></li>';

Expand Down Expand Up @@ -101,35 +100,31 @@ function fetchusersadmin($lstart = 0) {
}
}


echo '</ul>';
echo '<div class="tab-content">
<div class="tab-pane active" id="home"><br><h2>Welcome to '.$wsn.' user dashboard. Powered by <a href="//github.com/cydrobolt/polr">Polr</a>; Made with <3, <code>$ bash</code>, and lots of <code>git push</code>es</div>
<div class="tab-pane" id="links"><br>' . $linkshtml . '</div>
<div class="tab-pane active" id="home"><br><h2>Welcome to '.$wsn.' Polr dashboard.</div>
<div class="tab-pane" id="links"><br>' . $linkshtml . '</div>
'.$msges.'
<div class="tab-pane" id="settings"><br>
<h3>Change password</h3>
<form action=\'ucp-settingsp.php\' method=\'POST\'>
<input type=\'hidden\' name=\'action\' value=\'changepw\' />
Old Password: <input type=\'password\' name=\'currpw\' />
New Password: <input type=\'password\' name=\'newpw\' />
<input type=\'submit\' class=\'btn btn-success\'/>
</form>
</div>';
'.$msges.'
<div class="tab-pane" id="settings"><br>
<h3>Change password</h3>
<form action=\'ucp-settingsp.php\' method=\'POST\'>
<input type=\'hidden\' name=\'action\' value=\'changepw\' />
Old Password: <input type=\'password\' name=\'currpw\' />
New Password: <input type=\'password\' name=\'newpw\' />
<input type=\'submit\' class=\'btn btn-success\'/>
</form>
</div>';
if ($isadmin == true) {
$sessiondump = "";
foreach ($_SESSION as $sevar) {
$sessiondump = $sessiondump . '<br>' . $sevar;
}
echo '<div class="tab-pane" id="adminpanel"><br>Polr Links - Limited @ 720:' . $linksadmin . '<br>Polr Users - Limited @ 360:' . $usersadmin. '<script src="../js/ucpjs.js"></script>';
if ($debug==1) {
echo '<div class="tab-pane" id="adminpanel"><br>Polr Links - Limited @ 720:' . $linksadmin . '<br>Polr Users - Limited @ 360:' . $usersadmin. '<script src="../js/ucp.js"></script>';
if ($debug == 1) {
'<br>Debug Variables: <br>Default IP Fetch: ' . $ip . '<br>X-Forwarded-For:' . @$headers['X-Forwarded-For'] . '<br>Forwarded-For' . @$headers['forwarded-for'];
}
}


echo '</div>';
}

//require_once 'footerpage.php';
4 changes: 2 additions & 2 deletions admin/ucp-disablelink.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require_once '../req.php';
require_once '../polrauth.php';
require_once '../lib-core.php';
require_once '../lib-auth.php';
$polrauth = new polrauth();
$baseval = $mysqli->real_escape_string($_POST['baseval']);
$userinfo = $polrauth->islogged();
Expand Down
4 changes: 2 additions & 2 deletions admin/ucp-enablelink.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require_once '../req.php';
require_once '../polrauth.php';
require_once '../lib-core.php';
require_once '../lib-auth.php';
$polrauth = new polrauth();
$baseval = $mysqli->real_escape_string($_POST['baseval']);
$userinfo = $polrauth->islogged();
Expand Down
12 changes: 6 additions & 6 deletions admin/ucp-settingsp.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
require_once '../req.php';
require_once '../lib-core.php';
if (!$_SESSION['li']) {
header('Location: index.php');
}
require_once '../polrauth.php';
require_once '../lib-auth.php';
$polrauth = new polrauth();
$islogged = $polrauth->islogged();
$action = $mysqli->real_escape_string($_POST['action']);
Expand All @@ -12,7 +12,7 @@
$currpw = $mysqli->real_escape_string($_POST['currpw']);
$newpw = $mysqli->real_escape_string($_POST['newpw']);

require_once '../password.php';
require_once '../lib-password.php';
function noMc($length = 23) {
return substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);
}
Expand All @@ -30,7 +30,7 @@ function noMc($length = 23) {
if (!$islegit) {
require_once 'header.php';
echo "Invalid current password. <a href=\"index.php\">Back</a>";
require_once 'footer.php';
require_once 'layout-footerlg.php';
die();
}

Expand All @@ -39,12 +39,12 @@ function noMc($length = 23) {
if ($res) {
require_once 'header.php';
echo "Success! <a href='index.php'>Back</a>";
require_once 'footer.php';
require_once 'layout-footerlg.php';
die();
} else {
require_once 'header.php';
echo "Error! <a href='index.php'>Back</a>";
require_once 'footer.php';
require_once 'layout-footerlg.php';
die();
}
}
Expand Down
2 changes: 1 addition & 1 deletion api.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* OptEndpoint: temp - whether the URL is temporary or not
*/
$reqargs['nosession'] = true;
require_once('req.php'); //Fetch Config
require_once('lib-core.php'); //Fetch Config
require_once('dnsbl.php'); //Load Google SafeBrowsing Script

$protocol = '://';
Expand Down
64 changes: 0 additions & 64 deletions appcalls.php

This file was deleted.

10 changes: 5 additions & 5 deletions createurl.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
require_once("req.php");
require_once('header.php');
require_once('polrauth.php');
require_once("lib-core.php");
require_once('layout-headerlg.php');
require_once('lib-auth.php');
$polrauth = new polrauth();
$protocol = '://';
$hpi = $_POST['hp'];
Expand All @@ -11,7 +11,7 @@
if ($li_shorten_only == true) {
if (!isset($_SESSION['username'])) {
echo "<h2>Only logged in users may shorten links. Did you mean to <a href='login.php'>log in</a>?</h2>";
require_once('footer.php');
require_once('layout-footerlg.php');
die();
}
}
Expand Down Expand Up @@ -160,4 +160,4 @@ function rStr($length = 4) {
}
echo '<br><a href="index.php" class="btn btn-primary btn-large">Shorten Another Link</a></div>';

require_once('footer.php');
require_once('layout-footerlg.php');
File renamed without changes.
Loading

0 comments on commit cc6346e

Please sign in to comment.