Ejemplo n.º 1
0
<?php

function logout_add_css($show)
{
    $added = '#rapid_logout {	position: fixed;right: 15px;top: 5px}#rapid_logout li {display: inline;margin: 0;margin-right: 10px;border: 0}';
    return $show . $added;
}
function logout_button()
{
    global $cms;
    $html = "<script>jQuery(function (\$) {";
    $html .= "\$('body').append(\"";
    $html .= "<ul id='rapid_logout'>";
    $html .= "<li><a href='" . RAPID_DIR . "'>Admin Section</a></li>";
    $html .= "<li><a href='" . RAPID_DIR . "?action=logout' class='last'>Logout</a></li>";
    $html .= "</ul>";
    $html .= "\");});</script>";
    if ($cms->user->logged_in()) {
        echo "{$html}";
    }
}
hooks::do_action("head", "logout_button");
hooks::apply_filter("add_css", "logout_add_css", 1);
Ejemplo n.º 2
0
function logout_button()
{
    global $cms;
    $html = "<ul id='rapid_logout'>";
    $html .= "<li><a href='" . RAPID_DIR . "'>Admin Section</a></li>";
    $html .= "<li><a href='" . RAPID_DIR . "?action=logout' class='last'>Logout</a></li>";
    $html .= "</ul>";
    if ($cms->user->logged_in()) {
        echo "{$html}";
        ?>
	<script>
		$(document).ready(function () {
			$('#rapid_logout').css({
				'position':'fixed',
				'right': '15px',
				'top': '5px'
			});
			
			$('#rapid_logout li').css({
				'display': 'inline',
				'margin': '0',
				'margin-right': '10px',
				'border': '0'
			});
		});
	</script>
	<?php 
    }
}
hooks::do_action("head", "logout_button");
Ejemplo n.º 3
0
<?php

function generator_show()
{
    global $cms;
    global $hooks;
    echo $hooks->add_filter('show_generator', "<meta name=\"generator\" content=\"RapidCMS\" />\n");
}
hooks::do_action("head", "generator_show");
Ejemplo n.º 4
0
<?php

function clean_html($html)
{
    $c = htmlentities(trim($html), ENT_NOQUOTES, "UTF-8", false);
    $c = str_replace("&Acirc;", "", $c);
    $c = str_replace("&lt;", "<", $c);
    $c = str_replace("&gt;", ">", $c);
    $c = str_replace("<?php", "&lt;?php", $c);
    $c = str_replace("?>", "?&gt;", $c);
    // Make HTML better in safari & chrome
    $c = str_replace("<b>", "<strong>", $c);
    $c = str_replace("</b>", "</strong>", $c);
    $c = str_replace("<i>", "<em>", $c);
    $c = str_replace("</i>", "</em>", $c);
    $c = str_replace("<s>", "<strike>", $c);
    $c = str_replace("</s>", "</strike>", $c);
    $c = str_replace("<br>", "<br />", $c);
    return $c;
}
hooks::apply_filter("update_content", "clean_html", 1);
Ejemplo n.º 5
0
    $admin_page[] = 'http://' . $_SERVER['HTTP_HOST'] . RAPID_DIR . '/?action=logout';
    $referrer = preg_replace('/\\?.*/', '', $_SERVER['HTTP_REFERER']);
    if (isset($referrer)) {
        foreach ($admin_page as $p) {
            if ($referrer == $p) {
                $is_admin_page = true;
            }
        }
        if (!$is_admin_page) {
            $_SESSION['referer'] = $_SERVER['HTTP_REFERER'];
        }
    }
}
function admin_header_referer()
{
    global $cms;
    if (isset($_SESSION['referer']) && $cms->user->logged_in()) {
        if ($_SESSION['referer'] != "http://" . $_SERVER['HTTP_HOST'] . RAPID_DIR . "/index.php") {
            ?>
			<h2>Live Edit</h2>
			<p>Go back to the <a href="<?php 
            echo $_SESSION['referer'];
            ?>
">page</a> to edit live</p>
			<?php 
        }
    }
}
hooks::do_action("admin_header", "request_uri");
hooks::do_action("admin_sidebar", "admin_header_referer");
Ejemplo n.º 6
0
<?php

function global_css_show()
{
    global $cms;
    global $hooks;
    $show = "/*dynamically added css*/\n";
    echo "<style id='global-css'>";
    echo $hooks->add_filter('add_css', $show);
    echo "</style>";
}
hooks::do_action("head", "global_css_show");