11
shank
Re: coding help needed I think.
  • 2006/5/21 17:53

  • shank

  • Not too shy to talk

  • Posts: 144

  • Since: 2004/8/17


here is some php debug info from the non working install.

Quote:

Warning [PHP]: mkdir(../ehb_XXX/): Permission denied in file modules/modcreator/generate.php line 22
Warning [PHP]: move_uploaded_file(../ehb_XXX/logo.gif): failed to open stream: No such file or directory in file modules/modcreator/generate.php line 30
Warning [PHP]: move_uploaded_file(): Unable to move '/tmp/php7CrNNx' to '../ehb_XXX/logo.gif' in file modules/modcreator/generate.php line 30
Warning [PHP]: fopen(newxoopsversion.txt): failed to open stream: Permission denied in file modules/modcreator/generate.php line 43
s l s h a n k l e @ b e l l s o u t h . n e t



12
shank
coding help needed I think.
  • 2006/5/21 16:23

  • shank

  • Not too shy to talk

  • Posts: 144

  • Since: 2004/8/17


ok. So I created a module using the "mypage" idea found HERE.

This new module i'm calling modcreator. What it does is create new modules using the same idea of the "mypage".

After the form is filled out on the index it takes that information and puts it into the xoops_version.php file. it creates a new module directory with the name ehb_$modname which is taken from the form.
and it creates the index.php file with the content of coming soon.

This is still a work in progress, but I'm having an issue.

This module works on my local, and it works on my XOOPS site online, but I tested on someone elses XOOPS site, and it didn't work right. it did create the directory for the new module, and uploaded the file to serve as a logo in the admin, but then it dies. also the folder it created, and the gif file in it are locked and can not be deleted for some reason.

So what I am looking for is someone to take a look at my code and help me figure out why this is happening. also are there any security risks in this module I could fix, and generally just help me clean up the code a bit.

I will post the code of the module now, with a link at the bottom of this post so anyone can download a zip file of the module if they want to.

/modcreator/index.php
<?php
include("../../mainfile.php");
include(
XOOPS_ROOT_PATH."/header.php");
$xoopsOption['show_rblock'] = 1;
?>
//All files that contain the above must keep the above to display in the XOOPS framework
<html>
<title>modcreator</title>
<body>
<table align="center"><tr><td align="center"><h1>New Module</h1><br><br>
<!-- The data encoding type, enctype, MUST be specified as below -->
<form enctype="multipart/form-data" action="generate.php" method="post">
Module Name:<input type="text" name="name"><br>
Version:<input type="text" name="version"><br>
Description:<input type="text" name="descript"><br>
Author:<input type="text" name="author"><br>
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="3000" />
logo.GIF file(92x52pixels):<input type="file" name="logo"><br>
<input type="submit" value="Generate">
</form>
</td></tr></table>
</body>
//All files that contain the below must keep the below to display in the XOOPS framework
<?php
include(XOOPS_ROOT_PATH."/footer.php");

?>



/modcreator/generate.php
<?php
include("../../mainfile.php");
include(
XOOPS_ROOT_PATH."/header.php");
$xoopsOption['show_rblock'] = 1;
//All files that contain the above must keep the above to display in the XOOPS framework
$modname=$_POST['name'];
$modver=$_POST['version'];
$descript=$_POST['descript'];
$author=$_POST['author'];


if (
$_FILES['logo']['type'] != 'image/gif')
{
echo 
"The File Must Be A GIF file. Please make sure your file has GIF for an extension and try again.<br /><a href="index.php">Go Back To Form</a>";
}
elseif (
$_FILES['logo']['size'] > 3000)
{
echo 
"File is too larger. Files should be less than 3Kb. Please try again.<br /><a href="index.php">Go Back To Form</a>";
}
else
{
mkdir ("../ehb_$modname/"0755);
$logo=($_FILES['logo']['name']);
echo 
"directory /modules/$modname/ has been created.<br />";

$target_path "../ehb_$modname/";
$target_path $target_path basename$_FILES['logo']['name']);
$_FILES['logo']['tmp_name'];

if(
move_uploaded_file($_FILES['logo']['tmp_name'], $target_path)) {
    echo 
"The file "basename$_FILES['logo']['name']). " has been uploaded.<br />";
} else{
    echo 
"Possible file upload attack!n";
    echo 
'Here is some more debugging info:';
    
print_r($_FILES);
}


//Everything from here up works

//This creates a file called xoops_version.txt that we will move later.
$myFile "newxoopsversion.txt";
$fh fopen($myFile'w') or die("can't open file");

$stringData "<?phpn";
fwrite($fh$stringData);

$stringData "$modversion['name'] = "$modname";//name of modulen";
fwrite($fh$stringData);

$stringData "$modversion['version'] = "$modver";n";
fwrite($fh$stringData);

$stringData "$modversion['description'] = "$descript";n";
fwrite($fh$stringData);

$stringData "$modversion['author'] = "$author";n";
fwrite($fh$stringData);

$stringData "$modversion['credits'] = "";n";
fwrite($fh$stringData);

$stringData "$modversion['help'] = "";n";
fwrite($fh$stringData);

$stringData "$modversion['license'] = "GPL see LICENSE";n";
fwrite($fh$stringData);

$stringData "$modversion['official'] = 0;n";
fwrite($fh$stringData);

$stringData "$modversion['image'] = "$logo";n";
fwrite($fh$stringData);

$stringData "$modversion['dirname'] = "ehb_$modname";//name of directory on servern";
fwrite($fh$stringData);

$stringData "n";
fwrite($fh$stringData);

$stringData "// Admin thingsn";
fwrite($fh$stringData);

$stringData "$modversion['hasAdmin'] = 1;n";
fwrite($fh$stringData);

$stringData "$modversion['adminpath'] = "admin.php";n";
fwrite($fh$stringData);

$stringData "n";
fwrite($fh$stringData);

$stringData "// Menu/Sub Menun";
fwrite($fh$stringData);

$stringData "$modversion['hasMain'] = 0; //make 0 to not have this appear in main menun";
fwrite($fh$stringData);

$stringData "n";
fwrite($fh$stringData);

$stringData "?>";
fwrite($fh$stringData);
fclose($fh);
echo 
"new file has been created,";
//Now let's move it
rename("newxoopsversion.txt""../ehb_$modname/xoops_version.php");
echo 
"and moved to directory /modules/$modname/xoopsversion.php<br /><br />";

//Now we'll create the new index.php file
$myIndex "index.txt";
$fh fopen($myIndex'w') or die("can't open file");

$stringData "<?phpn";
fwrite($fh$stringData);

$stringData "include("../../mainfile.php");n";
fwrite($fh$stringData);

$stringData "include(XOOPS_ROOT_PATH."/header.php");n";
fwrite($fh$stringData);

$stringData "$xoopsOption['show_rblock'] = 1;n";
fwrite($fh$stringData);

$stringData "?>n";
fwrite($fh$stringData);

$stringData "Coming Soon!n";
fwrite($fh$stringData);

$stringData "<?phpn";
fwrite($fh$stringData);

$stringData "include(XOOPS_ROOT_PATH."/footer.php");n";
fwrite($fh$stringData);

$stringData "n";
fwrite($fh$stringData);

$stringData "?>";
fwrite($fh$stringData);
fclose($fh);
echo 
"new index file has been created,";
//Now let's move it
rename("index.txt""../ehb_$modname/index.php");
echo 
"and moved to directory /modules/ehb_$modname/index.php<br /><br />";
}
//All files that contain the below must keep the below to display in the XOOPS framework
include(XOOPS_ROOT_PATH."/footer.php");

?>



Isn't it some ugly code.

Incase you can't tell I am not a php coder, just a wannabe.

Here is the zip file:
modcreator.zip

Thanks,
Steve
s l s h a n k l e @ b e l l s o u t h . n e t



13
shank
Re: theme editing need help
  • 2006/5/17 2:20

  • shank

  • Not too shy to talk

  • Posts: 144

  • Since: 2004/8/17


Clear your template_c folder, and your browsers cache.
Also make sure in admin system preferances you have it set to update from the theme folder, or whatever it says.
s l s h a n k l e @ b e l l s o u t h . n e t



14
shank
Re: send an email notification when pm is received
  • 2006/5/15 17:21

  • shank

  • Not too shy to talk

  • Posts: 144

  • Since: 2004/8/17


s l s h a n k l e @ b e l l s o u t h . n e t



15
shank
Re: Moving Block to Top
  • 2006/5/1 1:47

  • shank

  • Not too shy to talk

  • Posts: 144

  • Since: 2004/8/17


What is the website so we can see what you are talking about specificly?


You can put block content into the theme, it is just a matter of how much work you want to do.

The code has been posted before on how to put the user menu in the theme, and the search would be simple also.

What exactly are you asking for?
s l s h a n k l e @ b e l l s o u t h . n e t



16
shank
Re: Why are my scrolling images clipping
  • 2006/4/24 22:53

  • shank

  • Not too shy to talk

  • Posts: 144

  • Since: 2004/8/17


The column is ok it is the block that is doing it.

I tried to see the actual image to compare, and they are linked to the wrong images also.

Good luck.
s l s h a n k l e @ b e l l s o u t h . n e t



17
shank
Re: simple question - mysite.com
  • 2006/4/22 16:33

  • shank

  • Not too shy to talk

  • Posts: 144

  • Since: 2004/8/17


Try admin > system > preferances > General settings
s l s h a n k l e @ b e l l s o u t h . n e t



18
shank
Re: Using xoops with subdomains
  • 2006/4/22 16:27

  • shank

  • Not too shy to talk

  • Posts: 144

  • Since: 2004/8/17


It appears as though you have XOOPS installed in a sub-directory instead of a sub-domain. And your sub-domain has been redirected to your XOOPS sub-directory.

Can you give us the link to the site?

Did you create the sub-domain and then install xopps? Or did you install XOOPS first?
s l s h a n k l e @ b e l l s o u t h . n e t



19
shank
Re: Strange error in custom PHP blocks
  • 2006/4/19 22:21

  • shank

  • Not too shy to talk

  • Posts: 144

  • Since: 2004/8/17


I meant put a closing php tag then reopen php again.
s l s h a n k l e @ b e l l s o u t h . n e t



20
shank
Re: Strange error in custom PHP blocks
  • 2006/4/19 19:58

  • shank

  • Not too shy to talk

  • Posts: 144

  • Since: 2004/8/17


In your custom php block put this before your code

?><?php


See if that works
s l s h a n k l e @ b e l l s o u t h . n e t




TopTop
« 1 (2) 3 4 5 ... 15 »



Login

Who's Online

242 user(s) are online (165 user(s) are browsing Support Forums)


Members: 0


Guests: 242


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