コード例 #1
0
 private function setupFX_Impl($layoutName, $recordCount, $user, $password)
 {
     $fx = new FX($this->dbSettings->getDbSpecServer(), $this->dbSettings->getDbSpecPort(), $this->dbSettings->getDbSpecDataType(), $this->dbSettings->getDbSpecProtocol());
     $fx->setCharacterEncoding('UTF-8');
     $fx->setDBUserPass($user, $password);
     $fx->setDBData($this->dbSettings->getDbSpecDatabase(), $layoutName, $recordCount);
     return $fx;
 }
コード例 #2
0
ファイル: BackupMain.php プロジェクト: hapebe/filecopy
 function run()
 {
     if (!FX::endsWith('/', $this->srcDir)) {
         $this->srcDir .= '/';
     }
     if (!FX::endsWith('/', $this->dstDir)) {
         $this->dstDir .= '/';
     }
     if (!FX::endsWith('/', $this->archiveDir)) {
         $this->archiveDir .= '/';
     }
     if (!FX::endsWith('/', $this->delDir)) {
         $this->delDir .= '/';
     }
     if (!$this->checkFileSystems()) {
         return FALSE;
     }
     clearstatcache();
     // enter recursion:
     $this->backup_dir($this->srcDir, "copy");
     $totalCopyChecks = $this->totalChecks;
     // reverse check backup'ed files for deletion:
     $this->backup_dir($this->dstDir, "reverseCheck");
     // check DB entries, whether they are excluded now (archived and deleted files):
     $this->checkDatabase();
     $msg = "Insgesamt " . number_format($this->totalBytes, 0, ";", ".") . " Bytes in " . $this->totalFiles . " Dateien gesichert, " . $totalCopyChecks . " Dateien überprüft.";
     $e = new FileCopyMessage($msg, 'ADMIN');
     echo $msg . "\n";
     $msg = "Insgesamt " . number_format($this->totalDelBytes, 0, ";", ".") . " Bytes in " . $this->totalDelFiles . " Dateien wurden gelöscht / verschoben.";
     $e = new FileCopyMessage($msg, 'ADMIN');
     echo $msg . "\n";
     return TRUE;
 }
コード例 #3
0
ファイル: TemplateUTF8.php プロジェクト: hapebe/filecopy
 function fill($params)
 {
     if (!$this->valid) {
         FX::errlog(__FILE__ . '@' . __LINE__ . ': TemplateUTF8 ist !valid!');
         return false;
     }
     $retval = array();
     $this->success = true;
     foreach ($this->components as $component) {
         list($t, $idx) = explode(":", $component);
         if ($t == "string") {
             $retval[] = $this->strings[$idx];
         }
         if ($t == "var") {
             if (isset($params[$this->vars[$idx]])) {
                 $retval[] = $params[$this->vars[$idx]];
             } else {
                 $this->success = false;
                 FX::errlog(__FILE__ . '@' . __LINE__ . ', ' . $_SERVER["PHP_SELF"] . ': unset param "' . $this->vars[$idx] . '"', 'W');
             }
         }
     }
     // echo FX::toHtmlTable($retval, true);
     $retval = implode("", $retval);
     // echo FX::toHtmlTable($retval, true);
     return $retval;
 }
コード例 #4
0
ファイル: FileCopyMessage.php プロジェクト: hapebe/filecopy
 function __construct($msg, $severity = '!', $filename = FALSE)
 {
     global $LNK;
     if ($severity == '!' && $severity != 'ERROR') {
         FX::errlog($msg, $severity);
     }
     $meldung = mysql_escape_string($msg);
     $klasse = 'INFO';
     if ($severity == '!') {
         $klasse = 'ERROR';
     }
     if ($severity == 'ERROR') {
         $klasse = 'ERROR';
     }
     if ($severity == 'NOTICE') {
         $klasse = 'NOTICE';
     }
     if ($severity == 'WARN') {
         $klasse = 'WARNING';
     }
     if ($severity == 'WARNING') {
         $klasse = 'WARNING';
     }
     if ($severity == 'ADMIN') {
         $klasse = 'ADMIN';
     }
     $datei = '';
     if ($filename !== FALSE) {
         $datei = mysqli_escape_string($LNK, $filename);
     }
     $sql = "INSERT DELAYED INTO reports (klasse, meldung, datei, datum)" . " VALUES ('" . $klasse . "', '" . $meldung . "', '" . $datei . "', NOW() )";
     $result = @mysqli_query($LNK, $sql);
     if (!$result) {
         FX::errlog(__FILE__ . "@" . __LINE__ . ": " . mysqli_error($LNK) . " ( SQL = " . $sql . ")");
         return FALSE;
     }
 }
コード例 #5
0
 function doQuery($action)
 {
     if (strlen(trim($this->FX->dataServer)) < 1) {
         return new FX_Error('No MySQL server specified.');
     }
     if (strlen(trim($this->FX->dataPort)) > 0) {
         $tempServer = $this->FX->dataServer . ':' . $this->FX->dataPort;
     } else {
         $tempServer = $this->FX->dataServer;
     }
     $mysql_res = @mysql_connect($tempServer, $this->FX->DBUser, $this->FX->DBPassword);
     // although username and password are optional for this function, FX.php expects them to be set
     if ($mysql_res == false) {
         return new FX_Error('Unable to connect to MySQL server.');
     }
     if ($action != '-dbopen') {
         if (!mysql_select_db($this->FX->database, $mysql_res)) {
             return new FX_Error('Unable to connect to specified MySQL database.');
         }
     }
     if (substr_count($action, '-db') == 0 && substr_count($action, 'names') == 0 && strlen(trim($this->FX->layout)) > 0) {
         $theResult = mysql_query('SHOW COLUMNS FROM ' . $this->FX->layout);
         if (!$theResult) {
             return new FX_Error('Unable to access MySQL column data: ' . mysql_error());
         }
         $counter = 0;
         $keyPrecedence = 0;
         while ($tempRow = mysql_fetch_assoc($theResult)) {
             $this->FX->fieldInfo[$counter]['name'] = $tempRow['Field'];
             $this->FX->fieldInfo[$counter]['type'] = $tempRow['Type'];
             $this->FX->fieldInfo[$counter]['emptyok'] = $tempRow['Null'];
             $this->FX->fieldInfo[$counter]['maxrepeat'] = 1;
             $this->FX->fieldInfo[$counter]['extra'] = $tempRow['Key'] . ' ' . $tempRow['Extra'];
             if ($this->FX->fuzzyKeyLogic) {
                 if (strlen(trim($this->FX->primaryKeyField)) < 1 || $keyPrecedence < 3) {
                     if (substr_count($this->FX->fieldInfo[$counter]['extra'], 'UNI ') > 0 && $keyPrecedence < 3) {
                         $this->FX->primaryKeyField = $this->FX->fieldInfo[$counter]['name'];
                         $keyPrecedence = 3;
                     } elseif (substr_count($this->FX->fieldInfo[$counter]['extra'], 'auto_increment') > 0 && $keyPrecedence < 2) {
                         $this->FX->primaryKeyField = $this->FX->fieldInfo[$counter]['name'];
                         $keyPrecedence = 2;
                     } elseif (substr_count($this->FX->fieldInfo[$counter]['extra'], 'PRI ') > 0 && $keyPrecedence < 1) {
                         $this->FX->primaryKeyField = $this->FX->fieldInfo[$counter]['name'];
                         $keyPrecedence = 1;
                     }
                 }
             }
             ++$counter;
         }
     }
     switch ($action) {
         case '-dbopen':
         case '-dbclose':
             return new FX_Error('Opening and closing MySQL databases not available.');
             break;
         case '-delete':
         case '-edit':
         case '-find':
         case '-findall':
         case '-findany':
         case '-new':
             if ($action == '-findany') {
                 $this->FX->dataQuery = 'SELECT ' . ($this->FX->selectColsSet ? $this->FX->selectColumns : '*') . " FROM {$this->FX->layout} ORDER BY RAND() LIMIT 1;";
             } else {
                 $this->FX->dataQuery = $this->BuildSQLQuery($action);
                 if (FX::isError($this->FX->dataQuery)) {
                     return $this->FX->dataQuery;
                 }
             }
         case '-sqlquery':
             // note that there is no preceding break, as we don't want to build a query
             $theResult = mysql_query($this->FX->dataQuery);
             if ($theResult === false) {
                 return new FX_Error('Invalid query: ' . mysql_error());
             } elseif ($theResult !== true) {
                 if (substr_count($action, '-find') > 0 || substr_count($this->FX->dataQuery, 'SELECT ') > 0) {
                     $this->FX->foundCount = mysql_num_rows($theResult);
                 } else {
                     $this->FX->foundCount = mysql_affected_rows($theResult);
                 }
                 if ($action == '-dup' || $action == '-edit') {
                     // pull in data on relevant record
                 }
                 $currentKey = '';
                 while ($tempRow = mysql_fetch_assoc($theResult)) {
                     foreach ($tempRow as $key => $value) {
                         if ($this->FX->useInnerArray) {
                             $tempRow[$key] = array($value);
                         }
                         if ($key == $this->FX->primaryKeyField) {
                             $currentKey = $value;
                         }
                     }
                     if ($this->FX->genericKeys || $this->FX->primaryKeyField == '') {
                         $this->FX->currentData[] = $tempRow;
                     } else {
                         $this->FX->currentData[$currentKey] = $tempRow;
                     }
                 }
             } else {
                 $this->FX->currentData = array();
             }
             break;
         case '-dup':
             break;
     }
     $this->FX->fxError = 0;
     return true;
 }
コード例 #6
0
ファイル: displayFXDataset.php プロジェクト: SmartPCGuy/fxphp
<?php

// '<?' or '<?php' tells PHP to start parsing
/*********************************************************************
 * The comments herein are designed to be helpful to someone with    *
 * little or no programming experience.  To that end, many of the    *
 * comments may address things will appear obvious to many coders.   *
 * For the most part I'll place my comments at the end of each line. *
 * Feel free to e-mail any comments or questions to FX@iviking.org.  *
 * Please remember that this code is being released as open source   *
 * under The Artistic License of PERL fame...                        *
 * http://www.opensource.org/licenses/artistic-license.html          *
 *...and is also covered by the FX.php license addendum...           *
 * http://www.iviking.org/downloads/ADDENDUM.txt                     *
 *********************************************************************/
include_once $_SERVER['DOCUMENT_ROOT'] . "/FX/FX.php";
// FX.php contains the class for pulling data
// from FileMaker into PHP -- 'include_once()'
// makes sure the class is only declared once.
include_once $_SERVER['DOCUMENT_ROOT'] . "/FX/server_data.php";
// To make sure that these examples work for you, be sure
// to set the IP address of your server in server_data.php
// IMPORTANT: The leading '$' denotes a variable in PHP
$DatasetQuery = new FX($serverIP, $webCompanionPort, $dataSourceType);
// This line creates an instance of the FX class
$DatasetQuery->SetDBData("Book_List.fp5", "Detail_View", 2);
// The '->' indicates that SetDBData is part of
// the FX instance we just created.
$DatasetQuery->FMSkipRecords(2);
$BookData = $DatasetQuery->FMFindAll();
?>
コード例 #7
0
 function doQuery($action)
 {
     $availableActions = array('-delete', '-edit', '-find', '-findall', '-new', '-sqlquery');
     if (!in_array(strtolower($action), $availableActions)) {
         // first off, toss out any requests for actions NOT supported under ODBC
         return new FX_Error("The action requested ({$action}) is not supported under ODBC via FX.php.");
     }
     $odbc_res = odbc_connect($this->FX->database, $this->FX->DBUser, $this->FX->DBPassword);
     // although username and password are optional for this function, FX.php expects them to be set
     if ($odbc_res == false) {
         return new FX_Error('Unable to connect to ODBC data source.');
     }
     switch ($action) {
         case '-delete':
         case '-edit':
         case '-find':
         case '-findall':
         case '-new':
             $this->FX->dataQuery = $this->BuildSQLQuery($action);
             if (FX::isError($this->FX->dataQuery)) {
                 return $this->FX->dataQuery;
             }
         case '-sqlquery':
             // note that there is no preceding break, as we don't want to build a query
             $odbc_result = odbc_exec($odbc_res, $this->FX->dataQuery);
             if (!$odbc_result) {
                 $tempErrorText = odbc_errormsg($odbc_res);
                 odbc_close($odbc_res);
                 return new FX_Error("Unsuccessful query: {$this->FX}->dataQuery ({$tempErrorText})");
             }
             $this->FX->foundCount = odbc_num_rows($odbc_result);
             $fieldCount = odbc_num_fields($odbc_result);
             if ($theResult < 0) {
                 $tempErrorText = odbc_errormsg($odbc_res);
                 odbc_close($odbc_res);
                 return new FX_Error("Unable to access field count for current ODBC query.  ({$tempErrorText})");
             }
             $odbc_columns = odbc_columns($odbc_res);
             if (!$odbc_columns) {
                 $tempErrorText = odbc_errormsg($odbc_res);
                 odbc_close($odbc_res);
                 return new FX_Error("Unable to retrieve column data via ODBC.  ({$tempErrorText})");
             }
             while (odbc_fetch_row($odbc_columns)) {
                 $fieldNumber = odbc_result($odbc_columns, 'ORDINAL_POSITION');
                 $this->FX->fieldInfo[$fieldNumber]['name'] = odbc_result($odbc_columns, 'COLUMN_NAME');
                 $this->FX->fieldInfo[$fieldNumber]['type'] = odbc_result($odbc_columns, 'TYPE_NAME');
                 $this->FX->fieldInfo[$fieldNumber]['emptyok'] = odbc_result($odbc_columns, 'IS_NULLABLE');
                 $this->FX->fieldInfo[$fieldNumber]['maxrepeat'] = 1;
                 $this->FX->fieldInfo[$fieldNumber]['extra'] = 'COLUMN_SIZE:' . odbc_result($odbc_columns, 'COLUMN_SIZE') . '|BUFFER_LENGTH:' . odbc_result($odbc_columns, 'BUFFER_LENGTH') . '|NUM_PREC_RADIX:' . odbc_result($odbc_columns, 'NUM_PREC_RADIX');
             }
             while (odbc_fetch_row($odbc_result)) {
                 $tempRow = array();
                 for ($i = 1; $i <= $fieldCount; ++$i) {
                     $theResult = odbc_result($odbc_result, $i);
                     if (!$this->FX->useInnerArray) {
                         $tempRow[$this->FX->fieldInfo[$i]['name']] = $theResult;
                     } else {
                         $tempRow[$this->FX->fieldInfo[$i]['name']] = array($theResult);
                     }
                     if ($this->FX->fieldInfo[$i]['name'] == $this->FX->primaryKeyField) {
                         $currentKey = $theResult;
                     }
                 }
                 if ($this->FX->genericKeys || $this->FX->primaryKeyField == '') {
                     $this->FX->currentData[] = $tempRow;
                 } else {
                     $this->FX->currentData[$currentKey] = $tempRow;
                 }
             }
             break;
         default:
             return new FX_Error("The action requested ({$action}) is not supported by FileMaker under ODBC via FX.php.");
             break;
     }
     $this->FX->fxError = 0;
     return true;
 }
コード例 #8
0
function findSeminars($args = false, $webArgs = false) {
	$sixWeeksFromToday = time() + (60 * 60 * 24 * 7 * 6);
	$dateRange = date('n/j/Y').'...'.date('n/j/Y', $sixWeeksFromToday);
	
	$fm = new FX();
	$fm->SetDBData('meyerSeminar', 'xsl_calendar');
	if($args) {
		foreach($args as $arg) {
			$fm->AddDBParam('KEY', $arg);
		}
		$fm->AddDBParam('-lop', 'or');
	} else {
		$fm->AddDBParam('isOpen', 1);
		$fm->AddDBParam('seminarTopic::isWebinar', 'yes', 'neq');
	}
//	$fm->AddDBParam('startDate', $dateRange);
	
	
	$fm->AddSortParam('venue::territory', 'regions');
	$fm->AddSortParam('startDate', 'ascend');
	$queryResult = $fm->FMFind();  
	if(FX::isError($queryResult)) $cache_this->errorCatch();
	$calendar = $queryResult['data'];
	
	
	// get Webinars
	
	$fm->SetDBData('meyerSeminar', 'xsl_calendar');
	if($webArgs) {
		foreach($webArgs as $arg) {
			$webinar_keys = $_REQUEST['ids_for_'.$arg];
			foreach($webinar_keys as $key) {
				$fm->AddDBParam('KEY', $key);
			}
		}
		$fm->AddDBParam('-lop', 'or');
	} else {
		$fm->AddDBParam('isOpen', 1);
		$fm->AddDBParam('seminarTopic::isWebinar', 'yes', 'eq');
	}
//	$fm->AddDBParam('startDate', $dateRange);
	
	$fm->AddSortParam('startDate', 'ascend');
	$fm->AddSortParam('startTime', 'ascend');
	$queryResult = $fm->FMFind();  
	if(FX::isError($queryResult)) $cache_this->errorCatch();
	if($queryResult['foundCount'] > 0) $webinars = $queryResult['data'];
	
	
	$region = '';
	$lastRegion = '';
	
	if(!$args) {
		$output = '<form action="upcoming_seminars.php" method="post">
								<input type="hidden" name="_do" value="process" />';
	}
	
	
	// seminars loop
	
	foreach($calendar as $recID => $data) {
		// 2 column design.  This $col keeps track of which column we are on, so we can know when to open/close table rows
		$col = (($col == 1)?2:1);
		$region = $data['venue::territory'][0];

		//HTML Output Variables
		$regionHTML = '
					<tr>
						<td colspan="3" align="center" height="50" style="line-height:21px;">
							<div></div>
						</td>
					</tr>
					<tr>
						<td colspan="3">
							<table cellspacing="0" cellpadding="0" border="0" class="text_wrap">
								<tr>
									<td colspan="1" style="font-size:20px;line-height:28px;" class="cat_header">
										<span style="font-family:Arial,sans-serif;font-weight:bold;color:#558ac8;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing: grayscale;">'.$region.'</span>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan="3" align="center" height="20" style="line-height:21px;">
							<div style="border-top:1px solid #558ac8;" id="seminars_underline"></div>
						</td>
					</tr>
					<tr>
						<td colspan="3" align="center" height="20" style="line-height:21px;">
							<div></div>
						</td>
					</tr>
					<tr>
						<td align="center" valign="top">';
		$padding = 	'<tr><td colspan="3" align="center" height="40" style="line-height:21px;" class="seminars_pad"><div></div></td></tr>';
		$leftCol = '<tr><td align="center" valign="top"><table cellpadding="0" cellspacing="0" border="0" width="210" align="left" class="stories_cont">' . '<tr><td colspan="2" align="center">';
		$rightCol = '<table cellpadding="0" cellspacing="0" border="0" width="210" align="right" class="stories_cont"><tr><td colspan="2" align="center">';
		$openSem = '<table cellpadding="0" cellspacing="0" border="0" class="seminars_text"><tr><td colspan="1" valign="top" style="font-size:18px;line-height:25px;" class="seminars_align">';

		// split things up by region
		if(!$region || $region != $lastRegion) {
			// different case for the first row
			if($lastRegion) {
				// if row was unfinished, finish it
				if($col == 2) {
					$output .= '<td>&nbsp;</td></tr>';
					$col = 1;
				}
				// close previous section, make divider
				$output .= '
					</td>
				</tr>';
			}
			
			// open new seminar block (REPLACED)
			$output .= $regionHTML;
		}
		
		
		//open a new row
		if($col == 1) {
			$output .= $leftCol;
		}
		if($col == 2) {
			$output .= $rightCol;
		}
		// the meat of the seminars
		$id = $data['KEY'][0];
		$regLink = (($data['Cvent_link'][0])?$data['Cvent_link'][0]:'http://www.meyersound.com/seminars/registration.php?id='.$id);
		$language = '('.str_replace(array('(',')'),'',$data['web_language'][0]).')';
		$output .= $openSem;
		if(!$args) {
			$output .= '<input type="checkbox" name="selectedSeminars[]" class="seminarSelect" value="'.$id.'">';
		}
		$output .= '
										<a href="'.$regLink.'" style="font-family:Arial,sans-serif;font-weight:normal;color:#5d6e83;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;text-decoration:none;" class="tagline">'.$data['venue::friendlyLocation'][0].'</a> 
									</td>
								</tr>
								<tr>
									<td colspan="1" valign="top" style="font-size:14px;line-height:21px;" class="seminars_align">
										<span style="font-family:Arial, sans-serif;font-weight:normal;color:#0f4dbc;text-decoration:none;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;" class="description">'.$data['friendlyDate'][0].'</span>
									</td>
								</tr>
								<tr>
									<td colspan="1" valign="top" style="font-size:14px;line-height:21px;" class="seminars_align">
										<span style="font-family:Arial, sans-serif;font-weight:normal;color:#51667c;text-decoration:none;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;" class="description">'.$data['seminarTopic::friendlyName'][0].' '.(($region != 'North America')?$language:'').'</span>
									</td>
								</tr>
						</table>
					</td>
				</tr>
			</table>';
		if($col == 2){
			$output .= '</td></tr>' .$padding;
		}			
		$lastRegion = $region;
		
	}// End Foreach Loop	
	
	// close last region:
	//$output .= '
				//		</table>
			//		</td>
			//	</tr>';
	// open new divider if there are webinars	to display
	if($webinars) {
		$output .= '
				<tr>
						<td class="w448" style="font-size: 11px; line-height: 22px; padding: 0px 35px; vertical-align: top;">
							<p class="left" style="margin: 2px 0px; float: left;"><img src="http://www.meyersound.com/mail/seminar_images/short-hr.gif" alt="" style="border: none;" /></p>
						</td>
				</tr>
				<tr>
						<td class="w448" style="font-size: 11px; line-height: 22px; padding: 0px 35px; vertical-align: top;">

							<p class="left" style="margin: 5px 0px; float: left;"><span class="mh1 blue normal" style="font-size: 14px; font-weight: normal; color: #3a4e7f;">Webinars</span></p>						</td>
					</tr>
					<tr>
						<td class="w448" style="font-size: 11px; line-height: 22px; padding: 0px 35px; vertical-align: top;">
							<table cellspacing="0" border="0" cellpadding="0" width="100%">';
	
		$col = 0;
		// webinars loop
		// first loop through and group webinars by the same date, and format so multiple webinars on one day gets one entry
		// webinars are put into an array, keyed by dateKey (seminar date and topic ID)
		foreach($webinars as $recID => $data) {
			
			// the meat of the seminars
			$id = $data['KEY'][0];
			$regLink = (($data['Cvent_link'][0])?$data['Cvent_link'][0]:'http://www.meyersound.com/seminars/registration.php?id='.$id);
			$language = '('.str_replace(array('(',')'),'',$data['web_language'][0]).')';
			
			$dateKey = str_replace(' ','_',str_replace(',','',$data['friendlyDate'][0]).'-'.$data['seminarTopic::KEY'][0]);
			
			$web[$dateKey]['courseName'] = str_replace('Webinar - ','',$data['seminarTopic::friendlyName'][0]).' '.(($region != 'North America')?$language:'');
			$web[$dateKey]['date'] = $data['friendlyDate'][0];
			//$web[$data['friendlyDate'][0]]['topicKey'] = $data['seminarTopic::KEY'][0];
			
			$web[$dateKey]['time'][$id] = '<a href="'.$regLink.'" style="font-size: 11px; color: #555656; text-decoration: none;">Register for '.formatFMTime($data['startTime'][0]).' PST</a>';
			
		}
		
		foreach($web as $dateKey => $data) {
			// 2 column design.  This $col keeps track of which column we are on, so we can know when to open/close table rows
			$col = (($col == 1)?2:1);
			
			//open a new row
			if($col == 1) {
				$output .= '<tr>';
			}
			
			// the meat of the seminars
			$id = $data['KEY'][0];
			$regLink = (($data['Cvent_link'][0])?$data['Cvent_link'][0]:'http://www.meyersound.com/seminars/registration.php?id='.$id);
			$language = '('.str_replace(array('(',')'),'',$data['web_language'][0]).')';
			
			$output .= '
								<td style="vertical-align: top;">';
			if(!$args) {
				// each webinar has 1 or more distinct course IDs for different times
				// make one checkbox for this course (by date+key, replacing commas and spaces w/ underscores
				//$dateKey = str_replace(' ','_',str_replace(',','',$data['date']).'-'.$data['topicKey']);
				$output .= '<input type="checkbox" name="selectedWebinars[]" class="seminarSelect" value="'.$dateKey.'">';
				foreach($data['time'] as $key => $time) {
					$output .= '<input type="hidden" name="ids_for_'.$dateKey.'[]" value="'.$key.'">';
				}
			}
			$output .= '
									<ul class="seminar" style="margin: 0px; list-style: none; line-height: normal; padding: 0px 0px 20px 0px; width: 224px;">
										<li class="sloc" style="font-weight: bold; font-size: 12px; color: #555656;">
											'.str_replace('(1 hour)', '', $data['courseName']).'
											
										</li>
										<li class="sdate" style="font-size: 11px; color: #3a4e7f;">'.$data['date'].'</li>';
			foreach($data['time'] as $key => $time) {
				$output .= '<li class="sinfo" style="font-size: 11px; width: 150px;">'.$time.'</li>';
			}
			$output .= '
									</ul> 
								</td>';
										
			if($col == 2) {
				$output .= '</tr>';
			}
			
			
		}	
		// close last row
		$output .= '		</table>
						</td>
					</tr>';
	} // end if webinars	
	if(!$args) {
		$output .= '
						<tr>
					<td><input type="submit" value="submit">
				</form>
			</td>
		</tr>';
	}
	
	return $output;
}
コード例 #9
0
Another part of this struggle is how many fields are put on the layout used in the XML RPC query,
the math of bandwidth distribution is simple it follows the principles of the multilplication table.

The more fields and the bigger then content, the slower the query.

For the purpose of bandwidth distribution it is not desirable to make the total space more narrow than it already is.


A typical real world example below
*/
$tmpStaticFile = 'http://www.example.com/xml/order/' . $o . '.fmpxmlresult.xml';
if (uriexists($tmpStaticFile)) {
    $q = new FX($tmpStaticFile);
    $q->FMFOpenQuery(true);
} else {
    $q = new FX($dinnerForOne, $sandeman);
    $q->SetDBData('WorldWideWait', 'xmlOrderStatusFlag');
    $q->AddDBParam('ordernumber', $_POST['ordernumber'], 'eq');
    $q->SetDBPassword($xmlPass, $xmlUser);
}
$r = $q->FMFind();
/*

uriexists implementation below:
*/
function uriexists($uri)
{
    // $o = output
    // $e = error code
    // $ch = cURL handler
    $ch = curl_init($uri);
コード例 #10
0
<?php

// '<?' or '<?php' tells PHP to start parsing
/*********************************************************************
 * The comments herein are designed to be helpful to someone with    *
 * little or no programming experience.  To that end, many of the    *
 * comments may address things will appear obvious to many coders.   *
 * For the most part I'll place my comments at the end of each line. *
 * Feel free to e-mail any comments or questions to FX@iviking.org.  *
 * Please remember that this code is being released as open source   *
 * under The Artistic License of PERL fame...                        *
 * http://www.opensource.org/licenses/artistic-license.html          *
 *...and is also covered by the FX.php license addendum...           *
 * http://www.iviking.org/downloads/ADDENDUM.txt                     *
 *********************************************************************/
include_once $_SERVER['DOCUMENT_ROOT'] . "/FX/FX.php";
// FX.php contains the class for pulling data
// from FileMaker into PHP -- 'include_once()'
// makes sure the class is only declared once.
include_once $_SERVER['DOCUMENT_ROOT'] . "/FX/server_data.php";
// To make sure that these examples work for you, be sure
// to set the IP address of your server in server_data.php
// IMPORTANT: The leading '$' denotes a variable in PHP
$DatasetQuery = new FX($serverIP, $webCompanionPort, $dataSourceType);
// This line creates an instance of the FX class
$DatasetQuery->SetDBUserPass($webUN, $webPW);
$DatasetQuery->SetDBData('Tester', 'Main_View');
$LayoutData = $DatasetQuery->FMView();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
コード例 #11
0
 private function setupFX_Impl($layoutName, $recordCount, $user, $password)
 {
     $fxPath = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'FX';
     $fxFiles = array('FX.php', 'datasource_classes' . DIRECTORY_SEPARATOR . 'RetrieveFM7Data.class.php');
     foreach ($fxFiles as $fxFile) {
         $path = $fxPath . DIRECTORY_SEPARATOR . $fxFile;
         if (is_file($path) && is_readable($path)) {
             require_once $path;
         } else {
             // If FX.php isn't installed in valid directories, it shows error message and finishes.
             throw new Exception('Data Access Class "FileMaker_FX" of INTER-Mediator requires ' . basename($fxFile) . ' on any right directory.');
         }
     }
     $fxObj = new FX($this->dbSettings->getDbSpecServer(), $this->dbSettings->getDbSpecPort(), $this->dbSettings->getDbSpecDataType(), $this->dbSettings->getDbSpecProtocol());
     $fxObj->setCharacterEncoding('UTF-8');
     $fxObj->setDBUserPass($user, $password);
     $fxObj->setDBData($this->dbSettings->getDbSpecDatabase(), $layoutName, $recordCount);
     return $fxObj;
 }
コード例 #12
0
ファイル: inspect.php プロジェクト: hapebe/filecopy
    // erwartet einen Parameter in der Form: dateFrom=2007-12-12+08:00:00 , dateTo=2007-12-19+20:59:59
    $timeStampFrom = FX::parseDBDate(str_replace("+", " ", $d0));
    $timeStampTo = FX::parseDBDate(str_replace("+", " ", $d1));
    echo "Dateien, auf die zwischen den Daten " . FX::makeDBDate($timeStampFrom) . " und " . FX::makeDBDate($timeStampTo) . " schreibend zugegriffen wurde.\n";
    $sql = "SELECT path, fname, mtime FROM files WHERE " . "(mtime > '" . FX::makeDBDate($timeStampFrom) . "') " . " AND (mtime < '" . FX::makeDBDate($timeStampTo) . "') " . " AND (status='C')" . " ORDER BY mtime DESC;";
    $result = @mysqli_query($LNK, $sql);
    if (!$result) {
        errlog(__FILE__ . "@" . __LINE__ . ": " . mysqli_error($LNK) . " ( SQL = " . $sql . ")");
    }
    while ($row = mysqli_fetch_assoc($result)) {
        extract($row);
        echo $path . "/" . $fname . " [" . $mtime . "]" . "\n";
    }
}
if (isset($sameName)) {
    echo "Dateien mit dem Namen " . FX::html_encode($sameName) . " existieren in den Verzeichnissen:\n";
    $sql = "SELECT path, size FROM files WHERE fname LIKE '" . mysqli_escape_string($LNK, $sameName) . "' AND status='C';";
    $result = @mysqli_query($LNK, $sql);
    if (!$result) {
        errlog(__FILE__ . "@" . __LINE__ . ": " . mysqli_error($LNK) . " ( SQL = " . $sql . ")");
    }
    while ($row = mysqli_fetch_assoc($result)) {
        echo $row["path"] . " [" . $row["size"] . " bytes]" . "\n";
    }
}
if (isset($largeFiles)) {
    $sql = "SELECT path, fname, size FROM files WHERE size > (100 * 1048000) AND status='C'";
    if (isset($ext)) {
        $sql .= " AND extension LIKE '" . mysqli_escape_string($LNK, $ext) . "'";
    }
    $sql .= " ORDER BY size DESC;";
コード例 #13
0
 function doQuery($action)
 {
     $connectString = '';
     $unsupportedActions = array('-dbnames', '-layoutnames', '-scriptnames', '-dbopen', '-dbclose');
     if (in_array($action, $unsupportedActions)) {
         return new FX_Error("The requested Action ({$action}) is not supported in PostgreSQL via FX.php.");
     }
     if (strlen(trim($this->FX->dataServer)) > 0) {
         $connectString .= " host={$this->FX->dataServer}";
     }
     if (strlen(trim($this->FX->dataPort)) > 0) {
         $connectString .= " port={$this->FX->dataPort}";
     }
     if (strlen(trim($this->FX->database)) > 0) {
         $connectString .= " dbname={$this->FX->database}";
     }
     if (strlen(trim($this->FX->DBUser)) > 0) {
         $connectString .= " user={$this->FX->DBUser}";
     }
     if (strlen(trim($this->FX->DBPassword)) > 0) {
         $connectString .= " password={$this->FX->DBPassword}";
     }
     if (strlen(trim($this->FX->urlScheme)) > 0 && $this->FX->urlScheme == 'https') {
         $connectString .= " sslmode=require";
     }
     $postresql_res = @pg_connect($connectString);
     if ($postresql_res == false) {
         return new FX_Error("Unable to connect to PostgreSQL server. (" . pg_last_error($postresql_res) . ")");
     }
     $theResult = pg_query($postresql_res, "SELECT column_name, data_type, is_nullable FROM information_schema.columns WHERE table_name ='{$this->FX->layout}'");
     if (!$theResult) {
         return new FX_Error('Unable to access PostgreSQL column data: ' . pg_last_error($postresql_res));
     }
     $counter = 0;
     $keyPrecedence = 0;
     while ($tempRow = @pg_fetch_array($theResult, $counter, PGSQL_ASSOC)) {
         $this->FX->fieldInfo[$counter]['name'] = $tempRow['column_name'];
         $this->FX->fieldInfo[$counter]['type'] = $tempRow['data_type'];
         $this->FX->fieldInfo[$counter]['emptyok'] = $tempRow['is_nullable'];
         $this->FX->fieldInfo[$counter]['maxrepeat'] = 1;
         ++$counter;
     }
     switch ($action) {
         case '-delete':
         case '-edit':
         case '-find':
         case '-findall':
         case '-new':
             $this->FX->dataQuery = $this->BuildSQLQuery($action);
             if (FX::isError($this->FX->dataQuery)) {
                 return $this->FX->dataQuery;
             }
         case '-sqlquery':
             // note that there is no preceding break, as we don't want to build a query
             $theResult = pg_query($this->FX->dataQuery);
             if (!$theResult) {
                 return new FX_Error('Invalid query: ' . pg_last_error($postresql_res));
             }
             if (substr_count($action, '-find') > 0 || substr_count($this->FX->dataQuery, 'SELECT ') > 0) {
                 $this->FX->foundCount = pg_num_rows($theResult);
             } else {
                 $this->FX->foundCount = pg_affected_rows($theResult);
             }
             if ($action == '-dup' || $action == '-edit') {
                 // pull in data on relevant record
             }
             $counter = 0;
             $currentKey = '';
             while ($tempRow = @pg_fetch_array($theResult, $counter, PGSQL_ASSOC)) {
                 foreach ($tempRow as $key => $value) {
                     if ($this->FX->useInnerArray) {
                         $tempRow[$key] = array($value);
                     }
                     if ($key == $this->FX->primaryKeyField) {
                         $currentKey = $value;
                     }
                 }
                 if ($this->FX->genericKeys || $this->FX->primaryKeyField == '') {
                     $this->FX->currentData[] = $tempRow;
                 } else {
                     $this->FX->currentData[$currentKey] = $tempRow;
                 }
                 ++$counter;
             }
             break;
         case '-findany':
             break;
         case '-dup':
             break;
     }
     $this->FX->fxError = 0;
     return true;
 }
コード例 #14
0
ファイル: index-fx.php プロジェクト: nojimage/fxphp
/* Modified by Masayuki Nii (2004/3/23), for Japanese language supporting. */
/* Modified by Masayuki Nii (2004/8/13), for adding Japanese field name support. */
/* Modified by Masayuki Nii (2004/9/4), for UTF-8. */
header('Content-Type: text/html;charset=utf-8');
// Added by msyk 2004/3/23
// For avoiding MOJI-BAKE( invalid character ), please saving this file by UTF-8 chacter set.
// このファイルはUTF-8で保存して利用してください。
include_once 'FX/FX.php';
// FX_charset.php contains the class for pulling data
// from FileMaker into PHP -- 'include_once()'
// makes sure the class is only declared once.
include_once 'server_data.php';
// To make sure that these examples work for you, be sure
// to set the IP address of your server in server_data.php
// IMPORTANT: The leading '$' denotes a variable in PHP
$BookQuery = new FX($serverIP, $webCompanionPort, 'FMPro7');
// This line creates an instance of the FX class
// If you use version 6 pro/unlimited, modify to 'FMPro5/6' from 'FMPro7'.
$BookQuery->SetDBData("Book_List.fp7", "Detail_View");
// The '->' indicates that SetDBData is part of the FX instance we just created.
$arrayName = 'HTTP_' . $HTTP_SERVER_VARS["REQUEST_METHOD"] . '_VARS';
// Note the '$$' a couple of lines down.  I'm using a variable
// whose name is the contents of another variable.  VERY handy.
// **** Added by msyk 2004/3/23 **** To make a new record in DB.
if (${$arrayName}['currentQuery'] == 'New Record') {
    foreach ($HTTP_POST_VARS as $key => $value) {
        if ($key != 'currentQuery' && $key != 'currentSort') {
            $BookQuery->AddDBParam($key, stripslashes($value));
        }
    }
    $BookQuery->FMNew();
コード例 #15
0
<?php

// '<?' or '<?php' tells PHP to start parsing
/*********************************************************************
 * The comments herein are designed to be helpful to someone with    *
 * little or no programming experience.  To that end, many of the    *
 * comments may address things will appear obvious to many coders.   *
 * For the most part I'll place my comments at the end of each line. *
 * Feel free to e-mail any comments or questions to FX@iviking.org.  *
 * Please remember that this code is being released as open source   *
 * under The Artistic License of PERL fame...                        *
 * http://www.opensource.org/licenses/artistic-license.html          *
 *...and is also covered by the FX.php license addendum...           *
 * http://www.iviking.org/downloads/ADDENDUM.txt                     *
 *********************************************************************/
include_once $_SERVER['DOCUMENT_ROOT'] . "/FX/FX.php";
// FX.php contains the class for pulling data
// from FileMaker into PHP -- 'include_once()'
// makes sure the class is only declared once.
include_once $_SERVER['DOCUMENT_ROOT'] . "/FX/server_data.php";
// To make sure that these examples work for you, be sure
// to set the IP address of your server in server_data.php
// IMPORTANT: The leading '$' denotes a variable in PHP
$DatasetQuery = new FX($serverIP, $webCompanionPort, $dataSourceType);
// This line creates an instance of the FX class
$DatasetQuery->SetDBData('Book_List.fp5');
$LayoutData = $DatasetQuery->FMLayoutNames();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
コード例 #16
0
ファイル: fx_tester.php プロジェクト: SmartPCGuy/fxphp
    // by placing the form values in an array, we can set all values for our search with a single function call
    $searchRecordsArray = array('First_Namer' => $_POST['fname'], 'Last_Name' => $_POST['lname'], 'Phone_1 ' => $_POST['phone']);
    // configure a connection to FileMaker Server Advanced
    $contactsListQuery = new FX($serverIP, $webCompanionPort, $dataSourceType);
    // set database and layout information
    $contactsListQuery->SetDBData('Contacts.fp7', 'web_list');
    // set database username and password
    $contactsListQuery->SetDBUserPass($webUN, $webPW);
    // add parameter array for new record
    $contactsListQuery->AddDBParamArray($searchRecordsArray);
    // create a new record
    $contactsList = $contactsListQuery->DoFXAction('perform_find');
} else {
    // otherwise, find all records
    // configure a connection to FileMaker Server Advanced
    $contactsListQuery = new FX($serverIP, $webCompanionPort, $dataSourceType);
    // set database and layout information
    $contactsListQuery->SetDBData('Contacts.fp7', 'web_list', 'all');
    // set database username and password
    $contactsListQuery->SetDBUserPass($webUN, $webPW);
    // retrieve all records in this database available to the current user
    $contactsList = $contactsListQuery->DoFXAction('show_all');
}
?>
<html>
    <head>
        <title>FX Error Tester</title>
    </head>
    <body>
        <h1>Contact List</h1>
        <table border="1">
コード例 #17
0
ファイル: FX.php プロジェクト: hapebe/filecopy
 /**
  * @return all UTF8 characters of $s EXCEPT FOR if they are within special ranges (Chinese characters)
  */
 static function noChineseChars($s, $enc = 'UTF-8')
 {
     $retval = '';
     $len = mb_strlen($s);
     for ($i = 0; $i < $len; $i++) {
         $c = mb_substr($s, $i, 1, $enc);
         $code = FX::mbOrd($c);
         if ($code >= 0x4e00 && $code <= 0x9fff) {
             continue;
         } elseif ($code >= 0x4e00 && $code <= 0x9fff) {
             continue;
         } elseif ($code >= 0x3400 && $code <= 0x4dff) {
             continue;
         } elseif ($code >= 0x20000 && $code <= 0x2a6df) {
             continue;
         } elseif ($code >= 0x2f800 && $code <= 0x2fa1f) {
             continue;
         }
         $retval .= $c;
     }
     return $retval;
 }
コード例 #18
0
ファイル: UTF8Spreadsheet.php プロジェクト: hapebe/filecopy
 function getRowByName($paramName)
 {
     if (!$this->has_rownames) {
         FX::errlog("UTF8Spreadsheet->getRowByName({$paramName}): trying, although !{$this->has_rownames}");
         return false;
     }
     foreach ($this->rownames as $idx => $rowName) {
         if ($paramName == $rowName) {
             return $idx;
         }
     }
     //not found - error!
     return false;
 }
コード例 #19
0
ファイル: index.php プロジェクト: SmartPCGuy/fxphp
    $_SERVER['DOCUMENT_ROOT'] = str_replace(str_replace('\\\\', '/', $_SERVER['PHP_SELF']), '', str_replace('\\\\', '/', $_SERVER['PATH_TRANSLATED'])) . '/';
    $DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
    $HTTP_SERVER_VARS['DOCUMENT_ROOT'] = $_SERVER['DOCUMENT_ROOT'];
}
# END MICROSOFT IIS TWEAKS
# Grab the FMErrors file for dynamic error reporting
require_once $_SERVER['DOCUMENT_ROOT'] . "/FX/Developer/FMErrors.php";
######## !!! Welcome to PHP, the FX.php Class and the FX Parser !!!! ###########
#  	BEGINNING OF USER CODE HERE
#  	This area is for you to change so the FileMaker query matches your own query.
#  	Use the FX Class documentation for understanding more about this process...
#
#  	To make the FX class work, the FX folder must be at the root level of your
#  	site, and you must INCLUDE the FX class into this page like this:
require_once $_SERVER['DOCUMENT_ROOT'] . "/FX/FX.php";
#  	You start your query by creating a new instance of an FX Class and assigning
#  	it to a variable.
$query = new FX(your_serverIP, 80, 'FMPro7');
#  	Using the same variable call the SetDBPassword (if necessary) using the pass-
#  	word and username that has the fmxml extended privilege.
$query->SetDBPassword(your_password, your_username);
#  	Using the new variable $query, call the SetDBData function, specifying which
#	FMP file, layout and how many you want in the returned set (this example
#	shows how to limit the result record set to 3).
$query->SetDBData(your_fm7File, your_layout, 3);
#  	Using the same variable call the AddDBParam to specify your serach criteria,
#  	passing it the field name and the match content (you can repeat this function
# 	as many times as you wish to add find requests).
$query->AddDBParam(your_fieldname, your_find_criteria);
#  	If you want to sort the result, us the AddSortParam  function and specify  the
#  	field and  the direction  (ascend/descend) of  your sort (you can repeat this
コード例 #20
0
<?php

// '<?' or '<?php' tells PHP to start parsing
/*********************************************************************
 * The comments herein are designed to be helpful to someone with    *
 * little or no programming experience.  To that end, many of the    *
 * comments may address things will appear obvious to many coders.   *
 * For the most part I'll place my comments at the end of each line. *
 * Feel free to e-mail any comments or questions to FX@iviking.org.  *
 * Please remember that this code is being released as open source   *
 * under The Artistic License of PERL fame...                        *
 * http://www.opensource.org/licenses/artistic-license.html          *
 *...and is also covered by the FX.php license addendum...           *
 * http://www.iviking.org/downloads/ADDENDUM.txt                     *
 *********************************************************************/
include_once $_SERVER['DOCUMENT_ROOT'] . "/FX/FX.php";
// FX.php contains the class for pulling data
// from FileMaker into PHP -- 'include_once()'
// makes sure the class is only declared once.
include_once $_SERVER['DOCUMENT_ROOT'] . "/FX/server_data.php";
// To make sure that these examples work for you, be sure
// to set the IP address of your server in server_data.php
// IMPORTANT: The leading '$' denotes a variable in PHP
$DatasetQuery = new FX($serverIP, $webCompanionPort, $dataSourceType);
// This line creates an instance of the FX class
$DatabaseData = $DatasetQuery->FMDBNames();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <title>iViking FX -- Database List Dataset Example Page</title>
コード例 #21
0
 function doQuery($action)
 {
     // Note that because of the way in which CAFEphp and FileMaker are implemented, CAFEphp must be running on the same
     // machine that is serving as the web server.  (You'll note that PHP creates a COM object which looks for a locally
     // running application.)  For this same reason, the server IP and port are irrelevant.
     $availableActions = array('-delete', '-edit', '-find', '-findall', '-new', '-sqlquery');
     if (!in_array(strtolower($action), $availableActions)) {
         // first off, toss out any requests for actions NOT supported under CAFEphp
         return new FX_Error("The action requested ({$action}) is not supported in CAFEphp.");
     }
     $CAFEphp_res = new COM('CAFEphp.Application');
     // although username and password are optional for this function, FX.php expects them to be set
     if ($CAFEphp_res == false) {
         return new FX_Error('Unable to load to CAFEphp.');
     }
     if (defined("DEBUG") and DEBUG or DEBUG_FUZZY) {
         $currentDebugString = "<p>CAFEphp version: " . $CAFEphp_res->Version() . "</p>\n";
         $this->FX->lastDebugMessage .= $currentDebugString;
         if (defined("DEBUG") and DEBUG) {
             echo $currentDebugString;
         }
     }
     $theResult = $CAFEphp_res->Connect($this->FX->database, $this->FX->DBUser, $this->FX->DBPassword);
     if ($theResult != 0) {
         $CAFEphp_res->EndConnection();
         switch ($theResult) {
             case -1:
                 return new FX_Error('Unable to connect.  Be sure the FileMaker database and CAFEphp are running.');
                 break;
             case -2:
                 return new FX_Error('Certificate not present.  You MUST have a certificate.');
                 break;
             case -3:
                 return new FX_Error('Certificate is corrupt.');
                 break;
             case -4:
                 return new FX_Error('CAFEphp is not running or the demo version has expired.');
                 break;
             case -5:
                 return new FX_Error('The current demo of CAFEphp has expired.');
                 break;
             default:
                 return new FX_Error('An unknown error has occured while attempting to create the COM object.');
                 break;
         }
     }
     switch ($action) {
         case '-delete':
         case '-edit':
         case '-find':
         case '-findall':
         case '-new':
             $this->FX->dataQuery = $this->BuildSQLQuery($action);
             if (FX::isError($this->FX->dataQuery)) {
                 return $this->FX->dataQuery;
             }
         case '-sqlquery':
             // note that there is no preceding break, as we don't want to build a query
             if (substr(trim($this->FX->dataQuery), 0, 6) == 'SELECT') {
                 $currentSelect = true;
                 $theResult = $CAFEphp_res->Query($this->FX->dataQuery, $this->FX->groupSize);
             } else {
                 $currentSelect = false;
                 $theResult = $CAFEphp_res->Execute($this->FX->dataQuery);
             }
             if ($theResult < 0) {
                 $CAFEphp_res->EndConnection();
                 switch ($theResult) {
                     case -1:
                         return new FX_Error('No CAFEphp connection for the query.');
                         break;
                     default:
                         return new FX_Error('An unknown error occured during the query.');
                         break;
                 }
             }
             $this->FX->foundCount = $theResult;
             $theResult = $CAFEphp_res->FieldCount();
             if ($theResult < 0) {
                 $CAFEphp_res->EndConnection();
                 switch ($theResult) {
                     case -1:
                         return new FX_Error('No CAFEphp connection for the field count.');
                         break;
                     case -2:
                         return new FX_Error('No query was performed for a field count.');
                         break;
                     default:
                         return new FX_Error('An unknown error occured during the query.');
                         break;
                 }
             } else {
                 $currentFieldCount = $theResult;
             }
             for ($i = 0; $i < $currentFieldCount; ++$i) {
                 $theResult = $CAFEphp_res->FieldName($i);
                 if ($theResult == '$-CAFEphpNOCONNECTION') {
                     $CAFEphp_res->EndConnection();
                     return new FX_Error("No CAFEphp connection while retieving the name of field {$i}.");
                 } elseif ($theResult == '$-CAFEphpNOQUERY') {
                     $CAFEphp_res->EndConnection();
                     return new FX_Error("CAFEphp returned a \"No Query\" error while retieving the name of field {$i}.");
                 } elseif ($theResult == '$-CAFEphpUNKNOWNERROR') {
                     $CAFEphp_res->EndConnection();
                     return new FX_Error("CAFEphp returned an unknown error while retieving the name of field {$i}.");
                 }
                 $this->FX->fieldInfo[$i]['name'] = $theResult;
                 $this->FX->fieldInfo[$i]['type'] = 'NO DATA';
                 $this->FX->fieldInfo[$i]['emptyok'] = 'NO DATA';
                 $this->FX->fieldInfo[$i]['maxrepeat'] = 'NO DATA';
                 $this->FX->fieldInfo[$i]['extra'] = '';
             }
             if ($currentSelect) {
                 $tempRow = array();
                 for ($i = 0; $i < $this->FX->foundCount; ++$i) {
                     for ($j = 0; $j < $currentFieldCount; ++$j) {
                         $theResult = $CAFEphp_res->FieldValue($j);
                         if ($theResult == '$-CAFEphpNOCONNECTION') {
                             $CAFEphp_res->EndConnection();
                             return new FX_Error("No CAFEphp connection while retieving the value of field {$i} for record {$j}.");
                         } elseif ($theResult == '$-CAFEphpNOQUERY') {
                             $CAFEphp_res->EndConnection();
                             return new FX_Error("CAFEphp returned a \"No Query\" error while retieving the value of field {$i} for record {$j}.");
                         } elseif ($theResult == '$-CAFEphpUNKNOWNERROR') {
                             $CAFEphp_res->EndConnection();
                             return new FX_Error("CAFEphp returned an unknown error while retieving the value of field {$i} for record {$j}.");
                         }
                         if (!$this->FX->useInnerArray) {
                             $tempRow[$this->FX->fieldInfo[$j]['name']] = $theResult;
                         } else {
                             $tempRow[$this->FX->fieldInfo[$j]['name']] = array($theResult);
                         }
                         if ($this->FX->fieldInfo[$j]['name'] == $this->FX->primaryKeyField) {
                             $currentKey = $value;
                         }
                     }
                     if ($this->FX->genericKeys || $this->FX->primaryKeyField == '') {
                         $this->FX->currentData[] = $tempRow;
                     } else {
                         $this->FX->currentData[$currentKey] = $tempRow;
                     }
                     $theResult = $CAFEphp_res->MoveNext();
                     if ($theResult < 0) {
                         $CAFEphp_res->EndConnection();
                         $next = $i + 1;
                         switch ($theResult) {
                             case -1:
                                 return new FX_Error('No CAFEphp connection while moving from record {$i} to {$next}.');
                                 break;
                             case -2:
                                 return new FX_Error('There was no current query while moving from record {$i} to {$next}.');
                                 break;
                             default:
                                 return new FX_Error('An unknown error occured while moving from record {$i} to {$next}.');
                                 break;
                         }
                     }
                 }
             }
             break;
         default:
             return new FX_Error("The action requested ({$action}) is not supported in CAFEphp.");
             break;
     }
     $this->FX->fxError = 0;
     return true;
 }
コード例 #22
0
ファイル: dbo_fmcakemix.php プロジェクト: nojimage/FMCakeMix
 /**
  * handleFXResult
  * 
  * logs queries, logs errors, and returns false on error
  * 
  * @param FX result object or FX error object
  * @param string : model name
  * @param string : action name
  * 
  * @return false if result is an FX error object
  */
 function handleFXResult($result, $modelName = 'N/A', $actionName = 'N/A')
 {
     $this->_queriesCnt++;
     // if a connection error
     if (FX::isError($result)) {
         // log error
         $this->_queriesLog[] = array('model' => $modelName, 'action' => $actionName, 'query' => '', 'error' => $result->toString(), 'numRows' => '', 'took' => round((getMicrotime() - $this->timeFlag) * 1000, 0));
         if (count($this->_queriesLog) > $this->_queriesLogMax) {
             array_pop($this->_queriesLog);
         }
         CakeLog::write('error', $this->formatErrorMessage('FX Error', $result->toString(), $modelName, $actionName));
         $this->timeFlag = getMicrotime();
         return FALSE;
         // if a filemaker error other than no records found
     } elseif ($result['errorCode'] != 0 && $result['errorCode'] != 401) {
         // log error
         $this->_queriesLog[] = array('model' => $modelName, 'action' => $actionName, 'query' => substr($result['URL'], strrpos($result['URL'], '?')), 'error' => $result['errorCode'], 'numRows' => '', 'took' => round((getMicrotime() - $this->timeFlag) * 1000, 0));
         if (count($this->_queriesLog) > $this->_queriesLogMax) {
             array_pop($this->_queriesLog);
         }
         CakeLog::write('error', $this->formatErrorMessage('FileMaker Error', $result['errorCode'], $modelName, $actionName, substr($result['URL'], strrpos($result['URL'], '?'))));
         $this->timeFlag = getMicrotime();
         return FALSE;
     } else {
         // log query
         $this->_queriesLog[] = array('model' => $modelName, 'action' => $actionName, 'query' => substr($result['URL'], strrpos($result['URL'], '?')), 'error' => $result['errorCode'], 'numRows' => isset($result['data']) ? count($result['data']) : $result['foundCount'], 'took' => round((getMicrotime() - $this->timeFlag) * 1000, 0));
         $this->timeFlag = getMicrotime();
         return TRUE;
     }
 }
コード例 #23
0
ファイル: index.php プロジェクト: SmartPCGuy/fxphp
}
if (!isset($FXE_groupSize) || strlen(trim($FXE_groupSize)) == 0) {
    $FXE_groupSize = 2;
}
if (!isset($FXE_action) || strlen(trim($FXE_action)) == 0) {
    $FXE_action = 'display';
}
if (!isset($FXE_username) || strlen(trim($FXE_username)) == 0) {
    $FXE_username = '';
}
if (!isset($FXE_password) || strlen(trim($FXE_password)) == 0) {
    $FXE_password = '';
}
if (fopen("http://{$FXE_FMServerIP}:{$FXE_FMWCPort}/", 'r')) {
    $errorMessage = 'No valid Database specified.';
    $FXQuery = new FX($FXE_FMServerIP, $FXE_FMWCPort, $dataSourceType);
    // This line creates an instance of the FX class.
    $DatabaseData = $FXQuery->FMDBNames();
    // The '->' indicates that SetDBData is part of
    // the FX instance we just created.
    if (FX::isError($DatabaseData)) {
        echo "<pre>\n";
        print_r($LayoutData);
        echo "</pre>\n";
        exit;
    }
    foreach ($DatabaseData['data'] as $key => $value) {
        $currentDatabaseList[] = $value['DATABASE_NAME'][0];
    }
    unset($DatabaseData);
    if (in_array($FXE_currentDatabaseName, $currentDatabaseList)) {
コード例 #24
0
ファイル: detail-fx.php プロジェクト: nojimage/fxphp
 * http://www.opensource.org/licenses/artistic-license.html		  *
 *********************************************************************/
/* Modified by Masayuki Nii (2004/8/13), for adding Japanese field name support. */
header('Content-Type: text/html;charset=utf-8');
// Added by msyk 2004/8/13
// For avoiding MOJI-BAKE( invalid character ), please saving this file by UTF-8 chacter set.
// このファイルはUTF-8で保存して利用してください。
include_once 'FX/FX.php';
// FX_charset.php contains the class for pulling data
// from FileMaker into PHP -- 'include_once()'
// makes sure the class is only declared once.
include_once 'server_data.php';
// To make sure that these examples work for you, be sure
// to set the IP address of your server in server_data.php
// IMPORTANT: The leading '$' denotes a variable in PHP
$BookQuery = new FX($serverIP, $webCompanionPort, 'FMPro7');
// This line creates an instance of the FX class
// If you use version 6 pro/unlimited, modify to 'FMPro5/6' from 'FMPro7'.
$BookQuery->SetDBData("Book_List", "Detail_View");
// The '->' indicates that SetDBData is part of the FX instance we just created.
$BookQuery->AddDBParam('-recid', $HTTP_GET_VARS['ID']);
// '-recid' is a reference to the unique ID that FileMaker
// creates for each record.  You'll also note that PHP
// recognizes the parameters passed from the last page ('ID').
$query = $HTTP_GET_VARS['query'];
$BookData = $BookQuery->FMFind();
$currentKey = key($BookData['data']);
// From the online PHP manual:
// key() returns the index element of the current array position
// This is ideal in our case since the outer array has one element.
?>
コード例 #25
0
 function doQuery($action)
 {
     $availableActions = array('-delete', '-edit', '-find', '-findall', '-new', '-sqlquery');
     $columnTypes = array(1 => 'char', 2 => 'integer', 3 => 'float', 4 => 'long', 5 => 'money', 6 => 'date', 7 => 'time', 8 => 'object', 9 => 'datetime', 10 => 'longlong', 11 => 'boolean', 12 => 'binary', 13 => 'text', 14 => 'timestamp');
     if (!in_array(strtolower($action), $availableActions)) {
         // first off, toss out any requests for actions NOT supported under OpenBase
         return new FX_Error("The action requested ({$action}) is not supported by OpenBase via FX.php.");
     }
     // although username and password are optional for this function, FX.php expects them to be set
     $openBase_res = ob_connect($this->FX->database, $this->FX->dataServer, $this->FX->DBUser, $this->FX->DBPassword);
     if (substr(trim($openBase_res), 0, 13) != 'Resource id #') {
         return new FX_Error("Error {$theResult}.  Unable to connect to OpenBase database.");
     }
     switch ($action) {
         case '-delete':
         case '-edit':
         case '-find':
         case '-findall':
         case '-new':
             $this->FX->dataQuery = $this->BuildSQLQuery($action);
             if (FX::isError($this->FX->dataQuery)) {
                 return $this->FX->dataQuery;
             }
         case '-sqlquery':
             // note that there is no preceding break, as we don't want to build a query
             ob_makeCommand($openBase_res, $this->FX->dataQuery);
             $theResult = ob_executeCommand($openBase_res);
             if (!$theResult) {
                 $tempErrorText = ob_servermessage($openBase_res);
                 ob_disconnect($openBase_res);
                 // ob_disconnect() is not in the documentation
                 return new FX_Error("Unsuccessful query: {$this->FX->dataQuery} ({$tempErrorText})");
             }
             $fieldCount = ob_resultColumnCount($openBase_res);
             for ($i = 0; $i < $fieldCount; ++$i) {
                 $this->FX->fieldInfo[$i]['name'] = ob_resultColumnName($openBase_res, $i);
                 $this->FX->fieldInfo[$i]['type'] = ob_resultColumnType($openBase_res, $i);
                 $this->FX->fieldInfo[$i]['emptyok'] = 'NO DATA';
                 $this->FX->fieldInfo[$i]['maxrepeat'] = 1;
                 $this->FX->fieldInfo[$i]['extra'] = '';
             }
             $this->FX->foundCount = ob_rowsAffected($openBase_res);
             $retrieveRow = array();
             $currentKey = '';
             while (ob_resultReturned($openBase_res) && ob_nextRowWithArray($openBase_res, $retrieveRow)) {
                 $tempRow = array();
                 foreach ($retrieveRow as $key => $value) {
                     if (!$this->FX->useInnerArray) {
                         $tempRow[$this->FX->fieldInfo[$key]['name']] = $value;
                     } else {
                         $tempRow[$this->FX->fieldInfo[$key]['name']] = array($value);
                     }
                     if ($key == $this->FX->primaryKeyField) {
                         $currentKey = $value;
                     } elseif ($this->FX->primaryKeyField == '' && $this->FX->fieldInfo[$key]['name'] == '_rowid') {
                         $currentKey = $value;
                     }
                 }
                 if (($this->FX->genericKeys || $this->FX->primaryKeyField == '') && strlen(trim($currentKey)) < 1) {
                     $this->FX->currentData[] = $tempRow;
                 } else {
                     $this->FX->currentData[$currentKey] = $tempRow;
                 }
             }
             break;
         default:
             return new FX_Error("The action requested ({$action}) is not supported by OpenBase via FX.php.");
             break;
     }
     $this->FX->fxError = 0;
     return true;
 }
コード例 #26
0
ファイル: FX.php プロジェクト: nojimage/FileMaker-Todo-App
 function FMDBClose()
 {
     $queryResult = $this->ExecuteQuery("-dbclose");
     if (FX::isError($queryResult)) {
         return $queryResult;
     }
 }
コード例 #27
0
ファイル: BackupFile.php プロジェクト: hapebe/filecopy
 function findByName($fpath, $fname)
 {
     global $LNK;
     $fileid = FALSE;
     if (FX::endsWith('/', $fpath)) {
         $fpath = substr($fpath, 0, -1);
     }
     $sql = "SELECT fileid FROM files WHERE path LIKE '" . mysqli_escape_string($LNK, $fpath) . "' AND fname LIKE '" . mysqli_escape_string($LNK, $fname) . "';";
     $result = @mysqli_query($LNK, $sql);
     if (!$result) {
         $e = new FileCopyMessage(__FILE__ . "@" . __LINE__ . ": " . mysqli_error($LNK) . " ( SQL = " . $sql . ")");
     }
     if ($row = mysqli_fetch_assoc($result)) {
         $fileid = $row["fileid"];
     }
     return $fileid;
 }