} display_html_header(); display_document_header(); display_menu(); echo '<table width="90%">' . "\n"; echo '<tr><td align="center" class="naglowek">Pomoc - wyniki wyszukiwania<hr></td></tr>' . "\n"; echo '<tr><td class="naglowek_maly">Szukane wyra¿enie: ' . "'" . htmlspecialchars(stripslashes($_GET['search'])) . "'" . '. Oto rezultaty wyszukiwania:</td></tr>'; $results = help_search($final_condition); /* $results[i] = array ( 'question_id' => '...', 'category_id' => '...', 'label' => '...' ); */ echo '<tr><td>'; if ($results === false) { echo "B³±d bazy danych, spróbuj pó¼niej.\n"; } else { if (empty($results)) { echo "Nic nie znaleziono.\n"; } else { echo "<table>\n"; foreach ($results as $result) { echo '<tr><td class="help_question">' . $result['category_id'] . '.' . $result['question_id'] . '.</td>'; echo '<td><a href="' . get_www_root() . 'help/?category_id=' . $result['category_id'] . '&question_id=' . $result['question_id'] . '" class="help_question">' . htmlspecialchars($result['question']) . "</a></td></tr>\n"; } echo "</table>\n"; } } echo "</td></tr>\n"; echo "</table>\n"; display_document_footer();
echo '<form action="add_category.php" method="post">' . "\n"; echo '<tr><td><input type="text" name="label" value="' . $cat_label . '" maxlength="255" size="50">' . "\n"; if (isset($_GET['category_id'])) { echo '<input type="hidden" name="category_id" value="' . $_GET['category_id'] . '">' . "\n"; } echo '<input type="submit" value="Zatwierd¼"></td></tr>' . "\n"; echo "</form>\n"; if (isset($_GET['category_id'])) { echo '<tr><td class="naglowek_maly">Pytania w tej kategorii:</td></tr>' . "\n"; $questions = help_get_category_questions($_GET['category_id']); if ($questions === false) { echo '<tr><td>B³±d bazy danych, spróbuj pó¼niej.</td></tr>'; } else { if (empty($questions)) { echo '<tr><td>Brak pytañ.</td></tr>'; } else { echo "<table>\n"; foreach ($questions as $qsn_id => $qsn_label) { echo '<tr><td class="help_question">' . $_GET['category_id'] . '.' . $qsn_id . '.</td>'; echo '<td><a href="' . get_www_root() . 'help/?category_id=' . $_GET['category_id'] . '&question_id=' . $qsn_id . '" class="help_question">' . htmlspecialchars($qsn_label) . '</a></td>'; echo '<td>[<a href="add_question_form.php?category_id=' . $_GET['category_id'] . '&question_id=' . $qsn_id . '" class="menu">Edytuj</a>]</td></tr>' . "\n"; } echo "</table>\n"; } } } echo "</table>\n"; display_document_footer(); ?>
} echo '<table width="90%">' . "\n"; echo '<tr><td align="center" class="naglowek">'; if (isset($_GET['question_id'])) { echo 'Edytuj pytanie'; $qsn_details = help_get_question_details($_GET['category_id'], $_GET['question_id']); $question = htmlspecialchars($qsn_details['question']); $answer = htmlspecialchars($qsn_details['answer']); } else { echo 'Nowe pytanie'; $question = ''; $answer = ''; } echo "<hr></td></tr>\n"; echo '<form action="add_question.php" method="post">' . "\n"; echo '<input type="hidden" name="category_id" value="' . $_GET['category_id'] . '">' . "\n"; if (isset($_GET['question_id'])) { echo '<input type="hidden" name="question_id" value="' . $_GET['question_id'] . '">' . "\n"; } echo '<tr><td align="center"><table>' . "\n"; echo '<tr><td align="right" width="20%">Kategoria:</td><td align="left">'; echo ' <a href="' . get_www_root() . 'help/?category_id=' . $_GET['category_id'] . '" class="help_category">' . htmlspecialchars(help_get_category_label($_GET['category_id'])) . "</a></td></tr>\n"; echo '<tr><td align="right">Pytanie:</td>'; echo '<td align="left"><input type="text" name="question" value="' . $question . '" maxlength="255" size="70"></td></tr>' . "\n"; echo '<tr><td align="right" valign="top">Odpowied¼:</td>'; echo '<td align="left"><textarea name="answer" cols="70" rows="20">' . $answer . "</textarea></td></tr>\n"; echo '<tr><td colspan="2" align="center"><input type="submit" value="Zatwierd¼"></td></tr>' . "\n"; echo "</form>\n"; echo "</table></td></tr>\n"; echo "</table>\n"; display_document_footer();
<?php function get_www_root() { $path_array = explode('/', $_SERVER['PHP_SELF']); $path_array = array_reverse($path_array); $root_depth = 0; while (($folder = each($path_array)) && $folder['value'] != 'flip') { ++$root_depth; } $root_depth -= 1; $root = ''; for ($i = 0; $i < $root_depth; ++$i) { $root .= '../'; } return $root; } $root = get_www_root(); require_once $root . 'cfg/database.php'; require_once $root . 'lib/display.php'; require_once $root . 'lib/mysql.php'; require_once $root . 'lib/auth.php'; require_once $root . 'cfg/config.php';
function display_add_users_form($values) { ?> <table width="90%"> <tr> <td class="naglowek" align="center">Dodaj u¿ytkowników<hr></td> </tr> <form action="<?php echo get_www_root(); ?> admin/add_users.php" method="POST"> <tr> <td><table><tr> <td align="right" valign="top">Wymieñ loginy nowych u¿ytkowników:<br> <small>(w formacie imie.nazwisko, bez polskich znaków)</small></td> <td align="left" valign="top"><textarea name="users" cols="30" rows="20"><?php echo stripslashes($values['users']); ?> </textarea></td> </tr> </table> </td> </tr> <tr> <td align="center"><input type="submit" value="Dalej"></td> </tr> </form> </table> <?php }