diff --git a/public_html/classes/logentry.php b/public_html/classes/logentry.php new file mode 100644 index 0000000..8b894ac --- /dev/null +++ b/public_html/classes/logentry.php @@ -0,0 +1,39 @@ + array( + 'Description' => "Description" + ), + 'numeric' => array( + 'ProjectId' => "ProjectId", + 'Component' => "Component", + 'Operation' => "Operation", + 'UserId' => "UserId" + ), + 'project' => array( + 'Project' => "ProjectId" + ), + 'user' => array( + 'User' => "UserId" + ) + ); +} diff --git a/public_html/classes/project.php b/public_html/classes/project.php new file mode 100644 index 0000000..edabb71 --- /dev/null +++ b/public_html/classes/project.php @@ -0,0 +1,60 @@ + array( + 'Name' => "Name", + 'ShortDescription' => "ShortDescription", + 'LongDescription' => "LongDescription" + ), + 'numeric' => array( + 'CreatorId' => "UserId", + 'LineCount' => "LineCount", + 'RepositorySize' => "RepositorySize", + 'ContributorCount' => "ContributorCount" + ), + 'timestamp' => array( + 'CreationDate' => "CreationDate", + 'LastActivity' => "LastActivity" + ), + 'boolean' => array( + 'IsActive' => "Active", + 'IsPublic' => "IsPublic" + ), + 'user' => array( + 'Creator' => "CreatorId" + ) + ); + + public function MarkActivity($user, $component, $operation, $description = "") + { + $sLogEntry = new LogEntry(0); + $sLogEntry->uComponent = $component; + $sLogEntry->uOperation = $operation; + $sLogEntry->uUserId = $user; + $sLogEntry->uProjectId = $this->sId; + $sLogEntry->uDescription = $description; + $sLogEntry->InsertIntoDatabase(); + + $this->uLastActivity = time(); + $this->InsertIntoDatabase(); + } +} diff --git a/public_html/classes/ticket.php b/public_html/classes/ticket.php new file mode 100644 index 0000000..e6c4de4 --- /dev/null +++ b/public_html/classes/ticket.php @@ -0,0 +1,41 @@ + array( + 'Subject' => "Subject" + ), + 'numeric' => array( + 'Status' => "Status", + 'CreatorId' => "UserId", + 'OwnerId' => "OwnerId", + 'Priority' => "Priority", + 'ProjectId' => "ProjectId" + ), + 'user' => array( + 'Creator' => "UserId", + 'Owner' => "OwnerId" + ), + 'project' => array( + 'Project' => "ProjectId" + ) + ); +} diff --git a/public_html/classes/ticketattachment.php b/public_html/classes/ticketattachment.php new file mode 100644 index 0000000..8d1d75a --- /dev/null +++ b/public_html/classes/ticketattachment.php @@ -0,0 +1,42 @@ + array( + 'Reference' => "Reference" + ), + 'numeric' => array( + 'Type' => "Type", + 'TicketId' => "TicketId", + 'MessageId' => "MessageId", + 'ProjectId' => "ProjectId" + ), + 'ticket' => array( + 'Ticket' => "Ticket" + ), + 'ticketmessage' => array( + 'Message' => "MessageId" + ), + 'project' => array( + 'Project' => "ProjectId" + ) + ); +} diff --git a/public_html/classes/ticketmessage.php b/public_html/classes/ticketmessage.php new file mode 100644 index 0000000..e6fd0a1 --- /dev/null +++ b/public_html/classes/ticketmessage.php @@ -0,0 +1,47 @@ + array( + 'Body' => "Body" + ), + 'boolean' => array( + 'IsFirstMessage' => "FirstMessage" + ), + 'numeric' => array( + 'AuthorId' => "UserId", + 'TicketId' => "TicketId", + 'ProjectId' => "ProjectId" + ), + 'timestamp' => array( + 'Date' => "Date" + ), + 'user' => array( + 'Author' => "UserId" + ), + 'ticket' => array( + 'Ticket' => "Ticket" + ), + 'project' => array( + 'Project' => "ProjectId" + ) + ); +} diff --git a/public_html/classes/tickettag.php b/public_html/classes/tickettag.php new file mode 100644 index 0000000..b786d64 --- /dev/null +++ b/public_html/classes/tickettag.php @@ -0,0 +1,37 @@ + array( + 'TagName' => "TagName" + ), + 'numeric' => array( + 'TicketId' => "TicketId", + 'ProjectId' => "ProjectId" + ), + 'ticket' => array( + 'Ticket' => "TicketId" + ), + 'project' => array( + 'Project' => "ProjectId" + ) + ); +} diff --git a/public_html/classes/user.php b/public_html/classes/user.php new file mode 100644 index 0000000..b37cc98 --- /dev/null +++ b/public_html/classes/user.php @@ -0,0 +1,155 @@ + array( + 'Username' => "Username", + 'DisplayName' => "DisplayName", + 'EmailAddress' => "EmailAddress", + 'Hash' => "Hash", + 'Salt' => "Salt", + 'ActivationKey' => "ActivationKey" + ), + 'boolean' => array( + 'IsAdmin' => "Admin", + 'IsActivated' => "Activated" + ) + ); + + public function GenerateSalt() + { + $this->uSalt = random_string(10); + } + + public function GenerateHash() + { + if(!empty($this->uSalt)) + { + if(!empty($this->uPassword)) + { + $this->uHash = $this->CreateHash($this->uPassword); + } + else + { + throw new Exception("User object is missing a password."); + } + } + else + { + throw new Exception("User object is missing a salt."); + } + } + + public function CreateHash($input) + { + global $cphp_config; + $hash = crypt($input, "$5\$rounds=50000\${$this->uSalt}{$cphp_config->salt}$"); + $parts = explode("$", $hash); + return $parts[4]; + } + + public function VerifyPassword($password) + { + if($this->CreateHash($password) == $this->sHash) + { + return true; + } + else + { + return false; + } + } + + public function Authenticate() + { + $_SESSION['user_id'] = $this->sId; + $_SESSION['logout_key'] = random_string(32); + $_SESSION['is_admin'] = $this->sIsAdmin; + + NewTemplater::SetGlobalVariable("logged-in", true); + + $this->SetGlobalVariables(); + } + + public function SetGlobalVariables() + { + NewTemplater::SetGlobalVariable("my-displayname", $this->sDisplayName); + } + + public static function CheckIfEmailValid($email) + { + return preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}$/i", $email); + } + + public static function CheckIfEmailExists($email) + { + try + { + $result = User::FindByEmail($email); + return true; + } + catch (NotFoundException $e) + { + return false; + } + } + + public static function CheckIfUsernameExists($username) + { + try + { + $result = User::FindByUsername($username); + return true; + } + catch (NotFoundException $e) + { + return false; + } + } + + public static function CheckIfDisplayNameExists($displayname) + { + try + { + $result = User::FindByDisplayName($displayname); + return true; + } + catch (NotFoundException $e) + { + return false; + } + } + + public static function FindByEmail($email) + { + return self::CreateFromQuery("SELECT * FROM users WHERE `EmailAddress` = :EmailAddress", array(':EmailAddress' => $email), 0); + } + + public static function FindByUsername($username) + { + return self::CreateFromQuery("SELECT * FROM users WHERE `Username` = :Username", array(':Username' => $username), 0); + } + + public static function FindByDisplayName($displayname) + { + return self::CreateFromQuery("SELECT * FROM users WHERE `DisplayName` = :DisplayName", array(':DisplayName' => $displayname), 0); + } +} diff --git a/public_html/include/base.php b/public_html/include/base.php new file mode 100644 index 0000000..4d25c25 --- /dev/null +++ b/public_html/include/base.php @@ -0,0 +1,14 @@ + 1, + "PRIORITY_LOW" => 2, + "PRIORITY_MEDIUM" => 3, + "PRIORITY_HIGH" => 4, + "PRIORITY_CRITICAL" => 5, + + "OPEN" => 1, + "CLOSED" => 2, + "INVALID" => 3, + "NEEDS_REVIEW" => 4, + "IN_PROGRESS" => 5 + + "ATTACHMENT_FILE" => 1, + "ATTACHMENT_COMMIT" => 2, + "ATTACHMENT_TICKET" => 3, + + "MESSAGE_FIRST" => 1, + "MESSAGE_RESPONSE" => 2, + "MESSAGE_CHANGE" => 3, + + "TICKET" => 1, + "DOWNLOAD" => 2, + "WIKIPAGE" => 3, + "COMMIT" => 4, + "FORUMPOST" => 5, + "INVITATION" => 6, + "DESCRIPTION" => 7 + + "CREATE" => 1, + "DELETE" => 2, + "UPDATE" => 3, + "ATTACH" => 4, + "REPLY" => 5 +); + +foreach($constants as $key => $value) +{ + define($key, $value, true); +} diff --git a/public_html/index.php b/public_html/index.php index 5e83324..4f8f91f 100644 --- a/public_html/index.php +++ b/public_html/index.php @@ -1,5 +1,14 @@ +require("include/base.php"); + +echo(Templater::AdvancedParse("layout", $locale->strings, array( + "project-name" => "Demo project", + "long-description" => "A large, multi-paragraph description of the project would go here.", + "no-downloads" => false, + "stable-version" => "1.5.3", + "experimental-version" => "1.6.1", + "line-count" => "62,671", + "ticket-count" => 12, + "tickets" => array(), + "more-tickets" => false +))); diff --git a/public_html/static/fontawesome-webfont.eot b/public_html/static/fontawesome-webfont.eot new file mode 100755 index 0000000..89070c1 Binary files /dev/null and b/public_html/static/fontawesome-webfont.eot differ diff --git a/public_html/static/fontawesome-webfont.svg b/public_html/static/fontawesome-webfont.svg new file mode 100755 index 0000000..1245f92 --- /dev/null +++ b/public_html/static/fontawesome-webfont.svg @@ -0,0 +1,255 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public_html/static/fontawesome-webfont.ttf b/public_html/static/fontawesome-webfont.ttf new file mode 100755 index 0000000..c17e9f8 Binary files /dev/null and b/public_html/static/fontawesome-webfont.ttf differ diff --git a/public_html/static/fontawesome-webfont.woff b/public_html/static/fontawesome-webfont.woff new file mode 100755 index 0000000..09f2469 Binary files /dev/null and b/public_html/static/fontawesome-webfont.woff differ diff --git a/public_html/static/style.css b/public_html/static/style.css new file mode 100644 index 0000000..9d8f920 --- /dev/null +++ b/public_html/static/style.css @@ -0,0 +1,256 @@ +@font-face { + font-family: "FontAwesome"; + src: url('/static/fontawesome-webfont.eot'); + src: url('/static/fontawesome-webfont.eot?#iefix') format('eot'), url('/static/fontawesome-webfont.woff') format('woff'), url('/static/fontawesome-webfont.ttf') format('truetype'), url('/static/fontawesome-webfont.svg#FontAwesome') format('svg'); + font-weight: normal; + font-style: normal; +} + +body +{ + background-color: #F3F3F3; + font-family: "Nobile", sans-serif; +} + +.clear +{ + clear: both; +} + +.wrapper +{ + width: 960px; + margin: 0px auto; +} + +.header +{ + padding-top: 6px; + padding-bottom: 6px; + border-bottom: 3px solid black; +} + +.header h1 +{ + float: right; + font-weight: bold; + font-size: 56px; + margin: 0px; +} + +.header h2 +{ + float: left; + font-weight: normal; + font-size: 56px; + margin: 0px; +} + +/*.header h2:before +{ + font-weight: normal; + content: ";"; + margin: 0px 16px; +}*/ + +.menu +{ + margin: 0px; + padding: 0px; + background-color: #252525; +} + +.menu li +{ + list-style: none; + margin: 0px; +} + +.menu li:not(.clear) +{ + display: block; + float: left; +} + +.menu li a +{ + display: block; + float: left; + text-decoration: none; + background-color: #252525; + color: #CFCFCF; + font-size: 14px; + padding: 6px 10px; +} + +.menu li a:hover +{ + background-color: #191919; + color: white; +} + +.menu li.active a +{ + background-color: black; + color: white; +} + +.main +{ + +} + +.footer +{ + border-top: 3px solid black; + margin-top: 12px; + padding-top: 6px; + font-size: 12px; +} + +section +{ + padding: 12px 0px; +} + +section h3 +{ + margin-top: 6px; +} + +section p +{ + font-size: 14px; +} + +p.lead +{ + font-weight: bold; +} + +aside +{ + float: right; + margin-left: 24px; +} + +aside section +{ + font-size: 14px; + padding: 12px; + width: 240px; + background-color: #141414; + margin-bottom: 16px; + margin-top: 12px; +} + +aside section, aside section a +{ + color: white; +} + +aside section h3 +{ + margin-top: 1px; + margin-bottom: 4px; + font-size: 19px; +} + +section.statistics ul, section.tickets ul +{ + margin: 0px; + padding: 0px; + list-style: none; +} + +section.statistics +{ + /*color: #ECFFBF;*/ +} + +section.tickets, section.tickets a +{ + /*color: #FFFBD5;*/ + font-size: 12px; + text-decoration: none; +} + +section.tickets strong +{ + font-size: 14px; +} + +section.tickets ul li +{ + margin-top: -1px; + margin-bottom: 0px; + /*border-top: 1px solid #FFE8BF; + border-bottom: 1px solid #FFE8BF;*/ + border-top: 1px solid #FFFFFF; + border-bottom: 1px solid #FFFFFF; + padding: 6px 0px; +} + +section.tickets ul li.more +{ + text-align: right; + border: none; +} + +section.tickets ul li.more a +{ + padding: 3px 6px; +} + +section.tickets ul li.more a:hover +{ + background-color: black; +} + +section.download a.download +{ + margin-top: 10px; + display: block; + padding: 10px 13px; + text-decoration: none; + border-radius: 9px; + border: 1px solid white; + +} + +section.download a.download:hover +{ + color: white; + background-color: #0C0C0C; + border: 1px solid white; + +} + +section.download a.download strong +{ + display: block; + font-size: 18px; +} + +section.download a.download b:before +{ + display: block; + float: left; + font-size: 40px; + font-family: FontAwesome; + font-weight: normal; + margin-right: 10px; + margin-top: 2px; + width: 38px; + text-align: center; +} + +section.download a.download b.stable:before +{ + content: "\f019"; +} + +section.download a.download b.experimental:before +{ + content: "\f0c3"; +} diff --git a/public_html/templates/layout.tpl b/public_html/templates/layout.tpl new file mode 100644 index 0000000..1e1fb1b --- /dev/null +++ b/public_html/templates/layout.tpl @@ -0,0 +1,84 @@ + + + + Cryto Team + + + + +
+
+

Team

+

{%?project-name}

+
+
+ +
+ +
+

Introduction

+ {%?long-description} +
+
+
+ +
+ +