gui->startup(); if (mjguest_basedir and $mjguest->settings->param['comment_system']): ob_start(); $mjguest->gui->block('insert'); $form = ob_get_clean(); endif; $mjguest->gui->block('reader_head'); if (!$mjguest->entry->get_set()) $mjguest->gui->redirect(1, 'guestbook_empty', 'do=write'); while ($mjguest->entry->get_each()) $mjguest->gui->block('reader_entry', true); $mjguest->gui->block('reader_foot'); if (mjguest_basedir and $mjguest->settings->param['comment_system']) echo $form; break; /* case 'redirect': $mjguest->gui->startup(); $mjguest->gui->block('redirect'); break; */ case 'delete': if (!empty($_GET['id']) and $mjguest->user->get('status') > 1) $mjguest->entry->cancel($_GET['id']); elseif (!empty($_GET['ip']) and $mjguest->user->get('status') == 3) $mjguest->entry->ban_guest($_GET['ip']); else $mjguest->gui->redirect(2, 'not_admin', 'do=setup'); $mjguest->gui->redirect(0, 'entry_deleted', "do=read&from={$_GET['from']}"); break; case 'edit': if ($mjguest->user->get('status') > 1 /* [CONTROLLO HACKER PER URL DIRETTO (no via icona)] or ([questa entry è appena stata scritta da questo user] entro lasso antiflood x questa entry AND user ha scritto questa entry) */ ): if (!empty($_POST)): if (trim($_POST['message'])): $mjguest->entry->update(); $mjguest->gui->redirect(0, 'entry_modified', "do=read&from={$_GET['from']}#e_{$_GET['id']}"); else: $mjguest->gui->redirect(1, 'entry_not_added', "do=read&from={$_GET['from']}#e_{$_GET['id']}"); endif; else: $mjguest->entry->get_one(); $mjguest->gui->startup(); $mjguest->gui->block('insert'); endif; else: $mjguest->gui->redirect(2, 'not_admin', 'do=setup'); endif; break; case 'write': if ($mjguest->user->get('status') == 1 and $mjguest->entry->check_flood($mjguest->user->get('ip'))) $mjguest->gui->redirect(1, 'already_signed', 'do=read&from=0'); elseif ($mjguest->user->get('status') == 1 and in_array($mjguest->user->get('ip'), $mjguest->settings->param['banned'])) $mjguest->gui->redirect(2, 'not_admin', 'do=read&from=0'); if (!empty($_POST)): if ($_POST['entrycode'] != $mjguest->user->get('entrycode')) $mjguest->gui->redirect(1, 'entry_not_added', 'do=write'); elseif ($mjguest->settings->param['captcha'] and ($mjguest->user->get('status') == 1 or mjguest_debugmode) and (md5((int)$_POST['captcha']) != $mjguest->user->get('captcha'))) $mjguest->gui->redirect(1, 'entry_not_added', 'do=write'); $mjguest->user->set('captcha'); $mjguest->user->set('entrycode'); if ($mjguest->entry->add()): if ($mjguest->user->get('status') == 1 and $mjguest->settings->param['notifynewentry']) tools::email($mjguest->settings->param['adminmail'].($mjguest->settings->param['mod_account']? ','.$mjguest->settings->param['modmail'] : ''), 'Nuovo messaggio nel Guestbook', ($_POST['name'] ? $_POST['name'] : 'Un ospite').' scrive: '.$mjguest->entry->detail['message']); #5.3 #tools::email($mjguest->settings->param['adminmail'].($mjguest->settings->param['mod_account']? ','.$mjguest->settings->param['modmail'] : ''), 'New guestbook entry', ($_POST['name'] ?: 'A guest').' wrote: '.$mjguest->entry->detail['message']); $mjguest->gui->redirect(0, 'entry_added', 'do=read&from=0'); else: $mjguest->gui->redirect(1, 'entry_not_added', 'do=write'); endif; else: $mjguest->user->set('captcha'); $mjguest->user->set('entrycode'); $mjguest->gui->startup(); $mjguest->gui->block('insert'); endif; break; case 'reply': if ($mjguest->user->get('status') > 1): if (!empty($_POST)): $mjguest->entry->reply(); $mjguest->gui->redirect(0, 'entry_modified', "do=read&from={$_GET['from']}#e_{$_GET['id']}"); else: $mjguest->entry->get_one(); $mjguest->gui->startup(); $mjguest->gui->block('insert'); endif; else: $mjguest->gui->redirect(2, 'not_admin', 'do=setup'); endif; break; case 'approve': if ($mjguest->user->get('status') > 1): $mjguest->entry->approve(); $mjguest->gui->redirect(0, 'entry_modified', "do=read&from={$_GET['from']}#e_{$_GET['id']}"); else: $mjguest->gui->redirect(2, 'not_admin', 'do=setup'); endif; break; case 'setup': if ($mjguest->user->get('status') > 1): if (!empty($_POST)): if (isset($_POST['logout'])): $mjguest->user->disconnect(); $mjguest->gui->redirect(0, 'logged_out', 'do=read&from=0'); else: if (isset($_POST['trashdata'])) $mjguest->entry->trash(); ( isset($_POST['restoreconfig']) ? $mjguest->settings->restore() : $mjguest->settings->update() ) ? $mjguest->gui->redirect(0, 'config_updated', 'do=setup') : $mjguest->gui->redirect(2, 'not_admin', 'do=read&from=0'); endif; else: $mjguest->gui->startup(); ($mjguest->user->get('status') == 2 and $mjguest->settings->param['mod_account']) ? $mjguest->gui->block('cp_mod') : $mjguest->gui->block('cp_admin') ; endif; else: if (!empty($_POST)): if ($mjguest->user->authorize()): $mjguest->gui->redirect(0, 'logged_in', 'do=setup'); else: $mjguest->gui->redirect(2, 'wrong_pass', 'do=read&from=0'); endif; else: $mjguest->gui->redirect(2, 'not_admin', 'do=read&from=0'); endif; endif; break; default: $mjguest->gui->redirect(2, 'not_admin', 'do=read&from=0'); endswitch; #----- Send everything to the browser -----# $mjguest->gui->output(); #----- If we are debugging, we can print some useful info -----# if (mjguest_debugmode): echo '
', print_r($_SESSION), '', 'Dati $_POST:
', print_r($_POST), '', 'Dati $_FILES:
', print_r($_FILES), '', 'Dati $_COOKIE (Key: ',(!empty($_COOKIE['mjguest']) ? print_r($_COOKIE['mjguest']['key']) : ''),'):
',(!empty($_COOKIE['mjguest']) ? print_r($_COOKIE['mjguest']['data']) : ''), '', 'Errori PHP soppressi: ', @$php_errormsg, '
', print_r(@debug_backtrace()), '