Example #1
0
function adsense_display_pages()
{
    if (($adsense_display_pages = forum_get_global_setting('adsense_display_pages', 'strlen', false)) !== false) {
        return $adsense_display_pages;
    }
    return ADSENSE_DISPLAY_TOP_OF_ALL_PAGES;
}
Example #2
0
function adsense_display_pages()
{
    if ($adsense_display_pages = forum_get_global_setting('adsense_display_pages')) {
        return $adsense_display_pages;
    }
    return ADSENSE_DISPLAY_TOP_OF_ALL_PAGES;
}
Example #3
0
function image_resize_imagemagick($src, $dest, $max_width = 150, $max_height = 150)
{
    if (!is_numeric($max_width)) {
        return false;
    }
    if (!is_numeric($max_height)) {
        return false;
    }
    // Array of mime-types to encoding types for imagemagick
    $mime_type_encoding = array('image/gif' => 'gif', 'image/jpeg' => 'jpg', 'image/png' => 'png');
    // Get the imagemagick path from settings.
    if (!($imagemagick_path = forum_get_global_setting('attachment_imagemagick_path'))) {
        return false;
    }
    // Check that imagemagick is executable.
    if (!is_executable($imagemagick_path)) {
        return false;
    }
    // Check the destination directory is writable.
    if (!is_writable(dirname($dest))) {
        return false;
    }
    // Check the file exists and we can get some image data from it.
    if (!file_exists($src) || !($image_info = @getimagesize($src))) {
        return false;
    }
    // Check it's an image type we support.
    if (!isset($image_info['mime']) || !isset($mime_type_encoding[$image_info['mime']])) {
        return false;
    }
    // If we're dealing with a GIF image, we need to
    // process it to correctly resize all the frames it
    // might contain - in the case of animated gifs.
    if (false || $image_info[2] == IMAGETYPE_GIF) {
        // Resize the gif, dropping all but the first frame.
        exec(sprintf('convert -size "%3$dx%4$d" xc:transparent %1$s[0] -resize "%3$dx%4$d^>" -gravity center -compose over -composite %5$s:%2$s', escapeshellarg($src), escapeshellarg($dest), $max_width, $max_height, $mime_type_encoding[$image_info['mime']]));
    } else {
        // It's not a gif, so carry on and resize the image.
        exec(sprintf('convert -size "%3$dx%4$d" xc:transparent %1$s -resize "%3$dx%4$d^>" -gravity center -compose over -composite %5$s:%2$s', escapeshellarg($src), escapeshellarg($dest), $max_width, $max_height, $mime_type_encoding[$image_info['mime']]));
    }
    // if imagemagick fails, it won't create the final image
    // so we test that exists before returning the result.
    if (!file_exists($dest)) {
        return false;
    }
    // Success
    return true;
}
Example #4
0
function forum_get_setting($setting_name, $callback = null, $default = null)
{
    $forum_settings = forum_get_settings();
    if (!is_array($forum_settings) || !isset($forum_settings[$setting_name])) {
        return forum_get_global_setting($setting_name, $callback, $default);
    }
    if (function_exists($callback) && is_callable($callback)) {
        return $callback($forum_settings[$setting_name]) ? $forum_settings[$setting_name] : $default;
    } else {
        if (is_scalar($callback)) {
            return mb_strtoupper($forum_settings[$setting_name]) == mb_strtoupper($callback);
        }
    }
    return $forum_settings[$setting_name];
}
Example #5
0
 private function set_headers()
 {
     // Get the forum name.
     $forum_name = forum_get_setting('forum_name', null, 'A Beehive Forum');
     // Get the forum email address
     $forum_email = forum_get_setting('forum_noreply_email', null, '*****@*****.**');
     // Mail function we're using.
     $mail_function = forum_get_global_setting('mail_function', null, MAIL_FUNCTION_PHP);
     // Get the Swift Headers set
     $headers = $this->getHeaders();
     // Add PHP version number to headers
     $headers->addTextHeader('X-Mailer', 'PHP/' . phpversion());
     // Add the Beehive version number to headers
     $headers->addTextHeader('X-Beehive-Forum', 'Beehive Forum ' . BEEHIVE_VERSION);
     // Add header to identify Swift version
     $headers->addTextHeader('X-Swift-Mailer', 'Swift Mailer ' . Swift::VERSION);
     // Add header to identify mail function used
     $headers->addTextHeader('X-Beehive-Mail-Function', $mail_function);
     // Set the Message From Header
     $this->setFrom($forum_email, $forum_name);
     // Set the Message Reply-To Header
     $this->setReplyTo($forum_email, $forum_name);
     // Set the Message Return-path Header
     $this->setReturnPath($forum_email);
 }
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";
if (forum_get_global_setting('allow_forum_google_analytics', 'Y')) {
    echo "  <table cellpadding=\"0\" cellspacing=\"0\" width=\"700\">\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\" colspan=\"2\" class=\"subhead\">", gettext("Google Analytics"), "</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";
Example #7
0
function html_get_google_analytics_code()
{
    if (forum_get_global_setting('allow_forum_google_analytics', 'Y')) {
        if (forum_get_setting('enable_google_analytics', 'Y')) {
            if ($google_analytics_code = forum_get_setting('google_analytics_code')) {
                return strlen(trim($google_analytics_code)) > 0 ? $google_analytics_code : false;
            }
        }
    } else {
        if (forum_get_global_setting('enable_google_analytics', 'Y')) {
            if ($google_analytics_code = forum_get_global_setting('google_analytics_code')) {
                return strlen(trim($google_analytics_code)) > 0 ? $google_analytics_code : false;
            }
        }
    }
    return false;
}
Example #8
0
    header("Request-URI: index.php");
    header("Content-Location: index.php");
    header("Location: index.php");
    exit;
}
require_once BH_INCLUDE_PATH . 'constants.inc.php';
require_once BH_INCLUDE_PATH . 'db.inc.php';
require_once BH_INCLUDE_PATH . 'format.inc.php';
require_once BH_INCLUDE_PATH . 'install.inc.php';
@set_time_limit(0);
$current_datetime = date(MYSQL_DATETIME, time());
if (!($forum_prefix_array = install_get_table_data())) {
    throw new Exception("Could not locate any previous Beehive Forum installations");
}
$attachment_real_path = null;
if (($attachment_dir = forum_get_global_setting('attachment_dir', null, false)) !== false) {
    $attachment_dir = rtrim(trim($attachment_dir), '/');
    if (!($attachment_real_path = realpath($attachment_dir))) {
        if (!($attachment_real_path = realpath(__DIR__ . '/../' . $attachment_dir))) {
            throw new Exception("Could not locate attachment directory");
        }
    }
}
/** @noinspection PhpUndefinedVariableInspection */
if (!install_table_exists($config['db_database'], 'USER_PERM')) {
    $sql = "CREATE TABLE GROUPS_NEW (";
    $sql .= "  GID MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT,";
    $sql .= "  FORUM MEDIUMINT(8) UNSIGNED NOT NULL,";
    $sql .= "  GROUP_NAME VARCHAR(32) NOT NULL,";
    $sql .= "  GROUP_DESC VARCHAR(255) DEFAULT NULL,";
    $sql .= "  GID_OLD MEDIUMINT(8) UNSIGNED NOT NULL,";