function adjustNewlines($text)
{
    $text = str_replace("\r\n", "\n", $text);
    // unix mode
    return str_replace("\n", nl(), $text);
    // ff mode
}
function welcome_render_page_late($args)
{
    global $page_has_object;
    if (!$args['edit'] || $page_has_object) {
        return false;
    }
    // we only display the information when there are no other pages in the
    // content directory except the current one
    load_modules('glue');
    $pns = pagenames(array());
    $pns = $pns['#data'];
    if (1 < count($pns)) {
        return false;
    }
    html_add_css(base_url() . 'modules/welcome/welcome-edit.css');
    html_add_js(base_url() . 'modules/welcome/welcome.js');
    body_append('<div id="welcome-msg">' . nl());
    body_append(tab() . '<span id="welcome-first"><img style="float:left; margin:5px 10px 0 5px" src="' . base_url() . 'modules/welcome/gun32.gif">Welcome to HOTGLUE!</span><br>' . nl());
    body_append(tab() . 'Your Content Manipulation System is ready to go!' . nl());
    body_append(tab() . '<p>A short intro before you start:</p>' . nl());
    body_append(tab() . '<span id="cont"><span id="text"><b>1.</b> Right now you are in <u>editing mode</u>. You can use single and double click to access the menus - they will appear next to the mouse pointer.</span>' . nl());
    body_append(tab() . '<span id="text"><b>2.</b> Click on the canvas (white background of the page) to open a menu which will let you create new objects, upload files and embed YouTube and Vimeo videos! Once you made an object click on it to activate its contextual menu.</span>' . nl());
    body_append(tab() . '<span id="text"><b>3.</b> Double-click on the canvas will give you a menu of options to change preferences, show a grid, make new pages, set background picture and more!</span>' . nl());
    body_append(tab() . '<span id="text"><b>4.</b> Remove "' . (SHORT_URLS ? '' : '?') . 'edit" from the address of the page (the URL) to see the "view-only" version. That\'s how your page will look to everyone else!</span>' . nl());
    body_append(tab() . '<span id="text"><b>5.</b> To get back to editing mode add "' . (SHORT_URLS ? '' : '?') . 'edit" to the URL of the page.<br>(for example: ' . base_url() . '<b>' . (SHORT_URLS ? '' : '?') . 'edit</b>)</span></span>' . nl());
    body_append(tab() . '<p>We recommend you to use <a href="http://firefox.com" target="_blank">Mozilla Firefox</a> browser when editing in HOTGLUE. Firefox is a very reliable and modern web-browser, it is our favorite!' . nl());
    body_append(tab() . '<p>You can find more information on how to work with HOTGLUE on our <a href="http://hotglue.me" target="_blank">web-site</a>. Make sure to check out "<a href="http://hotglue.me/what" target="_blank">What is HOTGLUE?</a>" and "<a href="http://hotglue.me/how" target="_blank">How to HOTGLUE?</a>" pages!' . nl());
    body_append(tab() . '<p>Enjoy! <span id="welcome-light">[click this message to make it go away]</span></p>' . nl());
    body_append('</div>' . nl());
    return true;
}
Example #3
0
function message($userID, $string)
{
    global $update;
    $u = new User($userID);
    $update = "<strong>UPDATE:</strong><br />" . nl();
    $update .= ucfirst($u->username) . "'s " . $string;
}
Example #4
0
/**
 *	log a message to file
 *
 *	@param string $level can be error, warn, info or debug
 *	@param string $msg message
 *	@return bool true if successful, false if not
 */
function log_msg($level, $msg)
{
    global $logfile;
    global $loglevels;
    global $request_id;
    // open logfile
    if ($logfile === false) {
        $m = umask(0111);
        // having two processes appending to the same file should
        // work fine (at least on Linux)
        $logfile = @fopen(LOG_FILE, 'ab');
        umask($m);
    }
    if ($logfile === false) {
        return false;
    }
    foreach ($loglevels as $ll) {
        if ($ll == $level) {
            fwrite($logfile, date('Y-m-d H:i:s') . tab() . pad($_SERVER['REMOTE_ADDR'], 15) . tab() . sprintf('%05u', $request_id) . tab() . $level . tab() . $msg . nl());
            fflush($logfile);
            break;
        }
        if ($ll == LOG_LEVEL) {
            break;
        }
    }
    return true;
}
Example #5
0
/**
 *	convert an associative array to a javascript block
 *
 *	@param array $container container array
 *	@return string
 */
function array_to_js($container)
{
    $ret = '<script type="text/javascript">' . nl();
    // sort container by keys
    ksort($container);
    $exists = array();
    foreach ($container as $key => $val) {
        // make sure the keys exist
        $objs = expl('.', $key);
        for ($i = 0; $i < count($objs) - 1; $i++) {
            $obj = implode('.', array_slice($objs, 0, $i + 1));
            if (!in_array($obj, $exists)) {
                if ($i == 0) {
                    $ret .= tab() . 'var ' . $obj . ' = ' . $obj . ' || {};' . nl();
                } else {
                    $ret .= tab() . $obj . ' = ' . $obj . ' || {};' . nl();
                }
                $exists[] = $obj;
            }
        }
        $ret .= tab() . '' . $key . ' = ' . json_encode($val) . ';' . nl();
    }
    $ret .= '</script>' . nl();
    return $ret;
}
function welcome_render_page_late($args)
{
    global $page_has_object;
    if (!$args['edit'] || $page_has_object) {
        return false;
    }
    // we only display the information when there are no other pages in the
    // content directory except the current one
    load_modules('glue');
    $pns = pagenames(array());
    $pns = $pns['#data'];
    if (1 < count($pns)) {
        return false;
    }
    html_add_css(base_url() . 'modules/welcome/welcome-edit.css');
    html_add_js(base_url() . 'modules/welcome/welcome.js');
    body_append('<div id="welcome-msg">' . nl());
    body_append(tab() . '<span id="welcome-first">Welcome to HOTGLUE!</span><br>' . nl());
    body_append(tab() . 'Your Content Manipulation System is ready to go!' . nl());
    body_append(tab() . '<p>A short intro before you start:<br>' . nl());
    body_append(tab() . '&#164; To get back to editing mode in the future, add "' . (SHORT_URLS ? '' : '?') . 'edit" to the address in the address bar (i.e.: ' . base_url() . '<b>' . (SHORT_URLS ? '' : '?') . 'edit</b>)<br>' . nl());
    body_append(tab() . '&#164; In editing mode, you can use single and double click to access the menus.<br>' . nl());
    body_append(tab() . '&#164; Click the page\'s background once to open a menu that lets you create new objects, upload files and embed videos (YouTube and Vimeo).<br>' . nl());
    body_append(tab() . '&#164; Double-click to open a menu that allows you to change preferences, show a grid, make new pages and more.<br>' . nl());
    body_append(tab() . '&#164; Remove "' . (SHORT_URLS ? '' : '?') . 'edit" from the address in the address bar to go to the viewing-only mode of this page.</p>' . nl());
    body_append(tab() . '<p>You can find more ideas on how to use HOTGLUE at the <a href="http://hotglue.me/how_basic" target="_blank">"How-to" section of our website</a>!' . nl());
    body_append(tab() . '<p>Enjoy!<br>' . nl());
    body_append(tab() . '<span id="welcome-light">[This message goes away when you click it]</span></p>' . nl());
    body_append('</div>' . nl());
    return true;
}
/**
 *	controller that shows a textarea for editing either a page's or the global 
 *	user-defined css file
 */
function controller_user_css_stylesheet($args)
{
    if ($args[0][1] == 'stylesheet') {
        // changing page stylesheet
        $page = $args[0][0];
        page_canonical($page);
        if (!page_exists($page)) {
            hotglue_error(404);
        }
    } else {
        // changing global stylesheet
        $page = false;
    }
    default_html(true);
    html_add_js_var('$.glue.page', $page);
    html_add_css(base_url() . 'modules/user_css/user_css.css');
    if (USE_MIN_FILES) {
        html_add_js(base_url() . 'modules/user_css/user_css.min.js');
    } else {
        html_add_js(base_url() . 'modules/user_css/user_css.js');
    }
    $bdy =& body();
    elem_attr($bdy, 'id', 'user_css');
    if ($page === false) {
        body_append('<h1>Global stylesheet</h1>' . nl());
        // try to load css
        $css = @file_get_contents(CONTENT_DIR . '/usercss');
        if ($css === false) {
            $css = '';
        }
    } else {
        body_append('<h1>' . htmlspecialchars($page, ENT_NOQUOTES, 'UTF-8') . ' stylesheet</h1>' . nl());
        load_modules('glue');
        $obj = load_object(array('name' => $page . '.usercss'));
        if ($obj['#error']) {
            $css = '';
        } else {
            $css = $obj['#data']['content'];
        }
    }
    // encoding to html must come before the replacement below
    $css = htmlspecialchars($css, ENT_NOQUOTES, 'UTF-8');
    // replace newline characters by an entity to prevent render_object()
    // from adding some indentation
    $css = str_replace("\r\n", '&#10;', $css);
    $css = str_replace("\n", '&#10;', $css);
    // why not replace tabs as well why we are at it
    $css = str_replace("\t", '&#09;', $css);
    body_append('<textarea id="user_css_text" placeholder="enter css code here">' . $css . '</textarea>' . nl());
    body_append('<br>' . nl());
    body_append('<input id="user_css_save" type="button" value="save">' . nl());
    echo html_finalize();
}
/**
 *	show a site where authenticated users can create new pages
 */
function controller_create_page($args)
{
    page_canonical($args[0][0]);
    $page = $args[0][0];
    if (page_exists($page)) {
        log_msg('debug', 'controller_create_page: page ' . quot($page) . 'already exists, invoking controller_edit');
        controller_edit($args);
        return;
    }
    load_modules('glue');
    default_html(true);
    html_add_css(base_url() . 'css/hotglue_error.css');
    if (USE_MIN_FILES) {
        html_add_js(base_url() . 'js/create_page.min.js');
    } else {
        html_add_js(base_url() . 'js/create_page.js');
    }
    html_add_js_var('$.glue.page', $page);
    html_add_js_var('$.glue.q', SHORT_URLS ? '' : '?');
    $bdy =& body();
    elem_attr($bdy, 'id', 'create_page');
    body_append(tab(1) . '<div id="paper">' . nl());
    body_append(tab(2) . '<div id="wrapper">' . nl());
    body_append(tab(3) . '<div id="content">' . nl());
    body_append(tab(4) . '<div id="left-nav">' . nl());
    body_append(tab(5) . '<img src="' . htmlspecialchars(base_url(), ENT_COMPAT, 'UTF-8') . 'img/hotglue-logo.png" alt="logo">' . nl());
    body_append(tab(4) . '</div>' . nl());
    body_append(tab(4) . '<div id="main">' . nl());
    body_append(tab(5) . '<h1 id="error-title">Page does not exist yet!</h1>' . nl());
    body_append(tab(5) . '<p>' . nl());
    body_append(tab(6) . 'This page does not exist yet!<br>' . nl());
    body_append(tab(6) . 'Would you like to create the page?' . nl());
    body_append(tab(5) . '</p>' . nl());
    body_append(tab(5) . '<form><input id="create_page_btn" type="button" value="Create it!"></form>' . nl());
    body_append(tab(4) . '</div>' . nl());
    body_append(tab(3) . '</div>' . nl());
    body_append(tab(2) . '</div>' . nl());
    body_append(tab(2) . '<div style="position: absolute; left: 200px; top: -10px; z-index: 2;">' . nl());
    body_append(tab(3) . '<img src="' . htmlspecialchars(base_url(), ENT_COMPAT, 'UTF-8') . 'img/hotglue-404.png" alt="404">' . nl());
    body_append(tab(2) . '</div>' . nl());
    body_append(tab(1) . '</div>' . nl());
    echo html_finalize();
}
Example #9
0
	function mkPackage($option, $caller, $pkg)
	{
		global $ff_admpath, $ff_version, $mosConfig_fileperms;

		$id          = $pkg;
		$name        = JRequest::getVar( 'pkg_name', '');
		$title       = JRequest::getVar( 'pkg_title', '');
		$version     = JRequest::getVar( 'pkg_version', '');
		$created     = date('Y-m-d H:i:s');
		$author      = JRequest::getVar( 'pkg_author', '');
		$email       = JRequest::getVar( 'pkg_email', '');
		$url         = JRequest::getVar( 'pkg_url', '');
		$description = JRequest::getVar( 'pkg_description', '');
		$copyright   = JRequest::getVar( 'pkg_copyright', '');

		savePackage($id, $name, $title, $version, $created, $author,
					$email, $url, $description, $copyright);

		$xmlname = $ff_admpath.'/packages/'.$name.'.xml';
		$existed = file_exists($xmlname);
		if ($existed)
			if (!is_writable($xmlname))
				die('XML file is not writable!');

		$file= fopen($xmlname, "w");

		$xml  = '<?xml version="1.0" encoding="utf-8" ?>'.nl().
				'<FacileFormsPackage';
		if ($id != '') $xml .= ' id="'.$id.'"';
                if ($id == '') $xml .= ' id="'.$name.'"';
		$xml .=
				' type="autoincrement" version="'.$ff_version.'">'.nl().
				indent(1).'<name>'.expstring($name).'</name>'.nl().
				indent(1).'<title>'.expstring($title).'</title>'.nl().
				indent(1).'<version>'.expstring($version).'</version>'.nl().
				indent(1).'<creationDate>'.$created.'</creationDate>'.nl().
				indent(1).'<author>'.expstring($author).'</author>'.nl().
				indent(1).'<authorEmail>'.expstring($email).'</authorEmail>'.nl().
				indent(1).'<authorUrl>'.expstring($url).'</authorUrl>'.nl().
				indent(1).'<description>'.expstring($description).'</description>'.nl().
				indent(1).'<copyright>'.expstring($copyright).'</copyright>'.nl();

		if ($id == '')
			$ids = JRequest::getVar( 'scriptsel', array());
		else {
			$ids = array();
			$rows = _ff_select(
				"select id from #__facileforms_scripts ".
				"where package =  '$id' ".
				"order by id"
			);
			if (count($rows)) foreach ($rows as $row) $ids[] = $row->id;
		} // if
		if (count($ids) > 0) {
			$ids = implode(',', $ids);
			$scripts = _ff_select(
				"select * from #__facileforms_scripts where id in ($ids) order by  package, name, id"
			);
			for ($s = 0; $s < count($scripts); $s++) {
				$script = $scripts[$s];
				$xml .= indent(1).'<script id="'.$script->id.'">'.nl();
				if ($script->published != 1)
					$xml .= indent(2).'<published>'.$script->published.'</published>'.nl();
				if ($script->package != '')
					$xml .= indent(2).'<package>'.expstring($script->package).'</package>'.nl();
				$xml .= indent(2).'<name>'.expstring($script->name).'</name>'.nl().
						indent(2).'<title>'.expstring($script->title).'</title>'.nl();
				if ($script->type != 'Untyped')
				   $xml .= indent(2).'<type>'.expstring($script->type).'</type>'.nl();
				$script->description = trim($script->description);
				if ($script->description != '')
					$xml .= indent(2).'<description>'.expstring($script->description).'</description>'.nl();
				$script->code = trim($script->code);
				if ($script->code != '')
					$xml .= indent(2).'<code>'.expstring($script->code).'</code>'.nl();
				$xml .= indent(1).'</script>'.nl();
			} // for
		} // if

		if ($id == '')
			$ids = JRequest::getVar( 'piecesel', array());
		else {
			$ids = array();
			$rows = _ff_select(
				"select id from #__facileforms_pieces ".
				"where package =  '$id' ".
				"order by id"
			);
			if (count($rows)) foreach ($rows as $row) $ids[] = $row->id;
		} // if
		if (count($ids) > 0) {
			$ids = implode(',', $ids);
			$pieces = _ff_select(
				"select * from #__facileforms_pieces where id in ($ids) order by  package, name, id"
			);
			for ($p = 0; $p < count($pieces); $p++) {
				$piece = $pieces[$p];
				$xml .= indent(1).'<piece id="'.$piece->id.'">'.nl();
				if ($piece->published != 1)
				   $xml .= indent(2).'<published>'.$piece->published.'</published>'.nl();
				if ($piece->package != '')
					$xml .= indent(2).'<package>'.expstring($piece->package).'</package>'.nl();
				$xml .= indent(2).'<name>'.expstring($piece->name).'</name>'.nl().
						indent(2).'<title>'.expstring($piece->title).'</title>'.nl();
				if ($piece->type != 'Untyped')
				   $xml .= indent(2).'<type>'.expstring($piece->type).'</type>'.nl();
				$piece->description = trim($piece->description);
				if ($piece->description != '')
					$xml .= indent(2).'<description>'.expstring($piece->description).'</description>'.nl();
				$piece->code = trim($piece->code);
				if ($piece->code != '')
					$xml .= indent(2).'<code>'.expstring($piece->code).'</code>'.nl();
				$xml .= indent(1).'</piece>'.nl();
			} // for
		} // if

		if ($id == '')
			$ids = JRequest::getVar( 'formsel', array());
		else {
			$ids = array();
			$rows = _ff_select(
				"select id from #__facileforms_forms ".
				"where package =  '$id' ".
				"order by id"
			);
			if (count($rows)) foreach ($rows as $row) $ids[] = $row->id;
		} // if
		if (count($ids) > 0) {
			$ids = implode(',', $ids);
			$forms = _ff_select(
				"select * from #__facileforms_forms where id in ($ids) order by  package, ordering, id"
			);
			for ($f = 0; $f < count($forms); $f++) {
				$form = $forms[$f];
				$xml .= indent(1).'<form id="'.$form->id.'">'.nl();
				if ($form->published != 1) $xml .= indent(2).'<published>'.$form->published.'</published>'.nl();
				if ($form->runmode != 0) $xml .= indent(2).'<runmode>'.$form->runmode.'</runmode>'.nl();
				if ($form->package != '')
					$xml .= indent(2).'<package>'.expstring($form->package).'</package>'.nl();
				$xml .=
					indent(2).'<name>'.expstring($form->name).'</name>'.nl().
					indent(2).'<title>'.expstring($form->title).'</title>'.nl();
				if ($form->description != '') $xml .= indent(2).'<description>'.expstring($form->description).'</description>'.nl();
				if ($form->class1 != '') $xml .= indent(2).'<class1>'.expstring($form->class1).'</class1>'.nl();
				if ($form->class2 != '') $xml .= indent(2).'<class2>'.expstring($form->class2).'</class2>'.nl();
				$xml .= indent(2).'<width>'.$form->width.'</width>'.nl();
				if ($form->widthmode != 0) $xml .= indent(2).'<widthmode>'.$form->widthmode.'</widthmode>'.nl();
				$xml .= indent(2).'<height>'.$form->height.'</height>'.nl();
				if ($form->heightmode != 0) $xml .= indent(2).'<heightmode>'.$form->heightmode.'</heightmode>'.nl();
				if ($form->pages    != 1) $xml .= indent(2).'<pages>'.$form->pages.'</pages>'.nl();
				if ($form->emailntf != 1) $xml .= indent(2).'<emailntf>'.$form->emailntf.'</emailntf>'.nl();
				if ($form->emaillog != 1) $xml .= indent(2).'<emaillog>'.$form->emaillog.'</emaillog>'.nl();
				if ($form->emailxml != 0) $xml .= indent(2).'<emailxml>'.$form->emailxml.'</emailxml>'.nl();
				if ($form->emailntf == 2) {
					$form->emailadr = expstring($form->emailadr);
					if ($form->emailadr != '') $xml .= indent(2).'<emailadr>'.$form->emailadr.'</emailadr>'.nl();
				} // if
				if($form->template_code != '')$xml.=indent(2).'<template_code>'.base64_encode($form->template_code).'</template_code>';
				if($form->template_code_processed != '')$xml.=indent(2).'<template_code_processed>'.base64_encode($form->template_code_processed).'</template_code_processed>';
				if($form->template_areas != '')$xml.=indent(2).'<template_areas>'.base64_encode($form->template_areas).'</template_areas>';
				if ($form->dblog != 1) $xml .=  indent(2).'<dblog>'.$form->dblog.'</dblog>'.nl();
				$form->description = trim($form->description);
				if ($form->prevmode != 2) $xml .= indent(2).'<prevmode>'.$form->prevmode.'</prevmode>'.nl();
				if ($form->prevmode != 0 && $form->widthmode != 0 && $form->prevwidth != '')
					$xml .= indent(2).'<prevwidth>'.$form->prevwidth.'</prevwidth>'.nl();
				$this->exportScript(
					'script1',
					'#__facileforms_scripts',
					$form->script1cond,
					$form->script1id,
					$form->script1code,
					2, $xml
				);
				$this->exportScript(
					'script2',
					'#__facileforms_scripts',
					$form->script2cond,
					$form->script2id,
					$form->script2code,
					2, $xml
				);
				$this->exportScript(
					'piece1',
					'#__facileforms_pieces',
					$form->piece1cond,
					$form->piece1id,
					$form->piece1code,
					2, $xml
				);
				$this->exportScript(
					'piece2',
					'#__facileforms_pieces',
					$form->piece2cond,
					$form->piece2id,
					$form->piece2code,
					2, $xml
				);
				$this->exportScript(
					'piece3',
					'#__facileforms_pieces',
					$form->piece3cond,
					$form->piece3id,
					$form->piece3code,
					2, $xml
				);
				$this->exportScript(
					'piece4',
					'#__facileforms_pieces',
					$form->piece4cond,
					$form->piece4id,
					$form->piece4code,
					2, $xml
				);

				$elems = _ff_select(
					"select * from #__facileforms_elements where form=$form->id order by page, ordering, id"
				);
				for ($e = 0; $e < count($elems); $e++) {
					$elem = $elems[$e];
					$xml .= indent(2).'<element id="'.$elem->id.'">'.nl();
					if ($elem->page != 1) $xml .= indent(3).'<page>'.$elem->page.'</page>'.nl();
					if ($elem->published != 1) $xml .= indent(3).'<published>'.$elem->published.'</published>'.nl();
					$xml .= indent(3).'<name>'.expstring($elem->name).'</name>'.nl().
							indent(3).'<title>'.expstring($elem->title).'</title>'.nl();
					if ($elem->type != 'Static Text/HTML') $xml .= indent(3).'<type>'.$elem->type.'</type>'.nl();
					if ($elem->class1 != '') $xml .= indent(3).'<class1>'.expstring($elem->class1).'</class1>'.nl();
					if ($elem->class2 != '') $xml .= indent(3).'<class2>'.expstring($elem->class2).'</class2>'.nl();
					if (isInputElement($elem->type)) {
						if ($elem->logging != 1)
						   $xml .= indent(3).'<logging>'.$elem->logging.'</logging>'.nl();
					} // if
					if (isVisibleElement($elem->type)) {
						if ($elem->posx != NULL) $xml .= indent(3).'<posx>'.$elem->posx.'</posx>'.nl();
						if ($elem->posx != NULL && $elem->posxmode!=0) $xml .= indent(3).'<posxmode>'.$elem->posxmode.'</posxmode>'.nl();
						if ($elem->posy != NULL) $xml .= indent(3).'<posy>'.$elem->posy.'</posy>'.nl();
						if ($elem->posy != NULL && $elem->posymode!=0) $xml .= indent(3).'<posymode>'.$elem->posymode.'</posymode>'.nl();
						if ($elem->width != NULL) $xml .= indent(3).'<width>'.$elem->width.'</width>'.nl();
						if ($elem->width != NULL && $elem->widthmode!=0) $xml .= indent(3).'<widthmode>'.$elem->widthmode.'</widthmode>'.nl();
						if ($elem->height != NULL) $xml .= indent(3).'<height>'.$elem->height.'</height>'.nl();
						if ($elem->height != NULL && $elem->heightmode!=0) $xml .= indent(3).'<heightmode>'.$elem->heightmode.'</heightmode>'.nl();
					} // if
					$xml .= indent(3).'<mailback>'.$elem->mailback.'</mailback>'.nl();
					$xml .= indent(3).'<mailbackfile>'.$elem->mailbackfile.'</mailbackfile>'.nl();
					if ($elem->flag1) $xml .= indent(3).'<flag1>'.$elem->flag1.'</flag1>'.nl();
					if ($elem->flag2) $xml .= indent(3).'<flag2>'.$elem->flag2.'</flag2>'.nl();
					$elem->data1 = expstring($elem->data1);
					if ($elem->data1 != '') $xml .= indent(3).'<data1>'.$elem->data1.'</data1>'.nl();
					$elem->data2 = expstring($elem->data2);
					if ($elem->data2 != '') $xml .= indent(3).'<data2>'.$elem->data2.'</data2>'.nl();
					$elem->data3 = expstring($elem->data3);
					if ($elem->data3 != '') $xml .= indent(3).'<data3>'.$elem->data3.'</data3>'.nl();
					$this->exportScript(
						'script1',
						'#__facileforms_scripts',
						$elem->script1cond,
						$elem->script1id,
						$elem->script1code,
						3, $xml
					);
					if ($elem->script1cond > 0) {
						if ($elem->script1flag1) $xml .= indent(3).'<script1flag1>'.$elem->script1flag1.'</script1flag1>'.nl();
						if ($elem->script1flag2) $xml .= indent(3).'<script1flag2>'.$elem->script1flag2.'</script1flag2>'.nl();
					} // if
					$this->exportScript(
						'script2',
						'#__facileforms_scripts',
						$elem->script2cond,
						$elem->script2id,
						$elem->script2code,
						3, $xml
					);
					if ($elem->script2cond > 0) {
						if ($elem->script2flag1) $xml .= indent(3).'<script2flag1>'.$elem->script2flag1.'</script2flag1>'.nl();
						if ($elem->script2flag2) $xml .= indent(3).'<script2flag2>'.$elem->script2flag2.'</script2flag2>'.nl();
						if ($elem->script2flag3) $xml .= indent(3).'<script2flag3>'.$elem->script2flag3.'</script2flag3>'.nl();
						if ($elem->script2flag4) $xml .= indent(3).'<script2flag4>'.$elem->script2flag4.'</script2flag4>'.nl();
						if ($elem->script2flag5) $xml .= indent(3).'<script2flag5>'.$elem->script2flag5.'</script2flag5>'.nl();
					} // if
					$this->exportScript(
						'script3',
						'#__facileforms_scripts',
						$elem->script3cond,
						$elem->script3id,
						$elem->script3code,
						3, $xml
					);
					if ($elem->script3cond > 0) {
						if ($elem->script3msg != '') $xml .= indent(3).'<script3msg>'.expstring($elem->script3msg).'</script3msg>'.nl();
					} // if
					$xml .= indent(2).'</element>'.nl();
				} // for
				$xml .= indent(1).'</form>'.nl();
			} // for
		} // if

		if ($id == '')
			$ids = JRequest::getVar( 'menusel', array());
		else {
			$ids = array();
			$rows = _ff_select(
				"select id from #__facileforms_compmenus ".
				"where package =  '$id' and parent = 0 ".
				"order by id"
			);
			if (count($rows)) foreach ($rows as $row) $ids[] = $row->id;
		} // if
		if (count($ids) > 0) {
			$ids = implode(',', $ids);
			$menus = _ff_select(
				"select * from #__facileforms_compmenus where id in ($ids) order by  package, ordering, id"
			);
			for ($m = 0; $m < count($menus); $m++) {
				$menu = $menus[$m];
				$xml .= indent(1).'<compmenu id="'.$menu->id.'">'.nl();
				if ($menu->published != 1)
				   $xml .= indent(2).'<published>'.$menu->published.'</published>'.nl();
				$menu->img = trim($menu->img);
				if ($menu->img != '')
					$xml .= indent(2).'<img>'.expstring($menu->img).'</img>'.nl();
				if ($menu->package != '')
					$xml .= indent(2).'<package>'.expstring($menu->package).'</package>'.nl();
				$xml .= indent(2).'<title>'.expstring($menu->title).'</title>'.nl();
				$menu->name = trim($menu->name);
				if ($menu->name != '')
					$xml .= indent(2).'<name>'.expstring($menu->name).'</name>'.nl();
				if ($menu->page != 1 && $menu->page!='')
				   $xml .= indent(2).'<page>'.$menu->page.'</page>'.nl();
				if ($menu->frame != 0)
				   $xml .= indent(2).'<frame>'.$menu->frame.'</frame>'.nl();
				if ($menu->border != 0)
				   $xml .= indent(2).'<border>'.$menu->border.'</border>'.nl();
				$menu->params = trim($menu->params);
				if ($menu->params != '')
					$xml .= indent(2).'<params>'.expstring($menu->params).'</params>'.nl();

				$submenus = _ff_select(
					"select * from #__facileforms_compmenus where parent=$menu->id order by ordering, id"
				);

				for ($s = 0; $s < count($submenus); $s++) {
					$submenu = $submenus[$s];
					$xml .= indent(2).'<compmenu id="'.$submenu->id.'">'.nl();
					if ($submenu->published != 1)
					   $xml .= indent(3).'<published>'.$submenu->published.'</published>'.nl();
					$submenu->img = trim($submenu->img);
					if ($submenu->img != '')
						$xml .= indent(3).'<img>'.expstring($submenu->img).'</img>'.nl();
					if ($menu->package != '')
						$xml .= indent(3).'<package>'.expstring($submenu->package).'</package>'.nl();
					$xml .= indent(3).'<title>'.expstring($submenu->title).'</title>'.nl();
					$submenu->name = trim($submenu->name);
					if ($submenu->name != '')
						$xml .= indent(3).'<name>'.expstring($submenu->name).'</name>'.nl();
					if ($submenu->page != 1 && $submenu->page!='')
					   $xml .= indent(3).'<page>'.$submenu->page.'</page>'.nl();
					if ($submenu->frame != 0)
					   $xml .= indent(3).'<frame>'.$submenu->frame.'</frame>'.nl();
					if ($submenu->border != 0)
					   $xml .= indent(3).'<border>'.$submenu->border.'</border>'.nl();
					$submenu->params = trim($submenu->params);
					if ($submenu->params != '')
						$xml .= indent(3).'<params>'.expstring($submenu->params).'</params>'.nl();
					$xml .= indent(2).'</compmenu>'.nl();
				} // for

				$xml .= indent(1).'</compmenu>'.nl();
			} // for
		} // if

		$xml .= '</FacileFormsPackage>'.nl();
		fwrite($file, $xml);
		fclose($file);

		if (!$existed) {
			$filemode = NULL;
			if (isset($mosConfig_fileperms)) {
				if ($mosConfig_fileperms!='')
					$filemode = octdec($mosConfig_fileperms);
			} else
				$filemode = 0644;
			if (isset($filemode)) @chmod($xmlname, $filemode);
		} // if
		HTML_facileFormsConf::edit($option, $caller, $pkg, $xmlname);
	} // mkPackage
Example #10
0
/**
 *	turn the page into a html string
 *
 *	@param bool &$cache is output cachable (will only modified if $cache is 
 *	true before)
 *	@return string html
 */
function html_finalize(&$cache = false)
{
    global $html;
    // return html5
    $ret = '<!DOCTYPE html>' . nl();
    $ret .= '<html';
    if (@is_array($html['header']['style'])) {
        $ret .= ' style="';
        ksort($html['header']['style']);
        foreach ($html['header']['style'] as $key => $val) {
            $ret .= htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . ': ' . htmlspecialchars($val, ENT_COMPAT, 'UTF-8') . '; ';
        }
        // strip the last space
        $ret = substr($ret, 0, -1);
        $ret .= '"';
    }
    $ret .= '>' . nl();
    $ret .= '<head>' . nl();
    $ret .= '<title>' . htmlspecialchars($html['header']['title'], ENT_NOQUOTES, 'UTF-8') . '</title>' . nl();
    $ret .= '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">' . nl();
    if (@is_array($html['header']['alternate'])) {
        foreach ($html['header']['alternate'] as $e) {
            $ret .= '<link rel="alternate" type="' . htmlspecialchars($e['type'], ENT_COMPAT, 'UTF-8') . '" href="' . htmlspecialchars($e['url'], ENT_COMPAT, 'UTF-8') . '" title="' . htmlspecialchars($e['title'], ENT_COMPAT, 'UTF-8') . '">' . nl();
        }
    }
    if (!empty($html['header']['favicon'])) {
        $ret .= '<link rel="shortcut icon" href="' . htmlspecialchars($html['header']['favicon'], ENT_COMPAT, 'UTF-8') . '">' . nl();
    }
    if (@is_array($html['header']['css'])) {
        _array_sort_by_prio($html['header']['css']);
        // removed the removal of duplicates here as two different media might point to the same url
        //array_unique_element($html['header']['css'], 'url');
        foreach ($html['header']['css'] as $e) {
            $ret .= '<link rel="stylesheet" type="text/css" href="' . htmlspecialchars($e['url'], ENT_COMPAT, 'UTF-8') . '"';
            if (!empty($e['media'])) {
                $ret .= ' media="' . htmlspecialchars($e['media'], ENT_COMPAT, 'UTF-8') . '"';
            }
            $ret .= '>' . nl();
        }
    }
    if (@is_array($html['header']['css_inline'])) {
        _array_sort_by_prio($html['header']['css_inline']);
        if (0 < count($html['header']['css_inline'])) {
            $ret .= '<style type="text/css">' . nl();
        }
        foreach ($html['header']['css_inline'] as $c) {
            $rule = $c['rule'];
            // if the rule ends with a newline character, remove it
            if (substr($rule, -1) == "\n") {
                $rule = substr($rule, 0, -1);
            }
            // move rule in by one tab
            $rule = str_replace("\n", "\n\t", $rule);
            $ret .= tab() . $rule . nl();
        }
        if (0 < count($html['header']['css_inline'])) {
            $ret .= '</style>' . nl();
        }
    }
    if (@is_array($html['header']['js'])) {
        _array_sort_by_prio($html['header']['js']);
        array_unique_element($html['header']['js'], 'url');
        foreach ($html['header']['js'] as $e) {
            $ret .= '<script type="text/javascript" src="' . htmlspecialchars($e['url'], ENT_COMPAT, 'UTF-8') . '"></script>' . nl();
        }
    }
    if (@is_array($html['header']['js_var'])) {
        $ret .= array_to_js($html['header']['js_var']);
    }
    if (@is_array($html['header']['js_inline'])) {
        _array_sort_by_prio($html['header']['js_inline']);
        foreach ($html['header']['js_inline'] as $c) {
            if (!empty($c['reason'])) {
                $ret .= '<!-- ' . $c['reason'] . ' -->' . nl();
                $ret .= '<script type="text/javascript">' . nl();
                // if the code ends with a newline character, remove it
                if (substr($c['code'], -1) == "\n") {
                    $c['code'] = substr($c['code'], 0, -1);
                }
                // move code in by one tab
                $c = str_replace("\n", "\n\t", $c);
                $ret .= tab() . $c['code'] . nl();
                $ret .= '</script>' . nl();
            }
        }
    }
    $ret .= '</head>' . nl();
    $ret .= elem_finalize($html['body']);
    $ret .= '</html>';
    // pass caching information up if requested
    if ($cache) {
        if (!$html['cache']) {
            $cache = false;
        }
    }
    return $ret;
}
	function expcsv(array $ids)
	{
                global $ff_config;

                $csvdelimiter = stripslashes($ff_config->csvdelimiter);
                $csvquote = stripslashes($ff_config->csvquote);
                $cellnewline = $ff_config->cellnewline == 0 ? "\n" : "\\n";

		$fields = array();
		$lines = array();
		$ids = implode(',', $ids);
		$this->db->setQuery(
			"select * from #__facileforms_records where id in ($ids) order by submitted Desc"
		);
		$recs = $this->db->loadObjectList();
		$recsSize = count($recs);
		for($r = 0; $r < $recsSize; $r++) {

                        $rec = $recs[$r];

			$lineNum = count($lines);

			$fields['ZZZ_A_ID'] = true;
			$fields['ZZZ_B_SUBMITTED'] = true;
			$fields['ZZZ_C_USER_ID'] = true;
			$fields['ZZZ_D_USERNAME'] = true;
			$fields['ZZZ_E_USER_FULL_NAME'] = true;
			$fields['ZZZ_F_TITLE'] = true;
			$fields['ZZZ_G_IP'] = true;
			$fields['ZZZ_H_BROWSER'] = true;
			$fields['ZZZ_I_OPSYS'] = true;
			$fields['ZZZ_J_TRANSACTION_ID'] = true;
			$fields['ZZZ_K_DATE'] = true;
			$fields['ZZZ_L_TEST_ACCOUNT'] = true;
			$fields['ZZZ_M_DOWNLOAD_TRIES'] = true;

			$lines[$lineNum]['ZZZ_A_ID'][] = $rec->id;
			$lines[$lineNum]['ZZZ_B_SUBMITTED'][] = $rec->submitted;
			$lines[$lineNum]['ZZZ_C_USER_ID'][] = $rec->user_id;
			$lines[$lineNum]['ZZZ_D_USERNAME'][] = $rec->username;
			$lines[$lineNum]['ZZZ_E_USER_FULL_NAME'][] = $rec->user_full_name;
			$lines[$lineNum]['ZZZ_F_TITLE'][] = $rec->title;
			$lines[$lineNum]['ZZZ_G_IP'][] = $rec->ip;
			$lines[$lineNum]['ZZZ_H_BROWSER'][] = $rec->browser;
			$lines[$lineNum]['ZZZ_I_OPSYS'][] = $rec->opsys;
			$lines[$lineNum]['ZZZ_J_TRANSACTION_ID'][] = $rec->paypal_tx_id;
			$lines[$lineNum]['ZZZ_K_DATE'][] = $rec->paypal_payment_date;
			$lines[$lineNum]['ZZZ_L_TEST_ACCOUNT'][] = $rec->paypal_testaccount;
			$lines[$lineNum]['ZZZ_M_DOWNLOAD_TRIES'][] = $rec->paypal_download_tries;

			$rec = $recs[$r];
			$this->db->setQuery(
				"select Distinct * from #__facileforms_subrecords where record = $rec->id order by id"
			);
			$subs = $this->db->loadObjectList();
			$subsSize = count($subs);
			for($s = 0; $s < $subsSize; $s++) {
				$sub = $subs[$s];
				if($sub->name != 'bfFakeName' && $sub->name != 'bfFakeName2' && $sub->name != 'bfFakeName3' && $sub->name != 'bfFakeName4'){
					if(!isset($fields[strtoupper($sub->name)]))
					{
						$fields[strtoupper($sub->name)] = true;
					}
					$lines[$lineNum][strtoupper($sub->name)][] = $sub->value;
				}
			}
		}

		$head = '';
		ksort($fields);
		$lineLength = count($lines);
		foreach($fields As $fieldName => $null)
		{
			$head .= $csvquote.$fieldName.$csvquote.$csvdelimiter;
			for($i = 0; $i < $lineLength;$i++)
			{
				if(!isset($lines[$i][$fieldName]))
				{
					$lines[$i][$fieldName] = array();
				}
			}
		}

		$head = substr($head,0,strlen($head)-1) . nl();

		$out = '';
		for($i = 0; $i < $lineLength;$i++)
		{
			ksort($lines[$i]);
			foreach($lines[$i] As $line){
				$out .= $csvquote.str_replace($csvquote,$csvquote.$csvquote,str_replace("\n",$cellnewline,str_replace("\r","",implode('|',$line)))).$csvquote.$csvdelimiter;
			}
			$out = substr($out,0,strlen($out)-1);
			$out .= nl();
		}

		$csvname = JPATH_SITE.'/components/com_breezingforms/exports/ffexport-'.date('YmdHis').'.csv';
		JFile::makeSafe($csvname);
		if (!JFile::write($csvname,$head.$out)) {
			echo "<script> alert('".addslashes(BFText::_('COM_BREEZINGFORMS_RECORDS_XMLNORWRTBL'))."'); window.history.go(-1);</script>\n";
			exit();
		} // if

                $this->db->setQuery(
			"update #__facileforms_records set exported=1 where id in ($ids)"
		);
                $this->db->query();

		/*
		$data = JFile::read($csvname);
		$files[] = array('name' => basename($csvname), 'data' => $data);

		$zip = JArchive::getAdapter('zip');
		$path = JPATH_SITE.'/components/com_breezingforms/exports/ffexport-csv-'.date('YmdHis').'.zip';
		$zip->create($path, $files);
		JFile::delete($csvname);
		*/
		@ob_end_clean();
		$_size = filesize($csvname);
		$_name = basename($csvname);
		@ini_set("zlib.output_compression", "Off");

                Header("Content-Type: text/comma-separated-values; charset=utf-8");
                Header("Content-Disposition: attachment;filename=\"$_name\"");
                Header("Content-Transfer-Encoding: 8bit");

		header("Pragma: public");
		header("Expires: 0");
		header("Cache-Control: private");
		//header("Content-Type: application/octet-stream");
		//header("Content-Disposition: attachment; filename=$_name");
		//header("Accept-Ranges: bytes");
		//header("Content-Length: $_size");
                ob_start();
		readfile($csvname);
                $c = ob_get_contents();
                ob_end_clean();
                if(function_exists('mb_convert_encoding')){
                    echo chr(255).chr(254).mb_convert_encoding( $c, 'UTF-16LE', 'UTF-8');
                } else {
                    echo $c;
                }
		exit;
	}
/**
 *	controller that shows a textarea for editing either a page's or the global 
 *	user-defined code files
 */
function controller_user_code_stylesheet($args)
{
    if ($args[0][1] == 'code') {
        // changing page code
        $page = $args[0][0];
        page_canonical($page);
        if (!page_exists($page)) {
            hotglue_error(404);
        }
    } else {
        // changing global code
        $page = false;
    }
    default_html(true);
    html_add_js_var('$.glue.page', $page);
    html_add_css(base_url() . 'modules/user_code/user_code.css');
    if (USE_MIN_FILES) {
        html_add_js(base_url() . 'modules/user_code/user_code.min.js');
    } else {
        html_add_js(base_url() . 'modules/user_code/user_code.js');
    }
    $bdy =& body();
    // create array with names of code elements
    $code = array('head' => '', 'body' => '');
    elem_attr($bdy, 'id', 'user_code');
    if ($page === false) {
        body_append('<h1>Global code</h1>' . nl());
        // try to load code
        foreach ($code as $x => $v) {
            $code[$x] = @file_get_contents(CONTENT_DIR . '/user' . $x);
            if ($code[$x] === false) {
                $code[$x] = '';
            }
        }
    } else {
        body_append('<h1>"' . htmlspecialchars(substr($page, 0, strpos($page, '.')), ENT_NOQUOTES, 'UTF-8') . '" page code</h1>' . nl());
        load_modules('glue');
        foreach ($code as $x => $v) {
            $obj = load_object(array('name' => $page . '.user' . $x));
            if ($obj['#error']) {
                $code[$x] = '';
            } else {
                $code[$x] = $obj['#data']['content'];
            }
        }
    }
    foreach ($code as $k => $v) {
        // encoding to html must come before the replacement below
        $v = htmlspecialchars($v, ENT_NOQUOTES, 'UTF-8');
        // replace newline characters by an entity to prevent render_object()
        // from adding some indentation
        $v = str_replace("\r\n", '&#10;', $v);
        $v = str_replace("\n", '&#10;', $v);
        // why not replace tabs as well why we are at it
        $v = str_replace("\t", '&#09;', $v);
        $code[$k] = $v;
    }
    body_append('<div id=\'text\'>add your custom code to &lt;head&gt; and &lt;body&gt; sections of this ' . ($page ? 'page.' : 'site.') . nl());
    body_append('<br>' . nl());
    body_append('be cautious - errors in the code below may render the whole ' . ($page ? 'page' : 'site') . ' unusable.</div>' . nl());
    body_append('<br>' . nl());
    body_append('<div id=\'fake_tags\'>&lt;head&gt;</div>' . nl());
    body_append('<textarea id="user_head_text" placeholder="enter code here">' . $code['head'] . '</textarea>' . nl());
    body_append('<br>' . nl());
    body_append('<div id=\'fake_tags\'>&lt;/head&gt;<br>' . nl());
    body_append('&lt;body&gt;</div>' . nl());
    body_append('<textarea id="user_body_text" placeholder="enter code here">' . $code['body'] . '</textarea>' . nl());
    body_append('<div id=\'fake_tags\'>&lt;/body&gt;</div><br>' . nl());
    body_append('<input id="user_code_save" type="button" value="save">' . nl());
    echo html_finalize();
}
Example #13
0
        // Get the user specific values from the Options_users table
        $val = Options::userGet($userId, $option);
        $label = camelcase2space($option);
        echo '<div class="control-group">' . nl();
        echo '	<label class="control-label" for="' . $option . '">' . $label . '</label>' . nl();
        echo '	<div class="controls">' . nl();
        if ($type == 'input') {
            echo '<input type="text" class="input-xlarge" id="' . $option . '" name="' . $option . '" value="' . $val . '">' . nl();
        }
        if ($type == 'textarea') {
            echo '<textarea class="textarea input-xxlarge" id="' . $option . '" name="' . $option . '">' . $val . '</textarea>' . nl();
        }
        if ($type == 'bool') {
            echo bool_select($val, $option);
        }
        if ($type == 'date') {
            echo mdy($val, $option, 'd m y');
        }
        echo "</div></div>" . nl();
    }
}
?>
		
<!-- Finish it off with the save button -->	
			<div class="controls">
				<input type="submit" name='action' class="btn btn-primary btn-large" value="Save Changes">
			</div>
		</form>
	</div>
</div>
Example #14
0
system($command);
nl();


$command = $tempDir . '/phd/pear/phd -g \'phpdotnet\phd\Highlighter_GeSHi\' --xinclude -f zfpackage -d '
    . $tempDir . '/manual2.full.xml -o ' . $tempDir . '/manual-html';
colorPrint('Running: ' . $command, 'green');
nl();
system($command);
nl();

colorPrint('[DONE]', 'green');
nl();

colorPrint('HTML Manual located in ' . $tempDir . '/manual-html/zf-package-chunked-xhtml/manual.html', 'green');
nl();

/** FUNCTIONS **/

function colorPrint($message, $color) {
    static $isColor = null;
    if ($isColor === null) {
        $isColor = (function_exists('posix_isatty'));
    }
    
    list($prefix, $postfix) = array('', '');
    
    if ($isColor) {
        switch ($color) {
            case 'green':
                list($prefix, $postfix) = array("\033[32m", "\033[37m");
    function submit()
    {
        global $database, $ff_config, $ff_comsite, $ff_mossite, $ff_otherparams;
        // CONTENTBUILDER BEGIN
        $cbRecordId = 0;
        $cbEmailNotifications = false;
        $cbEmailUpdateNotifications = false;
        $cbResult = $this->cbCheckPermissions();
        if ($cbResult['data'] !== null && $cbResult['data']['email_notifications']) {
            if (!JRequest::getInt('cb_record_id', 0)) {
                $cbEmailNotifications = true;
            } else {
                $cbEmailNotifications = false;
            }
        }
        if ($cbResult['data'] !== null && $cbResult['data']['email_update_notifications']) {
            if (JRequest::getInt('cb_record_id', 0)) {
                $cbEmailUpdateNotifications = true;
            } else {
                $cbEmailUpdateNotifications = false;
            }
        }
        if ($cbResult['data'] === null) {
            $cbEmailNotifications = true;
            $cbEmailUpdateNotifications = true;
        }
        // CONTENTBUILDER END
        $database = JFactory::getDBO();
        if (!$this->okrun) {
            return;
        }
        // currently only available in classic mode
        if (trim($this->formrow->template_code_processed) == '') {
            set_error_handler('_ff_errorHandler');
        }
        ob_start();
        $this->record_id = '';
        $this->status = _FF_STATUS_OK;
        $this->message = '';
        $this->sendNotificationAfterPayment = false;
        // handle Begin Submit piece
        $halt = false;
        $this->collectSubmitdata($cbResult);
        if (!$halt) {
            require_once JPATH_SITE . '/administrator/components/com_breezingforms/libraries/Zend/Json/Decoder.php';
            require_once JPATH_SITE . '/administrator/components/com_breezingforms/libraries/Zend/Json/Encoder.php';
            require_once JPATH_SITE . '/administrator/components/com_breezingforms/libraries/crosstec/functions/helpers.php';
            $dataObject = Zend_Json::decode(base64_decode($this->formrow->template_code));
            $rootMdata = $dataObject['properties'];
            if (JRequest::getVar('ff_applic', '') != 'mod_facileforms' && JRequest::getInt('ff_frame', 0) != 1 && bf_is_mobile()) {
                $is_device = true;
                $this->isMobile = isset($rootMdata['mobileEnabled']) && isset($rootMdata['forceMobile']) && $rootMdata['mobileEnabled'] && $rootMdata['forceMobile'] ? true : (isset($rootMdata['mobileEnabled']) && isset($rootMdata['forceMobile']) && $rootMdata['mobileEnabled'] && JFactory::getSession()->get('com_breezingforms.mobile', false) ? true : false);
            } else {
                $this->isMobile = false;
            }
            // transforming recaptcha into captcha due to compatibility on mobiles
            if ($this->isMobile && trim($this->formrow->template_code_processed) == 'QuickMode') {
                for ($i = 0; $i < $this->rowcount; $i++) {
                    $row = $this->rows[$i];
                    if ($row->type == "ReCaptcha") {
                        $this->rows[$i]->type = 'Captcha';
                        break;
                    }
                }
            }
            for ($i = 0; $i < $this->rowcount; $i++) {
                $row = $this->rows[$i];
                if ($row->type == "Captcha") {
                    require_once JPATH_SITE . '/components/com_breezingforms/images/captcha/securimage.php';
                    $securimage = new Securimage();
                    if (!$securimage->check(JRequest::getVar('bfCaptchaEntry', ''))) {
                        $halt = true;
                        $this->status = _FF_STATUS_CAPTCHA_FAILED;
                        exit;
                    }
                    break;
                } else {
                    if ($row->type == "ReCaptcha") {
                        if (!JFactory::getSession()->get('bfrecapsuccess', false)) {
                            $halt = true;
                            $this->status = _FF_STATUS_CAPTCHA_FAILED;
                            exit;
                        }
                        JFactory::getSession()->set('bfrecapsuccess', false);
                        break;
                    }
                }
            }
            require_once JPATH_SITE . '/administrator/components/com_breezingforms/libraries/Zend/Json/Decoder.php';
            require_once JPATH_SITE . '/administrator/components/com_breezingforms/libraries/Zend/Json/Encoder.php';
            $areas = Zend_Json::decode($this->formrow->template_areas);
            if (is_array($areas)) {
                switch (JRequest::getVar('ff_payment_method', '')) {
                    case 'PayPal':
                    case 'Sofortueberweisung':
                        foreach ($areas as $area) {
                            foreach ($area['elements'] as $element) {
                                if ($element['internalType'] == 'bfPayPal' || $element['internalType'] == 'bfSofortueberweisung') {
                                    $options = $element['options'];
                                    if (isset($options['sendNotificationAfterPayment']) && $options['sendNotificationAfterPayment']) {
                                        $this->sendNotificationAfterPayment = true;
                                    }
                                }
                            }
                        }
                }
            }
        }
        if (!$halt) {
            $code = '';
            switch ($this->formrow->piece3cond) {
                case 1:
                    // library
                    $database->setQuery("select name, code from #__facileforms_pieces " . "where id=" . $this->formrow->piece3id . " and published=1 ");
                    $rows = $database->loadObjectList();
                    if (count($rows)) {
                        echo $this->execPiece($rows[0]->code, BFText::_('COM_BREEZINGFORMS_PROCESS_BSPIECE') . " " . $rows[0]->name, 'p', $this->formrow->piece3id, null);
                    }
                    break;
                case 2:
                    // custom code
                    echo $this->execPiece($this->formrow->piece3code, BFText::_('COM_BREEZINGFORMS_PROCESS_BSPIECEC'), 'f', $this->form, 3);
                    break;
                default:
                    break;
            }
            // switch
            if ($this->bury()) {
                return;
            }
            if ($this->status == _FF_STATUS_OK) {
                if (!$this->formrow->published) {
                    $this->status = _FF_STATUS_UNPUBLISHED;
                } else {
                    if ($this->status == _FF_STATUS_OK) {
                        if ($this->formrow->dblog > 0) {
                            $cbRecordId = $this->logToDatabase($cbResult);
                        }
                        if ($this->status == _FF_STATUS_OK) {
                            if ($this->formrow->emailntf > 0 && ($cbEmailNotifications || $cbEmailUpdateNotifications)) {
                                // CONTENTBUILDER
                                $this->sendEmailNotification();
                            }
                            if ($this->formrow->mb_emailntf > 0 && ($cbEmailNotifications || $cbEmailUpdateNotifications)) {
                                // CONTENTBUILDER
                                $this->sendMailbackNotification();
                            }
                            // DROPBOX
                            if ($this->formrow->dropbox_submission_enabled) {
                                if ($this->formrow->dropbox_email && $this->formrow->dropbox_password) {
                                    if (!class_exists('DropboxUploader')) {
                                        require_once JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_breezingforms' . DS . 'libraries' . DS . 'dropbox' . DS . 'dropbox.php';
                                    }
                                    try {
                                        $dropbox = new DropboxUploader($this->formrow->dropbox_email, $this->formrow->dropbox_password);
                                        if ($this->formrow->dropbox_email && $this->formrow->dropbox_password) {
                                            $dropbox_types = explode(',', $this->formrow->dropbox_submission_types);
                                            foreach ($dropbox_types as $dropbox_type) {
                                                $dropbox_file = '';
                                                switch ($dropbox_type) {
                                                    case 'pdf':
                                                        $dropbox_file = $this->exppdf();
                                                        break;
                                                    case 'csv':
                                                        $dropbox_file = $this->expcsv();
                                                        break;
                                                    case 'xml':
                                                        $dropbox_file = $this->expxml();
                                                        break;
                                                }
                                                if ($dropbox_file != '') {
                                                    $dropbox->upload($dropbox_file, '/' . ($this->formrow->dropbox_folder != '' ? $this->formrow->dropbox_folder : $this->formrow->name));
                                                }
                                            }
                                        }
                                    } catch (Exception $e) {
                                    }
                                }
                            }
                            $this->sendMailChimpNotification();
                            $this->sendSalesforceNotification();
                            JPluginHelper::importPlugin('breezingforms_addons');
                            $dispatcher = JDispatcher::getInstance();
                            $dispatcher->trigger('onPropertiesExecute', array($this));
                            $tickets = JFactory::getSession()->get('bfFlashUploadTickets', array());
                            mt_srand();
                            if (isset($tickets[JRequest::getVar('bfFlashUploadTicket', mt_rand(0, mt_getrandmax()))])) {
                                unset($tickets[JRequest::getVar('bfFlashUploadTicket')]);
                                JFactory::getSession()->set('bfFlashUploadTickets', $tickets);
                            }
                        }
                    }
                    // if
                }
                // if
            }
            // if
            // handle End Submit piece
            JFactory::getDbo()->setQuery("SELECT MAX(id) FROM #__facileforms_records");
            $lastid = JFactory::getDbo()->loadResult();
            $_SESSION['virtuemart_bf_id'] = $lastid;
            $session = JFactory::getSession();
            $session->set('virtuemart_bf_id', $lastid);
            $code = '';
            switch ($this->formrow->piece4cond) {
                case 1:
                    // library
                    $database->setQuery("select name, code from #__facileforms_pieces " . "where id=" . $this->formrow->piece4id . " and published=1 ");
                    $rows = $database->loadObjectList();
                    if (count($rows)) {
                        echo $this->execPiece($rows[0]->code, BFText::_('COM_BREEZINGFORMS_PROCESS_ESPIECE') . " " . $rows[0]->name, 'p', $this->formrow->piece4id, null);
                    }
                    break;
                case 2:
                    // custom code
                    echo $this->execPiece($this->formrow->piece4code, BFText::_('COM_BREEZINGFORMS_PROCESS_ESPIECEC'), 'f', $this->form, 3);
                    break;
                default:
                    break;
            }
            // switch
            if ($this->bury()) {
                return;
            }
        }
        switch ($this->status) {
            case _FF_STATUS_OK:
                $message = BFText::_('COM_BREEZINGFORMS_PROCESS_SUBMITSUCCESS');
                break;
            case _FF_STATUS_UNPUBLISHED:
                $message = BFText::_('COM_BREEZINGFORMS_PROCESS_UNPUBLISHED');
                break;
            case _FF_STATUS_SAVERECORD_FAILED:
                $message = BFText::_('COM_BREEZINGFORMS_PROCESS_SAVERECFAILED');
                break;
            case _FF_STATUS_SAVESUBRECORD_FAILED:
                $message = BFText::_('COM_BREEZINGFORMS_PROCESS_SAVESUBFAILED');
                break;
            case _FF_STATUS_UPLOAD_FAILED:
                $message = BFText::_('COM_BREEZINGFORMS_PROCESS_UPLOADFAILED');
                break;
            case _FF_STATUS_SENDMAIL_FAILED:
                $message = BFText::_('COM_BREEZINGFORMS_PROCESS_SENDMAILFAILED');
                break;
            case _FF_STATUS_ATTACHMENT_FAILED:
                $message = BFText::_('COM_BREEZINGFORMS_PROCESS_ATTACHMTFAILED');
                break;
            case _FF_STATUS_CAPTCHA_FAILED:
                $message = BFText::_('COM_BREEZINGFORMS_CAPTCHA_ENTRY_FAILED');
                break;
            case _FF_STATUS_FILE_EXTENSION_NOT_ALLOWED:
                $message = BFText::_('COM_BREEZINGFORMS_FILE_EXTENSION_NOT_ALLOWED');
                break;
            default:
                $message = '';
                // custom piece status and message
                break;
        }
        // switch
        // built in PayPal action
        $paymentAction = false;
        if ($this->formrow->template_code != '') {
            require_once JPATH_SITE . '/administrator/components/com_breezingforms/libraries/Zend/Json/Decoder.php';
            require_once JPATH_SITE . '/administrator/components/com_breezingforms/libraries/Zend/Json/Encoder.php';
            $areas = Zend_Json::decode($this->formrow->template_areas);
            if (is_array($areas)) {
                jimport('joomla.version');
                $version = new JVersion();
                $j15 = true;
                if (version_compare($version->getShortVersion(), '1.6', '>=')) {
                    $j15 = false;
                }
                $paymentAction = true;
                switch (JRequest::getVar('ff_payment_method', '')) {
                    case 'PayPal':
                        foreach ($areas as $area) {
                            foreach ($area['elements'] as $element) {
                                if ($element['internalType'] == 'bfPayPal') {
                                    $options = $element['options'];
                                    $business = $options['business'];
                                    $paypal = 'https://www.paypal.com';
                                    if ($options['testaccount']) {
                                        $paypal = 'https://www.sandbox.paypal.com';
                                        $business = $options['testBusiness'];
                                    }
                                    $returnurl = htmlentities(JURI::root() . "index.php?option=com_breezingforms&confirmPayPal=true&form_id=" . $this->form . "&record_id=" . $this->record_id);
                                    $cancelurl = htmlentities(JURI::root() . "index.php?msg=" . BFText::_('Transaction Cancelled'));
                                    $html = '';
                                    if (!$this->inline) {
                                        $html .= '<html><head></head><body>';
                                    }
                                    JHTML::_('behavior.modal');
                                    $ppselect = JRequest::getVar('ff_nm_bfPaymentSelect', array());
                                    if (count($ppselect) != 0) {
                                        $ppselected = explode('|', $ppselect[0]);
                                        if (count($ppselected) == 4) {
                                            $options['itemname'] = htmlentities($ppselected[0], ENT_QUOTES, 'UTF-8');
                                            $options['itemnumber'] = htmlentities($ppselected[1], ENT_QUOTES, 'UTF-8');
                                            $options['amount'] = htmlentities($ppselected[2], ENT_QUOTES, 'UTF-8');
                                            $options['tax'] = htmlentities($ppselected[3], ENT_QUOTES, 'UTF-8');
                                        }
                                    }
                                    // keeping this for compat reasons
                                    $ppselect = JRequest::getVar('ff_nm_PayPalSelect', array());
                                    if (count($ppselect) != 0) {
                                        $ppselected = explode('|', $ppselect[0]);
                                        if (count($ppselected) == 4) {
                                            $options['itemname'] = htmlentities($ppselected[0], ENT_QUOTES, 'UTF-8');
                                            $options['itemnumber'] = htmlentities($ppselected[1], ENT_QUOTES, 'UTF-8');
                                            $options['amount'] = htmlentities($ppselected[2], ENT_QUOTES, 'UTF-8');
                                            $options['tax'] = htmlentities($ppselected[3], ENT_QUOTES, 'UTF-8');
                                        }
                                    }
                                    // compat end
                                    $html .= "<form name=\"ff_submitform\" action=\"" . $paypal . "/cgi-bin/webscr\" method=\"post\">";
                                    $html .= "<input type=\"hidden\" name=\"cmd\" value=\"_xclick\"/>";
                                    $html .= "<input type=\"hidden\" name=\"business\" value=\"" . $business . "\"/>";
                                    $html .= "<input type=\"hidden\" name=\"item_name\" value=\"" . $options['itemname'] . "\"/>";
                                    $html .= "<input type=\"hidden\" name=\"item_number\" value=\"" . $options['itemnumber'] . "\"/>";
                                    $html .= "<input type=\"hidden\" name=\"amount\" value=\"" . $options['amount'] . "\"/>";
                                    $html .= "<input type=\"hidden\" name=\"tax\" value=\"" . $options['tax'] . "\"/>";
                                    $html .= "<input type=\"hidden\" name=\"no_shipping\" value=\"1\"/>";
                                    $html .= "<input type=\"hidden\" name=\"no_note\" value=\"1\"/>";
                                    if ($options['useIpn']) {
                                        $html .= "<input type=\"hidden\" name=\"notify_url\" value=\"" . htmlentities(JURI::root() . "index.php?option=com_breezingforms&confirmPayPalIpn=true&raw=true&form_id=" . $this->form . "&record_id=" . $this->record_id) . "\"/>";
                                        if ($options['testaccount']) {
                                            $html .= "<input type=\"hidden\" name=\"test_ipn\" value=\"1\"/>";
                                        }
                                    } else {
                                        $html .= "<input type=\"hidden\" name=\"notify_url\" value=\"" . $returnurl . "\"/>";
                                    }
                                    $html .= "<input type=\"hidden\" name=\"return\" value=\"" . $returnurl . "\"/>";
                                    $html .= "<input type=\"hidden\" name=\"cancel_return\" value=\"" . $cancelurl . "\"/>";
                                    $html .= "<input type=\"hidden\" name=\"rm\" value=\"2\"/>";
                                    $html .= "<input type=\"hidden\" name=\"lc\" value=\"" . $options['locale'] . "\"/>";
                                    //$html .= "<input type=\"hidden\" name=\"pal\" value=\"D6MXR7SEX68LU\"/>";
                                    $html .= "<input type=\"hidden\" name=\"currency_code\" value=\"" . strtoupper($options['currencyCode']) . "\"/>";
                                    if (!$this->inline) {
                                        $html .= "</form></body></html>";
                                    }
                                    // TODO: let the user decide to use modal or simple alert
                                    if ($j15) {
                                        $html .= '<script type="text/javascript">' . nl() . indentc(1) . '<!--' . nl() . indentc(2) . '

										    SqueezeBox.initialize({});

										    SqueezeBox.loadModal = function(modalUrl,handler,x,y) {
										    		this.initialize();
										      		var options = $merge(options || {}, Json.evaluate("{handler: \'" + handler + "\', size: {x: " + x +", y: " + y + "}}"));
													this.setOptions(this.presets, options);
													this.assignOptions();
													this.setContent(handler,modalUrl);
										   	};

										    SqueezeBox.loadModal("' . JURI::root() . 'index.php?raw=true&option=com_breezingforms&showPayPalConnectMsg=true","iframe",300,100);

										 	

										' . nl() . indentc(1) . '// -->' . nl() . '</script>' . nl();
                                    }
                                    $html .= '<script type="text/javascript"><!--' . nl() . 'document.ff_submitform.submit();' . nl() . '//--></script>';
                                    echo $html;
                                    break;
                                }
                            }
                        }
                        break;
                    case 'Sofortueberweisung':
                        foreach ($areas as $area) {
                            foreach ($area['elements'] as $element) {
                                if ($element['internalType'] == 'bfSofortueberweisung') {
                                    $html = '';
                                    if (!$this->inline) {
                                        $html .= '<html><head></head><body>';
                                    }
                                    JHTML::_('behavior.modal');
                                    $options = $element['options'];
                                    $ppselect = JRequest::getVar('ff_nm_bfPaymentSelect', array());
                                    if (count($ppselect) != 0) {
                                        $ppselected = explode('|', $ppselect[0]);
                                        if (count($ppselected) == 4) {
                                            $options['reason_1'] = htmlentities($ppselected[0], ENT_QUOTES, 'UTF-8');
                                            $options['reason_2'] = htmlentities($ppselected[1], ENT_QUOTES, 'UTF-8');
                                            $options['amount'] = htmlentities($ppselected[2], ENT_QUOTES, 'UTF-8');
                                            if ($ppselected[3] != '' && intval($ppselected[3]) > 0) {
                                                $options['amount'] = '' . doubleval($options['amount']) + doubleval($ppselected[3]);
                                            }
                                        }
                                    }
                                    $options['amount'] = str_replace('.', ',', $options['amount']);
                                    $hash = '';
                                    if (isset($options['project_password']) && trim($options['project_password']) != '') {
                                        $data = array($options['user_id'], $options['project_id'], '', '', '', '', $options['amount'], $options['currency_id'], $options['reason_1'], $options['reason_2'], $this->form, $this->record_id, isset($options['mailback']) && $options['mailback'] ? implode('###', $this->mailbackRecipients) : '', '', '', '', $options['project_password']);
                                        $data_implode = implode('|', $data);
                                        $gen = sha1($data_implode);
                                        $hash = '<input type="hidden" name="hash" value="' . $gen . '" />';
                                    }
                                    $mailback = '';
                                    if (isset($options['mailback']) && $options['mailback']) {
                                        $mailback = '<input type="hidden" name="user_variable_2" value="' . implode('###', $this->mailbackRecipients) . '" />';
                                    }
                                    $html .= '
									<!-- sofortüberweisung.de -->
									<form method="post" name="ff_submitform" action="https://www.sofortueberweisung.de/payment/start">
									<input type="hidden" name="user_id" value="' . $options['user_id'] . '" />
									<input type="hidden" name="project_id" value="' . $options['project_id'] . '" />
									<input type="hidden" name="reason_1" value="' . $options['reason_1'] . '" />
									<input type="hidden" name="reason_2" value="' . $options['reason_2'] . '" />
									<input type="hidden" name="amount" value="' . $options['amount'] . '" />
									<input type="hidden" name="currency_id" value="' . $options['currency_id'] . '" />
									<input type="hidden" name="language_id" value="' . $options['language_id'] . '" />
									<input type="hidden" name="user_variable_0" value="' . $this->form . '" />
									<input type="hidden" name="user_variable_1" value="' . $this->record_id . '" />
									' . $mailback . '
									' . $hash . '
									</form>
									<!-- sofortüberweisung.de -->
									';
                                    if ($j15) {
                                        // TODO: let the user decide to use modal or simple alert
                                        $html .= '<script type="text/javascript">' . nl() . indentc(1) . '<!--' . nl() . indentc(2) . '

										    SqueezeBox.initialize({});

										    SqueezeBox.loadModal = function(modalUrl,handler,x,y) {
										    		this.initialize();
										      		var options = $merge(options || {}, Json.evaluate("{handler: \'" + handler + "\', size: {x: " + x +", y: " + y + "}}"));
													this.setOptions(this.presets, options);
													this.assignOptions();
													this.setContent(handler,modalUrl);
										   	};

										    SqueezeBox.loadModal("' . JURI::root() . 'index.php?raw=true&option=com_breezingforms&showPayPalConnectMsg=true","iframe",300,100);

										' . nl() . indentc(1) . '// -->' . nl() . '</script>' . nl();
                                    }
                                    $html .= '<script type="text/javascript"><!--' . nl() . 'document.ff_submitform.submit();' . nl() . '//--></script>';
                                    if (!$this->inline) {
                                        $html .= "</form></body></html>";
                                    }
                                    echo $html;
                                    break;
                                }
                            }
                        }
                        break;
                    default:
                        $paymentAction = false;
                }
            }
        }
        // CONTENTBUILDER
        if (JRequest::getVar('cb_controller', null) != 'edit' && $cbRecordId && is_array($cbResult) && isset($cbResult['data']) && isset($cbResult['data']['id']) && $cbResult['data']['id']) {
            if ($cbRecordId) {
                $return = JRequest::getVar('return', '');
                if ($return) {
                    $return = base64_decode($return);
                    if (JURI::isInternal($return)) {
                        JFactory::getApplication()->redirect($return, $msg);
                    }
                }
            }
            if ($cbResult['data']['force_login']) {
                jimport('joomla.version');
                $version = new JVersion();
                $is15 = true;
                if (version_compare($version->getShortVersion(), '1.6', '>=')) {
                    $is15 = false;
                }
                if (!JFactory::getUser()->get('id', 0)) {
                    if (!$is15) {
                        JFactory::getApplication()->redirect(JRoute::_('index.php?option=com_users&view=login&Itemid=' . JRequest::getInt('Itemid', 0), false));
                    } else {
                        JFactory::getApplication()->redirect(JRoute::_('index.php?option=com_user&view=login&Itemid=' . JRequest::getInt('Itemid', 0), false));
                    }
                } else {
                    if (!$is15) {
                        JFactory::getApplication()->redirect(JRoute::_('index.php?option=com_users&view=profile&Itemid=' . JRequest::getInt('Itemid', 0), false));
                    } else {
                        JFactory::getApplication()->redirect(JRoute::_('index.php?option=com_user&view=user&Itemid=' . JRequest::getInt('Itemid', 0), false));
                    }
                }
            } else {
                if (trim($cbResult['data']['force_url'])) {
                    JFactory::getApplication()->redirect(trim($cbResult['data']['force_url']));
                }
            }
            JFactory::getApplication()->redirect(JRoute::_('index.php?option=com_contentbuilder&controller=details&Itemid=' . JRequest::getInt('Itemid', 0) . '&backtolist=' . JRequest::getInt('backtolist', 0) . '&id=' . $cbResult['data']['id'] . '&record_id=' . $cbRecordId . '&limitstart=' . JRequest::getInt('limitstart', 0) . '&filter_order=' . JRequest::getCmd('filter_order'), false), BFText::_('COM_CONTENTBUILDER_SAVED'));
        }
        if (!$paymentAction) {
            if (!defined('VMBFCF_RUNNING')) {
                $ob = 0;
                while (ob_get_level() > 0 && $ob <= 32) {
                    ob_end_clean();
                    $ob++;
                }
                ob_start();
                echo '<!DOCTYPE html>
                    <html>
                    <head></head>
                    <body>';
            }
            if ($message == '') {
                $message = $this->message;
            } else {
                if ($this->message != '') {
                    $message .= ":" . nl() . $this->message;
                }
            }
            // if
            if (!$this->inline) {
                $url = $this->inframe ? $ff_mossite . '/index.php?format=html&tmpl=component' : ($this->runmode == _FF_RUNMODE_FRONTEND ? '' : 'index.php?format=html' . (JRequest::getCmd('tmpl', '') ? '&tmpl=' . JRequest::getCmd('tmpl', '') : ''));
                echo '<form name="ff_submitform" action="' . $url . '" method="post">' . nl();
            }
            // if
            switch ($this->runmode) {
                case _FF_RUNMODE_FRONTEND:
                    echo indentc(1) . '<input type="hidden" name="ff_form" value="' . htmlentities($this->form, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                    if ($this->target > 1) {
                        echo indentc(1) . '<input type="hidden" name="ff_target" value="' . htmlentities($this->target, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                    }
                    if ($this->inframe) {
                        echo indentc(1) . '<input type="hidden" name="ff_frame" value="1"/>' . nl();
                    }
                    if ($this->border) {
                        echo indentc(1) . '<input type="hidden" name="ff_border" value="1"/>' . nl();
                    }
                    if ($this->page != 1) {
                        indentc(1) . '<input type="hidden" name="ff_page" value="' . htmlentities($this->page, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                    }
                    if ($this->align != 1) {
                        echo indentc(1) . '<input type="hidden" name="ff_align" value="' . htmlentities($this->align, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                    }
                    if ($this->top != 0) {
                        echo indentc(1) . '<input type="hidden" name="ff_top" value="' . htmlentities($this->top, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                    }
                    reset($ff_otherparams);
                    while (list($prop, $val) = each($ff_otherparams)) {
                        echo indentc(1) . '<input type="hidden" name="' . htmlentities($prop, ENT_QUOTES, 'UTF-8') . '" value="' . htmlentities($val, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                    }
                    break;
                case _FF_RUNMODE_BACKEND:
                    echo indentc(1) . '<input type="hidden" name="option" value="com_breezingforms"/>' . nl() . indentc(1) . '<input type="hidden" name="act" value="run"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_form" value="' . htmlentities($this->form, ENT_QUOTES, 'UTF-8') . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_runmode" value="' . htmlentities($this->runmode, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                    if ($this->target > 1) {
                        echo indentc(1) . '<input type="hidden" name="ff_target" value="' . htmlentities($this->target, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                    }
                    if ($this->inframe) {
                        echo indentc(1) . '<input type="hidden" name="ff_frame" value="1"/>' . nl();
                    }
                    if ($this->border) {
                        echo indentc(1) . '<input type="hidden" name="ff_border" value="1"/>' . nl();
                    }
                    if ($this->page != 1) {
                        indentc(1) . '<input type="hidden" name="ff_page" value="' . htmlentities($this->page, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                    }
                    if ($this->align != 1) {
                        echo indentc(1) . '<input type="hidden" name="ff_align" value="' . htmlentities($this->align, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                    }
                    if ($this->top != 0) {
                        echo indentc(1) . '<input type="hidden" name="ff_top" value="' . htmlentities($this->top, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                    }
                    break;
                default:
                    // _FF_RUNMODE_PREVIEW:
                    if ($this->inframe) {
                        echo indentc(1) . '<input type="hidden" name="option" value="com_breezingforms"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_frame" value="1"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_form" value="' . htmlentities($this->form, ENT_QUOTES, 'UTF-8') . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_runmode" value="' . htmlentities($this->runmode, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                        if ($this->page != 1) {
                            indentc(1) . '<input type="hidden" name="ff_page" value="' . htmlentities($this->page, ENT_QUOTES, 'UTF-8') . '"/>' . nl();
                        }
                    }
                    // if
            }
            // if
            echo indentc(1) . '<input type="hidden" name="ff_contentid" value="' . JRequest::getInt('ff_contentid', 0) . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_applic" value="' . JRequest::getWord('ff_applic', '') . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_module_id" value="' . JRequest::getInt('ff_module_id', 0) . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_status" value="' . htmlentities($this->status, ENT_QUOTES, 'UTF-8') . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_message" value="' . htmlentities(addcslashes($message, "..!@\\@..ÿ"), ENT_QUOTES, 'UTF-8') . '"/>' . nl() . indentc(1) . '<input type="hidden" name="ff_form_submitted" value="1"/>' . nl();
            if (JRequest::getVar('tmpl') == 'component') {
                echo indentc(1) . '<input type="hidden" name="tmpl" value="component"/>' . nl();
            }
            if (isset($_REQUEST['cb_form_id']) && isset($_REQUEST['cb_record_id'])) {
                echo indentc(1) . '<input type="hidden" name="cb_form_id" value="' . JRequest::getInt('cb_form_id', 0) . '"/>' . nl();
                echo indentc(1) . '<input type="hidden" name="cb_record_id" value="' . JRequest::getInt('cb_record_id', 0) . '"/>' . nl();
                echo indentc(1) . '<input type="hidden" name="return" value="' . htmlentities(JRequest::getVar('return', ''), ENT_QUOTES, 'UTF-8') . '"/>' . nl();
            }
            // TODO: turn off tracing in the options
            if ($this->traceMode & _FF_TRACEMODE_DIRECT) {
                $this->dumpTrace();
                ob_end_flush();
                echo '</pre>';
            } else {
                ob_end_flush();
                $this->dumpTrace();
            }
            // if
            restore_error_handler();
            if (!$this->inline) {
                echo '</form>' . nl() . '<script type="text/javascript">' . nl() . indentc(1) . '<!--' . nl() . indentc(2) . 'document.ff_submitform.submit();' . nl() . indentc(1) . '// -->' . nl() . '</script>' . nl();
            }
            // if
            if (!defined('VMBFCF_RUNNING')) {
                $c = ob_get_contents();
                ob_end_clean();
                echo $c;
                echo '</body>
                      </html>';
            }
        }
        unset($_SESSION['ff_editable_overridePlg' . JRequest::getInt('ff_contentid', 0) . $this->form_id]);
        unset($_SESSION['ff_editablePlg' . JRequest::getInt('ff_contentid', 0) . $this->form_id]);
        JFactory::getSession()->set('ff_editableMod' . JRequest::getInt('ff_module_id', 0) . $this->form_id, 0);
        JFactory::getSession()->set('ff_editable_overrideMod' . JRequest::getInt('ff_module_id', 0) . $this->form_id, 0);
        if (!defined('VMBFCF_RUNNING')) {
            exit;
        }
    }
Example #16
0
function text_render_page_early($args)
{
    if ($args['edit']) {
        if (USE_MIN_FILES) {
            html_add_js(base_url() . 'modules/text/text-edit.min.js');
        } else {
            html_add_js(base_url() . 'modules/text/text-edit.js');
        }
        html_add_css(base_url() . 'modules/text/text-edit.css');
        html_add_js_var('$.glue.conf.text.auto_br', TEXT_AUTO_BR);
        if (TEXT_USE_WOFF_FONTS) {
            $woff_fonts = _woff_fonts();
            foreach ($woff_fonts as $font => $styles) {
                _include_woff_font($font);
                // TODO (later): check css encoding
                $rule = '.glue-font-woff-' . $font . ' {' . nl();
                // we use single quotes as they don't clash with inline styles
                $rule .= tab() . 'font-family: \'' . $font . '\';' . nl();
                $rule .= '}';
                html_add_css_inline($rule, 6);
            }
        }
    }
}
Example #17
0
	global $c_send_email;
	$c_send_email = false;
	
	$moveItem = $moveList->getFirst();
	$index = 0;
	while ($moveItem) {
		$afterList = new cs_list();
		if (($index + 1) < $moveList->getCount()) {
			$afterList = $moveList->getSubList($index + 1, $moveList->getCount() - ($index + 1));
		}

		$handledProjectList = moveRoom($environment, $afterList, $moveItem, $exec, $newPortalId);

		if ($handledProjectList->isNotEmpty()) {
			$handledProjectItem = $handledProjectList->getFirst();

			while ($handledProjectItem) {
				$moveList->removeElement($handledProjectItem);

				$handledProjectItem = $handledProjectList->getNext();
			}
		}
		
		$moveItem = $moveList->getNext();
		$index++;
	}
	
	nl(); nl();
	
	echo "Fertig!"; nl();
}
	function submit()
	{
		global $database, $ff_config, $ff_comsite, $ff_mossite, $ff_otherparams;

		$database = JFactory::getDBO();
		if (!$this->okrun) return;

                // currently only available in classic mode
                if(trim($this->formrow->template_code_processed) == ''){
                    set_error_handler('_ff_errorHandler');
                }
                
		ob_start();
		$this->record_id = '';
		$this->status = _FF_STATUS_OK;
		$this->message = '';
		$this->sendNotificationAfterPayment = false;

		// handle Begin Submit piece
		$halt = false;
		$this->collectSubmitdata();

		if(!$halt){
			for($i = 0; $i < $this->rowcount; $i++) {
				$row = $this->rows[$i];
				if ($row->type=="Captcha") {
					require_once(JPATH_SITE . '/components/com_breezingforms/images/captcha/securimage.php');
					$securimage = new Securimage();
					if(!$securimage->check(JRequest::getVar('bfCaptchaEntry', ''))){
						$halt = true;
						$this->status = _FF_STATUS_CAPTCHA_FAILED;
                                                exit;
					}
					break;
				}else
                                if ($row->type=="ReCaptcha") {
					if(!JFactory::getSession()->get('bfrecapsuccess',false)){
                                            $halt = true;
                                            $this->status = _FF_STATUS_CAPTCHA_FAILED;
                                        }
                                        JFactory::getSession()->set('bfrecapsuccess',false);
					break;
				}
			}

			require_once(JPATH_SITE.'/administrator/components/com_breezingforms/libraries/Zend/Json/Decoder.php');
			require_once(JPATH_SITE.'/administrator/components/com_breezingforms/libraries/Zend/Json/Encoder.php');

			$areas = Zend_Json::decode($this->formrow->template_areas);

			if(is_array($areas)){
				switch(JRequest::getVar('ff_payment_method', '')){
					case 'PayPal':
					case 'Sofortueberweisung':
						foreach($areas As $area){
							foreach($area['elements'] As $element){
								if($element['internalType'] == 'bfPayPal' || $element['internalType'] == 'bfSofortueberweisung'){
									$options = $element['options'];
									if( isset( $options['sendNotificationAfterPayment'] ) && $options['sendNotificationAfterPayment'] ){
										$this->sendNotificationAfterPayment = true;
									}
								}
							}
						}
				}
			}
		}

		if(!$halt){

			$code = '';

			switch ($this->formrow->piece3cond) {
				case 1: // library
					$database->setQuery(
						"select name, code from #__facileforms_pieces ".
						 "where id=".$this->formrow->piece3id." and published=1 "
					);
					$rows = $database->loadObjectList();
					if (count($rows))
						echo $this->execPiece(
								$rows[0]->code,
								BFText::_('COM_BREEZINGFORMS_PROCESS_BSPIECE')." ".$rows[0]->name,
								'p',
								$this->formrow->piece3id,
								null
							);
					break;
				case 2: // custom code
					echo $this->execPiece(
							$this->formrow->piece3code,
							BFText::_('COM_BREEZINGFORMS_PROCESS_BSPIECEC'),
							'f',
							$this->form,
							3
						);
					break;
				default:
					break;
			} // switch
			if ($this->bury()) return;

			if ($this->status == _FF_STATUS_OK) {
				if (!$this->formrow->published) {
					$this->status = _FF_STATUS_UNPUBLISHED;
				} else {
					if ($this->status == _FF_STATUS_OK) {
						if ($this->formrow->dblog > 0) $this->logToDatabase();
                                                
						if ($this->status == _FF_STATUS_OK){
							if ($this->formrow->emailntf > 0){
								$this->sendEmailNotification();
							}
                                                        if ($this->formrow->mb_emailntf > 0){
                                                            $this->sendMailbackNotification();
                                                        }
                                                        $this->sendMailChimpNotification();

							$tickets = JFactory::getSession()->get('bfFlashUploadTickets', array());
							mt_srand();
							if(isset($tickets[JRequest::getVar('bfFlashUploadTicket', mt_rand(0,mt_getrandmax()))])){
								unset($tickets[JRequest::getVar('bfFlashUploadTicket')]);
								JFactory::getSession()->set('bfFlashUploadTickets', $tickets);
							}
						}
					} // if
				} // if
			} // if

			// handle End Submit piece
			$code = '';
			switch ($this->formrow->piece4cond) {
				case 1: // library
					$database->setQuery(
						"select name, code from #__facileforms_pieces ".
						 "where id=".$this->formrow->piece4id." and published=1 "
					);
					$rows = $database->loadObjectList();
					if (count($rows))
						echo $this->execPiece(
								$rows[0]->code,
								BFText::_('COM_BREEZINGFORMS_PROCESS_ESPIECE')." ".$rows[0]->name,
								'p',
								$this->formrow->piece4id,
								null
							 );
					break;
				case 2: // custom code
					echo $this->execPiece(
							$this->formrow->piece4code,
							BFText::_('COM_BREEZINGFORMS_PROCESS_ESPIECEC'),
							'f',
							$this->form,
							3
						);
					break;
				default:
					break;
			} // switch

			if ($this->bury()) return;

		}

		switch ($this->status) {
			case _FF_STATUS_OK:
				$message = BFText::_('COM_BREEZINGFORMS_PROCESS_SUBMITSUCCESS');
				break;
			case _FF_STATUS_UNPUBLISHED:
				$message = BFText::_('COM_BREEZINGFORMS_PROCESS_UNPUBLISHED');
				break;
			case _FF_STATUS_SAVERECORD_FAILED:
				$message = BFText::_('COM_BREEZINGFORMS_PROCESS_SAVERECFAILED');
				break;
			case _FF_STATUS_SAVESUBRECORD_FAILED:
				$message = BFText::_('COM_BREEZINGFORMS_PROCESS_SAVESUBFAILED');
				break;
			case _FF_STATUS_UPLOAD_FAILED:
				$message = BFText::_('COM_BREEZINGFORMS_PROCESS_UPLOADFAILED');
				break;
			case _FF_STATUS_SENDMAIL_FAILED:
				$message = BFText::_('COM_BREEZINGFORMS_PROCESS_SENDMAILFAILED');
				break;
			case _FF_STATUS_ATTACHMENT_FAILED:
				$message = BFText::_('COM_BREEZINGFORMS_PROCESS_ATTACHMTFAILED');
				break;
			case _FF_STATUS_CAPTCHA_FAILED:
				$message = BFText::_('COM_BREEZINGFORMS_Captcha entry failed!');
				break;
			case _FF_STATUS_FILE_EXTENSION_NOT_ALLOWED:
				$message = BFText::_('COM_BREEZINGFORMS_File extension not allowed!');
				break;
			default:
				// custom piece status and message
				break;
		} // switch

		// built in PayPal action
		$paymentAction = false;

		if($this->formrow->template_code != ''){

			require_once(JPATH_SITE.'/administrator/components/com_breezingforms/libraries/Zend/Json/Decoder.php');
			require_once(JPATH_SITE.'/administrator/components/com_breezingforms/libraries/Zend/Json/Encoder.php');

			$areas = Zend_Json::decode($this->formrow->template_areas);

			if(is_array($areas)){

                            jimport('joomla.version');
                            $version = new JVersion();
                            $j15 = true;
                            if(version_compare($version->getShortVersion(), '1.6', '>=')){
                                $j15 = false;
                            }


							$paymentAction = true;

							switch(JRequest::getVar('ff_payment_method', '')){

								case 'PayPal':

								foreach($areas As $area){

									foreach($area['elements'] As $element){

									if($element['internalType'] == 'bfPayPal'){

									$options = $element['options'];

									$business = $options['business'];
									$paypal = 'https://www.paypal.com';

									if($options['testaccount']){
										$paypal = 'https://www.sandbox.paypal.com';
										$business = $options['testBusiness'];
									}

									$returnurl = htmlentities(JURI::root()."index.php?option=com_breezingforms&confirmPayPal=true&form_id=".$this->form."&record_id=".$this->record_id);
									$cancelurl = htmlentities(JURI::root()."index.php?msg=".BFText::_('COM_BREEZINGFORMS_Transaction cancelled by user!'));

									$html = '';
									if(!$this->inline)
										$html .= '<html><head></head><body>';

									JHTML::_('behavior.modal');

									$ppselect = JRequest::getVar('ff_nm_bfPaymentSelect', array());
									if(count($ppselect) != 0){
										$ppselected = explode('|',$ppselect[0]);
										if(count($ppselected) == 4){
											$options['itemname'] = $ppselected[0];
											$options['itemnumber'] = $ppselected[1];
											$options['amount'] = $ppselected[2];
											$options['tax'] = $ppselected[3];
										}
									}

									// keeping this for compat reasons
									$ppselect = JRequest::getVar('ff_nm_PayPalSelect', array());
									if(count($ppselect) != 0){
										$ppselected = explode('|',$ppselect[0]);
										if(count($ppselected) == 4){
											$options['itemname'] = $ppselected[0];
											$options['itemnumber'] = $ppselected[1];
											$options['amount'] = $ppselected[2];
											$options['tax'] = $ppselected[3];
										}
									}
									// compat end

									$html .= "<form name=\"ff_submitform\" action=\"".$paypal."/cgi-bin/webscr\" method=\"post\">";
									$html .= "<input type=\"hidden\" name=\"cmd\" value=\"_xclick\"/>";
									$html .= "<input type=\"hidden\" name=\"business\" value=\"".$business."\"/>";
									$html .= "<input type=\"hidden\" name=\"item_name\" value=\"".$options['itemname']."\"/>";
									$html .= "<input type=\"hidden\" name=\"item_number\" value=\"".$options['itemnumber']."\"/>";
									$html .= "<input type=\"hidden\" name=\"amount\" value=\"".$options['amount']."\"/>";
									$html .= "<input type=\"hidden\" name=\"tax\" value=\"".$options['tax']."\"/>";
									$html .= "<input type=\"hidden\" name=\"no_shipping\" value=\"1\"/>";
									$html .= "<input type=\"hidden\" name=\"no_note\" value=\"1\"/>";
                                                                        if( $options['useIpn'] ){
                                                                            $html .= "<input type=\"hidden\" name=\"notify_url\" value=\"".htmlentities(JURI::root()."index.php?option=com_breezingforms&confirmPayPalIpn=true&raw=true&form_id=".$this->form."&record_id=".$this->record_id)."\"/>";
                                                                            if($options['testaccount']){
                                                                                $html .= "<input type=\"hidden\" name=\"test_ipn\" value=\"1\"/>";
                                                                            }
                                                                        }else{
                                                                            $html .= "<input type=\"hidden\" name=\"notify_url\" value=\"".$returnurl."\"/>";
                                                                        }
									$html .= "<input type=\"hidden\" name=\"return\" value=\"".$returnurl."\"/>";
									$html .= "<input type=\"hidden\" name=\"cancel_return\" value=\"".$cancelurl."\"/>";
									$html .= "<input type=\"hidden\" name=\"rm\" value=\"2\"/>";
									$html .= "<input type=\"hidden\" name=\"lc\" value=\"".$options['locale']."\"/>";
									//$html .= "<input type=\"hidden\" name=\"pal\" value=\"D6MXR7SEX68LU\"/>";
									$html .= "<input type=\"hidden\" name=\"currency_code\" value=\"".strtoupper($options['currencyCode'])."\"/>";

									if(!$this->inline)
										$html .= "</form></body></html>";

									// TODO: let the user decide to use modal or simple alert
                                                                        if($j15){
                                                                            $html .= '<script type="text/javascript">'.nl().
								   		 indentc(1).'<!--'.nl().
										 indentc(2).'

										    SqueezeBox.initialize({});

										    SqueezeBox.loadModal = function(modalUrl,handler,x,y) {
										    		this.initialize();
										      		var options = $merge(options || {}, Json.evaluate("{handler: \'" + handler + "\', size: {x: " + x +", y: " + y + "}}"));
													this.setOptions(this.presets, options);
													this.assignOptions();
													this.setContent(handler,modalUrl);
										   	};

										    SqueezeBox.loadModal("'.JURI::root().'index.php?raw=true&option=com_breezingforms&showPayPalConnectMsg=true","iframe",300,100);

										 	

										'.nl().
										 indentc(1).'// -->'.nl().
										 '</script>'.nl();
                                                                        }
                                                                        $html .= '<script type="text/javascript">document.ff_submitform.submit();</script>';
									echo $html;

									break;
									}
									}
									}

									break;

								case 'Sofortueberweisung':

									foreach($areas As $area){
									foreach($area['elements'] As $element){
									if($element['internalType'] == 'bfSofortueberweisung'){

									$html = '';
									if(!$this->inline)
										$html .= '<html><head></head><body>';

									JHTML::_('behavior.modal');

									$options = $element['options'];

									$ppselect = JRequest::getVar('ff_nm_bfPaymentSelect', array());
									if(count($ppselect) != 0){
										$ppselected = explode('|',$ppselect[0]);
										if(count($ppselected) == 4){
											$options['reason_1'] = $ppselected[0];
											$options['reason_2'] = $ppselected[1];
											$options['amount'] = $ppselected[2];
											if($ppselected[3] != '' && intval($ppselected[3]) > 0){
												$options['amount'] = '' . doubleval($options['amount']) + doubleval($ppselected[3]);
											}
										}
									}

									$options['amount'] = str_replace('.',',', $options['amount']);

									$hash = '';
									if(isset($options['project_password']) && trim($options['project_password']) != ''){

										$data = array(
									      $options['user_id'],    // user_id
									      $options['project_id'],    // project_id
									      '',         // sender_holder
									      '',         // sender_account_number
									      '',         // sender_bank_code
									      '',         // sender_country_id
									      $options['amount'],    // amount
									                  // currency_id, Pflichtparameter bei Hash-Berechnung
									      $options['currency_id'],
									      $options['reason_1'], // reason_1
									      $options['reason_2'], // reason_2
									      $this->form,         // user_variable_0
									      $this->record_id,         // user_variable_1
									      (isset($options['mailback']) && $options['mailback'] ? implode('###',$this->mailbackRecipients) : ''),         // user_variable_2
									      '',         // user_variable_3
									      '',         // user_variable_4
									      '',         // user_variable_5
									      $options['project_password']    // project_password
										);
										$data_implode = implode('|', $data);

										$gen = sha1($data_implode);

										$hash = '<input type="hidden" name="hash" value="'.$gen.'" />';
									}

									$mailback = '';
									if(isset($options['mailback']) && $options['mailback']){
										$mailback = '<input type="hidden" name="user_variable_2" value="'.implode('###',$this->mailbackRecipients).'" />';
									}

									$html .= '
									<!-- sofortüberweisung.de -->
									<form method="post" name="ff_submitform" action="https://www.sofortueberweisung.de/payment/start">
									<input type="hidden" name="user_id" value="'.$options['user_id'].'" />
									<input type="hidden" name="project_id" value="'.$options['project_id'].'" />
									<input type="hidden" name="reason_1" value="'.$options['reason_1'].'" />
									<input type="hidden" name="reason_2" value="'.$options['reason_2'].'" />
									<input type="hidden" name="amount" value="'.$options['amount'].'" />
									<input type="hidden" name="currency_id" value="'.$options['currency_id'].'" />
									<input type="hidden" name="language_id" value="'.$options['language_id'].'" />
									<input type="hidden" name="user_variable_0" value="'.$this->form.'" />
									<input type="hidden" name="user_variable_1" value="'.$this->record_id.'" />
									'.$mailback.'
									'.$hash.'
									</form>
									<!-- sofortüberweisung.de -->
									';

                                                                        if($j15){
									// TODO: let the user decide to use modal or simple alert
                                                                        $html .= '<script type="text/javascript">'.nl().
								   		 indentc(1).'<!--'.nl().
										 indentc(2).'

										    SqueezeBox.initialize({});

										    SqueezeBox.loadModal = function(modalUrl,handler,x,y) {
										    		this.initialize();
										      		var options = $merge(options || {}, Json.evaluate("{handler: \'" + handler + "\', size: {x: " + x +", y: " + y + "}}"));
													this.setOptions(this.presets, options);
													this.assignOptions();
													this.setContent(handler,modalUrl);
										   	};

										    SqueezeBox.loadModal("'.JURI::root().'index.php?raw=true&option=com_breezingforms&showPayPalConnectMsg=true","iframe",300,100);

										'.nl().
										 indentc(1).'// -->'.nl().
										 '</script>'.nl();
                                                                        }
                                                                        $html .= '<script type="text/javascript">document.ff_submitform.submit();</script>';


									if(!$this->inline)
										$html .= "</form></body></html>";

									echo $html;



									break;
									}
									}
									}

									break;

								default:
									$paymentAction = false;
							}

			}
		}

		if(!$paymentAction){

			if ($message == '')
				$message = $this->message;
			else {
				if ($this->message != '')
					$message .= ":".nl().$this->message;
			} // if

			if (!$this->inline) {
				$url = ($this->inframe)
						? $ff_mossite.'/index.php?format=html&tmpl=component'
						: (($this->runmode==_FF_RUNMODE_FRONTEND)
							? ''
							: 'index.php?format=html&tmpl=component');

				echo '<form name="ff_submitform" action="'.$url.'" method="post">'.nl();
			} // if

			switch ($this->runmode) {
				case _FF_RUNMODE_FRONTEND:
					echo indentc(1).'<input type="hidden" name="ff_form" value="'.$this->form.'"/>'.nl();
					if ($this->target > 1)
						echo indentc(1).'<input type="hidden" name="ff_target" value="'.$this->target.'"/>'.nl();
					if ($this->inframe)
						echo indentc(1).'<input type="hidden" name="ff_frame" value="1"/>'.nl();
					if ($this->border)
						echo indentc(1).'<input type="hidden" name="ff_border" value="1"/>'.nl();
					if ($this->page != 1)
						 indentc(1).'<input type="hidden" name="ff_page" value="'.$this->page.'"/>'.nl();
					if ($this->align != 1)
						echo indentc(1).'<input type="hidden" name="ff_align" value="'.$this->align.'"/>'.nl();
					if ($this->top != 0)
						echo indentc(1).'<input type="hidden" name="ff_top" value="'.$this->top.'"/>'.nl();
					reset($ff_otherparams);
					while (list($prop, $val) = each($ff_otherparams))
						echo indentc(1).'<input type="hidden" name="'.$prop.'" value="'.$val.'"/>'.nl();
					break;

				case _FF_RUNMODE_BACKEND:
					echo indentc(1).'<input type="hidden" name="option" value="com_breezingforms"/>'.nl().
						 indentc(1).'<input type="hidden" name="act" value="run"/>'.nl().
						 indentc(1).'<input type="hidden" name="ff_form" value="'.$this->form.'"/>'.nl().
						 indentc(1).'<input type="hidden" name="ff_runmode" value="'.$this->runmode.'"/>'.nl();
					if ($this->target > 1)
						echo indentc(1).'<input type="hidden" name="ff_target" value="'.$this->target.'"/>'.nl();
					if ($this->inframe)
						echo indentc(1).'<input type="hidden" name="ff_frame" value="1"/>'.nl();
					if ($this->border)
						echo indentc(1).'<input type="hidden" name="ff_border" value="1"/>'.nl();
					if ($this->page != 1)
						 indentc(1).'<input type="hidden" name="ff_page" value="'.$this->page.'"/>'.nl();
					if ($this->align != 1)
						echo indentc(1).'<input type="hidden" name="ff_align" value="'.$this->align.'"/>'.nl();
					if ($this->top != 0)
						echo indentc(1).'<input type="hidden" name="ff_top" value="'.$this->top.'"/>'.nl();
					break;

				default: // _FF_RUNMODE_PREVIEW:
					if ($this->inframe) {
						echo indentc(1).'<input type="hidden" name="option" value="com_breezingforms"/>'.nl().
							 indentc(1).'<input type="hidden" name="ff_frame" value="1"/>'.nl().
							 indentc(1).'<input type="hidden" name="ff_form" value="'.$this->form.'"/>'.nl().
							 indentc(1).'<input type="hidden" name="ff_runmode" value="'.$this->runmode.'"/>'.nl();
						if ($this->page != 1)
							 indentc(1).'<input type="hidden" name="ff_page" value="'.$this->page.'"/>'.nl();
					} // if
			} // if

			echo indentc(1).'<input type="hidden" name="ff_contentid" value="'.JRequest::getInt('ff_contentid',0).'"/>'.nl().
				 indentc(1).'<input type="hidden" name="ff_applic" value="'.JRequest::getWord('ff_applic','').'"/>'.nl().
				 indentc(1).'<input type="hidden" name="ff_module_id" value="'.JRequest::getInt('ff_module_id',0).'"/>'.nl().
				 indentc(1).'<input type="hidden" name="ff_status" value="'.$this->status.'"/>'.nl().
				 indentc(1).'<input type="hidden" name="ff_message" value="'.addcslashes($message, "\0..\37!@\@\177..\377").'"/>'.nl();

			// TODO: turn off tracing in the options
			if ($this->traceMode & _FF_TRACEMODE_DIRECT) {
				$this->dumpTrace();
				ob_end_flush();
				echo '</pre>';
			} else {
                            
				ob_end_flush();
				$this->dumpTrace();
			} // if
			restore_error_handler();
                        
			if (!$this->inline) {
				echo '</form>'.nl().
					 '<script type="text/javascript">'.nl().
					 indentc(1).'<!--'.nl().
					 indentc(2).'document.ff_submitform.submit();'.nl().
					 indentc(1).'// -->'.nl().
					 '</script>'.nl().
					 '</body>'.nl().
					 '</html>'.nl();
			} // if

		}

		unset($_SESSION['ff_editable_overridePlg'.JRequest::getInt('ff_contentid',0) . $this->form_id]);
		unset($_SESSION['ff_editablePlg'.JRequest::getInt('ff_contentid',0) . $this->form_id]);
		JFactory::getSession()->set('ff_editableMod'.JRequest::getInt('ff_module_id',0) . $this->form_id, 0);
		JFactory::getSession()->set('ff_editable_overrideMod'.JRequest::getInt('ff_module_id',0) . $this->form_id, 0);
	} // submit
Example #19
0
function array2options($array, $default = null)
{
    $out = '';
    foreach ($array as $key => $row) {
        if (!is_null($default) && $row == $default) {
            $out .= '<option value="' . htmlspecialchars($row, ENT_QUOTES) . '" selected="selected">' . ucfirst($row) . '</option>' . nl();
        } elseif (is_array($default) && in_array($row, $default)) {
            $out .= '<option value="' . htmlspecialchars($row, ENT_QUOTES) . '" selected="selected">' . ucfirst($row) . '</option>' . nl();
        } else {
            $out .= '<option value="' . htmlspecialchars($row, ENT_QUOTES) . '">' . ucfirst($row) . '</option>' . nl();
        }
    }
    return $out;
}
Example #20
0
/**
 *	return a hotglue-themed error message to the client
 *
 *	the function does not return if successful.
 *	@param int $code error code
 *	@param bool $no_header don't output any header
 *	@return false if the error code is not supported yet
 */
function hotglue_error($code, $no_header = false)
{
    if (!$no_header) {
        // output header
        if (USE_HOTGLUE_ERRORS) {
            $header_only = true;
        } else {
            $header_only = false;
        }
        if (!http_error($code, $header_only)) {
            return false;
        }
    }
    // output informative message
    html_flush();
    default_html(false);
    html_add_css(base_url() . 'css/hotglue_error.css');
    $bdy =& body();
    elem_attr($bdy, 'id', 'hotglue_error');
    body_append(tab(1) . '<div id="paper">' . nl());
    body_append(tab(2) . '<div id="wrapper">' . nl());
    body_append(tab(3) . '<div id="content">' . nl());
    body_append(tab(4) . '<div id="left-nav">' . nl());
    body_append(tab(5) . '<img src="' . htmlspecialchars(base_url(), ENT_COMPAT, 'UTF-8') . 'img/hotglue-logo.png" alt="logo">' . nl());
    body_append(tab(4) . '</div>' . nl());
    body_append(tab(4) . '<div id="main">' . nl());
    if ($code == 400) {
        body_append(tab(5) . '<h1 id="error-title">ERROR 400, bad request!</h1>' . nl());
    } elseif ($code == 401) {
        body_append(tab(5) . '<h1 id="error-title">Authorization required!</h1>' . nl());
    } elseif ($code == 404) {
        body_append(tab(5) . '<h1 id="error-title">ERROR 404, not found!</h1>' . nl());
    } elseif ($code == 500) {
        body_append(tab(5) . '<h1 id="error-title">ERROR 500, server fault!</h1>' . nl());
    }
    body_append(tab(5) . '<p>' . nl());
    if ($code == 400) {
        body_append(tab(6) . 'Something got screwed up...<br>' . nl());
        body_append(tab(6) . 'The page is sending a bad request to the server!' . nl());
    } elseif ($code == 401) {
        body_append(tab(6) . 'You need to be logged in in order to do this.<br>' . nl());
    } elseif ($code == 404) {
        body_append(tab(6) . 'It looks like you got lost in cyber-space...<br>' . nl());
        body_append(tab(6) . 'The page you are trying to reach does not exist!' . nl());
    } elseif ($code == 500) {
        body_append(tab(6) . 'Are we runnining out of fuel?!<br>' . nl());
        body_append(tab(6) . 'Something is causing serious server errors!' . nl());
    }
    body_append(tab(5) . '</p>' . nl());
    body_append(tab(6) . '<a href="' . htmlspecialchars(base_url(), ENT_COMPAT, 'UTF-8') . '" id="home">take me home!</a>' . nl());
    body_append(tab(4) . '</div>' . nl());
    body_append(tab(3) . '</div>' . nl());
    body_append(tab(2) . '</div>' . nl());
    body_append(tab(2) . '<div style="position: absolute; left: 200px; top: -10px; z-index: 2;">' . nl());
    body_append(tab(3) . '<img src="' . htmlspecialchars(base_url(), ENT_COMPAT, 'UTF-8') . 'img/hotglue-404.png" alt="404">' . nl());
    body_append(tab(2) . '</div>' . nl());
    body_append(tab(1) . '</div>' . nl());
    echo html_finalize();
    die;
}
Example #21
0
/**
 *	turn an object into an html string
 *
 *	the function also appends the resulting string to the output in 
 *	html.inc.php.
 *	@param array $args arguments
 *		string 'name' is the object name (i.e. page.rev.obj)
 *		bool 'edit' are we editing or not
 *	@return array response
 *		html
 */
function render_object($args)
{
    // maybe move this to common.inc.php in the future and get rid of some of
    // these checks in the beginning
    $obj = load_object($args);
    if ($obj['#error']) {
        return $obj;
    } else {
        $obj = $obj['#data'];
    }
    if (!isset($args['edit'])) {
        return response('Required argument "edit" missing', 400);
    }
    if ($args['edit']) {
        $args['edit'] = true;
    } else {
        $args['edit'] = false;
    }
    log_msg('debug', 'render_object: rendering ' . quot($args['name']));
    $ret = invoke_hook_while('render_object', false, array('obj' => $obj, 'edit' => $args['edit']));
    if (empty($ret)) {
        log_msg('warn', 'render_object: nobody claimed ' . quot($obj['name']));
        return response('');
    } else {
        $temp = array_keys($ret);
        log_msg('debug', 'render_object: ' . quot($obj['name']) . ' was handled by ' . quot($temp[0]));
        $temp = array_values($ret);
        // make sure object has a tailing newline
        if (0 < strlen($temp[0]) && substr($temp[0], -1) != "\n") {
            $temp[0] .= nl();
        }
        body_append($temp[0]);
        // return the element as html-string as well
        return response($temp[0]);
    }
}
Example #22
0
					<th>Comments</th>
					<th>Date</th>
				</tr>
			<?php 
function nl($s, $r)
{
    echo "<td class=" . $s . "><p class=" . $s . ">" . htmlspecialchars($r[$s]) . "</p></td>";
}
$query = "SELECT * FROM apps";
$results = $db->query($query);
while ($row = $results->fetchArray(SQLITE3_ASSOC)) {
    echo "<tr>";
    nl('username', $row);
    nl('email', $row);
    nl('id', $row);
    nl('city', $row);
    nl('state', $row);
    nl('zip', $row);
    nl('comments', $row);
    nl('date', $row);
    echo "</tr>";
}
?>
			</table>
		</div>
		<div class="col-md-12 text-center" style="margin-top:40px">
			<a class="btn btn-primary" href="dbdump.php">Export as CSV</a>
		</div>
    </body>
</html>
Example #23
0
    </thead>
    <tbody>
<?php 
        foreach ($users as $id => $values) {
            echo "<tr>" . nl();
            echo "<td>" . $values['username'] . "</td>" . nl();
            echo "<td><a class='btn' href='mailto:" . $values['email'] . "?subject=Hi There'>Send Email</i></a></td>" . nl();
            echo "<td>" . $values['group'] . "</td>" . nl();
            echo "<td>" . Options::userGet($id, 'firstName') . "</td>" . nl();
            echo "<td>" . Options::userGet($id, 'surname') . "</td>" . nl();
            $dob = Options::userExists($id, 'dateOfBirth') ? time2str(Options::userGet($id, 'dateOfBirth')) : '';
            echo "<td>" . $dob . "</td>" . nl();
            echo "</tr>" . nl();
        }
    }
    ?>

    </tbody>
  </table>
    
<?php 
    if (isset($pager)) {
        echo $pager;
    }
    // Print Pager
} else {
    echo "<p><strong>Sorry no users found</strong></p>" . nl();
    // No users based on search criteria
}
?>
</div>
 function exportXml()
 {
     global $database, $ff_admsite, $ff_compath, $ff_version, $mosConfig_fileperms;
     $ids = JRequest::getVar('cid', array());
     JArrayHelper::toInteger($ids);
     jimport('joomla.version');
     $version = new JVersion();
     $_version = $version->getShortVersion();
     $tz = 'UTC';
     if (version_compare($_version, '3.2', '>=')) {
         $tz = new DateTimeZone(JFactory::getApplication()->getCfg('offset'));
     }
     $date_stamp = date('YmdHis');
     $date_file = date('Y-m-d H:i:s');
     if (version_compare($_version, '3.2', '>=')) {
         $date_ = JFactory::getDate('now', $tz);
         $offset = $date_->getOffsetFromGMT();
         if ($offset > 0) {
             $date_->add(new DateInterval('PT' . $offset . 'S'));
         } else {
             if ($offset < 0) {
                 $offset = $offset * -1;
                 $date_->sub(new DateInterval('PT' . $offset . 'S'));
             }
         }
         $date_stamp = $date_->format('YmdHis', true);
         $date_file = $date_->format('Y-m-d H:i:s', true);
     }
     $database = JFactory::getDBO();
     $xmlname = $ff_compath . '/exports/ffexport-' . $date_stamp . '.xml';
     if (isset($ids[0])) {
         $ids = implode(',', $ids);
         $database->setQuery("select * from #__facileforms_records where id in ({$ids}) order by submitted Desc");
     } else {
         if (JRequest::getInt('form_selection', 0)) {
             $database->setQuery("select * from #__facileforms_records where form = " . $database->Quote(JRequest::getInt('form_selection', 0)) . " order by submitted Desc");
         } else {
             $database->setQuery("select * from #__facileforms_records order by submitted Desc");
         }
     }
     $recs = $database->loadObjectList();
     if ($database->getErrorNum()) {
         echo $database->stderr();
         return false;
     }
     // if
     $xml = '<?xml version="1.0" encoding="utf-8" ?>' . nl() . '<FacileFormsExport type="records" version="' . $ff_version . '">' . nl() . indent(1) . '<exportdate>' . $date_file . '</exportdate>' . nl();
     $updIds = array();
     $form = '';
     for ($r = 0; $r < count($recs); $r++) {
         $rec = $recs[$r];
         if (version_compare($this->version, '3.2', '>=')) {
             $date_ = JFactory::getDate($rec->submitted, $this->tz);
             $offset = $date_->getOffsetFromGMT();
             if ($offset > 0) {
                 $date_->add(new DateInterval('PT' . $offset . 'S'));
             } else {
                 if ($offset < 0) {
                     $offset = $offset * -1;
                     $date_->sub(new DateInterval('PT' . $offset . 'S'));
                 }
             }
             $rec->submitted = $date_->format('Y-m-d H:i:s', true);
         }
         $updIds[] = $rec->id;
         $xml .= indent(1) . '<record id="' . $rec->id . '">' . nl() . indent(2) . '<submitted>' . $rec->submitted . '</submitted>' . nl() . indent(2) . '<user_id>' . $rec->user_id . '</user_id>' . nl() . indent(2) . '<username>' . htmlspecialchars($rec->username) . '</username>' . nl() . indent(2) . '<user_full_name>' . htmlspecialchars($rec->user_full_name) . '</user_full_name>' . nl() . indent(2) . '<form>' . $rec->form . '</form>' . nl() . indent(2) . '<title>' . htmlspecialchars($rec->title) . '</title>' . nl() . indent(2) . '<name>' . $rec->name . '</name>' . nl() . indent(2) . '<ip>' . $rec->ip . '</ip>' . nl() . indent(2) . '<browser>' . htmlspecialchars($rec->browser) . '</browser>' . nl() . indent(2) . '<opsys>' . htmlspecialchars($rec->opsys) . '</opsys>' . nl() . indent(2) . '<provider>' . $rec->provider . '</provider>' . nl() . indent(2) . '<viewed>' . $rec->viewed . '</viewed>' . nl() . indent(2) . '<exported>' . $rec->exported . '</exported>' . nl() . indent(2) . '<archived>' . $rec->archived . '</archived>' . nl() . indent(2) . '<pptxid>' . $rec->paypal_tx_id . '</pptxid>' . nl() . indent(2) . '<pppdate>' . $rec->paypal_payment_date . '</pppdate>' . nl() . indent(2) . '<pptestacc>' . $rec->paypal_testaccount . '</pptestacc>' . nl() . indent(2) . '<ppdltries>' . $rec->paypal_download_tries . '</ppdltries>' . nl();
         $database->setQuery("select subs.* from #__facileforms_subrecords As subs, #__facileforms_elements As els where els.id=subs.element And subs.record = {$rec->id} order by ordering");
         $subs = $database->loadObjectList();
         for ($s = 0; $s < count($subs); $s++) {
             $sub = $subs[$s];
             if ($sub->type == 'File Upload' && strpos(strtolower($sub->value), '{cbsite}') === 0) {
                 $out = '';
                 $nl = '';
                 $_values = explode("\n", str_replace("\r", '', $sub->value));
                 $length = count($_values);
                 $i = 0;
                 foreach ($_values as $_value) {
                     if ($i + 1 < $length) {
                         $nl = "\n";
                     } else {
                         $nl = '';
                     }
                     $out .= str_replace(array('{cbsite}', '{CBSite}'), array(JPATH_SITE, JPATH_SITE), $_value) . $nl;
                     $i++;
                 }
                 $sub->value = $out;
             }
             $xml .= indent(2) . '<subrecord id="' . $sub->id . '">' . nl() . indent(3) . '<element>' . $sub->element . '</element>' . nl() . indent(3) . '<name>' . $sub->name . '</name>' . nl() . indent(3) . '<title>' . htmlspecialchars($sub->title) . '</title>' . nl() . indent(3) . '<type>' . $sub->type . '</type>' . nl() . indent(3) . '<value>' . htmlspecialchars($sub->value) . '</value>' . nl() . indent(2) . '</subrecord>' . nl();
         }
         // for
         $xml .= indent(1) . '</record>' . nl();
     }
     // for
     $xml .= '</FacileFormsExport>' . nl();
     //$xmlname = JFile::makeSafe($xmlname);
     if (!JFile::write($xmlname, $xml)) {
         echo "<script> alert('" . addslashes(BFText::_('COM_BREEZINGFORMS_RECORDS_XMLNORWRTBL')) . "'); window.history.go(-1);</script>\n";
         exit;
     }
     // if
     if (isset($updIds[0])) {
         $updIds = implode(',', $updIds);
         $database->setQuery("update #__facileforms_records set exported=1 where id in ({$updIds})");
         $database->query();
     }
     @ob_end_clean();
     $_size = filesize($xmlname);
     $_name = basename($xmlname);
     @ini_set("zlib.output_compression", "Off");
     header("Pragma: public");
     header("Expires: 0");
     header("Cache-Control: private");
     header("Content-Type: application/octet-stream");
     header("Content-Disposition: attachment; filename={$_name}");
     header("Accept-Ranges: bytes");
     header("Content-Length: {$_size}");
     readfile($xmlname);
     exit;
 }
Example #25
0
function bool_select($value, $name)
{
    $true = '';
    $false = '';
    if ($value == false) {
        $false = ' selected ';
    } else {
        $true = ' selected ';
    }
    $out = '<select class="select" name="' . $name . '">' . nl();
    $out .= '   <option ' . $false . ' value="0">No</option>' . nl();
    $out .= '   <option ' . $true . ' value="1">Yes</option>' . nl();
    $out .= '</select>' . nl();
    return $out;
}
Example #26
0
function get_next_token(&$pos)
{
    global $last_type, $last_text;
    global $whitespace, $wordchar, $punct;
    global $input, $input_length;
    if (!$whitespace) {
        $whitespace = make_array("\n\r\t ");
    }
    if (!$wordchar) {
        $wordchar = make_array('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$');
    }
    if (!$punct) {
        $punct = explode(' ', '+ - * / % & ++ -- = += -= *= /= %= == === != !== > < >= <= >> << >>> >>>= >>= <<= && &= | || ! !! , : ? ^ ^= |=');
    }
    $n_newlines = 0;
    do {
        if ($pos >= $input_length) {
            return array('', TK_EOF);
        }
        $c = $input[$pos];
        $pos += 1;
        if ($c == "\n") {
            nl($n_newlines == 0);
            $n_newlines += 1;
        }
    } while (in_array($c, $whitespace));
    if (in_array($c, $wordchar)) {
        if ($pos < $input_length) {
            while (in_array($input[$pos], $wordchar)) {
                $c .= $input[$pos];
                $pos += 1;
                if ($pos == $input_length) {
                    break;
                }
            }
        }
        // small and surprisingly unugly hack for 1E-10 representation
        if ($pos != $input_length and preg_match('/^\\d+[Ee]$/', $c) and $input[$pos] == '-') {
            $pos += 1;
            list($next_word, $next_type) = get_next_token($pos);
            $c .= '-' . $next_word;
            return array($c, TK_WORD);
        }
        if ($c == 'in') {
            // hack for 'in' operator
            return array($c, TK_OPERATOR);
        }
        return array($c, TK_WORD);
    }
    if ($c == '(' || $c == '[') {
        return array($c, TK_START_EXPR);
    }
    if ($c == ')' || $c == ']') {
        return array($c, TK_END_EXPR);
    }
    if ($c == '{') {
        return array($c, TK_START_BLOCK);
    }
    if ($c == '}') {
        return array($c, TK_END_BLOCK);
    }
    if ($c == ';') {
        return array($c, TK_END_COMMAND);
    }
    if ($c == '/') {
        // peek for comment /* ... */
        if ($input[$pos] == '*') {
            $comment = '';
            $pos += 1;
            if ($pos < $input_length) {
                while (!($input[$pos] == '*' && isset($input[$pos + 1]) && $input[$pos + 1] == '/') && $pos < $input_length) {
                    $comment .= $input[$pos];
                    $pos += 1;
                    if ($pos >= $input_length) {
                        break;
                    }
                }
            }
            $pos += 2;
            return array("/*{$comment}*/", TK_BLOCK_COMMENT);
        }
        // peek for comment // ...
        if ($input[$pos] == '/') {
            $comment = $c;
            while ($input[$pos] != "\r" && $input[$pos] != "\n") {
                $comment .= $input[$pos];
                $pos += 1;
                if ($pos >= $input_length) {
                    break;
                }
            }
            $pos += 1;
            return array($comment, TK_COMMENT);
        }
    }
    if ($c == "'" || $c == '"' || $c == '/' && ($last_type == TK_WORD and $last_text == 'return' or $last_type == TK_START_EXPR || $last_type == TK_END_BLOCK || $last_type == TK_OPERATOR || $last_type == TK_EOF || $last_type == TK_END_COMMAND)) {
        // regexp
        $sep = $c;
        $c = '';
        $esc = false;
        if ($pos < $input_length) {
            while ($esc || $input[$pos] != $sep) {
                $c .= $input[$pos];
                if (!$esc) {
                    $esc = $input[$pos] == '\\';
                } else {
                    $esc = false;
                }
                $pos += 1;
                if ($pos >= $input_length) {
                    break;
                }
            }
        }
        $pos += 1;
        if ($last_type == TK_END_COMMAND) {
            nl();
        }
        return array($sep . $c . $sep, TK_STRING);
    }
    if (in_array($c, $punct)) {
        while ($pos < $input_length and in_array($c . $input[$pos], $punct)) {
            $c .= $input[$pos];
            $pos += 1;
            if ($pos >= $input_length) {
                break;
            }
        }
        return array($c, TK_OPERATOR);
    }
    return array($c, TK_UNKNOWN);
}