Exemple #1
0
function show404($shorturl)
{
    yourls_status_header(404);
    yourls_html_head('page404', 'This page does not exist');
    yourls_html_logo();
    ?>

<div class="main-column">
	<div class="panel panel-teaser">
		<div class="panel-header">
			<h1>Page Not Found</h1>
		</div>
		<div class="panel-body">
			<p>Leider konnten wir keine Adresse unter dem Kürzel <strong><?php 
    echo $shorturl;
    ?>
</strong> finden.
			Das bedeutet, dass diese Kurz-URL nicht existiert.
		</div>
	</div>
</div>
<div class="sidebar-column">

	<div class="panel panel-sidebar">
		<h2>Über den Kurz-URL-Dienst</h2>
		<div class="panel-body">
			<span class="caret"></span>

			<p>Auf der Website <?php 
    echo $_SERVER['SERVER_NAME'];
    ?>
 lassen sich Kurzlinks
			zu Ressourcen der <a href="http://www.uni-frankfurt.de/">Goethe-Universität Frankfurt</a>
			erstellen. <a href="/">Zur Startseite</a>
		</div>
	</div>

</div>


<?php 
    yourls_html_footer();
}
Exemple #2
0
function ozh_preview_show($keyword)
{
    require_once YOURLS_INC . '/functions-html.php';
    yourls_html_head('preview', 'Short URL preview');
    yourls_html_logo();
    $title = yourls_get_keyword_title($keyword);
    $url = yourls_get_keyword_longurl($keyword);
    $base = YOURLS_SITE;
    $char = OZH_PREVIEW_CHAR;
    echo <<<HTML
        <h2>Link Preview</h2>
        <p>You requested the short URL <strong><a href="{$base}/{$keyword}">{$base}/{$keyword}</a></strong></p>
        <p>This short URL points to:</p>
        <ul>
        <li>Long URL: <strong><a href="{$base}/{$keyword}">{$url}</a></strong></li>
        <li>Page title: <strong>{$title}</strong></li>
        </ul>
        <p>If you still want to visit this link, please <strong><a href="{$base}/{$keyword}">click here</a></strong>.</p>

        <p>Thank you for using our shortening service.</p>
HTML;
    yourls_html_footer();
}
    }
    ?>
			
	</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();
Exemple #4
0
function yourls_login_screen($error_msg = '')
{
    yourls_html_head('login');
    $action = isset($_GET['mode']) && $_GET['mode'] == 'logout' ? '?' : '';
    yourls_html_logo();
    ?>
	<div id="login">
		<form method="post" action="<?php 
    echo $action;
    ?>
"> <?php 
    // reset any QUERY parameters
    ?>
			<?php 
    if (!empty($error_msg)) {
        echo '<p class="error">' . $error_msg . '</p>';
    }
    ?>
			<p>
				<label for="username">Username</label><br />
				<input type="text" id="username" name="username" size="30" class="text" />
			</p>
			<p>
				<label for="password">Password</label><br />
				<input type="password" id="password" name="password" size="30" class="text" />
			</p>
			<p style="text-align: right;">
				<input type="submit" id="submit" name="submit" value="Login" class="button" />
			</p>
		</form>
		<script type="text/javascript">$('#username').focus();</script>
	</div>
	<?php 
    yourls_html_footer();
    die;
}
/**
 * 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('This page does not exist. Maybe a plugin you thought was activated is inactive?', '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;
}
 /**
  * Yourls action auth_successful
  *
  * @return bool
  */
 public function action_auth_successful()
 {
     if (!yourls_is_admin()) {
         return true;
     }
     /**
      * Check page permissions
      */
     if (preg_match('#\\/admin\\/(.*?)\\.php#', $_SERVER['SCRIPT_FILENAME'], $matches)) {
         if (!in_array($matches[1], $this->helperGetAllowedPermissions())) {
             yourls_add_notice(yourls__('Denied access to this page', self::APP_NAMESPACE));
             yourls_html_head('accessdenied', yourls__('Denied access to this page', self::APP_NAMESPACE));
             yourls_html_logo();
             yourls_html_menu();
             yourls_html_footer();
             die;
         }
     }
     /**
      * Check action permissions
      */
     if (yourls_is_Ajax()) {
         $action = $this->getRequest('action');
         $permissions = $this->helperGetAllowedPermissions();
         $bol = false;
         switch ($action) {
             case 'edit_display':
             case 'edit_save':
                 if (!in_array('edit', $permissions['action'])) {
                     $bol = true;
                 }
                 break;
             case 'add':
             case 'delete':
                 if (!in_array($action, $permissions['action'])) {
                     $bol = true;
                 }
                 break;
         }
         if ($bol) {
             $this->setRequest('action_old', $action);
             $this->setRequest('action', 'accessdenied');
         }
     }
 }