Exemplo n.º 1
0
 /**
  * Tente de récupérer une config des plugins à partir d'un autre fichier
  */
 public static function setPluginsList()
 {
     $otherPluginsList = AdminServConfig::PLUGINS_LIST;
     if ($otherPluginsList) {
         if (file_exists($otherPluginsList)) {
             include_once $otherPluginsList;
             if (isset($PLUGINS)) {
                 if (AdminServConfig::PLUGINS_LIST_TYPE == 'add') {
                     ExtensionConfig::$PLUGINS = array_merge(ExtensionConfig::$PLUGINS, $PLUGINS);
                 } else {
                     ExtensionConfig::$PLUGINS = $PLUGINS;
                 }
             } else {
                 AdminServ::error(Utils::t('Variable "$PLUGINS" not found.'));
             }
         } else {
             AdminServ::error(Utils::t('Cannot include another plugins config file.'));
         }
     }
 }
<?php

ExtensionConfig::remove_language_key('imageuploading');
ExtensionConfig::remove_page('/extensions/uploadimage');
ExtensionConfig::remove_page('/admin/imageuploading', array('file' => 'admin/imageuploading.php', 'template' => true, 'nocontentbox' => true, 'admin' => true));
ExtensionConfig::remove_admin_menu('imageuploading');
ExtensionConfig::remove_page('/myimages');
$db->query('DELETE FROM `#^config` WHERE c_name IN(\'user_image_maxwidth\', \'user_image_maxheight\', \'user_image_maxsize\')') or enhanced_error('Failed to delete config entries', true);
$db->drop_table('userimages');
$db->drop_field('user_groups', 'g_upload_images');
unlink(FORUM_ROOT . '/app_resources/pages/myimages.php');
unlink(FORUM_ROOT . '/app_resources/pages/uploadimage.php');
unlink(FORUM_ROOT . '/app_resources/pages/admin/imageuploading.php');
Exemplo n.º 3
0
//map all UTC offsets to new timezones
$mappings = array(-12 => 383, -11 => 398, -10 => 53, -9 => 94, -8 => 132, -7 => 162, -6 => 144, -5 => 151, -4 => 84, -3 => 57, -2 => 295, -1 => 8, 0 => 415, 1 => 333, 2 => 327, 3 => 340, 4 => 230, 5 => 244, 6 => 266, 7 => 220, 8 => 271, 9 => 279, 10 => 309, 11 => 399, 12 => 385, 13 => 213);
//I hate mass queries as much as anyone, but they have to be done
foreach ($mappings as $oldtime => $newtime) {
    $db->query('UPDATE `#^users` SET timezone=' . $newtime . ' WHERE timezone=' . $oldtime) or enhanced_error('Failed to update timezone', true);
}
echo '<li>RV3: Converting timezones... success</li>';
ExtensionConfig::add_page('/styles', array('file' => 'style.php', 'template' => false, 'admin' => false, 'mod' => false, 'subdirs' => true));
ExtensionConfig::remove_page('/styles/default.css');
ExtensionConfig::remove_page('/styles/default.css/');
ExtensionConfig::remove_page('/styles/embed.css');
echo '<li>RV3: Adding missing pages... success</li>';
ExtensionConfig::add_language_key('showallposts', 'Show all posts', 'English');
ExtensionConfig::add_language_key('timeformatdesc', 'The following two entries allow you to set the format used for displaying all times by the software. For items that only display the date, the date format is used, but for items that display the time, the date format and time format are joined together. The formats must follow the <a href="http://php.net/manual/en/function.date.php#refsect1-function.date-parameters">PHP guidelines</a>.', 'English');
ExtensionConfig::add_language_key('unknownerror', 'An unknown error occurred', 'English');
ExtensionConfig::add_language_key('specificnestingerror', 'The tag <b>[$1]</b> cannot be placed directly inside <b>[$2]</b>.', 'English');
ExtensionConfig::add_language_key('errorwaslocated', 'The above error was located at: ', 'English');
ExtensionConfig::add_language_key('tagwasopened', 'The <b>[$1]</b> tag was opened at the following location: ', 'English');
ExtensionConfig::add_language_key('archived', '(Archived)', 'English');
ExtensionConfig::add_language_key('dateformat', 'Date format', 'English');
ExtensionConfig::add_language_key('timeformat', 'Time format', 'English');
ExtensionConfig::add_language_key('basegroupon', 'Base new group on:', 'English');
ExtensionConfig::add_language_key('forumalreadyopen', 'You have modified a forum or already have one open for editing. Please refresh the page and then try again.', 'English');
ExtensionConfig::add_language_key('existingwords', 'Existing words', 'English');
ExtensionConfig::add_language_key('bbcodeinPM', 'BBCode in private messages', 'English');
ExtensionConfig::add_language_key('otherforumeditsconfirmrefresh', 'Edits to a forum have been submitted in another window. Do you want to refresh this page to reflect those changes?', 'English');
ExtensionConfig::add_language_key('archiveforum', 'Archive forum', 'English');
ExtensionConfig::add_language_key('changecategory', 'Change category', 'English');
ExtensionConfig::add_language_key('noextdir', 'The directory "app_config/extensions" does not exist or is not writable. Please create it and change the file permissions appropriately to fix this (if in doubt, chmod to 0777).', 'English');
echo '<li>RV3: Adding missing language keys... success</li>';
set_config('db_version', 3);
Exemplo n.º 4
0
				<?php 
    ExtensionConfig::run_hooks('bbcode_toolbar');
    ?>
				<p><?php 
    if ($cur_topic['closed'] || $cur_topic['forum_archived']) {
        echo '<span class="closedlabel">' . translate('topicisclosed') . '</span><br />';
    }
    ?>
				<textarea name="message" id="message" rows="10" cols="70"<?php 
    if ($cur_topic['closed'] || $cur_topic['forum_archived']) {
        echo ' style="background-color: #DDD; border-color: #AAA;"';
    }
    ?>
></textarea></p>
                <?php 
    ExtensionConfig::run_hooks('bbcode_toolbar_bottom');
    ?>
				<p><a href="<?php 
    echo $base_config['baseurl'];
    ?>
/bbcodehelp"><?php 
    echo translate('bbcode');
    ?>
</a>: <?php 
    if ($futurebb_config['enable_bbcode']) {
        echo translate('on');
    } else {
        echo translate('off');
    }
    ?>
, <a href="<?php 
<?php

if ($futurebb_user['language'] != 'English') {
    $error = 'This extension only works in English. Please change your language.';
    return;
}
ExtensionConfig::add_language_key('imageuploading', 'Image Uploading', 'English');
ExtensionConfig::add_page('/extensions/uploadimage', array('file' => 'uploadimage.php', 'template' => false, 'nocontentbox' => true));
if (!file_exists(FORUM_ROOT . '/static/userimages')) {
    mkdir(FORUM_ROOT . '/static/userimages');
}
ExtensionConfig::add_page('/admin/imageuploading', array('file' => 'admin/imageuploading.php', 'template' => true, 'nocontentbox' => true, 'admin' => true));
ExtensionConfig::add_admin_menu('imageuploading', 'imageuploading');
ExtensionConfig::add_page('/myimages', array('file' => 'myimages.php', 'template' => true));
set_config('user_image_maxwidth', 1024);
set_config('user_image_maxheight', 768);
set_config('user_image_maxsize', 512);
$table = new DBTable('userimages');
$new_fld = new DBField('id', 'INT');
$new_fld->add_key('PRIMARY');
$new_fld->add_extra('NOT NULL');
$new_fld->add_extra('AUTO_INCREMENT');
$table->add_field($new_fld);
$new_fld = new DBField('filename', 'VARCHAR(256)');
$new_fld->add_extra('NOT NULL');
$table->add_field($new_fld);
$new_fld = new DBField('user', 'INT');
$new_fld->add_extra('NOT NULL');
$table->add_field($new_fld);
$new_fld = new DBField('ip_addr', 'VARCHAR(50)');
$new_fld->add_extra('NOT NULL');
Exemplo n.º 6
0
			req.send('');
			
			req.onreadystatechange = function() {
				if (req.readyState==4 && req.status==200) {
					document.getElementById('notificationsdropdown').innerHTML = req.responseText;
				} else {
					//failure
				}
			 }
		}
	}
	//]]>
	</script>
	<$other_head_stuff/>
	<?php 
ExtensionConfig::run_hooks('load_header', array());
?>
</head>

<body>

<div id="futurebb">
	<div class="forum_header">
		<div>
			<?php 
if ($futurebb_user['id'] != 0) {
    // If logged in
    //user button
    echo '<a class="userbutton" href="' . $base_config['baseurl'] . '/users/' . $futurebb_user['username'] . '">';
    if (file_exists(FORUM_ROOT . '/static/avatars/' . $futurebb_user['id'] . '.' . $futurebb_user['avatar_extension'])) {
        echo '<img src="' . $base_config['baseurl'] . '/static/avatars/' . $futurebb_user['id'] . '.' . $futurebb_user['avatar_extension'] . '" width="36px" height="36px" alt="avatar" />';
Exemplo n.º 7
0
while ($f = readdir($handle)) {
    if ($f != '.' && $f != '..') {
        $f = htmlspecialchars($f);
        echo '<option value="' . $f . '">' . $f . '</option>';
    }
}
?>
</select></th>
		</tr>
		<tr>
			<th><?php 
echo translate('timezone');
?>
</th>
			<td><select name="timezone"><?php 
$timezones = DateTimeZone::listIdentifiers();
foreach ($timezones as $key => $val) {
    echo '<option value="' . $key . '">' . $val . '</option>';
}
?>
			</select></td>
		</tr>
	</table>
	<?php 
ExtensionConfig::run_hooks('show_captcha');
?>
	<p><input type="submit" name="form_sent" value="<?php 
echo translate('submit');
?>
" /></p>
</form>
Exemplo n.º 8
0
                    echo '<input type="checkbox" name="user_list[' . $id . ']" id="user_list_' . $id . '" value="' . $id . '"';
                    if (in_array($id, $visible_groups)) {
                        echo ' checked="checked"';
                    }
                    echo ' /> <label for="user_list_' . $id . '">' . htmlspecialchars($name) . '</label><br />';
                }
            }
            ?>
<br /><?php 
            echo translate('userlistvisgrpsdesc');
            ?>
					</td>
				</tr>
                <?php 
        }
        ExtensionConfig::run_hooks('group_options_bottom');
        ?>
			</table>
            <?php 
        if ($group_id != 2 && $group_id != 1) {
            //hide for guests/admins
            ?>
			<p><?php 
            echo translate('promoteto');
            ?>
 <select name="config[g_promote_group]"><option value="0"><?php 
            echo translate('dontpromote');
            ?>
</option><?php 
            foreach ($user_groups as $id => $name) {
                if ($id != intval($dirs[3]) && !$group_info[$id]['guest']) {
Exemplo n.º 9
0
<?php

$db->query('DELETE FROM `#^bans` WHERE expires<=' . time()) or enhanced_error('Failed to delete old bans', true);
//delete any bans that have already expired
if ($ban_type == 'ban') {
    $page_title = translate('banned');
    $result = $db->query('SELECT * FROM `#^bans` WHERE (username=\'' . $db->escape($futurebb_user['username']) . '\' OR ip=\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\') AND (expires>' . time() . ' OR expires IS NULL)') or error('Failed to check for bans', __FILE__, __LINE__, $db->error());
    $cur_ban = $db->fetch_assoc($result);
    $ban_page_replaced = false;
    //this sets up for a hook, where the ban page can be replaced
    ExtensionConfig::run_hooks('ban_page', array('ban_info' => $cur_ban, 'type' => $ban_type));
    if (!$ban_page_replaced) {
        ?>
		<h2><?php 
        echo translate('banned');
        ?>
</h2>
		<p><?php 
        echo translate('bannedmsg1');
        if ($cur_ban['expires'] != null) {
            echo ' ' . translate('until') . ' ' . user_date($cur_ban['expires']);
        }
        ?>
. <?php 
        echo translate('bannedmsg2');
        ?>
<br /><b><?php 
        echo htmlspecialchars($cur_ban['message']);
        ?>
</b><br /><?php 
        echo translate('bannedmsg3', $futurebb_config['admin_email']);
Exemplo n.º 10
0
$new_fld->add_extra('NOT NULL');
$new_fld->add_extra('AUTO_INCREMENT');
$table->add_field($new_fld);
$new_fld = new DBField('hash', 'VARCHAR(50)');
$new_fld->set_default('');
$new_fld->add_extra('NOT NULL');
$table->add_field($new_fld);
$new_fld = new DBField('results', 'TEXT');
$new_fld->set_default('');
$new_fld->add_extra('NOT NULL');
$table->add_field($new_fld);
$new_fld = new DBField('time', 'INT');
$new_fld->add_extra('NOT NULL');
$table->add_field($new_fld);
$table->commit();
echo '<li>RV4: Adding search cache table... success</li>';
//insert new language keys
ExtensionConfig::add_language_key('exttoonew', 'The extension you are installing requires FutureBB version $1, while you are currently running $2. Go to <a href="http://futurebb.futuresight.org">the FutureBB website</a> to update your forum software.', 'English', 'admin');
ExtensionConfig::add_language_key('notextinsidetag', 'You are not allowed to place any text directly inside the <b>[$1]</b> tag.', 'English', 'main');
ExtensionConfig::add_language_key('posttime', 'Post time', 'English', 'main');
ExtensionConfig::add_language_key('tables', 'Tables', 'English', 'main');
ExtensionConfig::add_language_key('colrow', 'Col $1, Row $2', 'English', 'main');
ExtensionConfig::add_language_key('tableintro', 'You use the <code>[table][/table]</code> tags to start and end a table. You use <code>[tr][/tr]</code> to indicate a row, and <code>[td][/td]</code> to indicate a cell. The <code>[tr]</code> tag must go directly inside the <code>[table]</code> tag, and the <code>[td]</code> tag must go inside the <code>[tr]</code> tag.', 'English', 'main');
ExtensionConfig::add_language_key('relevance', 'Relevance', 'English', 'main');
echo '<li>RV4: Adding new language keys... success</li>';
//alert the admin that the promotion operator has been changed from > to >=
$db->query('INSERT INTO `#^reports`(post_id,post_type,reason,reported_by,time_reported) VALUES(0, \'special\',\'' . $db->escape('For automatic user group promotion, the system now checks if the user\'s post count is greater than or equal to the number you enter, as opposed to strictly greater than.') . '\',0,' . time() . ')') or enhanced_error('Failed to alert admin about promotion operator change', true);
//welcome the admin to FutureBB 1.4
$db->query('INSERT INTO `#^reports`(post_id,post_type,reason,reported_by,time_reported) VALUES(0, \'special\',\'' . $db->escape('Welcome to FutureBB 1.4! Once you follow the steps explained in the other automatic notifications, your upgrade will be complete. We hope you enjoy it!') . '\',0,' . time() . ')') or enhanced_error('Failed to alert admin to rebuild search index', true);
set_config('db_version', 4);
set_config('new_version', 0);
Exemplo n.º 11
0
 static function CheckPromotion()
 {
     global $futurebb_user, $db;
     if ($futurebb_user['g_promote_group'] == 0) {
         return;
     }
     $num_posts = $futurebb_user['num_posts'];
     $days_registered = floor((time() - $futurebb_user['registered']) / 60 / 60 / 24);
     if ($futurebb_user['g_promote_operator'] == 1) {
         $promote = $num_posts >= $futurebb_user['g_promote_posts'] && $days_registered >= $futurebb_user['g_promote_days'];
     } else {
         $promote = $num_posts >= $futurebb_user['g_promote_posts'] || $days_registered >= $futurebb_user['g_promote_days'];
     }
     if ($promote) {
         $db->query('UPDATE `#^users` SET group_id=' . $futurebb_user['g_promote_group'] . ' WHERE id=' . $futurebb_user['id']) or error('Failed to update user group', __FILE__, __LINE__, $db->error());
         ExtensionConfig::run_hooks('user_promoted', array());
     }
 }
Exemplo n.º 12
0
    set_config('maintenance', 1);
    set_config('turn_on_maint', 0);
}
if ($futurebb_config['turn_off_maint'] > 0 && $futurebb_config['turn_off_maint'] < time() && $futurebb_config['maintenance']) {
    set_config('maintenance', 0);
    set_config('turn_off_maint', 0);
}
if ($futurebb_config['maintenance'] && !$futurebb_user['g_admin_privs'] && strpos(str_replace($base_config['basepath'], '', $_SERVER['REQUEST_URI']), '/styles') !== 0 && strpos(str_replace($base_config['basepath'], '', $_SERVER['REQUEST_URI']), '/login') !== 0) {
    httperror('maint');
}
if (isset($page_info['admin']) && !$futurebb_user['g_admin_privs']) {
    httperror(403);
}
if (isset($page_info['mod']) && !$futurebb_user['g_mod_privs']) {
    httperror(403);
}
//automatically check for updates
if (ini_get('allow_url_fopen')) {
    if ($futurebb_config['last_update_check'] < time() - 60 * 60 * 24 && !$futurebb_config['new_version']) {
        $version = file_get_contents('http://futuresight.org/api/getversion/futurebb');
        if ($version > FUTUREBB_VERSION) {
            translate('<addfile>', 'admin');
            $q = new DBInsert('reports', array('post_type' => 'special', 'reason' => translate('newversionmsg'), 'time_reported' => time()), 'Failed to insert update notification');
            $q->commit();
            set_config('new_version', 1);
        }
        set_config('last_update_check', time());
    }
}
ExtensionConfig::run_hooks('startup', array());