Fork me on GitHub

guestbook? help please  Bottom

  • hi there.
    i've been searching on the net, and as a result i've found the good guestbook around (postguestbook), but i have some prob with this module.

    i have installed the module absolutely fine without error in localhost (php4 mysql4) except if i change the the setting in admin mode its nothing happend (whole white screen) i'm using apache on windows on my local..

    ~

    then i'm trying to install postguestbook on the server (using customized PHP i think?) and the result i cant even install it.. its said "Error! Sorry! Table creation failed "
    language key (_CREATETABLEFAILED)

    when i'm search that lang key i cant find it in init lang file..


    i've no idea whats wrong here.. my friend said this guestbook works fine with him.

    so if there's another guestbook module can u tell me wich one? i need a guestbook that users can input their comment, but no need to register. also it need our permission to accept it or denied/delete it.
  • pnBook might be an alternative solution or EZComments can also be (ab)used to be a guestbook.



    --
    "He is not dangerous, he just wants to play...."
  • ez comment & pnBook do these module have permission setting for guest? and permission for accept it or deny? i dont understand why postguestbook cant be installed on the server tought its all installed correctly on localhost..
  • Both EZComments and pnBook use the permission system and can be configured to be used by guests. The usual hint in this case: You will be spammed, believe me icon_wink .

    Possible reasons for the postguestbook problem might be different PHP versions or (most likely) different MySQL versions. Some older (no longer maintained) modules are known to not work together with MySQL 4 and/or 5.



    --
    "He is not dangerous, he just wants to play...."
  • Code

    <?php
    // $Id: pninit.php,v 1.10 2002/11/17 14:48:05 schup Exp $
    // LICENSE
    //
    // This program is free software; you can redistribute it and/or
    // modify it under the terms of the GNU General Public License (GPL)
    // as published by the Free Software Foundation; either version 2
    // of the License, or (at your option) any later version.
    //
    // This program is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    // GNU General Public License for more details.
    //
    // To read the license please visit http://www.gnu.org/copyleft/gpl.html

    // <security msg="check for direct call">
    if (!function_exists('pnModGetVar'))
    {
        die ("You can't access this file directly...");
    }
    // </security>
    // <change msg="include global language file of this module">
    $modinfo = pnModGetInfo(pnModGetIDFromName('postguestbook'));
    $currentlang = pnUserGetLang();
    include_once("modules/$modinfo[directory]/pnlang/$currentlang/global.php");
    // </change>

    /**
     * initialise the postguestbook module
     * This function is only ever called once during the lifetime of a particular
     * module instance
     */

    function postguestbook_init()
    {
       //pnModSetVar('postguestbook', 'style', 'none');
       list($dbconn) = pnDBGetConn();
       $pntable = pnDBGetTables();

       /*
       CREATE TABLE nuke_postguestbook_gb
       (
          gb_id int(11) NOT NULL auto_increment,
          gb_name varchar(255) NOT NULL default '',
          gb_email varchar(255) default NULL,
          gb_ip varchar(255) NOT NULL default '',
          gb_message text NOT NULL,
          gb_homepage varchar(255) default NULL,
          gb_timestamp datetime NOT NULL default 'CURRENT DATE',
          gb_members int(2) NOT NULL default '0',
          gb_private_msg int(2) NOT NULL default '0',
          PRIMARY KEY  (gb_id)
       )
       */

       $guestbook_table           = $pntable['postguestbook_guestbook'];
       $guestbook_column          = &$pntable['postguestbook_guestbook_column'];

       $sql = "CREATE TABLE $guestbook_table (
             $guestbook_column[id] int NOT NULL auto_increment,
             $guestbook_column[owner_uid] int(11) DEFAULT '-1' NOT NULL,
             $guestbook_column[name] varchar(255) NOT NULL default '',
             $guestbook_column[email] varchar(150) default NULL,
             $guestbook_column[ip] varchar(50) default NULL,
             $guestbook_column[message] text NOT NULL,
             $guestbook_column[comment] text default NULL,
             $guestbook_column[homepage] varchar(255) default NULL,
             $guestbook_column[timestamp] datetime NOT NULL default 'CURRENT_TIMESTAMP',
             $guestbook_column[members] int NOT NULL default '0',
             $guestbook_column[private_msg] int NOT NULL default '0',
             $guestbook_column[location] varchar(128) default NULL,
             $guestbook_column[mood] varchar(128) default NULL,
             $guestbook_column[user1] varchar(255) default NULL,
             $guestbook_column[user2] varchar(255) default NULL,
             $guestbook_column[user3] varchar(255) default NULL,
             $guestbook_column[user4] varchar(255) default NULL,
             $guestbook_column[user5] varchar(255) default NULL,
             $guestbook_column[disable_html] char(1) default 'N' NOT NULL,
             $guestbook_column[disable_bbcode] char(1) default 'N' NOT NULL,
             $guestbook_column[disable_autolinks] char(1) default 'N' NOT NULL,
             $guestbook_column[pn_uid] int(11) default NULL,
             PRIMARY KEY  (gb_id)) Comment='Guestbook Entries'"
    ;

       $dbconn->Execute($sql);

       if ($dbconn->ErrorNo() != 0)
       {
          pnSessionSetVar('errormsg', _CREATETABLEFAILED);
          return false;
       }

       // set Config parameters

       // how much entries are on each page (maximum)
       pnModSetVar('postguestbook', 'entries_per_page',  '10');
       // whats the display-style/theme? -> changed to internal after Version 0.5
       pnModSetVar('postguestbook', 'style',             'internal');

       // enable/disable html-code in messages
       pnModSetVar('postguestbook', 'enable_html',       '0');
       // enable/disable bbcode in messages
       pnModSetVar('postguestbook', 'enable_bbcode',       '0');

       // notify admin
       // -> settings taken from PostNuke config
       pnModSetVar('postguestbook', 'notify',          pnConfigGetVar('notify'));
       pnModSetVar('postguestbook', 'notify_email',    pnConfigGetVar('notify_email'));
       pnModSetVar('postguestbook', 'notify_subject',  pnConfigGetVar('notify_subject'));
       pnModSetVar('postguestbook', 'notify_message',  pnConfigGetVar('notify_message'));
       pnModSetVar('postguestbook', 'notify_from',     pnConfigGetVar('notify_from'));

       pnModSetVar('postguestbook', 'use_smarty_version', 'new');

       // let everyone sign the guestbook
       pnModSetVar('postguestbook', 'sign_check_by_cms', '0') ;
       return true;
    }

    /**
     * upgrade the postguestbook module from an old version
     * This function can be called multiple times
     */

    function postguestbook_upgrade($oldversion)
    {
       list($dbconn) = pnDBGetConn();
       $pntable = pnDBGetTables();


       $guestbook_table           = $pntable['postguestbook_guestbook'];
       $guestbook_column          = &$pntable['postguestbook_guestbook_column'];

       // <hack msg="try to figure out old version because of Envo/PostNuke Bug">
       if ($oldversion == '0.5' || $oldversion == '0.6')
       {
          $old_fetch_mode = $ADODB_FETCH_MODE;
          //$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
          $sql = "select * from $guestbook_table LIMIT 0,1;";
          $rs = $dbconn->Execute($sql);

          if ($rs)
          {
             //$arr = $rs->FetchRow();
             $arr = $rs->GetRowAssoc();
             if (strlen($arr['GB_DISABLE_HTML']) == 0)
             {
                // no GB_DISABLE_HTML column => version can't be 0.5 or above
                $oldversion = '0.4';
             }
             $rs->Close();
          }
       }
       //$ADODB_FETCH_MODE = $old_fetch_mode;
       // </hack>
       switch ($oldversion)
       {
          case '0.1':
          {
             pnModSetVar('postguestbook', 'enable_html',       '0');
             pnModSetVar('postguestbook', 'enable_bbcode',     '0');
             // no break -> make updates of higher versions too
          }
          case '0.2':
          case '0.3':
          case '0.3.1':
          case '0.3.2':
          case '0.4':
          case '0.4.1':
          {
               
                // don't use $guestbook_column[id] for after => table.column doesn't work
               
             $sql = "ALTER TABLE `$guestbook_table`
                   ADD $guestbook_column[owner_uid] INT(11) NOT NULL DEFAULT '-1' AFTER gb_id,
                   ADD $guestbook_column[comment] TEXT AFTER gb_message,
                   ADD $guestbook_column[disable_html] CHAR(1)  NOT NULL DEFAULT 'N',
                   ADD $guestbook_column[disable_bbcode] CHAR(1) NOT NULL DEFAULT 'N',
                   ADD $guestbook_column[disable_autolinks] CHAR(1) NOT NULL DEFAULT 'N',
                   ADD $guestbook_column[pn_uid] INT(11) DEFAULT NULL;"
    ;
             $dbconn->Execute($sql);
             pnSessionSetVar('errormsg', $sql);

             if ($dbconn->ErrorNo() != 0)
             {
                pnSessionSetVar('errormsg', _UPDATETABLEFAILED . ":0.4:$sql" . $dbconn->ErrorNo());
                return false;
             }
             // only break for default
             break;
          }
          case '0.5':
          {
             // nothing to be done
             break;
          }
          default:
          {
             pnSessionSetVar('errormsg', _UPDATETABLEFAILED . ":old version not known:$oldversion");
          }
       }

       // old version independent -> if not set, set it  <img src="http://community.zikula.org/images/smilies/icon_smile.gif" alt="icon_smile" />
       if (strlen(pnModGetVar('postguestbook', 'use_smarty_version')) == 0)
       {
          pnModSetVar('postguestbook', 'use_smarty_version', 'new');
       }

       // let everyone sign the guestbook
       if (strlen(pnModGetVar('postguestbook', 'sign_check_by_cms')) == 0)
       {
             pnModSetVar('postguestbook', 'sign_check_by_cms', '0') ;
       }

       return true;
    }

    /**
     * delete the postguestbook module
     * This function is only ever called once during the lifetime of a particular
     * module instance
     */

    function postguestbook_delete()
    {
       list($dbconn) = pnDBGetConn();
       $pntable = pnDBGetTables();
       $guestbook_table           = $pntable['postguestbook_guestbook'];
       //$guestbook_column          = &$pntable['postguestbook_guestbook_column'];

       $module_vars_table      = $pntable['module_vars'];
       $module_vars_column     = &$pntable['module_vars_column'];
       $blocks_table           = $pntable['blocks'];
       $blocks_column          = &$pntable['blocks_column'];

       // get the module id
       $modid = pnModGetIDFromName('postguestbook');

       $sql = "DROP TABLE $guestbook_table";
       $dbconn->Execute($sql);
       if ($dbconn->ErrorNo() != 0)
       {
          pnSessionSetVar('errormsg', 'Guestbook Table Drop Failed');
          // continue and try to delete remaining items
          // -> only if guestbook-table doesn't exist anymore?
          //return false;
       }


       // remove all the postguestbook variables from the DB
       // \todo: PN API-function for deleting all config-vars of a module?
       pnModDelVar('postguestbook', 'entries_per_page');
       pnModDelVar('postguestbook', 'style');
       pnModDelVar('postguestbook', 'notify');
       pnModDelVar('postguestbook', 'notify_email');
       pnModDelVar('postguestbook', 'notify_subject');
       pnModDelVar('postguestbook', 'notify_message');
       pnModDelVar('postguestbook', 'notify_from');
       pnModDelVar('postguestbook', 'use_smarty_version');
       pnModDelVar('postguestbook', 'sign_check_by_cms') ;

       /*
       // -> quick and dirty
       $sql = "DELETE FROM $module_vars_table WHERE $module_vars_column[modname] LIKE 'postguestbook%'";
       $dbconn->Execute($sql);
       if ($dbconn->ErrorNo() != 0)
       {
          pnSessionSetVar('errormsg', 'postguestbook Module Variable Clean-Up Failed');
          return false;
       }
       */


       // remove any blocks associated with postguestbook
       /*   -> no blocks
       $sql = "DELETE FROM $blocks_table WHERE $blocks_column[mid] = $modid";
       $dbconn->Execute($sql);
       if ($dbconn->ErrorNo() != 0)
       {
          pnSessionSetVar('errormsg', 'postguestbook Blocks Clean-Up Failed');
          return false;
       }
       */

       return true;
    }
    ?>



  • oh man. my post does disapear?? >.< i'm not familiar with posting using postnuke :(


    i need some guestbook module that can grant guest to sign the guestbook.. but.. it will not show / viewable until admin approve the letter..
    ..

    just curious if that kind of guestbook exist
  • The guestbook by Invalidresponse can be setup that way for non logged in users.
    Although you can see the post by a guest, it won't actually be visible to others until you approve it.

    http://www.invalidresponse.com/



    edited by: Thug21, Mar 06, 2007 - 03:52 PM

This list is based on users active over the last 60 minutes.