1

(5 replies, posted in Programming)

omg i have it works!!!

thanks a lot

u r my man <3

but the last question please..cause i want it can translate to Chinese as well. But the problem is they will have to have different Charset (Encode) ; so what should i do?

should i add like this ?

if ($lang = cn)
{
$charset = 'GB2312';
}

thank you very much

2

(5 replies, posted in Programming)

but furthermore

are my codes above right? because i'm not sure it is right or not...

Thanks

3

(5 replies, posted in Programming)

No I do not turn on register globals.

Now it only appears the default lang but i can not switch to the other languages...

I did try your code and it does show

vi,en-us;q=0.9,zh-cn;q=0.8,zh-hk;q=0.6,zh-mo;q=0.5,zh-sg;q=0.4,zh-tw;q=0.3,zh;q=0.1

Please help.

Thank you very much

4

(5 replies, posted in Programming)

Hi all;

I'm new to php , at the moment i'm trying to make a website which visitor can switch the language on the fly ( no need database) and in the same site(page)..like punbb; the user can choose the language by using lang files.

Here is my script for index.php (main page)

<?php
session_start();

if(!isset($lang)) {
    $lang = getenv('HTTP_ACCEPT_LANGUAGE');
    $lang_default = "en";
}

if (is_file("lang/index.$lang.php"))
{
    $_SESSION["lang"] = $lang;
    include("lang/index.$lang.php");
} else {
    $_SESSION["lang"] = $lang_default;
    include("lang/index.$lang_default.php");
}

?>    
<body>
<form action="<?php echo $PHP_SELF;?>" method="get">
<select name="lang" size="1" onchange="this.form.submit()">
 <option value="en">English</option>
<option value="cn">France</option>
        </select>
</form>    


<p><?PHP echo main;?></p>


</body>

and here is my index.en.php

<?PHP
define("main", "How it works?");

?>

but the problem is i cant switch it; it always is at the default lang; i cant switch to others. But if i put the form and the script away from the main page. Let the user choose language frist then can access to the main page then it can work.

Can you guys please help to show how i can get it works inside the web page. So they can always switch the language at the page they are at.

Please help

Thank you very much

thank you for your reply. I did uninstall the calendar mod..i will try to fresh install it again...

Thanks

hmm it still cant...weird...

I've checked the database; nothing seems wrong. Furthermore; i tried to delete/add event inside phpmyadmin, it still does highlight on the small calendar but cant access...blank page still..

<?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"Xem các s? ki?n khác"; ?></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"Tr? v? l?ch"; ?></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"Tr? v? l?ch"; ?></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"Tr? v? l?ch"; ?></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="https://os.fastueux.com/Forum/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"Tr? v? l?ch"; ?></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"Tr? v? l?ch"; ?></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"Tr? v? l?ch"; ?></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_edit']);
            }

?>
    <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"Tr? v? l?ch"; ?></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']."'>".$lang_calendar['Birthday'].$bday_list['username']."</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='https://os.fastueux.com/Forum/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';?>
<script language="javascript1.2" type="text/javascript" src="https://os.fastueux.com/Forum/js/him.js"></script>

here it is. I dont think i have changed anything though...Thanks

twohawks wrote:

Hi Mystic...
My initial thought is to wonder if you have been doing any .htaccess editing for your site, or other files management on the site, that would have altered the way your server is told to respond to file requests.

We are going to need more information...
Did you recently edit/re-mod your calendar installation, or has nothing changed?
Does it do this only for editing an event, or for what links exactly?
Does it do this for any other php files at the site or only calendar? 
When was it (they) last working that you know of?
What sort of work has been performed on your site since then (not just punbb)?
Has anyone else tested this for you?   (give us the relevant link(s) to your site)

...to start with.

Hi there;

I didnt change anything..few days ago i still can access to add new events but now i couldnt... And furthermore I didnt perform my site any new scripts yet...

Also I didnt edit/re-mod the calendar files as well as punbb because it worked fine. All other functions of my site (including Punbb Forum) still working great except the calendar...

I've tested on different pc, with different OS as well as browsers but all the same results...

Here is the link : https://os.fastueux.com/Forum/calendar.php

hi i dont know why suddenly i can go in the calendar anymore... If i use Firefox 2 then it just offers me to download the calendar.php file...but if i use IE then it just shows "The page cannot be displayed" ...

I've checked all the files; they are still there but i dont know why? I didnt touch to them ; today i just wanted to add a new event then I discovered it doesnt work anymore...

Can you please tell me why?

Thanks

Edit: I have tried both on Windows and Fedora Core 6 but same result...

very cool indeed

11

(2 replies, posted in General discussion)

edit: i've founded this one: http://www.servage.net/?a=guk-safemode but I'm not sure it is a good web host or not?

12

(2 replies, posted in General discussion)

Hi all;

I would like to ask if there are any good host provider (safe or so...) which have PHP safe mod off? Cause at the moment, my host provider have PHP safe mod on and mostly all my scripts couldnt run through it...

Thanks.

Happy Valentine's Day

thanks for replies...

i used like this and it works just cool:

'#\[wiki\](.*?)\[/wiki\]#',
 '<a href="http://en.wikipedia.org/wiki/$1" alt="Wiki" target="_blank">$1</a><img src=http://en.wikipedia.org/wiki/external.png />',

Hi all;

I wanted to ask is there are any kind of mod which can display the key word in [[..]] and link that key workd to wikipedia?

Ex: i like to link "PUNBB" word to wikipedia then in text area i will type like this [[PUNBB]] and it will be linked to http://en.wikipedia.com/PUNBB

I though the code would look like this:

//    $this->currentItem->body = preg_replace( "/\[\[(.+?)\|(.+?)\]\]/", "<a href=\"http://en.wikipedia.org/wiki/\\1\" target=\"_blank\" title=\"Wikipedia: \\2\">\\2</a>", $this->currentItem->body );
//    $this->currentItem->more = preg_replace( "/\[\[(.+?)\|(.+?)\]\]/", "<a href=\"http://en.wikipedia.org/wiki/\\1\" target=\"_blank\" title=\"Wikipedia: \\2\">\\2</a>", $this->currentItem->more );

    
//    $this->currentItem->body = preg_replace( "/\[\[(.+?)\]\]/", "<a href=\"http://en.wikipedia.org/wiki/\\1\" target=\"_blank\" title=\"Wikipedia: \\1\">\\1</a>", $this->currentItem->body );
//    $this->currentItem->more = preg_replace( "/\[\[(.+?)\]\]/", "<a href=\"http://en.wikipedia.org/wiki/\\1\" target=\"_blank\" title=\"Wikipedia: \\1\">\\1</a>", $this->currentItem->more );
  }
    
    function wikiLink( $text ) {
        $links = preg_match_all( "/(\[\[.+?\]\])/", $text, $wiki, PREG_SET_ORDER );
        
        for( $i=0; $i<$links; $i++ ) {
            $link = preg_match( "/^\[\[(.+?)\]\]$/", $wiki[$i][0], $item );
            //$info .= $item[1];
            $split = explode( "|", $item[1] );
            if ( count($split) == 2 ) {
                $linkage = "<a href=\"http://en.wikipedia.org/wiki/$split[0]\" target=\"_blank\" title=\"Wikipedia: $split[0]\">$split[1]</a>";
            } else {
                $linkage = "<a href=\"http://en.wikipedia.org/wiki/$split[0]\" target=\"_blank\" title=\"Wikipedia: $split[0]\">$split[0]</a>";
            }
            $text = str_replace( $item[0], $linkage, $text );
        }
        return($text);

any idea out there please?

Thanks

its gonna be a hard work ; but i will give it a try...

thanks wink

Hi all;

I would like to install 2 punbb forums on different sub-domain ; but still in the same server... and i would like to use the same USER database for both forums. Which means , when an user registers for forum A then he will able to login into forum B without register again. And of course; it would be the same if he registers for forum B at the first place.

I though i only need to change the prefix of the tables but im not sure how the USER table is gonna work?

Thanks

cool ; cant wait for that.

But by the way ; i just switch to Nucleus >.< since i though it could be easy to integrate ... hope 1.3 Punbb can work well with it.

Thx for your answer

well ive read that seems like Punbb can work well with NucleusCMS , doesnt it? I dont mind to change the Web Blog ; i just dont know which one can integrate well with Punbb. Like when an user registers at punbb then they can log in to that web log with the same account?

Thanks

Hi there;

I have one small question...I do like to integrate the user database of punbb to wordpress , so when the user register at forum ; they also can able to log in to wordpress with that account. Since it is very troubleshooting if users have to register 2 times in the same website.

Could you guys please show me how? I did research but they all talked about how to integrate the layout, i just dont want it , I just want to integrate the user name + user password for these 2 engines.

Please help.

Thank you very much

:buzz: anyone please? almost x-mas  sad(

Hi guys;

Im using flash for the header file of my website; so i want it is in forum also. I did these following steps:

1 - Main.tpl : include my header file and footer file
2 - Copy footer.php and header.php files to /include/users/
3 - Copy the flash file to the same directory.

However it only appears the header/footer without any flash movies. I dont know why ; eventhough on the main website it works just nice. Please help me.

Thanks a lot

thanks i did check this one before. but it does apply only for youtube and yeah ...flv files i bet... on wiki i found a mod to add wmv.. but seems like has a problem. it sometimes play online, sometimes when u click on the link, it will ask you to download...i dont know why...

thanks for reply

Hi guys;

Ive searched all the forum to see if there are any Media bbcode ; which users can add it like [wmv][/wmv] so they can watch clip online in the forum. I found some but there werent a mod; furthermore no one has told how to do it... can any of you guys please tell me where is that mod (if its available) ; otherwise please show me how to it... thanks ...

P/s: i tried to modify from the MP3 BBcode but it couldnt work out...

Regards!

hi;
ive installed your mods... i tried to upload it but i couldnt too...it has a lot of errors while uploading...

first is like this:

Warning: mkdir(): SAFE MODE Restriction in effect. The script whose uid is 10007 is not allowed to access /srv/www/vhosts/xxxx/os/httpdocs/Forum/uploads/478 owned by uid 30 in /srv/www/vhosts/xxxxx/os/httpdocs/Forum/include/image_upload/image_upload.php on line 341

second one is

Warning: chmod(): Unable to access /srv/www/vhosts/xxxxxxxx/os/httpdocs/Forum/uploads/478/thumbnails in /srv/www/vhosts/xxxxxxxxxxx/os/httpdocs/Forum/include/image_upload/image_upload.php on line 342

Warning: chmod(): No such file or directory in /srv/www/vhosts/xxxxxxxxxx/os/httpdocs/Forum/include/image_upload/image_upload.php on line 342

Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The script whose uid is 10007 is not allowed to access /srv/www/xxxxxxxxx/os/httpdocs/Forum/uploads/478 owned by uid 30 in /srv/www/vhosts/xxxxxxxxxx/os/httpdocs/Forum/include/image_upload/image_upload.php on line 346

im sure ive created the uploads folder as well as Chmod it to 777... but i have no idea...

please help me..

p/s im using ssl (https) so is that the problem?

25

(3 replies, posted in PunBB 1.2 discussion)

yes it does; but yeah i fix it; silly im again; i forgot to ppint the image in the CSS to https; thats why it doesnt eapper right; thanks again