Esempio n. 1
0
    case 'comp-success':
        doNotify(i18n_r('ER_COMPONENT_SAVE') . '. <a href="components.php?undo&nonce=' . get_nonce("undo") . '">' . i18n_r('UNDO') . '</a>', 'success');
        break;
    case 'comp-restored':
        doNotify(i18n_r('ER_COMPONENT_REST') . '. <a href="components.php?undo&nonce=' . get_nonce("undo") . '">' . i18n_r('UNDO') . '</a>', 'success');
        break;
    case 'profile-restored':
        doNotify(i18n_r('ER_PROFILE_RESTORED') . '. <a href="profile.php?undo&nonce=' . get_nonce("undo") . '&userid=' . $userid . '">' . i18n_r('UNDO') . '</a>', 'success');
        break;
    case 'settings-restored':
        doNotify(i18n_r('ER_OLD_RESTORED') . '. <a href="settings.php?undo&nonce=' . get_nonce("undo") . '">' . i18n_r('UNDO') . '</a>', 'success');
        break;
    default:
        if (isset($error)) {
            doNotify('<b>' . i18n_r('ERROR') . ':</b> ' . $error, 'error');
        } elseif (isset($_GET['cancel'])) {
            doNotify(i18n_r('ER_CANCELLED_FAIL'), 'error');
        } elseif (isset($_GET['logout'])) {
            doNotify(i18n_r('MSG_LOGGEDOUT'), 'info');
        } elseif (!empty($err)) {
            doNotify('<b>' . i18n_r('ERROR') . ':</b> ' . $err, 'error');
        } elseif (isset($success)) {
            doNotify($success, 'success');
        }
        break;
}
function doNotify($msg, $type = '', $persist = false)
{
    echo '<div class="updated notify ' . ($type == '' ? '' : 'notify_' . $type . ' ') . ($persist ? 'remove' : '') . '"><p>' . $msg . '</p></div>';
}
/* ?> */
Esempio n. 2
0
        doNotify(i18n_r('FILL_IN_REQ_FIELD'), 'error', true, true);
        break;
    case 'login-fail':
        doNotify(i18n_r('LOGIN_FAILED'), 'error', true, true);
        break;
    default:
        if (isset($error)) {
            doNotify('<b>' . i18n_r('ERROR') . ':</b> ' . $error, 'error', true);
        } elseif (isset($_GET['cancel'])) {
            doNotify(i18n_r('ER_CANCELLED_FAIL'), 'error');
        } elseif (isset($_GET['logout'])) {
            doNotify(i18n_r('MSG_LOGGEDOUT'), 'info', true, true);
        } elseif (!empty($err)) {
            doNotify('<b>' . i18n_r('ERROR') . ':</b> ' . $err, 'error', true);
        } elseif (isset($success)) {
            doNotify($success, 'success', false);
        }
        break;
}
/**
 * output a notification
 * @param  str  $msg     the message text
 * @param  string  $type    type of message success, error, info, warn
 * @param  boolean $persist trueto make message not expire and dissapear
 * @param  boolean $force   force the message to show on auth pages
 */
function doNotify($msg, $type = '', $persist = false, $force = false)
{
    // do not output notifications on auth pages to prevent nonce and data leakage, unless force is true
    if (isAuthPage() && !$force) {
        return;