Пример #1
0
function forum_links_get_links()
{
    if (!($db = db::get())) {
        return false;
    }
    if (!($table_prefix = get_table_prefix())) {
        return false;
    }
    $forum_links_top_link = forum_get_setting('forum_links_top_link', null, gettext("Forum Links"));
    $sql = "SELECT LID, TITLE, URI FROM `{$table_prefix}FORUM_LINKS` ";
    $sql .= "ORDER BY POS ASC";
    if (!($result = $db->query($sql))) {
        return false;
    }
    if ($result->num_rows == 0) {
        return false;
    }
    $links_array = array($forum_links_top_link);
    while ($forum_links_data = $result->fetch_assoc()) {
        if (!isset($forum_links_data['TITLE']) || strlen(trim($forum_links_data['TITLE'])) < 1) {
            $forum_links_data['TITLE'] = '-';
        }
        if (!isset($forum_links_data['URI']) || strlen(trim($forum_links_data['URI'])) < 1) {
            $links_array[$forum_links_data['LID']] = $forum_links_data['TITLE'];
        } else {
            $forum_links_data['URI'] = href_cleanup_query_keys($forum_links_data['URI']);
            $links_array[$forum_links_data['URI']] = $forum_links_data['TITLE'];
        }
    }
    return $links_array;
}
Пример #2
0
 public function __construct($num_chars = 6, $min_char_size = 15, $max_char_size = 25, $noise_factor = 9, $max_rotation = 30)
 {
     if (!is_numeric($num_chars)) {
         $num_chars = 6;
     }
     if (!is_numeric($min_char_size)) {
         $min_char_size = 20;
     }
     if (!is_numeric($max_char_size)) {
         $max_char_size = 40;
     }
     if (!is_numeric($noise_factor)) {
         $noise_factor = 9;
     }
     if (!is_numeric($max_rotation)) {
         $max_rotation = 30;
     }
     $this->num_chars = $num_chars;
     $this->min_char_size = $min_char_size;
     $this->max_char_size = $max_char_size;
     $this->max_rotation = $max_rotation;
     $this->key = forum_get_setting('text_captcha_key');
     $this->image_x = ($num_chars + 1) * (int) (($this->max_char_size + $this->min_char_size) / 1.5);
     $this->image_y = (int) (2.4 * $this->max_char_size);
     if (($text_captcha_dir = forum_get_setting('text_captcha_dir', 'strlen', false)) !== false) {
         $this->text_captcha_dir = rtrim($text_captcha_dir, '/');
     }
     if ($noise_factor > 0) {
         $this->noise_factor = $noise_factor;
         $this->noise_level = $num_chars * $noise_factor;
     } else {
         $this->noise_factor = 0;
         $this->noise_level = 0;
     }
 }
Пример #3
0
function sfs_check_banned($user_data, &$cached_response = false)
{
    if (forum_get_setting('sfs_enabled', 'N')) {
        return false;
    }
    $request = array('f' => 'json');
    if (isset($user_data['IPADDRESS']) && strlen(trim($user_data['IPADDRESS'])) > 0) {
        $request['ip'] = ipv6_to_ipv4($user_data['IPADDRESS']);
    }
    if (!isset($user_data['UID']) || $user_data['UID'] > 0) {
        if (isset($user_data['LOGON']) && strlen(trim($user_data['LOGON'])) > 0) {
            $request['username'] = $user_data['LOGON'];
        }
        if (isset($user_data['EMAIL']) && strlen(trim($user_data['EMAIL'])) > 0) {
            $request['email'] = $user_data['EMAIL'];
        }
    }
    if (sizeof($request) < 2) {
        return false;
    }
    $ban_type_array = array('ip' => BAN_TYPE_IP, 'username' => BAN_TYPE_LOGON, 'email' => BAN_TYPE_EMAIL);
    $sfs_api_url_array = parse_url(forum_get_setting('sfs_api_url', null, 'http://www.stopforumspam.com/api'));
    $sfs_api_url_array['query'] = http_build_query($request, false, '&');
    $sfs_api_url = build_url_str($sfs_api_url_array);
    $sfs_api_url_md5 = md5($sfs_api_url);
    $min_confidence = forum_get_setting('sfs_min_confidence', null, 75);
    $response_confidence = 0;
    $cached_response = false;
    try {
        if (!($response = sfs_cache_get($sfs_api_url_md5, $cached_response))) {
            $curl = curl_init($sfs_api_url);
            curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, 500);
            curl_setopt($curl, CURLOPT_TIMEOUT_MS, 500);
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
            $response = json_decode(curl_exec($curl), true);
        }
        if (!isset($response['success']) || $response['success'] != 1) {
            return false;
        }
        if (!$cached_response) {
            sfs_cache_put($sfs_api_url_md5, $response);
        }
        foreach (array_keys($ban_type_array) as $key) {
            if (!isset($response[$key]['confidence'])) {
                continue;
            }
            $response_confidence += $response[$key]['confidence'];
        }
        $response_confidence = $response_confidence / (count($request) - 1);
    } catch (Exception $e) {
        return false;
    }
    return $response_confidence > $min_confidence;
}
Пример #4
0
function sphinx_search_connect()
{
    if (!($sphinx_search_host = forum_get_setting('sphinx_search_host'))) {
        return false;
    }
    if (!($sphinx_search_port = forum_get_setting('sphinx_search_port', 'is_numeric', false))) {
        return false;
    }
    try {
        return mysqli_connect($sphinx_search_host, null, null, null, $sphinx_search_port);
    } catch (Exception $e) {
        return false;
    }
}
Пример #5
0
function sfs_check_banned($user_data, &$cached_response = false)
{
    if (forum_get_setting('sfs_enabled', 'N')) {
        return false;
    }
    $request = array('f' => 'json');
    if (isset($user_data['IPADDRESS']) && strlen(trim($user_data['IPADDRESS'])) > 0) {
        $request['ip'] = $user_data['IPADDRESS'];
    }
    if (!isset($user_data['UID']) || $user_data['UID'] > 0) {
        if (isset($user_data['LOGON']) && strlen(trim($user_data['LOGON'])) > 0) {
            $request['username'] = $user_data['LOGON'];
        }
        if (isset($user_data['EMAIL']) && strlen(trim($user_data['EMAIL'])) > 0) {
            $request['email'] = $user_data['EMAIL'];
        }
    }
    if (sizeof($request) < 2) {
        return false;
    }
    $ban_type_array = array('ip' => BAN_TYPE_IP, 'username' => BAN_TYPE_LOGON, 'email' => BAN_TYPE_EMAIL);
    $sfs_api_url_array = parse_url(forum_get_setting('sfs_api_url', null, 'http://www.stopforumspam.com/api'));
    $sfs_api_url_array['query'] = http_build_query($request, false, '&');
    $sfs_api_url = build_url_str($sfs_api_url_array);
    $sfs_api_url_md5 = md5($sfs_api_url);
    $min_confidence = forum_get_setting('sfs_min_confidence', null, 75);
    $response_confidence = 0;
    try {
        if (!($response = sfs_cache_get($sfs_api_url_md5, $cached_response))) {
            $context = stream_context_create(array('http' => array('timeout' => 1)));
            $response = json_decode(file_get_contents($sfs_api_url, null, $context), true);
        }
        sfs_cache_put($sfs_api_url_md5, $response);
        if (!isset($response['success']) || $response['success'] != 1) {
            return false;
        }
        foreach (array_keys($ban_type_array) as $key) {
            if (!isset($response[$key]['confidence'])) {
                continue;
            }
            $response_confidence += $response[$key]['confidence'];
        }
        $response_confidence = $response_confidence / (count($request) - 1);
    } catch (Exception $e) {
        return false;
    }
    return $response_confidence > $min_confidence;
}
Пример #6
0
function form_check_csrf_token()
{
    if (!isset($_SERVER['REQUEST_METHOD']) || mb_strtoupper($_SERVER['REQUEST_METHOD']) !== 'POST') {
        return;
    }
    if (in_array(basename($_SERVER['PHP_SELF']), get_csrf_exempt_files()) || defined('BH_DISABLE_CSRF')) {
        return;
    }
    if (!($token_name = forum_get_setting('csrf_token_name'))) {
        html_draw_error(gettext('Sorry, you do not have access to this page.'));
    }
    if (!isset($_POST[$token_name]) || $_POST[$token_name] != session::get_csrf_token()) {
        unset($_POST[$token_name]);
        session::refresh_csrf_token();
        html_draw_error(gettext('Sorry, you do not have access to this page.'));
    }
    unset($_POST[$token_name]);
}
Пример #7
0
function word_filter_get_by_uid($uid)
{
    if (!is_numeric($uid)) {
        return false;
    }
    if (!($user_prefs = user_get_prefs($uid))) {
        return false;
    }
    static $word_filter_array = array();
    if (!isset($word_filter_array[$uid])) {
        $word_filter_array[$uid] = array();
        if (isset($user_prefs['USE_ADMIN_FILTER']) && $user_prefs['USE_ADMIN_FILTER'] == 'Y' || forum_get_setting('force_word_filter', 'Y')) {
            word_filter_get(0, $word_filter_array[$uid]);
        }
        if (isset($user_prefs['USE_WORD_FILTER']) && $user_prefs['USE_WORD_FILTER'] == 'Y') {
            word_filter_get($uid, $word_filter_array[$uid]);
        }
    }
    return word_filter_prepare($word_filter_array[$uid]);
}
Пример #8
0
function image_resize($src, $dest, $max_width = 150, $max_height = 150)
{
    // Check attachment thumbnails are enabled.
    if (forum_get_setting('attachment_thumbnails', 'N')) {
        return false;
    }
    // Get the thumbnail method.
    $attachment_thumbnail_method = forum_get_setting('attachment_thumbnail_method');
    // Different function for each method.
    switch ($attachment_thumbnail_method) {
        // Use external ImageMagick binary.
        case ATTACHMENT_THUMBNAIL_IMAGEMAGICK:
            return image_resize_imagemagick($src, $dest, $max_width, $max_height);
            break;
            // Use PHP's GD image library.
        // Use PHP's GD image library.
        default:
            return image_resize_gd($src, $dest, $max_width, $max_height);
            break;
    }
}
Пример #9
0
function sphinx_search_connect()
{
    if (!($sphinx_search_host = forum_get_setting('sphinx_search_host'))) {
        return false;
    }
    if (!($sphinx_search_port = forum_get_setting('sphinx_search_port', 'is_numeric', false))) {
        return false;
    }
    if (!($sphinx = mysqli_init())) {
        return false;
    }
    if (!$sphinx->options(MYSQLI_OPT_CONNECT_TIMEOUT, 2)) {
        return false;
    }
    if (!$sphinx->real_connect($sphinx_search_host, null, null, null, $sphinx_search_port)) {
        return false;
    }
    if (mysqli_connect_error()) {
        return false;
    }
    return $sphinx;
}
Пример #10
0
function lang_init()
{
    $available_languages = lang_get_available(false);
    if (isset($_SESSION['LANGUAGE']) && in_array($_SESSION['LANGUAGE'], $available_languages)) {
        $language = $_SESSION['LANGUAGE'];
    } else {
        if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
            $language = locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']);
        }
    }
    if (!isset($language)) {
        $language = forum_get_setting('default_language', 'strlen', 'en_GB');
    }
    $languages = array($language . '.utf8', $language . '.UTF8', $language . '.utf-8', $language . '.UTF-8', $language);
    setlocale(LC_ALL, $languages);
    putenv('LC_ALL=' . $language);
    putenv('LANG=' . $language);
    putenv('LANGUAGE=' . $language);
    bindtextdomain('messages', realpath(BH_INCLUDE_PATH . 'locale'));
    bind_textdomain_codeset('messages', 'UTF-8');
    textdomain('messages');
}
Пример #11
0
echo "                                          </tr>\n";
echo "                                        </table>\n";
echo "                                      </td>\n";
echo "                                    </tr>\n";
echo "                                  </table>\n";
echo "                                </div>\n";
echo "                              </td>\n";
echo "                            </tr>\n";
echo "                            <tr>\n";
echo "                              <td align=\"left\">&nbsp;</td>\n";
echo "                            </tr>\n";
echo "                            <tr>\n";
echo "                              <td align=\"left\">\n";
echo "                                ", form_submit("post", gettext("Post")), "&nbsp;", form_submit("preview_poll", gettext("Preview")), "&nbsp;", form_submit("preview_form", gettext("Preview Voting Form"));
echo "&nbsp;<a href=\"discussion.php?webtag={$webtag}\" class=\"button\" target=\"_self\"><span>", gettext("Cancel"), "</span></a>";
if (forum_get_setting('attachments_enabled', 'Y')) {
    echo "&nbsp;<a href=\"attachments.php?webtag={$webtag}&amp;aid={$aid}\" class=\"button popup 660x500\" id=\"attachments\"><span>", gettext("Attachments"), "</span></a>\n";
    echo "                                        ", form_input_hidden("aid", htmlentities_array($aid)), "\n";
}
echo "                              </td>\n";
echo "                            </tr>\n";
echo "                          </table>\n";
echo "                        </td>\n";
echo "                      </tr>\n";
echo "                    </table>\n";
echo "                  </td>\n";
echo "                </tr>\n";
echo "                <tr>\n";
echo "                  <td align=\"left\">&nbsp;</td>\n";
echo "                </tr>\n";
echo "              </table>\n";
Пример #12
0
echo "                        </td>\n";
echo "                      </tr>\n";
echo "                      <tr>\n";
echo "                        <td align=\"left\">\n";
echo form_submit("post", gettext("Post"), "tabindex=\"2\""), "\n";
echo form_submit("preview", gettext("Preview"), "tabindex=\"3\""), "\n";
if (isset($_POST['t_tid']) && is_numeric($_POST['t_tid']) && isset($_POST['t_rpid']) && is_numeric($_POST['t_rpid'])) {
    echo "<a href=\"discussion.php?webtag={$webtag}&amp;msg={$_POST['t_tid']}.{$_POST['t_rpid']}\" class=\"button\" target=\"_self\"><span>", gettext("Cancel"), "</span></a>\n";
} else {
    if (isset($_GET['replyto']) && validate_msg($_GET['replyto'])) {
        echo "<a href=\"discussion.php?webtag={$webtag}&amp;msg={$_GET['replyto']}\" class=\"button\" target=\"_self\"><span>", gettext("Cancel"), "</span></a>\n";
    } else {
        echo "<a href=\"discussion.php?webtag={$webtag}\" class=\"button\" target=\"_self\"><span>", gettext("Cancel"), "</span></a>\n";
    }
}
if (forum_get_setting('attachments_enabled', 'Y') && (session::check_perm(USER_PERM_POST_ATTACHMENTS | USER_PERM_POST_READ, $t_fid) || $new_thread)) {
    echo "<a href=\"attachments.php?aid={$aid}\" class=\"button popup 660x500\" id=\"attachments\"><span>", gettext("Attachments"), "</span></a>\n";
    echo form_input_hidden("aid", htmlentities_array($aid));
}
if ($allow_sig == true) {
    echo "                        </td>\n";
    echo "                      </tr>\n";
    echo "                      <tr>\n";
    echo "                        <td align=\"left\">&nbsp;</td>\n";
    echo "                      </tr>\n";
    echo "                      <tr>\n";
    echo "                        <td align=\"left\">\n";
    echo "                          <table class=\"messagefoot\" width=\"553\" cellspacing=\"0\">\n";
    echo "                            <tr>\n";
    echo "                              <td align=\"left\" class=\"subhead\">", gettext("Signature"), "</td>\n";
    if (($page_prefs & POST_SIGNATURE_DISPLAY) > 0) {
Пример #13
0
if (session::check_perm(USER_PERM_ADMIN_TOOLS, 0, 0) && sizeof($admin_user_array['user_array']) > 0) {
    echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"86%\">\n";
    echo "    <tr>\n";
    echo "      <td align=\"left\">\n";
    echo "        <table class=\"box\" width=\"100%\">\n";
    echo "          <tr>\n";
    echo "            <td align=\"left\" class=\"posthead\">\n";
    echo "              <table width=\"100%\">\n";
    echo "                <tr>\n";
    echo "                  <td class=\"subhead\" align=\"left\">", gettext("Options"), "</td>\n";
    echo "                </tr>\n";
    echo "                <tr>\n";
    echo "                  <td align=\"center\">\n";
    echo "                    <table class=\"posthead\" width=\"95%\">\n";
    echo "                      <tr>\n";
    if (forum_get_setting('require_user_approval', 'Y')) {
        echo "                        <td align=\"left\" valign=\"top\" style=\"white-space: nowrap\">", gettext("With selected"), ":&nbsp;</td>\n";
        echo "                        <td align=\"left\" valign=\"top\" style=\"white-space: nowrap\" width=\"100%\">", form_dropdown_array("action", array(-1 => '&nbsp;', ADMIN_USER_OPTION_END_SESSION => gettext("End Session (Kick)"), ADMIN_USER_OPTION_APPROVE => gettext("Approve")), false, false, 'bhlogondropdown'), "&nbsp;", form_submit("select_action", gettext("Go")), "</td>\n";
    } else {
        echo "                        <td align=\"left\" valign=\"top\" style=\"white-space: nowrap\">", gettext("With selected"), ":&nbsp;</td>\n";
        echo "                        <td align=\"left\" valign=\"top\" style=\"white-space: nowrap\" width=\"100%\">", form_dropdown_array("action", array(-1 => '&nbsp;', ADMIN_USER_OPTION_END_SESSION => gettext("End Session (Kick)")), false, false, 'bhlogondropdown'), "&nbsp;", form_submit("select_action", gettext("Go")), "</td>\n";
    }
    echo "                      </tr>\n";
    echo "                    </table>\n";
    echo "                  </td>\n";
    echo "                </tr>\n";
    echo "                <tr>\n";
    echo "                  <td align=\"left\" colspan=\"6\">&nbsp;</td>\n";
    echo "                </tr>\n";
    echo "              </table>\n";
    echo "            </td>\n";
Пример #14
0
 echo "        <table class=\"box\" width=\"100%\">\n";
 echo "          <tr>\n";
 echo "            <td align=\"left\" class=\"posthead\">\n";
 echo "              <table class=\"posthead\" width=\"100%\">\n";
 echo "                <tr>\n";
 echo "                  <td align=\"left\" class=\"subhead\">", gettext("Options"), "</td>\n";
 echo "                </tr>\n";
 echo "              </table>\n";
 echo "              <table class=\"posthead\" width=\"100%\">\n";
 echo "                <tr>\n";
 echo "                  <td align=\"center\">\n";
 echo "                    <table class=\"posthead\" width=\"95%\">\n";
 echo "                      <tr>\n";
 echo "                        <td align=\"left\">", form_checkbox("use_word_filter", "Y", gettext("Enable word filter."), session::get_value('USE_WORD_FILTER') == 'Y'), "</td>\n";
 echo "                      </tr>\n";
 if (!forum_get_setting('force_word_filter', 'Y')) {
     echo "                      <tr>\n";
     echo "                        <td align=\"left\">", form_checkbox("use_admin_filter", "Y", gettext("Include admin word filter in my list."), session::get_value('USE_ADMIN_FILTER') == 'Y'), "</td>\n";
     echo "                      </tr>\n";
 }
 echo "                      <tr>\n";
 echo "                        <td align=\"left\">&nbsp;</td>\n";
 echo "                      </tr>\n";
 echo "                    </table>\n";
 echo "                  </td>\n";
 echo "                </tr>\n";
 echo "              </table>\n";
 echo "            </td>\n";
 echo "          </tr>\n";
 echo "        </table>\n";
 echo "      </td>\n";
Пример #15
0
function stats_get_most_downloaded_attachment()
{
    if (!($db = db::get())) {
        return false;
    }
    if (!($table_prefix = get_table_prefix())) {
        return false;
    }
    if (!($attachment_dir = forum_get_setting('attachment_dir'))) {
        return false;
    }
    if (!($forum_fid = get_forum_fid())) {
        return false;
    }
    $sql = "SELECT PAI.TID, PAI.PID, PAF.AID, PAF.HASH, PAF.FILENAME, ";
    $sql .= "PAF.MIMETYPE, PAF.DOWNLOADS FROM POST_ATTACHMENT_FILES PAF ";
    $sql .= "LEFT JOIN POST_ATTACHMENT_IDS PAI ON (PAI.AID = PAF.AID) ";
    $sql .= "WHERE PAI.FID = '{$forum_fid}' ";
    $sql .= "ORDER BY PAF.DOWNLOADS DESC ";
    if (!($result = $db->query($sql))) {
        return false;
    }
    while ($attachment_data = $result->fetch_assoc()) {
        if (@file_exists("{$attachment_dir}/{$attachment_data['HASH']}")) {
            if (@file_exists("{$attachment_dir}/{$attachment_data['HASH']}.thumb")) {
                $filesize = filesize("{$attachment_dir}/{$attachment_data['HASH']}");
                $filesize += filesize("{$attachment_dir}/{$attachment_data['HASH']}.thumb");
                return array("msg" => sprintf("%s.%s", $attachment_data['TID'], $attachment_data['PID']), "filename" => rawurldecode($attachment_data['FILENAME']), "filedate" => filemtime("{$attachment_dir}/{$attachment_data['HASH']}"), "filesize" => $filesize, "aid" => $attachment_data['AID'], "hash" => $attachment_data['HASH'], "mimetype" => $attachment_data['MIMETYPE'], "downloads" => $attachment_data['DOWNLOADS']);
            } else {
                return array("msg" => sprintf("%s.%s", $attachment_data['TID'], $attachment_data['PID']), "filename" => rawurldecode($attachment_data['FILENAME']), "filedate" => filemtime("{$attachment_dir}/{$attachment_data['HASH']}"), "filesize" => filesize("{$attachment_dir}/{$attachment_data['HASH']}"), "aid" => $attachment_data['AID'], "hash" => $attachment_data['HASH'], "mimetype" => $attachment_data['MIMETYPE'], "downloads" => $attachment_data['DOWNLOADS']);
            }
        }
    }
    return false;
}
Пример #16
0
    echo "        </table>\n";
    echo "      </td>\n";
    echo "    </tr>\n";
    echo "  </table>\n";
    echo "  <br />\n";
}
if (forum_check_webtag_available($webtag)) {
    echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"600\">\n";
    echo "    <tr>\n";
    echo "      <td align=\"left\">\n";
    echo "        <table class=\"box\" width=\"100%\">\n";
    echo "          <tr>\n";
    echo "            <td align=\"left\" class=\"posthead\">\n";
    echo "              <table class=\"posthead\" width=\"100%\">\n";
    echo "                <tr>\n";
    echo "                  <td align=\"left\" class=\"subhead\" colspan=\"1\">", sprintf(gettext("User Status for %s"), forum_get_setting('forum_name', null, 'A Beehive Forum')), "</td>\n";
    echo "                </tr>\n";
    echo "                <tr>\n";
    echo "                  <td align=\"center\">\n";
    echo "                    <table class=\"posthead\" width=\"90%\">\n";
    if (session::check_perm(USER_PERM_ADMIN_TOOLS, 0)) {
        echo "                      <tr>\n";
        echo "                        <td align=\"left\">", form_checkbox("t_admintools", USER_PERM_ADMIN_TOOLS, gettext("User has access to forum admin tools"), $user_perms & USER_PERM_ADMIN_TOOLS), "</td>\n";
        echo "                      </tr>\n";
    }
    echo "                      <tr>\n";
    echo "                        <td align=\"left\">", form_checkbox("t_globalmod", USER_PERM_FOLDER_MODERATE, gettext("User can moderate all folders"), $user_perms & USER_PERM_FOLDER_MODERATE), "</td>\n";
    echo "                      </tr>\n";
    echo "                      <tr>\n";
    echo "                        <td align=\"left\">", form_checkbox("t_linksmod", USER_PERM_LINKS_MODERATE, gettext("User can moderate Links section"), $user_perms & USER_PERM_LINKS_MODERATE), "</td>\n";
    echo "                      </tr>\n";
Пример #17
0
echo "    <tr>\n";
echo "      <td align=\"left\">\n";
echo "        <table class=\"box\" width=\"100%\">\n";
echo "          <tr>\n";
echo "            <td align=\"left\" class=\"posthead\">\n";
echo "              <table width=\"100%\">\n";
echo "                <tr>\n";
echo "                  <td class=\"subhead\" align=\"left\">", gettext("Options"), "</td>\n";
echo "                </tr>\n";
echo "                <tr>\n";
echo "                  <td align=\"center\">\n";
echo "                    <table class=\"posthead\" width=\"95%\">\n";
echo "                      <tr>\n";
echo "                        <td align=\"left\" colspan=\"2\">", form_checkbox("hide_empty", "Y", gettext("Hide rows with empty or null values in selected columns"), $hide_empty == 'Y'), "</td>\n";
echo "                      </tr>\n";
if (forum_get_setting('guest_show_recent', 'Y')) {
    echo "                      <tr>\n";
    echo "                        <td align=\"left\" colspan=\"2\">", form_checkbox("hide_guests", "Y", gettext("Show Registered Users only (hide Guests)"), $hide_guests == 'Y'), "</td>\n";
    echo "                      </tr>\n";
}
echo "                      <tr>\n";
echo "                        <td align=\"left\">&nbsp;</td>\n";
echo "                      </tr>\n";
echo "                    </table>\n";
echo "                  </td>\n";
echo "                </tr>\n";
echo "              </table>\n";
echo "            </td>\n";
echo "          </tr>\n";
echo "        </table>\n";
echo "      </td>\n";
Пример #18
0
                echo "  <div class=\"register_confirmation\">", sprintf(gettext("To prevent automated registrations this forum requires you enter a confirmation code. The code is displayed in the image below. If you are visually impaired or cannot otherwise read the code please contact the %s."), $forum_owner_link), "</div>\n";
                echo "  <div class=\"register_confirmation_image\">\n";
                echo "    ", html_style_image('text_captcha_image', gettext("This is a captcha-picture. It is used to prevent automatic registration"), 'text_captcha_image', array('background-image' => sprintf("url('data:image/jpeg;base64,%s')", base64_encode(file_get_contents($text_captcha_image))), 'width' => "{$text_captcha->get_width()}px", 'height' => "{$text_captcha->get_height()}px")), "\n";
                echo "    ", html_style_image('text_captcha_reload reload', null, 'text_captcha_reload'), "\n";
                echo "  </div>\n";
                echo "  <div class=\"register_confirmation_input\">\n";
                echo "    ", light_form_input_text("private_key", null, 20, htmlentities_array($text_captcha->get_num_chars())), "\n";
                echo "  </div>\n";
                //echo "  <div class=\"clearer\"></div>\n";
                //echo "</div>\n";
            }
        }
    }
    echo "  <div class=\"register_buttons\">\n";
    echo "  ", light_form_submit('register', gettext("Register"));
    echo "  <a href=\"llogon.php?webtag={$webtag}\" class=\"button\" target=\"_self\"><span>", gettext("Cancel"), "</span></a>\n";
    echo "  </div>\n";
} else {
    $forum_name = forum_get_setting('forum_name', 'strlen', 'A Beehive Forum');
    if (($forum_rules = forum_get_setting('forum_rules_message', 'strlen', false)) !== false) {
        $forum_rules = sprintf(gettext("<p><b>Forum Rules</b></p><p>Registration to %1\$s is free! We do insist that you abide by the rules and policies detailed below. If you agree to the terms, please check the 'I agree' checkbox and press the 'Register' button below. If you would like to cancel the registration, click <a href=\"index.php?webtag=%2\$s\">here</a> to return to the forums index.</p><p>Although the administrators and moderators of %1\$s will attempt to keep all objectionable messages off this forum, it is impossible for us to review all messages. All messages express the views of the author, and neither the owners of %1\$s, nor Project Beehive Forum and its affiliates will be held responsible for the content of any message.</p><p>By agreeing to these rules, you warrant that you will not post any messages that are obscene, vulgar, sexually-orientated, hateful, threatening, or otherwise in violation of any laws.</p><p>The owners of %1\$s reserve the right to remove, edit, move or close any thread for any reason.</p>"), $forum_name, $webtag);
    }
    echo "  ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n";
    echo "  <div class=\"register_rules\">", fix_html($forum_rules), "</div>\n";
    echo "  <div class=\"register_accept\">", light_form_checkbox('user_agree_rules', 'Y', gettext("I have read, and agree to abide by the forum rules.")), "</div>\n";
    echo "  <div class=\"register_buttons\">", light_form_submit('forum_rules', gettext("Register")), "</div>\n";
}
echo "</div>\n";
echo "</div>\n";
echo "</form>\n";
light_html_draw_bottom();
Пример #19
0
function forum_check_maintenance()
{
    $forum_maintenance_functions_array = array('pm_system_prune_folders', 'thread_auto_prune_unread_data', 'sitemap_create_file');
    $new_forum_settings = array();
    if (!forum_self_clean_check_ajax()) {
        return;
    }
    $forum_maintenance_hour = forum_get_setting('forum_maintenance_hour', 'is_numeric', 3);
    $forum_maintenance_duration = forum_get_setting('forum_maintenance_duration', 'is_numeric', 1);
    $forum_maintenance_function = forum_get_setting('forum_maintenance_function', 'is_numeric', 0);
    $forum_maintenance_function++;
    if (!isset($forum_maintenance_functions_array[$forum_maintenance_function])) {
        $forum_maintenance_function = 0;
    }
    $forum_maintenance_date_var = sprintf("%s_last_run", $forum_maintenance_functions_array[$forum_maintenance_function]);
    $forum_maintenance_last_run = forum_get_setting($forum_maintenance_date_var, 'is_numeric', 0);
    if (time() - $forum_maintenance_last_run < DAY_IN_SECONDS) {
        return;
    }
    if (time() < mktime($forum_maintenance_hour)) {
        return;
    }
    if (time() > mktime($forum_maintenance_hour + $forum_maintenance_duration)) {
        return;
    }
    if (!function_exists($forum_maintenance_functions_array[$forum_maintenance_function])) {
        return;
    }
    ignore_user_abort(true);
    $forum_maintenance_functions_array[$forum_maintenance_function]();
    $new_forum_settings[$forum_maintenance_date_var] = time();
    $new_forum_settings['forum_maintenance_function'] = $forum_maintenance_function;
    forum_save_global_settings($new_forum_settings);
}
Пример #20
0
function format_date($time)
{
    if (($timezone_id = session::get_value('TIMEZONE')) === false) {
        $timezone_id = forum_get_setting('forum_timezone', null, 27);
    }
    if (($gmt_offset = session::get_value('GMT_OFFSET')) === false) {
        $gmt_offset = forum_get_setting('forum_gmt_offset', null, 0);
    }
    if (($dst_offset = session::get_value('DST_OFFSET')) === false) {
        $dst_offset = forum_get_setting('forum_dst_offset', null, 0);
    }
    if (($dl_saving = session::get_value('DL_SAVING')) === false) {
        $dl_saving = forum_get_setting('forum_dl_saving', null, 'N');
    }
    // Calculate $time in user's timezone.
    $time = $time + $gmt_offset * HOUR_IN_SECONDS;
    // Calculate the current time in user's timezone.
    $current_time = time() + $gmt_offset * HOUR_IN_SECONDS;
    // Check for DST changes
    if ($dl_saving == 'Y' && timestamp_is_dst($timezone_id, $gmt_offset)) {
        // Ammend the $time to include DST
        $time = $time + $dst_offset * HOUR_IN_SECONDS;
        // Ammend the current time to include DST
        $current_time = $current_time + $dst_offset * HOUR_IN_SECONDS;
    }
    // Get the year of $time
    $time_year = gmdate("Y", $time);
    // Get the year for the current time
    $current_year = gmdate('Y', $current_time);
    // Only show the year if it is different to the current year
    if ($time_year != $current_year) {
        if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
            $format = strftime('%#d %b %Y', $time);
        } else {
            $format = strftime('%e %b %Y', $time);
        }
    } else {
        if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
            $format = strftime('%#d %b', $time);
        } else {
            $format = strftime('%e %b', $time);
        }
    }
    return $format;
}
Пример #21
0
                echo "  </table>\n";
            }
        }
    }
    echo "  <br />\n";
    echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"600\">\n";
    echo "    <tr>\n";
    echo "      <td align=\"center\">", form_submit('register', gettext("Register")), "&nbsp;", form_submit('cancel', gettext("Cancel")), "</td>\n";
    echo "    </tr>\n";
    echo "  </table>\n";
    echo "  <br />\n";
    echo "</form>\n";
    echo "</div>\n";
} else {
    $forum_name = forum_get_setting('forum_name', null, 'A Beehive Forum');
    if (!($forum_rules = forum_get_setting('forum_rules_message'))) {
        $forum_rules = sprintf(gettext("<p><b>Forum Rules</b></p><p>Registration to %1\$s is free! We do insist that you abide by the rules and policies detailed below. If you agree to the terms, please check the 'I agree' checkbox and press the 'Register' button below. If you would like to cancel the registration, click <a href=\"index.php?webtag=%2\$s\">here</a> to return to the forums index.</p><p>Although the administrators and moderators of %1\$s will attempt to keep all objectionable messages off this forum, it is impossible for us to review all messages. All messages express the views of the author, and neither the owners of %1\$s, nor Project Beehive Forum and its affiliates will be held responsible for the content of any message.</p><p>By agreeing to these rules, you warrant that you will not post any messages that are obscene, vulgar, sexually-orientated, hateful, threatening, or otherwise in violation of any laws.</p><p>The owners of %1\$s reserve the right to remove, edit, move or close any thread for any reason.</p>"), $forum_name, $webtag);
    }
    echo "<br />\n";
    echo "<div align=\"center\">\n";
    echo "<form accept-charset=\"utf-8\" name=\"form_register\" action=\"register.php\" method=\"post\" target=\"_self\">\n";
    echo "  ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n";
    echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"600\">\n";
    echo "    <tr>\n";
    echo "      <td align=\"left\">\n";
    echo "        <table class=\"box\" width=\"100%\">\n";
    echo "          <tr>\n";
    echo "            <td align=\"left\" class=\"posthead\">\n";
    echo "              <table class=\"posthead\" width=\"100%\">\n";
    echo "                <tr>\n";
    echo "                  <td align=\"left\" class=\"subhead\">", gettext("Forum Rules"), "</td>\n";
Пример #22
0
                $uri = "lmessages.php?webtag={$webtag}&msg={$return_msg}";
            } else {
                if (isset($tid) && is_numeric($tid) && isset($reply_to_pid) && is_numeric($reply_to_pid)) {
                    $uri = "lmessages.php?webtag={$webtag}&msg={$tid}.{$reply_to_pid}";
                } else {
                    $uri = "lmessages.php?webtag={$webtag}";
                }
            }
            if (isset($tid) && is_numeric($tid) && isset($new_pid) && is_numeric($new_pid)) {
                $uri .= "&post_success={$tid}.{$new_pid}";
            }
        }
        header_redirect($uri);
        exit;
    } else {
        $error_msg_array[] = sprintf(gettext("You can only post once every %s seconds. Please try again later."), forum_get_setting('minimum_post_frequency', 'is_numeric', 0));
    }
}
if (!isset($fid)) {
    $fid = 1;
}
if ($new_thread && !($folder_dropdown = folder_draw_dropdown($fid, "fid", "", FOLDER_ALLOW_NORMAL_THREAD, USER_PERM_THREAD_CREATE, "", "post_folder_dropdown"))) {
    light_html_draw_error(gettext("You cannot create new threads."));
}
if (isset($thread_data['CLOSED']) && $thread_data['CLOSED'] > 0 && !session::check_perm(USER_PERM_FOLDER_MODERATE, $fid)) {
    light_html_draw_error(gettext("This thread is closed, you cannot post in it!"));
}
if (isset($return_msg)) {
    $back = "lmessages.php?webtag={$webtag}&msg={$return_msg}";
} else {
    if (isset($tid) && is_numeric($tid) && isset($reply_to_pid) && is_numeric($reply_to_pid)) {
Пример #23
0
function links_update($lid, $fid, $uid, $title, $uri, $description)
{
    if (!($db = db::get())) {
        return false;
    }
    if (!is_numeric($lid)) {
        return false;
    }
    if (!is_numeric($fid)) {
        return false;
    }
    if (!is_numeric($uid)) {
        return false;
    }
    $uri = $db->escape($uri);
    $title = $db->escape($title);
    $description = $db->escape($description);
    if (!($table_prefix = get_table_prefix())) {
        return false;
    }
    $current_datetime = date(MYSQL_DATETIME, time());
    if (forum_get_setting('require_link_approval', 'Y') && !perm_is_links_moderator($uid)) {
        $sql = "UPDATE LOW_PRIORITY `{$table_prefix}LINKS` SET FID = '{$fid}', ";
        $sql .= "TITLE = '{$title}', URI = '{$uri}', DESCRIPTION = '{$description}', ";
        $sql .= "APPROVED = NULL, APPROVED_BY = NULL WHERE LID = '{$lid}'";
    } else {
        $sql = "UPDATE LOW_PRIORITY `{$table_prefix}LINKS` SET FID = '{$fid}', ";
        $sql .= "TITLE = '{$title}', URI = '{$uri}', DESCRIPTION = '{$description}', ";
        $sql .= "APPROVED = CAST('{$current_datetime}' AS DATETIME), APPROVED_BY = {$uid} ";
        $sql .= "WHERE LID = '{$lid}'";
    }
    if (!$db->query($sql)) {
        return false;
    }
    return true;
}
Пример #24
0
if (isset($ret) && strlen(trim($ret)) > 0) {
    $available_files_preg = implode("|^", array_map('preg_quote_callback', get_available_files()));
    if (preg_match("/^{$available_files_preg}/u", basename($ret)) < 1) {
        $ret = "admin_forums.php?webtag={$webtag}";
    }
}
if (isset($_POST['back'])) {
    header_redirect($ret);
}
if (isset($_POST['enable'])) {
    if (forum_update_access($forum_fid, FORUM_RESTRICTED)) {
        header_redirect("admin_forum_access.php?webtag={$webtag}");
        exit;
    }
}
if (!forum_get_setting('access_level', FORUM_RESTRICTED)) {
    html_draw_error(gettext("Forum is not set to Restricted Mode. Do you want to enable it now?"), 'admin_forum_access.php', 'post', array('enable' => gettext("Enable"), 'back' => gettext("Back")), array('ret' => $ret), false, 'center');
}
if (isset($_GET['page']) && is_numeric($_GET['page'])) {
    $main_page = $_GET['main_page'];
} else {
    if (isset($_POST['main_page']) && is_numeric($_POST['main_page'])) {
        $main_page = $_POST['main_page'];
    } else {
        $main_page = 1;
    }
}
if (isset($_GET['search_page']) && is_numeric($_GET['search_page'])) {
    $search_page = $_GET['search_page'];
} else {
    if (isset($_POST['search_page']) && is_numeric($_POST['search_page'])) {
echo "                      </tr>\n";
echo "                      <tr>\n";
echo "                        <td align=\"left\" colspan=\"2\">&nbsp;</td>\n";
echo "                      </tr>\n";
echo "                    </table>\n";
echo "                  </td>\n";
echo "                </tr>\n";
echo "              </table>\n";
echo "            </td>\n";
echo "          </tr>\n";
echo "        </table>\n";
echo "      </td>\n";
echo "    </tr>\n";
echo "  </table>\n";
echo "  <br />\n";
$forum_name = forum_get_setting('forum_name', null, 'A Beehive Forum');
$frame_top_target = html_get_top_frame_name();
$default_forum_rules = sprintf(gettext("<p><b>Forum Rules</b></p><p>Registration to %1\$s is free! We do insist that you abide by the rules and policies detailed below. If you agree to the terms, please check the 'I agree' checkbox and press the 'Register' button below. If you would like to cancel the registration, click <a href=\"index.php?webtag=%2\$s\" target=\"%3\$s\">here</a> to return to the forums index.</p><p>Although the administrators and moderators of %1\$s will attempt to keep all objectionable messages off this forum, it is impossible for us to review all messages. All messages express the views of the author, and neither the owners of %1\$s, nor Project Beehive Forum and its affiliates will be held responsible for the content of any message.</p><p>By agreeing to these rules, you warrant that you will not post any messages that are obscene, vulgar, sexually-orientated, hateful, threatening, or otherwise in violation of any laws.</p><p>The owners of %1\$s reserve the right to remove, edit, move or close any thread for any reason.</p>"), $forum_name, $webtag, $frame_top_target);
if (!isset($forum_global_settings['forum_rules_message'])) {
    $forum_global_settings['forum_rules_message'] = $default_forum_rules;
}
echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"600\">\n";
echo "    <tr>\n";
echo "      <td align=\"left\">\n";
echo "        <table class=\"box\" width=\"100%\">\n";
echo "          <tr>\n";
echo "            <td align=\"left\" class=\"posthead\">\n";
echo "              <table class=\"posthead\" width=\"100%\">\n";
echo "                <tr>\n";
echo "                  <td align=\"left\" class=\"subhead\" colspan=\"3\">", gettext("Forum Rules"), "</td>\n";
echo "                </tr>\n";
Пример #26
0
function messages_forum_stats($tid, $pid)
{
    $webtag = get_webtag();
    if (forum_get_setting('show_stats', 'Y')) {
        echo "<br />\n";
        echo "<div align=\"center\">\n";
        echo "  <form action=\"user_stats.php\" method=\"get\" target=\"_self\">\n";
        echo "    ", form_input_hidden('webtag', $webtag), "\n";
        echo "    ", form_input_hidden('msg', "{$tid}.{$pid}"), "\n";
        echo "    <table cellpadding=\"0\" cellspacing=\"0\" width=\"96%\">\n";
        echo "      <tr>\n";
        echo "        <td align=\"center\">\n";
        echo "          <table class=\"box\" width=\"100%\">\n";
        echo "            <tr>\n";
        echo "              <td align=\"left\" class=\"posthead\">\n";
        echo "                <table class=\"posthead\" width=\"100%\" cellspacing=\"0\">\n";
        echo "                  <tr>\n";
        echo "                    <td>\n";
        echo "                      <table border=\"0\" cellspacing=\"0\" width=\"100%\">\n";
        echo "                        <tr>\n";
        echo "                          <td align=\"left\" class=\"subhead\">", gettext("Forum Stats"), "</td>\n";
        echo "                          <td align=\"right\" class=\"subhead\">\n";
        if (!session::logged_in()) {
            echo "                            &nbsp;";
        } else {
            if (session::get_value("SHOW_STATS") == "Y") {
                echo "                            ", form_submit_image('hide.png', 'forum_stats_toggle', 'hide', '', 'button_image toggle_button'), "\n";
            } else {
                echo "                            ", form_submit_image('show.png', 'forum_stats_toggle', 'show', '', 'button_image toggle_button'), "\n";
            }
        }
        echo "                          </td>\n";
        echo "                        </tr>";
        echo "                      </table>\n";
        echo "                    </td>\n";
        echo "                  </tr>\n";
        echo "                  <tr>\n";
        echo "                    <td>\n";
        if (!session::logged_in() || session::get_value("SHOW_STATS") == "Y") {
            echo "                      <div id=\"forum_stats\" class=\"forum_stats_toggle\">\n";
        } else {
            echo "                      <div id=\"forum_stats\" class=\"forum_stats_toggle\" style=\"display: none\">\n";
        }
        echo "                        <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"posthead\">\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" id=\"active_user_counts\"></td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" class=\"activeusers\" id=\"active_user_list\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" id=\"thread_stats\">&nbsp;<br />&nbsp;</td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" id=\"post_stats\">&nbsp;<br />&nbsp;</td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" id=\"user_stats\">&nbsp;<br />&nbsp;</td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                          <tr>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                            <td align=\"left\">&nbsp;</td>\n";
        echo "                            <td align=\"left\" width=\"35\">&nbsp;</td>\n";
        echo "                          </tr>\n";
        echo "                        </table>\n";
        echo "                      </div>\n";
        echo "                    </td>\n";
        echo "                  </tr>\n";
        echo "                </table>\n";
        echo "              </td>\n";
        echo "            </tr>\n";
        echo "          </table>\n";
        echo "        </td>\n";
        echo "      </tr>\n";
        echo "    </table>\n";
        echo "  </form>\n";
        echo "</div>\n";
    }
}
Пример #27
0
}
if (!($attachment_dir = attachments_check_dir())) {
    header_status(500, 'Internal Server Error');
    exit;
}
$valid = true;
$error = null;
$attachment_details = null;
$content = null;
$file_type = null;
$temp_file = null;
$file_size = null;
$file_name = null;
$content_type = 'text/html; charset=UTF-8';
$file_hash = md5(uniqid(mt_rand()));
$max_user_attachment_space = forum_get_setting('attachments_max_user_space', 'is_numeric', 1048576);
$free_upload_space = attachments_get_free_user_space($_SESSION['UID']);
$attachment_mime_types = attachments_get_mime_types();
$total_attachment_size = 0;
$attachment_dir = rtrim($attachment_dir, '/');
if (isset($_POST['summary'])) {
    if (isset($_POST['hashes']) && is_array($_POST['hashes'])) {
        $hash_array = array_filter($_POST['hashes'], 'is_md5');
    } else {
        $hash_array = array();
    }
    $used_post_space = format_file_size(attachments_get_post_used_space($_SESSION['UID'], $hash_array));
    $free_post_space = attachments_get_free_post_space($_SESSION['UID'], $hash_array);
    $content_type = 'application/json; charset=UTF-8';
    $content = json_encode(array('used_post_space' => $used_post_space, 'free_post_space' => $free_post_space > -1 ? format_file_size($free_post_space) : gettext("Unlimited"), 'free_upload_space' => $free_upload_space > -1 ? format_file_size($free_upload_space) : gettext("Unlimited")));
} else {
Пример #28
0
function thread_list_draw_top($mode, $folder = false)
{
    $webtag = get_webtag();
    forum_check_webtag_available($webtag);
    echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
    echo "  <tr>\n";
    echo "    <td align=\"left\" class=\"postbody\">", html_style_image('post', gettext("New Discussion")), "&nbsp;<a href=\"post.php?webtag={$webtag}\" target=\"", html_get_frame_name('main'), "\">", gettext("New Discussion"), "</a></td>\n";
    echo "  </tr>\n";
    if (forum_get_setting('allow_polls', 'Y')) {
        echo "  <tr>\n";
        echo "    <td align=\"left\" class=\"postbody\">", html_style_image('poll', gettext("Create Poll")), "&nbsp;<a href=\"create_poll.php?webtag={$webtag}\" target=\"", html_get_frame_name('main'), "\">", gettext("Create Poll"), "</a></td>\n";
        echo "  </tr>\n";
    }
    echo "  <tr>\n";
    echo "    <td align=\"left\" class=\"postbody\">", html_style_image('search', gettext("Search")), "&nbsp;<a href=\"search.php?webtag={$webtag}\" target=\"", html_get_frame_name('right'), "\">", gettext("Search"), "</a></td>\n";
    echo "  </tr>\n";
    echo "  <tr>\n";
    echo "    <td align=\"left\" class=\"postbody\">", html_style_image('pm_unread', gettext("Inbox")), "&nbsp;<a href=\"pm.php?webtag={$webtag}\" target=\"", html_get_frame_name('main'), "\">", gettext("Inbox"), "</a> <span class=\"pmnewcount\" id=\"pm_message_count\"></span></td>\n";
    echo "  </tr>\n";
    echo "</table>\n";
    echo "<br />\n";
    $available_views = thread_list_available_views();
    echo "<form accept-charset=\"utf-8\" name=\"f_mode\" method=\"get\" action=\"thread_list.php\">\n";
    echo "  ", form_input_hidden("webtag", htmlentities_array($webtag)), "\n";
    echo "  <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
    echo "    <tr>\n";
    echo "      <td align=\"left\" class=\"postbody\">\n";
    echo "        ", form_dropdown_array("mode", $available_views, htmlentities_array($mode)), "&nbsp;", form_submit("go", gettext("Go!")), "\n";
    if (is_numeric($folder) && in_array($folder, folder_get_available_array())) {
        echo "        ", form_input_hidden("folder", htmlentities_array($folder)), "\n";
    }
    echo "      </td>\n";
    echo "    </tr>\n";
    echo "  </table>\n";
    echo "</form>\n";
}
Пример #29
0
// Bootstrap
require_once 'boot.php';
// Required includes
require_once BH_INCLUDE_PATH . 'admin.inc.php';
require_once BH_INCLUDE_PATH . 'constants.inc.php';
require_once BH_INCLUDE_PATH . 'form.inc.php';
require_once BH_INCLUDE_PATH . 'format.inc.php';
require_once BH_INCLUDE_PATH . 'forum.inc.php';
require_once BH_INCLUDE_PATH . 'header.inc.php';
require_once BH_INCLUDE_PATH . 'html.inc.php';
require_once BH_INCLUDE_PATH . 'links.inc.php';
require_once BH_INCLUDE_PATH . 'session.inc.php';
require_once BH_INCLUDE_PATH . 'word_filter.inc.php';
// End Required includes
// Check links section is enabled.
if (!forum_get_setting('show_links', 'Y')) {
    html_draw_error(gettext("You may not access this section."));
}
$error_msg_array = array();
$success_msg = null;
$title = null;
if (isset($_POST['lid']) && is_numeric($_POST['lid'])) {
    $lid = $_POST['lid'];
} else {
    if (isset($_GET['lid']) && is_numeric($_GET['lid'])) {
        $lid = $_GET['lid'];
    } else {
        html_draw_error(gettext("You must provide a link ID!"));
    }
}
if (isset($_POST['parent_fid']) && is_numeric($_POST['parent_fid'])) {
Пример #30
0
function post_check_frequency()
{
    if (!($db = db::get())) {
        return false;
    }
    if (($uid = session::get_value('UID')) === false) {
        return false;
    }
    if (!($table_prefix = get_table_prefix())) {
        return false;
    }
    $minimum_post_frequency = intval(forum_get_setting('minimum_post_frequency', null, 0));
    if ($minimum_post_frequency == 0) {
        return true;
    }
    $current_datetime = date(MYSQL_DATE_HOUR_MIN, time());
    $sql = "SELECT UNIX_TIMESTAMP(LAST_POST) + {$minimum_post_frequency}, ";
    $sql .= "UNIX_TIMESTAMP('{$current_datetime}') FROM `{$table_prefix}USER_TRACK` ";
    $sql .= "WHERE UID = '{$uid}'";
    if (!($result = $db->query($sql))) {
        return false;
    }
    if ($result->num_rows > 0) {
        list($last_post_stamp, $current_timestamp) = $result->fetch_row();
        if (!is_numeric($last_post_stamp) || $last_post_stamp < $current_timestamp) {
            $sql = "UPDATE LOW_PRIORITY `{$table_prefix}USER_TRACK` ";
            $sql .= "SET LAST_POST = CAST('{$current_datetime}' AS DATETIME) ";
            $sql .= "WHERE UID = '{$uid}'";
            if (!($result = $db->query($sql))) {
                return false;
            }
            return true;
        }
    } else {
        $sql = "INSERT INTO `{$table_prefix}USER_TRACK` (UID, LAST_POST) ";
        $sql .= "VALUES ('{$uid}', CAST('{$current_datetime}' AS DATETIME))";
        if (!($result = $db->query($sql))) {
            return false;
        }
        return true;
    }
    return false;
}