Thanks! : )

The line of code provided in Preview button on quick reply.txt

<p><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" /><input type="submit" name="preview" value="Preview" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>

is working fine, but if I to want my Preview button to be translated, I'd use the line that you'd find in post.php i.e;

<p><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" /><input type="submit" name="preview" value="<?php echo $lang_post['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>

and to my surprise it won't work. It will display an empty (but working fine) button. Any assistance would be appreciated.

78

(14 replies, posted in PunBB 1.2 troubleshooting)

Glad to see it's working fine for you! : P

Got any adivce with respect with the problem I'm encountering? Did I manage to explain it good enough for people to understand it? I know what's missing in the output, but I don't know which file or template to edit in order to fix it.

79

(14 replies, posted in PunBB 1.2 troubleshooting)

I use notepad++
nice site!

80

(14 replies, posted in PunBB 1.2 troubleshooting)

Well that's the thing, I don't know how I could edit that page since it's kinda generated after a user would click a particular link.

It's the only bug preventing me from putting the calendar on my website, so it's not in prod yet. I'm working on it using wamp but I'll be glad to send you the site and the db.txt or grant you remote access to my pc. (via msn messenger?)

81

(14 replies, posted in PunBB 1.2 troubleshooting)

yes there's a <div class="clearer"></div> at the bottom of the generated output (calendar.php?action=edit). But I don't know how to modify this output since the content of the php code is created after a user would click a link..

82

(14 replies, posted in PunBB 1.2 troubleshooting)

upon further investigations, do you guys think I'd need to edit one of the templates?
is there a way to see which template is "attached" to this no_event message?

Hi guys,

I've got this problem with the Miniportal sidebar versus the Calendar Mod

A user would click the edit an event link;
if there's no event to edit, this code

if(!$db->num_rows($result)){
message($lang_calendar['no_events']);
}

will generate this particular output in the whole php page

        <!--Calendar Version:2.0.6a -->
<div class="blocktable">

<div id="msg" class="block">
    <h2><span>Info</span></h2>
    <div class="box">
        <div class="inbox">
        <p>There is no event to edit</p>
        <p><a href="javascript: history.go(-1)">Go Back</a></p>
        </div>
    </div>
</div>
        
    </div>    
</div>

but a </div> tag is missing in the code ^^ so the sidebar won't display properly... This output display the sidebar below the There is no event to edit message. So instead of getting the correct display as show below, I get the result as shown at the bottom of this image.

http://i119.photobucket.com/albums/o144/indiequebec/idqcaleditnogood.gif

anyone know how I could make an extra </div> appear in the ^^ code whenever this function is called?. Or any other way to fix this problem?

I'm willing to provide additional files/code if necessary...

Thanks!

84

(0 replies, posted in Feature requests)

I'm part of this forum where there's this one guy who always post some insight on music and I was wondering if it would eventually become a nice feature to be able to subscribe to whatever a particular user writes..

twohawks wrote:

I would be happy to take a look at your file and check your code, Vanslyde, if you wish to post the code (or a temporary link to where I can download your calendar.php file).  I can then test it for you here.  Be sure to use the !code tag! if you post the code here!

here's my calendar.php
I tried the modifications you posted here on feb 12th. It didn't work (apart form the "No_Event message display corrections" - thanks!) and I rolled back to the previous version. I removed the Birthday stuff.

I'm stll looking for a way to a hide the Edit Event link for a guest if he/she didn't posted any in the first place, 'cause otherwiise that would bring them to this kind of screen

<?php
define('PUN_ROOT', './');
require PUN_ROOT.'calendar/header.php';
require PUN_ROOT.'include/parser.php';


?>
<!--Calendar Version:2.0.6a -->
<div class="blocktable">
<?php
//
//do the stuff like viewing topics posts birthdays or events
//
if(isset($view))
{
    if($view == 'topics')
    {
        ###########################################################
        ###//===============//=================//===============//#
        ##//===============// Show Topic List //===============//##
        #//===============//=================//===============//###
        ###########################################################

        //Number of posts to display
        $disp_topics = $pun_user['disp_topics'];

        $result = $db->query('SELECT id FROM '.$db->prefix.'topics WHERE posted > '.$datestart.' AND posted < '.$dateend);
        $num_replies = $db->num_rows($result);


        // Determine the post offset (based on $_GET['p'])
        $num_pages = ceil(($num_replies) / $disp_topics);

        $p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : $_GET['p'];
        $start_from = $disp_topics * ($p - 1);

        $pages = paginate($num_pages, $p, 'calendar.php?view=topics&date='.$year.'.'.$month.'.'.$day);

        // Pulls list of topics for the day
        $result = $db->query('
            SELECT
             t.id, t.poster, t.subject, t.posted, t.last_post, t.last_post_id, t.last_poster, t.moved_to, t.num_replies, t.closed, t.forum_id
            FROM '.$db->prefix.'topics AS t
            LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].')

            WHERE
                t.posted > '.$datestart.'  AND
                t.posted < '.$dateend.' AND
                (fp.read_forum IS NULL OR fp.read_forum=1)

            ORDER BY posted LIMIT '.$start_from.','.$disp_topics
        ) or error('Unable to fetch topic list for forum', __FILE__, __LINE__, $db->error());

?>
        <h2 style="text-align:center"><span><?php echo $lang_calendar['Viewing_Topics']." ".$datestring ?></span></h2>

        <div class="box">

        <table cellspacing="0">
        <thead>
        <tr>
            <th style="white-space: nowrap"><?php echo $lang_common['Topic']?></th>
            <th style="width: 13%; white-space: nowrap"><?php echo $lang_common['Author']?></th>
            <th style="width: 7%; white-space: nowrap"><?php echo $lang_common['Replies']?></th>
            <th style="width: 25%; white-space: nowrap"><?php echo $lang_common['Last post']?></th>
        </tr>
        </thead>
        <tbody>
<?php
        if($db->num_rows($result))
        {
            while ($cur_topic = $db->fetch_assoc($result))
            {
                if ($cur_topic['moved_to'] == null)
                    $last_post = '<a href="viewtopic.php?pid='.$cur_topic['last_post_id'].'#'.$cur_topic['last_post_id'].'">'.format_time($cur_topic['last_post']).'</a><br /> '.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['last_poster']);
                else
                    $last_post = ' ';

                if ($pun_config['o_censoring'] == '1')
                    $cur_topic['subject'] = censor_words($cur_topic['subject']);

                if ($cur_topic['closed'] == '0')
                    $subject = '<a href="viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a>';
                else
                    $subject = '<a class="punclosed" href="viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a>';

?>
            <tr class="puntopic">
                <td><?php echo $subject ?></td>
                <td><?php echo pun_htmlspecialchars($cur_topic['poster']) ?></td>
                <td><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_replies'] : ' ' ?></td>
                <td style="white-space: nowrap"><?php echo $last_post ?></td>
            </tr>
<?php
            }
        }else
            echo"\t\t\t<tr>\n\t\t\t\t<td colspan='4'>".$lang_calendar['No_Topics']."</td>\n\t\t\t</tr>";
?>
            <tr>
                <th colspan='4'> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a>       <a href="calendar.php"><?php echo"Return to Calendar"; ?></a> </th>
            </tr>
        </tbody>
        </table>
    </div>

<?php
        navigation('topics');
    }
    elseif($view == 'posts')
    {
        ##########################################################
        ###//===============//================//===============//#
        ##//===============// Show Post list //===============//##
        #//===============//================//================ ###
        ##########################################################

        //Number of posts to display
        $disp_posts = $pun_user['disp_posts'];

        $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE posted > '.$datestart.' AND posted < '.$dateend);
        $num_replies = $db->num_rows($result);


        // Determine the post offset (based on $_GET['p'])
        $num_pages = ceil(($num_replies) / $disp_posts);

        $p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : $_GET['p'];
        $start_from = $disp_posts * ($p - 1);

        $pages = paginate($num_pages, $p, 'calendar.php?view=posts&date='.$year.'.'.$month.'.'.$day);

        $result = $db->query('
            SELECT
             p.id, p.poster, p.poster_id, p.message, p.posted, p.topic_id,
             t.id as tid, t.subject as tsub, t.forum_id,
             f.id as fid, f.forum_name as fname

            FROM '.$db->prefix.'posts AS p
            INNER JOIN '.$db->prefix.'topics AS t ON p.topic_id=t.id
            INNER JOIN '.$db->prefix.'forums AS f ON t.forum_id=f.id
            LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].')


            WHERE
                p.posted > '.$datestart.' AND
                p.posted < '.$dateend.' AND
                (fp.read_forum IS NULL OR fp.read_forum=1)

            ORDER BY p.posted LIMIT '.$start_from.','.$disp_posts
        )or error('Unable to fetch topic list for forum', __FILE__, __LINE__, $db->error());

?>
        <h2 style="text-align:center"><span><?php echo $lang_calendar['Viewing_Posts']." ".$datestring ?></span></h2>

        <div class="box">
        <table cellspacing="0">
        <thead>
            <tr>
                <th style="white-space: nowrap"> <?php echo $lang_common['Message']?></th>
                <th style="width: 12%"><?php echo $lang_common['Posted']?></th>
                <th style="width: 12%"><?php echo $lang_common['Forum']?></th>
            </tr>
        </thead>
        <tbody>
<?php
        if($db->num_rows($result))
        {
            while ($cur_posts = $db->fetch_assoc($result))
            {
                if (pun_strlen($cur_posts['message']) >= 80)
                {
                    $cur_posts['message'] = substr($cur_posts['message'], 0, 79);
                    $cur_posts['message'] .= '…';
                }

?>
            <tr>
                <td>
                <?php echo $lang_common['Topic']?>: <a href="viewtopic.php?id=<?php echo$cur_posts['tid']?>"><?php echo $cur_posts['tsub']?></a><br />
                <?php echo $lang_calendar['Posted_by']?> <a href="profile.php?id=<?php echo$cur_posts['poster_id']?>"><?php echo $cur_posts['poster']?></a><br />

                <div class="box" style="padding:5px; margin:4px;">
                    <?php echo $cur_posts['message']?>
                    <div style="text-align: right">
                        <a href="viewtopic.php?pid=<?php echo$cur_posts['id'].'#p'.$cur_posts['id']?>"><?php echo $lang_calendar['go_to_post']?></a>
                    </div>
                </div>
                </td>
                <td class="puncon2cent"><?php echo date($pun_config['o_time_format'], $cur_posts['posted'])?></td>
                <td class="puncon1cent"><a href="viewforum.php?id=<?php echo$cur_posts['fid']?>"><?php echo $cur_posts['fname']?></a></td>

            </tr>

<?php            }
        }else
            echo"\t\t\t<tr>\n\t\t\t\t<td colspan='3'>".$lang_calendar['No_Posts']."</td>\n\t\t\t</tr>";
?>
                <tr>
                    <th colspan='3'> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a>       <a href="calendar.php"><?php echo"Return to Calendar"; ?></a> </th>
                </tr>
            </tbody>
            </table>
        </div>
<?php
        navigation('posts');
    }
    elseif($view == 'bday')
    {
        ###########################################################
        ###//===============//===============//=================//#
        ##//===============// Birthday list //=================//##
        #//==================================================// ###
        ###########################################################
        require PUN_ROOT.'lang/'.$pun_user['language'].'/profile.php';

        $result = $db->query('SELECT id, username, use_avatar, last_post, registered, birthday, DAYOFMONTH(birthday) as day    FROM '.$db->prefix.'users WHERE DAYOFMONTH(birthday) = '.$day.' AND MONTH(birthday) = '.$month.' ORDER BY username') or error('Unable to fetch birtday list', __FILE__, __LINE__, $db->error());


?>
        <h2 style="text-align:center"><span><?php echo $lang_calendar['Viewing_Bday']." ".$datestring ?></span></h2>

        <div class="box">

        <table cellspacing="0">
        <thead>
            <tr>
                <th style="width: 80px"><?php echo $lang_profile['Avatar']?></th>
                <th style="width: 25%; text-align: center"><?php echo $lang_common['Username']?></th>
                <th style="width: 15%; text-align: center"><?php echo $lang_calendar['Age']?></th>
                <th style="text-align: center"><?php echo $lang_common['Registered']?></th>
            </tr>
        </thead>
        <tbody>

<?php
        if($db->num_rows($result))
        {
            while($bday_list = $db->fetch_assoc($result))
            {
                if ($bday_list['use_avatar'] == '1')
                {
                    if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$bday_list['id'].'.gif'))
                        $avatar = '<img class="punavatar" src="'.$pun_config['o_avatars_dir'].'/'.$bday_list['id'].'.gif" alt="" />';
                    else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$bday_list['id'].'.jpg'))
                        $avatar = '<img class="punavatar" src="'.$pun_config['o_avatars_dir'].'/'.$bday_list['id'].'.jpg" alt="" />';
                    else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$bday_list['id'].'.png'))
                        $avatar = '<img class="punavatar" src="'.$pun_config['o_avatars_dir'].'/'.$bday_list['id'].'.png" alt="" />';
                    else
                        $avatar = $lang_profile['No avatar'];
                }
                else
                    $avatar = $lang_profile['No avatar'];

                list($bday_year,$bday_month,$bday_day) = explode('-', $bday_list['birthday']);
                $age = (strlen($bday_year)!='4')? $lang_profile['Unknown']: $year-$bday_year;
?>
            <tr>
                <td><?php echo $avatar?></td>
                <td style="text-align: center; font-size: 120%"><a href="profile.php?id=<?php echo$bday_list['id']?>"><?php echo $bday_list['username']?></a></td>
                <td style="text-align: center; font-size: 120%"><?php echo $age?></td>
                <td style="text-align: center; font-size: 120%"><?php echo format_time($bday_list['registered'])?></td>
            </tr>
<?php
            }
        }else
            echo"\t\t\t<tr>\n\t\t\t\t<td colspan='4'>".$lang_calendar['No_Bday']>"</td>\n\t\t\t</tr>\n";
?>
            <tr>
                <th colspan='4'> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a>       <a href="calendar.php"><?php echo"Return to Calendar"; ?></a> </th>
            </tr>
        </tbody>
        </table>
    </div>
<?php
        navigation('bday');
    }
    elseif($view == 'event')
    {
        ######################################################
        ###//===============//=============//==============//#
        ##//===============// Events List //==============//##
        #//===============//=============//==============//###
        ######################################################

        $stype = (isset($_GET['id']))? 'e.id = '.intval($_GET['id']) : 'dayofmonth(e.date) = '.$day.' AND month(e.date) = '.$month ;
        $result = $db->query('SELECT e.id, e.date, e.title, e.user_id, e.body, u.username as username, u.num_posts as posts, u.registered as reg, g.g_title as group_id FROM '.$db->prefix.'calendar AS e INNER JOIN '.$db->prefix.'users AS u ON e.user_id=u.id LEFT JOIN '.$db->prefix.'groups AS g ON u.group_id=g.g_id WHERE '.$stype) or error('Unable to fetch event list', __FILE__, __LINE__, $db->error());
?>
    <h2 style="text-align:center"><span><?php echo $lang_calendar['Viewing_Event']?></span></h2>
    <div class="box">

        <table cellspacing="0">
<?php
        if($db->num_rows($result))
        {
            while($event_info = $db->fetch_assoc($result))
            {

                //setting up the date info
                $date_part = explode('-',$event_info['date']);
                           //     $date = date("F jS", mktime(0,0,0,$date_part['1'],$date_part['2'], $date_part['0']));

                                  // could have used $datestring but choose do it this way, in case someone wants to use it to
                                  // view all the events in a week or month.
                                  $date = date_str(mktime(0,0,0,$date_part['1'],$date_part['2'], $date_part['0']));

                           //     This is currently not functional
                           //     if($date_part[0]=="0000")
                           //             $date .= ' (Recuring Event)';
                           //     else
                           //       $date .= ' '.$date_part[0].' (Single Day Event)';

                                  $event_info['body'] = parse_message($event_info['body'], 0);
?>
            <tr>
                <th style="width:18em;" align="left"><a href="profile.php?id=<?php echo $event_info['user_id']?>"><?php echo $event_info['username']?></a></th>
                          <th align="left"><b><?php echo $event_info['title']?></b></th>
            </tr>
            <tr>
                <td>
                                <?php echo $lang_calendar['Event_Date'].' '.$date ?>
                          </td>
                          <td valign="top">
                                <?php echo $event_info['body']?>
                          </td>
            </tr>
<?php
            }
        }else
            echo"\t\t\t<tr>\n\t\t\t\t<td colspan='2'>".$lang_calendar['No_Events']>"</td>\n\t\t\t</tr>\n";

?>
            <tr>
                <th colspan='2'> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a>       <a href="calendar.php"><?php echo"Return to Calendar"; ?></a> </th>
            </tr>
        </table>

    </div>



<?php
        navigation('event');

    }

}




//
// Do the actions like adding and editing events
//
elseif(isset($action))
{
    if(
        ($pun_user['group_id'] == PUN_MOD && $CFG_mod_add=='no')
        or ($pun_user['group_id'] == PUN_MEMBER && $CFG_user_add=='no')
        or ($pun_user['group_id'] == PUN_GUEST))
        message($lang_calendar['warning']);

    elseif($action == 'add')
    {
        #######################################################
        ###//===============//==============//==============//#
        ##//===============// Add an event //==============//##
        #//===============//==============//==============//###
        #######################################################
        if(isset($_POST['form_sent']))
        {
            // Check to see if the Title, Body, Month, and Day were sent
            if(empty($_POST['title']))
                message($lang_calendar['need_title']);
            elseif(empty($_POST['body']))
                message($lang_calendar['need_body']);
            elseif($_POST['month']=="0" || $_POST['day']=="0")
                message($lang_calendar['need_date']);

            // Clean up body and title from POST
            $title = pun_trim($_POST['title']);
            $body = pun_linebreaks(pun_trim($_POST['body']));
                         $body = preparse_bbcode($body, $errors);

            // Setup the corretct date layout for the database
                        if($_POST['year'] == $lang_calendar['Year'])
                $_POST['year'] = date('Y');

            // Check to see of the month and day were set

            // Check to see if the day seleced for the month is an actual day
            $year=($_POST['year']=='0000')? date('Y'): $_POST['year'];
            if(date('t', mktime(0,0,0,$_POST['month'],1,$year))< $_POST['day'])
                message($lang_calendar['date_error']);

            $date = $_POST['year'].'-'.$_POST['month'].'-'.$_POST['day'];

            // Add the Event to the database
            $db->query('INSERT INTO '.$db->prefix.'calendar (date, title, body, user_id) VALUES("'.$date.'", "'.$title.'", "'.$body.'", "'.$_POST['user_id'].'")') or error('Unable to create new event', __FILE__, __LINE__, $db->error());

            redirect('calendar.php', $lang_calendar['event_added']);
        }
        else
        {
?>
    <div class="blockform">
    <h2><?php echo $lang_calendar['add_event']?></h2>
    <div class="box">
        <form method="post" action="calendar.php?action=add" onsubmit="return process_form(this)">
            <div class="inform">
                <fieldset>
                    <legend><?php echo $lang_calendar['add_info']?></legend>
                    <div class="infldset">
                        <input type="hidden" name="form_sent" value="1" />
                        <input type="hidden" name="user_id" value="<?php echo $pun_user['id']?>" />

                        <label class="conl" style="width: 152px;">
                            <strong><?php echo $lang_calendar['Title']?></strong><br />
                            <input type="text" name="title" maxlength="50" /><br />
                        </label>

                        <label class="conl">
                            <strong><?php echo $lang_calendar['Date']?></strong><br />

                            <select name="month">
                                <option value='0'><?php echo $lang_calendar['Month']?></option>
<?php
    $month_name = array('',$lang_calendar['January'],$lang_calendar['February'],$lang_calendar['March'],$lang_calendar['April'],$lang_calendar['May'],$lang_calendar['June'],$lang_calendar['July'],$lang_calendar['August'],$lang_calendar['September'],$lang_calendar['October'],$lang_calendar['November'],$lang_calendar['December']);
    for($x=1;$x<13;$x++)
        echo"\t\t\t\t\t\t\t\t<option value='".$x."'>".$month_name[$x]."</option>\n";

?>
                            </select>
                        </label>
                        <label class="conl"><br />
                            <select name="day">
                                <option value='0'><?php echo $lang_calendar['Day']?></option>
<?php
    for($x=01;$x<=31;$x++)
        echo"\t\t\t\t\t\t\t\t<option value='".$x."'>".$x."</option>\n";

?>
                            </select>
                        </label>
                        <label class="conl"><br />
                            <input name="year" size="5" value="<?php echo $lang_calendar['Year']?>" onselect="document.post.year.value=''" /> 

                        </label>
                        <br />

                        <div class="txtarea">
                            <label class="conl">
                                <strong><?php echo $lang_calendar['Body']?></strong><br />
                                <textarea name="body" rows="7" cols="65"></textarea><br />
                            </label><br />
                        </div>
                        <br class="clearer">
                    </div>

                </fieldset>
            </div>
            <p><input type="submit" value="<?php echo $lang_common['Submit'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a>       <a href="calendar.php"><?php echo"Return to Calendar"; ?></a></p>
        </form>
    </div>
    </div>
        <?php
        }
    }
    elseif($action =='edit')
    {
        ########################################################
        ###//===============//===============//==============//#
        ##//===============// Edit an event //==============//##
        #//===============//===============//==============//###
        ########################################################
        if(isset($_POST['form_sent']))
        {
            // Check to see if the Title, Body, Month, and Day were sent
            if(empty($_POST['title']))
                message($lang_calendar['need_title']);
            elseif(empty($_POST['body']))
                message($lang_calendar['need_body']);
            elseif($_POST['month']=="0" || $_POST['day']=="0")
                message($lang_calendar['need_date']);

            // Clean up body and title from POST
            $title = pun_trim($_POST['title']);
            $body = pun_linebreaks(pun_trim($_POST['body']));
                         $body = preparse_bbcode($body, $errors);

            // Setup the corretct date layout for the database
                        if($_POST['year'] == $lang_calendar['Year'])
                $_POST['year'] = date('Y');

            // Check to see of the month and day were set

            // Check to see if the day seleced for the month is an actual day
            $year=($_POST['year']=='0000')? date('Y'): $_POST['year'];
            if(date('t', mktime(0,0,0,$_POST['month'],1,$year))< $_POST['day'])
                message($lang_calendar['date_error']);

            $date = $_POST['year'].'-'.$_POST['month'].'-'.$_POST['day'];

            // Add the Event to the database
            $db->query('UPDATE '.$db->prefix.'calendar SET date="'.$date.'", title="'.$title.'", body="'.$body.'" WHERE id='.$_POST['event_id']) or error('Unable to Update event', __FILE__, __LINE__, $db->error());

            redirect('calendar.php?action=edit', $lang_calendar['event_edited']);
        }
        elseif(isset($_POST['delete_event']))
        {
            if(isset($_POST['delete_confirmed'])){
                $db->query('DELETE FROM '.$db->prefix.'calendar WHERE id ="'.$_POST['delete_event'].'"') or error('Unable to Delete event', __FILE__, __LINE__, $db->error());

                redirect('calendar.php?action=edit', $lang_calendar['event_deleted']);
            }
            else
            {
                if(empty($_POST['event']))
                    message($lang_calendar['no_event']);

                $result = $db->query('SELECT date, title, body FROM '.$db->prefix.'calendar WHERE id = "'.$_POST['event'].'"') or error('Unable to fetch Event info', __FILE__, __LINE__, $db->error());
                $cur_event = $db->fetch_assoc($result);


?>
</div>
<div class="blockform">
    <h2><span><?php echo $lang_common['Info'] ?></span></h2>
    <div class="box">
        <form method="post" action="calendar.php?action=edit">
            <input type="hidden" name="delete_event" value="<?php echo $_POST['event']?>" />
            <div class="inform">
                <fieldset>
                    <legend class=warntext><?php echo $lang_calendar['delete_confirm'];?></legend>
                    <div class="infldset">
                        <div class="postmsg">
                            <p><b><?php echo $cur_event['title']?></b></p>
                            <p><?php echo $cur_event['body']?></p>
                        </div>
                    </div>
                </fieldset>
            </div>
            <p><input type="Submit" name="delete_confirmed" value="<?php echo $lang_calendar['delete_yes']?>" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a>       <a href="calendar.php"><?php echo"Return to Calendar"; ?></a></p>
        </form>
    </div>
<?php
            }
        }
        else if(isset($_POST['edit_event']))
        {
            if(empty($_POST['event']))
                message($lang_calendar['no_event']);

            // Get all the info for the event your trying to edit
            $result = $db->query('SELECT * FROM '.$db->prefix.'calendar WHERE id ="'.$_POST['event'].'"') or error('Unable to fetch event information', __FILE__, __LINE__, $db->error());
            $event_list = $db->fetch_assoc($result);

            // Get the date info and put it into parts
            $date = explode('-', $event_list['date']);
?>
    <div class="blockform">
    <h2><?php echo $lang_calendar['edit_event']?></h2>
    <div class="box">
        <form method="post" action="calendar.php?action=edit" onsubmit="return process_form(this)">
            <div class="inform">
                <fieldset>
                    <legend><?php echo $lang_calendar['edit_info']?></legend>
                    <div class="infldset">
                        <input type="hidden" name="form_sent" value="1" />
                        <input type="hidden" name="event_id" value="<?php echo $_POST['event']?>" />

                        <label style="float:left; width: 152px;">
                            <strong><?php echo $lang_calendar['Title']?></strong><br />
                            <input type="text" value="<?php echo $event_list['title']?>" name="title" maxlength="50" tabindex="1" /><br />
                        </label>

                        <label class="conl">
                            <strong><?php echo $lang_calendar['Date']?></strong><br />

                            <select name="month" tabindex="2">
                                <option value='0'><?php echo $lang_calendar['Month']?></option>
<?php
    $month_name = array('',$lang_calendar['January'],$lang_calendar['February'],$lang_calendar['March'],$lang_calendar['April'],$lang_calendar['May'],$lang_calendar['June'],$lang_calendar['July'],$lang_calendar['August'],$lang_calendar['September'],$lang_calendar['October'],$lang_calendar['November'],$lang_calendar['December']);
    for($x=1;$x<13;$x++)
    {
        $s = ($x == $date[1])? " selected='selected'" : NULL ;
        echo"\t\t\t\t\t\t\t\t<option value='".$x."'".$s.">".$month_name[$x]."</option>\n";
    }
?>
                            </select>
                        </label>
                        <label class="conl"><br />
                            <select name="day" tabindex="3">
                                <option value='0'><?php echo $lang_calendar['Day']?></option>
<?php
    for($x=01;$x<=31;$x++)
    {
        $s = ($x == $date[2])? " selected='selected'" : NULL ;
        echo"\t\t\t\t\t\t\t\t<option value='".$x."'".$s.">".$x."</option>\n";
    }
?>
                            </select>
                        </label>
                        <label class="conl"><br />
                            <input name="year" value="<?php echo $date[0]?>" size="5" tabindex="4" /> 

                        </label>
                        <br />

                        <div class="txtarea">
                            <label class="conl">
                                <strong><?php echo $lang_calendar['Body']?></strong><br />
                                <textarea name="body" rows="7" cols="65"><?php echo str_replace('<br />',"\n",$event_list['body'])?></textarea><br />
                            </label><br />
                        </div>
                        <br class="clearer">
                    </div>

                </fieldset>
            </div>
            <p><input type="submit" value="<?php echo $lang_common['Submit'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a>       <a href="calendar.php"><?php echo"Return to Calendar"; ?></a></p>
        </form>
    </div>
    </div>

<?php

        }
        else
        {

            if(($pun_user['g_id'] == PUN_MOD && $CFG_mod_add=='yes') or ($pun_user['g_id'] == PUN_MOD && $CFG_mod_edit=='no') or ($pun_user['g_id'] == PUN_MEMBER && $CFG_user_add=='yes'))
                $can_edit = "WHERE user_id = ".$pun_user['id'];
            else
                $can_edit = "";

            //Number of posts to display
            $disp_posts = $pun_user['disp_posts'];

            $result = $db->query('SELECT id FROM '.$db->prefix.'calendar');
            $num_replies = $db->num_rows($result);

            // Determine the post offset (based on $_GET['p'])
            $num_pages = ceil(($num_replies) / $disp_posts);
            $p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : $_GET['p'];
            $start_from = $disp_posts * ($p - 1);

            $pages = paginate($num_pages, $p, 'calendar.php?action=edit');

            $result = $db->query('SELECT * FROM '.$db->prefix.'calendar '.$can_edit.' ORDER BY date LIMIT '.$start_from.','.$disp_posts) or error('Unable to fetch event information', __FILE__, __LINE__, $db->error());

            if(!$db->num_rows($result)){
                message($lang_calendar['no_events']);
            }

?>


    
    <form method="post" action="calendar.php?action=edit" onsubmit="return process_form(this)">
    <div class="blockform">
        <h2><?php echo $lang_calendar['edit_event']?></h2>
        <div class="box">
            <table cellspacing='0'>
            <thead>
                <tr>
                    <th> </th>
                    <th><?php echo $lang_calendar['Title']?></th>
                    <th><?php echo $lang_calendar['Date']?></th>
                    <th><?php echo $lang_calendar['Body']?></th>


                </tr>
            </thead>
            <tbody>
<?php

            while($event_list = $db->fetch_assoc($result))
            {
                $date_part = explode('-',$event_list['date']);
                $date_year = ($date_part['0']=='0000')?  date('y') : $date_part['0'];
                $date = date_str( mktime(0,0,0,$date_part['1'],$date_part['2'],$date_year));
?>
                <tr>
                    <td style="width:10px">
                        <input type="radio" name="event" value="<?php echo $event_list['id']?>" />
                    </td>
                    <td style="width:145px"><?php echo $event_list['title']?></td>
                    <td style="width:85px"><?php echo $date ?></td>
                    <td><?php echo str_replace('\n','<br />',$event_list['body'])?></td>

                </tr>
<?php
            }
?>
                <tr>
                    <td colspan="4">
                        <input type="submit" value="<?php echo $lang_calendar['edit_event']?>" name="edit_event" /> <input type="submit" value="<?php echo $lang_calendar['delete_event']?>" name="delete_event" /> <a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a>       <a href="calendar.php"><?php echo"Return to Calendar"; ?></a>
                    </td>
                </tr>
            </tbody>
            </table>
        </div>
    </div>
    </form>
</div>
<div class="linksb">
    <div class="inbox">
        <p class="pagelink conl"><?php echo $lang_common['Pages'].': '.$pages?></p>
        <div class="clearer"></div>
    </div>
<?php
        }


    }
}
//
// Show the weekly calendar
//
elseif(isset($week))
{
    ########################################################
    ###//===============//===============//==============//#
    ##//===============// Week Calendar //==============//##
    #//===============//===============//==============//###
    ########################################################
    list($year,$week) = explode('.',$week);
    $day_one = (date('w',mktime(0,0,0,1,1,$year))==0)? 7 : date('w',mktime(0,0,0,1,1,$year));

    $first_day = strtotime("-".$day_one." days", mktime(0,0,0,1,1,$year));
    $date = strtotime ("+$week weeks", $first_day);
    $month = date('n',$date);
    $week_start = mktime(0,0,0,date('n',$date),date('j',$date),$year);
    $week_end = $week_start+(60*60*24*7);

        $strdate = date(Y, $date)."-".$month."-".date('d',$date);
        $strdate2 = date(Y, $week_end)."-".date('m',$week_end)."-".date('d',$week_end);


    //change querys if $type is set to posts
    if($type == "posts")
    {

        $result = $db->query('SELECT t.posted FROM '.
                          $db->prefix.'topics as t LEFT JOIN '.
                          $db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].
                          ') WHERE t.posted > '.$week_start.' AND t.posted < '.$week_end.
                          ' AND    (fp.read_forum IS NULL OR fp.read_forum=1)') or
                          error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
        $topic = array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
        while($topic_list = $db->fetch_row($result)){
            $time = date("j",$topic_list[0]);
            $topic[$time]++;
        };

        //Find the posts made for "said" day (one month only)
        $result = $db->query('SELECT p.posted FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON p.topic_id=t.id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].') WHERE p.posted > '.$week_start.' AND p.posted < '.$week_end.' AND (fp.read_forum IS NULL OR fp.read_forum=1)') or error('Unable to fetch posts list', __FILE__, __LINE__, $db->error());
        $posts = array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
        while($post_list = $db->fetch_assoc($result)){
            $time = date('j',$post_list['posted']);
            $posts[$time]++;
        };
    }
    //change querys if $type is set to events
    elseif($type == "events")
    {
        //Find the birthdays for "said" day (selected week)
        $strWhere = 'WHERE MONTH(birthday) = '.$month.' or (MONTH(birthday) = '.date('n',$week_end).' and DAYOFMONTH(birthday) < 7) ';
        $strQuery = 'SELECT DAYOFMONTH(birthday) as day, username FROM '.$db->prefix.'users '.$strWhere;

        $result = $db->query($strQuery) or error('Unable to fetch birtday list', __FILE__, __LINE__, $db->error());
        $bdays = array('','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','');
        while($bday_list = $db->fetch_assoc($result)){
            if(count($bday_list)>6)
                $bdays[$bday_list['day']]++;
            else
                $bdays[$bday_list['day']] .="*<a href='calendar.php?view=bday&date=".$year.".".$month.".".$bday_list['day']."'>".$bday_list['username'].$lang_calendar['Birthday']."</a>  ";
        };

        //Find the events for "said" day (selected week)
        $strWhere = 'WHERE date >= "'.$strdate .'" AND date <= DATE_ADD("'.$strdate.'", INTERVAL 8 DAY ) ';
        $strQuery = 'SELECT id, title, DAYOFMONTH(date) as day FROM '.$db->prefix.'calendar '.$strWhere;
              $result = $db->query($strQuery) or
                          error('Unable to fetch calendar dates', __FILE__, __LINE__, $db->error());
        $dates = array('','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','');
        while($dates_list = $db->fetch_assoc($result)){
            $dates[$dates_list['day']] .= "*<a href='calendar.php?view=event&id=".$dates_list['id']."'>".$dates_list['title']."</a>  ";
        };
    }
?>
    <div style="width:100%;float:left;margin-right:-225px">
    <div style="display:inline;float:left;margin-right:225px">

<?php
    //list dates in this week
    if($CFG_start_day == "S"){$a='0';$b='7';}
    elseif($CFG_start_day == "M"){$a='1';$b='8';}

    for ($x=$a; $x<$b; $x++) {
            $datestamp = strtotime("+$x days", $date);
        $wk_name = $lang_calendar[date ('l', $datestamp)];
        $date_no      =date('j', $datestamp);
        $mth_name =date('F', $datestamp);
        $year_name =date("Y", $datestamp);
                $month_no   =date("n", $datestamp);

        if ($x == "0" | ($x == "1" & $b =="8")){
            echo "\t<h2><a href='calendar.php?".$ltype."date=".$year_name.".".$month_no."'>".$lang_calendar[$mth_name]." ".$year_name."</a></h2>\n\t<div class='box'>\n\t<table cellspacing='0'>\n";
        } elseif(date('d', $datestamp)=="1" ){
            echo "\t\t</table>\n\t</div>\n";
            echo "\t<h2><a href='calendar.php?".$ltype."date=".$year_name.".".$month_no."'>".$lang_calendar[$mth_name]." ".$year_name."</a></h2>\n\t<div class='box'>\n\t<table cellspacing='0'>\n";
        }
        $class = ($date_no == date('j') && $mth_name == date('F') && $year_name == date('Y'))? "class='calendar_day'" : "";
                        if (!empty($bdays[$date_no])) $class =" class='calendar_bday'";
                        if (!empty($dates[$date_no])) $class =" class='calendar_event'";

        echo "\t\t\t\t<tr><td valign='top' colspan='2' ".$class."><strong>".$wk_name."</strong></td></tr>\n";
        echo "\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' style='width:2%' ".$class.">".$date_no."</td>\n";
        echo "\t\t\t\t\t<td style='width:97%' ".$class.">";

        if(!empty($topic[$date_no]))echo"<a href='calendar.php?view=topics&date=".$year.".".$month.".".$date_no."'>".$lang_calendar['Topics']." ".$topic[$date_no]."</a>  ";
        if(!empty($posts[$date_no]))echo"<a href='calendar.php?view=posts&date=".$year.".".$month.".".$date_no."'>".$lang_calendar['Posts']." ".$posts[$date_no]."</a>  ";

        if(!empty($bdays[$date_no]) && !is_int($bdays[$date_no]))
            echo "<a href='calendar.php?view=bday&date=".$year.".".$month.".".$date_no."'>".$lang_calendar['Birthdays']." ".$bdays[$date_no]."</a><br /><img src='./img/icon_party.gif' width='38' height='18' alt='' />";
        elseif(!empty($bdays[$date_no]) && is_int($bdays[$date_no]))
                echo $bdays[$date_no];

            if(!empty($dates[$date_no]))
                echo $dates[$date_no];
        
        echo " </td>\n\t\t\t\t</tr>\n\n";
    }
?>
                <tr>
                    <td colspan="2"><div style="float:left">
<?php                    echo "<a href='calendar.php?week=".$year.".".($week-1)."'>".$lang_calendar['Last Week']."</a> | ";
                    echo "<a href='calendar.php?week=".$year.".".($week+1)."'>".$lang_calendar['Next Week']."</a></div>"; ?>
<?php if($CFG_show_typelist=="yes") { ?>
                    <div style="float:right">
                                                <form id="date" method="post" action="calendar.php?week=<?php echo $_GET['week']?>">
                                                        <div style="float:left">
                                                                <select name="type" onChange="document.forms['date'].submit()">
                                                                        <option value="posts"<?php if($type=="posts")echo" selected='selected'"?>><?php echo $lang_calendar['posts/topics']?></option>
                                                                        <option value="events"<?php if($type=="events")echo" selected='selected'"?>><?php echo $lang_calendar['events']?></option>
                                                                </select>

                                                        </div>
                                                </form>
                                 </div>
<?php } ?>
                                       </td>
                </tr>

            </table>
        </div>


<?php    if(
        ($pun_user['g_id'] == PUN_MOD && $CFG_mod_add=='yes')
        or ($pun_user['g_id'] == PUN_MEMBER && $CFG_user_add=='yes')
        or ($pun_user['g_id'] == PUN_ADMIN)
    )
        echo "\t<br />\n\t<div class='box'><p> <a href='calendar.php?action=add'>".$lang_calendar['Add_event']."</a> | <a href='calendar.php?action=edit'>".$lang_calendar['Edit_event']."</a></p></div>\n";
?>
</div>
    </div>

<?php    if($CFG_show_cal == "yes"){
    echo "<div style='float:right;width:215px'>";
        mini_cal($month_no, $year, "week");
        echo "</div>";
        }
?>

    <br class="clearer" />


<?php

}
//
//
//if $actions, $view or $week isnt set
//
else
{
    #########################################################
    ###//===============//===============//===============//#
    ##//===============// Main Calendar //===============//##
    #//===============//===============//===============//###
    #########################################################

    //change querys if $type is set to posts
    if($type == "posts")
    {

        $result = $db->query('SELECT t.posted FROM '.$db->prefix.'topics as t LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].') WHERE t.posted > '.$month_start.' AND t.posted < '.$month_end.' AND    (fp.read_forum IS NULL OR fp.read_forum=1)') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
        $topic = array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
        while($topic_list = $db->fetch_row($result)){
            $time = date("j",$topic_list[0]);
            $topic[$time]++;
        };

        //Find the posts made for "said" day
        $result = $db->query('SELECT p.posted FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON p.topic_id=t.id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$pun_user['g_id'].') WHERE p.posted > '.$month_start.' AND p.posted < '.$month_end.' AND (fp.read_forum IS NULL OR fp.read_forum=1)') or error('Unable to fetch posts list', __FILE__, __LINE__, $db->error());
        $posts = array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
        while($post_list = $db->fetch_assoc($result)){
            $time = date('j',$post_list['posted']);
            $posts[$time]++;
        };
    }
    //change querys if $type is set to events
    elseif($type == "events")
    {

        //Find the birthdays for "said" day
        $result = $db->query('SELECT DAYOFMONTH(birthday) as day, username FROM '.$db->prefix.'users WHERE MONTH(birthday) = '.$month) or error('Unable to fetch birtday list', __FILE__, __LINE__, $db->error());
        $bdays = array('','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','');
        while($bday_list = $db->fetch_assoc($result)){
            if(count($bday_list)>3)
                $bdays[$bday_list['day']]++;
            else
                                $bdays[$bday_list['day']] .="<a href='calendar.php?view=bday&date=".$year.".".$month.".".$bday_list['day']."'>".$bday_list['username'].$lang_calendar['Birthday']."</a><br />";
        };

        //Find the events for "said" day
        $result = $db->query('SELECT id, title, DAYOFMONTH(date) as day FROM '.$db->prefix.'calendar WHERE MONTH(date) = '.$month.' AND (YEAR(date) = '.$year.' OR YEAR(date) = "0000")') or error('Unable to fetch calendar dates', __FILE__, __LINE__, $db->error());
        $dates = array('','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','');
        while($dates_list = $db->fetch_assoc($result)){
            $dates[$dates_list['day']] .= "<a href='calendar.php?view=event&date=".$year.".".$month.".".$dates_list['day']."'>".$dates_list['title']."</a><br />";
        };


    }
?>
    <h2 style="text-align:center">
        <span>
                     <!--   <a href="calendar.php?<?php echo $ltype?>date=<?php echo ($year-1).'.'.$month;?>"><–</a> -->
                        <a href="calendar.php?<?php echo $ltype?>date=<?php if($month == 1){echo $year-1;}else{echo$year;}?>.<?php if($month == 1){echo '12';}else{echo $month-1;}?>"><<—</a>
            <?php echo $lang_calendar[$monthtext]." ".$year."\n" ?>
                        <a href="calendar.php?<?php echo $ltype?>date=<?php if($month == 12){echo $year+1;}else{echo$year;}?>.<?php if($month == 12){echo '1';}else{echo $month+1;}?>">—>></a>
                     <!--   <a href="calendar.php?<?php echo $ltype?>date=<?php echo ($year+1).'.'.$month;?>">–></a> -->
        </span>
    </h2>
    <div class="box">
        <table cellspacing="0">
        <thead>
            <tr>
<?php if($CFG_start_day == "S"):?>                <th><?php echo $lang_calendar['Sunday']?></th>
<?php endif;?>                <th><?php echo $lang_calendar['Monday']?></th>
                <th><?php echo $lang_calendar['Tuesday']?></th>
                                <th><?php echo $lang_calendar['Wednesday']?></th>
                <th><?php echo $lang_calendar['Thursday']?></th>
                <th><?php echo $lang_calendar['Friday']?></th>
                <th><?php echo $lang_calendar['Saturday']?></th>
<?php if($CFG_start_day == "M"):?>                <th><?php echo $lang_calendar['Sunday']?></th>
<?php endif;?>
                <th class='calendar_wk'> </th>
            </tr>
        </thead>
        <tbody>
            <tr>
<?php

        if ($day_of_wk <> 0){
            for ($i=0; $i<$day_of_wk; $i++)
            { echo "\t\t\t\t<td valign='top' style='width:14%; height:75px' class='calendar_no' > </td>\n"; }
        }

        for ($date_of_mth = 1; $date_of_mth <= $days_in_mth; $date_of_mth++) {

            $date_no = date("j", mktime(0, 0, 0, $month, $date_of_mth, $year));
            $day_of_wk = start_date(date('w', mktime(0, 0, 0, $month, $date_of_mth, $year)));
            $class = ($date_no ==  date("j") &&  $month == date("n") && $year == date("Y"))? " class='calendar_day'" : NULL ;
                        if (!empty($bdays[$date_no])) $class =" class='calendar_bday'";
                        if (!empty($dates[$date_no])) $class =" class='calendar_event'";

            echo "\t\t\t\t<td valign='top' style='width:14%; height:75px'".$class."><span>".$date_no."</span><br />";

            if(!empty($topic[$date_no]))echo"<a href='calendar.php?view=topics&date=".$year.".".$month.".".$date_no."'>".$lang_calendar['Topics']." ".$topic[$date_no]."</a><br />";
            if(!empty($posts[$date_no]))echo"<a href='calendar.php?view=posts&date=".$year.".".$month.".".$date_no."'>".$lang_calendar['Posts']." ".$posts[$date_no]."</a><br />";

            if(!empty($bdays[$date_no]) && !is_int($bdays[$date_no]))
                echo"<a href='calendar.php?view=bday&date=".$year.".".$month.".".$date_no."'>".$lang_calendar['Birthdays']."<br /> ".$bdays[$date_no]."</a><br />";
            elseif(!empty($bdays[$date_no]) && is_int($bdays[$date_no]))
                echo $bdays[$date_no]."<br />";

            if(!empty($dates[$date_no]))echo $dates[$date_no]."<br />";

            echo "</td>\n";

            if ( $day_of_wk == 6 )
            {

                //if $date_no minus 5 days is greater than 0 AKA 1 or biger
                if($date_no-5 > 0)
                {
                    $date_link = date('W', mktime(0,0,0,$month,($date_no-5),$year));
                    $year_link = $year;
                }
                //if its less than 1 aka 0 or negitive
                else
                {
                    //if $month minus 1 month is less than 1 AKA 0 or negitive
                    if($month-1 < 1)
                    {
                        $pre_year = $year-1;
                        $pre_month = '12';
                        $pre_day = date('t', mktime(0,0,0,$pre_month,1,$pre_year))+($date_no-5)-1;

                    }
                    else
                    {
                        $pre_year = $year;
                        $pre_month = $month-1;
                        $pre_day = date('t', mktime(0,0,0,$pre_month,1,$pre_year))+($date_no-5);

                    }

                    $date_link = date('W', mktime(0,0,0,$pre_month,$pre_day,$pre_year));
                    $year_link = $pre_year;
                }

        //        if($year_link == date('Y')-1)        $date_link = $date_link-1;
        //        elseif($year_link == date('Y')+1)    $date_Link = $date_link+1;
                echo "\t\t\t\t<td class='calendar_wk'><a href='calendar.php?".$ltype."week=".$year_link.".".$date_link."'>«</a></td>\n";

                echo "\t\t\t</tr>\n\t\t\t<tr>\n";
            }
            if ( $day_of_wk < 6 && $date_of_mth == $days_in_mth ) {

                for ( $i = $day_of_wk ; $i < 6; $i++ )
                { echo "\t\t\t\t<td valign='top' style='width:14%; height:75px' class='calendar_no' > </td>\n"; }

                echo "\t\t\t\t<td class='calendar_wk'><a href='calendar.php?week=".$year_link.".".($date_link+1)."'>«</a></td>\n";
                echo "\t\t\t</tr>\n";
            }
            if( $date_of_mth == $days_in_mth)
                break;
        }
?>
                <td colspan="8">
                    <div style="float:left; padding-top:5px; padding-right:3px"><?php echo $lang_calendar['go_to']?></div>
                    <form id="date" method="post" action="calendar.php">
                        <div style="float:left">
                            <select name="month">
<?php
                $month_name = array($lang_calendar['January'],$lang_calendar['February'],$lang_calendar['March'],$lang_calendar['April'],$lang_calendar['May'],$lang_calendar['June'],$lang_calendar['July'],$lang_calendar['August'],$lang_calendar['September'],$lang_calendar['October'],$lang_calendar['November'],$lang_calendar['December']);
                for($x=00;$x<12;$x++)
                {
                    $z = $x+1;
                    echo"\t\t\t\t\t\t\t\t<option value='".$z."'";
                    if($month == $z)echo" selected='selected'";
                    echo">".$month_name[$x]."</option>\n";
                }
?>
                            </select>
                            <select name="year">
<?php
                for($x=-5; $x<=5; $x++)
                {
                    $said_year = $year+$x;
                    echo"\t\t\t\t\t\t\t\t<option value='".$said_year."'";
                    if($said_year == $year)echo" selected='selected'";
                    echo ">".$said_year."</option>\n";
                }
?>
                            </select>
                                                        <input type="submit" value="<?php echo $lang_calendar['go'] ?>" />
                        </div>
                        <div style="float:left; padding-top:5px; padding-left:3px">
                            <a href="calendar.php?date=<?php echo date('Y.m')?>"><?php echo $lang_calendar['current_month'];?></a>
                            <a href="calendar.php?week=<?php echo date('Y.W')?>"><?php echo $lang_calendar['current_week'];?></a>
                        </div>
<?php if($CFG_show_typelist=="yes") { ?>
                                              <div style="float:right">
                                                        <select name="type" onChange="document.forms['date'].submit()" >
                                                                <option value="posts"<?php if($type=="posts")echo" selected='selected'"?>><?php echo $lang_calendar['posts/topics']?></option>
                                                                <option value="events"<?php if($type=="events")echo" selected='selected'"?>><?php echo $lang_calendar['events']?></option>
                                                        </select>
                                                </div>
<?php } ?>
                    </form>
                </td>
            </tr>
        </tbody>
        </table>
    </div>
<?php
    if($CFG_show_cal == "yes"){
        echo"\t<br />\n\t<table cellspacing='0'>\n\t<tr>\n\t\t<td valign='top' style='border:none;padding:0 5px 0 0; margin:0'>\n";
        mini_cal($month, $year, 'main');
        echo "\t\t</td>\n\t</tr>\n\t</table>\n";
    }

    if(
        ($pun_user['g_id'] == PUN_MOD && $CFG_mod_add=='yes')
        or ($pun_user['g_id'] == PUN_MEMBER && $CFG_user_add=='yes')
        or ($pun_user['g_id'] == PUN_ADMIN)
    )
        echo "\t<br />\n\t<div class='box'><p> <a href='calendar.php?action=add'>".$lang_calendar['Add_event']."</a> | <a href='calendar.php?action=edit'>".$lang_calendar['Edit_event']."</a></p></div>\n";
}
?>
</div>
<?php require PUN_ROOT.'footer.php';?>

Thanks for your advice!
I get the same results in both IE and FF.
I updated my files with the code you posted about at the punres forum but this aint fixing the prob.

I'm usually good at comparing 2 php files (one that would work and one that won't), finding the trouble and fixing it, but in this case I sense the layout of the There are no events for you to edit output page isn't defined in the file calendar.php.. I don't know where it might be defined.

-Alternatively, is there a way to hide the Edit Event link for a guest if he/she didn't posted any in the first place? (but still available for mods/admin).

Thats all I need to put my calendar in prod, fixing or at least hiding this There are no events for you to edit output page.

Mods, could I submit this display issue ^^ in the Calling CSS Expert thread in case we don't find a solution here?

I have a small display issue between my forum sidebar vs no event to edit window...

When I get the There are no events for you to edit message the left sidebar goes below the message (image's lower screen) while it would display without any problems in any other calendar screens (image's top screen)

http://i119.photobucket.com/albums/o144/indiequebec/idqcaleditnogood.gif

The sidebar is from Wiki's miniportal article ( http://wiki.punres.org/Miniportal ) and I didn't made any modification to the code besides adding a few boxes.

If anyone has any idea how to solve this plz let me know! (or an idea of a more suitable thread where I can post this since it deals with both sidebars and the calendar mod) Thanks!

^^ In calendar.php I had to find

message($lang_calendar['no_events_edit']);

and replace it by

message($lang_calendar['no_events']);

edit: line 651

smile

Vanslyde wrote:

<snip>
Even though he/she didn't post any event, a new member would click edit event and get to a page where it would read;
Infos
Go Back

twohawks wrote:

Oh, and as far as changing the link text, those are written in the files so simply search the Cal2x files for the text strings you wish to change.

Cheers,

argh.. I'm unable to change that link text, or even locate it for that matter..

In order to figure out what part of the code needed to be changed I modified calendar.php so each <?php echo $lang_common['Go back'] string would become
<?php echo $lang_common['Go back 100']
<?php echo $lang_common['Go back 199']

etc,
^^ the number next to Go back being the line# where the string is located.

In common.php I created the entries
'Go back 100'    =>    'Go back 100',
'Go back 199'    =>    'Go back 199',

etc,

I was expecting one of these messages to appear... But that didn't do anything.. when a registered user (who never posted any event at all) click Edit Event in the main calendar view, the message Info, Go back still appear whitout any number next to it.. hmm

I went through the appropriate thread in the other forum (punres.org http://www.punres.org/viewtopic.php?id=208&) but couldn't find anything about it..

I successfully removed the mod.

Well I meant the next Calendar release... since we're in thread Calendar 2.0 I figured out the next release would be 3.0... aaaanyway...

I installed it, removed the bdays, it works great!
But there's one thing I'd like to change and I can't seem to find any infos about.

Even though he/she didn't post any event, a new member would click edit event and get to a page where it would read;
Infos
Go Back

How can I change this text in order for the user to know that he/she can't edit any event because he/she didn't posted any in the first place?

So I guess there's no more support for this mod until 3.0 (if any) gets released, right?

Thing is I'd like to try to implement it on my board, knowing that someone over here is available for help if needed...

so now.. how about clickable footers? wink


j/k

in message_send.php of course : )
thanks!

Does anyone know how the instructions to integrate the Easy BBCode 1.0.1 into my Private Message window? (meaning the smileys/buttons would be available when writing a PM)

96

(1 replies, posted in PunBB 1.2 show off)

So I guess it could my turn to introduce my message board.. it's called www.indiequebec.com and is targeted for people who'd like to talk about the indie music scene mainly in quebec but also elsewhere. Some of you may have seen it already via this site's donation page.
It's not intergrated to any website, just a forum for now..

Took me about 30hours of work and at least another 30 hours of reading posts at punbb.org

I?m proud of what I did, considering the fact that 3 months ago I didn?t know shit about php/punbb/mysql/wamp... the site has been in prod for 2 months now and I still add some features as time goes by.

It may doesn't look like much but I've installed the following;
Mark as read,
private messages,
easy bbcode,
custom smilies (what do you think of em? They?re created based on a font I found. Some of them were edited a bit, they?re kinda cool considering they?re unique),
who?s online,
youtube/google vid code,
target window selection + user website link open in new window,
image verification for registration (that was a tough one to implement, after 4 hours I finally understood I had to modify some settings in my php folder),
custom pages,
left blocks,
a little icon that shows « online » under your nick whenever you?re logged in, as well as the same icon showing up whenever you have a PM..
hidden mods
no search by usergroup
hidden links for guests

The skin was created with spinkbb.
It's in no way as cool/complete as some other sites I've seen here in this section but for a first shot at it I think it's not bad at all...
I think the readability is great and that's pretty much all that matters for now.

I have yet to install the quickpost preview button (couldn?t find the right mod) and the PM email notification (didn?t search for the mod yet.. I understood it?s in the french punbb forum)

I still don?t know if it will be popular.. I?m giving it 24 months before taking it down in case it?s not.
Good referencing will be the next step.. so I?ll have to learn about that.

www.indiequebec.com

http://www.indiequebec.com/forums/img/smilies/v2indielogo18.gif

Thanks to all for your feeback and especially for your help in creating this message board!.. : )

97

(7 replies, posted in PunBB 1.2 troubleshooting)

yup!, Thanks a lot! : )

98

(7 replies, posted in PunBB 1.2 troubleshooting)

I know it's paradoxical and I doubt it can be done but I got to ask; how about having a small image instead of a warning text? Do you think its possible?

99

(132 replies, posted in General discussion)

SNL Digital Short

Andy Samberg & Justin Timberlake

A Special Christmas Box *Uncensored

100

(8 replies, posted in PunBB 1.2 troubleshooting)

Smartys wrote:

Vanslyde: That's a Yahoo spider

oh... http://www.kommunen.nu/img/smileys/smiley_blush.gif

Thanks.