Browse Source

Add some stuff, remove active config.json from tracked files, update config

develop
Sven Slootweg 9 years ago
parent
commit
3dc8c8b08a
  1. 1
      .gitignore
  2. 14
      config.json.example
  3. 28
      public_html/authenticators/project.php
  4. 13
      public_html/debug.createuser.php
  5. 16
      public_html/modules/error/project.php
  6. 16
      public_html/modules/home/index.php
  7. 25
      public_html/modules/project/index.php
  8. 63
      public_html/rewrite.php
  9. 13
      public_html/templates/home/layout.tpl
  10. 51
      public_html/templates/project/index.tpl
  11. 19
      public_html/templates/project/layout.tpl

1
.gitignore

@ -0,0 +1 @@
config.json

14
config.json → config.json.example

@ -20,11 +20,15 @@
"port": 11211
},
"class_map": {
"user": "User",
"interestgroup": "InterestGroup",
"project": "Project",
"repository": "Repository",
"ticket": "Ticket"
"user": "User",
"interestgroup": "InterestGroup",
"project": "Project",
"repository": "Repository",
"ticket": "Ticket",
"tickettag": "TicketTag",
"ticketmessage": "TicketMessage",
"ticketattachment": "TicketAttachment",
"logentry": "LogEntry"
},
"components": [
"router",

28
public_html/authenticators/project.php

@ -0,0 +1,28 @@
<?php
/*
* Cryto Team is more free software. It is licensed under the WTFPL, which
* allows you to do pretty much anything with it, without having to
* ask permission. Commercial use is allowed, and no attribution is
* required. We do politely request that you share your modifications
* to benefit other developers, but you are under no enforced
* obligation to do so :)
*
* Please read the accompanying LICENSE document for the full WTFPL
* licensing text.
*/
if(!isset($_APP)) { die("Unauthorized."); }
$uSlug = $router->uParameters[1];
try
{
$sProject = Project::CreateFromQuery("SELECT * FROM projects WHERE `Slug` = :Slug", array(":Slug" => $uSlug));
NewTemplater::SetGlobalVariable("project-name", $sProject->sName);
NewTemplater::SetGlobalVariable("project-url", "/project/{$sProject->sSlug}");
$sRouterAuthenticated = true;
}
catch (NotFoundException $e)
{
$sRouterAuthenticated = false;
}

13
public_html/debug.createuser.php

@ -0,0 +1,13 @@
<?php
require("include/base.php");
$sUser = new User(0);
$sUser->uUsername = "test";
$sUser->uPassword = "test";
$suser->uDisplayName = "Test user"; /* This does not work?! */
$sUser->uEmailAddress = "test@test.com";
$sUser->uIsActivated = true;
$sUser->uIsAdmin = true;
$sUser->GenerateSalt();
$sUser->GenerateHash();
$sUser->InsertIntoDatabase();

16
public_html/modules/error/project.php

@ -0,0 +1,16 @@
<?php
/*
* Cryto Team is more free software. It is licensed under the WTFPL, which
* allows you to do pretty much anything with it, without having to
* ask permission. Commercial use is allowed, and no attribution is
* required. We do politely request that you share your modifications
* to benefit other developers, but you are under no enforced
* obligation to do so :)
*
* Please read the accompanying LICENSE document for the full WTFPL
* licensing text.
*/
if(!isset($_APP)) { die("Unauthorized."); }
$sPageContents = "That project does not exist.";

16
public_html/modules/home/index.php

@ -0,0 +1,16 @@
<?php
/*
* Cryto Team is more free software. It is licensed under the WTFPL, which
* allows you to do pretty much anything with it, without having to
* ask permission. Commercial use is allowed, and no attribution is
* required. We do politely request that you share your modifications
* to benefit other developers, but you are under no enforced
* obligation to do so :)
*
* Please read the accompanying LICENSE document for the full WTFPL
* licensing text.
*/
if(!isset($_APP)) { die("Unauthorized."); }
$sPageContents = "hi";

25
public_html/modules/project/index.php

@ -0,0 +1,25 @@
<?php
/*
* Cryto Team is more free software. It is licensed under the WTFPL, which
* allows you to do pretty much anything with it, without having to
* ask permission. Commercial use is allowed, and no attribution is
* required. We do politely request that you share your modifications
* to benefit other developers, but you are under no enforced
* obligation to do so :)
*
* Please read the accompanying LICENSE document for the full WTFPL
* licensing text.
*/
if(!isset($_APP)) { die("Unauthorized."); }
$sPageContents = Templater::AdvancedParse("project/index", $locale->strings, array(
"long-description" => $sProject->sLongDescription,
"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
));

63
public_html/rewrite.php

@ -0,0 +1,63 @@
<?php
/*
* Cryto Team is more free software. It is licensed under the WTFPL, which
* allows you to do pretty much anything with it, without having to
* ask permission. Commercial use is allowed, and no attribution is
* required. We do politely request that you share your modifications
* to benefit other developers, but you are under no enforced
* obligation to do so :)
*
* Please read the accompanying LICENSE document for the full WTFPL
* licensing text.
*/
require("include/base.php");
$sPageTitle = "";
$sPageContents = "";
$router = new CPHPRouter();
$router->allow_slash = true;
$router->ignore_query = true;
$router->routes = array(
0 => array(
"^/$" => "modules/home/index.php",
"^/project/([a-zA-Z0-9_-]+)$" => array("target" => "modules/project/index.php",
"authenticator" => "authenticators/project.php",
"auth_error" => "modules/error/project.php",
"_page_type" => "project"),
"^/project/([a-zA-Z0-9_-]+)/tickets$" => array("target" => "modules/project/tickets/index.php",
"authenticator" => "authenticators/project.php",
"auth_error" => "modules/error/project.php",
"_page_type" => "project"),
"^/project/([a-zA-Z0-9_-]+)/ticket/([0-9]+)$" => array("target" => "modules/project/tickets/view.php",
"authenticator" => "authenticators/project.php",
"auth_error" => "modules/error/project.php",
"_page_type" => "project"),
)
);
$router->RouteRequest();
if(empty($router->uVariables['page_type']))
{
$sContents = NewTemplater::Render("home/layout", $locale->strings, array(
"contents" => $sPageContents
));
}
elseif($router->uVariables['page_type'] == "project")
{
$sContents = NewTemplater::Render("project/layout", $locale->strings, array(
"contents" => $sPageContents
));
}
else
{
die();
}
echo(NewTemplater::Render("layout", $locale->strings, array(
"contents" => $sContents
)));

13
public_html/templates/home/layout.tpl

@ -0,0 +1,13 @@
<div class="header">
<h1>Team</h1>
<div class="clear"></div>
</div>
<ul class="menu">
<!-- <li class="active"><a href="#">Overview</a></li>
<li><a href="#">Account</a></li>
<li class="clear"></li> -->
</ul>
<div class="main">
{%?contents}
<div class="clear"></div>
</div>

51
public_html/templates/project/index.tpl

@ -0,0 +1,51 @@
<aside>
<section class="download">
<h3>Downloads</h3>
{%if isempty|stable-version == false}
<a href="download/stable" class="download">
<b class="stable"></b>
<strong>Latest stable</strong>
{%?stable-version}
</a>
{%/if}
{%if isempty|experimental-version == false}
<a href="download/experimental" class="download">
<b class="experimental"></b>
<strong>Latest testing</strong>
{%?experimental-version}
</a>
{%/if}
{%if no-downloads == true}
There are no downloads for this project yet.
{%/if}
</section>
<section class="statistics">
<h3>Statistics</h3>
<ul>
<li><strong>{%?line-count}</strong> lines of code</li>
<!-- <li><strong>0</strong> commits</li>
<li><strong>0</strong> contributors</li> -->
<li><strong>{%?ticket-count}</strong> open tickets</li>
</ul>
</section>
<section class="tickets">
<h3>Latest tickets</h3>
<ul>
{%if isempty|tickets == false}
{%foreach ticket in tickets}
<li><strong>{%?ticket[title]}</strong> {%?ticket[date]}</li>
{%/foreach}
{%if more-tickets == true}
<li class="more"><a href="tickets">more...</a></li>
{%/if}
{%else}
No tickets.
{%/if}
</ul>
</section>
</aside>
<section class="intro">
<h3>Introduction</h3>
{%?long-description}
</section>

19
public_html/templates/project/layout.tpl

@ -0,0 +1,19 @@
<div class="header">
<h1>Team</h1>
<h2>{%?project-name}</h2>
<div class="clear"></div>
</div>
<ul class="menu">
<li class="active"><a href="#">Overview</a></li>
<li><a href="#">Downloads</a></li>
<li><a href="#">Code</a></li>
<li><a href="#">Tickets</a></li>
<li><a href="#">Forum</a></li>
<li><a href="#">Contributors</a></li>
<li><a href="#">Invitations</a></li>
<li class="clear"></li>
</ul>
<div class="main">
{%?contents}
<div class="clear"></div>
</div>
Loading…
Cancel
Save