Skip to content

Commit

Permalink
rebasing to chusopr/casimir
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Nov 29, 2014
1 parent 79605e8 commit 49a39c3
Show file tree
Hide file tree
Showing 11 changed files with 265 additions and 366 deletions.
7 changes: 1 addition & 6 deletions api.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?php
ob_start();
ob_implicit_flush(0);

require_once 'user/casimir-conf.php';
require_once 'inc/conf.php';
require_once 'inc/Casimir.php';
$casimir = new Casimir();
$casimir->handleRequest();
Expand Down Expand Up @@ -33,6 +30,4 @@
echo '</casimir>';
break;
}
$casimir->print_gzipped_page();

?>
14 changes: 7 additions & 7 deletions casimir.doap
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@

<description xml:lang="en">Cas.im/ir is a simple to install and use URL shortener, that let the user set the short URL he wants. It only needs PHP and MySQL to run.</description>

<wiki rdf:resource="http://wiki.github.com/nhoizey/casimir" />
<wiki rdf:resource="http://wiki.github.com/chusopr/casimir" />

<wiki
rdf:resource="http://wiki.github.com/nhoizey/casimir/wikis.atom"
rdf:resource="http://wiki.github.com/chusopr/casimir/wikis.atom"
dc:format="application/rdf+xml"
/>

<bug-database rdf:resource="http://github.com/nhoizey/casimir/issues" />
<bug-database rdf:resource="http://github.com/chusopr/casimir/issues" />

<license rdf:resource="http://github.com/nhoizey/casimir/blob/master/license.txt" />
<license rdf:resource="http://github.com/chusopr/casimir/blob/master/license.txt" />

<programming-language>PHP</programming-language>

<maintainer>
<foaf:Person>
<foaf:name>Nicolas Hoizey</foaf:name>
<foaf:homepage rdf:resource=http://www.gasteroprod.com/" />
<foaf:name>Chuso Pérez</foaf:name>
<foaf:homepage rdf:resource=http://chuso.net/" />
</foaf:Person>
</maintainer>
</Project>
</rdf:RDF>
</rdf:RDF>
Binary file modified img/casimir.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
479 changes: 200 additions & 279 deletions inc/Casimir.php

Large diffs are not rendered by default.

31 changes: 15 additions & 16 deletions inc/footer.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
<div id="footer">
<p style="float: right">
&copy; 2009 <a href="http://www.gasteroprod.com/">Nicolas HOIZEY</a>
</p>
<p>
<a href="<?php echo $casimir->base_url; ?>">Home</a> |
<a href="<?php echo $casimir->base_url; ?>tools.php">Tools</a> |
<a href="<?php echo $casimir->base_url; ?>stats.php#lastday">Stats</a> |
<a href="https://github.com/neofutur/gwgd">About gwgd shortener</a>
</p>
</div>
<?php
if (file_exists('user/footer.php')) {
require 'user/footer.php';
}
?>
<footer>
<nav>
<ul>
<li><a href="<?php echo $casimir->base_url; ?>"><?php echo _("Home"); ?></a></li>
<li><a href="<?php echo $casimir->base_url; ?>tools.php"><?php echo _('Tools'); ?></a></li>
<li><a href="<?php echo $casimir->base_url; ?>stats.php#lastday"><?php echo _('Stats'); ?></a></li>
<li class="poweredby"><a href="https://github.com/chusopr/casimir#readme"><?php printf(_("Powered by %s"), "Cas.im/ir"); ?></a></li>
</ul>
</nav>
<?php
if (file_exists('user/footer.php')) {
require 'user/footer.php';
}
?>
</footer>
</div>
</body>

Expand Down
9 changes: 2 additions & 7 deletions inc/header.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title><?php echo TITLE ; ?> </title>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />

<title><?php echo INSTANCE_NAME; ?></title>
<link rel="stylesheet" type="text/css" media="screen" href="screen.css" />
<?php
if (file_exists('user/screen.css')) {
Expand All @@ -16,7 +13,5 @@
</head>

<body onload="document.getElementById('long').focus();">
<?php include("user/perso.php"); ?>
<div id="main">
<h1><a href="<?php echo $casimir->base_url; ?>"> <?php echo NAME ; ?></a></h1>
<h2> <?php echo TITLE ; ?></h2>
<h1><a href="<?php echo $casimir->base_url; ?>"><?php echo INSTANCE_NAME; ?></a></h1>
11 changes: 4 additions & 7 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
<?php
ob_start();
ob_implicit_flush(0);

require_once 'user/casimir-conf.php';
require_once 'inc/conf.php';
require_once 'inc/Casimir.php';


$casimir = new Casimir();
$casimir->handleRequest();

if ((RECAPTCHA) && ((!ini_get("allow_url_fopen")) || (!function_exists("json_decode"))))
die(_("This site is not correctly configured: reCAPTCHA was enabled but the server does not met all requirements."));

require_once 'inc/header.php';

$casimir->showForm();

require_once 'inc/footer.php';

$casimir->print_gzipped_page();
?>
4 changes: 4 additions & 0 deletions screen.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ input[type=text] {
background-image: linear-gradient(to bottom, #F85E2A, #EF372E);
}

.error, .success {
padding-right: 128px;
}

.error {
color: red;
}
Expand Down
31 changes: 13 additions & 18 deletions stats.php
Original file line number Diff line number Diff line change
@@ -1,42 +1,39 @@
<?php
ob_start();
ob_implicit_flush(0);

require_once 'user/casimir-conf.php';
require_once 'inc/conf.php';
require_once 'inc/Casimir.php';

$casimir = new Casimir();

require_once 'inc/header.php';
?>
<h3>Most followed short URLs</h3>
<h3><?php echo _("Most followed short URLs"); ?></h3>
<ul class="tablinks">
<li><a href="#lastday">Last day</a></li>
<li><a href="#lastweek">Last week</a></li>
<li><a href="#lastmonth">Last month</a></li>
<li><a href="#ever">Ever</a></li>
<li><a href="#lastday"><?php echo _("Last day"); ?></a></li>
<li><a href="#lastweek"><?php echo _("Last week"); ?></a></li>
<li><a href="#lastmonth"><?php echo _("Last month"); ?></a></li>
<li><a href="#ever"><?php echo _("Ever"); ?></a></li>
</ul>
<div class="tabs">
<div id="lastday">
<h4>Last day</h4>
<h4><?php echo _("Last day"); ?></h4>
<?php
echo $casimir->getMostUsedLastDays(1, 5 * HISTSIZEX );
echo $casimir->getMostUsedLastDays(1, 5);
?>
</div>
<div id="lastweek">
<h4>Last week</h4>
<h4><?php echo _("Last week"); ?></h4>
<?php
echo $casimir->getMostUsedLastDays(7, 5 * HISTSIZEX);
echo $casimir->getMostUsedLastDays(7, 5);
?>
</div>
<div id="lastmonth">
<h4>Last month</h4>
<h4><?php echo _("Last month"); ?></h4>
<?php
echo $casimir->getMostUsedLastDays(30, 5 * HISTSIZEX);
echo $casimir->getMostUsedLastDays(30, 5);
?>
</div>
<div id="ever">
<h4>Ever</h4>
<h4><?php echo _("Ever"); ?></h4>
<?php
echo $casimir->getMostUsedSinceDate();
?>
Expand All @@ -45,6 +42,4 @@

<?php
require_once 'inc/footer.php';
$casimir->print_gzipped_page();

?>
12 changes: 4 additions & 8 deletions tools.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
<?php
ob_start();
ob_implicit_flush(0);
require_once 'user/casimir-conf.php';
require_once 'inc/conf.php';
require_once 'inc/Casimir.php';

$casimir = new Casimir();

require_once 'inc/header.php';
?>
<h3>Tools</h3>
<h4>Bookmarklet</h4>
<div id="bookmarklet">Drag this bookmarklet into your toolbar: <?php $casimir->showBookmarklet(); ?></div>
<h3><?php echo _("Tools"); ?></h3>
<h4><?php echo _("Bookmarklet"); ?></h4>
<div id="bookmarklet"><?php printf(_("Drag this bookmarklet into your toolbar: %s"), $casimir->showBookmarklet()); ?></div>
<?php
require_once 'inc/footer.php';
$casimir->print_gzipped_page();

?>
33 changes: 15 additions & 18 deletions user/casimir-conf.php.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php
// Instance name
define('INSTANCE_NAME', 'Cas.im/ir');

// MySQL connection
define('MYSQL_HOST', 'localhost');
define('MYSQL_USER', 'root');
Expand All @@ -11,24 +14,18 @@ define('USE_REWRITE', false);
// restrict access?
define('ACCESS_KEY', '');

// verify if the URL exists?
define('GETHEAD', 'yes');

// Get the linked page title?
define('GETTITLE', 'yes');

// Default API format ('text' or 'xml')
define('DEFAULT_API_FORMAT', 'text');
// bigger stats size
define('HISTSIZEX', '3' );
// Site title
define('TITLE', 'gw.gd - Yet Another URL Shortener' );
// site name
define('NAME', 'gw.gd' );

/regexp antispam
define('SPAMREGEXP', '/[a-zA-Z]{1,30}[0-9]{4,6}$/');
//blacklist antispam
define('BLACKLISTWORDS', serialize(array('porn','hack','crack','cheat','diet','seo','pills','casino','forsale','promotion','sexy','victoriamilan','internalservererror','funactivities','bodycomposition','verycute','m88','purchase','forex','surgery','weight-loss','weightloss','fitness','gamble','lottery','linkschwartz','buya','homesecurity','bigmuscles','dondecomprar','diabete','forfree','calvinklein','hotels','carinsurance','attorney','coupon','testosterone','luxury','rental','cheap','discount','promo','timberland','nike','cosmetic','ushud','followers' )));

?>
// Use reCAPTCHA service to block spam bots
// Please note that this will disable Casimir API
// Also note that allow_url_fopen and json_encode are required
define('RECAPTCHA', false);
// Use SSL to validate reCAPTCHA response. It's the preferred method
// since it's more secure to transmit your private key, but may require
// additional PHP dependencies
define('RECAPTCHA_HTTPS', true);
// Your reCaptcha public key as provided by recaptcha.net
define('RECAPTCHA_KEY', 'your-public-key');
// Your reCaptcha secret key as provided by recaptcha.net
define('RECAPTCHA_SECRET', 'your-private-key');

0 comments on commit 49a39c3

Please sign in to comment.