Beispiel #1
0
	function sort($option, $pkg, $form, $page)
	{
		$rows = _ff_select("select * from `#__facileforms_forms` where id = $form");
		$width = $height = 600;
		if (count($rows)) {
			$f = $rows[0];
			if ($f->widthmode ==0) $width  = $f->width;  else $width = $f->prevwidth;
			if ($f->heightmode==0) $height = $f->height;
			if ($width < 1) $width = 600;
			if ($height < 1) $height = 600;
		} // if
		$rows = _ff_select(
			"select id ".
			"from `#__facileforms_elements` ".
			"where form=$form and page=$page ".
			"order by ".
				"if(`type`='Hidden Input',1,0), ".
				"if(`type`='Hidden Input',0,if(posy<0,$height+if(posymode=0,posy,(posy*$height)/100),if(posymode=0,posy,(posy*$height)/100))), ".
				"if(`type`='Hidden Input',0,if(posx<0,$width+if(posxmode=0,posx,(posx*$width)/100),if(posxmode=0,posx,(posx*$width)/100))), ".
				"name, title, id"
		);
		$o = 1;
		if (count($rows)) foreach ($rows as $row) {
			_ff_query("update `#__facileforms_elements` set ordering=$o where id=$row->id");
			$o++;
		} // foreach
		JFactory::getApplication()->redirect(
			"index.php?option=$option&act=editpage&form=$form&page=$page&pkg=$pkg",
			BFText::_('COM_BREEZINGFORMS_ELEMENTS_SORTED'));
	} // save
Beispiel #2
0
	function dropPackage($id)
	{
		if ($this->hasErrors()) return;
		$this->oldscripts = _ff_select(
			"select id, name from #__facileforms_scripts where package =  '$id'"
		);
		$this->oldpieces = _ff_select(
			"select id, name from #__facileforms_pieces where package =  '$id'"
		);
		dropPackage($id); // the one in admin.facileforms.php
	} // dropPackage
Beispiel #3
0
	function instPackage($option, $caller, $pkg)
	{
		$rows = _ff_select(
			"select * from #__facileforms_packages where id != '' order by id"
		);
		HTML_facileFormsConf::instPackage($option, $caller, $pkg, $rows);
	} // instPackage
 static function sort($option, $pkg, $form, $page)
 {
     $rows = _ff_select("select * from `#__facileforms_forms` where id = " . JFactory::getDBO()->Quote($form));
     $width = $height = 600;
     if (count($rows)) {
         $f = $rows[0];
         if ($f->widthmode == 0) {
             $width = $f->width;
         } else {
             $width = $f->prevwidth;
         }
         if ($f->heightmode == 0) {
             $height = $f->height;
         }
         if ($width < 1) {
             $width = 600;
         }
         if ($height < 1) {
             $height = 600;
         }
     }
     // if
     $rows = _ff_select("select id " . "from `#__facileforms_elements` " . "where form=" . JFactory::getDBO()->Quote($form) . " and page=" . JFactory::getDBO()->Quote($page) . " " . "order by " . "if(`type`='Hidden Input',1,0), " . "if(`type`='Hidden Input',0,if(posy<0," . intval($height) . "+if(posymode=0,posy,(posy*" . intval($height) . ")/100),if(posymode=0,posy,(posy*" . intval($height) . ")/100))), " . "if(`type`='Hidden Input',0,if(posx<0," . intval($width) . "+if(posxmode=0,posx,(posx*" . intval($width) . ")/100),if(posxmode=0,posx,(posx*" . intval($width) . ")/100))), " . "name, title, id");
     $o = 1;
     if (count($rows)) {
         foreach ($rows as $row) {
             _ff_query("update `#__facileforms_elements` set ordering={$o} where id={$row->id}");
             $o++;
         }
     }
     // foreach
     JFactory::getApplication()->redirect("index.php?option={$option}&act=editpage&form={$form}&page={$page}&pkg={$pkg}", BFText::_('COM_BREEZINGFORMS_ELEMENTS_SORTED'));
 }
Beispiel #5
0
	function step3($option)
	{
		global $ff_admpath,$mainframe, $ff_config, $errors, $errmode;
		
		$instmode = intval(JRequest::getVar( 'ff_installmode', 1));
		$instsamp = intval(JRequest::getVar( 'ff_instsamples', 0));
                $instqmsamp = intval(JRequest::getVar( 'ff_instqmsamples', 0));
		$instold  = intval(JRequest::getVar( 'ff_instoldlib', 0));

		// list of sample forms before 1.4
		$sampleforms =
			"'SampleContactForm',".
			"'SampleCountrySelect',".
			"'SamplePaneNavigation',".
			"'SamplePizzaShop',".
			"'SampleEmbeddedCode',".
			"'SamplePieceApp',".
			"'RnrContestRegist',".
			"'RnrContestList'";

		// list of sample menus before 1.4
		$samplemenus =
			"'Facile Forms Sample Menu'";

		// list of sample scripts before 1.4
		$stdscripts =
			"'ff_anychecked',".
			"'ff_checked',".
			"'ff_countQuerySelections',".
			"'ff_getfocus',".
			"'ff_getQuerySelections',".
			"'ff_getQuerySelectedRows',".
			"'ff_integer_or_empty',".
			"'ff_nextpage',".
			"'ff_page1',".
			"'ff_page2',".
			"'ff_page3',".
			"'ff_previouspage',".
			"'ff_showaction',".
			"'ff_showelementinit',".
			"'ff_showforminit',".
			"'ff_showsubmitted',".
			"'ff_showvalidation',".
			"'ff_submittedhome',".
			"'ff_unchecked',".
			"'ff_validate_form',".
			"'ff_validate_nextpage',".
			"'ff_validate_page',".
			"'ff_validate_submit',".
			"'ff_validemail',".
			"'ff_valuenotempty'";

		// list of sample pieces before 1.4
		$stdpieces =
			"'ff_InitUtilities',".
			"'ff_SubmitUtilities',".
			"'ff_redirectParent',".
			"'ff_getPageByName',".
			"'ff_setSelected',".
			"'ff_setChecked',".
			"'ff_setValue'";

		// database update
		$sql_path = $ff_admpath.'/sql';
		$errors = array();
		$errmode = 'log';
		switch ($instmode) {
			case 0: // New install: create tables
				facileFormsInstaller::exec_sql($sql_path.'/create.sql');
				$ff_config = new facileFormsConfig();
				break;
			case 1: // Reinstall: no db change
				break;
			case 2: // Upgrade from 1.0.x
				facileFormsInstaller::exec_sql($sql_path.'/upgrade_1.1.sql');
			case 3: // Upgrade from 1.1.x
				facileFormsInstaller::exec_sql($sql_path.'/upgrade_1.2.sql');
			case 4: // Upgrade from 1.2.x
				facileFormsInstaller::exec_sql($sql_path.'/upgrade_1.3.sql');
			case 5: // Upgrade from 1.3.x
				facileFormsInstaller::exec_sql($sql_path.'/upgrade_1.4.sql');
			default:
				break;
		} // switch

		// get xref to old samples
		$oldscripts = NULL;
		$oldpieces = NULL;
		if ($instmode>=2 && $instmode<=5) { // upgrades until 1.4
			// get old xref tables
			$oldscripts = _ff_select("select id, name from #__facileforms_scripts where name in ($stdscripts)");
			$oldpieces = _ff_select("select id, name from #__facileforms_pieces where name in ($stdpieces)");
			// drop old std scripts & pieces
			_ff_query("delete from #__facileforms_scripts where name in ($stdscripts)");
			_ff_query("delete from #__facileforms_pieces where name in ($stdpieces)");
		} // if

		// call installer to load new std libraries
		$xmlfile = $ff_admpath.'/packages/stdlib.english.xml';

		$inst = new ff_importPackage();
		$inst->import($xmlfile);

		if (intval($instold) == 1) {
			// call installer to load backward compatibility library
			$xmlfile = $ff_admpath.'/packages/oldlib.english.xml';
			$inst->import($xmlfile);
		} // if

		
		if (intval($instsamp) == 1) {
			if ($instmode>=2 && $instmode<=5) { // upgrades until 1.4
				// drop old sample forms
				$rows = _ff_select("select id from #__facileforms_forms where name in ($sampleforms)");
				if (count($rows)) foreach ($rows as $row) {
					_ff_query("delete from #__facileforms_elements where form = $row->id");
					_ff_query("delete from #__facileforms_forms where id = $row->id");
				} // if

				// drop old sample menus
				$rows = _ff_select("select id from #__facileforms_compmenus where title in ($samplemenus)");
				if (count($rows)) foreach ($rows as $row)
					_ff_query("delete from #__facileforms_compmenus where id=$row->id or parent=$row->id");
			} // if

			// call installer to load new samples
			$xmlfile = $ff_admpath.'/packages/samples.english.xml';
			$inst->import($xmlfile);
		} // if

                if (intval($instqmsamp) == 1) {
                    $xmlfile = $ff_admpath.'/packages/quickmode.samples.xml';
                    if(file_exists($xmlfile)){
                        $inst->import($xmlfile);
                    }
                }

		// relink items refering to old scripts and pieces
		relinkScripts($oldscripts);
		relinkPieces($oldpieces);

		// adjust component menu
                jimport('joomla.version');
                $version = new JVersion();

                if(version_compare($version->getShortVersion(), '1.6', '>=')){

                    updateComponentMenus();

                    _ff_query(
                            "update #__menu set `alias` = 'BreezingForms' ".
                            "where `link`='index.php?option=com_breezingforms'"
                    );
                    _ff_query(
                            "update #__menu set `alias` = 'Manage Records', img='components/com_breezingforms/images/js/ThemeOffice/checkin.png' ".
                            "where `link`='index.php?option=com_breezingforms&act=managerecs'"
                    );
                    _ff_query(
                            "update #__menu set `alias` = 'Manage Backend Menus', img='components/com_breezingforms/images/js/ThemeOffice/mainmenu.png' ".
                            "where `link`='index.php?option=com_breezingforms&act=managemenus'"
                    );
                    _ff_query(
                            "update #__menu set `alias` = 'Manage Forms', img='components/com_breezingforms/images/js/ThemeOffice/content.png' ".
                            "where `link`='index.php?option=com_breezingforms&act=manageforms'"
                    );
                    _ff_query(
                            "update #__menu set `alias` = 'Manage Scripts', img='components/com_breezingforms/images/js/ThemeOffice/controlpanel.png' ".
                            "where `link`='index.php?option=com_breezingforms&act=managescripts'"
                    );
                    _ff_query(
                            "update #__menu set `alias` = 'Manage Pieces', img='components/com_breezingforms/images/js/ThemeOffice/controlpanel.png' ".
                            "where `link`='index.php?option=com_breezingforms&act=managepieces'"
                    );
                    _ff_query(
                            "update #__menu set `alias` = 'Integrator', img='components/com_breezingforms/images/js/ThemeOffice/controlpanel.png' ".
                            "where `link`='index.php?option=com_breezingforms&act=integrate'"
                    );
                    _ff_query(
                            "update #__menu set `alias` = 'Configuration', img='components/com_breezingforms/images/js/ThemeOffice/config.png' ".
                            "where `link`='index.php?option=com_breezingforms&act=configuration'"
                    );
                } else {
                    
                    _ff_query("update #__components set admin_menu_link='' where `option`='com_breezingforms' and parent=0");
                    updateComponentMenus();

                    // assign nice icons to facileforms
                    _ff_query(
                            "update #__components set admin_menu_img='components/com_breezingforms/images/js/ThemeOffice/checkin.png' ".
                            "where admin_menu_link='option=com_breezingforms&act=managerecs'"
                    );
                    _ff_query(
                            "update #__components set admin_menu_img='components/com_breezingforms/images/js/ThemeOffice/mainmenu.png' ".
                            "where admin_menu_link='option=com_breezingforms&act=managemenus'"
                    );
                    _ff_query(
                            "update #__components set admin_menu_img='components/com_breezingforms/images/js/ThemeOffice/content.png' ".
                            "where admin_menu_link='option=com_breezingforms&act=manageforms'"
                    );
                    _ff_query(
                            "update #__components set admin_menu_img='components/com_breezingforms/images/js/ThemeOffice/controlpanel.png' ".
                            "where admin_menu_link='option=com_breezingforms&act=managescripts'"
                    );
                    _ff_query(
                            "update #__components set admin_menu_img='components/com_breezingforms/images/js/ThemeOffice/controlpanel.png' ".
                            "where admin_menu_link='option=com_breezingforms&act=managepieces'"
                    );
                    _ff_query(
                            "update #__components set admin_menu_img='components/com_breezingforms/images/js/ThemeOffice/config.png' ".
                            "where admin_menu_link='option=com_breezingforms&act=integrate'"
                    );
                    _ff_query(
                            "update #__components set admin_menu_img='components/com_breezingforms/images/js/ThemeOffice/config.png' ".
                            "where admin_menu_link='option=com_breezingforms&act=configuration'"
                    );

                    // fix broken menuitems
                    $id = _ff_selectValue(
                            "select min(id) from #__components ".
                             "where `parent`=0 and `option`='com_breezingforms'"
                    );
                    if ($id)
                            _ff_query(
                                    "update #__menu ".
                                       "set componentid=$id, link='index.php?option=com_breezingforms' ".
                                     "where type='components' and params like 'ff_com_name=%'"
                            );
                }
                
		if ($ff_config->images == '{mossite}/administrator/components/com_breezingforms/images')
			$ff_config->images = '{mossite}/components/com_breezingforms/images';
		if ($ff_config->uploads == '{mospath}/administrator/components/com_breezingforms/uploads')
			$ff_config->uploads = '{mospath}/components/com_breezingforms/uploads';
		$ff_config->store();
		HTML_facileFormsInstaller::step3($option, $errors);
	} // step3
function dropPackage($id)
{
    // drop package settings
    _ff_query("delete from #__facileforms_packages where id = " . JFactory::getDBO()->Quote($id) . "");
    // drop backend menus
    $rows = _ff_select("select id from #__facileforms_compmenus where package = " . JFactory::getDBO()->Quote($id) . "");
    if (count($rows)) {
        foreach ($rows as $row) {
            _ff_query("delete from #__facileforms_compmenus where id={$row->id} or parent={$row->id}");
        }
    }
    updateComponentMenus();
    // drop forms
    $rows = _ff_select("select id from #__facileforms_forms where package = " . JFactory::getDBO()->Quote($id) . "");
    if (count($rows)) {
        foreach ($rows as $row) {
            _ff_query("delete from #__facileforms_elements where form = {$row->id}");
            _ff_query("delete from #__facileforms_forms where id = {$row->id}");
        }
    }
    // if
    // drop scripts
    _ff_query("delete from #__facileforms_scripts where package =  " . JFactory::getDBO()->Quote($id) . "");
    // drop pieces
    _ff_query("delete from #__facileforms_pieces where package =  " . JFactory::getDBO()->Quote($id) . "");
}
 function dropPackage($id)
 {
     if ($this->hasErrors()) {
         return;
     }
     $this->oldscripts = _ff_select("select id, name from #__facileforms_scripts where package =  " . JFactory::getDBO()->Quote($id) . "");
     $this->oldpieces = _ff_select("select id, name from #__facileforms_pieces where package =  " . JFactory::getDBO()->Quote($id) . "");
     dropPackage($id);
     // the one in admin.facileforms.php
 }
function dropPackage($id)
{
	// drop package settings
	_ff_query("delete from #__facileforms_packages where id = '$id'");

	// drop backend menus
	$rows = _ff_select("select id from #__facileforms_compmenus where package = '$id'");
	if (count($rows)) foreach ($rows as $row)
		_ff_query("delete from #__facileforms_compmenus where id=$row->id or parent=$row->id");
	updateComponentMenus();

	// drop forms
	$rows = _ff_select("select id from #__facileforms_forms where package = '$id'");
	if (count($rows)) foreach ($rows as $row) {
		_ff_query("delete from #__facileforms_elements where form = $row->id");
		_ff_query("delete from #__facileforms_forms where id = $row->id");
	} // if

	// drop scripts
	_ff_query("delete from #__facileforms_scripts where package =  '$id'");

	// drop pieces
	_ff_query("delete from #__facileforms_pieces where package =  '$id'");
} // dropPackage