326

(71 replies, posted in News)

Actually, he never said that. He said there are issues. Anyway, he doesn't need it I guess because he knows there is an issue. If you need to check it still Smartys my email is: shedrock@sympatico.ca

327

(71 replies, posted in News)

I am assuming you received the email though?

I think you mean in each plugin. I tried it but it doesn't work. I just get an error:

Parse error: parse error, unexpected '=' in c:\punbb\plugins\AMP_Uploads_Conf.php on line 40

Ok, I am lost. Exactly where do I find that. This is what I see in admin_load.php

if (!isset($_SERVER['REQUEST_URI']))
    $_SERVER['REQUEST_URI'] = (isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '').'?'.(isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '');

330

(71 replies, posted in News)

I sent you an email Smarty's with some login info to test yourself.

Cheers!
Bingiman

Here is AP_Attachment_Mod.php

<?php
##
##

// Tell admin_loader.php that this is indeed a plugin and that it is loaded
define('PUN_PLUGIN_LOADED', 1);

require PUN_ROOT.'include/attach/attach_incl.php'; //Attachment Mod row, loads variables, functions and lang file


//
// If we have any input
//

if(isset($_POST['read_documentation'])){    // the user wants to read the documentation, so let him/her do so...
    generate_admin_menu($plugin);    // Display the admin navigation menu
?>

<?php
}elseif(isset($_POST['list_attachments'])){
    if(isset($_POST['start']))
        $attach_limit_start = intval($_POST['start']);
    else
        $attach_limit_start = 0;
    if(isset($_POST['number']))
        $attach_limit_number = intval($_POST['number']);
    else
        $attach_limit_number = 50;
    if(isset($_POST['auto_increase']))
        $attach_auto_increase = (intval($_POST['auto_increase'])==1)?$attach_limit_start+$attach_limit_number:$attach_limit_start;
    else
        $attach_auto_increase = $attach_limit_start;
    if(isset($_POST['direction']))
        $attach_result_direction = (intval($_POST['direction'])==1)?'ASC':'DESC';
    else
        $attach_result_direction = 'ASC';
    if(isset($_POST['order']))
        switch (intval($_POST['order'])){
            case 0:
                $attach_result_order = 'id';
                break;
            case 1:
                $attach_result_order = 'downloads';
                break;
            case 2:
                $attach_result_order = 'size';
                break;
            case 3:
                $attach_result_order = 'downloads*size';
                break;
            default:
                $attach_result_order = 'id';
                break;
        }
    else
        $attach_result_order = 'id';
        
    $attach_output = '';
    
    //search for all attachments ...
    $result = $db->query('SELECT id, owner, post_id, filename, extension, mime, location, size, downloads FROM `'.$db->prefix.'attach_2_files` ORDER BY '.$attach_result_order.' '.$attach_result_direction.' LIMIT '.$attach_limit_start.','.$attach_limit_number.'')or error('Unable to fetch attachments',__FILE__,__LINE__,$db->error());
    if($db->num_rows($result)>0){
        while(list($attach_id,$attach_owner,$attach_post_id,$attach_filename,$attach_extension,$attach_mime,$attach_location,$attach_size,$attach_downloads)=$db->fetch_row($result)){
            $attach_output .= '                <div class="inform">
                    <fieldset>
                        <legend>Attachment: ('.$attach_id.') '.$attach_filename.'</legend>
                        <div class="infldset">
                        <table class="aligntop" cellspacing="0">
                            <tr>
                                <th scope="row">Filename</th>
                                <td>
                                    <span>'.attach_icon($attach_extension).'"<a href="attachment.php?item='.$attach_id.'">'.$attach_filename.'</a>" Click to view/download.</span>
                                </td>
                            </tr>
                            <tr>
                                <th scope="row">Filesize</th>
                                <td>
                                    <span>'.number_format($attach_size).' bytes</span>
                                </td>
                            </tr>
                            <tr>
                                <th scope="row">Downloads</th>
                                <td>
                                    <span>'.number_format($attach_downloads).' downloads</span>
                                </td>
                            </tr>
                            <tr>
                                <th scope="row">Total transfer</th>
                                <td>
                                    <span>'.number_format($attach_downloads*$attach_size).' bytes</span>
                                </td>
                            </tr>
                            <tr>
                                <th scope="row">Actions</th>
                                <td>
                                    <span>
                                        <form name="alter_attachment_id_'.$attach_id.'" method="post" action="'.$_SERVER['REQUEST_URI'].'">
                                            <input class="button" type="Submit" name="delete_attachment" value="Delete attachment" /><input type="hidden" name="attachment_id" value="'.$attach_id.'" />
                                        </form>
                                    </span>
                                </td>
                            </tr>
                        </table>
                        </div>
                    </fieldset>
                </div>';
            
        }
    }else
        message('No attachments found.');
    
    
    generate_admin_menu($plugin);    // Display the admin navigation menu
?>
    <div class="block">
        <h2><span>Attachment Mod <?php echo $pun_config['attach_cur_version']; ?> - List attachments</span></h2>
        <div class="box">
            <div class="inbox">
                <div class="inform">
                    <form name="list_attachments_form" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
                    <fieldset>
                        <legend>Search options</legend>
                        <div class="infldset">
                        <table class="aligntop" cellspacing="0">
                            <tr>
                                <th scope="row">Start at</th>
                                <td>
                                    <span><input class="textbox" type="text" name="start" size="3" value="<?php echo $attach_auto_increase; ?>" tabindex="1" /> (Auto increase? <input type="radio" name="auto_increase" value="1" tabindex="2" <?php echo ($attach_auto_increase != $attach_limit_start)?'checked="checked" ':''; ?>/><strong>Yes</strong> <input type="radio" name="auto_increase" value="0" tabindex="3" <?php echo ($attach_auto_increase != $attach_limit_start)?'':'checked="checked" '; ?>/><strong>No</strong>)</span>
                                </td>
                            </tr>
                            <tr>
                                <th scope="row">Number to show</th>
                                <td>
                                    <span><input class="textbox" type="text" name="number" size="3" value="<?php echo $attach_limit_number; ?>"  tabindex="4" /></span>
                                </td>
                            </tr>
                            <tr>
                                <th scope="row">Order</th>
                                <td>
                                    <span><input type="radio" name="order" value="0" tabindex="5" <?php echo ($attach_result_order == 'id')?'checked="checked" ':''; ?>/>ID <input type="radio" name="order" value="1" tabindex="6" <?php echo ($attach_result_order == 'downloads')?'checked="checked" ':''; ?>/>Downloads <input type="radio" name="order" value="2" tabindex="7" <?php echo ($attach_result_order == 'size')?'checked="checked" ':''; ?>/>Size <input type="radio" name="order" value="3" tabindex="8" <?php echo ($attach_result_order == 'downloads*size')?'checked="checked" ':''; ?>/>Total transfer</span>
                                </td>
                            </tr>
                            <tr>
                                <th scope="row">Direction</th>
                                <td>
                                    <span><input type="radio" name="direction" value="1" tabindex="9" <?php echo ($attach_result_direction == 'ASC')?'checked="checked" ':''; ?>/>Increasing <input type="radio" name="direction" value="0" tabindex="10" <?php echo ($attach_result_direction == 'DESC')?'checked="checked" ':''; ?>/>Decreasing</span>
                                </td>
                            </tr>
                        </table>
                        <input class="button" type="submit" name="list_attachments" value="List Attachments" tabindex="11" />
                        </div>
                    </fieldset>
                    </form>
                </div>
                <?php echo $attach_output; ?>
            </div>
        </div>
    </div>
<?php    
}elseif(isset($_POST['delete_orphan'])){
    //ok, delte this attachment
    if(attach_delete_attachment(intval($_POST['attachment_id'])))
        message('Orpahn attachment deleted.');
    else
        message('Error when deleting orphan. Orphan attachment not deleted.');

}elseif(isset($_POST['delete_attachment'])){
    //ok, delete this attachment
    if(attach_delete_attachment(intval($_POST['attachment_id'])))
        message('Attachment deleted.');
    else
        message('Error when deleting attachment. Attachment not deleted.');

}elseif(isset($_POST['list_orphans'])){
    $attach_output='';
    
    //search if we have any orphans
    $result_attach = $db->query('SELECT af.id, af.owner, af.post_id, af.filename, af.extension, af.mime, af.location, af.size, af.downloads FROM `'.$db->prefix.'attach_2_files` AS af LEFT JOIN `'.$db->prefix.'posts` AS p ON p.id=af.post_id WHERE p.id IS NULL') or error('Unable to search for orphans',__FILE__,__LINE__,$db->error());
    if($db->num_rows($result_attach)>0){// if we have any orphans, output some info
        while(list($attach_id,$attach_owner,$attach_post_id,$attach_filename,$attach_extension,$attach_mime,$attach_location,$attach_size,$attach_downloads)=$db->fetch_row($result_attach)){
            $attach_output .= '
                <div class="inform">
                    <fieldset>
                        <legend>Attachment: ('.$attach_id.') '.$attach_filename.'</legend>
                        <div class="infldset">
                        <table class="aligntop" cellspacing="0">
                            <tr>
                                <th scope="row">Filename</th>
                                <td>
                                    <span>'.attach_icon($attach_extension).'"<a href="attachment.php?item='.$attach_id.'">'.$attach_filename.'</a>" Click to view/download. (Location on disk: "'.$attach_location.'")</span>
                                </td>
                            </tr>
                            <tr>
                                <th scope="row">Filesize</th>
                                <td>
                                    <span>'.number_format($attach_size).' bytes</span>
                                </td>
                            </tr>
                            <tr>
                                <th scope="row">Downloads</th>
                                <td>
                                    <span>'.number_format($attach_downloads).' downloads</span>
                                </td>
                            </tr>
                            <tr>
                                <th scope="row">Total transfer</th>
                                <td>
                                    <span>'.number_format($attach_downloads*$attach_size).' bytes</span>
                                </td>
                            </tr>
                            <tr>
                                <th scope="row">Actions</th>
                                <td>
                                    <span>
                                        <form name="alter_attachment_id_'.$attach_id.'" method="post" action="'.$_SERVER['REQUEST_URI'].'">
                                            <input class="button" type="Submit" name="delete_orphan" value="Delete attachment" /><input type="hidden" name="attachment_id" value="'.$attach_id.'" />
                                        </form>
                                    </span>
                                </td>
                            </tr>
                        </table>
                        </div>
                    </fieldset>
                </div>';
        }
    }else    // if we haven't any orphans, show such a message
        message('No orphans found. Yipeee. :)');

        

    generate_admin_menu($plugin);    // Display the admin navigation menu
?>
    <div class="block">
        <h2><span>Attachment Mod <?php echo $pun_config['attach_cur_version']; ?> - List all orphan attachments</span></h2>
        <div class="box">
            <div class="inbox">
                <?php echo $attach_output; ?>
            </div>
        </div>
    </div>
<?php
        
}elseif(isset($_POST['delete_orphans'])){
    // search for all orphans, 
    $result_attach = $db->query('SELECT af.id FROM `'.$db->prefix.'attach_2_files` AS af LEFT JOIN `'.$db->prefix.'posts` AS p ON p.id=af.post_id WHERE p.id IS NULL') or error('Unable to search for orphans',__FILE__,__LINE__,$db->error());
    // if there is any orphans start deleting them one by one...
    if($db->num_rows($result_attach)>0){// we have orphan(s)
        $i=0;
        while(list($attach_id)=$db->fetch_row($result_attach)){
            attach_delete_attachment($attach_id);
            $i++;
        }
        message($i.' orphan(s) deleted. Shouldn\'t be any orphans left now');
    }else{// if there aren't any orphans, tell the user that...
        message('No orphans found. Yipeee. :)');
    }
    
}elseif(isset($_POST['edit_rules'])&&isset($_POST['forum'])){

    $attach_output ='';
    $attach_cur_f_id=intval($_POST['forum']);
    
    // first some stuff is things are updated, deleted or created ... after this the normal 'edit_rules' will show ... 
    
    if(isset($_POST['update_ruleset'])){
        // here the update will go ... to update an existing ruleset
        // calculate the rules
        $attach_cur_group_rules = 0;
        $attach_cur_group_rules += (isset($_POST['download']))?ATTACH_DOWNLOAD:0;
        $attach_cur_group_rules += (isset($_POST['upload']))?ATTACH_UPLOAD:0;
        $attach_cur_group_rules += (isset($_POST['owner_delete']))?ATTACH_OWNER_DELETE:0;
        $attach_cur_group_rules += (isset($_POST['delete']))?ATTACH_DELETE:0;
        $attach_cur_group_id = intval($_POST['edit_ruleset']);
        $attach_cur_group_size = ($pun_config['attach_max_size']>intval($_POST['size']))?intval($_POST['size']):$pun_config['attach_max_size'];
        $attach_cur_group_per_post = intval($_POST['per_post']);
        $attach_cur_group_file_ext = $db->escape($_POST['file_ext']);

        if($attach_cur_group_rules != 0)
            $result = $db->query('UPDATE '.$db->prefix.'attach_2_rules SET rules=\''.$attach_cur_group_rules.'\', size=\''.$attach_cur_group_size.'\', per_post=\''.$attach_cur_group_per_post.'\', file_ext=\''.$attach_cur_group_file_ext.'\' WHERE group_id=\''.$attach_cur_group_id.'\' AND forum_id=\''.$attach_cur_f_id.'\' LIMIT 1')or error('Unable to update ruleset for group',__FILE__,__LINE__,$db->error());
        else
            $result = $db->query('DELETE FROM '.$db->prefix.'attach_2_rules WHERE group_id=\''.$attach_cur_group_id.'\' AND forum_id=\''.$attach_cur_f_id.'\' LIMIT 1')or error('Unable to update/delete ruleset for group',__FILE__,__LINE__,$db->error());

    }elseif(isset($_POST['delete_ruleset'])){
        // here the deletes will go ... to delete an existing ruleset
        $attach_cur_group_id = intval($_POST['edit_ruleset']);
        
        $result = $db->query('DELETE FROM '.$db->prefix.'attach_2_rules WHERE group_id=\''.$attach_cur_group_id.'\' AND forum_id=\''.$attach_cur_f_id.'\' LIMIT 1')or error('Unable to delete ruleset for group',__FILE__,__LINE__,$db->error());
        
        
    }elseif(isset($_POST['create_ruleset'])){
        // here the creates will go ... to create a new ruleset
        $attach_cur_group_rules = 0;
        $attach_cur_group_rules += (isset($_POST['download']))?ATTACH_DOWNLOAD:0;
        $attach_cur_group_rules += (isset($_POST['upload']))?ATTACH_UPLOAD:0;
        $attach_cur_group_rules += (isset($_POST['owner_delete']))?ATTACH_OWNER_DELETE:0;
        $attach_cur_group_rules += (isset($_POST['delete']))?ATTACH_DELETE:0;
        $attach_cur_group_id = intval($_POST['newgroup']);
        $attach_cur_group_size = intval($_POST['size']);
        $attach_cur_group_per_post = intval($_POST['per_post']);
        $attach_cur_group_file_ext = $db->escape($_POST['file_ext']);

        if($attach_cur_group_rules != 0)
            $result = $db->query('INSERT INTO '.$db->prefix.'attach_2_rules (group_id, forum_id, rules, size, per_post, file_ext) VALUES (\''.$attach_cur_group_id.'\', \''.$attach_cur_f_id.'\', \''.$attach_cur_group_rules.'\', \''.$attach_cur_group_size.'\', \''.$attach_cur_group_per_post.'\', \''.$attach_cur_group_file_ext.'\')')or error('Unable to create ruleset',__FILE__,__LINE__,$db->error());
        else
            message('You need to allow the group to do anything to add them to the rules for the forum! No new ruleset created.');
    }
    // and now back to the normal 'edit rules'
    
    
    $attach_output ='';
    $attach_cur_f_id=intval($_POST['forum']);
    
    // generate an array with groupid => groupname (used for matching existing rules, but also for creating new ones...)
    $attach_grouparray = array();
    $result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE 1 ORDER BY g_id ASC')or error('Unable to fetch usergroups',__FILE__,__LINE__,$db->error());
    if($db->num_rows($result)!=0){
        while(list($key,$value) = $db->fetch_row($result)){
            $attach_grouparray[$key]=$value;    
        }
    }
    
    // fetch all the info of this forum
    $result = $db->query('SELECT forum_name FROM '.$db->prefix.'forums WHERE id='.$attach_cur_f_id.' LIMIT 1')or error('Unable to fetch forum',__FILE__,__LINE__,$db->error());
    if($db->num_rows($result)==0)
        error('No such forum found');
    list($attach_cur_f_name) = $db->fetch_row($result);
    
    // fetch all existing rules
    $attach_rightsarray = array();
    $attach_sizearray = array();
    $attach_per_postarray = array();
    $attach_file_extarray = array();
    $result_two = $db->query('SELECT group_id, rules, size, per_post, file_ext FROM '.$db->prefix.'attach_2_rules WHERE forum_id='.$attach_cur_f_id.' ORDER BY group_id')or error('Unable to fetch rights for users in forum',__FILE__,__LINE__,$db->error());
    if($db->num_rows($result_two)!=0){
        while(list($attach_cur_group_id,$attach_cur_group_rules,$attach_cur_group_size,$attach_cur_group_per_post,$attach_cur_group_file_ext) = $db->fetch_row($result_two)){
            $attach_rightsarray[$attach_cur_group_id] = $attach_cur_group_rules;
            $attach_sizearray[$attach_cur_group_id] = $attach_cur_group_size;
            $attach_per_postarray[$attach_cur_group_id] = $attach_cur_group_per_post;
            $attach_file_extarray[$attach_cur_group_id] = $attach_cur_group_file_ext;
        }
    }
    // create output for the existing ones
    if(count($attach_rightsarray)!=0){
        $attach_output .= '
        <h2 class="block2"><span>Existing rules for forum: '.$attach_cur_f_name.'</span></h2>
        <div class="box">
            <div> 
                <div class="inform">
';
        foreach ($attach_rightsarray as $key => $value){
            $attach_cur_group_rules  ='<input type="checkbox" name="download" value="1" ';
            $attach_cur_group_rules .= (attach_rules($value,ATTACH_DOWNLOAD))?'checked="checked" ':'';
            $attach_cur_group_rules .='/>Download <input type="checkbox" name="upload" value="1" ';
            $attach_cur_group_rules .= (attach_rules($value,ATTACH_UPLOAD))?'checked="checked" ':''; 
            $attach_cur_group_rules .='/>Upload <input type="checkbox" name="owner_delete" value="1" ';
            $attach_cur_group_rules .= (attach_rules($value,ATTACH_OWNER_DELETE))?'checked="checked" ':''; 
            $attach_cur_group_rules .='/>Owner Delete <input type="checkbox" name="delete" value="1" ';
            $attach_cur_group_rules .= (attach_rules($value,ATTACH_DELETE))?'checked="checked" ':''; 
            $attach_cur_group_rules .='/>Delete';
            
            $attach_output .= '
                    <form id="example'.$key.'" name="example'.$key.'" method="post" action="'.$_SERVER['REQUEST_URI'].'">
                        <fieldset>
                            <legend>Group: ';
            $attach_output .= (array_key_exists($key,$attach_grouparray))? $attach_grouparray[$key]:'(<strong>'.$key.'</strong> Best is to delete this ruleset, no group has it!!!!)';
            $attach_output .= '</legend>
                            <div class="infldset">
                                <table class="aligntop" cellspacing="0">
                                    <tr>
                                        <th scope="row">Allow</th>
                                        <td>
                                            <span>'.$attach_cur_group_rules.'</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th scope="row">Max Upload</th>
                                        <td>
                                            <span><input class="textbox" type="text" name="size" value="'.$attach_sizearray[$key].'" />bytes</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th scope="row">Attachments per post</th>
                                        <td>
                                            <input class="textbox" type="text" name="per_post" value="'.$attach_per_postarray[$key].'" />
                                            <span>Here you can increase the allowed number of attachments per post. (To add more attachments to a post the user needs to edit the message.)</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th scope="row">Allowed files</th>
                                        <td>
                                            <input class="textbox" type="text" name="file_ext" value="'.$attach_file_extarray[$key].'" size="80" />
                                            <span>If empty, allow all files except those to always deny.</span>
                                        </td>
                                    </tr>
                                </table>
                                <input type="hidden" name="forum" value="'.$attach_cur_f_id.'" />
                                <input type="hidden" name="edit_rules" value="'.$attach_cur_f_id.'" />
                                <input type="hidden" name="edit_ruleset" value="'.$key.'" />
                                <input class="button" type="submit" name="update_ruleset" value="Edit this ruleset" /> or 
                                <input class="button" type="submit" name="delete_ruleset" value="Delete this ruleset" />
                            </div>
                        </fieldset>
                    </form>
';
        }
        $attach_output .= '
                </div>
            </div>
        </div>';
    }
    // create output for creating a new one
    
    if(count($attach_grouparray)>0){
        // generate the select statement
        $attach_group_select = '
                                            <select class="textbox" id="newgroup" name="newgroup">
';
        foreach($attach_grouparray as $key => $value){
            if($key!=1)$attach_group_select .= '                                                <option value="'.$key.'">'.$value.'</OPTION>
';
        }
        $attach_group_select .= '
                                            </select>
';
        // generate the whole baddabang ... 
        $attach_output .= '
        
        <h2 class="block2"><span>Create new ruleset for forum: '.$attach_cur_f_name.'</span></h2>
        <div class="box">
            <div> 
                <div class="inform">
                    <form id="createnew" name="createnew" method="post" action="'.$_SERVER['REQUEST_URI'].'">
                        <fieldset>
                            <legend>Create new ruleset</legend>
                            <div class="infldset">
                                <table class="aligntop" cellspacing="0">
                                    <tr>
                                        <th scope="row">Group</th>
                                        <td>'.$attach_group_select.'</td>
                                    </tr>
                                    <tr>
                                        <th scope="row">Allow</th>
                                        <td>
                                            <span><input type="checkbox" name="download" value="1" />Download 
                                            <input type="checkbox" name="upload" value="1" />Upload 
                                            <input type="checkbox" name="owner_delete" value="1" />Owner Delete 
                                            <input type="checkbox" name="delete" value="1" />Delete</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th scope="row">Max Upload</th>
                                        <td>
                                            <span><input class="textbox" type="text" name="size" value="100000" />bytes</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th scope="row">Attachments per post</th>
                                        <td>
                                            <input class="textbox" type="text" name="per_post" value="1" />
                                            <span>Here you can increase the allowed number of attachments per post. (To add more attachments to a post the user needs to edit the message.)</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th scope="row">Allowed files</th>
                                        <td>
                                            <input class="textbox" type="text" name="file_ext" value="" size="80" />
                                            <span>If empty, allow all files except those to always deny.</span>
                                        </td>
                                    </tr>
                                </table>
                                <input type="hidden" name="forum" value="'.$attach_cur_f_id.'" />
                                <input type="hidden" name="edit_rules" value="'.$attach_cur_f_id.'" />
                                <input class="button" type="submit" name="create_ruleset" value="Create new ruleset" />
                            </div>
                        </fieldset>
                    </form>
                </div>
            </div>
        </div>
        
        ';
        
        
    }
    
    
    
    
    // output the shit
    generate_admin_menu($plugin);    // Display the admin navigation menu
?>
        <div id="exampleplugin" class="blockform">
        <h2><span>Attachment Mod <?php echo $pun_config['attach_cur_version']; ?> - Edit rules</span></h2>
        <div class="box">
            <div class="inbox">
                <p>You alter the rules per group basis, for each forum. Download, means that people in that group are allowed to download all attachments in that forum. Upload, means that the group is allowed to attach files to their posts. Owner delete, means that the owner of the file is allowed to delete the file from the post. Delete, means that the group will be allowed to delete all files (usefull for Moderators, but noone else)</p>
                <p>You can also set a max size per group, and a list of allowed filextensions. The max size cannot be set larger than the hard limit set in the settings (if it is, it'll get that value instead). The allowed file extensions is where you can limit what people is allowed to upload, if it's left empty the Attachment Mod will allow all files except those specified in the Mod Settings to always deny.</p>
            </div>
        </div>

        <?php echo $attach_output; ?>
        
    </div>
<?php    
    
    
    
    
    
}elseif(isset($_POST['list_rules'])){

    $attach_output ='';

    // generate an array with groupid => groupname, used when figuring out what the group is called ...
    $attach_grouparray = array();
    $attach_rightsarray = array();
    $result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE 1 ORDER BY g_id ASC')or error('Unable to fetch usergroups',__FILE__,__LINE__,$db->error());
    if($db->num_rows($result)!=0){
        while(list($key,$value) = $db->fetch_row($result)){
            $attach_grouparray[$key]=$value;    
        }
    }
    
    // select all the categorys and forums ...
    $result = $db->query('SELECT c.cat_name, f.id, f.forum_name FROM '.$db->prefix.'categories AS c, '.$db->prefix.'forums AS f WHERE c.id=f.cat_id ORDER BY c.disp_position, f.disp_position')or error('Unable to fetch categorys and forums',__FILE__,__LINE__,$db->error());
    if($db->num_rows($result)!=0){
        $attach_prev_cat_name = '';
        while(list($attach_cur_cat_name,$attach_cur_f_id,$attach_cur_f_name) = $db->fetch_row($result)){
            // if the category name has changed, and the last one isn't '' end the category and start a new, othervise just start one
            if($attach_cur_cat_name!=$attach_prev_cat_name){
                if($attach_prev_cat_name!=''){    // close the last one ...
                    $attach_output .= '
                </div>
            </div>
        </div>    


';
                }
                //start new category
                $attach_output .= '
        <h2 class="block2"><span>Category: '.$attach_cur_cat_name.'</span></h2>
        <div class="box">
            <div> 
                <div class="inform">';
            }
            $attach_prev_cat_name = $attach_cur_cat_name;

            
            // empty the strings ...
            $attach_cur_forum_download = '';
            $attach_cur_forum_upload = '';
            $attach_cur_forum_delete = '';
            $attach_cur_forum_ownerdelete = '';
            unset($attach_rightsarray);            
            $attach_rightsarray = array();
            // select all the groups that has rights set in this forum...
            $result_two = $db->query('SELECT group_id, rules FROM '.$db->prefix.'attach_2_rules WHERE forum_id='.$attach_cur_f_id.' ORDER BY group_id')or error('Unable to fetch rights for users in forum',__FILE__,__LINE__,$db->error());
            if($db->num_rows($result_two)!=0){
                // clean up the array ... so we have an empty array to start with
                
                while(list($attach_cur_group_id,$attach_cur_group_rules) = $db->fetch_row($result_two)){
                    $attach_rightsarray[$attach_cur_group_id] = $attach_cur_group_rules;
                }
                
                // check what they may access ...
                foreach ($attach_rightsarray as $key => $value){
                    
                    if(attach_rules($value,ATTACH_DOWNLOAD)){
                        if(array_key_exists($key,$attach_grouparray))
                            $attach_cur_forum_download .= ', '.$attach_grouparray[$key];
                        else
                            $attach_cur_forum_download .= ', (<strong>'.$key.'</strong>)';
                    }

                    if(attach_rules($value,ATTACH_UPLOAD)){
                        if(array_key_exists($key,$attach_grouparray))
                            $attach_cur_forum_upload .= ', '.$attach_grouparray[$key];
                        else
                            $attach_cur_forum_upload .= ', (<strong>'.$key.'</strong>)';
                    }

                    if(attach_rules($value,ATTACH_DELETE)){
                        if(array_key_exists($key,$attach_grouparray))
                            $attach_cur_forum_delete .= ', '.$attach_grouparray[$key];
                        else
                            $attach_cur_forum_delete .= ', (<strong>'.$key.'</strong>)';
                    }

                    if(attach_rules($value,ATTACH_OWNER_DELETE)){
                        if(array_key_exists($key,$attach_grouparray))
                            $attach_cur_forum_ownerdelete .= ', '.$attach_grouparray[$key];
                        else
                            $attach_cur_forum_ownerdelete .= ', (<strong>'.$key.'</strong>)';
                    }
                    
                }
                
                
            }
            // output the forum stuff...
            $attach_output .= '
                    <form method="post" action="'.$_SERVER['REQUEST_URI'].'">
                        <fieldset>
                            <legend>Forum: '.$attach_cur_f_name.'</legend>
                            <div class="infldset">
                                <table class="aligntop" cellspacing="0">
                                    <tr>
                                        <th scope="row">Download</th>
                                        <td>
                                            <span>'.ltrim($attach_cur_forum_download,', ').'</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th scope="row">Upload</th>
                                        <td>
                                            <span>'.ltrim($attach_cur_forum_upload,', ').'</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th scope="row">Owner delete</th>
                                        <td>
                                            <span>'.ltrim($attach_cur_forum_ownerdelete,', ').'</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th scope="row">Delete</th>
                                        <td>
                                            <span>'.ltrim($attach_cur_forum_delete,', ').'</span>
                                        </td>
                                    </tr>
                                </table>
                                <input type="hidden" name="forum" value="'.$attach_cur_f_id.'" /><input class="button" type="submit" name="edit_rules" value="Edit rules for this forum" />
                            </div>
                        </fieldset>
                    </form>
';
        }
        // close the last category
        $attach_output .= '
                </div>
            </div>
        </div>    
    </div>


';
    }

    // well ... generate the page :D
    
    generate_admin_menu($plugin);    // Display the admin navigation menu

?>
        <div id="exampleplugin" class="blockform">
        <h2><span>Attachment Mod <?php echo $pun_config['attach_cur_version']; ?> - Administration Rules</span></h2>
        <div class="box">
            <div class="inbox">
                <p>This is where you select what rules should be applied on different groups on different forums.</p>
                <p>If a group isn't listed, they aren't allowed to do stuff.(Except Administrators that always may post)</p>
            </div>
        </div>
    
<?php    
    echo $attach_output;

    
}elseif(isset($_POST['optimize_tables'])){
    $result = $db->query('OPTIMIZE TABLE `'.$db->prefix.'attach_2_files`')or error('Unable to optimize table: attach_2_files',__FILE__,__LINE__,$db->error());
    $result = $db->query('OPTIMIZE TABLE `'.$db->prefix.'attach_2_rules`')or error('Unable to optimize table: attach_2_rules',__FILE__,__LINE__,$db->error());
    redirect($_SERVER['REQUEST_URI'], 'Attachment Mod '.$pun_config['attach_cur_version'].', Tables Optimized …');
    
}elseif(isset($_POST['update_settings'])){
    // rewrite stuff from POST variables
    $form['use_icon'] = intval($_POST['use_icon']);
    $form['icon_folder'] = $_POST['icon_folder']; //later strip out all < > | ? * " from the string, to try to up the safety
    $form['icon_extension'] = $_POST['icon_extension']; //later strip out all \ / < > | ? *  from the string, to try to up the safety
    $form['icon_name'] = $_POST['icon_name']; //later strip out all \ / < > | ? *  from the string, to try to up the safety
    $form['create_orphans'] = intval($_POST['create_orphans']);
    $form['always_deny'] = $_POST['always_deny']; //later strip out all \ / < > | ? *  from the string, to try to up the safety
    $form['max_size'] = intval($_POST['max_size']);
    $form['basefolder'] = $_POST['basefolder']; //later strip out all < > | ? * " from the string, to try to up the safety
    
    //insert it into the database
    //taken most from admin_options.php, small changes to cope with the attachment mod instead of forum options...
    while (list($key, $input) = @each($form))
    {
        // Only update values that have changed
        if ($pun_config['attach_'.$key] != $input)
        {
            if ($input != '' || is_int($input))
                $value = '\''.$db->escape($input).'\'';
            else
                $value = 'NULL';

            $db->query('UPDATE '.$db->prefix.'config SET conf_value='.$value.' WHERE conf_name=\'attach_'.$key.'\'') or error('Unable to update attachment mod config', __FILE__, __LINE__, $db->error());
        }
    }

    // Regenerate the config cache
    require_once PUN_ROOT.'include/cache.php';
    generate_config_cache();
// end of stuff taken from admin_options
    redirect($_SERVER['REQUEST_URI'], 'Attachment Mod '.$pun_config['attach_cur_version'].' settings updated. Redirecting …');


}elseif(isset($_POST['generate_subfolder'])||isset($_POST['change_subfolder'])){
    // if the latter, we should use that instead for new folder
    if(isset($_POST['change_subfolder']))    // we want to use the entered subfolder
        $newname = $_POST['subfolder'];        // fiddle with security later... i.e. only allow 0-9 + a-z
    else 
        $newname = attach_generate_pathname($pun_config['attach_basefolder']);    // ok, we doesn't need to use a folder that has been created beforehand ...
        
    if(!attach_create_subfolder($newname))
        error('Unable to create new subfolder with name '.$newname,__FILE__,__LINE__);
    else
        redirect($_SERVER['REQUEST_URI'], 'Attachment Mod '.$pun_config['attach_cur_version'].' new subfolder created. Redirecting …');

        
}elseif(isset($_POST['alter_settings'])||isset($_GET['alter_settings'])){
    // Display the admin navigation menu
    generate_admin_menu($plugin);
?>
    <div id="exampleplugin" class="blockform">
        <h2><span>Attachment Mod <?php echo $pun_config['attach_cur_version']; ?> - Alter Settings</span></h2>
        <div class="box">
            <div class="inbox">
                <p>From this page you can more or less alter everything how the mod will behave. Please consult the documentation before changing the values here, as some changes might get undesired results.</p>
            </div>
        </div>
        
        <h2 class="block2"><span>Settings</span></h2>
        <div class="box">
            <form method="post" action="<?php echo $_SERVER['REQUEST_URI'] ?>">
                <p class="submittop"><input class="button" type="submit" name="update_settings" value="Update settings" tabindex="1" /></p>
                <div class="inform">
                    <fieldset>
                        <legend>Attachment Icons</legend>
                        <div class="infldset">
                        <table class="aligntop" cellspacing="0">
                            <tr>
                                <th scope="row">Use icons</th>
                                <td>
                                    <strong><input type="radio" name="use_icon" value="1" <?php if($pun_config['attach_use_icon']==1)echo 'checked="checked" '; ?>tabindex="2" />Yes <input type="radio" name="use_icon" value="0" <?php if($pun_config['attach_use_icon']==0)echo 'checked="checked" '; ?>tabindex="3" />No</strong>
                                    <span>If you want to globally disable the use of icons for the attachments. If it's set to No, noone will see icons, even if the users have selected to show images. Icons are not showed to people that has selected not to use images in posts.</span>
                                </td>
                            </tr>
                            <tr>
                                <th scope="row">Icon folder<div></div></th>
                                <td>
                                    <input class="textbox" type="text" name="icon_folder" value="<?php echo $pun_config['attach_icon_folder']; ?>" tabindex="4" />
                                    <span>Set this to where the attachment mod stores the icons. The pathname should end with a slash.</span>
                                </td>
                            </tr>
                            <tr>
                                <th scope="row">Icons used<div></div></th>
                                <td>
                                    <input class="textbox" type="text" name="icon_extension" value="<?php echo htmlspecialchars($pun_config['attach_icon_extension']); ?>" tabindex="5" size="50" />File extension<br />
                                    <input class="textbox" type="text" name="icon_name" value="<?php echo htmlspecialchars($pun_config['attach_icon_name']); ?>" tabindex="6" size="50" />Icon name
                                    <span>This is the arrays that holds what fileextension get what icon, the items are separated with double quotation marks (").</span>
                                </td>
                            </tr>
                        </table>
                        </div>
                    </fieldset>
                </div>
                <div class="inform">
                    <fieldset>
                        <legend>Attachment Limitations and Storage</legend>
                        <div class="infldset">
                        <table class="aligntop" cellspacing="0">
                            <tr>
                                <th scope="row">Create orphans</th>
                                <td>
                                    <strong><input type="radio" name="create_orphans" value="1" <?php if($pun_config['attach_create_orphans']=='1')echo 'checked="checked" '; ?>tabindex="7" />Yes <input type="radio" name="create_orphans" value="0" <?php if($pun_config['attach_create_orphans']=='0')echo 'checked="checked" '; ?>tabindex="8" />No</strong>
                                    <span>If you select to create orphans, then when a thread is deleted no attachments will get deleted. They will instead become orphans, with a possibility to transfer the attachments to new posts. This is done like this as if a person decides to delete his post, it might be ok to loose a couple of attachments, but if a whole thread gets deleted this would mean that people could have important attachments dissapear. I recommend this to be left on Yes (and then it will be faster to delete threads aswell)</span>
                                </td>
                            </tr>
                            <tr>
                                <th scope="row">Always deny<div></div></th>
                                <td>
                                    <input class="textbox" type="text" name="always_deny" value="<?php echo htmlspecialchars($pun_config['attach_always_deny']); ?>" tabindex="9" size="50" />
                                    <span>Files with these extensions will always be denied when people try to upload them, except for Administrators, who can override it. Separate items with double quotation marks (")</span>
                                </td>
                            </tr>
                            <tr>
                                <th scope="row">Max filesize<div></div></th>
                                <td>
                                    <input class="textbox" type="text" name="max_size" value="<?php echo htmlspecialchars($pun_config['attach_max_size']); ?>" tabindex="10" size="10" />bytes
                                    <span>This is the 'hard' limit for the maximum allowed uploadsize, not even Administrators can override this. Read documentation to know how big you can allow this to be.</span>
                                </td>
                            </tr>
                            <tr>
                                <th scope="row">Attachments basefolder<div></div></th>
                                <td>
                                    <input class="textbox" type="text" name="basefolder" value="<?php echo htmlspecialchars($pun_config['attach_basefolder']); ?>" tabindex="11" />
                                    <span>This is where the Mod will save the files, make sure PHP is allowed to create directories here, as the mod won't work if it isn't allowed to write to this folder. It's extremely important that users cannot browse this folder, as they could get hold of secure items if that would be the case.</span>
                                </td>
                            </tr>
                        </table>
                        </div>
                    </fieldset>
                </div>
                <p class="submitend"><input class="button" type="submit" name="update_settings" value="Update settings" tabindex="12" /></p>
            </form>
        </div>

        
        <h2 class="block2"><span>Subfolders</span></h2>
        <div class="box">
            <form method="post" action="<?php echo $_SERVER['REQUEST_URI'] ?>">
                <div class="inform">
                    <fieldset>
                        <legend>Subfolders</legend>
                        <div class="infldset">
                        <table class="aligntop" cellspacing="0">
                            <tr>
                                <th scope="row">Current subfolder<div></div></th>
                                <td>
                                    <input class="textbox" type="text" name="subfolder" value="<?php echo htmlspecialchars($pun_config['attach_subfolder']); ?>" tabindex="13" size="40" maxlength="32" />
                                    <span>In this subfolder the Attachment Mod will save the files. Make sure you <strong>read the documentation <u>before</u></strong> changing this. <em>I suggest you use the generate button to generate new unique names</em> instead of writing your own. (This is simply because humans usually don't make that difficult names, humans are quite predictable)</span>
                                    <span><input class="button" type="submit" name="generate_subfolder" value="Generate new subfolder" tabindex="14" /> or <input class="button" type="submit" name="change_subfolder" value="Change subfolder" tabindex="15" /></span>
                                </td>
                            </tr>
                        </table>
                        </div>
                    </fieldset>
                </div>
            </form>
        </div>
    </div>
<?php 
}else{        // Nothing has been asked for, design the 'main page'

    // calculate some statistics
    $result = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'attach_2_files WHERE 1')or error('Unable to count number of attachment files',__FILE__,__LINE__,$db->error());
    if($db->num_rows($result)!=0){
        list($attach_number_of_rows) = $db->fetch_row($result);
        if($attach_number_of_rows!=0){
            $attach_output = "Number of attachments: $attach_number_of_rows<br />\n                        ";
            // figure out the disk usage, taken from the mysql tables ...
            $result = $db->query('SELECT SUM(size),SUM(downloads),SUM(downloads*size) FROM `'.$db->prefix.'attach_2_files` WHERE 1')or error('Unable to summarize disk usage',__FILE__,__LINE__,$db->error());
            if($db->num_rows($result)!=0){
                list($attach_size,$attach_downloads,$attach_total_transfer) = $db->fetch_row($result);
                $attach_output .= 'Used diskspace: '.number_format($attach_size)." bytes<br />\n                        ";
                $attach_output .= 'Total downloads: '.number_format($attach_downloads)." downloads<br />\n                        ";
                $attach_output .= 'Total transfer: '.number_format($attach_total_transfer)." bytes transferred<br />\n                        ";
            }

            // select the most downloaded file
            $result = $db->query('SELECT id, owner, filename, size, downloads FROM '.$db->prefix.'attach_2_files WHERE 1 ORDER BY downloads DESC LIMIT 1')or error('Unable to fetch most downloaded attachment',__FILE__,__LINE__,$db->error());
            if($db->num_rows($result)!=0){
                list($attach_most_id,$attach_most_owner_id,$attach_most_filename,$attach_most_size,$attach_most_downloads) = $db->fetch_row($result);
                $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE id = '.$attach_most_owner_id.' LIMIT 1')or error('Unable to fetch name on user with most downloaded attachment',__FILE__,__LINE__,$db->error());
                if($db->num_rows($result)==1)
                list($attach_most_owner) = $db->fetch_row($result);
                else
                $attach_most_owner = 'Now a guest';
                $attach_output .= 'Most downloaded: '.number_format($attach_most_downloads).' downloads ("<a href="attachment.php?item='.$attach_most_id.'">'.$attach_most_filename.'</a>" ('.number_format($attach_most_size).' bytes) posted by <a href="profile.php?section=admin&id='.$attach_most_owner_id.'">'.$attach_most_owner.'</a>)';
            }else
            $attach_output .= 'Most downloaded: none';

            // select the attachment with largest total size (size*downloads)
            $result = $db->query('SELECT id, owner, filename, size, downloads FROM '.$db->prefix.'attach_2_files WHERE 1 ORDER BY downloads*size DESC LIMIT 1')or error('Unable to fetch downloaded attachment with most transfersize',__FILE__,__LINE__,$db->error());
            if($db->num_rows($result)!=0){
                list($attach_most_id,$attach_most_owner_id,$attach_most_filename,$attach_most_size,$attach_most_downloads) = $db->fetch_row($result);
                $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE id = '.$attach_most_owner_id.' LIMIT 1')or error('Unable to fetch name on user with largest total downloaded attachment',__FILE__,__LINE__,$db->error());
                if($db->num_rows($result)==1)
                list($attach_most_owner) = $db->fetch_row($result);
                else
                $attach_most_owner = 'Now a guest';
                $attach_output .= "<br />\n".'Largest total download: '.number_format(($attach_most_downloads*$attach_most_size)).' bytes. ("<a href="attachment.php?item='.$attach_most_id.'">'.$attach_most_filename.'</a>" ('.number_format($attach_most_size).' bytes, '.number_format($attach_most_downloads).' downloads) posted by <a href="profile.php?section=admin&id='.$attach_most_owner_id.'">'.$attach_most_owner.'</a>)';
            }else
            $attach_output .= "<br />\n".'Largest total download: none';
        }else
            $attach_output = 'No attachments<br /> <br /> '; // Ugly hack due to pageformatting goes funny without those extra rows...
    }



    // Display the admin navigation menu
    generate_admin_menu($plugin);
?>
    <div id="exampleplugin" class="blockform">
        <h2><span>Attachment Mod <?php echo $pun_config['attach_cur_version']; ?> - Administration Menu</span></h2>
        <div class="box">
            <div class="inbox">
                <p>From here you can set the settings for the attachment mod. But also perform maintenence tasks (note that some are recommended to be done in Maintenence mode!)</p>
                <p>Choose from the menu below what you want to do.</p>
            </div>
        </div>

        <h2 class="block2"><span>Menu</span></h2>
        <div class="box">
            <form method="post" action="<?php echo $_SERVER['REQUEST_URI'] ?>">
                <div class="inform">
                    <fieldset>
                        <legend>Basic functions (no need for maintenence mode)</legend>
                        <div class="infldset">
                        <table class="aligntop" cellspacing="0">
                            <tr>
                                <th scope="row"><div><input class="button" type="submit" name="read_documentation" value="Read Documentation" tabindex="2" /></div></th>
                                <td>
                                    <span>Read the documentation of this mod, how it works, what makes it work, security tips, usage guidelines etc.</span>
                                </td>
                            </tr>
                            <tr>
                                <th scope="row"><div><input class="button" type="submit" name="list_attachments" value="List Attachments" tabindex="3" /></div></th>
                                <td>
                                    <span>Here you can see information for all attachments, and remove unwanted without going to the post.</span>
                                </td>
                            </tr>
                            <tr>
                                <th scope="row"><div><input class="button" type="submit" name="list_orphans" value="List Orphans" tabindex="4" /></div></th>
                                <td>
                                    <span>When a complete thread gets deleted, the attachments won't be deleted, instead they turn up as orphans (has no parents, i.e. no post is the owner of this attachment). The reason why this is made is because loosing 1-10 attachments might not be that bad, but loosing hundreds might be.</span>
                                </td>
                            </tr>
                            <tr>
                                <th scope="row"><div><input class="button" type="submit" name="delete_orphans" value="Delete Orphans" tabindex="5" /></div></th>
                                <td>
                                    <span>This will delete <strong>all</strong> orphan attachments.</span>
                                </td>
                            </tr>
                            <tr>
                                <th scope="row"><div><input class="button" type="submit" name="list_rules" value="List Rules" tabindex="6" /></div></th>
                                <td>
                                    <span>In here you can see what permissions you have set for different groups, and you can assign groups access to attach files to their posts or change already existing rules. All settings are per group and per forum basis. No rules = no permissions.</span>
                                </td>
                            </tr>
                        </table>
                        </div>
                    </fieldset>
                </div>
                <div class="inform">
                    <fieldset>
                        <legend>Advanced functions (You should probably be in maintenence mode)</legend>
                        <div class="infldset">
                        <table class="aligntop" cellspacing="0">
                            <tr>
                                <th scope="row"><div><input class="button" type="submit" name="optimize_tables" value="Optimize Attachments" tabindex="7" /></div></th>
                                <td>
                                    <span>If alot of files has been removed, or lots of rules been removed, there are probably alot of overhead in the database, optimize removed unused space in the database tables.</span>
                                </td>
                            </tr>
                            <tr>
                                <th scope="row"><div><input class="button" type="submit" name="alter_settings" value="Alter Settings" tabindex="8" /></div></th>
                                <td>
                                    <span>Here you can change almost all settings how the mod behaves, from adding new icons, to creating a new directory to store new attachments in.</span>
                                </td>
                            </tr>
                        </table>
                        </div>
                    </fieldset>
                </div>
            </form>
        </div>
        
        <h2 class="block2"><span>Statistics</span></h2>
        <div id="adstats" class="box">
            <div class="inbox">
                <dl>
                    <dt>Mod Version</dt>
                    <dd>Attachment Mod <?php echo $pun_config['attach_cur_version']; ?><br />
                        © Copyright 2003, 2004, 2005 Frank Hagström
                    </dd>
                    <dt>Attachments<br />(According to files currently in database)</dt>
                    <dd>
                        <?php echo $attach_output;?>
                    </dd>
                </dl>
            </div>
        </div>
    </div>
<?php
}


// Note that the script just ends here. The footer will be included by admin_loader.php.

Sorry, I did not recall you saying that before. I must have missed it.

Here is AMP_Upload_Conf.php

<?php


// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
    exit;

// Tell admin_loader.php that this is indeed a plugin and that it is loaded
define('PUN_PLUGIN_LOADED', 1);

$result = $db->query('SELECT * FROM '.$db->prefix.'uploads_conf WHERE g_id='.$pun_user['g_id']); 
$upl_conf= $db->fetch_assoc($result);
if (!$upl_conf) {
    $result = $db->query('SELECT * FROM '.$db->prefix.'uploads_conf WHERE g_id=0');        
    $upl_conf= $db->fetch_assoc($result);
}    


// If the "Show text" button was clicked
if (isset($_POST['save_options']))
{
     $k=1;
     while ($k <= $_POST['k']) {  
            if (isset($_POST['p_view_'.$k])) { $p_view[$k] = $_POST['p_view_'.$k]; } else $p_view[$k]=0;
            if (isset($_POST['p_upload_'.$k])) { $p_upload[$k] = $_POST['p_upload_'.$k]; } else $p_upload[$k]=0;
            if (isset($_POST['p_globalview_'.$k])) { $p_globalview[$k] = $_POST['p_globalview_'.$k]; } else $p_globalview[$k]=0;
            if (isset($_POST['p_delete_'.$k])) { $p_delete[$k] = $_POST['p_delete_'.$k]; } else $p_delete[$k]=0;
            if (isset($_POST['p_globaldelete_'.$k])) { $p_globaldelete[$k] = $_POST['p_globaldelete_'.$k]; } else $p_globaldelete[$k]=0;
            if (isset($_POST['p_setop_'.$k])) { $p_setop[$k] = $_POST['p_setop_'.$k]; } else $p_setop[$k]=0;
            if (isset($_POST['u_fsize_'.$k])) { $u_fsize[$k] = $_POST['u_fsize_'.$k]; } else $u_fsize[$k]=0;
    
        $result2 = $db->query('SELECT g_id FROM '.$db->prefix.'uploads_conf WHERE g_id='.$k); 
        if ($db->fetch_assoc($result2)) {
            $query=('UPDATE '.$db->prefix.'uploads_conf SET p_view = '.$p_view[$k].', p_upload ='.$p_upload[$k].', p_globalview = '.$p_globalview[$k].', p_delete = '.$p_delete[$k].', p_globaldelete = '.$p_globaldelete[$k].', p_setop = '.$p_setop[$k].', u_fsize = '.$u_fsize[$k].'  WHERE g_id='.$k.';');
        } else {
            $query=('INSERT INTO '.$db->prefix.'uploads_conf VALUES ('.$k.', '.$u_fsize[$k].',  '.$p_view[$k].', '.$p_globalview[$k].', '.$p_upload[$k].', '.$p_delete[$k].', '.$p_globaldelete[$k].', '.$p_setop[$k].')');
        }        
        $result = $db->query($query);
        $k++; } //while 
        redirect($_SERVER['REQUEST_URI'],'Permissions updated, redirecting …');
}
elseif (isset($_POST['save_types']))
{
    $k = 1;
    while ($k <= $_POST['num_types']) {
        $cat = "cat$k";
        $ext = "ext$k";
        $db->query("UPDATE {$db->prefix}uploads_types SET type='{$_POST[$cat]}', exts='{$_POST[$ext]}'
                WHERE id=$k") or error('Unable to update info about types', __FILE__, __LINE__, $db->error());
    $k++;
    }
    redirect($_SERVER['REQUEST_URI'],'Types updated, redirecting …');

}
elseif (isset($_POST['add_type']))
{
    $db->query("INSERT INTO {$db->prefix}uploads_types (type,exts) VALUES ('{$_POST[cat0]}','{$_POST[ext0]}')")
        or error('Unable to add new type', __FILE__, __LINE__, $db->error());
    redirect($_SERVER['REQUEST_URI'],'New type added, redirecting …');
        
}
elseif (isset($_GET['action']) && isset($_GET['id']))
{
    if ($_GET['action']=='delete')
    {
        $db->query("DELETE FROM {$db->prefix}uploads_types WHERE id={$_GET[id]}")
            or error('Unable to delete a type', __FILE__, __LINE__, $db->error());
    redirect('admin_loader.php?plugin='.$plugin,'Type deleted, redirecting …');     
    }
    else redirect('admin_loader.php?plugin='.$plugin,'Action unknown, redirecting …');     

}


    // Display the admin navigation menu
    generate_admin_menu($plugin);

?>
<div id="exampleplugin" class="blockform">
        <h2><span>PunUploadExtra 1.0 module options</span></h2>
        <div class="box">
            <div class="inbox">
<?php     if (!$upl_conf['p_setop'])
             { echo '<p>You do not have permissions to set configuration of this module. Please contact Administration.</p>';}
        else { 


?>

                <p>This plugin edits settings for PunUploadExtra module.</p>

        
        
<?php
     $result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups') or error('Unable to get useergroups', __FILE__, __LINE__, $db->error()); 
     $i=0;
    while ($i < $db->num_rows($result)) {

        $groups[$i] = $db->fetch_assoc($result);
        $result2 = $db->query('SELECT * FROM '.$db->prefix.'uploads_conf WHERE g_id='.$groups[$i]['g_id']) or error('Unable to read upload persmissions', __FILE__, __LINE__, $db->error());
        $perms[$i]= $db->fetch_assoc($result2);
        if (!$perms[$i]) {
            $result2 = $db->query('SELECT * FROM '.$db->prefix.'uploads_conf WHERE g_id=0');        
            $perms[$i]= $db->fetch_assoc($result2);
           }
         $i++;               
    }

?>

    <div class="inform">
        <form id="example" method="post" action="<?php echo $_SERVER['REQUEST_URI'] ?>">
        <fieldset>
            <legend>Edit group permissions for uploads module</legend>
            <div class="infldset">
                <table id="forumperms" cellspacing="0">
                <thead>
                    <tr>
                        <th class="atcl"> </th>
                        <th>Access to uploader</th>
                        <th>Upload files</th>
                        <th>View *all* uploaded files</th>
                        <th>Delete files</th>
                        <th>Global Moderation</th>
                        <th>Set uploader options</th>
                        <th>Max upload file size (Kb)</th>
                    </tr>
                </thead>
                <tbody>
                
<?php     $k=0; 
    foreach ($groups as $group) 
    { ?>
                
                    <tr>
                        <th class="atcl">
                            <?php     echo $group['g_title'] ?>
                            <input type="hidden" name="g_title_<?php     echo $group['g_id']; echo '" value="'.$group['g_title'].'"'; ?> />
                        </th>
                        <td><?php  ?>
                            <input type="checkbox" name="p_view_<?php     echo $group['g_id'] ?>" value="1" <?php     if ($perms[$k]['p_view']==1) echo 'checked="checked"'; ?> />
                        </td>
                        <td>
                            <input type="checkbox" name="p_upload_<?php     echo $group['g_id'] ?>" value="1" <?php     if ($perms[$k]['p_upload']==1) echo 'checked="checked"'; ?> />
                        </td>
                        <td>
                            <input type="checkbox" name="p_globalview_<?php     echo $group['g_id'] ?>" value="1" <?php     if ($perms[$k]['p_globalview']==1) echo 'checked="checked"'; ?> />
                        </td>
                        <td>
                            <input type="checkbox" name="p_delete_<?php     echo $group['g_id'] ?>" value="1" <?php     if ($perms[$k]['p_delete']==1) echo 'checked="checked"'; ?> />
                        </td>
                        <td>
                            <?php     if ($group['g_id']<>3) { ?>
                            <input type="checkbox" name="p_globaldelete_<?php     echo $group['g_id'] ?>" value="1" <?php     if ($perms[$k]['p_globaldelete']==1) echo 'checked="checked"'; ?> />
                            <?php     } else { echo '<b>N/A</b>'; ?><input type="hidden" name="p_setop_<?php     echo $group['g_id']; ?>" value="0" /><?php } ?>
                        </td>
                        <td>
                            <?php     if (($group['g_id']==1)||($group['g_id']==2)) { ?>
                            <input type="checkbox" name="p_setop_<?php     echo $group['g_id'] ?>" value="1" <?php     if ($perms[$k]['p_setop']==1) echo 'checked="checked"'; ?> />
                            <?php     } else { echo '<b>N/A</b>'; ?><input type="hidden" name="p_setop_<?php     echo $group['g_id']; ?>" value="0" /><?php } ?>                            
                        </td>
                        <td>
                            <input type="text" size="7" name="u_fsize_<?php     echo $group['g_id'] ?>" value="<?php     echo $perms[$k]['u_fsize'] ?>" />
                        </td>
                    </tr>                    

<?php     $k++; } //foreach ?>
                                                    
                </tbody>
        </table>
                <div class="fsetsubmit"><input type="submit" name="save_options" value="Save options" /></div>
        </div>
        </fieldset><div>
            <input type="hidden" name="k" value="<?php     echo $k; ?>" /></div>
        </form>
    </div>
    
    <div class="inform">
        <form id="types" method="post" action="<?php echo $_SERVER['REQUEST_URI'] ?>">
        <fieldset>
        <legend>Edit file categories and their types, or add a new one</legend>
        <div class="infldset">

            <div class="fsetsubmit"><input type="submit" name="save_types" value="Save types" /></div>
            <br />
<?php
        $result = $db->query('SELECT * FROM '.$db->prefix.'uploads_types') or error('Unable to read upload typess', __FILE__, __LINE__, $db->error());
        $num_types = 0;
        while ($ar = $db->fetch_assoc($result)) {
            echo "<input type=\"text\" size=\"30\" maxlength=\"200\" value=\"{$ar['type']}\" name=\"cat{$ar['id']}\" />  <input type=\"text\" size=\"50\" maxlength=\"250\" value=\"{$ar['exts']}\" name=\"ext{$ar['id']}\" /> <a href=\"{$_SERVER['REQUEST_URI']}&action=delete&id={$ar['id']}\">Delete</a><br />";
            $num_types++;
        }
        echo "<input type=\"hidden\" name=\"num_types\" value=\"$num_types\" />";
?>
        <div class="fsetsubmit"><input type="submit" name="save_types" value="Save types" /></div><br />
        
        <div class="inform">
        <fieldset><legend>Add a new type</legend>
            <div class="infldset">
            <input type="text" size="30" maxlength="200" value="" name="cat0" />  <input type="text" size="50" maxlength="250" value="" name="ext0" /><br />
            <input type="submit" name="add_type" value="Add new type" />
            </div>
        </fieldset>
        </div>
        </div>
        </fieldset>
        </form>
    </div>
    
    
    </div>
</div>
</div>
<?php
    } //$upl_conf['p_setop']


// Note that the script just ends here. The footer will be included by admin_loader.php.

333

(71 replies, posted in News)

This line of code is still a problem:

    // Prefix with o_base_url (unless it's there already)
    if (strpos($destination_url, $pun_config['o_base_url']) !== 0)
        $destination_url = $pun_config['o_base_url'].'/'.$destination_url;

    // Do a little spring cleaning
    $destination_url = preg_replace('/([\r\n])|(%0[ad])|(;[\s]*data[\s]*:)/i', '', $destination_url);

This is what's causing the problem on this thread:

http://punbb.org/forums/viewtopic.php?id=17591

I removed it and put the old code back and it works every time.

I also get a double slash like this.

That is not the problem. It also happens on my local setup so it is not a hosting issue, which is what I thought. It only happens to plugins that require a path for some reason.

I am not worried about the span becuase I can always alter that area to add another one. My goal was to get it to work in that area. Well, if it is too much to modify then I guess I will have to live without it.

Bingiman

I am using the attachment mod and I've never had any issues with it before. However, I am on a new host and I know my attachment directory is correct but if I save settings it works, but when I save settings again it I get the following:

Notice the URL. Any idea why this would happen?

Thanks

Yes, I am trying to add it to that line I provided above but I can't figure it out.

Let me show you a pic.

http://img104.imageshack.us/img104/3413/sample10ms2.th.gif

The image I am showing you is the line of code below:

    $last_post = 'Re: <a href="viewtopic.php?pid='.$l_pid.'#p'.$l_pid.'"'.$idmT.'>'.$idm.'</a><br />'.format_time($l_post).'<br /><span class="byuser">'.$lang_common['by'].' <a href="profile.php?id='.$l_pr_id.'">'.pun_htmlspecialchars($l_pr).'</a></span>';

That does not work for mine at all. You do also realize that my index is modded? The username on my index is an actual URL to the user profile and that's the area I need to add the code to. Your solution only changes the color of the Online users. I need to find out how to change the color of the actual username which is a link.

I am not a code. There is an area in there I have no clue what to do with. I can post the code here if you want to look at it. I am sure you can figure it out.

This is the line, notice the $l_pr

    $last_post = 'Re: <a href="viewtopic.php?pid='.$l_pid.'#p'.$l_pid.'"'.$idmT.'>'.$idm.'</a><br />'.format_time($l_post).'<br /><span class="byuser">'.$lang_common['by'].' <a href="profile.php?id='.$l_pr_id.'">'.pun_htmlspecialchars($l_pr).'</a></span>';

and this is my complete index.php

<?php
/***********************************************************************

  Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)

  This file is part of PunBB.

  PunBB is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published
  by the Free Software Foundation; either version 2 of the License,
  or (at your option) any later version.

  PunBB is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  MA  02111-1307  USA

************************************************************************/


define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';


if ($pun_user['g_read_board'] == '0')
    message($lang_common['No view']);


// Load the index.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php';

$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';

################################################################################
########################### Sub Forum MOD (start) ##############################
################################################################################
$sfcount=0;
$sfdb = array($_parent_id_, $_topics_, $_posts_, $_last_post_id_, $_last_poster_, $_last_post_);
//$forums_info = $db->query('SELECT num_topics, num_posts, parent_forum_id, last_post_id, last_poster, last_post, id, forum_name FROM '.$db->prefix.'forums ORDER BY disp_position') or error(implode($db->error(),''),__FILE__,__LINE__,$db->error());

$forums_info = $db->query('SELECT f.num_topics, f.num_posts, f.parent_forum_id, f.last_post_id, f.last_poster, f.last_post, f.id, f.forum_name, p.poster_id as last_poster_id, t.subject FROM '.$db->prefix.'forums AS f LEFT JOIN '.$db->prefix.'posts AS p ON (p.id=f.last_post_id) LEFT JOIN '.$db->prefix.'topics AS t ON t.last_post_id=f.last_post_id ORDER BY disp_position') or error(implode($db->error(),''),__FILE__,__LINE__,$db->error());
while($current = $db->fetch_assoc($forums_info)) {
 if ($current['parent_forum_id'] != 0)
  {
   $sfdb[$sfcount][0] = $current['parent_forum_id'];
   $sfdb[$sfcount][1] = $current['num_topics'];
   $sfdb[$sfcount][2] = $current['num_posts'];
   $sfdb[$sfcount][3] = $current['last_post_id'];
   $sfdb[$sfcount][4] = $current['last_poster'];
   $sfdb[$sfcount][5] = $current['last_post'];
   $sfdb[$sfcount][6] = $current['id'];
   $sfdb[$sfcount][7] = $current['forum_name'];
   $sfdb[$sfcount][8] = $current['last_poster_id'];
   $sfdb[$sfcount][9] = $current['subject'];

   $sfcount++;
  }
}
################################################################################
########################### Sub Forum MOD ( end ) ##############################
################################################################################

// MOD: MARK TOPICS AS READ - 1 LINE NEW CODE FOLLOWS
$new_topics = get_all_new_topics();

// Print the categories and forums
$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.redirect_url, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster, f.parent_forum_id, p.poster_id as last_poster_id, t.subject FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'topics AS t ON t.last_post_id=f.last_post_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') LEFT JOIN '.$db->prefix.'posts AS p ON (p.id=f.last_post_id) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND (f.parent_forum_id IS NULL OR f.parent_forum_id=0) ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());

$cur_category = 0;
$cat_count = 0;

// stuff for toggling categories
$cat_ids = (isset($_COOKIE['collapseprefs']))? $_COOKIE['collapseprefs'].',': FALSE;

while ($cur_forum = $db->fetch_assoc($result))
{
    $moderators = '';

    if ($cur_forum['cid'] != $cur_category)    // A new category since last iteration?
    {
        if ($cur_category != 0)
            echo "\t\t\t".'</tbody>'."\n\t\t\t".'</table>'."\n\t\t".'</div>'."\n\t".'</div>'."\n".'</div>'."\n\n";

        ++$cat_count;

        // Setting varibles for toggling categories
        $div_box = strstr($cat_ids, $cat_count.',')? ' style="display:none"' : '';
        $exp_img = (is_file('img/blank.gif')? 'img/': 'img/') . (strpos($div_box,'none') ? 'blank.gif' : 'blank.gif');
?>
<div id="idx<?php echo $cat_count ?>" class="blocktable">
    <h2>
        <span><a class="forum-cat" href="javascript:togglecategory(<?php echo $cat_count?>);" title="Collapse/Expand Category"><img style="vertical-align: middle;" src="<?php echo $exp_img?>" alt="Collapse" id="img_<?php echo $cat_count?>" /><?php echo pun_htmlspecialchars($cur_forum['cat_name']) ?></a></span>
    </h2>
    <div class="box" id="box_<?php echo $cat_count ?>"<?php echo $div_box?>>
        <div class="inbox">
            <table cellspacing="0">
            <thead>
                <tr>
                    <th style="border-top: 0px;" class="tcl" scope="col"><?php echo $lang_common['Forum'] ?></th>
                    <th style="border-top: 0px;" class="tc2" scope="col"><?php echo $lang_index['Topics'] ?></th>
                    <th style="border-top: 0px;" class="tc3" scope="col"><?php echo $lang_common['Posts'] ?></th>
                    <th style="border-top: 0px;" class="tcr" scope="col"><?php echo $lang_common['Last post'] ?></th>
                </tr>
            </thead>
            <tbody>
<?php

        $cur_category = $cur_forum['cid'];
    }

    $item_status = '';
    $icon_text = $lang_common['Normal icon'];
    $icon_type = 'icon';

    // Are there new posts?
        // MOD: MARK TOPICS AS READ - 1 LINE MODIFIED CODE FOLLOWS
    if (!$pun_user['is_guest'] && forum_is_new($cur_forum['fid'], $cur_forum['last_post']))

    {
        $item_status = 'inew';
        $icon_text = $lang_common['New icon'];
        $icon_type = 'icon inew';
    }

    // Is this a redirect forum?
    if ($cur_forum['redirect_url'] != '')
    {
        $forum_field = '<h3><a onclick="window.open(this.href); return false;" href="'.pun_htmlspecialchars($cur_forum['redirect_url']).'" title="'.$lang_index['Link to'].' '.pun_htmlspecialchars($cur_forum['redirect_url']).'">'.pun_htmlspecialchars($cur_forum['forum_name']).'</a></h3>';
        $num_topics = $num_posts = ' ';
        $item_status = 'iredirect';
        $icon_text = $lang_common['Redirect icon'];
        $icon_type = 'icon';
    }
    else
    {
        $forum_field = '<h3><a href="viewforum.php?id='.$cur_forum['fid'].'">'.pun_htmlspecialchars($cur_forum['forum_name']).'</a></h3>';
################################################################################
########################### Sub Forum MOD (start) ##############################
################################################################################
  $n_t = 0;
  $n_p = 0;
  $l_pid = $cur_forum['last_post_id'];
  $l_pr = $cur_forum['last_poster'];
  $l_pr_id = $cur_forum['last_poster_id'];
  $l_pr_su = $cur_forum['subject'];
  $l_post = $cur_forum['last_post'];
  for ($i = 0; $i < $sfcount; $i++)
  {
   if ($sfdb[$i][0] == $cur_forum['fid'])
    {
     $n_t = $n_t + $sfdb[$i][1];
     $n_p = $n_p + $sfdb[$i][2];
     if ($l_pid < $sfdb[$i][3])
      {
       $l_pid = $sfdb[$i][3];
       $l_pr = $sfdb[$i][4];
     $l_pr_id = $sfdb[$i][8];
       $l_post = $sfdb[$i][5];
       $l_pr_su = $sfdb[$i][9];
      }
    }
  }
  $num_topics = $n_t + $cur_forum['num_topics'];
  $num_posts = $n_p + $cur_forum['num_posts'];
################################################################################
########################### Sub Forum MOD ( end ) ##############################
################################################################################
    }

    if ($cur_forum['forum_desc'] != '')
        $forum_field .= "\n\t\t\t\t\t\t\t\t".$cur_forum['forum_desc'];


    // Display the last topic
    $idm = $l_pr_su;
    if(strlen($idm) > 25) {
        $idmComp = str_replace('"', "''", $idm);
        $idm = substr($idm, 0, 25).'...';
    } else
        $idmComp = '';
 
    // If there is a last_post/last_poster.
    if ($l_post != '') {
        $idmT = (isset($idmComp)) ? ' title="'.$idmComp.'"' : '';
    $last_post = 'Re: <a href="viewtopic.php?pid='.$l_pid.'#p'.$l_pid.'"'.$idmT.'>'.$idm.'</a><br />'.format_time($l_post).'<br /><span class="byuser">'.$lang_common['by'].' <a href="profile.php?id='.$l_pr_id.'">'.pun_htmlspecialchars($l_pr).'</a></span>';
    } else
        $last_post = ' ';

    if ($cur_forum['moderators'] != '')
    {
        $mods_array = unserialize($cur_forum['moderators']);
        $moderators = array();

        while (list($mod_username, $mod_id) = @each($mods_array))
            $moderators[] = '<a href="profile.php?id='.$mod_id.'"><span class="byuser">'.pun_htmlspecialchars($mod_username).'</span></a>';

        $moderators = "\t\t\t\t\t\t\t\t".'<br /><span class="moderator">[<span class="mod_by">'.$lang_common['Moderated by'].':</span> '.implode(', ', $moderators).']</span>'."\n";
    }

    if (!empty($sfdb)) {
        foreach ($sfdb as $sub_forums) {

            if (!$pun_user['is_guest']) {
                if ($cur_forum['fid'] == $sub_forums[0]) {
                    if (forum_is_new($cur_forum['fid'], $cur_forum['last_post']) || forum_is_new($sub_forums[6], $sub_forums[5])) {
                        $item_status = 'inew';
                        $icon_text = $lang_common['New icon'];
                        $icon_type = 'icon inew';
                    }
                }
    }
        }
    }

?>
                 <tr<?php if ($item_status != '') echo ' class="'.$item_status.'"'; ?>>
                    <td class="tcl">
                        <div class="intd">
                            <div class="<?php echo $icon_type ?>"><div class="nosize"><?php echo $icon_text ?></div></div>
                            <div class="tclcon">
                                <?php echo $forum_field."\n".$moderators ?>
<?php
                        $sub_forums_list = array();
                        if(!empty($sfdb)) {
                           foreach ($sfdb as $sub_forums) {
                                 if($cur_forum['fid'] == $sub_forums[0]) {
                                    $sub_forums_list[] = '<a class="subforum_name" href="viewforum.php?id='.$sub_forums[6].'">'.pun_htmlspecialchars($sub_forums[7]).'</a>';
                                 }
                             }
                           // EDIT THIS FOR THE DISPLAY STYLE OF THE SUBFORUMS ON MAIN PAGE
                           if(!empty($sub_forums_list)) {
                                 // Leave one $sub_forums_list commented out to use the other (between the ###..)
                                 ################################
                                 // This is Single Line Wrap Style
                                 $sub_forums_list = "\t\t\t\t\t\t\t\t".'<span class="subforum">'.$lang_common['Sub Forums'].':</span> '.implode(', ', $sub_forums_list)."\n";
                                 // This is List Style
                                 //$sub_forums_list = "\n".'<b><em>Sub Forums:</em></b><br />  --  '.implode('<br />  --  ', $sub_forums_list)."\n";
                                 ################################
                                 if ($cur_forum['forum_desc'] != NULL) {
                                    echo "<br />";
                                 }
                                 // TO TURN OFF DISPLAY OF SUBFORUMS ON INDEX PAGE, COMMENT OUT THE FOLLOWING LINE
                                 echo "$sub_forums_list";
                           }
                        }
?>
                            </div>
                        </div>
                    </td>
                    <td class="tc2"><?php echo $num_topics ?></td>
                    <td class="tc3"><?php echo $num_posts ?></td>
                    <td style="text-align: right;" class="tcr"><?php echo $last_post ?></td>
                </tr>
<?php

}

// Did we output any categories and forums?
if ($cur_category > 0)
    echo "\t\t\t".'</tbody>'."\n\t\t\t".'</table>'."\n\t\t".'</div>'."\n\t".'</div>'."\n".'</div>'."\n\n";
else
    echo '<div id="idx0" class="block"><div class="box"><div class="inbox"><p>'.$lang_index['Empty board'].'</p></div></div></div>';

//include('active-topics.php');

// Collect some statistics from the database
$result = $db->query('SELECT COUNT(id)-1 FROM '.$db->prefix.'users') or error('Unable to fetch total user count', __FILE__, __LINE__, $db->error());
$stats['total_users'] = $db->result($result);

$result = $db->query('SELECT id, username FROM '.$db->prefix.'users ORDER BY registered DESC LIMIT 1') or error('Unable to fetch newest registered user', __FILE__, __LINE__, $db->error());
$stats['last_user'] = $db->fetch_assoc($result);

$result = $db->query('SELECT SUM(num_topics), SUM(num_posts) FROM '.$db->prefix.'forums') or error('Unable to fetch topic/post count', __FILE__, __LINE__, $db->error());
list($stats['total_topics'], $stats['total_posts']) = $db->fetch_row($result);

?>
<div id="brdstats" class="block no-base-border">
    <h2><span><?php echo $lang_index['Board info'] ?></span></h2>
    <div class="box">
        <div class="inbox">
            <dl class="conr">
                <dt><strong><?php echo $lang_index['Board stats'] ?></strong></dt>
                <dd><?php echo $lang_index['No of users'].': <strong>'. $stats['total_users'] ?></strong></dd>
                <dd><?php echo $lang_index['No of topics'].': <strong>'.$stats['total_topics'] ?></strong></dd>
                <dd><?php echo $lang_index['No of posts'].': <strong>'.$stats['total_posts'] ?></strong></dd>
            </dl>
            <dl class="conl">
                <dt><strong><?php echo $lang_index['User info'] ?></strong></dt>
                <dd><?php echo $lang_index['Newest user'] ?>: <a href="profile.php?id=<?php echo $stats['last_user']['id'] ?>"><?php echo pun_htmlspecialchars($stats['last_user']['username']) ?></a></dd>
<?php

if ($pun_config['o_users_online'] == '1')
{
    // Fetch users online info and generate strings for output
    $num_guests = 0;
    $users = array();
    $result = $db->query('SELECT user_id, ident FROM '.$db->prefix.'online WHERE idle=0 ORDER BY ident', true) or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());

    while ($pun_user_online = $db->fetch_assoc($result))
    {
        if ($pun_user_online['user_id'] > 1)
            $users[] = "\n\t\t\t\t".'<dd><a href="profile.php?id='.$pun_user_online['user_id'].'">'.pun_htmlspecialchars($pun_user_online['ident']).'</a>';
        else
            ++$num_guests;
    }

    $num_users = count($users);
    echo "\t\t\t\t".'<dd>'. $lang_index['Users online'].': <strong>'.$num_users.'</strong></dd>'."\n\t\t\t\t".'<dd>'.$lang_index['Guests online'].': <strong>'.$num_guests.'</strong></dd>'."\n\t\t\t".'</dl>'."\n";


    if ($num_users > 0)
        echo "\t\t\t".'<dl id="onlinelist" class= "clearb">'."\n\t\t\t\t".'<dt><strong>'.$lang_index['Online'].': </strong></dt>'."\t\t\t\t".implode(',</dd> ', $users).'</dd>'."\n\t\t\t".'</dl>'."\n";
    else
        echo "\t\t\t".'<div class="clearer"></div>'."\n";

}
else
    echo "\t\t".'</dl>'."\n\t\t\t".'<div class="clearer"></div>'."\n";


?>
        </div>
    </div>
</div>
<?php
$footer_style = 'index';
require PUN_ROOT.'footer.php';

If you can show me what I need to change or add, that would be awesome.

Bingiman

342

(71 replies, posted in News)

You all are very welcome. big_smile

343

(2 replies, posted in General discussion)

Well, the code is simple really:

margin-top: 5px !important; margin-top: 7px;

344

(71 replies, posted in News)

Yes it does. Thank you. big_smile

ok, thank you Smartys

The changes I've made to the functions.php file are now giving me warnings. If I go to profile and then hit "submit" I get the following:

line 6 column 94 - Warning: unescaped & or unknown entity "&ampid"
line 19 column 116 - Warning: unescaped & or unknown entity "&ampid"

AS well as, it takes me to a page that says:

Bad request. The link you followed is incorrect or outdated.

Go back

Bingiman

It is a great mod. Although I don't see the reason for adding the style to the main.tpl. Isn't it a bit redundant?

Anyway, I tried it and it works great. You should have also included Members in the css classes. I also tried that and it does work as well. I myself can't use this mod because for one, my index.php file uses sub-forums with the username link to profile on the index page and that's unfortunate. It does make the site look more structured to some small degree.

Bingiman

348

(2 replies, posted in General discussion)

Can someone tell me why it is !important does not work for me. I am using FF and IE7 but IE only responds to the line that uses the !important rule. I know I am using it right because I've actually used it before. What could be causing it not to work. Thanks for any suggestions.

Bingiman.

349

(12 replies, posted in PunBB 1.2 troubleshooting)

Isn't that like forum categories? I didn't even think that was possible with pun. I did try it before and had no success.

Thanks smartys.