Joomla! Discussion Forums



It is currently Tue Nov 24, 2009 2:19 am (All times are UTC )

 




Post new topic Reply to topic  [ 8 posts ] 
Author Message
Posted: Fri Nov 06, 2009 11:18 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Apr 21, 2009 1:06 pm
Posts: 17
Please help with such problem. I need to add new .php file to existing and installed Joomla 1.5 component but then I include the JEXEC code in the beginning of the .php file

Code:
defined( '_JEXEC' ) or die( 'Restricted access' );



my .php file does not work :( As I understand I should include my new file somewhere but where? Please advice what should I do.


Top
  E-mail  
 
Posted: Sat Nov 07, 2009 12:55 am 
User avatar
Joomla! Exemplar
Joomla! Exemplar
Offline

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 7647
Location: Europe
The line you stated above, means that the direct access to that file is not allowed.

are you trying to write an extension? component? module?

Olaf

_________________
Olaf Offick
Learn Skills - a world of learning at your fingertips
http://learn-skills.org


Top
   
 
Posted: Sat Nov 07, 2009 1:08 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Apr 21, 2009 1:06 pm
Posts: 17
I have written component but now I have to add some functionality (after component installation) and I am trying to add some new files but don't work if i include JEXEC statement in the begining of the .php file.


Top
  E-mail  
 
Posted: Sat Nov 07, 2009 3:32 am 
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Mon Aug 11, 2008 1:16 am
Posts: 312
LowCoder wrote:
I have written component but now I have to add some functionality (after component installation) and I am trying to add some new files but don't work if i include JEXEC statement in the begining of the .php file.


does the XML install file include the folder that it is contained in?


Top
  E-mail  
 
Posted: Sat Nov 07, 2009 9:39 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Apr 21, 2009 1:06 pm
Posts: 17
Folder is included but file is not included. After component installation the .xml file is in the admin part of component (e.g. administrator/components/com_mycomponent/mycomponent.xml). But files I have to add is on the site part of the component - e.g. mysite/components/com_mycomponent/newfileafterinstallation.php


Top
  E-mail  
 
Posted: Sat Nov 07, 2009 6:16 pm 
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Mon Aug 11, 2008 1:16 am
Posts: 312
LowCoder wrote:
Folder is included but file is not included. After component installation the .xml file is in the admin part of component (e.g. administrator/components/com_mycomponent/mycomponent.xml). But files I have to add is on the site part of the component - e.g. mysite/components/com_mycomponent/newfileafterinstallation.php


As long as the folders are registered, that should take care of it being part of the framework pathing.
Somehow, you are trying to access that php file from outside the framework, thus the security locks you out.
The only outside entry point should be the root index.php.
The code is designed so that direct execution of a file is not possible, such as:
http://mysite/components/com_mycomponen ... ponent.php
Is this what you are attempting to do for some reason?


Top
  E-mail  
 
Posted: Sat Nov 07, 2009 6:53 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Apr 21, 2009 1:06 pm
Posts: 17
Not exactly. I am trying to get more functionality including new files to earlier registered (by the installator) .php files. For example I have the file model.php file which is defined in .xml file and this file was successfully installed with the component. After that I create file extras.php and I want to include this file to model.php through
Code:
//model.php
require_once('extras.php');

This is ok and it works but if I try to include to extras.php file directive
Code:
//extras.php
defined( '_JEXEC' ) or die( 'Restricted access' );

The all functionality in the extras don't work because _JEXEC is not defined and program's flow dies;
In such situation I can't use rich functionality of Joomla framework e.g. call JRequest::getVar() or transfer variable between modules through global variables and so on.

So I want to know - what installator does during installation process? Where extra files should be registered in? In the database? (I didn't find such information in database) May be somewhere in Joomla files?
In other words - how I can install component manually (not through installator)?


Top
  E-mail  
 
Posted: Sat Nov 07, 2009 7:49 pm 
Joomla! Explorer
Joomla! Explorer
Offline

Joined: Mon Aug 11, 2008 1:16 am
Posts: 312
again, the problem is with your access. Probably the script that is doing the upgrading needs get to the files via JRoute
instead of direct addressing which is taboo.

I am not enough of a security guru to say whether faking it out by defining _JEXEC in your script is a good idea or not, so i will err on the side of caution an say that the single entry point philosophy should be adhered to at all times.

Maybe if doing it that standard way will not work, you might run the "fake out ' idea past those folks in the security forum. However, i think you just have an implementation issue.


Top
  E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

Quick reply

 



Who is online

Users browsing this forum: ajibanda and 22 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group