1

(12 replies, posted in PunBB 1.2 discussion)

Hi Andy.....

template has been changed!

SCREEN SHOT

http://www.dartmouth-online.com/bb/punbb_org.gif


C, ya...

2

(12 replies, posted in PunBB 1.2 discussion)

Hi Andy...

That is just (1) template. I have another that matches the default PunBB theme, when I get home I will change it so you can see it. Also, because it is template driven just changing the template buttons and the CSS will give you any style you want!


F!

3

(12 replies, posted in PunBB 1.2 discussion)

Hi Everyone

Introducing PunBB Spell Check Version 0.9 <- hehe

Some notes....

The example uses template (1), I will give you this template (buttons/images) when I release this tomorrow (14 languages)!. The example is in English, and the dictionary is also English, because I do not want to load my laptop with junk. But the spell checker and the 'regex(s)' it uses can handle all languages supported by Aspell!

PunBB Spell Check works off PunBB, so it will only work with PunBB! PunBB Spell Check is completely template driven and works of language files!

Language en_spell.php

<?php
$lang_spell = array (

'spell_load'            =>     'Spell Checker Loading...',
'spell_wait'            =>    'Please Wait',
'spell_done'            =>    'Spell Check Complete.',
'spell_none'            =>    'No Errors Found...',
'not_found'                =>    'Not in dictionary',
'dictionary'            =>    'Dictionary',
'current_lang'            =>    'American (English)',
'suggest_word'            =>    'Suggestions',
'change_to'                =>    'Change to...',
'show_options'            =>    'Spell Check Options',
'just_finish'            =>    'Finish Spell Check',
'just_cancel'            =>    'Cancel Spell Check',
'add_word'                =>    'Add Word',
'change_all'            =>    'Change All',
'change_word'            =>    'Change Word',
'ignore_all'            =>    'Ignore All',
'ignore_word'            =>    'Ignore Word',
'spell_title'            =>    'PunBB Spell Checker',
'bad_error'                =>    'Critical Error...',
'bad_request'            =>    'Access Disallowed.',
'cancel_now'            =>    'Spell Check Canceled.',
'correct_name'            =>    'Corrected:',
'spell_words'            =>    'words'

);
?>

I will include (14) different language files.


LAST NOTE: the 'OPTIONS' is not active in the example, if it was active, it would allow you to manage your personal dictionaries if the administrator allowed this option. If the administrator does not then 'OPTIONS and ADD WORD' would not be active! I have left 'ADD WORD' on so you can see how it learns to 'IGNORE' words that you have added to the dictionary! I am now working on a simple 'FILTER' that will allow the administrator to 'FILTER' words that can never be added to the user(s) personal dictionaries!


Please try it out, and tell me what you think! Also if you want something added before I release it, please tell me that also!

SCREEN SHOT

http://zip.ya-right.net/img/punbb_spell.gif



URL to try it....


http://zip.ya-right.net/post.php?fid=1


Well, that's all, let me go read some posts...

F!

Hi

I have a few very nice mods to release, but I have been waiting for some simple things to be added before releasing these mods!

1. user select language

I really would like to see this, so that one of my mods 'PunBB Spell Check' could be based on the user language interface!

I am going to release it in a day or two, but having the $var -> $cur_user['lang'] would give the user more control and also allow me to add more language based features by just knowing the language the user is using!

I will put a demo of it tonight, when my DNS gets updated to my laptop server for one of my domain's. As it is now, it contains the following...

1. spell check
2. ignore ( HTML, PunBB code )
3. registered user can have personal dictionaries (admin option)
4. add a word or word list to your personal dictionary
5. remove words from your personal dictionary

It runs under Unix/Linux/Windows, using PHP configured with Pspell

I'll post the demo late tonight, and will release it in a day or two (working on a few nice templates with 14 different languages that will be supported)

Spell Check = English
Correcteur Orthographique = Européen (Français), Canadien (Français)
Verificador Ortográfica = Europeo (Castellano), Argentino (Español)
Spel Controleur = Europeaaan (Nederlands)
Stavekontrol = Europæisk (Dansk)
Verificador Ortográfica = Brazilian (Português), Europeu (Português)
Oikeinkirjoituksen Tarkistus  = Eurooppalainen (Suomi)
Rechtschreibprüfung = Europäisch (Deutsch)
Controllo Ortografico = Europeo (Italiano)
Stavekontroll = Europeer (Norsk)
Stavningskontroll = Europé (Svenska)
???????? ?????????? = ??????????? (???????)

I will also include Russian, when I have a chance to finish the button set(s) for the russian language!


F!

5

(19 replies, posted in Programming)

Hi

I had few minutes today, so I thought I would write you something!

Real quick rundown...

Admin Upload Manager

1. Secure login (supporting cookie session or url based)
2. allows 'MULTI' file uploads (unlimited only by server)
3. allows you simple managing options (view or delete)

Setup...

Create a md5() password using this simple script below,
then pate the ouput into the define() ADMIN_PASS !
Note the example password in the script is '2242'

<?

//

echo md5 ( 'some_plain_text_password' );

?>

Then configure the options at the top of the script!
Only change the HTML parts if you want to change
the colors that the 'results and manage page' output!
But only do that after you are sure you configured all
the define() options correctly!


//admin.php or whatever you want to call it!


<?

    // do not touch, if you don't know what it does....

    !isset($_COOKIE['sid']) && isset($_GET['sid']) && !empty($_GET['sid']) ? session_id($_GET['sid']) : (!isset($_COOKIE['sid']) ? session_id(md5(uniqid(microtime()))) : null);
    session_name ( 'sid' );
    session_start ();
    define('UP_A', (!isset($_COOKIE['sid']) ? '?sid=' . session_id() : ''), true);
    define('UP_B', (!isset($_COOKIE['sid']) ? '?sid=' . session_id() . '&' : '?'), true);

    /*
    *
    * define the admin user
    *
    */

    define ( 'ADMIN_USER', 'admin' );

    /*
    *
    * create a md5() password and place it in the define below!
    * Use the script that is below this one to do this...
    *
    */

    define ( 'ADMIN_PASS', '1a3f91fead97497b1a96d6104ad339f6' );

    /*
    *
    * The upload folder path to the upload directory!
    * On windows use full path (c:/www/docs/uploads/)
    *          !! INCLUDE TRAILING '/'
    *
    */

    define ( 'UPLOAD_PATH', 'e:/www/docs/www/docs/uploads/' );

    // max number of files allowed to upload

    define ( 'MAX_FILES', '5' );

    // define the max single file size (bytes)

    define ( 'MAX_SIZE', '1048576' );



    // do not touch below....

    $erro = array ();

    if ( !empty ( $_REQUEST['logout'] ) && !empty ( $_SESSION['local']['in'] ) )
    {
        do_out ( '1' );
    }

    elseif ( !empty ( $_REQUEST['manage'] ) && !empty ( $_SESSION['local']['in'] ) )
    {
        run_manage ();
    }

    elseif ( !empty ( $_REQUEST['upload'] ) && !empty ( $_SESSION['local']['in'] ) )
    {
        upload_form ();
    }

    elseif ( !empty ( $_POST['login'] ) && test_login () )
    {
        upload_form ();
    }

    elseif ( empty ( $_SESSION['local']['in'] ) )
    {

        do_out ( '0' );
        login_form ();
    }

    elseif ( !empty ( $_POST['send'] ) )
    {
          $return = array();
        $x = 0;

        for ( $i = 0; $i < sizeof ( $_FILES['up'] ); $i++ )
        {
            if ( is_uploaded_file ( $_FILES['up']['tmp_name'][$i] ) )
            {
                if ( $_FILES['up']['tmp_name'][$i] != 'none' )
                      {

                    $ss = filesize ( $_FILES['up']['tmp_name'][$i] );

                            if ( $ss > 10 && $ss <= MAX_SIZE )
                            {

                        $sn = $_FILES['up']['name'][$i];

                                  if ( move_uploaded_file ( $_FILES['up']['tmp_name'][$i], UPLOAD_PATH . $sn ) )
                                  {
                                        $return[$x]['name'] = substr ( $sn, 0, strrpos ( $sn, '.' ) );
                                        $return[$x]['type'] = substr ( $sn, ( strrpos ( $sn, '.' ) + 1 ) );
                                        $return[$x]['size'] = $ss;
                            $x++;
                                  }

                            }

                      }

            }

        }

        process_return ( $return );

    }
    else
    {
        do_out ( '0' );
        upload_form ();
    }

   
    function test_login ()
    {

        if ( ADMIN_USER == $_POST['admin'] && ADMIN_PASS == md5 ( $_POST['pass'] ) )
        {

            $_SESSION['local']['in'] = 1;

            return ( 1 );

        }

        return ( 0 );

    }

    function do_out ( $type )
    {

        $_SESSION = array ();
        session_destroy ();

        if ( !empty ( $type ) )
        {

            header ( 'Location: ' . $_SERVER['PHP_SELF'] );
            exit ();

        }

    }

    function login_form ()
    {
?>
<html>
<head>
  <title>ADMIN UPLOAD LOGIN</title>
</head>
<body>
  <center>
   <form action='<?=$_SERVER['PHP_SELF'];?>' method='post'>
   <input type='hidden' name='login' value='1'>
   <p></p>
   <p></p>
   USERNAME
   <br />
   <br />
   <input type='text' name='admin' size='20' maxlength='20'>
   <br />
   <br />
   PASSWORD
   <br />
   <br />
   <input type='password' name='pass' size='20' maxlength='20'>
   <br />
   <br />
   <input type='submit' name='submit' value='Login!'>
   </form>
  </center>
</body>
</html>
<?
    exit ();
}
    function upload_form ()
    {
?>
<html>
<head>
  <title>ADMIN UPLOAD FORM</title>
</head>
<body>
  <center>
   <br />
   <br />
   <a href='<?=$_SERVER['PHP_SELF'];?><?=UP_B;?>manage=1'>Manage Files</a>  or  <a href='<?=$_SERVER['PHP_SELF'];?><?=UP_B;?>logout=1'>Log Out</a></td>
   <br />
   <br />
   <form enctype='multipart/form-data' action='<?=$_SERVER['PHP_SELF'];?><?=UP_A;?>' method='post'>
   <input type='hidden' name='send' value='1'>
   <p></p>
   <p></p>
   UPLOAD FILES
   <br />
   <br />
<?
        for ( $i = 1; $i <= MAX_FILES; $i++ )
        {
            echo "<input type='file' name='up[]' size='40'>\r\n<br />\r\n";
        }
?>
   <br />
   <br />
   <input type='submit' name='submit' value='UPLOAD!'>
   </form>
  <center>
</body>
</html>
<?
    exit ();
}

    function process_return ( $in )
    {
        if ( !empty ( $in ) )
        {
?>
<html>
<head>
  <title>ADMIN UPLOAD RESULTS</title>
  <style>
  table {margin: 0px;padding: 0px;border: 0px;border-spacing: 0px;border-collapse: collapse;text-align: center;}
  td {margin: 0px;padding: 0px;border: 0px;border-spacing: 0px;border-collapse: collapse;text-align: center;}
  .zt, .mt {background-color: #ffffff;}
  .st, .ft, .mh, .mi, .bttn {background-color: #777777;}
  .st, .zt, .mh {border: 2px solid;}
  .zt {border-color: #777777;}
  .st {border-color: #000000;}
  .mh, .bttn {border-color: #ffffff;}
  .st, .mh, .mi, .bttn {color: #ffffff;}
  .zt {padding: 6px;}
  .st {padding: 4px;}
  .mh, .mi {padding: 2px;}
  .st, .zt, .mt, .ft, .mh, .mi, .bttn {font-size: 12px;}
  .bttn {height: 21px;}
  </style>
</head>
<body>
  <center>
   <table width='688'>
    <tr>
     <td class='zt' width='100%'>
      <table width='672'>
       <tr>
        <td class='st'>FILES UPLOADED</td>
       </tr>
       <tr>
        <td class='mt' width='100%' height='4'></td>
       </tr>
       <tr>
        <td class='mt' width='100%' height='20'><a href='<?=$_SERVER['PHP_SELF'];?><?=UP_B;?>logout=1'>Log Out</a></td>
       </tr>
       <tr>
        <td class='mt' width='100%' height='4'></td>
       </tr>
       <tr>
        <td class='st'>
         <table width='100%'>
          <tr>
           <td class='mh' width='4%' height='21'>#</td>
           <td class='ft' width='2%'></td>
           <td class='mh' width='52%' height='21'>FILE NAME</td>
           <td class='ft' width='2%'></td>
           <td class='mh' width='24%' height='21'>FILE SIZE</td>
           <td class='ft' width='2%'></td>
           <td class='mh' width='16%' height='21'>FILE TYPE</td>
          </tr>
<?
            for ( $i = 0; $i < sizeof ( $in ); $i++ )
            {

                $j = ( $i + 1 );

echo "          <tr>
           <td class='mi' width='4%' height='21'>" . ( $j < 10 ? '0' . $j : $j ) . "</td>
           <td class='ft' width='2%'></td>
           <td class='mi' width='52%' height='21'>" . $in[$i]['name'] . "</td>
           <td class='ft' width='2%'></td>
           <td class='mi' width='24%' height='21'>" . $in[$i]['size'] . " bytes</td>
           <td class='ft' width='2%'></td>
           <td class='mi' width='16%' height='21'>" . $in[$i]['type'] . "</td>
          </tr>
";
            }
?>
         </table>
        </td>
       </tr>
       <tr>
        <td class='mt' width='100%' height='8'></td>
       </tr>
       <tr>
        <td class='st'><input class='bttn' type='button' onclick="location.href='<?=$_SERVER['PHP_SELF'];?><?=UP_B;?>upload=1';" value='UPLOAD FILES'>  <input class='bttn' type='button' onclick="location.href='<?=$_SERVER['PHP_SELF'];?><?=UP_B;?>manage=1';" value='MANAGE FILES'></td>
       </tr>
      </table>
     </td>
    </tr>
   </table>
  </center>
</body>
</html>
<?
        }
        else
        {
?>
<html>
<head>
  <title>ADMIN UPLOAD ERROR</title>
  <META HTTP-EQUIV="Refresh" Content="4;URL=<?=$_SERVER['PHP_SELF'];?><?=UP_B;?>upload=1">
</head>
<body>
  <center>
   <p></p>
   <p></p>
   !! NO FILES BEING UPLOADED WERE VALID !!
   <br />
   <br />
   redirecting you to the upload form...
   <br />
   <br />
  <center>
</body>
</html>
<?
        }
    }

    function run_manage ()
    {

        if ( !empty ( $_POST['delete'] ) )
        {

            do_delete ();

        }

        $files = get_files ();

        if ( is_array ( $files ) && !empty ( $files ) )
        {
?>
<html>
<head>
  <title>ADMIN FILE MANAGE</title>
  <style>
  table {margin: 0px;padding: 0px;border: 0px;border-spacing: 0px;border-collapse: collapse;text-align: center;}
  td {margin: 0px;padding: 0px;border: 0px;border-spacing: 0px;border-collapse: collapse;text-align: center;}
  .zt, .mt {background-color: #ffffff;}
  .st, .ft, .mh, .mi, .bttn {background-color: #777777;}
  .st, .zt, .mh {border: 2px solid;}
  .zt {border-color: #777777;}
  .st {border-color: #000000;}
  .mh, .bttn {border-color: #ffffff;}
  .st, .mh, .mi, .bttn {color: #ffffff;}
  .zt {padding: 6px;}
  .st {padding: 4px;}
  .mh, .mi {padding: 2px;}
  .st, .zt, .mt, .ft, .mh, .mi, .bttn {font-size: 12px;}
  .bttn {height: 21px;}
  </style>
</head>
<body>
  <center>
   <table width='688'>
   <form action='<?=$_SERVER['PHP_SELF'];?><?=UP_A;?>' method='post'>
   <input type='hidden' name='manage' value='1'>
    <tr>
     <td class='zt' width='100%'>
      <table width='672'>
       <tr>
        <td class='st'>CURRENT FILES LIST</td>
       </tr>
       <tr>
        <td class='mt' width='100%' height='4'></td>
       </tr>
       <tr>
        <td class='mt' width='100%' height='20'><a href='<?=$_SERVER['PHP_SELF'];?><?=UP_B;?>logout=1'>Log Out</a></td>
       </tr>
       <tr>
        <td class='mt' width='100%' height='4'></td>
       </tr>
       <tr>
        <td class='st'>
         <table width='100%'>
          <tr>
           <td class='mh' width='4%' height='21'>#</td>
           <td class='ft' width='2%'></td>
           <td class='mh' width='44%' height='21'>FILE NAME</td>
           <td class='ft' width='2%'></td>
           <td class='mh' width='20%' height='21'>FILE SIZE</td>
           <td class='ft' width='2%'></td>
           <td class='mh' width='20%' height='21'>FILE DATE</td>
           <td class='ft' width='2%'></td>
           <td class='mh' width='4%' height='21'>DELETE</td>
          </tr>
<?
            for ( $i = 0; $i < sizeof ( $files ); $i++ )
            {

                $j = ( $i + 1 );

echo "          <tr>
           <td class='mi' width='4%' height='21'>" . ( $j < 10 ? '0' . $j : $j ) . "</td>
           <td class='ft' width='2%'></td>
           <td class='mi' width='44%' height='21'>" . $files[$i]['name'] . "</td>
           <td class='ft' width='2%'></td>
           <td class='mi' width='20%' height='21'>" . $files[$i]['size'] . " bytes</td>
           <td class='ft' width='2%'></td>
           <td class='mi' width='20%' height='21'>" . $files[$i]['date'] . "</td>
           <td class='ft' width='2%'></td>
           <td class='mh' width='4%' height='21'><input type='checkbox' name='delete[]' value='" . $files[$i]['file'] . "'></td>
          </tr>
";
            }
?>
         </table>
        </td>
       </tr>
       <tr>
        <td class='mt' width='100%' height='8'></td>
       </tr>
       <tr>
        <td class='st'><input type='submit' class='bttn' value='DELETE FILES'>  <input class='bttn' type='button' onclick="location.href='<?=$_SERVER['PHP_SELF'];?><?=UP_B;?>upload=1';" value='UPLOAD FILES'></td>
       </tr>
      </table>
     </td>
    </tr>
   </table>
  </center>
</body>
</html>

<?
        }
        else
        {
?>
<html>
<head>
  <title>ADMIN FILE MANAGER</title>
  <META HTTP-EQUIV="Refresh" Content="4;URL=<?=$_SERVER['PHP_SELF'];?><?=UP_B;?>upload=1">
</head>
<body>
  <center>
   <p></p>
   <p></p>
   !! THERE ARE NO FILES TO MANAGE !!
   <br />
   <br />
   redirecting you to the upload form...
   <br />
   <br />
  <center>
</body>
</html>
<?
        }
    }

    function do_delete ()
    {
        foreach ( $_POST['delete'] as $file )
        {
            $now = UPLOAD_PATH . pack ( "H*", $file );

            if ( file_exists ( $now ) )
            {
                unlink ( $now );
            }
        }
    }

    function get_files ()
    {

        $out = array ();
        $x = 0;

        if ( is_dir ( UPLOAD_PATH ) )
        {
            $td = opendir ( UPLOAD_PATH );

            while ( false !==  ( $file = readdir ( $td ) ) )
            {
                if ( $file != '.' && $file != '..' && !is_dir ( UPLOAD_PATH . $file ) )
                {
                    $out[$x]['name'] = $file;
                    $out[$x]['size'] = filesize ( UPLOAD_PATH . $file );
                    $out[$x]['date'] = date ( 'F d Y H:i:s', filemtime ( UPLOAD_PATH . $file ) );
                    $out[$x]['file'] = bin2hex ( $file );
                    $x++;
                }
            }
            closedir ( $td );
            clearstatcache ();
        }

        return ( $out );
    }
?>


Sonia