Support Spidean

Do you like our FREE downloads? How about the FREE support for the FREE downloads? Please help us out and donate any amount! It's fast and easy through PayPal.

Spidean Forums

Board Index > Support > User Variables INSIDE PostWrap!!!


 < Last Thread   Next Thread >New Topic  Post Reply
Author: Subject: User Variables INSIDE PostWrap!!!

Newbie





Posts: 2
Registered: 1/7/2003
Status: Offline

  posted on 3/2/2003 at 12:36 PM
Well folks, it might not sound like much to some of the more experienced folks in the pn world, but I finally got the API func's to work INSIDE of PostWrap! The first caveat must be that I have no idea of the security implications of how I got to this point, so perhaps a kindly mentor would be willing to look through it all...

The first part I learned is that basically there is no Wrapper (not PostWrap, not htmlpages, not blank.php, not sections, not ContentExpress) program that can do this natively with PHP (ton's of bboards, believe me I looked for weeks on this...). The closest I found was the "blank.php" file that gave me some basic hints that the API was available regardless of location or referer, just had to figure it out. Since it's now 4am and I just figured it out, forgive me if I'm not putting together complete sentances...

So, figuring I'd just go the brute force route under Phoenix w/ PostWrap, I grabbed the admin.php file and stripped it down so as to be absolutely sure of the API framework. I threw in one include, the PHP file I've been trying to populate with pnUserGetVar variables and VIOLA!!! The damn thing worked!! Now just so you know, I'm on pn0.7.2.3 (Phoenix) and have turned global's on via PHP just to be compatible in hopes that that wasn't my problem.

One of the other things that I've notived but can't seem to figure out, is why I can call the originating script in the root dir, but if I attempt to call any subdir it fails (could be just me not grasping how the hosting platform I'm on is dealing with ref dirs, but even explicitly, it still doesn't work unless in the home dir of PN). Willing to discuss this more if you're interested...

So, back to the meat of the story...

quote:
<?php
// File: $Id: admin.php,v 1.4 2003/01/04 08:42:58 larsneo Exp $ $Name: $

include 'includes/pnAPI.php';
pnInit();
include 'includes/legacy.php';

/* Allows Postnuke to work with register_globals set to off
* Patch for php 4.2.x or greater
*/

if ( function_exists('ini_get') ) {
$onoff = ini_get('register_globals');
} else {
$onoff = get_cfg_var('register_globals');
}
if ($onoff != 1) {
@extract($HTTP_SERVER_VARS, EXTR_SKIP);
@extract($HTTP_COOKIE_VARS, EXTR_SKIP);
@extract($HTTP_POST_FILES, EXTR_SKIP);
@extract($HTTP_POST_VARS, EXTR_SKIP);
@extract($HTTP_GET_VARS, EXTR_SKIP);
@extract($HTTP_ENV_VARS, EXTR_SKIP);
@extract($HTTP_SESSION_VARS, EXTR_SKIP);
}
include 'step1.php';

?>


is all I use to call the subordinate scripts (step1.php) and since they are included the API functions are made available to them as well!!! Just so you know, previously I've seen similiar postings and every attempt to make them work failed. Seems that the extraction of the var's is significant here, and again, I can't profess to being a great PHP or PN programmer, so any insight as to why this method works and all others seem to fail would be a nice help.

I'm assuming now that I must call every script explicitly with this mod'ed framework (ie, an include statement).

Okay, that's enough for tonight, I'm back to coding a bit more then sleep...if anyone is interested in pursuing this experience, let me know...

Chrome!

 
Reply With Quote

Administrator




Posts: 4608
Registered: 10/7/2002
Status: Offline

  posted on 3/10/2003 at 07:07 PM
Very cool... I'll look it over.

Thanks!
Shawn

 
Reply With Quote

Newbie




Posts: 6
Registered: 3/17/2003
Status: Offline

  posted on 3/17/2003 at 11:48 PM
Very good news. I believe this may be exactly what I've been looking for myself this past week. When you get the chance, I'm hoping maybe you can explain this a little bit better for me, as i'm very new to php and postnuke. I've got a nice menu system created by someone else that uses variables as well that i've been trying to implement with postwrap as well on content express.

My first question is this, what does your actual url look like, as its not the actual file names.

 
Reply With Quote
New Topic    Post Reply


Main Menu

Get AutoTheme

Featured Item

Poll

How do you like the new look?

[ Results | Polls ]

Votes: 180

Powered by the AutoTheme HTML Theme System
Page created in 0.118239 Seconds