function preAddLink($args) { if (YOURLS_MULTIUSER_ANONYMOUS === true) { return; } else { $token = isset($_REQUEST['token']) ? yourls_sanitize_string($_REQUEST['token']) : ''; $user = getUserIdByToken($token); if ($user == false) { $u = $_SESSION["user"]; $user = getUserIdByToken($u["token"]); } if ($user == false) { echo yourls_notice_box("<b>You need to be logged to short a link.</b>"); die; } else { return; } } }
/** * Wrapper function to display admin notices * */ function yourls_add_notice($message, $style = 'notice') { // Escape single quotes in $message to avoid breaking the anonymous function $message = yourls_notice_box(strtr($message, array("'" => "\\'")), $style); yourls_add_action('admin_notices', create_function('', "echo '{$message}';")); }
function yourls_add_notice($message) { $message = yourls_notice_box($message); yourls_add_action('admin_notices', create_function('', "echo '{$message}';")); }
<?php if (strpos($_SERVER["REQUEST_URI"], "form.php") === false) { if (YOURLS_PRIVATE === false || !defined('YOURLS_ABSPATH')) { die; // NO DIRECT CALLS IF PUBLIC OR if YOURLS_ABSPATH NOT DEFINED! } echo yourls_notice_box("<b>Log in</b>"); mu_html_loginForm($error_msg); } else { }
<?php if (strpos($_SERVER["REQUEST_URI"], "formjoin.php") === false) { if (YOURLS_PRIVATE === false || !defined('YOURLS_ABSPATH')) { die; // NO DIRECT CALLS IF PUBLIC OR if YOURLS_ABSPATH NOT DEFINED! } echo yourls_notice_box("<b>Sign in</b>"); mu_html_signupForm($error_msg); } else { }