示例#1
0
/**
 * Pick the right DB class and return an instance
 *
 * @since 1.7
 * @param string $extension Optional: user defined choice
 * @return class $ydb DB class instance
 */
function yourls_set_DB_driver()
{
    // Auto-pick the driver. Priority: user defined, then PDO, then mysqli, then mysql
    if (defined('YOURLS_DB_DRIVER')) {
        $driver = strtolower(YOURLS_DB_DRIVER);
        // accept 'MySQL', 'mySQL', etc
    } elseif (extension_loaded('pdo_mysql')) {
        $driver = 'pdo';
    } elseif (extension_loaded('mysqli')) {
        $driver = 'mysqli';
    } elseif (extension_loaded('mysql')) {
        $driver = 'mysql';
    } else {
        $driver = '';
    }
    // Set the new driver
    if (in_array($driver, array('mysql', 'mysqli', 'pdo'))) {
        require_once YOURLS_INC . '/ezSQL/ez_sql_core.php';
        require_once YOURLS_INC . '/ezSQL/ez_sql_core_yourls.php';
        require_once YOURLS_INC . '/ezSQL/ez_sql_' . $driver . '.php';
        require_once YOURLS_INC . '/ezSQL/ez_sql_' . $driver . '_yourls.php';
    }
    $class = 'ezSQL_' . $driver . '_yourls';
    global $ydb;
    if (!class_exists($class, false)) {
        $ydb = new stdClass();
        yourls_die(yourls__('YOURLS requires the mysql, mysqli or pdo_mysql PHP extension. No extension found. Check your server config, or contact your host.'), yourls__('Fatal error'), 503);
    }
    yourls_do_action('set_DB_driver', $driver);
    $ydb = new $class(YOURLS_DB_USER, YOURLS_DB_PASS, YOURLS_DB_NAME, YOURLS_DB_HOST);
    yourls_debug_log("DB driver: {$driver}");
}
 public function getFunctions()
 {
     return array(new \Twig_SimpleFunction('yourls__', function ($text, $domain = '') {
         if (!$domain) {
             $domain = $this->_options['namespace'];
         }
         return yourls__($text, $domain);
     }));
 }
示例#3
0
/**
 * Check for valid user via login form or stored cookie. Returns true or an error message
 *
 */
function yourls_is_valid_user()
{
    // Allow plugins to short-circuit the whole function
    $pre = yourls_apply_filter('shunt_is_valid_user', null);
    if (null !== $pre) {
        return $pre;
    }
    // $unfiltered_valid : are credentials valid? Boolean value. It's "unfiltered" to allow plugins to eventually filter it.
    $unfiltered_valid = false;
    // Logout request
    if (isset($_GET['action']) && $_GET['action'] == 'logout') {
        yourls_do_action('logout');
        yourls_store_cookie(null);
        return yourls__('Logged out successfully');
    }
    // Check cookies or login request. Login form has precedence.
    yourls_do_action('pre_login');
    // Determine auth method and check credentials
    if (yourls_is_API() && isset($_REQUEST['timestamp']) && !empty($_REQUEST['timestamp']) && isset($_REQUEST['signature']) && !empty($_REQUEST['signature'])) {
        yourls_do_action('pre_login_signature_timestamp');
        $unfiltered_valid = yourls_check_signature_timestamp();
    } elseif (yourls_is_API() && !isset($_REQUEST['timestamp']) && isset($_REQUEST['signature']) && !empty($_REQUEST['signature'])) {
        yourls_do_action('pre_login_signature');
        $unfiltered_valid = yourls_check_signature();
    } elseif (isset($_REQUEST['username']) && isset($_REQUEST['password']) && !empty($_REQUEST['username']) && !empty($_REQUEST['password'])) {
        yourls_do_action('pre_login_username_password');
        $unfiltered_valid = yourls_check_username_password();
    } elseif (!yourls_is_API() && isset($_COOKIE[yourls_cookie_name()])) {
        yourls_do_action('pre_login_cookie');
        $unfiltered_valid = yourls_check_auth_cookie();
    }
    // Regardless of validity, allow plugins to filter the boolean and have final word
    $valid = yourls_apply_filter('is_valid_user', $unfiltered_valid);
    // Login for the win!
    if ($valid) {
        yourls_do_action('login');
        // (Re)store encrypted cookie if needed
        if (!yourls_is_API()) {
            yourls_store_cookie(YOURLS_USER);
            // Login form : redirect to requested URL to avoid re-submitting the login form on page reload
            if (isset($_REQUEST['username']) && isset($_REQUEST['password']) && isset($_SERVER['REQUEST_URI'])) {
                $url = $_SERVER['REQUEST_URI'];
                yourls_redirect($url);
            }
        }
        // Login successful
        return true;
    }
    // Login failed
    yourls_do_action('login_failed');
    if (isset($_REQUEST['username']) || isset($_REQUEST['password'])) {
        return yourls__('Invalid username or password');
    } else {
        return yourls__('Please log in');
    }
}
示例#4
0
function display_error($message, $action)
{
    echo '<div class="content error">';
    echo '<p class="message">' . $message . '</p>';
    if (!empty($action)) {
        echo $action;
    } else {
        echo '<p class="action"><a href="javascript:history.go(-1)" class="button">' . yourls__('&larr; Go back and try again', 'isq_translation') . '</a></p>';
    }
    echo '</div>';
    include 'footer.php';
    die;
}
示例#5
0
/**
 * Check a REQUEST password sent in plain text against stored password which can be a salted hash
 *
 */
function yourls_check_password_hash($stored, $plaintext)
{
    if (substr($stored, 0, 4) == 'md5:' and strlen($stored) == 42) {
        // Stored password is a salted hash: "md5:<$r = rand(10000,99999)>:<md5($r.'thepassword')>"
        // And 42. Of course. http://www.google.com/search?q=the+answer+to+life+the+universe+and+everything
        list($temp, $salt, $md5) = explode(':', $stored);
        return $stored == 'md5:' . $salt . ':' . md5($salt . $plaintext);
    } else {
        // Password was sent in clear
        $message = '';
        $message .= yourls__('<strong>Notice</strong>: your password is stored as clear text in your <tt>config.php</tt>');
        $message .= yourls__('Did you know you can easily improve the security of your YOURLS install by <strong>encrypting</strong> your password?');
        $message .= yourls__('See <a href="http://yourls.org/userpassword">UsernamePassword</a> for details');
        yourls_add_notice($message, 'notice');
        return $stored == $plaintext;
    }
}
示例#6
0
文件: tools.php 项目: Steadroy/YOURLS
            ur = l.split(new RegExp(ups))[1],
            ups = ups.split(/\\:/),
            p = '?up=' + enc(ups[0]+':') + '&us=' + enc(ups[1]) + '&ur='+enc(ur) + '&t=' + enc(d.title) + '&s=' + s2 + '&share=tumblr',
            u = f + p;
        try {
            throw ('ozhismygod');
        } catch (z) {
            a = function () {
                if (!w.open(u,'Share','width=450,height=450,left=430','_blank')) l = u;
            };
            if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0);
            else a();
        }
        void(0);
TUMBLR;
yourls_bookmarklet_link(yourls_make_bookmarklet($js_code), yourls__('YOURLS &amp; Tumblr'));
?>
        
		<?php 
yourls_do_action('social_bookmarklet_buttons_after');
?>
		
		</p>

	<h2><?php 
yourls_e('Prefix-n-Shorten');
?>
</h2>
		
		<p><?php 
yourls_se("When viewing a page, you can also prefix its full URL: just head to your browser's address bar, add \"<span>%s</span>\" to the beginning of the current URL (right before its 'http://' part) and hit enter.", preg_replace('@https?://@', '', YOURLS_SITE) . '/');
示例#7
0
/**
 * Handle plugin administration page
 *
 */
function yourls_plugin_admin_page($plugin_page)
{
    global $ydb;
    // Check the plugin page is actually registered
    if (!isset($ydb->plugin_pages[$plugin_page])) {
        yourls_die(yourls__('This page does not exist. Maybe a plugin you thought was activated is inactive?'), yourls__('Invalid link'));
    }
    // Draw the page itself
    yourls_do_action('load-' . $plugin_page);
    yourls_html_head('plugin_page_' . $plugin_page, $ydb->plugin_pages[$plugin_page]['title']);
    yourls_html_logo();
    yourls_html_menu();
    call_user_func($ydb->plugin_pages[$plugin_page]['function']);
    yourls_html_footer();
    die;
}
示例#8
0
/**
 * Output translated strings used by the Javascript calendar
 *
 * @since 1.6
 */
function yourls_l10n_calendar_strings()
{
    echo "\n<script>\n";
    echo "var l10n_cal_month = " . json_encode(array_values(yourls_l10n_months())) . ";\n";
    echo "var l10n_cal_days = " . json_encode(array_values(yourls_l10n_weekday_initial())) . ";\n";
    echo "var l10n_cal_today = \"" . yourls_esc_js(yourls__('Today')) . "\";\n";
    echo "var l10n_cal_close = \"" . yourls_esc_js(yourls__('Close')) . "\";\n";
    echo "</script>\n";
    // Dummy returns, to initialize l10n strings used in the calendar
    yourls__('Today');
    yourls__('Close');
}
示例#9
0
/**
 * Marks a function as deprecated and informs when it has been used. Stolen from WP.
 *
 * There is a hook deprecated_function that will be called that can be used
 * to get the backtrace up to what file and function called the deprecated
 * function.
 *
 * The current behavior is to trigger a user error if YOURLS_DEBUG is true.
 *
 * This function is to be used in every function that is deprecated.
 *
 * @since 1.6
 * @uses yourls_do_action() Calls 'deprecated_function' and passes the function name, what to use instead,
 *   and the version the function was deprecated in.
 * @uses yourls_apply_filters() Calls 'deprecated_function_trigger_error' and expects boolean value of true to do
 *   trigger or false to not trigger error.
 *
 * @param string $function The function that was called
 * @param string $version The version of WordPress that deprecated the function
 * @param string $replacement Optional. The function that should have been called
 */
function yourls_deprecated_function($function, $version, $replacement = null)
{
    yourls_do_action('deprecated_function', $function, $replacement, $version);
    // Allow plugin to filter the output error trigger
    if (YOURLS_DEBUG && yourls_apply_filters('deprecated_function_trigger_error', true)) {
        if (!is_null($replacement)) {
            trigger_error(sprintf(yourls__('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement));
        } else {
            trigger_error(sprintf(yourls__('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version));
        }
    }
}
示例#10
0
/**
 * Die with a DB error message
 *
 * @TODO in version 1.8 : use a new localized string, specific to the problem (ie: "DB is dead")
 *
 * @since 1.7.1
 */
function yourls_db_dead()
{
    // Use any /user/db_error.php file
    if (file_exists(YOURLS_USERDIR . '/db_error.php')) {
        include_once YOURLS_USERDIR . '/db_error.php';
        die;
    }
    yourls_die(yourls__('Incorrect DB config, or could not connect to DB'), yourls__('Fatal error'), 503);
}
示例#11
0
 /**
  * Map Ldap exceptions
  *
  * @param Exception $e
  * @return string
  */
 private function mapLdapException(Exception $e)
 {
     switch ($e->getCode()) {
         case Ldap::ERROR_COULD_CONNECT_TO_SERVER:
         case Ldap::ERROR_COULD_NOT_BIND_TO_SERVER:
             $msg = yourls__('No connection to LDAP-Server', self::APP_NAMESPACE);
             break;
         case Ldap::ERROR_NO_SEARCH_RESULT:
         case Ldap::ERROR_NO_USER_WITH_INFORMATION_FOUND:
         case Ldap::ERROR_NO_ENTRIES_FOUND:
         case Ldap::ERROR_USER_IS_NOT_IN_ALLOWED_GROUP:
         case Ldap::ERROR_AUTH_FAILED_WRONG_PASSWORD:
         default:
             $msg = yourls__('Invalid username or password', self::APP_NAMESPACE);
     }
     return $msg . (true === YOURLS_DEBUG ? ' (' . $e->getMessage() . ')' : '');
 }
 /**
  * Action: yourls_ajax_laemmi_edit_ldapgroup_save
  */
 public function action_yourls_ajax_laemmi_edit_ldapgroup_save()
 {
     $keyword = yourls_sanitize_string($this->getRequest('keyword'));
     $nonce = $this->getRequest('nonce');
     $id = yourls_string2htmlid($keyword);
     yourls_verify_nonce('laemmi_edit_ldapgroup_save_' . $id, $nonce, false, 'omg error');
     $this->action_insert_link(['', '', $keyword, '', '', '']);
     $return = [];
     $return['status'] = 'success';
     $return['message'] = yourls__('Link updated in database', self::APP_NAMESPACE);
     echo json_encode($return);
 }
示例#13
0
?>
		<p>
			<img src="<?php 
yourls_site_url();
?>
/images/yourls-logo.png" alt="YOURLS" title="YOURLS" />
		</p>
		<?php 
// Print errors, warnings and success messages
foreach (array('error', 'warning', 'success') as $info) {
    if (count(${$info}) > 0) {
        echo "<ul class='{$info}'>";
        foreach (${$info} as $msg) {
            echo '<li>' . $msg . "</li>\n";
        }
        echo '</ul>';
    }
}
// Display install button or link to admin area if applicable
if (!yourls_is_installed() && !isset($_REQUEST['install'])) {
    echo '<p style="text-align: center;"><input type="submit" name="install" value="' . yourls__('Install YOURLS') . '" class="button" /></p>';
} else {
    if (count($error) == 0) {
        echo '<p style="text-align: center;">&raquo; <a href="' . yourls_admin_url() . '" title="' . yourls__('YOURLS Administration Page') . '">' . yourls__('YOURLS Administration Page') . '</a></p>';
    }
}
?>
	</form>
</div>
<?php 
yourls_html_footer();
示例#14
0
文件: index.php 项目: yourls/yourls
    yourls_html_tfooter($params);
}
yourls_table_tbody_start();
// Main Query
$where = yourls_apply_filter('admin_list_where', $where);
$url_results = $ydb->get_results("SELECT * FROM `{$table_url}` WHERE 1=1 {$where} ORDER BY `{$sort_by}` {$sort_order} LIMIT {$offset}, {$perpage};");
$found_rows = false;
if ($url_results) {
    $found_rows = true;
    foreach ($url_results as $url_result) {
        $keyword = yourls_sanitize_string($url_result->keyword);
        $timestamp = strtotime($url_result->timestamp);
        $url = stripslashes($url_result->url);
        $ip = $url_result->ip;
        $title = $url_result->title ? $url_result->title : '';
        $clicks = $url_result->clicks;
        echo yourls_table_add_row($keyword, $url, $title, $ip, $clicks, $timestamp);
    }
}
$display = $found_rows ? 'display:none' : '';
echo '<tr id="nourl_found" style="' . $display . '"><td colspan="6">' . yourls__('No URL') . '</td></tr>';
yourls_table_tbody_end();
yourls_table_end();
yourls_do_action('admin_page_after_table');
if ($is_bookmark) {
    yourls_share_box($url, $return['shorturl'], $title, $text);
}
?>
	
<?php 
yourls_html_footer();
示例#15
0
/**
 * Create MySQL tables. Return array( 'success' => array of success strings, 'errors' => array of error strings )
 *
 * @since 1.3
 * @return array  An array like array( 'success' => array of success strings, 'errors' => array of error strings )
 */
function yourls_create_sql_tables()
{
    // Allow plugins (most likely a custom db.php layer in user dir) to short-circuit the whole function
    $pre = yourls_apply_filter('shunt_yourls_create_sql_tables', null);
    // your filter function should return an array of ( 'success' => $success_msg, 'error' => $error_msg ), see below
    if (null !== $pre) {
        return $pre;
    }
    global $ydb;
    $error_msg = array();
    $success_msg = array();
    // Create Table Query
    $create_tables = array();
    $create_tables[YOURLS_DB_TABLE_URL] = 'CREATE TABLE IF NOT EXISTS `' . YOURLS_DB_TABLE_URL . '` (' . '`keyword` varchar(200) BINARY NOT NULL,' . '`url` text BINARY NOT NULL,' . '`title` text CHARACTER SET utf8,' . '`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,' . '`ip` VARCHAR(41) NOT NULL,' . '`clicks` INT(10) UNSIGNED NOT NULL,' . ' PRIMARY KEY  (`keyword`),' . ' KEY `timestamp` (`timestamp`),' . ' KEY `ip` (`ip`)' . ');';
    $create_tables[YOURLS_DB_TABLE_OPTIONS] = 'CREATE TABLE IF NOT EXISTS `' . YOURLS_DB_TABLE_OPTIONS . '` (' . '`option_id` bigint(20) unsigned NOT NULL auto_increment,' . '`option_name` varchar(64) NOT NULL default "",' . '`option_value` longtext NOT NULL,' . 'PRIMARY KEY  (`option_id`,`option_name`),' . 'KEY `option_name` (`option_name`)' . ') AUTO_INCREMENT=1 ;';
    $create_tables[YOURLS_DB_TABLE_LOG] = 'CREATE TABLE IF NOT EXISTS `' . YOURLS_DB_TABLE_LOG . '` (' . '`click_id` int(11) NOT NULL auto_increment,' . '`click_time` datetime NOT NULL,' . '`shorturl` varchar(200) BINARY NOT NULL,' . '`referrer` varchar(200) NOT NULL,' . '`user_agent` varchar(255) NOT NULL,' . '`ip_address` varchar(41) NOT NULL,' . '`country_code` char(2) NOT NULL,' . 'PRIMARY KEY  (`click_id`),' . 'KEY `shorturl` (`shorturl`)' . ') AUTO_INCREMENT=1 ;';
    $create_table_count = 0;
    $ydb->show_errors = true;
    // Create tables
    foreach ($create_tables as $table_name => $table_query) {
        $ydb->query($table_query);
        $create_success = $ydb->query("SHOW TABLES LIKE '{$table_name}'");
        if ($create_success) {
            $create_table_count++;
            $success_msg[] = yourls_s("Table '%s' created.", $table_name);
        } else {
            $error_msg[] = yourls_s("Error creating table '%s'.", $table_name);
        }
    }
    // Initializes the option table
    if (!yourls_initialize_options()) {
        $error_msg[] = yourls__('Could not initialize options');
    }
    // Insert sample links
    if (!yourls_insert_sample_links()) {
        $error_msg[] = yourls__('Could not insert sample short URLs');
    }
    // Check results of operations
    if (sizeof($create_tables) == $create_table_count) {
        $success_msg[] = yourls__('YOURLS tables successfully created.');
    } else {
        $error_msg[] = yourls__('Error creating YOURLS tables.');
    }
    return array('success' => $success_msg, 'error' => $error_msg);
}
示例#16
0
/**
 * Create MySQL tables. Return array( 'success' => array of success strings, 'errors' => array of error strings )
 *
 */
function yourls_create_sql_tables()
{
    global $ydb;
    $error_msg = array();
    $success_msg = array();
    // Create Table Query
    $create_tables = array();
    $create_tables[YOURLS_DB_TABLE_URL] = 'CREATE TABLE IF NOT EXISTS `' . YOURLS_DB_TABLE_URL . '` (' . '`keyword` varchar(200) BINARY NOT NULL,' . '`url` text BINARY NOT NULL,' . '`title` text CHARACTER SET utf8,' . '`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,' . '`ip` VARCHAR(41) NOT NULL,' . '`clicks` INT(10) UNSIGNED NOT NULL,' . ' PRIMARY KEY  (`keyword`),' . ' KEY `timestamp` (`timestamp`),' . ' KEY `ip` (`ip`)' . ');';
    $create_tables[YOURLS_DB_TABLE_OPTIONS] = 'CREATE TABLE IF NOT EXISTS `' . YOURLS_DB_TABLE_OPTIONS . '` (' . '`option_id` bigint(20) unsigned NOT NULL auto_increment,' . '`option_name` varchar(64) NOT NULL default "",' . '`option_value` longtext NOT NULL,' . 'PRIMARY KEY  (`option_id`,`option_name`),' . 'KEY `option_name` (`option_name`)' . ') AUTO_INCREMENT=1 ;';
    $create_tables[YOURLS_DB_TABLE_LOG] = 'CREATE TABLE IF NOT EXISTS `' . YOURLS_DB_TABLE_LOG . '` (' . '`click_id` int(11) NOT NULL auto_increment,' . '`click_time` datetime NOT NULL,' . '`shorturl` varchar(200) BINARY NOT NULL,' . '`referrer` varchar(200) NOT NULL,' . '`user_agent` varchar(255) NOT NULL,' . '`ip_address` varchar(41) NOT NULL,' . '`country_code` char(2) NOT NULL,' . 'PRIMARY KEY  (`click_id`),' . 'KEY `shorturl` (`shorturl`)' . ') AUTO_INCREMENT=1 ;';
    $create_table_count = 0;
    $ydb->show_errors = true;
    // Create tables
    foreach ($create_tables as $table_name => $table_query) {
        $ydb->query($table_query);
        $create_success = $ydb->query("SHOW TABLES LIKE '{$table_name}'");
        if ($create_success) {
            $create_table_count++;
            $success_msg[] = yourls_s("Table '%s' created.", $table_name);
        } else {
            $error_msg[] = yourls_s("Error creating table '%s'.", $table_name);
        }
    }
    // Insert data into tables
    yourls_update_option('version', YOURLS_VERSION);
    yourls_update_option('db_version', YOURLS_DB_VERSION);
    yourls_update_option('next_id', 1);
    // Insert sample links
    yourls_insert_link_in_db('http://planetozh.com/blog/', 'ozhblog', 'planetOzh: Ozh\' blog');
    yourls_insert_link_in_db('http://ozh.org/', 'ozh', 'ozh.org');
    yourls_insert_link_in_db('http://yourls.org/', 'yourls', 'YOURLS: Your Own URL Shortener');
    // Check results of operations
    if (sizeof($create_tables) == $create_table_count) {
        $success_msg[] = yourls__('YOURLS tables successfully created.');
    } else {
        $error_msg[] = yourls__('Error creating YOURLS tables.');
    }
    return array('success' => $success_msg, 'error' => $error_msg);
}
示例#17
0
/**
 * Rewrite logout link
 *
 * @param string $link   Default element
 * @param string $show   Allow muting
 * @return string        Logout element (HTML)
 */
function lc_full_bootstrap_logout_link($link, $show = false)
{
    if ($show && yourls_is_private() && defined('YOURLS_USER')) {
        return '<div class="navbar-right"><p class="navbar-text">' . sprintf(yourls__('Hello <strong>%s</strong>'), YOURLS_USER) . '</p><a href="?action=logout" title="' . yourls_esc_attr__('Logout') . '" class="btn btn-default navbar-btn"><i class="icon-signout"></i> ' . yourls__('Logout') . '</a></div>';
    } else {
        return '';
    }
}
示例#18
0
        if (isset($plugin[$value])) {
            $data[$field] = $plugin[$value];
        } else {
            $data[$field] = '(no info)';
        }
        unset($plugin[$value]);
    }
    $plugindir = trim(dirname($file), '/');
    if (yourls_is_active_plugin($file)) {
        $class = 'active';
        $action_url = yourls_nonce_url('manage_plugins', yourls_add_query_arg(array('action' => 'deactivate', 'plugin' => $plugindir)));
        $action_anchor = yourls__('Deactivate');
    } else {
        $class = 'inactive';
        $action_url = yourls_nonce_url('manage_plugins', yourls_add_query_arg(array('action' => 'activate', 'plugin' => $plugindir)));
        $action_anchor = yourls__('Activate');
    }
    // Other "Fields: Value" in the header? Get them too
    if ($plugin) {
        foreach ($plugin as $extra_field => $extra_value) {
            $data['desc'] .= "<br/>\n<em>{$extra_field}</em>: {$extra_value}";
            unset($plugin[$extra_value]);
        }
    }
    $data['desc'] .= '<br/><small>' . yourls_s('plugin file location: %s', $file) . '</small>';
    printf("<tr class='plugin %s'><td class='plugin_name'><a href='%s'>%s</a></td><td class='plugin_version'>%s</td><td class='plugin_desc'>%s</td><td class='plugin_author'><a href='%s'>%s</a></td><td class='plugin_actions actions'><a href='%s'>%s</a></td></tr>", $class, $data['uri'], $data['name'], $data['version'], $data['desc'], $data['author_uri'], $data['author'], $action_url, $action_anchor);
}
?>
	</tbody>
	</table>
	
示例#19
0
<div class="content">
	<h2><?php 
yourls_e('The bookmarklet', 'isq_translation');
?>
</h2>

	<?php 
$bookmarkletdialog = yourls__('Save this as a bookmark.', 'isq_translation');
?>
	<p><?php 
yourls_e('Add this to your bookmarks or drag it to your bookmarks bar to quickly access shortening functions.', 'isq_translation');
?>
 </p>
	<p class="bookmarklet-container"><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 button"><span class="icon-move"><?php 
include 'public/images/move.svg';
?>
</span><?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>
示例#20
0
文件: tools.php 项目: GasmoN/yourls
<?php

define('YOURLS_ADMIN', true);
require_once dirname(dirname(__FILE__)) . '/includes/load-yourls.php';
yourls_maybe_require_auth();
yourls_html_head('tools', yourls__('Cool YOURLS Tools'));
yourls_html_logo();
yourls_html_menu();
?>

	<div class="sub_wrap">
	
	<h2><?php 
yourls_e('Bookmarklets');
?>
</h2>
	
		<p><?php 
yourls_e('YOURLS comes with <span>four</span> handy <span>bookmarklets</span> for easier link shortening.');
?>
</p>

		<h3><?php 
yourls_e('Standard or Instant, Simple or Custom');
?>
</h3>
		
		<ul>
			<li><?php 
yourls_e('The <span>Standard Bookmarklets</span> will take you to a page where you can easily edit or delete your brand new short URL.');
?>
示例#21
0
</p>
			<p><?php 
            yourls_e("On every step, if <span class='error'>something goes wrong</span>, you'll see a message and hopefully a way to fix.");
            ?>
</p>
			<p><?php 
            yourls_e('If everything goes too fast and you cannot read, <span class="success">good for you</span>, let it go :)');
            ?>
</p>
			<p><?php 
            yourls_e('Once you are ready, press "Upgrade" !');
            ?>
</p>
			<?php 
            echo "\n\t\t\t<form action='upgrade.php?' method='get'>\n\t\t\t<input type='hidden' name='step' value='1' />\n\t\t\t<input type='hidden' name='oldver' value='{$oldver}' />\n\t\t\t<input type='hidden' name='newver' value='{$newver}' />\n\t\t\t<input type='hidden' name='oldsql' value='{$oldsql}' />\n\t\t\t<input type='hidden' name='newsql' value='{$newsql}' />\n\t\t\t<input type='submit' class='primary' value='" . yourls_esc_attr__('Upgrade') . "' />\n\t\t\t</form>";
            break;
        case 1:
        case 2:
            $upgrade = yourls_upgrade($step, $oldver, $newver, $oldsql, $newsql);
            break;
        case 3:
            $upgrade = yourls_upgrade(3, $oldver, $newver, $oldsql, $newsql);
            echo '<p>' . yourls__('Your installation is now up to date ! ') . '</p>';
            echo '<p>' . yourls_s('Go back to <a href="%s">the admin interface</a>', yourls_admin_url('index.php')) . '</p>';
    }
}
?>
	

<?php 
yourls_html_footer();
示例#22
0
 /**
  * Filter: admin_links
  */
 public function filter_admin_links()
 {
     list($admin_links) = func_get_args();
     $admin_links['admin']['anchor'] = yourls__('Home', self::APP_NAMESPACE);
     return $admin_links;
 }
示例#23
0
 /**
  * Sets up the translated strings and object properties.
  *
  * The method creates the translatable strings for various
  * calendar elements. Which allows for specifying locale
  * specific calendar names and text direction.
  *
  * @since 1.6
  * @access private
  */
 function init()
 {
     // The Weekdays
     $this->weekday[0] = yourls__('Sunday');
     $this->weekday[1] = yourls__('Monday');
     $this->weekday[2] = yourls__('Tuesday');
     $this->weekday[3] = yourls__('Wednesday');
     $this->weekday[4] = yourls__('Thursday');
     $this->weekday[5] = yourls__('Friday');
     $this->weekday[6] = yourls__('Saturday');
     // The first letter of each day. The _%day%_initial suffix is a hack to make
     // sure the day initials are unique.
     $this->weekday_initial[yourls__('Sunday')] = yourls__('S_Sunday_initial');
     $this->weekday_initial[yourls__('Monday')] = yourls__('M_Monday_initial');
     $this->weekday_initial[yourls__('Tuesday')] = yourls__('T_Tuesday_initial');
     $this->weekday_initial[yourls__('Wednesday')] = yourls__('W_Wednesday_initial');
     $this->weekday_initial[yourls__('Thursday')] = yourls__('T_Thursday_initial');
     $this->weekday_initial[yourls__('Friday')] = yourls__('F_Friday_initial');
     $this->weekday_initial[yourls__('Saturday')] = yourls__('S_Saturday_initial');
     foreach ($this->weekday_initial as $weekday_ => $weekday_initial_) {
         $this->weekday_initial[$weekday_] = preg_replace('/_.+_initial$/', '', $weekday_initial_);
     }
     // Abbreviations for each day.
     $this->weekday_abbrev[yourls__('Sunday')] = yourls__('Sun');
     $this->weekday_abbrev[yourls__('Monday')] = yourls__('Mon');
     $this->weekday_abbrev[yourls__('Tuesday')] = yourls__('Tue');
     $this->weekday_abbrev[yourls__('Wednesday')] = yourls__('Wed');
     $this->weekday_abbrev[yourls__('Thursday')] = yourls__('Thu');
     $this->weekday_abbrev[yourls__('Friday')] = yourls__('Fri');
     $this->weekday_abbrev[yourls__('Saturday')] = yourls__('Sat');
     // The Months
     $this->month['01'] = yourls__('January');
     $this->month['02'] = yourls__('February');
     $this->month['03'] = yourls__('March');
     $this->month['04'] = yourls__('April');
     $this->month['05'] = yourls__('May');
     $this->month['06'] = yourls__('June');
     $this->month['07'] = yourls__('July');
     $this->month['08'] = yourls__('August');
     $this->month['09'] = yourls__('September');
     $this->month['10'] = yourls__('October');
     $this->month['11'] = yourls__('November');
     $this->month['12'] = yourls__('December');
     // Abbreviations for each month. Uses the same hack as above to get around the
     // 'May' duplication.
     $this->month_abbrev[yourls__('January')] = yourls__('Jan_January_abbreviation');
     $this->month_abbrev[yourls__('February')] = yourls__('Feb_February_abbreviation');
     $this->month_abbrev[yourls__('March')] = yourls__('Mar_March_abbreviation');
     $this->month_abbrev[yourls__('April')] = yourls__('Apr_April_abbreviation');
     $this->month_abbrev[yourls__('May')] = yourls__('May_May_abbreviation');
     $this->month_abbrev[yourls__('June')] = yourls__('Jun_June_abbreviation');
     $this->month_abbrev[yourls__('July')] = yourls__('Jul_July_abbreviation');
     $this->month_abbrev[yourls__('August')] = yourls__('Aug_August_abbreviation');
     $this->month_abbrev[yourls__('September')] = yourls__('Sep_September_abbreviation');
     $this->month_abbrev[yourls__('October')] = yourls__('Oct_October_abbreviation');
     $this->month_abbrev[yourls__('November')] = yourls__('Nov_November_abbreviation');
     $this->month_abbrev[yourls__('December')] = yourls__('Dec_December_abbreviation');
     foreach ($this->month_abbrev as $month_ => $month_abbrev_) {
         $this->month_abbrev[$month_] = preg_replace('/_.+_abbreviation$/', '', $month_abbrev_);
     }
     // The Meridiems
     $this->meridiem['am'] = yourls__('am');
     $this->meridiem['pm'] = yourls__('pm');
     $this->meridiem['AM'] = yourls__('AM');
     $this->meridiem['PM'] = yourls__('PM');
     // Numbers formatting
     // See http://php.net/number_format
     /* //translators: $thousands_sep argument for http://php.net/number_format, default is , */
     $trans = yourls__('number_format_thousands_sep');
     $this->number_format['thousands_sep'] = 'number_format_thousands_sep' == $trans ? ',' : $trans;
     /* //translators: $dec_point argument for http://php.net/number_format, default is . */
     $trans = yourls__('number_format_decimal_point');
     $this->number_format['decimal_point'] = 'number_format_decimal_point' == $trans ? '.' : $trans;
     // Set text direction.
     if (isset($GLOBALS['text_direction'])) {
         $this->text_direction = $GLOBALS['text_direction'];
     } elseif ('rtl' == yourls_x('ltr', 'text direction')) {
         $this->text_direction = 'rtl';
     }
 }
示例#24
0
        echo '<p>' . yourls__('No referrer data.') . '</p>';
    }
    ?>
			
	</div>
</div><!--/panel-body -->
</div><!--/panel -->

<?php 
}
// endif do log redirect
?>


	<div id="stat_tab_share" class="tab">
		<h2><?php 
yourls_e('Share');
?>
</h2>
		
		<?php 
yourls_share_box($longurl, yourls_link($keyword), $title, '', '<h3>' . yourls__('Short link') . '</h3>', '<h3>' . yourls__('Quick Share') . '</h3>');
?>

	</div>
	
</div>


<?php 
yourls_html_footer();
 /**
  * Returns the html fields for form
  *
  * @param array $options
  * @return string
  */
 private function getHtmlFields(array $options = [])
 {
     $permissions = $this->helperGetAllowedPermissions();
     $html = '';
     if (isset($permissions[self::PERMISSION_ACTION_EDIT_COMMENT])) {
         $html .= '<div class="laemmi_form_field"><label>' . yourls__('Comment', self::APP_NAMESPACE) . ':</label> <textarea name="comment" rows="5">' . $options['comment'] . '</textarea></div>';
     }
     if (isset($permissions[self::PERMISSION_ACTION_EDIT_LABEL])) {
         $html .= '<div class="laemmi_form_field"><label>' . yourls__('Label', self::APP_NAMESPACE) . ':</label> <input class="text" type="text" name="label" placeholder="' . yourls__('Add labels comma separated', self::APP_NAMESPACE) . '" value="' . $options['label'] . '" /></div>';
     }
     return $html;
 }