Compare commits
60 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5ac64c570 | ||
|
|
50308c2783 | ||
|
|
daaeebfcda | ||
|
|
48f480ae7d | ||
|
|
38e6ca4f98 | ||
|
|
7c4138e3a4 | ||
|
|
be5287c8b6 | ||
|
|
ddd23ad4e4 | ||
|
|
16d0500cc5 | ||
|
|
94bcee59ec | ||
|
|
14f293a2e1 | ||
|
|
06f475d075 | ||
|
|
bde1a92c19 | ||
|
|
7b5e477585 | ||
|
|
cc8cdcc9cd | ||
|
|
b3cc086649 | ||
|
|
bd499e0e1d | ||
|
|
c70df5b4d6 | ||
|
|
8c4da404f6 | ||
|
|
ab37632469 | ||
|
|
f31ec32821 | ||
|
|
d2a2966390 | ||
|
|
1e8eb9fe08 | ||
|
|
e3823abefb | ||
|
|
2423d8036f | ||
|
|
7dc37d4de7 | ||
|
|
2b9ab972ce | ||
|
|
9ec1bbe529 | ||
|
|
10af3dbe1c | ||
|
|
f0566b8b5e | ||
|
|
e898da7e6c | ||
|
|
c97d882872 | ||
|
|
8cbc21f60f | ||
|
|
2c2dcb740d | ||
|
|
78cb3ed559 | ||
|
|
da890206ab | ||
|
|
f770cfa03e | ||
|
|
ea01a72d2b | ||
|
|
7530b53c56 | ||
|
|
9f651f9059 | ||
|
|
8ca020a5b6 | ||
|
|
8f818e63b4 | ||
|
|
cf605a9ec5 | ||
|
|
2f98a2707c | ||
|
|
c05a17fbab | ||
|
|
679dcd0961 | ||
|
|
0293dff577 | ||
|
|
718420690b | ||
|
|
90fbc64d0a | ||
|
|
553a1a8743 | ||
|
|
1ee65b690d | ||
|
|
db1565dbe9 | ||
|
|
f1c7c4b8c2 | ||
|
|
9d59f95dcc | ||
|
|
250f92df69 | ||
|
|
b507bb48cb | ||
|
|
e34de4c290 | ||
|
|
2dbe0d987f | ||
|
|
a97007a8c9 | ||
|
|
337f158812 |
14
.gitignore
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Ignore everything
|
||||||
|
/*
|
||||||
|
/*/
|
||||||
|
|
||||||
|
# Except Infinity Squared
|
||||||
|
!public/
|
||||||
|
!index.php
|
||||||
|
!result.php
|
||||||
|
!header.php
|
||||||
|
!footer.php
|
||||||
|
!.gitignore
|
||||||
|
|
||||||
|
# Specifically ignore the config file
|
||||||
|
public/config.php
|
||||||
2
README.md
Normal file → Executable file
@@ -4,7 +4,7 @@ Infinity Squared
|
|||||||
================
|
================
|
||||||
A beautiful theme for YOURLS, carefully crafted by [Tom Slominski](http://tomslominski.net/).
|
A beautiful theme for YOURLS, carefully crafted by [Tom Slominski](http://tomslominski.net/).
|
||||||
|
|
||||||
See the project's [Wiki pages](https://github.com/tomslominski/infinity-squared) at GitHub for the latest installation and upgrade instructions.
|
See the project's [Wiki pages](https://github.com/tomslominski/infinity-squared/wiki) at GitHub for the latest installation and upgrade instructions.
|
||||||
|
|
||||||
qTip 2 is dual licensed under [MIT](http://en.wikipedia.org/wiki/MIT_License) or [GPLv2](http://en.wikipedia.org/wiki/GNU_General_Public_License) licenses.
|
qTip 2 is dual licensed under [MIT](http://en.wikipedia.org/wiki/MIT_License) or [GPLv2](http://en.wikipedia.org/wiki/GNU_General_Public_License) licenses.
|
||||||
|
|
||||||
|
|||||||
16
footer.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
</div>
|
||||||
|
<div class="paragraph">
|
||||||
|
<h2><?php yourls_e( 'The bookmarklet', 'isq_translation') ?></h2>
|
||||||
|
|
||||||
|
<?php $bookmarkletdialog = yourls__( 'Save this as a bookmark', 'isq_translation') // Can't put it where it belongs as there'd be too much char escaping ?>
|
||||||
|
<p><?php yourls_e( 'Add this to your bookmarks or drag it to your bookmarks bar to quickly access shortening functions:', 'isq_translation') ?> <a href="javascript:(function()%7Bvar%20d=document,w=window,enc=encodeURIComponent,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),s2=((s.toString()=='')?s:enc(s)),f='<?php echo YOURLS_SITE . '/index.php'; ?>',l=d.location,p='?url='+enc(l.href)+'&title='+enc(d.title)+'&keyword='+s2,u=f+p;try%7Bthrow('ozhismygod');%7Dcatch(z)%7Ba=function()%7Bif(!w.open(u))l.href=u;%7D;if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();%7Dvoid(0);%7D)();" onClick="alert('<?php echo $bookmarkletdialog ?>'); return false;" class="bookmarklet"><?php yourls_e( 'Shorten', 'isq_translation') ?></a></p>
|
||||||
|
<p><?php yourls_e( 'This bookmarklet takes the page URL and title and opens a new tab, where you can fill out a CAPTCHA. If you have selected text before using the bookmarklet, that will be used as the keyword.', 'isq_translation') ?></p>
|
||||||
|
<p><?php yourls_e( 'Support for bookmarklets on mobile varies. For example, they work on Chrome for Android but you have to add and sync them from your desktop.', 'isq_translation') ?></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="footer">
|
||||||
|
<p><?php yourls_e( 'Powered by <a href="http://yourls.org/">YOURLS</a>. Design by <a href="http://tomslominski.net/">Tom Slominski</a>. Also used: <a href="http://formalize.me/">Formalize</a> and <a href="http://qtip2.com/">qTip²</a>. Find this theme on <a href="https://github.com/tomslominski/infinity-squared">GitHub</a>.', 'isq_translation') ?></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
103
header.php
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<?php
|
||||||
|
// Start YOURLS engine
|
||||||
|
require_once( dirname(__FILE__).'/includes/load-yourls.php' );
|
||||||
|
|
||||||
|
// Ask for Infinity Squared settings
|
||||||
|
include( dirname(__FILE__).'/public/config.php' );
|
||||||
|
class ISQ { public static $general = array(), $links = array(), $social = array(), $recaptcha = array(); }
|
||||||
|
|
||||||
|
// Load translations
|
||||||
|
function isq_load_textdomain() {
|
||||||
|
yourls_load_custom_textdomain( 'isq_translation', $site . '/public/languages' );
|
||||||
|
$site = YOURLS_SITE;
|
||||||
|
}
|
||||||
|
isq_load_textdomain();
|
||||||
|
|
||||||
|
// Load reCAPTCHA
|
||||||
|
require_once( dirname(__FILE__).'/public/recaptchalib.php');
|
||||||
|
?>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title><?php echo ISQ::$general['name']; ?></title> <!-- Site title defined in theme settings -->
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
|
||||||
|
<link rel="shortcut icon" href="<?php echo YOURLS_SITE; ?>/images/favicon.gif" /> <!-- Default favicon -->
|
||||||
|
<link rel="stylesheet" href="<?php echo YOURLS_SITE; ?>/public/formalize.css" /> <!-- Formalize CSS -->
|
||||||
|
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.1.1/basic/jquery.qtip.min.css" /><!-- qTip CSS -->
|
||||||
|
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Ubuntu:regular,italic,bold,bolditalic"><!-- Ubuntu from Google Web Fonts -->
|
||||||
|
<link rel="stylesheet" href="<?php echo YOURLS_SITE; ?>/public/style.css" /><!-- Theme CSS -->
|
||||||
|
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <!-- jQuery -->
|
||||||
|
<script src="<?php echo YOURLS_SITE; ?>/public/js/jquery.formalize.min.js"></script><!-- Formalize JS -->
|
||||||
|
<script src="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.1.1/basic/jquery.qtip.min.js"></script><!-- qTip JS -->
|
||||||
|
<?php if (!empty(ISQ::$social['plus'])) { ?>
|
||||||
|
<script type="text/javascript" src="https://apis.google.com/js/plusone.js">
|
||||||
|
{lang: "en-GB"}
|
||||||
|
</script>
|
||||||
|
<?php } ?>
|
||||||
|
<script type="text/javascript"><!-- reCAPTCHA -->
|
||||||
|
var RecaptchaOptions = {
|
||||||
|
theme : 'white'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<?php if (!empty(ISQ::$general['clipboard'])) { ?>
|
||||||
|
<script type="text/javascript" src="js/jquery.zclip.min.js"></script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function(){
|
||||||
|
$('button#long-copy').zclip({
|
||||||
|
path:'js/ZeroClipboard.swf',
|
||||||
|
copy:function(){return $('input#long-copy').val();},
|
||||||
|
afterCopy: function() {
|
||||||
|
$("button#long-copy").html('<?php yourls_e( 'Copied!', 'isq_translation'); ?>');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('button#short-copy').zclip({
|
||||||
|
path:'js/ZeroClipboard.swf',
|
||||||
|
copy:function(){return $('input#short-copy').val();},
|
||||||
|
afterCopy: function() {
|
||||||
|
$("button#short-copy").html('<?php yourls_e( 'Copied!', 'isq_translation'); ?>');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('button#stats-copy').zclip({
|
||||||
|
path:'js/ZeroClipboard.swf',
|
||||||
|
copy:function(){return $('input#stats-copy').val();},
|
||||||
|
afterCopy: function() {
|
||||||
|
$("button#stats-copy").html('<?php yourls_e( 'Copied!', 'isq_translation'); ?>');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?php } ?>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function()
|
||||||
|
{
|
||||||
|
$('a.bookmarklet').qtip({
|
||||||
|
});
|
||||||
|
$('label').qtip({
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="container">
|
||||||
|
<header>
|
||||||
|
<h1><a href="<?php echo YOURLS_SITE; ?>"><?php echo ISQ::$general['name']; ?></a></h1>
|
||||||
|
<ul class="menu">
|
||||||
|
<li><a href="<?php echo YOURLS_SITE; ?>"><?php echo ISQ::$general['name']; ?></a></li>
|
||||||
|
<li><a href="<?php echo ISQ::$links['url_1']; ?>"><?php echo ISQ::$links['name_1']; ?></a></li>
|
||||||
|
<li><a href="<?php echo ISQ::$links['url_2']; ?>"><?php echo ISQ::$links['name_2']; ?></a></li>
|
||||||
|
<li><a href="<?php echo ISQ::$links['url_3']; ?>"><?php echo ISQ::$links['name_3']; ?></a></li>
|
||||||
|
<li><a href="<?php echo ISQ::$links['url_4']; ?>"><?php echo ISQ::$links['name_4']; ?></a></li>
|
||||||
|
<li><a href="<?php echo ISQ::$links['url_5']; ?>"><?php echo ISQ::$links['name_5']; ?></a></li>
|
||||||
|
<li><a href="<?php echo ISQ::$links['url_6']; ?>"><?php echo ISQ::$links['name_6']; ?></a></li>
|
||||||
|
<li><a href="<?php echo ISQ::$links['url_7']; ?>"><?php echo ISQ::$links['name_7']; ?></a></li>
|
||||||
|
<li><a href="<?php echo ISQ::$links['url_8']; ?>"><?php echo ISQ::$links['name_8']; ?></a></li>
|
||||||
|
<li><a href="<?php echo ISQ::$links['url_9']; ?>"><?php echo ISQ::$links['name_9']; ?></a></li>
|
||||||
|
<li><a href="<?php echo ISQ::$links['url_10']; ?>"><?php echo ISQ::$links['name_10']; ?></a></li>
|
||||||
|
</ul>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="paragraph">
|
||||||
216
index.php
Executable file → Normal file
@@ -1,196 +1,20 @@
|
|||||||
<!DOCTYPE html>
|
<?php include('header.php');
|
||||||
<?php
|
|
||||||
// Start YOURLS engine
|
$url = yourls_sanitize_url( $_REQUEST['url'] );
|
||||||
require_once( dirname(__FILE__).'/includes/load-yourls.php' );
|
$keyword = isset( $_REQUEST['keyword'] ) ? yourls_sanitize_keyword( $_REQUEST['keyword'] ): '' ;
|
||||||
|
$title = isset( $_REQUEST['title'] ) ? yourls_sanitize_title( $_REQUEST['title'] ) : '' ;
|
||||||
// Ask for Infinity Squared settings
|
|
||||||
require_once( dirname(__FILE__).'/public/config.php' );
|
?>
|
||||||
class ISQ { public static $general = array(), $links = array(), $social = array(); }
|
|
||||||
|
<h2><?php yourls_e( 'Enter a new URL to shorten', 'isq_translation'); ?></h2>
|
||||||
// Translations stuff
|
<h3><?php yourls_e( 'Hover over the labels to see more information', 'isq_translation'); ?></h3>
|
||||||
function isq_load_textdomain() {
|
<form method="post" action="result.php">
|
||||||
yourls_load_custom_textdomain( 'isq_translation', $site . '/public/languages' );
|
<p><label for="url" title="<?php yourls_e( 'Paste the long URL here', 'isq_translation'); ?>"><?php yourls_e( 'Long URL (required):', 'isq_translation'); ?></label> <input type="text" id="url" class="right" name="url" value="<?php echo($url); ?>" /></p>
|
||||||
$site = YOURLS_SITE;
|
<p><label for="keyword" title="<?php yourls_e( 'A keyword replaces the default short string', 'isq_translation'); ?>"><?php yourls_e( 'Custom keyword:', 'isq_translation'); ?></label> <input type="text" id="keyword" class="right" name="keyword" value="<?php echo($keyword); ?>" /></p>
|
||||||
}
|
<p><label for="title" title="<?php yourls_e( 'Optional title used when sharing a link from YOURLS using social sharers', 'isq_translation'); ?>"><?php yourls_e( 'Optional title:', 'isq_translation'); ?></label> <input type="text" id="title" class="right" name="title" value="<?php echo($title); ?>" /></p>
|
||||||
isq_load_textdomain();
|
<p><label for="antispam" title="<?php yourls_e( 'This is an antispam check. Sorry, we have to do this to prevent the database being overrun by bots!', 'isq_translation'); ?>"><?php yourls_e( 'reCAPTCHA', 'isq_translation'); ?></label> <span class="right"><?php echo recaptcha_get_html(ISQ::$recaptcha['public']); ?></span></p>
|
||||||
|
|
||||||
// Settings definitions
|
<p><input type="submit" value="<?php yourls_e( 'Shorten', 'isq_translation'); ?>" /></p>
|
||||||
$ISQtitle = ISQ::$general['name'];
|
</form>
|
||||||
$ISQname_1= ISQ::$links['name_1'];
|
|
||||||
$ISQurl_1= ISQ::$links['url_1'];
|
<?php include('footer.php'); ?>
|
||||||
$ISQname_2= ISQ::$links['name_2'];
|
|
||||||
$ISQurl_2= ISQ::$links['url_2'];
|
|
||||||
$ISQname_3= ISQ::$links['name_3'];
|
|
||||||
$ISQurl_3= ISQ::$links['url_3'];
|
|
||||||
$ISQname_4= ISQ::$links['name_4'];
|
|
||||||
$ISQurl_4= ISQ::$links['url_4'];
|
|
||||||
$ISQname_5= ISQ::$links['name_5'];
|
|
||||||
$ISQurl_5= ISQ::$links['url_5'];
|
|
||||||
$ISQname_6= ISQ::$links['name_6'];
|
|
||||||
$ISQurl_6= ISQ::$links['url_6'];
|
|
||||||
$ISQname_7= ISQ::$links['name_7'];
|
|
||||||
$ISQurl_7= ISQ::$links['url_7'];
|
|
||||||
$ISQname_8= ISQ::$links['name_8'];
|
|
||||||
$ISQurl_8= ISQ::$links['url_8'];
|
|
||||||
$ISQname_9= ISQ::$links['name_9'];
|
|
||||||
$ISQurl_9= ISQ::$links['url_9'];
|
|
||||||
$ISQname_10= ISQ::$links['name_10'];
|
|
||||||
$ISQurl_10= ISQ::$links['url_10'];
|
|
||||||
|
|
||||||
// Error definitions
|
|
||||||
|
|
||||||
$genericerror = '<h2 class="error">' . yourls__( 'An error has occured :(', 'isq_translation') . '</h2>';
|
|
||||||
|
|
||||||
if ( $message = $url. yourls__( 'added to database', 'isq_translation') ) {
|
|
||||||
$error = '<h2>' . yourls__( 'URL shortened successfully', 'isq_translation') . '</h2><p>' . yourls__( 'View the details of your short URL below.', 'isq_translation') . '</p>';
|
|
||||||
} elseif ( $message = $url. yourls__( 'already exists in database', 'isq_translation') ) {
|
|
||||||
$error = $genericerror . '<p class="error">' . yourls__( 'This URL already exists in this database. This website does not allow a single URL to have multiple short links.', 'isq_translation') . '</p>';
|
|
||||||
} elseif ( $message = yourls__( 'Short URL', 'isq_translation') . $url . yourls__( 'already exists in database or is reserved', 'isq_translation') ) {
|
|
||||||
$error = $genericerror . '<p class="error">' . yourls__( 'This short URL already exists in this database or is reserved. This website does not allow a single URL to have multiple short links. It could\'ve also been reserved by the admin.', 'isq_translation') . '</p>';
|
|
||||||
} elseif ( $message = yourls__( 'Missing URL input', 'isq_translation') ) {
|
|
||||||
$error = $genericerror . '<p class="error">' . yourls__( 'You did not enter the URL you want to shorten or the server lost it. Please try again.', 'isq_translation') . '</p>';
|
|
||||||
} elseif ( $message = yourls__( 'This URL is a short URL', 'isq_translation') ) {
|
|
||||||
$error = $genericerror . '<p class="error">' . yourls__( 'You cannot shorten a short URL!', 'isq_translation') . '</p>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php echo $ISQtitle; ?></title> <!-- Site title defined in theme settings -->
|
|
||||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
|
|
||||||
<link rel="stylesheet" href="<?php echo YOURLS_SITE; ?>/public/formalize.css" /> <!-- Formalize CSS -->
|
|
||||||
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.1.1/basic/jquery.qtip.min.css" /><!-- qTip CSS -->
|
|
||||||
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Ubuntu:regular,italic,bold,bolditalic"><!-- Ubuntu from Google Web Fonts -->
|
|
||||||
<link rel="stylesheet" href="<?php echo YOURLS_SITE; ?>/public/style.css" /><!-- Theme CSS -->
|
|
||||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <!-- jQuery -->
|
|
||||||
<script src="<?php echo YOURLS_SITE; ?>/public/js/jquery.formalize.min.js"></script><!-- Formalize JS -->
|
|
||||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.1.1/basic/jquery.qtip.min.js"></script><!-- qTip JS -->
|
|
||||||
<?php if (!empty(ISQ::$social['plus'])) { ?>
|
|
||||||
<script type="text/javascript" src="https://apis.google.com/js/plusone.js">
|
|
||||||
{lang: "en-GB"}
|
|
||||||
</script>
|
|
||||||
<?php } ?>
|
|
||||||
<script>
|
|
||||||
$(document).ready(function()
|
|
||||||
{
|
|
||||||
$('a.bookmarklet').qtip({
|
|
||||||
});
|
|
||||||
$('label').qtip({
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div id="container">
|
|
||||||
<header>
|
|
||||||
<h1><a href="<?php echo YOURLS_SITE; ?>"><?php echo $ISQtitle; ?></a></h1>
|
|
||||||
<ul class="menu">
|
|
||||||
<li><a href="<?php echo $ISQurl_1; ?>"><?php echo $ISQname_1; ?></a></li>
|
|
||||||
<li><a href="<?php echo $ISQurl_2; ?>"><?php echo $ISQname_2; ?></a></li>
|
|
||||||
<li><a href="<?php echo $ISQurl_3; ?>"><?php echo $ISQname_3; ?></a></li>
|
|
||||||
<li><a href="<?php echo $ISQurl_4; ?>"><?php echo $ISQname_4; ?></a></li>
|
|
||||||
<li><a href="<?php echo $ISQurl_5; ?>"><?php echo $ISQname_5; ?></a></li>
|
|
||||||
<li><a href="<?php echo $ISQurl_6; ?>"><?php echo $ISQname_6; ?></a></li>
|
|
||||||
<li><a href="<?php echo $ISQurl_7; ?>"><?php echo $ISQname_7; ?></a></li>
|
|
||||||
<li><a href="<?php echo $ISQurl_8; ?>"><?php echo $ISQname_8; ?></a></li>
|
|
||||||
<li><a href="<?php echo $ISQurl_9; ?>"><?php echo $ISQname_9; ?></a></li>
|
|
||||||
<li><a href="<?php echo $ISQurl_10; ?>"><?php echo $ISQname_10; ?></a></li>
|
|
||||||
</ul>
|
|
||||||
</header>
|
|
||||||
<div class="paragraph">
|
|
||||||
<?php
|
|
||||||
|
|
||||||
// Part to be executed if FORM has been submitted
|
|
||||||
if ( isset($_REQUEST['url']) ) {
|
|
||||||
|
|
||||||
$url = yourls_sanitize_url( $_REQUEST['url'] );
|
|
||||||
$keyword = isset( $_REQUEST['keyword'] ) ? yourls_sanitize_keyword( $_REQUEST['keyword'] ): '' ;
|
|
||||||
$title = isset( $_REQUEST['title'] ) ? yourls_sanitize_title( $_REQUEST['title'] ) : '' ;
|
|
||||||
$return = yourls_add_new_link( $url, $keyword, $title );
|
|
||||||
|
|
||||||
$shorturl = isset( $return['shorturl'] ) ? $return['shorturl'] : '';
|
|
||||||
$message = isset( $return['message'] ) ? $return['message'] : '';
|
|
||||||
$title = isset( $return['title'] ) ? $return['title'] : '';
|
|
||||||
|
|
||||||
if (!empty(ISQ::$social['facebook'])) { $ISQfacebook = '<a href="http://facebook.com/sharer.php?u=$shorturl" class="share-button" target="_blank"><img src="public/img/facebook.png" alt="Facebook" width="55px" height="62px" /></a>'; }
|
|
||||||
if (!empty(ISQ::$social['twitter'])) { $ISQtwitter = '<a href="http://twitter.com/share" class="twitter-share-button" data-url="$shorturl" data-text="$title" data-count="vertical">Tweet</a><script src="http://platform.twitter.com/widgets.js"></script>'; }
|
|
||||||
if (!empty(ISQ::$social['plus'])) { $ISQplus = '<div class="g-plus" data-action="share" data-annotation="vertical-bubble" data-height="62" data-href="$shorturl"></div>'; }
|
|
||||||
if (!empty(ISQ::$social['linkedin'])) { $ISQlinkedin = '<script src="http://platform.linkedin.com/in.js"></script><script type="IN/Share" data-url="$shorturl" data-counter="top"></script>'; }
|
|
||||||
if (!empty(ISQ::$general['qr'])) { $ISQqr = '<h2>' . yourls__( 'QR code', 'isq-translation' ) . '</h2><p>' . yourls__( 'Share your code with external devices', 'isq-translation' ) . '</p><img class="qr" src="https://chart.googleapis.com/chart?cht=qr&chs=250x250&chl=$shorturl&chld=L|0" alt="QR" width="250px" height="250px" />'; }
|
|
||||||
|
|
||||||
$output_original = yourls__( 'Original URL:', 'isq_translation');
|
|
||||||
$output_short = yourls__( 'Short URL:', 'isq_translation');
|
|
||||||
/* translators: This is short for statistics */
|
|
||||||
$output_stats = yourls__( 'Stats:', 'isq_translation');
|
|
||||||
$output_copy = yourls__( 'Click on a link and press Ctrl+C to quickly copy it', 'isq_translation');
|
|
||||||
$output_share_h2 = yourls__( 'Share', 'isq_translation');
|
|
||||||
$output_share_p = yourls__( 'Share your short URL', 'isq_translation');
|
|
||||||
|
|
||||||
echo <<<RESULT
|
|
||||||
$error
|
|
||||||
<div class="output">
|
|
||||||
<p><label>$output_original</label> <input type="text" name="shorturl" onclick="this.select();" onload="this.select();" value="$url"></p>
|
|
||||||
<p><label>$output_short</label> <input type="text" name="shorturl" onclick="this.select();" onload="this.select();" value="$shorturl"></p>
|
|
||||||
<p><label>$output_stats</label> <input type="text" name="shorturl" onclick="this.select();" onload="this.select();" value="$shorturl+"></p>
|
|
||||||
<p class="desktop-only">$output_copy</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
$ISQqr
|
|
||||||
|
|
||||||
<h2>$output_share_h2</h2>
|
|
||||||
<p>$output_share_p</p>
|
|
||||||
$ISQfacebook
|
|
||||||
$ISQtwitter
|
|
||||||
$ISQplus
|
|
||||||
$ISQlinkedin
|
|
||||||
RESULT;
|
|
||||||
|
|
||||||
// Part to be executed when no form has been submitted
|
|
||||||
} else {
|
|
||||||
|
|
||||||
$site = YOURLS_SITE;
|
|
||||||
|
|
||||||
$site_enter = yourls__( 'Enter a new URL to shorten', 'isq_translation');
|
|
||||||
$site_hover = yourls__( 'Hover over the labels to see more information', 'isq_translation');
|
|
||||||
$site_long = yourls__( 'Long URL (required):', 'isq_translation');
|
|
||||||
$site_long_hover = yourls__( 'Paste the long URL here', 'isq_translation');
|
|
||||||
$site_keyword = yourls__( 'Custom keyword:', 'isq_translation');
|
|
||||||
$site_keyword_hover = yourls__( 'A keyword replaces the default short string', 'isq_translation');
|
|
||||||
$site_title = yourls__( 'Optional title:', 'isq_translation');
|
|
||||||
$site_title_hover = yourls__( 'Optional title used when sharing a link from YOURLS', 'isq_translation');
|
|
||||||
$site_submit = yourls__( 'Shorten', 'isq_translation');
|
|
||||||
|
|
||||||
echo <<<HTML
|
|
||||||
<h2>$site_enter</h2>
|
|
||||||
<h3>$site_hover</h3>
|
|
||||||
<form method="post" action="">
|
|
||||||
<p><label for="url" title="$site_long_hover">$site_long</label> <input type="text" id="url" class="right" name="url" /></p>
|
|
||||||
<p><label for="keyword" title="$site_keyword_hover">$site_keyword</label> <input type="text" id="keyword" class="right" name="keyword" /></p>
|
|
||||||
<p><label for="title" title="$site_title_hover">$site_title</label> <input type="text" id="title" class="right" name="title" /></p>
|
|
||||||
<p><input type="submit" value="$site_submit" /></p>
|
|
||||||
</form>
|
|
||||||
HTML;
|
|
||||||
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="paragraph desktop-only">
|
|
||||||
<h2><?php yourls_e( 'The bookmarklets', 'isq_translation') ?></h2>
|
|
||||||
<p><?php yourls_e( 'To use the bookmarklets drag them to your bookmark bar or simply right click on them and select the appropriate option.', 'isq_translation') ?></p>
|
|
||||||
|
|
||||||
<a href="javascript:(function()%7Bvar%20d=document,w=window,enc=encodeURIComponent,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),s2=((s.toString()=='')?s:enc(s)),f='<?php echo $page; ?>',l=d.location,p='?url='+enc(l.href)+'&title='+enc(d.title)+'&text='+s2,u=f+p;try%7Bthrow('ozhismygod');%7Dcatch(z)%7Ba=function()%7Bif(!w.open(u))l.href=u;%7D;if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();%7Dvoid(0);%7D)()" title="<?php yourls_e( 'Shortens the URL of the current site and opens a new tab with the details of the shortened URL.', 'isq_translation') ?>" class="bookmarklet"><?php yourls_e( 'Simple Shorten', 'isq_translation') ?></a>
|
|
||||||
<a href="javascript:(function()%7Bvar%20d=document,s=d.createElement('script');window.yourls_callback=function(r)%7Bif(r.short_url)%7Bprompt(r.message,r.short_url);%7Delse%7Balert('An%20error%20occured:%20'+r.message);%7D%7D;s.src='<?php echo $page; ?>?url='+encodeURIComponent(d.location.href)+'&jsonp=yourls';void(d.body.appendChild(s));%7D)();" title="<?php yourls_e( 'Opens a pop up with the short URL for the current page.', 'isq_translation') ?>" class="bookmarklet"><?php yourls_e( 'Instant Shorten', 'isq_translation') ?></a>
|
|
||||||
<a href="javascript:(function()%7Bvar%20d=document,w=window,enc=encodeURIComponent,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),s2=((s.toString()=='')?s:enc(s)),f='<?php echo $page; ?>',l=d.location,k=prompt(%22Custom%20URL%22),k2=(k?'&keyword='+k:%22%22),p='?url='+enc(l.href)+'&title='+enc(d.title)+'&text='+s2+k2,u=f+p;if(k!=null)%7Btry%7Bthrow('ozhismygod');%7Dcatch(z)%7Ba=function()%7Bif(!w.open(u))l.href=u;%7D;if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();%7Dvoid(0)%7D%7D)()" title="<?php yourls_e( 'Opens a popup which asks for the keyword for the current URL and opens a new tab with the details of the shortened URL.', 'isq_translation') ?>" class="bookmarklet" ><?php yourls_e( 'Custom Shorten', 'isq_translation') ?></a>
|
|
||||||
<a href="javascript:(function()%7Bvar%20d=document,k=prompt('Custom%20URL'),s=d.createElement('script');if(k!=null){window.yourls_callback=function(r)%7Bif(r.short_url)%7Bprompt(r.message,r.short_url);%7Delse%7Balert('An%20error%20occured:%20'+r.message);%7D%7D;s.src='<?php echo $page; ?>?url='+encodeURIComponent(d.location.href)+'&keyword='+k+'&jsonp=yourls';void(d.body.appendChild(s));%7D%7D)();" title="<?php yourls_e( 'This prompts you for the keyword for the current page and then opens a pop up with the short URL of the current page.', 'isq_translation') ?>" class="bookmarklet"><?php yourls_e( 'Instant Custom Shorten', 'isq_translation') ?></a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="footer">
|
|
||||||
<p><?php yourls_e( 'Powered by <a href="http://yourls.org/">YOURLS</a>. Design by <a href="http://tomslominski.net/">Tom Slominski</a>. Also used: <a href="http://formalize.me/">Formalize</a> and <a href="http://qtip2.com/">qTip²</a>. Find this theme on <a href="https://github.com/tomslominski/infinity-squared">GitHub</a>.', 'isq_translation') ?></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|||||||
0
public/CHANGELOG.md
Executable file → Normal file
17
public/config.php → public/config-sample.php
Executable file → Normal file
@@ -1,10 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
// Copy and rename your file to config.php in this directory to edit your settings
|
||||||
|
|
||||||
// General settings
|
// General settings
|
||||||
// 1 to enable, 0 to disable
|
// 1 to enable, 0 to disable
|
||||||
ISQ::$general = array(
|
ISQ::$general = array(
|
||||||
'name' => 'kwl.me', // The name of your URL shortener
|
'name' => 'URL shortener', // The name of your URL shortener
|
||||||
'qr' => 1, // Do you want to display a QR code?
|
'qr' => 1, // Do you want to display a QR code?
|
||||||
'mobile' => 0 // Do you want to enable the mobile version?
|
'clipboard' => 1 // Do you want to enable zeroClipboard? (uses flash)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Menu- The width of ∞² menu allows you to have about 10 links
|
// Menu- The width of ∞² menu allows you to have about 10 links
|
||||||
@@ -38,6 +41,14 @@ ISQ::$social = array(
|
|||||||
'facebook' => 1,
|
'facebook' => 1,
|
||||||
'twitter' => 1,
|
'twitter' => 1,
|
||||||
'plus' => 1,
|
'plus' => 1,
|
||||||
'linkedin' => 1
|
'linkedin' => 1,
|
||||||
|
'tumblr' => 1
|
||||||
|
);
|
||||||
|
|
||||||
|
// reCAPTCHA API keys
|
||||||
|
// Get yourls from https://www.google.com/recaptcha/admin
|
||||||
|
ISQ::$recaptcha = array(
|
||||||
|
'public' => '',
|
||||||
|
'private' => ''
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
11
public/fonts/icons.svg
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<metadata>Generated by IcoMoon</metadata>
|
||||||
|
<defs>
|
||||||
|
<font id="icons" horiz-adv-x="512">
|
||||||
|
<font-face units-per-em="512" ascent="480" descent="-32" />
|
||||||
|
<missing-glyph horiz-adv-x="512" />
|
||||||
|
<glyph unicode=" " d="" horiz-adv-x="256" />
|
||||||
|
<glyph unicode="" d="M512 221.714q0-7.428-5.428-12.857l-73.143-73.143q-5.428-5.428-12.857-5.428t-12.857 5.428-5.428 12.857v36.572h-109.714v-109.714h36.572q7.428 0 12.857-5.428t5.428-12.857-5.428-12.857l-73.143-73.143q-5.428-5.429-12.857-5.429t-12.857 5.429l-73.143 73.143q-5.428 5.428-5.428 12.857t5.428 12.857 12.857 5.428h36.571v109.714h-109.715v-36.572q0-7.428-5.428-12.857t-12.857-5.428-12.857 5.428l-73.143 73.143q-5.428 5.428-5.428 12.857t5.428 12.857l73.143 73.143q5.428 5.428 12.857 5.428t12.857-5.428 5.428-12.857v-36.571h109.715v109.714h-36.572q-7.428 0-12.857 5.428t-5.429 12.857 5.428 12.857l73.143 73.143q5.429 5.428 12.857 5.428t12.857-5.428l73.143-73.143q5.428-5.429 5.428-12.857t-5.428-12.857-12.857-5.428h-36.572v-109.714h109.714v36.572q0 7.428 5.428 12.857t12.857 5.428 12.857-5.428l73.143-73.143q5.428-5.429 5.428-12.857z" />
|
||||||
|
</font></defs></svg>
|
||||||
|
After Width: | Height: | Size: 1.3 KiB |
BIN
public/fonts/icons.ttf
Normal file
BIN
public/fonts/icons.woff
Normal file
0
public/formalize.css
Executable file → Normal file
0
public/img/button.png
Executable file → Normal file
|
Before Width: | Height: | Size: 85 B After Width: | Height: | Size: 85 B |
0
public/img/facebook.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
0
public/img/noise.png
Executable file → Normal file
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
0
public/img/select_arrow.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 52 B After Width: | Height: | Size: 52 B |
BIN
public/img/tumblr.png
Normal file
|
After Width: | Height: | Size: 700 B |
0
public/js/jquery.formalize.min.js
vendored
Executable file → Normal file
276
public/recaptchalib.php
Normal file
@@ -0,0 +1,276 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* This is a PHP library that handles calling reCAPTCHA.
|
||||||
|
* - Documentation and latest version
|
||||||
|
* http://recaptcha.net/plugins/php/
|
||||||
|
* - Get a reCAPTCHA API Key
|
||||||
|
* https://www.google.com/recaptcha/admin/create
|
||||||
|
* - Discussion group
|
||||||
|
* http://groups.google.com/group/recaptcha
|
||||||
|
*
|
||||||
|
* Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net
|
||||||
|
* AUTHORS:
|
||||||
|
* Mike Crawford
|
||||||
|
* Ben Maurer
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The reCAPTCHA server URL's
|
||||||
|
*/
|
||||||
|
define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api");
|
||||||
|
define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api");
|
||||||
|
define("RECAPTCHA_VERIFY_SERVER", "www.google.com");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encodes the given data into a query string format
|
||||||
|
* @param $data - array of string elements to be encoded
|
||||||
|
* @return string - encoded request
|
||||||
|
*/
|
||||||
|
function _recaptcha_qsencode ($data) {
|
||||||
|
$req = "";
|
||||||
|
foreach ( $data as $key => $value )
|
||||||
|
$req .= $key . '=' . urlencode( stripslashes($value) ) . '&';
|
||||||
|
|
||||||
|
// Cut the last '&'
|
||||||
|
$req=substr($req,0,strlen($req)-1);
|
||||||
|
return $req;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submits an HTTP POST to a reCAPTCHA server
|
||||||
|
* @param string $host
|
||||||
|
* @param string $path
|
||||||
|
* @param array $data
|
||||||
|
* @param int port
|
||||||
|
* @return array response
|
||||||
|
*/
|
||||||
|
function _recaptcha_http_post($host, $path, $data, $port = 80) {
|
||||||
|
|
||||||
|
$req = _recaptcha_qsencode ($data);
|
||||||
|
|
||||||
|
$http_request = "POST $path HTTP/1.0\r\n";
|
||||||
|
$http_request .= "Host: $host\r\n";
|
||||||
|
$http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
|
||||||
|
$http_request .= "Content-Length: " . strlen($req) . "\r\n";
|
||||||
|
$http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
|
||||||
|
$http_request .= "\r\n";
|
||||||
|
$http_request .= $req;
|
||||||
|
|
||||||
|
$response = '';
|
||||||
|
if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) {
|
||||||
|
die ('Could not open socket');
|
||||||
|
}
|
||||||
|
|
||||||
|
fwrite($fs, $http_request);
|
||||||
|
|
||||||
|
while ( !feof($fs) )
|
||||||
|
$response .= fgets($fs, 1160); // One TCP-IP packet
|
||||||
|
fclose($fs);
|
||||||
|
$response = explode("\r\n\r\n", $response, 2);
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the challenge HTML (javascript and non-javascript version).
|
||||||
|
* This is called from the browser, and the resulting reCAPTCHA HTML widget
|
||||||
|
* is embedded within the HTML form it was called from.
|
||||||
|
* @param string $pubkey A public key for reCAPTCHA
|
||||||
|
* @param string $error The error given by reCAPTCHA (optional, default is null)
|
||||||
|
* @return string - The HTML to be embedded in the user's form.
|
||||||
|
*/
|
||||||
|
function recaptcha_get_html ($pubkey, $error = null)
|
||||||
|
{
|
||||||
|
if ($pubkey == null || $pubkey == '') {
|
||||||
|
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'
|
||||||
|
|| $_SERVER['SERVER_PORT'] == 443) { // http://stackoverflow.com/questions/1175096/how-to-find-out-if-you-are-using-https-without-serverhttps
|
||||||
|
$server = RECAPTCHA_API_SECURE_SERVER;
|
||||||
|
} else {
|
||||||
|
$server = RECAPTCHA_API_SERVER;
|
||||||
|
}
|
||||||
|
|
||||||
|
$errorpart = "";
|
||||||
|
if ($error) {
|
||||||
|
$errorpart = "&error=" . $error;
|
||||||
|
}
|
||||||
|
return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
|
||||||
|
|
||||||
|
<noscript>
|
||||||
|
<iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
|
||||||
|
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
|
||||||
|
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
|
||||||
|
</noscript>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A ReCaptchaResponse is returned from recaptcha_check_answer()
|
||||||
|
*/
|
||||||
|
class ReCaptchaResponse {
|
||||||
|
var $is_valid;
|
||||||
|
var $error;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls an HTTP POST function to verify if the user's guess was correct
|
||||||
|
* @param string $privkey
|
||||||
|
* @param string $remoteip
|
||||||
|
* @param string $challenge
|
||||||
|
* @param string $response
|
||||||
|
* @param array $extra_params an array of extra variables to post to the server
|
||||||
|
* @return ReCaptchaResponse
|
||||||
|
*/
|
||||||
|
function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array())
|
||||||
|
{
|
||||||
|
if ($privkey == null || $privkey == '') {
|
||||||
|
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($remoteip == null || $remoteip == '') {
|
||||||
|
die ("For security reasons, you must pass the remote ip to reCAPTCHA");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//discard spam submissions
|
||||||
|
if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
|
||||||
|
$recaptcha_response = new ReCaptchaResponse();
|
||||||
|
$recaptcha_response->is_valid = false;
|
||||||
|
$recaptcha_response->error = 'incorrect-captcha-sol';
|
||||||
|
return $recaptcha_response;
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
|
||||||
|
array (
|
||||||
|
'privatekey' => $privkey,
|
||||||
|
'remoteip' => $remoteip,
|
||||||
|
'challenge' => $challenge,
|
||||||
|
'response' => $response
|
||||||
|
) + $extra_params
|
||||||
|
);
|
||||||
|
|
||||||
|
$answers = explode ("\n", $response [1]);
|
||||||
|
$recaptcha_response = new ReCaptchaResponse();
|
||||||
|
|
||||||
|
if (trim ($answers [0]) == 'true') {
|
||||||
|
$recaptcha_response->is_valid = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$recaptcha_response->is_valid = false;
|
||||||
|
$recaptcha_response->error = $answers [1];
|
||||||
|
}
|
||||||
|
return $recaptcha_response;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gets a URL where the user can sign up for reCAPTCHA. If your application
|
||||||
|
* has a configuration page where you enter a key, you should provide a link
|
||||||
|
* using this function.
|
||||||
|
* @param string $domain The domain where the page is hosted
|
||||||
|
* @param string $appname The name of your application
|
||||||
|
*/
|
||||||
|
function recaptcha_get_signup_url ($domain = null, $appname = null) {
|
||||||
|
return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname));
|
||||||
|
}
|
||||||
|
|
||||||
|
function _recaptcha_aes_pad($val) {
|
||||||
|
$block_size = 16;
|
||||||
|
$numpad = $block_size - (strlen ($val) % $block_size);
|
||||||
|
return str_pad($val, strlen ($val) + $numpad, chr($numpad));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Mailhide related code */
|
||||||
|
|
||||||
|
function _recaptcha_aes_encrypt($val,$ky) {
|
||||||
|
if (! function_exists ("mcrypt_encrypt")) {
|
||||||
|
die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
|
||||||
|
}
|
||||||
|
$mode=MCRYPT_MODE_CBC;
|
||||||
|
$enc=MCRYPT_RIJNDAEL_128;
|
||||||
|
$val=_recaptcha_aes_pad($val);
|
||||||
|
return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function _recaptcha_mailhide_urlbase64 ($x) {
|
||||||
|
return strtr(base64_encode ($x), '+/', '-_');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* gets the reCAPTCHA Mailhide url for a given email, public key and private key */
|
||||||
|
function recaptcha_mailhide_url($pubkey, $privkey, $email) {
|
||||||
|
if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
|
||||||
|
die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
|
||||||
|
"you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$ky = pack('H*', $privkey);
|
||||||
|
$cryptmail = _recaptcha_aes_encrypt ($email, $ky);
|
||||||
|
|
||||||
|
return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gets the parts of the email to expose to the user.
|
||||||
|
* eg, given johndoe@example,com return ["john", "example.com"].
|
||||||
|
* the email is then displayed as john...@example.com
|
||||||
|
*/
|
||||||
|
function _recaptcha_mailhide_email_parts ($email) {
|
||||||
|
$arr = preg_split("/@/", $email );
|
||||||
|
|
||||||
|
if (strlen ($arr[0]) <= 4) {
|
||||||
|
$arr[0] = substr ($arr[0], 0, 1);
|
||||||
|
} else if (strlen ($arr[0]) <= 6) {
|
||||||
|
$arr[0] = substr ($arr[0], 0, 3);
|
||||||
|
} else {
|
||||||
|
$arr[0] = substr ($arr[0], 0, 4);
|
||||||
|
}
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets html to display an email address given a public an private key.
|
||||||
|
* to get a key, go to:
|
||||||
|
*
|
||||||
|
* http://www.google.com/recaptcha/mailhide/apikey
|
||||||
|
*/
|
||||||
|
function recaptcha_mailhide_html($pubkey, $privkey, $email) {
|
||||||
|
$emailparts = _recaptcha_mailhide_email_parts ($email);
|
||||||
|
$url = recaptcha_mailhide_url ($pubkey, $privkey, $email);
|
||||||
|
|
||||||
|
return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) .
|
||||||
|
"' onclick=\"window.open('" . htmlentities ($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ($emailparts [1]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
119
public/style.css
Executable file → Normal file
@@ -3,6 +3,21 @@ Infinity Squared CSS
|
|||||||
https://github.com/tomslominski/infinity-squared
|
https://github.com/tomslominski/infinity-squared
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Structure */
|
||||||
|
body {
|
||||||
|
background: #F1F1F1;
|
||||||
|
color: black;
|
||||||
|
font-family: 'Ubuntu', sans-serif, Helvetica, Arial;
|
||||||
|
font-size: 62.5%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#container {
|
||||||
|
width: 60%;
|
||||||
|
min-width: 720px;
|
||||||
|
margin: 0 auto;
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
/* General */
|
/* General */
|
||||||
::selection {
|
::selection {
|
||||||
background: rgba(1,63,109,0.7);
|
background: rgba(1,63,109,0.7);
|
||||||
@@ -29,23 +44,30 @@ a, a:visited, .footer a, .footer a:visited {
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
p, a {
|
||||||
font-size: 1.2em;
|
font-size: 1.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Structure */
|
@font-face {
|
||||||
body {
|
font-family: 'icons';
|
||||||
background: #F1F1F1;
|
src:url('fonts/icons.woff') format('woff'),
|
||||||
color: black;
|
url('fonts/icons.ttf') format('truetype'),
|
||||||
font-family: 'Ubuntu', sans-serif, Helvetica, Arial;
|
url('fonts/icons.svg#icons') format('svg');
|
||||||
font-size: 62.5%;
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
#container {
|
[class^="icon-"], [class*=" icon-"] {
|
||||||
width: 60%;
|
font-family: 'icons';
|
||||||
min-width: 720px;
|
speak: none;
|
||||||
margin: 0 auto;
|
font-style: normal;
|
||||||
background-color: white;
|
font-weight: normal;
|
||||||
|
font-variant: normal;
|
||||||
|
text-transform: none;
|
||||||
|
line-height: 1;
|
||||||
|
/* Better Font Rendering =========== */
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Header */
|
/* Header */
|
||||||
@@ -88,7 +110,6 @@ h1 a:hover {
|
|||||||
color: white;
|
color: white;
|
||||||
padding: 0 2% 0 2%;
|
padding: 0 2% 0 2%;
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
font-size: 1.2em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu a {
|
.menu a {
|
||||||
@@ -134,22 +155,18 @@ h2 {
|
|||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.bookmarklet {
|
.radio {
|
||||||
border-radius: 11px;
|
margin-right: 10%;
|
||||||
background: #ddd url(../img/button.png) repeat-x;
|
}
|
||||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fff), color-stop(1, #ddd));
|
|
||||||
background: -moz-linear-gradient(top center, #fff 0%, #ddd 100%);
|
input[type="radio"] {
|
||||||
border: 1px solid;
|
margin-right: 1%;
|
||||||
border-color: #ddd #bbb #999;
|
}
|
||||||
cursor: pointer;
|
|
||||||
color: #333;
|
.bookmarklet:before {
|
||||||
font: bold 12px/1.2 Arial, sans-serif;
|
font-family: 'icons';
|
||||||
outline: 0;
|
content: "\e600";
|
||||||
overflow: visible;
|
margin: 2px;
|
||||||
padding: 3px 10px 4px;
|
|
||||||
text-shadow: #fff 0 1px 1px;
|
|
||||||
text-decoration: none;
|
|
||||||
margin-right: 2%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tooltips */
|
/* Tooltips */
|
||||||
@@ -178,6 +195,31 @@ a.bookmarklet {
|
|||||||
|
|
||||||
.error {
|
.error {
|
||||||
color: red;
|
color: red;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.social-sharer {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.output label {
|
||||||
|
width: 20%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.output input {
|
||||||
|
width: 60%
|
||||||
|
}
|
||||||
|
|
||||||
|
.output button {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.output button.active {
|
||||||
|
color:#013F6D;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Footer */
|
/* Footer */
|
||||||
@@ -193,6 +235,10 @@ a.bookmarklet {
|
|||||||
font-size: 1.1em;
|
font-size: 1.1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.footer a {
|
||||||
|
font-size: 1.1em;
|
||||||
|
}
|
||||||
|
|
||||||
.footer a:hover {
|
.footer a:hover {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
border-bottom: dashed 1px #013F6D;
|
border-bottom: dashed 1px #013F6D;
|
||||||
@@ -221,7 +267,20 @@ header {
|
|||||||
margin-top:0;
|
margin-top:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.desktop-only {
|
.desktop-only, .zclip {
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Error page */
|
||||||
|
#wrap > h1 > a {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wrap > h2,
|
||||||
|
#wrap > p {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Importing custom user styles */
|
||||||
|
@import url("public/user-style.css");
|
||||||
|
|||||||
49
result.php
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
include('header.php');
|
||||||
|
|
||||||
|
$url = yourls_sanitize_url( $_REQUEST['url'] );
|
||||||
|
$keyword = isset( $_REQUEST['keyword'] ) ? yourls_sanitize_keyword( $_REQUEST['keyword'] ): '' ;
|
||||||
|
$title = isset( $_REQUEST['title'] ) ? yourls_sanitize_title( $_REQUEST['title'] ) : '' ;
|
||||||
|
$return = yourls_add_new_link( $url, $keyword, $title );
|
||||||
|
|
||||||
|
$shorturl = isset( $return['shorturl'] ) ? $return['shorturl'] : '';
|
||||||
|
$message = isset( $return['message'] ) ? $return['message'] : '';
|
||||||
|
$title = isset( $return['title'] ) ? $return['title'] : '';
|
||||||
|
|
||||||
|
$resp = recaptcha_check_answer (ISQ::$recaptcha['private'],
|
||||||
|
$_SERVER["REMOTE_ADDR"],
|
||||||
|
$_POST["recaptcha_challenge_field"],
|
||||||
|
$_POST["recaptcha_response_field"]);
|
||||||
|
|
||||||
|
if (!$resp->is_valid) {
|
||||||
|
// What happens when the CAPTCHA was entered incorrectly
|
||||||
|
die ( '<p class="error" title="' . $resp->error . '">' . yourls__( 'The reCAPTCHA wasn\'t entered correctly. Go back and try it again.', 'isq_translation' ) . '</p></div></div>' );
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- Error reporting -->
|
||||||
|
<?php echo $error; ?>
|
||||||
|
|
||||||
|
<!-- Default output -->
|
||||||
|
<h2><?php yourls_e( 'Results', 'isq_translation'); ?></h2>
|
||||||
|
<p><?php yourls_e( 'View your short URL', 'isq_translation'); ?></p>
|
||||||
|
<div class="output">
|
||||||
|
<p><label for="longurl"><? yourls_e( 'Original URL:', 'isq_translation'); ?></label> <input type="text" name="longurl" onclick="this.select();" onload="this.select();" value="<?php echo $url; ?>" id="long-copy"> <?php if (!empty(ISQ::$general['clipboard'])) { echo '<button id="long-copy" data-clipboard-target="long-copy" class="desktop-only">' . yourls__( 'Copy to Clipboard', 'isq-translation' ) . '</button>'; } ?> </p>
|
||||||
|
<p><label for="shorturl"><?php yourls_e( 'Short URL:', 'isq_translation'); ?></label> <input type="text" name="shorturl" onclick="this.select();" onload="this.select();" value="<?php echo $shorturl; ?>" id="short-copy"> <?php if (!empty(ISQ::$general['clipboard'])) { echo '<button id="short-copy" data-clipboard-target="short-copy" class="desktop-only">' . yourls__( 'Copy to Clipboard', 'isq-translation' ) . '</button>'; } ?> </p>
|
||||||
|
<p><label for="stats"><?php /* translators: This is short for statistics */ yourls_e( 'Stats:', 'isq_translation'); ?></label> <input type="text" name="stats" onclick="this.select();" onload="this.select();" value="<?php echo $shorturl . '+'; ?>" id="stats-copy"> <?php if (!empty(ISQ::$general['clipboard'])) { echo '<button id="stats-copy" data-clipboard-target="stats-copy" class="desktop-only">' . yourls__( 'Copy to Clipboard', 'isq-translation' ) . '</button>'; } ?> </p>
|
||||||
|
<p class="desktop-only"><?php yourls_e( 'Click on a link and press Ctrl+C to quickly copy it.', 'isq_translation'); ?></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- QR code -->
|
||||||
|
<?php if (!empty(ISQ::$general['qr'])) { echo '<h2>' . yourls__( 'QR code', 'isq-translation' ) . '</h2><p>' . yourls__( 'Share your link with external devices', 'isq-translation' ) . '</p><img class="qr" src="https://chart.googleapis.com/chart?cht=qr&chs=250x250&chl=$shorturl&chld=L|0" alt="QR" width="250px" height="250px" />'; } ?>
|
||||||
|
|
||||||
|
<!-- Social sharers -->
|
||||||
|
<h2><?php yourls_e( 'Share', 'isq_translation'); ?></h2>
|
||||||
|
<p><?php yourls_e( 'Share your short URL', 'isq_translation'); ?></p>
|
||||||
|
<?php if (!empty(ISQ::$social['facebook'])) { echo '<div class="social-sharer"><a href="http://facebook.com/sharer.php?u=' . $shorturl . '" class="share-button" target="_blank"><img src="public/img/facebook.png" alt="Facebook" width="55px" height="62px" /></a></div>'; } ?>
|
||||||
|
<?php if (!empty(ISQ::$social['twitter'])) { echo '<div class="social-sharer"><a href="http://twitter.com/share" class="twitter-share-button" data-url="' . $shorturl . '" data-text="'. $title .'" data-count="vertical">Tweet</a><script src="http://platform.twitter.com/widgets.js"></script></div>'; } ?>
|
||||||
|
<?php if (!empty(ISQ::$social['plus'])) { echo '<div class="g-plus social-sharer" data-action="share" data-annotation="vertical-bubble" data-height="62" data-href="' . $shorturl . '"></div>'; } ?>
|
||||||
|
<?php if (!empty(ISQ::$social['linkedin'])) { echo '<div class="social-sharer"><script src="http://platform.linkedin.com/in.js"></script><script type="IN/Share" data-url="' . $shorturl . '" data-counter="top"></script></div>'; } ?>
|
||||||
|
<?php if (!empty(ISQ::$social['tumblr'])) { echo '<a href="http://www.tumblr.com/share/link?url='. urlencode($shorturl) .'&name='. urlencode($title) .'" title="Share on Tumblr"><img src="public/img/tumblr.png" alt="Share on Tumblr" width="55px" height="62px" /></a>'; } ?>
|
||||||
|
<?php include('footer.php'); ?>
|
||||||