2013-11-01 18:15:39 +00:00
< ? php
include ( 'header.php' );
2015-03-02 22:51:20 +00:00
$recaptcha_data = file_get_contents ( 'https://www.google.com/recaptcha/api/siteverify?secret=' . ISQ :: $recaptcha [ 'secret' ] . '&response=' . $_REQUEST [ 'g-recaptcha-response' ]);
$recaptcha_json = json_decode ( $recaptcha_data , TRUE );
// What happens when the CAPTCHA was completed incorrectly
if ( $recaptcha_json [ 'success' ] != 'true' ) {
echo '<p class="error">' . yourls__ ( 'Are you a bot? Google thinks so. Go back and try again.' , 'isq_translation' ) . '</p>' ;
include ( 'footer.php' );
die ();
}
2015-02-21 22:31:29 +03:00
$url = isset ( $_REQUEST [ 'url' ] ) ? yourls_sanitize_url ( $_REQUEST [ 'url' ] ) : '' ;
2015-02-21 21:36:45 +03:00
$keyword = isset ( $_REQUEST [ 'keyword' ] ) ? yourls_sanitize_keyword ( $_REQUEST [ 'keyword' ] ) : '' ;
2015-02-24 15:24:27 +00:00
$title = isset ( $_REQUEST [ 'title' ] ) ? yourls_sanitize_title ( $_REQUEST [ 'title' ] ) : '' ;
2015-03-01 20:25:20 +00:00
$return = yourls_add_new_link ( $url , $keyword , $title );
2015-02-21 21:36:45 +03:00
2015-02-24 15:24:27 +00:00
$shorturl = isset ( $return [ 'shorturl' ] ) ? $return [ 'shorturl' ] : '' ;
$message = isset ( $return [ 'message' ] ) ? $return [ 'message' ] : '' ;
$title = isset ( $return [ 'title' ] ) ? $return [ 'title' ] : '' ;
2015-02-24 16:01:40 +00:00
2015-02-24 22:41:58 +00:00
// QR code shenanigans
2015-03-01 21:41:26 +00:00
if ( ISQ :: $general [ 'qr' ] ) {
2015-02-24 22:41:58 +00:00
2015-03-01 21:41:26 +00:00
include ( 'public/phpqrcode/qrlib.php' );
$qrContainerId = 'url-qr-code' ;
$saveToFile = false ;
$imageWidth = 600 ; // in pixels
$qrCode = QRcode :: svg ( $url , $qrContainerId , $saveToFile , QR_ECLEVEL_L , $imageWidth );
};
2015-02-24 22:41:58 +00:00
2013-11-01 18:15:39 +00:00
?>
2013-11-01 19:19:35 +00:00
<!-- Error reporting -->
2015-02-21 22:11:46 +03:00
< ? php isset ( $error ) ? $error : '' ; ?>
2013-11-01 19:19:35 +00:00
<!-- Default output -->
2013-12-31 00:56:00 +00:00
< h2 >< ? php yourls_e ( 'Results' , 'isq_translation' ); ?> </h2>
< p >< ? php yourls_e ( 'View your short URL' , 'isq_translation' ); ?> </p>
2013-11-01 19:19:35 +00:00
< div class = " output " >
2015-01-31 00:01:01 +00:00
< p >< label for = " longurl " >< ? php 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>
2013-11-13 16:46:27 +00:00
< 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>
2013-11-01 19:19:35 +00:00
< 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 -->
2015-03-01 21:41:26 +00:00
< ? php if ( ISQ :: $general [ 'qr' ] ) { echo '<h2>' . yourls__ ( 'QR code' , 'isq-translation' ) . '</h2><p>' . yourls__ ( 'Share your link with external devices' , 'isq-translation' ) . '</p>' . $qrCode ; } ?>
2013-11-01 19:19:35 +00:00
<!-- Social sharers -->
< h2 >< ? php yourls_e ( 'Share' , 'isq_translation' ); ?> </h2>
< p >< ? php yourls_e ( 'Share your short URL' , 'isq_translation' ); ?> </p>
2015-03-01 21:50:58 +00:00
< ? php if ( 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 ( 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 ( 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 ( 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 ( 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>' ; } ?>
2015-02-24 22:41:58 +00:00
< ? php include ( 'footer.php' ); ?>