$shorturl | $url | $date | $ip | $clicks | |
+$keyword | $display_url | $date | $ip | $clicks | |
ROW;
}
@@ -299,8 +301,8 @@ function yourls_edit_link($url, $keyword, $newkeyword='') {
// All clear, update
if ( !$new_url_already_there && $keyword_is_ok ) {
- $timestamp4screen = date( 'Y M d H:i', time()+( yourls_HOURS_OFFSET * 3600) );
- $timestamp4db = date('Y-m-d H:i:s', time()+( yourls_HOURS_OFFSET * 3600) );
+ $timestamp4screen = date( 'Y M d H:i', time()+( YOURLS_HOURS_OFFSET * 3600) );
+ $timestamp4db = date('Y-m-d H:i:s', time()+( YOURLS_HOURS_OFFSET * 3600) );
$update_url = $ydb->query("UPDATE `$table` SET `url` = '$url', `timestamp` = '$timestamp4db', `keyword` = '$newkeyword' WHERE `keyword` = '$keyword';");
if( $update_url ) {
$return['url'] = array( 'keyword' => $newkeyword, 'shorturl' => YOURLS_SITE.'/'.$newkeyword, 'url' => $strip_url, 'date' => $timestamp4screen);
@@ -582,6 +584,7 @@ function yourls_html_head( $context = 'index' ) {
+
num_queries > 1 ? $ydb->num_queries.' queries' : $ydb->num_queries.' query';
?>
+
'. $ydb->all_queries .'';
@@ -813,7 +817,7 @@ function yourls_redirect( $location, $code = 301 ) {
function yourls_redirect_javascript( $location ) {
echo <<
- //window.location="$location";
+ window.location="$location";
(if you are not redirected after 10 seconds, please click here)
REDIR;
@@ -1155,4 +1159,12 @@ function yourls_html_link( $href, $title = '' ) {
// Return word or words if more than one
function yourls_plural( $word, $count=1 ) {
return $word . ($count > 1 ? 's' : '');
+}
+
+// Return trimmed string
+function yourls_trim_long_string( $string, $length = 70, $append = '[...]' ) {
+ if ( strlen( $string ) > $length ) {
+ $string = substr( $string, 0, $length - strlen( $append ) ) . $append;
+ }
+ return $string;
}
\ No newline at end of file
diff --git a/js/infos.js b/js/infos.js
index 7d6506c..d229bd6 100644
--- a/js/infos.js
+++ b/js/infos.js
@@ -3,6 +3,7 @@ $(document).ready(function(){
$('#tabs ul#headers').css('display', 'block');
$('.tab h2').css('display','none');
+ // Toggle tabs
$('#tabs ul#headers li a').click(function(){
var target = $(this).attr('href').replace('#', '');
$('#tabs div.tab').css('display', 'none');
@@ -11,9 +12,15 @@ $(document).ready(function(){
$(this).addClass('selected').css('outline', 'none').blur();
return false;
});
+
+ // Activate tab
+ if (location.hash) {
+ $('#tabs ul#headers li a[href="'+location.hash+'"]').click();
+ } else {
+ $('#tabs ul#headers li a:first').click();
+ }
- $('#tabs ul#headers li a:first').click();
-
+ // Toggle detail lists
$('a.details').click(function(){
var target = $(this).attr('id').replace('more_', 'details_');
$('#'+target).toggle();
diff --git a/js/insert.js b/js/insert.js
index 3f6d815..75a57c8 100644
--- a/js/insert.js
+++ b/js/insert.js
@@ -41,8 +41,7 @@ function add() {
// Display the edition interface
function edit(id) {
- add_loading("#edit-button-" + id);
- add_loading("#delete-button-" + id);
+ add_loading('#actions-'+id+' .button');
var keyword = $('#keyword_'+id).val();
$.getJSON(
"index_ajax.php",
@@ -50,8 +49,7 @@ function edit(id) {
function(data){
$("#id-" + id).after( data.html );
$("#edit-url-"+ id).focus();
- end_loading("#edit-button-" + id);
- end_loading("#delete-button-" + id);
+ end_loading('#actions-'+id+' .button');
}
);
}
@@ -75,11 +73,15 @@ function remove(id) {
);
}
+// Redirect to stat page
+function stats(link) {
+ window.location=link;
+}
+
// Cancel edition of a link
function hide_edit(id) {
$("#edit-" + id).fadeOut(200, function(){
- end_disable("#edit-button-" + id);
- end_disable("#delete-button-" + id);
+ end_disable('#actions-'+id+' .button');
});
}
@@ -96,17 +98,15 @@ function edit_save(id) {
function(data){
if(data.status == 'success') {
$("#url-" + id).html('' + data.url.url + '');
- $("#keyword-" + id).html('' + data.url.shorturl + '');
+ $("#keyword-" + id).html('' + data.url.keyword + '');
$("#timestamp-" + id).html(data.url.date);
$("#edit-" + id).fadeOut(200, function(){
$('#tblUrl tbody').trigger("update");
});
}
feedback(data.message, data.status);
- end_disable("#edit-close-" + id);
- end_loading("#edit-close-" + id);
- end_disable("#edit-button-" + id);
- end_disable("#delete-button-" + id);
+ end_disable('#actions-'+id+' .button');
+ end_loading('#actions-'+id+' .button');
}
);
}
diff --git a/yourls-infos.php b/yourls-infos.php
index f2a82bd..5082e9c 100644
--- a/yourls-infos.php
+++ b/yourls-infos.php
@@ -25,7 +25,7 @@
$dates = array();
// Loop through all results and build list of referrers, countries and hits per day
-foreach( $hits as $hit ) {
+foreach( (array)$hits as $hit ) {
extract( (array)$hit );
if ( isset( $country_code ) && $country_code ) {
@@ -106,13 +106,12 @@
Your are logged in as: . Logout
-Informations
+
Short URL:
Long URL:
Number of hits since : hit 1 ? 's' : ''); ?>
-