示例#1
0
文件: index.php 项目: kd2org/garradin
        try {
            $config->set('nom_asso', Utils::post('nom_asso'));
            $config->set('email_asso', Utils::post('email_asso'));
            $config->set('adresse_asso', Utils::post('adresse_asso'));
            $config->set('site_asso', Utils::post('site_asso'));
            $config->set('email_envoi_automatique', Utils::post('email_envoi_automatique'));
            $config->set('accueil_wiki', Utils::post('accueil_wiki'));
            $config->set('accueil_connexion', Utils::post('accueil_connexion'));
            $config->set('categorie_membres', Utils::post('categorie_membres'));
            $config->set('champ_identite', Utils::post('champ_identite'));
            $config->set('champ_identifiant', Utils::post('champ_identifiant'));
            $config->set('pays', Utils::post('pays'));
            $config->set('monnaie', Utils::post('monnaie'));
            $config->save();
            Utils::redirect('/admin/config/?ok');
        } catch (UserException $e) {
            $error = $e->getMessage();
        }
    }
}
$tpl->assign('error', $error);
$tpl->assign('garradin_version', garradin_version() . ' [' . (garradin_manifest() ?: 'release') . ']');
$tpl->assign('php_version', phpversion());
$v = \SQLite3::version();
$tpl->assign('sqlite_version', $v['versionString']);
$tpl->assign('pays', Utils::getCountryList());
$cats = new Membres\Categories();
$tpl->assign('membres_cats', $cats->listSimple());
$champs_liste = array_merge(['id' => ['title' => 'Numéro unique', 'type' => 'number']], $config->get('champs_membres')->getList());
$tpl->assign('champs', $champs_liste);
$tpl->display('admin/config/index.tpl');
示例#2
0
文件: init.php 项目: kd2org/garradin
function exception_handler($e)
{
    if ($e instanceof UserException || $e instanceof \KD2\MiniSkelMarkupException) {
        try {
            if (PHP_SAPI == 'cli') {
                echo $e->getMessage();
            } else {
                $tpl = Template::getInstance();
                $tpl->assign('error', $e->getMessage());
                $tpl->display('error.tpl');
            }
            exit;
        } catch (Exception $e) {
        }
    }
    $file = str_replace(ROOT, '', $e->getFile());
    $error = "Exception of type " . get_class($e) . " happened !\n\n" . $e->getCode() . " - " . $e->getMessage() . "\n\nIn: " . $file . ":" . $e->getLine() . "\n\n";
    if (!empty($_SERVER['HTTP_HOST']) && !empty($_SERVER['REQUEST_URI'])) {
        $error .= 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . "\n\n";
    }
    $error .= $e->getTraceAsString();
    $error .= "\n-------------\n";
    $error .= 'Garradin version: ' . garradin_version() . "\n";
    $error .= 'Garradin manifest: ' . garradin_manifest() . "\n";
    $error .= 'PHP version: ' . phpversion() . "\n";
    foreach ($_SERVER as $key => $value) {
        if (is_array($value)) {
            $value = json_encode($value);
        }
        $error .= $key . ': ' . $value . "\n";
    }
    $error = str_replace("\r", '', $error);
    error_log($error);
    if (MAIL_ERRORS) {
        mail(MAIL_ERRORS, '[Garradin] Erreur d\'exécution', $error, 'From: "' . WWW_URL . '" <*****@*****.**>');
    }
    if (PHP_SAPI == 'cli') {
        echo $error;
    } else {
        echo '<!DOCTYPE html><meta charset="utf-8" /><style type="text/css">body { font-family: sans-serif; } h3 { color: darkred; }
        pre { text-shadow: 2px 2px 5px black; color: darkgreen; font-size: 2em; float: left; margin: 0 1em 0 0; padding: 1em; background: #cfc; border-radius: 50px; }</style>
        <pre> \\__/<br /> (xx)<br />//||\\\\</pre>
        <h1>Erreur d\'exécution</h1>';
        if (SHOW_ERRORS) {
            echo '<p>Une erreur s\'est produite à l\'exécution de Garradin. Pour rapporter ce bug
            merci d\'inclure le message suivant :</p>
            <textarea cols="70" rows="' . substr_count($error, "\n") . '">' . htmlspecialchars($error, ENT_QUOTES, 'UTF-8') . '</textarea>
            <hr />
            <p><a href="http://dev.kd2.org/garradin/Rapporter%20un%20bug">Comment rapporter un bug</a></p>';
        } else {
            echo '<p>Une erreur s\'est produite à l\'exécution de Garradin.</p>
            <p>Le webmaster a été prévenu.</p>';
        }
    }
    exit;
}