1
bungoman85
uploading files via wfsection
  • 2005/6/21 17:36

  • bungoman85

  • Just popping in

  • Posts: 27

  • Since: 2005/5/23


Ok, yet another question about the wfsection module. Is there a way to allow users to upload files from the front end? So far I've only been able to find a way to upload files when submitting an article through the administration menu. That doesn't do me much good if I want non-administrative users to be able to upload files.



2
bungoman85
Re: problem with wfsections posting articles
  • 2005/6/21 17:33

  • bungoman85

  • Just popping in

  • Posts: 27

  • Since: 2005/5/23


Nevermind, I figured it out. The notices didn't have anything to do with it. I just forgot that articles by default have to be approved before they are visible from the front end. Duh.



3
bungoman85
problem with wfsections posting articles
  • 2005/6/21 16:56

  • bungoman85

  • Just popping in

  • Posts: 27

  • Since: 2005/5/23


Whenever I try and post an article using the wfsections module from the front end I get the following two notices:

Notice [PHP]: Undefined index: filename in file modules/wfsection/submit.php line 129
Notice [PHP]: Use of undefined constant _WFS_THANKS - assumed '_WFS_THANKS' in file modules/wfsection/submit.php line 172

When I go back to where the article should be posted it doesn't show up. It is in the database, I can see it there, but it doesn't show up on the section page. Anyone know what might cause this behaviour and how it can be fixed?



4
bungoman85
Site Map
  • 2005/6/20 22:37

  • bungoman85

  • Just popping in

  • Posts: 27

  • Since: 2005/5/23


Is there a module that will generate a simple site map view with links to every page on my website?



5
bungoman85
making a block visible only on the view account page
  • 2005/6/20 16:46

  • bungoman85

  • Just popping in

  • Posts: 27

  • Since: 2005/5/23


Is there a simple way to make a block, such as the themes selection block, visible only in the View Account page? I want the user to be able to select the theme they use, but I want to keep away clutter on other pages so it seems the best place for the block would be on the user's own account page. I don't see it in the list of pages for it to appear visible on, is there a way to make it appear only there?



6
bungoman85
Re: is there a module...
  • 2005/6/16 18:42

  • bungoman85

  • Just popping in

  • Posts: 27

  • Since: 2005/5/23


I just tried that module. It isn't quite what I'm looking for, it can't do a tree view menu. That's the kind of thing I really need to have, but I need to be able to set up the individual links myself.



7
bungoman85
is there a module...
  • 2005/6/15 18:26

  • bungoman85

  • Just popping in

  • Posts: 27

  • Since: 2005/5/23


That combines the functionality of the iMenu module (ability to create links in a nice menu to wherever I want) and the style of the treemenuxl module (a nice tree view expandable/collapsable menu)? I need something that can give me the best of both, some of the navigation modules are without good descriptions, so I was wondering if anyone has used anything that does all that.



8
bungoman85
Re: really odd error in wfsection 2.07 beta 3 code
  • 2005/6/13 19:13

  • bungoman85

  • Just popping in

  • Posts: 27

  • Since: 2005/5/23


Forgot to mention, you'll need to change some things in the script to fit your own system, like the group name and the MySQL user and whatnot, nothing too hard to figure out.



9
bungoman85
Re: really odd error in wfsection 2.07 beta 3 code
  • 2005/6/13 19:11

  • bungoman85

  • Just popping in

  • Posts: 27

  • Since: 2005/5/23


Quote:

wcrwcr wrote:
Hi bungoman

Quote:
(using a nice little perl script I made that copies XOOPS and the mySQL database for backup and allows me to revert to any previous version I want).


Any chance to share that very interesting script?


#!/usr/local/bin/perl -w
# ******************************************************************************
# File: xoopsbackup.pl
#
# Author: Sean Eshbaugh
#
# Created: 06-01-2005
#
# Description:
#  Creates a backup of the current XOOPS mySQL database and puts it in the
#  current XOOPS directory. Then a copy of the XOOPS directory is made and the
#  version number associated with it is incrimented by one. All necessary
#  changes to file permissions and associations are then made. The symbolic
#  link from the Apache htdocs directory is changed to the new XOOPS directory.
#  Finally the old XOOPS database is removed from the new XOOPS folder to
#  prevent unecessary clutter.
#
# Arguments:
#  <arg1> - <password>
#
# Returns: 
#  0 on success, 1 on failure
#
# ******************************************************************************
# $Id$

# ******************** Globals *************************************************
use strict;
use 
Cwd;
use 
File::Basename;

my $usage "nUsage: xoopsbackup.pl <mysql_password>nn";

my $password "";

my $basepath "/usr/local/apache2";

# ******************** Main ****************************************************

# Parse the command line arguments and get the mySQL database password
&parse_cmd_line;

# Set umask
umask 002;

# cd to the Apache directory
chdir($basepath) || die "Could not cd to $basepathn";

# Get the name of the current XOOPS directory from the htdocs link
print STDERR "Getting current XOOPS path...n";

my $current_xoops_dir = &get_current_xoops_dir;

# Get the version number from the XOOPS directory name
print STDERR "Getting current XOOPS backup version...n";

my $current_version = &get_current_version;

# Incriment the current version by one to get the next version
print STDERR "Getting new XOOPS backup version...n";

my $next_version $current_version 1;

# Create the new XOOPS directory name
print STDERR "Getting new XOOPS path...n";

my $new_xoops_dir sprintf("htdocs.xoops.v%03d"$next_version);

# Backup the mySQL database to a file
print STDERR "Backing up mySQL dbase...n";

&
backup_dbase;

# Copy existing XOOPS installation to a new directory
&seed_new_dir;

print 
STDERR "Done backing up Xoops.n";

# ******************** Subs ****************************************************

# Parse cmd line args
sub parse_cmd_line
{
        
unless (@ARGV == 1)
        {
                die 
$usage;
        }

        
$password $ARGV[0];
}

# Get the current XOOPS directory
sub get_current_xoops_dir
{
         
unless (-'htdocs')
        {
                die 
"Could not find htdocs link in current dir: $basepathn";
        }

        return 
readlink('htdocs');
}

sub get_current_version
{
        if (
$current_xoops_dir =~ /.v(ddd)$/)
        {
                return $
1;
        }
        else
        {
                die 
"Could not extract version from current XOOPS path: $current_xoops_dirn";
        }
}

sub backup_dbase
{
        
my $outfile "$basepath/htdocs/xoopsdb.v" sprintf("%03d"$current_version) . ".sql";

        if (-
f $outfile)
        {
                
unlink($outfile) || die "Failed to delete $outfilen";
        }

        
my $mysql_cmd "/usr/local/mysql-4.1.7/bin/mysqldump -u root -p$password XOOPS ";

        
unless (system("$mysql_cmd > $outfile") == 0)
        {
                die 
"System call failed: $mysql_cmdn";
        }
}

sub seed_new_dir
{
        
# Copy the current XOOPS directory to a new one
        
print STDERR "Copying old XOOPS directory to new XOOPS directory...n";

        
my $cmd "/bin/cp -pr $current_xoops_dir $new_xoops_dir";

        
unless (system($cmd) == 0)
        {
                die 
"System call failed: $cmdn";
        }

        
# Change group ownership of the new XOOPS directory to techweb
        
print STDERR "Changing group ownership of new XOOPS directory to techweb...n";

        
$cmd "/bin/chgrp -R techweb $new_xoops_dir";

        
unless (system($cmd) == 0)
        {
                die 
"System call failed: $cmdn";
        }

        
# Add group write privleges to the new directory
        
print STDERR "Adding group write privleges to new XOOPS directory...n";

        
$cmd "/bin/chmod -R g+w $new_xoops_dir";

        
unless (system($cmd) == 0)
        {
                die 
"System call failed: $cmdn";
        }

        
# Update XOOPS root path in mainfile.php
        
print STDERR "Updating XOOPS root path...n";

        
$cmd "/bin/chmod u+w $new_xoops_dir/mainfile.php";

        
unless (system($cmd) == 0)
        {
                die 
"System call failed: $cmdn";
        }

        &
update_xoops_root_path;

        
# Set privleges to read only for the new mainfile.php
        
print STDERR "Setting privleges to read only for the new mainfile.php...n";

        
$cmd "/bin/chmod 444 $new_xoops_dir/mainfile.php";

        
unless (system($cmd) == 0)
        {
                die 
"System call failed: $cmdn";
        }

        
# Change symbolic link to point to the newly created XOOPS directory
        
print STDERR "Changing htdocs symbolic link to point to new XOOPS directory...n";

        
$cmd "/bin/rm -f htdocs; /bin/ln -s $new_xoops_dir htdocs";

        
unless (system($cmd) == 0)
        {
                die 
"System call failed: $cmdn";
        }

        
# Remove mySQL database backup from new directory
        
print STDERR "Removing old mySQL database backup from new XOOPS directory...n";

        
chdir ('htdocs') || die "Could not cd into newly created 'htdocs' directoryn";

        
my $oldfile  "$basepath/htdocs/xoopsdb.v" sprintf("%03d"$current_version) . ".sql";

        
$cmd "/bin/rm -f $oldfile";

        
unless (system($cmd) == 0)
        {
                die 
"System call failed: $cmdn";
        }
}

sub update_xoops_root_path
{
        
my $file "$new_xoops_dir/mainfile.php";
        
my @array = &load_file_to_array($file);

        
open(OUT">$file") || die "Could not open $file for writtingn";

        foreach 
my $line (@array)
        {
                
$line =~ s/$current_xoops_dir/$new_xoops_dir/;

                print 
OUT "$linen";
        }

        
close(OUT);
}

# Read the contents of a file into an array
sub load_file_to_array
{
        
my $file shift;
        
my @array = ();

        
open(LFTA$file) || die "Could not open $file for readingn";

        while (<
LFTA>)
        {
                
$_ =~ s/r//;

                
chomp $_;

                
push(@array, $_);
        }

        
close(LFTA);

        return @array;
}


and...

#!/usr/local/bin/perl -w
# ******************************************************************************
# File: xoopsrevert.pl
#
# Author: Sean Eshbaugh
#
# Created: 06-03-2005
#
# Description:
#
# Arguments:
#  <arg1> - <password>, <arg2> - <version to revert to>
#
# Returns: 
#  0 on success, 1 on failure
#
# ******************************************************************************
# $Id$

# ******************** Globals *************************************************

use strict;
use 
Cwd;
use 
File::Basename;

my $usage "nUsage: xoopsrevert.pl <password> <requested_version>nn";

my $basepath "/usr/local/apache2/";

my $password "";

my $requested_version 0;

# ******************** Main ****************************************************

# Parse the command line arguments and get the mySQL database password
&parse_cmd_line;

# Set umask

umask 002;

# cd to the Apache directory
chdir($basepath) || die "Could not cd to $basepathn";

# Get the name of the current XOOPS directory from the htdocs link
print STDERR "Getting current XOOPS path...n";

my $current_xoops_dir = &get_current_xoops_dir;

# Check to see if the requested version exists
my $requested_version_dir "htdocs.xoops.v" sprintf("%03d"$requested_version);

unless (-d $requested_version_dir)
{
        die 
"Could not find requested backup versionn";
}       

if (
$current_xoops_dir eq $requested_version_dir)
{
        die 
"Current XOOPS backup requestedn";
}

print 
STDERR "$current_xoops_dirn";
print 
STDERR "$requested_version_dirn";

# Change symbolic link to point to the old XOOPS directory
print STDERR "Changing htdocs symbolic link to point to old XOOPS directory...n";

my $cmd "/bin/rm -f htdocs; /bin/ln -s $requested_version_dir htdocs";

unless (system($cmd) == 0)
{
        die 
"System call failed: $cmdn";
}

# Edit the mySQL backup file so that mySQL can use it
print STDERR "Editing the mySQL database file...n";

&
edit_mysql_file;

# ******************** Subs ****************************************************

# Parse cmd line args
sub parse_cmd_line
{
        
unless (@ARGV == 2)
        {
                die 
$usage;
        }

        
$password $ARGV[0];

        
$requested_version $ARGV[1];
}

# Get the current XOOPS directory
sub get_current_xoops_dir
{
        
unless (-'htdocs')
        {
                die 
"Could not find htdocs link in current dir: $basepathn";
        }

        return 
readlink('htdocs');
}

sub edit_mysql_file
{
        
my $file "$requested_version_dir/xoopsdb.v" sprintf("%03d"$requested_version) . ".sql";
        
my @array = &load_file_to_array($file);

        
open(OUT">$file") || die "Could not open $file for writtingn";

        print 
OUT "use xoopsn";

        foreach 
my $line (@array)
        {
                print 
OUT "$linen";
        }

        
close(OUT);

        
my $mysql_cmd "/usr/local/mysql-4.1.7/bin/mysql -u root -p$password < $file";

        
unless (system($mysql_cmd) == 0)
        {
                die 
"Could not load the mySQL database filen";
        }
}

# Read the contents of a file into an array
sub load_file_to_array
{
        
my $file shift;
        
my @array = ();

        
open(LFTA$file) || die "Could not open $file for readingn";

        while (<
LFTA>)
        {
                
$_ =~ s/r//;

                
chomp $_;

                
push(@array, $_);
        }

        
close(LFTA);

        return @array;
}



10
bungoman85
really odd error in wfsection 2.07 beta 3 code
  • 2005/6/13 18:24

  • bungoman85

  • Just popping in

  • Posts: 27

  • Since: 2005/5/23


So I finally figured out how to turn PHP debug on. I decided to roll back XOOPS to a point before I had installed the wfsection module (using a nice little perl script I made that copies XOOPS and the mySQL database for backup and allows me to revert to any previous version I want). Rather than go with version 1.01 of the module, which was generating lots of blank pages and is relatively old I decided to go with 2.07 beta 3, the newest version. I had tried it before but I had not been able to install it before for some odd reason it was making XOOPS freak out whenever I tried to go to the modules admin page. It seems there was some sort of fatal error inside the PHP code that was causing XOOPS to stop rendering HTML so I couldn't even see the module in the install list, nor could I see any module whose directories inode number was greater than the wfsection directory's. Now that I have PHP debug on I was able to shed some light on the problem. At first I was getting some redeclared variable errors inside of the wfsarticle.php file inside the declaration of the WfsArticle class. I commented out the redeclared variables (why they were left in there is beyond me) but then I came to this error:

Fatal error: Cannot re-assign $this in /engtools/local_advtech_develop/apache2/htdocs.xoops.v006/modules/wfsection/class/wfsarticle.php on line 591
Notice [PHP]: Undefined index: logopath in file modules/wfsection/class/common.php line 92
Notice [PHP]: Undefined index: logopath in file modules/wfsection/class/common.php line 93

Here is the code in surrounding the error:

585 function getArticle($articleid)
586 {
587 $sql = "SELECT * FROM " . $this->table . " WHERE articleid=" . $articleid . " ";
588 $array = $this->db->fetchArray($this->db->query($sql));
589 if (!is_array($array))
590 {
591 $this = false;
592 return false;
593 }
594 $this->makeArticle($array);
595 }

This error is a bit much for me to handle without serious understanding of what is going on. I don't feel comfortable trying to change any of this code as I don't want to break it more than it already is broken. Does anyone know what this error means exactly? Has anyone else even encountered this before?




TopTop
(1) 2 3 »



Login

Who's Online

191 user(s) are online (133 user(s) are browsing Support Forums)


Members: 0


Guests: 191


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits