예제 #1
0
 /**
  * Saves pane visibility.
  */
 public function visible()
 {
     extract(psa(array('pane', 'visible', 'origin')));
     send_xml_response();
     if ($this->valid_token($pane) && preg_match('/^[a-z0-9_-]+$/i', $pane)) {
         set_pref("pane_{$pane}_visible", (int) ($visible === 'true'), $origin, PREF_HIDDEN, 'yesnoradio', 0, PREF_PRIVATE);
         return;
     }
     trigger_error('invalid_pane', E_USER_WARNING);
 }
예제 #2
0
function article_save_pane_state()
{
    global $event;
    $panes = array('textile_help', 'advanced', 'recent', 'more');
    $pane = gps('pane');
    if (in_array($pane, $panes)) {
        set_pref("pane_{$event}_{$pane}_visible", gps('visible') == 'true' ? '1' : '0', $event, PREF_HIDDEN, 'yesnoradio', 0, PREF_PRIVATE);
        send_xml_response();
    } else {
        send_xml_response(array('http-status' => '400 Bad Request'));
    }
}
예제 #3
0
function adminErrorHandler($errno, $errstr, $errfile, $errline)
{
    global $production_status, $theme, $event, $step;
    if (!error_reporting()) {
        return;
    }
    // When even a minimum environment is missing...
    if (!isset($production_status)) {
        echo '<pre>' . gTxt('internal_error') . ' "' . $errstr . '"' . n . "in {$errfile} at line {$errline}" . '</pre>';
        return;
    }
    if ($production_status == 'live' || $production_status != 'debug' && $errno == E_USER_NOTICE) {
        $backtrace = $msg = '';
    } else {
        $backtrace = '';
        $msg = gTxt('internal_error');
        if (has_privs('debug.verbose')) {
            $msg .= ' "' . $errstr . '"';
        }
        if ($production_status == 'debug') {
            if (has_privs('debug.backtrace')) {
                $msg .= n . "in {$errfile} at line {$errline}";
                $backtrace = join(n, get_caller(5, 1));
            }
        }
    }
    $httpstatus = in_array($errno, array(E_ERROR, E_USER_ERROR)) ? '500' : '200';
    $out = "{$msg}.\n{$backtrace}";
    if (http_accept_format('html')) {
        if (!empty($backtrace)) {
            echo "<pre>{$msg}.</pre>" . n . '<pre style="padding-left: 2em;" class="backtrace"><code>' . txpspecialchars($backtrace) . '</code></pre>';
        } elseif (!empty($msg)) {
            echo is_object($theme) ? $theme->announce(array($out, E_ERROR), true) : "<pre>{$out}</pre>";
        }
        $c = array('in' => '', 'out' => '');
    } elseif (http_accept_format('js')) {
        send_script_response(is_object($theme) && !empty($msg) ? $theme->announce_async(array($out, E_ERROR), true) : "/* {$out} */");
        $c = array('in' => '/* ', 'out' => ' */');
    } elseif (http_accept_format('xml')) {
        send_xml_response(array('http-status' => $httpstatus, 'internal_error' => "{$out}"));
        $c = array('in' => '<!-- ', 'out' => ' -->');
    } else {
        txp_die($msg, 500);
    }
    if ($production_status != 'live' && in_array($errno, array(E_ERROR, E_USER_ERROR))) {
        die($c['in'] . gTxt('get_off_my_lawn', array('{event}' => $event, '{step}' => $step)) . $c['out']);
    }
}
예제 #4
0
/**
 * Error handler for admin-side pages.
 *
 * @param   int    $errno
 * @param   string $errstr
 * @param   string $errfile
 * @param   int    $errline
 * @access  private
 * @package Debug
 */
function adminErrorHandler($errno, $errstr, $errfile, $errline)
{
    global $production_status, $theme, $event, $step;
    $error = array();
    if ($production_status == 'testing') {
        $error = array(E_WARNING => 'Warning', E_RECOVERABLE_ERROR => 'Catchable fatal error', E_USER_ERROR => 'User_Error', E_USER_WARNING => 'User_Warning');
    } elseif ($production_status == 'debug') {
        $error = array(E_WARNING => 'Warning', E_NOTICE => 'Notice', E_RECOVERABLE_ERROR => 'Catchable fatal error', E_USER_ERROR => 'User_Error', E_USER_WARNING => 'User_Warning', E_USER_NOTICE => 'User_Notice');
        if (!isset($error[$errno])) {
            $error[$errno] = $errno;
        }
    }
    if (!isset($error[$errno]) || !error_reporting()) {
        return;
    }
    // When even a minimum environment is missing.
    if (!isset($production_status)) {
        echo '<pre dir="auto">' . gTxt('internal_error') . ' "' . $errstr . '"' . n . "in {$errfile} at line {$errline}" . '</pre>';
        return;
    }
    $backtrace = '';
    if (has_privs('debug.verbose')) {
        $msg = $error[$errno] . ' "' . $errstr . '"';
    } else {
        $msg = gTxt('internal_error');
    }
    if ($production_status == 'debug' && has_privs('debug.backtrace')) {
        $msg .= n . "in {$errfile} at line {$errline}";
        $backtrace = join(n, get_caller(5, 1));
    }
    if ($errno == E_ERROR || $errno == E_USER_ERROR) {
        $httpstatus = 500;
    } else {
        $httpstatus = 200;
    }
    $out = "{$msg}.\n{$backtrace}";
    if (http_accept_format('html')) {
        if ($backtrace) {
            echo "<pre dir=\"auto\">{$msg}.</pre>" . n . '<pre class="backtrace" dir="ltr"><code>' . txpspecialchars($backtrace) . '</code></pre>';
        } elseif (is_object($theme)) {
            echo $theme->announce(array($out, E_ERROR), true);
        } else {
            echo "<pre dir=\"auto\">{$out}</pre>";
        }
    } elseif (http_accept_format('js')) {
        if (is_object($theme)) {
            send_script_response($theme->announce_async(array($out, E_ERROR), true));
        } else {
            send_script_response('/* ' . $out . '*/');
        }
    } elseif (http_accept_format('xml')) {
        send_xml_response(array('http-status' => $httpstatus, 'internal_error' => "{$out}"));
    } else {
        txp_die($msg, 500);
    }
}
예제 #5
0
function form_save_pane_state()
{
    global $event;
    $panes = array('article', 'category', 'comment', 'file', 'link', 'misc', 'section', 'article-tags', 'link-tags', 'comment-tags', 'comment-detail-tags', 'comment-form-tags', 'search-result-tags', 'file-tags', 'category-tags', 'section-tags');
    $pane = gps('pane');
    if (in_array($pane, $panes)) {
        set_pref("pane_form_{$pane}_visible", gps('visible') == 'true' ? '1' : '0', $event, PREF_HIDDEN, 'yesnoradio', 0, PREF_PRIVATE);
        send_xml_response();
    } else {
        trigger_error('invalid_pane', E_USER_WARNING);
    }
}
예제 #6
0
function page_save_pane_state()
{
    global $event;
    $panes = array('article-tags', 'article-nav-tags', 'nav-tags', 'xml-tags', 'misc-tags', 'file-tags');
    $pane = gps('pane');
    if (in_array($pane, $panes)) {
        set_pref("pane_page_{$pane}_visible", gps('visible') == 'true' ? '1' : '0', $event, PREF_HIDDEN, 'yesnoradio', 0, PREF_PRIVATE);
        send_xml_response();
    } else {
        trigger_error('invalid_pane', E_USER_WARNING);
    }
}
예제 #7
0
파일: txp_form.php 프로젝트: psic/websites
function form_save_pane_state()
{
    global $event;
    $panes = array('article', 'category', 'comment', 'file', 'link', 'misc', 'section', 'article-tags', 'link-tags', 'comment-tags', 'comment-detail-tags', 'comment-form-tags', 'search-result-tags', 'file-tags', 'category-tags', 'section-tags');
    $pane = gps('pane');
    if (in_array($pane, $panes)) {
        set_pref("pane_form_{$pane}_visible", gps('visible') == 'true' ? '1' : '0', $event, PREF_HIDDEN, 'yesnoradio', 0, PREF_PRIVATE);
        send_xml_response();
    } else {
        send_xml_response(array('http-status' => '400 Bad Request'));
    }
}
예제 #8
0
function page_save_pane_state()
{
    global $event;
    $panes = array('article-tags', 'article-nav-tags', 'nav-tags', 'xml-tags', 'misc-tags', 'file-tags');
    $pane = gps('pane');
    if (in_array($pane, $panes)) {
        set_pref("pane_page_{$pane}_visible", gps('visible') == 'true' ? '1' : '0', $event, PREF_HIDDEN, 'yesnoradio', 0, PREF_PRIVATE);
        send_xml_response();
    } else {
        send_xml_response(array('http-status' => '400 Bad Request'));
    }
}
예제 #9
0
function article_save_pane_state()
{
    global $event;
    $panes = array('textile_help', 'advanced', 'custom_field', 'image', 'meta', 'recent', 'comments', 'dates');
    $pane = gps('pane');
    if (in_array($pane, $panes)) {
        set_pref("pane_{$event}_{$pane}_visible", gps('visible') == 'true' ? '1' : '0', $event, PREF_HIDDEN, 'yesnoradio', 0, PREF_PRIVATE);
        send_xml_response();
    } else {
        trigger_error('invalid_pane', E_USER_WARNING);
    }
}
예제 #10
0
function smd_ebook_save_pane_state()
{
    $panes = array('smd_ebook_usrset', 'smd_ebook_pubset', 'smd_ebook_settings');
    $pane = gps('pane');
    if (in_array($pane, $panes)) {
        set_pref("pane_{$pane}_visible", gps('visible') === 'true' ? '1' : '0', 'smd_ebook', PREF_HIDDEN, 'yesnoradio', 0, PREF_PRIVATE);
        send_xml_response();
    } else {
        send_xml_response(array('http-status' => '400 Bad Request'));
    }
}