From e98d999535575c2aa7ef869dcd1253b7fdbf13c9 Mon Sep 17 00:00:00 2001 From: EC2 Default User Date: Thu, 19 Jun 2014 18:49:42 +0000 Subject: [PATCH] Fixed Analytics & Formatted Code --- account.php | 99 +++++++++++++++++++++++-------------------- functions.php | 12 +++--- hw.php | 113 +++++++++++++++++++++++++------------------------- index.php | 6 ++- legal.php | 13 ++++++ login.php | 4 +- press.php | 16 +++---- register.php | 4 +- search.php | 19 ++++----- share.php | 4 +- 10 files changed, 153 insertions(+), 137 deletions(-) diff --git a/account.php b/account.php index 770d0a1..2b0b412 100644 --- a/account.php +++ b/account.php @@ -3,8 +3,8 @@ $whack = new Whack(); $user_id = $whack->getProfileID(); if (!$user_id) { - header("Location: /register"); - die("You need to login to access your account."); + header("Location: /register"); + die("You need to login to access your account."); } $profile = $whack->getProfile($user_id); ?> @@ -38,14 +38,14 @@ _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { - var u=(("https:" == document.location.protocol) ? "https" : "http") + "://localhost/analytics/"; + var u=(("https:" == document.location.protocol) ? "https" : "http") + "://homeworkhunt.com/analytics/"; _paq.push(['setTrackerUrl', u+'piwik.php']); _paq.push(['setSiteId', 1]); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); })(); +

@@ -68,54 +68,61 @@
- Email Us + Email Us
Not ? Logout. - + - - -
-

Woah there! You haven't shared any homework yet!

Why is sharing homework important?

-
    -
  1. Earn upvotes which translate directly into credits allowing you to download more homework!
  2. -
  3. Fuel the community! Remember, sharing is caring!
  4. -
  5. Become a Trusted member so you can download unlimited homework for free! Learn more
  6. -
- Share Homework -
-
- - - - - - - - - - - - - "); - echo(""); - echo(""); -} -?> - -
RatingDownloadsTitle
".$post['rating']."".$post['downloads']."".htmlspecialchars($post['title'])."
-
+
+
+

Woah there! You haven't shared any homework yet!

+ +

Why is sharing homework important?

+ +
    +
  1. Earn upvotes which translate directly into credits allowing you to download more homework!
  2. + +
  3. Fuel the community! Remember, sharing is caring!
  4. + +
  5. Become a Trusted member so you can download unlimited homework for free! Learn more +
  6. +
Share Homework +
+ +
+
+ + + + + + + + + + + + + "); + echo(""); + echo(""); + } + ?> + +
RatingDownloadsTitle
".$post['rating']."".$post['downloads']."".htmlspecialchars($post['title'])."
+
+
-
-
- +
+ + diff --git a/functions.php b/functions.php index 8b633b6..7e268b7 100755 --- a/functions.php +++ b/functions.php @@ -75,7 +75,7 @@ function share($user, $title, $description, $file) { $this->proccessContent($post, $fileContent); return true; } - + $apikey = CLOUDCONVERT_KEY; $process = CloudConvert::createProcess(pathinfo($file['name'], PATHINFO_EXTENSION), "txt", $apikey); $fileURL = $s3->getObjectUrl( @@ -86,7 +86,7 @@ function share($user, $title, $description, $file) { 'ResponseContentDisposition' => 'attachment; filename="'.$fileName.'"' ) ); - + $process -> setOption("callback", SERVER_PROTOCOL."://".SERVER_HOSTNAME."/services/CloudConvert/callback?callback=true&secret=".CLOUDCONVERT_KEY."&hw=".$post); $process -> uploadByUrl($fileURL, $fileName, "txt"); return true; @@ -177,7 +177,7 @@ function homework($id, $user = 0) { $hw["rating"] = $row_3['rating']; $result_4 = mysqli_query($mysqli, "SELECT `isUpvote` FROM `votes` WHERE `user` = '$user' AND `post` = '$id_safe'") or die("Error " . mysqli_error($mysqli)); - + $row_4 = mysqli_fetch_assoc($result_4); if($user == 0 || empty($row_4['isUpvote']) ) { $hw["voteStatus"] = "never"; @@ -200,7 +200,7 @@ function getUser($user) { $row = mysqli_fetch_assoc($result); return $row; } - + // Returns search results for the query string. function search($q) { $mysqli = mysqli_connect(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_NAME) or die("Error " . mysqli_error($mysqli)); @@ -257,7 +257,7 @@ function sitemapePages() { $totalCount = $row['total']; return ceil($totalCount/50000); } - // Returns HW ID's for each of the + // Returns HW ID's for each of the function sitemapPage($page) { $mysqli = mysqli_connect(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_NAME) or die("Error " . mysqli_error($mysqli)); $skip = ($page-1)*50000; @@ -270,7 +270,7 @@ function sitemapPage($page) { } return $posts; } - + function creditsRemaining($user) { return 5; } diff --git a/hw.php b/hw.php index ad61c4f..42eb04d 100644 --- a/hw.php +++ b/hw.php @@ -8,17 +8,17 @@ $hasPurchased = $whack->hasPurchased($user_id, $hwID); if ($hw == false) die("Homework not found"); function formatBytes($bytes, $precision = 2) { - $units = array('B', 'KB', 'MB', 'GB', 'TB'); + $units = array('B', 'KB', 'MB', 'GB', 'TB'); - $bytes = max($bytes, 0); - $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); - $pow = min($pow, count($units) - 1); + $bytes = max($bytes, 0); + $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); + $pow = min($pow, count($units) - 1); - // Uncomment one of the following alternatives - // $bytes /= pow(1024, $pow); - // $bytes /= (1 << (10 * $pow)); + // Uncomment one of the following alternatives + // $bytes /= pow(1024, $pow); + // $bytes /= (1 << (10 * $pow)); - return round($bytes, $precision) . ' ' . $units[$pow]; + return round($bytes, $precision) . ' ' . $units[$pow]; } header ('Content-type: text/html; charset=utf-8'); @@ -61,7 +61,7 @@ function formatBytes($bytes, $precision = 2) { _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { - var u=(("https:" == document.location.protocol) ? "https" : "http") + "://localhost/analytics/"; + var u=(("https:" == document.location.protocol) ? "https" : "http") + "://homeworkhunt.com/analytics/"; _paq.push(['setTrackerUrl', u+'piwik.php']); _paq.push(['setSiteId', 1]); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; @@ -70,64 +70,63 @@ function formatBytes($bytes, $precision = 2) { -
- - - -
-
-

-
-

-
-
-
- File -
+ +
+ + -
- -
+
+
+


-
- Credit(s) -
+


-
- By -
-
-
- +
+
+ File +
-
- To download this entire homework assignment for 1 credit, you will need an account. Both accounts and credits are free and more credits may be earned by sharing quality homework. -
+
+ +
-
-
- ">    "> +
+ Credit(s) +
+ +
+ By +
+
+ + +
+ To download this entire homework assignment for 1 credit, you will need an account. Both accounts and credits are free and more credits may be earned by sharing quality homework. +
+ +
+
+ ">    "> +
-
- Download - - +
+ Download +
-
-

Comments feature coming soon.

-
    -
  • -
+

Comments feature coming soon.

+ +
    +
  • +
+
-
-
-
- +
+
diff --git a/index.php b/index.php index 1e1d455..133343e 100755 --- a/index.php +++ b/index.php @@ -51,9 +51,11 @@
-
+ beta
+font-size: 22px;">beta +
diff --git a/legal.php b/legal.php index e432fc7..ed89455 100755 --- a/legal.php +++ b/legal.php @@ -10,6 +10,19 @@ + diff --git a/login.php b/login.php index cd333c3..7a3c596 100755 --- a/login.php +++ b/login.php @@ -36,14 +36,14 @@ _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { - var u=(("https:" == document.location.protocol) ? "https" : "http") + "://localhost/analytics/"; + var u=(("https:" == document.location.protocol) ? "https" : "http") + "://homeworkhunt.com/analytics/"; _paq.push(['setTrackerUrl', u+'piwik.php']); _paq.push(['setSiteId', 1]); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); })(); +

diff --git a/press.php b/press.php index 2dc1722..e939d16 100644 --- a/press.php +++ b/press.php @@ -29,7 +29,7 @@ _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { - var u=(("https:" == document.location.protocol) ? "https" : "http") + "://localhost/analytics/"; + var u=(("https:" == document.location.protocol) ? "https" : "http") + "://homeworkhunt.com/analytics/"; _paq.push(['setTrackerUrl', u+'piwik.php']); _paq.push(['setSiteId', 1]); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; @@ -44,8 +44,8 @@ text-align: left!important; } img { - width: 100%; - -webkit-border-radius: 5px; + width: 100%; + -webkit-border-radius: 5px; } @@ -53,7 +53,7 @@
+

@@ -127,9 +127,7 @@
-
- -
+

Luke Jarboe

@@ -163,11 +161,13 @@

Homework Hunt ins't so much a service for cheating as it is for verifying correctness. If students tried to use Homework Hunt to cheat, they wouldn't be able to succeed when tests and exams came around.

+
- +

Often I do homework, have it checked by my teacher, and never know if my answers were actually correct. It's great to finally feel like I'm learning from my homework and that it's more than just busy work.

+
diff --git a/register.php b/register.php index 96d3a06..afa0bbe 100755 --- a/register.php +++ b/register.php @@ -37,14 +37,14 @@ _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { - var u=(("https:" == document.location.protocol) ? "https" : "http") + "://localhost/analytics/"; + var u=(("https:" == document.location.protocol) ? "https" : "http") + "://homeworkhunt.com/analytics/"; _paq.push(['setTrackerUrl', u+'piwik.php']); _paq.push(['setSiteId', 1]); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); })(); +

diff --git a/search.php b/search.php index 085f0c3..33a1960 100755 --- a/search.php +++ b/search.php @@ -21,14 +21,12 @@ - - - @@ -57,12 +55,13 @@

Filter:

+