Example #1
0
    public function getRuncode(){

        //Get params
        $params = &JComponentHelper::getParams( 'com_jfoxconsole' );

        //load post and put on variables
        $jfoxcode = Jrequest::getVar('code', '', 'post','string', JREQUEST_ALLOWRAW );

        $format = JRequest::getCmd('format', 'html');

        $cols = JRequest::getInt('cols');
        $rows = JRequest::getInt('rows');

        if ($cols == 0) {
            if ($format == 'html') {
            $cols = $params->get('cols_html', 130);
            $rows = $params->get('rows_html', 20);
            } else {
            $cols = $params->get('cols_raw', 130);
            $rows = $params->get('rows_raw', 3);
           }
        }
        

        //load $app for be able to take at least live_site
        $app = JFactory::GetApplication();

        // the core that execute the code and put in one variable
        ob_start();
        eval($jfoxcode);
        $eval_result = ob_get_contents();
        ob_end_clean();

        // Way to abstract errors
        //todo: think a bit better who to do it to show another useful messages to user
        $errormessage   = 'Parse error';
        $pos = strpos($eval_result , $errormessage);

        if ($pos === false OR $params->get('filter_error') == 0) {
			if ($eval_result != ''){
					$jfoxconsoleoutput = $eval_result;
			} else {
					$jfoxconsoleoutput = JTEXT::_('COM_JFOXCONSOLE_NO_RESULT');
			}
        } else {
            $jfoxconsoleoutput = JTEXT::_('COM_JFOXCONSOLE_RUNCODE_HAS_ERROR');
        }


        $result = new stdClass;
        $result->jfoxconsoleoutput = $jfoxconsoleoutput;
        $result->jfoxcode = $jfoxcode;
        $result->cols = $cols;
        $result->rows = $rows;
        
        return $result;
    }
Example #2
0
<?php
/**
 * @version $Id$
 * @package    joomlafox
 * @subpackage plugin
 * @author     Webdesign Engenharia {@link http://www.webdesign.eng.br}
 * @author     Emerson da Rocha Luiz {@link http://www.fititnt.org}
 * @author     Created on 20-Oct-2009
 */

defined('_JEXEC') or die('Access Denied');

//URL
$app = JFactory::GetApplication();
//Todo: revise this part on Joomla 1.6
//$live_site = $app->isAdmin() ? $app->getSiteURL() : JURI::base();
$live_site = $app->isAdmin() ? JURI::base() : JURI::base();

$generalfox = NULL;



$generalfox .= "<div id=\"jfox_general\" style=\"display:none;\" >" .
"<fieldset><legend>What is JFox?</legend>
Version: JFox 0.7.0RC2. <br />
JFox (the new version of JoomlaFox!) is one extension for Firebug on Firefox [jfox_version.xpi], one Joomla! plugin [plg_jfox_version.tar.gz] 
and one optional component [com_jfoxconsole_version.tar.gz] that togeteder help Joomla extension developers to debug yours components, modules, plugins and templates
more easy.<br />
Oficial site: <a href=\"http://www.fititnt.org/joomlafox.html\" target=\"_blank\">http://www.fititnt.org/joomlafox.html</a><br />
Oficial forum: <a href=\"http://forum.fititnt.org/viewforum.php?f=3\" target=\"_blank\">http://forum.fititnt.org/viewforum.php?f=3</a><br />
Developer twitter: <a href=\"http://twitter.com/fititnt\" target=\"_blank\">@fititnt</a>