function SOWord($sAddr, $sPath, $sFile, &$sPage, $sUser = "", $sPassword = "") { $errmsg = ""; do { // Construct URL and grab page... // $sURL = "http://" . $sAddr . "/ext.dll?MfcISAPICommand=LoadPage&" . "page=doc.htx&a0=/get/" . $sPath . "/" . rawurlencode($sFile) . "&a1=_&a2=2048&a3=8&a4=1"; $errmsg = SOHTTPGet($sURL, &$sPage, $sUser, $sPassword); if (strlen($errmsg)) { break; } } while (0); return $errmsg; }
function SOInit($sAddr) { $errmsg = ""; do { // Just do a search for dummy data... this will kick off the // one-time load of the indexes. // $sURL = "http://" . $sAddr . "/ext.dll?MfcISAPICommand=LoadPage&page=search.htx&a0=xyzzy&a1=0&a2=1&a3=6"; $errmsg = SOHTTPGet($sURL, &$sPage, "", ""); if (strlen($errmsg)) { break; } } while (0); return $errmsg; }
function SOExcelUpdate($sAddr, $sPath, $sFile, $nSheet, $sUpdateCell, $sUpdateValue, $sUpdateType, $sUser = "", $sPassword = "") { $errmsg = ""; do { // Construct URL and grab page... // $nX = $nY = 1; $nDX = $nDY = 10; $sURL = "http://" . $sAddr . "/ext.dll?MfcISAPICommand=LoadPage&" . "page=xls.htx&a0=/get/" . $sPath . "/" . rawurlencode($sFile) . "&a1=" . $nSheet . "&a2=Update&" . "a3=" . $nX . "&a4=" . $nY . "&a5=" . $nDX . "&a6=" . $nDY . "&a7=2&a8=100%25&" . "a10=" . $sUpdateCell . "&a9=" . rawurlencode($sUpdateValue) . "/" . $sUpdateType; // echo("URL = $sURL <BR>"); $errmsg = SOHTTPGet($sURL, &$sPage, $sUser, $sPassword); if (strlen($errmsg)) { break; } } while (0); return $errmsg; }
function SOExcel($sAddr, $sPath, $sFile, $nSheet, &$aData, $sCellStart, $sCellEnd, $sUser = "", $sPassword = "") { $aData = array(); $nDX = 25; $nDY = 50; $errmsg = ""; do { // Convert cell addressing to numeric row/columns... // SOExcelCell2RowCol($sCellStart, $nXS, $nYS); SOExcelCell2RowCol($sCellEnd, $nXE, $nYE); // echo(" nXS= $nXS nYS= $nYS nXE= $nXE NYE= $nYE <BR>"); // Loop through by chunks until done. // for ($nY = $nYS; $nY <= $nYE; $nY += $nDY) { for ($nX = $nXS; $nX <= $nXE; $nX += $nDX) { // Construct URL and grab page... // $sURL = "http://" . $sAddr . "/ext.dll?MfcISAPICommand=LoadPage&" . "page=xls.htx&a0=/get/" . $sPath . "/" . rawurlencode($sFile) . "&a1=" . $nSheet . "&a2=_&" . "a3=" . $nX . "&a4=" . $nY . "&a5=" . $nDX . "&a6=" . $nDY . "&a7=2&a8=100%25"; $errmsg = SOHTTPGet($sURL, &$sPage, $sUser, $sPassword); if (strlen($errmsg)) { break; } $aColumns = array(); // Rip through first row of matrix to grab column labels. // for ($i = 0; $i < $nDX + 1; $i++) { $sTemp = "<TD class=fXH align=center>"; $nCursor = strpos($sPage, $sTemp); if ($nCursor === false) { $errmsg = "Invalid template file (1)"; break; } $nCursor += strlen($sTemp); if (!$i) { $sPage = substr($sPage, $nCursor + 2); continue; } $sColumn = substr($sPage, $nCursor, 2); if (($nCursor2 = strpos($sColumn, '<')) > 0) { $sColumn = substr($sColumn, 0, $nCursor2); } $aColumns[$i - 1] = $sColumn; $sPage = substr($sPage, $nCursor + 2); } if (strlen($errmsg)) { break; } // echo("Columns=".implode(", ", $aColumns)."<BR>"); // Rip through multiple rows of data... // for ($i = 0; $i < $nDY; $i++) { for ($j = 0; $j < $nDX; $j++) { $sTemp = "<TD class=fXL"; $nCursor = strpos($sPage, $sTemp); if ($nCursor === false) { $errmsg = "Invalid template file (2)"; break; } $nCursor += strlen($sTemp); $nCursor = strpos($sPage, ">", $nCursor); if ($nCursor === false) { $errmsg = "Invalid template file (3)"; break; } $nCursor++; // $sVal = substr($sPage, $nCursor, 255); if (($nCursor2 = strpos($sVal, '<')) > 0) { $sVal = substr($sVal, 0, $nCursor2); } // $sPage = substr($sPage, $nCursor + $nCursor2); $nTemp = $nY + $i + 1; settype($nTemp, "string"); $aData[$aColumns[$j] . $nTemp] = $sVal; // echo("Cell ".$aColumns[$j].$nTemp."= ".$sVal."<BR>"); } if (strlen($errmsg)) { break; } } // ...end loop through chunks. // } if (strlen($errmsg)) { break; } } } while (0); return $errmsg; }
function SOAccess($sAddr, $sPath, $sFile, $sTable, &$aData, $nRowStart, $nRows, $sUser = "", $sPassword = "") { $aData = array(); $errmsg = ""; do { // Construct URL and grab page... // $sURL = "http://" . $sAddr . "/ext.dll?MfcISAPICommand=LoadPage&" . "page=mdb.htx&a0=/get/" . $sPath . "/" . rawurlencode(trim($sFile)) . "&a1=" . rawurlencode(trim($sTable)) . "&a2=V&a3=&a4=" . $nRowStart . "&a8=" . $nRows . "&a9="; $errmsg = SOHTTPGet($sURL, &$sPage, $sUser, $sPassword); if (strlen($errmsg)) { break; } $aColumns = array(); // echo($sPage); // Rip through first row of matrix to grab column labels. // for ($i = 0; $i < 255; $i++) { $sTemp = "<td class=fXH align=center>"; $nCursor = strpos($sPage, $sTemp); if ($nCursor === false) { break; } $nCursor += strlen($sTemp); $sColumn = substr($sPage, $nCursor, 255); if (($nCursor2 = strpos($sColumn, '<')) > 0) { $sColumn = substr($sColumn, 0, $nCursor2); } $aColumns[$i] = strtolower($sColumn); $sPage = substr($sPage, $nCursor + 2); } if (strlen($errmsg)) { break; } if (!sizeof($aColumns)) { $errmsg = "Invalid template file (1)"; break; } // echo("Columns (".sizeof($aColumns).")=".implode(", ", $aColumns)."<BR>"); // Rip through multiple rows of data... // for ($i = 0; $i < $nRows; $i++) { for ($j = 0; $j < sizeof($aColumns); $j++) { $sTemp = "<td class=fXL"; $nCursor = strpos($sPage, $sTemp); if ($nCursor === false) { if (!$i) { $errmsg = "No more data found"; } break; } $nCursor += strlen($sTemp); $nCursor = strpos($sPage, ">", $nCursor); if ($nCursor === false) { $errmsg = "Invalid template file (3)"; break; } $nCursor++; // $sVal = substr($sPage, $nCursor, 255); if (($nCursor2 = strpos($sVal, '<')) > 0) { $sVal = substr($sVal, 0, $nCursor2); } // $sPage = substr($sPage, $nCursor + $nCursor2); $aData[$nY + $i][$aColumns[$j]] = $sVal; // echo("Val: ".($nY + $i).$aColumns[$j]."= ".$sVal."<BR>"); } if (strlen($errmsg)) { break; } } } while (0); return $errmsg; }