Thread: Major Additions - GRPS: Groups Commune 2.0.x
View Single Post
  #1821  
Old 08-26-2007, 02:41 PM
djilou djilou is offline
 
Join Date: Dec 2006
Posts: 119
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by sabret00the View Post
can you post your newreply.php in here please.
PHP Code:
<?php

/*****************************\
* Name: GRPS: Groups Commune
* Written By: Paul "sabret00the" Walker-Daley
* Concept: 30 October 2003
* Spawned: 26 March 2005
* Copyright Since: 23 April 2004
* Gold: 19 October 2006
* Modified: 21 December 2006
* Contact: sabe@ebslive.com
\*****************************/

// ################ SET SCRIPT LOCATION ENVIRONMENT ######################
require_once('./includes/config_grps.php');

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS'1);
define('GET_EDIT_TEMPLATES'true);
define('THIS_SCRIPT''groupsreply');

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array('grps''threadmanage''posting');

// get special data templates from the datastore
$specialtemplates = array(
    
'smiliecache',
    
'bbcodecache'
);

// pre-cache templates used by specific actions
$actiontemplates = array();

$globaltemplates = array(
    
'groups_newreply'
);

// ### STANDARD INITIALIZATIONS ###
$checked = array();
$newpost = array();

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
require_once(
'./includes/functions_newpost.php');
require_once(
'./includes/functions_editor.php');
require_once(
'./includes/functions_bigthree.php');
require_once(
DIR '/includes/class_postbit.php');
require_once(
'./includes/class_grps.php');
require_once(
'./includes/functions_grps.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

if (empty($vbulletin->userinfo['userid']))
{
    
print_no_permission();
}

(
$hook vBulletinHook::fetch_hook('grps_global_start')) ? eval($hook) : false;

// get decent textarea size for user's browser
$textareacols fetch_textarea_width();

$vbulletin->input->clean_array_gpc('r', array(
    
'noquote'    =>    TYPE_BOOL,
    
'p'            =>    TYPE_INT,
));


// ### GET QUOTE FEATURES ###
// check for valid thread or post
if (!empty($vbulletin->GPC['p']))
{
    
$getquotedetails $db->query_first("
        SELECT username, pagetext, dateline, groupid, threadid
        FROM grps_post
        WHERE postid = " 
intval($vbulletin->GPC['p'])
    );
    
$originalposter $getquotedetails['username'];

    
$postdate vbdate($vbulletin->options['dateformat'], $getquotedetails['dateline']);
    
$posttime vbdate($vbulletin->options['timeformat'], $getquotedetails['dateline']);
    
$pagetext htmlspecialchars_uni($getquotedetails['pagetext']);
    
$pagetext trim(strip_quotes($pagetext));

    
$groupid $getquotedetails['groupid'];
    
$threadid $getquotedetails['threadid'];

    eval(
'$newpost[\'message\'] = "' fetch_template('newpost_quote'10) . '";');

    
// fetch the quoted post title
    
$newpost['title'] = htmlspecialchars_uni(fetch_quote_title($postinfo['title'], $threadinfo['title']));
}

// ############################### start post reply ###############################
if (isset($_POST['do']) AND $_POST['do'] == 'postreply')
{
    
$vbulletin->input->clean_array_gpc('p', array(
        
'g'                 => TYPE_INT,
        
'p'                 => TYPE_INT,
        
'parentid'         => TYPE_INT,
        
'userid'         => TYPE_INT,
        
'ipaddress'         => TYPE_STR,
        
'wysiwyg'        => TYPE_BOOL,
        
'message'        => TYPE_STR,
        
'quickreply'     => TYPE_BOOL,
        
'fromquickreply' => TYPE_BOOL,
        
'folderid'       => TYPE_UINT,
        
'emailupdate'    => TYPE_UINT,
        
'title'          => TYPE_STR,
        
'iconid'         => TYPE_UINT,
        
'parseurl'       => TYPE_BOOL,
        
'signature'      => TYPE_BOOL,
        
'preview'        => TYPE_STR,
        
'disablesmilies' => TYPE_BOOL,
        
'username'       => TYPE_STR,
        
'rating'         => TYPE_UINT,
        
'stickunstick'   => TYPE_BOOL,
        
'openclose'      => TYPE_BOOL,
        
'ajax'           => TYPE_BOOL,
        
'ajax_lastpost'  => TYPE_INT
    
));

    
$threadinfo grps_getthreadinfo($_POST['t']);

    
$grps_ids explode(' 'trim($vbulletin->userinfo['grps']));

    if (!
in_array($vbulletin->GPC['g'], $grps_ids))
    {
        
print_no_permission();
    }

    if (
sizeof($errors) > 0)
    {
        
// ### POST HAS ERRORS ###
        
$postpreview construct_errors($errors); // this will take the preview's place
        
construct_checkboxes($newpost);
        
$_GET['do'] = 'newreply';
        
$newpost['message'] = htmlspecialchars_uni($newpost['message']);
    }
    else if (
$vbulletin->GPC['preview'])
    {
        
// ### PREVIEW POST ###
        
$newpost['message'] = htmlspecialchars_uni($newpost['message']);
        
$postpreview grps_datamanager::build_post_preview($newpost$vbulletin->userinfo['userid']);
        
$previewpost true;
        
$_GET['do'] = 'newreply';
    }
    else
    {
        
grps_datamanager::build_group_post($_POST);

        (
$hook vBulletinHook::fetch_hook('grps_newreply_successful')) ? eval($hook) : false;
        
        
// ### NOT PREVIEW - ACTUAL POST ###
        
if (!$vbulletin->options['grpsmoderateposts'])
        {
            
$grps_numberofposts $db->query_first("
                SELECT COUNT(*) AS posttotal, MAX(postid) AS postid
                FROM grps_post
                WHERE groupid = " 
intval($threadinfo['groupid']) . " AND threadid = " intval($threadinfo['threadid']) . "
            "
);

            
$whatpage ceil($grps_numberofposts['posttotal'] / $vbulletin->options['grpspostsperpage']);
            if (
$whatpage 1)
            {
                
$gotopage '&amp;page=' $whatpage;
            }
            else
            {
                
$gotopage FALSE;
            }

            
$vbulletin->url 'viewthread.php?' $vbulletin->session->vars['sessionurl'] . 'g=' $threadinfo['groupid'] . '&amp;t=' $threadinfo['threadid'] . $gotopage '#post' $grps_numberofposts['postid'];
        }
        else
        {
            
$vbulletin->url 'viewthread.php?' $vbulletin->session->vars['sessionurl'] . 'g=' $threadinfo['groupid'] . '&amp;t=' $threadinfo['threadid'];
        }
        eval(
print_standard_redirect('Redirecting...'FALSE));

    } 
// end if

}

// ############################### start new reply ###############################
if (isset($_GET['do']) AND $_GET['do'] == 'newreply')
{
    
$vbulletin->input->clean_array_gpc('r', array(
        
't'            =>    TYPE_INT
    
));

//    echo $threadid;

    
$threadid = (empty($threadid)) ? $vbulletin->GPC['t'] : $threadid;

    
$threadinfo grps_getthreadinfo($threadid);
    
$foruminfo grps_getgroupinfo($threadinfo['groupid']);

    
$newpost = array('title' => NULL'iconid' => NULL'message' => htmlspecialchars_uni($newpost['message']));
    
$foruminfo = @array_merge($foruminfo, array('allowbbcode' => TRUE'allowimages' => TRUE'allowhtml' => FALSE'allowsmilies' => TRUE'forumid' => NULL));

    
$grps_ids explode(' 'trim($vbulletin->userinfo['grps']));

    if (!
in_array($threadinfo['groupid'], $grps_ids))
    {
        
print_no_permission();
    }

    
// falls down from preview post and has already been sent through htmlspecialchars() in build_new_post()
    
$title = ($newpost['title']) ? construct_phrase($vbphrase['grps_re_x'], $newpost['title']) : '';

    
// *********************************************************************
    // get options checks

    
$posticons construct_icons($newpost['iconid'], 1);

    
$editorid construct_edit_toolbar(
        
$newpost['message'],
        
0,
        
$foruminfo['forumid'],
        
1,
        
1,
        (
$forumperms $vbulletin->bf_ugp_forumpermissions['canpostattachment'] AND $vbulletin->userinfo['userid'])
    );

    
$messagearea str_replace(
        array(
            
'="clientscript',
            
'src="images/smilies/'
        
),
        array(
            
'="' $vbulletin->options['bburl'] . '/clientscript',
            
'src="' $vbulletin->options['bburl'] . '/images/smilies/'
        
),
    
$messagearea);

    
$posticons str_replace('src="images/icons/''src="' $vbulletin->options['bburl'] . '/images/icons/'$posticons);

    
// auto-parse URL
    
if (!isset($checked['parseurl']))
    {
        
$checked['parseurl'] = 'checked="checked"';
    }

    if (
$vbulletin->userinfo['userid'] AND !$postpreview)
    {
        
// signature
        
$checked['signature'] = ($vbulletin->userinfo['signature'] != '') ? 'checked="checked"' '';
    }

    eval(
'$usernamecode = "' fetch_template('newpost_usernamecode') . '";');
    
$usernamecode grps_rewrite_links($usernamecode);

    
// *********************************************************************
    // finish the page

    
construct_forum_rules($foruminfo$forumperms);

    
// draw nav bar
    
$navbits = array();
    
$navbits['browse.php?' $vbulletin->session->vars['sessionurl'] . 'c=' $foruminfo['catid']] = $foruminfo['catname'];
    
$navbits['groups.php?' $vbulletin->session->vars['sessionurl'] . 'g=' $foruminfo['groupid']] = $foruminfo['title'];
    
$navbits['viewthread.php?' $vbulletin->session->vars['sessionurl'] . 'g=' $foruminfo['groupid'] . '&amp;t=' $threadinfo['threadid']] = $threadinfo['title'];
    
$navbits[''] = $vbphrase['reply_to_thread'];

    
$navbits construct_navbits($navbits);
    eval(
'$headinclude = "' fetch_template('headinclude') . '";');
    
$headinclude grps_rewrite_links($headinclude);
    eval(
'$navbar = "' fetch_template('navbar') . '";');
    
$navbar grps_rewrite_links($navbar);
    eval(
'$footer = "' fetch_template('footer') . '";');
    
$footer grps_rewrite_links($footer);
    (
$hook vBulletinHook::fetch_hook('grps_global_complete')) ? eval($hook) : false;

    
// complete
    
eval('print_output("' fetch_template('groups_newreply') . '");');

}


?>
Happy birthday
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01479 seconds
  • Memory Usage 1,968KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete