function spam_show_clicker($id, $type) { //KOlla om användaren redan rapporterat $current_reported = 0; //Om man är inloggad if (isset($_SESSION[PREFIX . 'user_id']) && user_get_admin($_SESSION[PREFIX . 'user_id']) < 2) { $sql = "SELECT id FROM " . PREFIX . "spam WHERE type='" . sql_safe($type) . "' AND spam_id=" . sql_safe($id) . " AND user="******";"; } else { if (isset($_SESSION[PREFIX . 'user_id']) && user_get_admin($_SESSION[PREFIX . 'user_id']) > 1) { $sql = "SELECT COUNT(id) as nr FROM " . PREFIX . "spam WHERE type='" . sql_safe($type) . "' AND spam_id=" . sql_safe($id) . ";"; // echo "<br />DEBUG0949: $sql"; if ($ss = mysql_query($sql)) { if ($s = mysql_fetch_array($ss)) { $current_reported_admin = $s['nr']; } } } else { $sql = "SELECT id FROM " . PREFIX . "spam WHERE type='" . sql_safe($type) . "' AND spam_id=" . sql_safe($id) . " AND IP='" . sql_safe($_SERVER['REMOTE_ADDR']) . "';"; } } // echo "<br />DEBUG1717: $sql"; if ($ss = mysql_query($sql)) { $current_reported = mysql_affected_rows(); } echo "<form method=\"post\">\n\t<input type=\"hidden\" name=\"type\" value=\"{$type}\">"; if (isset($_SESSION[PREFIX . 'user_id']) && user_get_admin($_SESSION[PREFIX . 'user_id']) > 1) { echo "<input type=\"hidden\" name=\"id[]\" value=\"{$id}\">"; if (isset($current_reported_admin) && $current_reported_admin > 0) { //Den här har markerats som spam av andra echo "<input type=\"submit\" class=\"spambutton red\" name=\"this_is_spam\" value=\"Mark as spam ({$current_reported_admin})\">"; } else { echo "<input type=\"submit\" class=\"spambutton\" name=\"this_is_spam\" value=\"Mark as spam\">"; } } else { echo "<input type=\"hidden\" name=\"id\" value=\"{$id}\">"; if ($current_reported < 1) { echo "<input type=\"submit\" class=\"spambutton\" name=\"this_is_spam\" value=\"Report as spam\">"; } else { echo "<input type=\"submit\" class=\"spambutton\" name=\"this_is_not_spam\" value=\"Reported as spam (click to unreport)\">"; } } echo "</form>"; }
function comment_display_author_text($comment_id) { $sql = "SELECT user, nick, email, url, added FROM " . PREFIX . "comment WHERE id=" . sql_safe($comment_id) . ";"; if ($cc = mysql_query($sql)) { if ($c = mysql_fetch_assoc($cc)) { $comment_time = date("Y-m-d H:i", strtotime($c['added'])); $comment_link = comment_get_link($comment_id); $user_link = NULL; if ($c['user'] !== NULL) { $user_name = user_get_name($c['user']); $user_link = user_get_link($c['user']); } else { if ($c['nick'] !== NULL) { $user_name = $c['nick']; $user_link = "<a href=\"" . $c['url'] . "\">" . $user_name . "</a>"; } } //Kolla om författaren är admin if (user_get_admin($c['user']) > 1) { $admin = " " . _("(Admin)"); } else { $admin = ""; } if (!isset($user_name)) { echo sprintf(_("Posted at <a href=\"%s\">%s</a>"), $comment_link, $comment_time); } else { if ($user_link == NULL) { echo sprintf(_("Posted by %s%s at <a href=\"%s\">%s</a>"), $user_name, $admin, $comment_link, $comment_time); } else { echo sprintf(_("Posted by %s%s at <a href=\"%s\">%s</a>"), $user_link, $admin, $comment_link, $comment_time); } } } } }
function user_display_settings() { login_check_logged_in_mini(); if (isset($_GET['user'])) { if (user_get_admin($_SESSION[PREFIX . "user_id"]) && user_exists($_GET['user'])) { $user_id = $_GET['user']; } } else { $user_id = $_SESSION[PREFIX . "user_id"]; } if (!$user_id) { echo "<div class=\"message_box error well\">No valid user</div>"; } else { echo "<h1>" . sprintf(_("Settings for %s"), user_get_name($user_id)) . "</h1>"; echo '<form method="post">'; //Username echo '<div class="form-group"> <label for="username_input">' . _("Username") . '</label> <input type="text" name="username" id="username_input" placeholder="' . _("Username") . '" class="form-control" value="' . user_get_name($user_id) . '"> </div>'; //email echo '<div class="form-group"> <label for="email_input">' . _("Email") . '</label> <input type="text" name="email" id="email_input" placeholder="' . _("Email") . '" class="form-control" value="' . user_get_email($user_id) . '"> </div>'; //password echo '<div class="form-group"> <label for="password_input">' . _("Password") . '</label> <input type="password" name="password" id="password_input" placeholder="' . _("Password") . '" class="form-control"> </div>'; //Flattr id echo '<div class="form-group"> <label for="flattr_id_input">' . _("Flattr id") . '</label> <input type="text" name="flattr_id" id="flattr_id_input" placeholder="' . _("Flattr id") . '" class="form-control" value="' . flattr_get_flattrID($user_id) . '"> </div>'; //Flattr choice // echo "<pre>".print_r(flattr_get_flattr_choice($user_id, "comment"),1)."</pre>"; echo '<div class="checkbox">'; echo '<label> <input type="checkbox" name="flattr_choice[]" value="comment"'; if (flattr_get_flattr_choice($user_id, "comment")) { echo ' checked'; } echo '> ' . sprintf(_("Display Flattr-button on <strong>%s</strong>"), _("comments")) . ' </label>'; echo '</div>'; echo '<div class="checkbox">'; echo '<label> <input type="checkbox" name="flattr_choice[]" value="feedback"'; if (flattr_get_flattr_choice($user_id, "feedback")) { echo ' checked'; } echo '> ' . sprintf(_("Display Flattr-button on <strong>%s</strong>"), _("feedbacks")) . ' </label>'; echo '</div>'; if (defined('CUSTOM_SETTINGS')) { $custom_settings = unserialize(CUSTOM_SETTINGS); if (isset($custom_settings['flattr'])) { foreach ($custom_settings['flattr'] as $custom_flattr_choice => $translation) { user_setting_flattr_display($user_id, $custom_flattr_choice, $translation); } } } //Save button echo '<input type="submit" class="btn btn-success" value="' . _("Save") . '" name="user_update_settings">'; echo '</form>'; } }