function createOutput($records, $sql, $description) { //Report Number and Name echo "<h3>" . $description . "</h3>"; echo "SQL Statement:"; echo "<p class='sqlStatement'> " . formatSQL($sql) . "</p>"; echo "<br>"; //Get Size of Data Array //get row count $row = sizeof($records); //get column count /*Count Recursive counts all elements in the array, But every row in the array has a title and data row thats why you have to divide with 2 and then divide with the amount of array rows*/ $column = (count($records, COUNT_RECURSIVE) - $row) / 2 / $row; //Get Titles $titles = getTitles($records); //Create Table createTable($records, $row, $column, $titles); }
function generatePayload($ws_client_url, $service, $service_name, $parameters, $xsl) { global $debug, $defFile; //die($service_name." - ".$service); switch ($service_name) { case "Identify": $response = listRecords($set = $parameters["set"], $from = $parameters["from"], $until = $parameters["until"], $control = $parameters["control"], $lang = "en", $nrm = "iso", $count = 30, $debug = false); break; case "ListMetadataFormats": $response = getAbstractArticle($set = $parameters["pid"], $from = $parameters["from"], $until = $parameters["until"], $control = $parameters["control"], $lang = "en", $nrm = "iso", $count = 30, $debug = false); break; case "ListIdentifiers": $response = listRecords($set = $parameters["set"], $from = $parameters["from"], $until = $parameters["until"], $control = $parameters["control"], $lang = "en", $nrm = "iso", $count = 30, $debug = false, $metadataprx = $parameters["metadataprefix"]); break; case "ListSets": $response = getTitles($lang = "en", $debug = false); break; case "ListRecords": $response = ListRecords($set = $parameters["set"], $from = $parameters["from"], $until = $parameters["until"], $control = $parameters["control"], $lang = "en", $nrm = "iso", $count = 30, $debug = false, $metadataprx = $parameters["metadataprefix"]); break; case "ListRecordsAgris": $response = ListRecordsAgris($set = $parameters["set"], $from = $parameters["from"], $until = $parameters["until"], $control = $parameters["control"], $lang = "en", $nrm = "iso", $count = 100, $debug = false, $metadataprx = $parameters["metadataprefix"]); break; case "GetRecord": $response = getAbstractArticle($pid = $parameters["pid"], $lang = "en", $ws = $parameters["ws_oai"], $debug = false); break; case "GetRecordAgris": $response = getAbstractArticleAgris($pid = $parameters["pid"], $lang = "en", $ws = $parameters["ws_oai"], $debug = false); break; } #workaround for fatal error in DOMDocument::loadXML() when XML have & character $response = preg_replace('/ & /', ' & ', $response); if (!$debug) { $transform = new XSLTransformerOAI(); $transform->setXslBaseUri($defFile["PATH_OAI"]); $transform->setXslFile($defFile["PATH_OAI"] . $xsl); $transform->setXml($response); $transform->transform(); if ($transform->getError()) { echo "XSL Transformation error\n"; echo $transform->getError(); exit; } $result = $transform->getOutput(); } return $result; }
$results2 = $conn->query($query); if (mysqli_num_rows($results1) >= 1 or mysqli_num_rows($results2) >= 1) { return true; } else { return false; } } function getArticle($conn) { //Fetch article, display to user. $query = "SELECT * FROM `articles_enabled` ORDER BY RAND() LIMIT 1"; $result = $conn->query($query); foreach ($result as $rec) { return $rec; } } $str = json_encode(getArticle($conn)); echo $str; $size = ob_get_length(); header("Content-Length: {$size}"); ob_end_flush(); // Strange behaviour, will not work flush(); // Unless both are called ! ob_end_clean(); $array = getTitles(); foreach ($array as $rec) { if (!articleExists($rec, $conn)) { addArticle($rec, $conn); } }
<input type="hidden" name="page" value="EXCEL_Php_Worksheets"/> <input type="submit" value="Display XLS Info"/> </form> <?php // process XLS file upload if (isset($_REQUEST['xlsfile'])) { $xlsfile = $_REQUEST['xlsfile']; //$upload_dir $xlsfile_path = $upload_dir['path'] . '/' . $xlsfile; echo 'PATH: ' . $xlsfile_path . '<br/>'; // get titles from XLS file $titluri = getTitles(); // from 001ReadExcel.php echo '<form>'; $columnIndex = 0; foreach ($titluri as $titlu) { echo '<input type="checkbox" name = "xlscolumn[]" value="' . $columnIndex . '">' . $titlu . '</input><br/>'; } echo '<input type="hidden" name="page" value="EXCEL_Php_Worksheets"/>'; echo '<input type="submit" value="Preview"/>'; echo '</form>'; } ?> <?php // display required fields // print_r($_REQUEST['xlscolumn']);
<!--Box ends --> </TD></TR> </TBODY> </TABLE><br> </TD></TR> <?php } # if loop } # for loop } ?> <?php if ($action == "view_results") { $titles = getTitles(); ?> <TR><TD><BR></TD></TR> <?php if ($user->isAdmin()) { echo '<tr><td>For Admins all the polls will be listed. not just the closed ones</td></tr>'; } ?> <TR><TD colspan=2> <!-- Box starts --> <TABLE cellSpacing=0 cellPadding=0 border=0 width="100%"> <TBODY> <TR> <TD width=4 height=4><IMG height=4 src="images/corner.gif" width=4></TD> <TD align=left background=images/tb_top.gif height=4><IMG height=4 src="images/tb_left_topt.gif" width=8></TD> <TD align=right background=images/tb_top.gif height=4><IMG height=4 src="images/tb_right_topt.gif" width=8></TD>
<?php /** * Server-side PHP script that generates a list of albums (in JSON format) */ // TODO $albums = array('coldplay' => array('title' => 'A Rush of Blood to the Head', 'cover' => "images\\coldplay-cover.jpg", 'tracks' => array(array('track' => 'Politik', 'time' => sec(5, 19)), array('track' => 'In My Place', 'time' => sec(3, 46)), array('track' => 'God Put a Smile Upon Your Face', 'time' => sec(4, 57)), array('track' => 'The Scientist', 'time' => sec(5, 9)), array('track' => 'Clocks', 'time' => sec(5, 7)), array('track' => 'Daylight', 'time' => sec(5, 27)), array('track' => 'Green Eyes', 'time' => sec(3, 43)), array('track' => 'Warning Sign', 'time' => sec(5, 31)), array('track' => 'A Whisper', 'time' => sec(3, 58)), array('track' => 'A Rush of Blood to the Head', 'time' => sec(5, 51)), array('track' => 'Amsterdam', 'time' => sec(5, 19)))), 'gunsnroses' => array('title' => 'Greatest Hits', 'cover' => 'http://upload.wikimedia.org/wikipedia/en/3/36/GreatestHits_Guns%27n%27Roses.jpg', 'tracks' => array(array('track' => 'Welcome to the Jungle', 'time' => sec(4, 34)), array('track' => 'Sweet Child O\' Mine', 'time' => sec(3, 21)), array('track' => 'Patience', 'time' => sec(5, 56)), array('track' => 'Paradise City', 'time' => sec(6, 46)), array('track' => 'Knockin\' on Heaven\'s Door', 'time' => sec(5, 35)), array('track' => 'Civil War', 'time' => sec(7, 42)), array('track' => 'You Could Be Mine', 'time' => sec(5, 44)), array('track' => 'Don\'t Cry (original)', 'time' => sec(4, 43)), array('track' => 'November Rain', 'time' => sec(8, 56)), array('track' => 'Live & Let Die', 'time' => sec(3, 4)), array('track' => 'Yesterday\'s', 'time' => sec(3, 16)), array('track' => 'Ain\'t It Fun', 'time' => sec(5, 4)), array('track' => 'Since I Don\'t Have You', 'time' => sec(4, 19)), array('track' => 'Sympathy for the Devil', 'time' => sec(7, 18))))); function sec($min, $sec) { return $min * 60 + $sec; } function getTitles($albums) { $titles['albums'] = array(); foreach ($albums as $album) { array_push($titles['albums'], $album['title']); } return $titles; } $json = json_encode(getTitles($albums)); echo $json;
function generatePayload($ws_client_url, $service, $service_name, $parameters, $xsl) { global $debug, $defFile; //die($service_name." - ".$service); switch ($service_name) { case "Identify": $response = listRecords($set = $parameters["set"], $from = $parameters["from"], $until = $parameters["until"], $control = $parameters["control"], $lang = "en", $nrm = "iso", $count = 30, $debug = false); break; case "ListMetadataFormats": $response = getAbstractArticle($set = $parameters["set"], $from = $parameters["from"], $until = $parameters["until"], $control = $parameters["control"], $lang = "en", $nrm = "iso", $count = 30, $debug = false); break; case "ListIdentifiers": $response = listRecords($set = $parameters["set"], $from = $parameters["from"], $until = $parameters["until"], $control = $parameters["control"], $lang = "en", $nrm = "iso", $count = 30, $debug = false); break; case "ListSets": $response = getTitles($lang = "en", $debug = false); break; case "ListRecords": $response = ListRecords($set = $parameters["set"], $from = $parameters["from"], $until = $parameters["until"], $control = $parameters["control"], $lang = "en", $nrm = "iso", $count = 30, $debug = false); break; case "GetRecord": $response = getAbstractArticle($pid = $parameters["pid"], $lang = "en", $ws = $parameters["ws_oai"], $debug = false); break; } // $result = ""; if (!$debug) { $transform = new XSLTransformer(); if (getenv("ENV_SOCKET") != "true") { //socket $xsl = file_get_contents($defFile["PATH_OAI"] . $xsl); } else { $xsl = str_replace('.XSL', '', strtoupper($xsl)); } $transform->setXslBaseUri($defFile["PATH_OAI"]); $transform->setXsl($xsl); $transform->setXml($response); $transform->transform(); if ($transform->getError()) { // Transformation error echo "XSL Transformation error\n"; echo $transform->getError(); $transform->destroy(); exit; } $result = $transform->getOutput(); $transform->destroy(); } return $result; }