Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Mod File Upload
I had it towards the top of the page. It might be outputting headers, which would cause problems if they appear before the headers I emit.
Offline
Re: Mod File Upload
I’m trying to pick up PHP as I go but every time I learn something it just seems to get more complicated! :grin:
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
Re: Mod File Upload
The funny part is that I really don’t know PHP either. I never really used it until Txp.
Offline
Re: Mod File Upload
Snap!
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
Re: Mod File Upload
> Anton wrote:
> If you get an error using the first of the three examples under the plugin info section (<txp:mem_file_link id=“1” />), try using the third one instead (<txp:mem_file_link id=“23”>The link text goes here</txp:mem_file_link>) since that one works well. The first one will work in a future release, IIRC.
Anton – Could you go into this a bit further? Where are these 3 examples in what ‘plugin info section’? At the moment I can’t access the admin section (presumably because I’m using this with RC1).
Last edited by jonhicks (2004-12-08 13:49:52)
Cheers,
Jon VC#9
Offline
Re: Mod File Upload
jon, for RC1, you can’t use the single tag format for the plugin (the one that ends with />) because of the way that RC1 handles tags compared to how RC2 handles them. You instead would have to use the long format (<txp:mem_file_link link="1">Click To Download</txp:mem_file_link>
) instead.
The plugin info section is the ‘plugin’ tab under the ‘Admin’ tab. It is the page where you install and enable plugins. Clicking on one of the plugin names will bring up the plugin code and display the plugin’s help below the code box.
You probably cannot access the admin section because of the modifications to the “txp_prefs.php” page. Turn on error reporting for that file by adding the following code towards the top of it.
<code> error_reporting(E_ALL);</code>
<code>ini_set("display_errors","1");</code>
Offline
Re: Mod File Upload
Hi Manfre – I tried adding that code, but still no errors are reported. Maybe I should just bite the bullet and update to RC2? I’m not worried about having to use the long tag format though, just need to access admin and install the plug-in part of the mod.
Cheers,
Jon VC#9
Offline
#44 2004-12-08 17:11:39
- zmeigorin
- New Member
- From: Moscow
- Registered: 2004-11-12
- Posts: 6
Re: Mod File Upload
To make the plugin work with RC1, simply change <code>$atts</code> to <code>$atts = null</code> in its first line.
Offline
Re: Mod File Upload
Manfre… has anyone told you that they love you ?!
Worked like a charm, except the “CREATE TABLE” kept on failing, not sure why, but took me awhile to track down that was the problem. I was able to create the table from the command line, but I wanted to see what problem was, I am not sure what or why this is true, but i changes single quotes and took out latin stuff.
<pre>
<code>
$sql = “CREATE TABLE `txp_file` ( “
. “ `id` INT NOT NULL AUTO_INCREMENT ,”
. “ `filename` VARCHAR NOT NULL ,”
. “ `category` VARCHAR NOT NULL ,”
. “ `permissions` VARCHAR DEFAULT ‘0’ NOT NULL ,”
. “ `description` VARCHAR NOT NULL ,”
. “ PRIMARY KEY ( `id` ) ,”
. “ UNIQUE ( `filename` )
) TYPE=MyISAM PACK_KEYS=0 AUTO_INCREMENT=15 “;
</code>
</pre>
Now that it’s install, could i conceivably comment out “file_install()” ??
question : “how to force line breaks in textile so SQL doesn’t end up one line?”
update : doh! <code>< pre> tag</code>
Last edited by dbulli (2004-12-13 18:09:51)
nuff-respec ::: dannyb
Offline
Re: Mod File Upload
dbulli, I’ll look in to the problem with the create table. I’m not sure why you were having a problem, but it may be the version of MySQL you were installing it to.
You can comment out the file_install() call at the top of the file. It’s not needed once everything is put in place, but it is harmless after it does what it needs to do—just a few extra db calls to make sure the config values exist in the database.
Offline
Re: Mod File Upload
If this helps: version 3.23.56-log
Also one minor little thing because i am a dumba$$ … but there may be others out there, i had no idea where to change the “file_base_path” (i actually wanted it in the web tree) … i had to sift thru code to realize it was in “admin > site preferences”, doh .. maybe noteworth to mention, in notes.
I will try and sift through your code to find out where to put a check for certain types of extensions. Not a huge deal as I am using this right now for internal proof of concept, but regardless you saved my life!
<pre>
<code>
if( !in_array( strtolower( strrchr( FILENAME, “.” )), ARRAY_ALLOWED_EXTS ))
{
return “not an accepted extension”;
}
else
{
return 1;
}
</code>
</pre>
nuff-respec ::: dannyb
Offline
Re: Mod File Upload
The create table problems you were having make sense because that stuff works for 4.x versions, but I guess it is not supported in in the 3.x versions.
Save yourself the trouble of searching, but there are no extension checks. Files can have any extension. I intentionally left out a extension check because only authenticated users can upload files by default, and altering the text and layout of the site is more damaging than uploading of files. You can restrict user types from having access to the upload tab by removing the matching number from the “check_privs(1,2,3,4,5,6);” at the top of the file “txp_file.php”.
Offline