function getCodeListeVideo($reponse) { $anneeRef = 0; $resultat = ''; $resultatTemp = ''; while ($video = $reponse->fetch()) { $annee = $video['annee_video']; if ($anneeRef != $annee and $anneeRef != 0) { $resultat .= getSeparateur($anneeRef); $resultat .= getDebutListe(); $resultat .= $resultatTemp; $resultat .= getFinListe(); $resultatTemp = ''; } if ($anneeRef != $annee) { $anneeRef = $annee; } $resultatTemp .= getElement($video['id_video'], $video['titre_video'], $video['code_video'], $video['codehebergeur_video'], $video['commentaire_video']); } $resultat .= getSeparateur($anneeRef); $resultat .= getDebutListe(); $resultat .= $resultatTemp; $resultat .= getFinListe(); return $resultat; }
private function buildModel() { $nElements = getNumberOfElements(); $features = array(); for ($i = 0; $i < $nElements; ++$i) { $oogF = getElement($i); switch ($oogF->getType()) { case OOG_SLOT: $features[$i] = new V2Slot($oogF); break; case OOG_HOLE: $features[$i] = new V2Hole($oogF); break; } } }
</div> <div id="institution-profile" class="col-xs-12 col-md-6 profile-region" data-source="institution"> <h3>Institution Information</h3> <?php echo getElement("institution", $place["name"]); ?> <?php echo getElement("department", $place["department"]); ?> <div class="profile-data address"> <address data-number="<?php echo $place['street_number']; ?>" data-street="<?php echo $place['street']; ?>" data-country="<?php echo $place['country_code']; ?>" data-zip="<?php echo $place['zip']; ?>" > <?php echo getElement("address", $place["street_number"] ." ". $place["street"]); ?> </address> </div> <?php echo getElement("department phone", $place["department_phone"]); ?> </div> <div id="bio-profile" class="col-xs-12 profile-region" data-source="profile"> <h3><?php echo $titlePossessive; ?> Bio</h3> <?php $bio = str_replace("\\n", "\n", $bio); if(!$isViewingSelf) { if(empty($bio)) $bio = "*No profile provided*"; ?> <marked-element> <div class="markdown-html"></div> <script type="text/markdown"><?php echo $bio; ?></script> </marked-element> <?php } else { ?> <iron-autogrow-textarea label="Profile Text" placeholder="Any profile bio text you'd like. Markdown accepted." value="<?php echo $bio; ?>" rows="5" class="user-input"></iron-autogrow-textarea>
$str = "There was an error retrieving files for the requested" . " account. Please try again."; echo getElement("", "", 0, 0, $str); } else { if ($result[0]->num_rows < 1) { echo getElement("", "", 0, 0, "No files associated with this account."); } else { $i = 0; //if our id, we can delete if ($fileID == $_SESSION['id']) { $del = ""; } else { //not our id, cannot delete $del = 1; } while ($row = $result[0]->fetch_assoc()) { echo getElement($row['name'], $row['size'], $row['id'], $i++, $del); } } } } ?> </ul> </div> </div> <!--</section>--> <!--</div> </div>--> </div> </div>
foreach ($categories as $key_category => $value_category) { $article = new Article($bdd, $_TABLES); if ($value_category->use_url) { $url .= $value_category->url; } $html = file_get_html($url); if (!is_null($html)) { $temp['url'] = getElement($html->find($config->container)->find($config->item->container)->find($config->item->url->html), $config->item->url->element); $temp['title'] = getElement($html->find($config->container)->find($config->item->container)->find($config->item->title->html), $config->item->title->element); $temp['width_image'] = getElement($html->find($config->container)->find($config->item->container)->find($config->item->width_image->html), $config->item->width_image->element); $temp['height_image'] = getElement($html->find($config->container)->find($config->item->container)->find($config->item->height_image->html), $config->item->height_image->element); $temp['image'] = getElement($html->find($config->container)->find($config->item->container)->find($config->item->image->html), $config->item->image->element); $temp['alt_image'] = getElement($html->find($config->container)->find($config->item->container)->find($config->item->alt_image->html), $config->item->alt_image->element); $temp['description'] = getElement($html->find($config->container)->find($config->item->container)->find($config->item->description->html), $config->item->description->element); $temp['date_publication'] = getElement($html->find($config->container)->find($config->item->container)->find($config->item->date_publication->html), $config->item->date_publication->element); $temp['author'] = getElement($html->find($config->container)->find($config->item->container)->find($config->item->author->html), $config->item->author->element); $data = json_encode($temps); $article->setArticle($data); die('Scrap one article'); } } } else { echo "Categories Not Found For " . $url; } } } else { echo "Websites Not Found"; } } else { echo "BDD ERROR : " . json_encode($bdd); echo "TABLES ERROR : " . json_encode($_TABLES);
function df_ListFields($Table, $Default, $Name) { if (empty($Table)) { return; } $result = mysql_query("SHOW COLUMNS FROM `" . $Table . "`"); $Return = '<select name="Data[Content][' . $Name . ']" id="Return_' . $Table . '">'; //$Return .= '<option value="false">None</option>'; if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_assoc($result)) { $Sel = ''; if ($Default == $row['Field']) { $Sel = 'selected="selected"'; } $Return .= '<option value="' . $row['Field'] . '" ' . $Sel . '>' . $row['Field'] . '</option>'; } } if (!empty($_GET['interface'])) { $Element = getElement($_GET['interface']); $Config =& $Element['Content']; if (!empty($Config['_CloneField'])) { $Return .= '<optgroup label="Cloned Fields">'; foreach ($Config['_CloneField'] as $Field => $Array) { $Sel = ''; if ($Default == $Field) { $Sel = 'selected="selected"'; } $Return .= '<option value="' . $Field . '" ' . $Sel . '>' . $Config['_FieldTitle'][$Field] . '</option>'; } } } $Return .= '</select>'; return $Return; }
function readDSC($reader, $section, $validHTML, $openTag, $hrefTag, $repName, $file) { $doc = ''; $doc = $_GET['doc']; // variables $level = ""; $count = 0; $lhs = $rhs = $table = ""; $insideDID = false; $current = ""; $boldMe = false; $class = ""; $nestedC = array(); $render = ""; $depth = 0; $reduced = 0; $otherLevel = ""; $subseriesCount = 0; $seriesCount = 0; $otherlevelCount = 0; $scopecontent = false; $firstDiv = true; //echo "DEBUG <br>\n"; //echo "DEBUG-repName: $repName <br>\n"; // New fetch of summary block of XML - we need this // data to fill out the Aeon request. // -- rewrite "dsc" request as "summary" request $summary_url = str_replace('=dsc', '=summary', $file); //echo "DEBUG-summary-url: $summary_url <br>\n"; // -- fetch the summary XML into a string $xml_as_string = file_get_contents($summary_url); //echo "<!-- DEBUG-xml-as-string: $xml_as_string <br> --> \n"; // -- disable namespaces $xml_as_string = str_replace('xmlns=', 'ns=', $xml_as_string); // -- convert into simple PHP object $summary = new SimpleXMLElement($xml_as_string); // -- DEBUG - show that it's working //$clio = $summary->xpath('//unitid[@type=\'clio\']'); //echo "//unitid[@type=clio]=[" . $clio[0] . "] <br /> \n"; // line up all the summary-derived values we'll need to pass to Aeon... $CallNumber = $summary->xpath('//unitid[@type=\'call_num\']'); $CallNumber = $CallNumber[0]; $ItemAuthor = $summary->xpath('//origination/*'); $ItemAuthor = join(', ', $ItemAuthor); // as yet, never multiple auth. //$ItemTitle = $summary->unittitle; $ItemTitle = dom_import_simplexml($summary->unittitle)->textContent; $ItemDate = $summary->unitdate; $ItemTitle .= " {$ItemDate}"; // cosmetic, expected display value // $EADNumber = $summary->xpath('//unitid[@type=\'clio\']'); // $EADNumber = $EADNumber[0]; $ReferenceNumber = $summary->xpath('//unitid[@type=\'clio\']'); $ReferenceNumber = $ReferenceNumber[0]; //$Location = $repName; // passed in to function directly $Location = $summary->xpath('//location'); $Location = $Location[0]; $ItemInfo1 = 'Archival Materials'; // constant boilerplate $DocumentType = 'All'; // constant boilerplate // we're done with this SimpleXML object unset($summary); $aeon_fields = array('CallNumber', 'ItemAuthor', 'ItemTitle', 'ItemDate', 'ReferenceNumber', 'Location', 'ItemInfo1', 'DocumentType'); // aeon support - start request form global $env; $show_requests = false; //if ($env == "dev") $show_requests = true; // if ($env == "test") $show_requests = true; // if ($_SERVER['REMOTE_ADDR'] == '128.59.154.72') $show_requests = true; // we're launching - turn on for everyone $show_requests = true; // marquis, 7/21/2015 - per Evelyn's discussions w/RBML staff, load with checkboxes shown. //echo "<div class=\"aeon_blurb toggle_target\" style=\"display:none;\">\n"; echo "<div class=\"aeon_blurb\">\n"; // $usertype = $_SESSION['aeonControl_usertype']; // if ( $usertype == 'shib') echo "usertype: $usertype<br>\n"; // if ( $usertype == 'nonshib') echo "usertype: $usertype<br>\n"; echo "Submit a request for access to the archival material.<br>\n"; echo "All users will need to register the first time they make a request.<br>\n"; echo "Columbia-affiliated users may login with their uni and password.<br>\n"; echo "Unaffiliated users may create a new account.<br>\n"; if ($_SERVER['REMOTE_ADDR'] == '128.59.154.72') { echo "<form name=\"EADRequest\" action=\"/aeon/aeon-debug.php\" method=\"POST\" target=\"aeon\">\n\n"; } else { echo "<form name=\"EADRequest\" action=\"/aeon/aeon.php\" method=\"POST\" target=\"aeon\">\n\n"; } echo "<input type=\"submit\" name=\"SubmitButton\" value=\"Submit Request\">\n"; echo "<input type=\"button\" id=\"clear_checkboxes\" value=\"Clear Checkboxes\" \">\n"; echo "<input type=\"hidden\" name=\"AeonForm\" value=\"EADRequest\">\n"; // These variables are marked as "fixed", meaning that they are a constant value // to be added to each individual request that's made foreach ($aeon_fields as $field) { echo "<input type=\"hidden\" name=\"" . $field . "_FIXED\" value=\"" . ${$field} . "\">\n"; } echo "</div>\n"; // marquis, 7/21/2015 - per Evelyn's discussions w/RBML staff, load with checkboxes shown. //if ($show_requests) { // echo "<a href='' class=\"toggle_control\"><b>>>> Show Request Checkboxes</b></a>"; //} //echo "<a href='' class=\"toggle_control\" style=\"display:none\"><b>>>> Hide Request Checkboxes</b></a>"; echo "<div style='clear:both' />\n"; // aeon support - tracking variables $currentContainerKey = "NONE"; $currentDescription = ""; $checkboxCounter = 1; $containerType = ''; $insideUnitTitle = 0; $seriesLabel = ''; if ($doc == "ldpd_7818783") { echo '<div class="ldpd_7818783">'; } while ($reader->read()) { if ($reader->name != "#text" && !array_key_exists($reader->name, $validHTML)) { $current = $reader->name; } if ($reader->name == "scopecontent") { if ($reader->nodeType == XMLReader::ELEMENT) { $scopecontent = true; } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { $scopecontent = false; } } } // DEBUG // echo "CURRENT = " . $current . "<br />"; if ($reader->name == "#comment") { continue; } if ($reader->name == "parent_heading") { if ($reader->nodeType == XMLReader::ELEMENT) { print "<h2 class=\"parent_heading\">"; } else { print "</h2>"; } } // end IF parent heading if ($reader->getAttribute("level") != "") { //$oldLevel = $level; $level = $reader->getAttribute("level"); //if ($level == 'series') { echo "#### NEW LEVEL == SERIES ####";}; if ($level == 'series') { $seriesLabel = ''; } } if ($reader->getAttribute("otherlevel") != "") { $otherLevel = $reader->getAttribute("otherlevel"); } if ($reader->getAttribute("render") != "" && !array_key_exists($reader->name, $validHTML)) { $render = $reader->getAttribute("render"); } // reset count if ($level == "series" || $level == "subseries") { $count = 0; } if ($reader->name == "c" && $reader->getAttribute("level") == "file") { if ($reader->nodeType == XMLReader::ELEMENT) { if ($reduced > 2) { $count++; } if ($doc != "ldpd_7818783" || !$firstDiv) { print "<div class=\"c\">\n"; } else { if ($doc == "ldpd_7818783" && $firstDiv) { print "<div class=\"c1\">\n"; $firstDiv = !$firstDiv; } } array_push($nestedC, 'c'); $depth++; $reduced = 0; } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { print "</div><!-- class c-->\n\n"; array_pop($nestedC); $depth--; $reduced++; } } } // if name is c and level is file if ($reader->name == "unittitle" && ($level == "series" || $level == "subseries" || $level == "otherlevel")) { if ($reader->nodeType == XMLReader::ELEMENT) { $localCount = 0; switch ($level) { case "series": $localCount = ++$seriesCount; break; case "subseries": $localCount = ++$subseriesCount; break; case "otherlevel": $localCount = ++$otherlevelCount; break; } $insideUnitTitle = 1; print '<a name="' . $level . $localCount . '"></a>' . getElement($level, true, $otherLevel); } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { print getElement($level, false, $otherLevel); if ($otherLevel != "") { $otherLevel == ""; } $insideUnitTitle = 0; } } //echo "otherlevel: " . $otherLevel . "<br />"; } if ($reader->name == "head") { if ($reader->nodeType == XMLReader::ELEMENT) { print getElement("head", true); } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { print getElement("head", false); } } } // DEBUG //echo $current . " " . $reader->name . "<br />\n"; if ($current == "did") { $insideDID = true; } if ($reader->name == "c" && $level == "file") { if ($count % 2 == 0) { $class = "even"; } else { $class = "odd"; } } else { if ($reader->name == "did" && $level == "file") { if ($reader->nodeType == XMLReader::ELEMENT) { $table = " <table width=\"100%\" class=\"cTable\">\n"; $table .= " <tr>\n"; } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { // Left-Hand-Side $table .= " <td class=\"{$class}\">{$lhs}</td>\n"; // Right-Hand-Side $rhs = rtrim($rhs); if (substr($rhs, -1) == ",") { $rhs = substr($rhs, 0, -1); } // If right-hand value is comma-seperated list, put comma within div $rhs = str_replace('</div>,', ',</div>', $rhs); $table .= " <td class=\"{$class} rhs\">{$rhs}</td>\n"; $table .= " </tr>\n"; $table .= " </table>\n"; print $table; // aeon support // need here to build and provide: // -- ItemVolume = container lable value, etc. //print "<input type=\"hidden\" name=\"ItemVolume_$requestID\" value=\"$label " . rtrim($currentValue) . "\">\n"; print "<input type=\"hidden\" name=\"ItemVolume_{$requestID}\" value=\"" . rtrim($currentContainerKey) . "\">\n"; // -- ItemSubTitle = ancestor::c[@level='series']/did/unittile print "<input type=\"hidden\" name=\"ItemSubTitle_{$requestID}\" value=\"" . rtrim($seriesLabel) . "\">\n"; print "<input type=\"hidden\" name=\"ItemDescription_{$requestID}\" value=\"" . rtrim($currentDescription) . "\">\n"; // aeon $currentDescription = ""; // aeon $lhs = $rhs = $table = ""; $insideDID = $boldMe = false; $count++; } } } } //TODO is this necessary?? // if there is markup that we should print out, do so (only if in $validHTML array) if (array_key_exists($reader->name, $validHTML) && $level != "file" || array_key_exists($reader->name, $validHTML) && $level == "file" && strtolower($reader->name) == "p") { if ($reader->nodeType == XMLReader::ELEMENT) { if ($reader->name != "") { print "<" . $validHTML[$reader->name] . '>' . "\n"; array_push($openTag, $reader->name); } else { array_push($openTag, $reader->name); } } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { if ($reader->name != "") { print "</" . $validHTML[$reader->name] . '>' . "\n"; array_pop($openTag); } } } } // end IF reader->name in validHTML array // LIST ELEMENTS -- modified as <ul> if ($reader->name == "list" || $reader->name == "change") { if ($reader->name == "change") { $change = true; } if ($reader->nodeType == XMLReader::ELEMENT) { if ($scopecontent) { echo "<ul"; if ($reader->hasAttributes && $reader->getAttribute("type")) { echo ' class="' . $reader->getAttribute("type") . '"'; } echo ">"; } else { $lhs .= "<ul"; if ($reader->hasAttributes && $reader->getAttribute("type")) { $lhs .= ' class="' . $reader->getAttribute("type") . '"'; } $lhs .= ">"; } } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { if ($scopecontent) { echo "</ul>\n"; } else { $lhs .= "</ul>\n"; } if ($reader->name == "change") { $change = false; } } } } // if LIST if ($reader->name == "item") { if (!$change) { if ($reader->nodeType == XMLReader::ELEMENT) { if ($scopecontent) { echo "<li>\n"; } else { $lhs .= "<li>\n"; } } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { if ($scopecontent) { echo "</li>\n"; } else { $lhs .= "</li>\n"; } } } } } if ($reader->hasAttributes) { if ($reader->getAttribute("level") != "") { $level = $reader->getAttribute("level"); } if ($reader->name == "extref" || $reader->name == "dao") { $href = $reader->getAttribute("xlink:href"); $hrefTag = !$hrefTag; if ($reader->nodeType == XMLReader::ELEMENT) { if ($scopecontent || $level != "file") { $class = ""; if (stristr($href, 'omeka')) { $class = 'class = "omekalink"'; } echo '<a href="' . $href . '" ' . $class . ' target="_blank">'; } else { $lhs .= '<a href="' . $href . '">'; } } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { if ($scopecontent || $level != "file") { echo "</a>\n"; } else { $lhs .= "</a>\n"; } } } //$hrefTag = !$hrefTag; } // if extref // need a label for the containers if ($reader->name == "container" && $level == "file") { $label = $reader->getAttribute("label"); $containerType = $reader->getAttribute("type"); if ($reader->nodeType == XMLReader::ELEMENT) { if ($level == "file") { //$rhs .= "<div class=\"label\">" . $label . " "; $rhs .= "<div class=\"label\">"; // add label+value together, below } } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { if ($level == "file") { $rhs .= "</div>"; } } } } // if CONTAINER if ($reader->getAttribute("render") != "") { $render = $reader->getAttribute("render"); if ($reader->nodeType == XMLReader::ELEMENT) { $lhs .= "<span class=\"{$render}\">"; } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { $lhs .= "</span>"; $render = ""; } } } } else { // no attributes if ($level == "file" && ($current == "unittitle" || $current == "unitdate" || $current == "extent" || $current == "physdesc" || $current == "note")) { if ($reader->nodeType == XMLReader::ELEMENT) { $lhs .= '<div class="' . $current . '">'; } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { $lhs .= '</div><!--' . $current . '-->'; } } } if ($level == "file" && $current == "scopecontent" && !array_key_exists($reader->name, $validHTML)) { if ($reader->nodeType == XMLReader::ELEMENT) { print "<table class=\"scope\"><tr><td class=\"scope"; //$lhs .= "<table class=\"scope\"><tr><td class=\"scope"; if ($depth == 0 || $depth == 1) { print " " . $class; } print "\">\n"; } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { print "</td></tr></table><!-- scope -->\n"; } } } if ($level == "file" && stristr($current, "restrict") && !array_key_exists($reader->name, $validHTML)) { if ($reader->nodeType == XMLReader::ELEMENT) { print "<div class=\"restrict\">\n"; } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { print "</div><!-- scope -->\n"; } } } } // if attributes if ($reader->hasValue && $reader->value != "") { if ($current == "container") { $currentValue = rtrim($reader->value); if ($currentValue == "") { continue; } if (substr($rhs, -6) == "</div>") { $rhs .= ", "; } if ($render != "") { $rhs .= "<{$render}>"; } // If we're inside a container and we've just read a value, // then the container-label + value == right-hand-side display value // $currentValue = rtrim($reader->value); //print "currentValue=[$currentValue]\n"; //print "trimmed currentValue=[" . rtrim($currentValue) . "]\n"; // aeon support // - whenever the key changes, print a new checkbox. // - key is chosen to control correct form rendering // - display label & param value are whatever RBML wants //if (isset($containerType) && $containerType == 'Box' && if (isset($containerType) && strcasecmp($containerType, 'Box') == 0 && $currentContainerKey != "{$label} {$currentValue}") { $currentContainerKey = "{$label} {$currentValue}"; $requestID = $doc . "_" . $checkboxCounter++; // marquis, 7/21/2015 - per Evelyn's discussions w/RBML staff, // load with checkboxes shown. // $rhs .= "<span class=\"aeon_checkbox toggle_target\" style=\"display:none\">\n"; $rhs .= "<span class=\"aeon_checkbox\">\n"; $rhs .= "<input type=\"checkbox\" name=\"Request[]\" value=\"{$requestID}\" id=\"{$requestID}\" class=\"aeon_checkbox\" >\n"; $rhs .= "<label for=\"{$requestID}\">Request {$label} {$currentValue}</label>\n"; $rhs .= "</span>\n"; // moved down to below the "table" (row of data) // // aeon support // // need here to build and provide: // // -- ItemVolume = container lable value, etc. // $rhs .= "<input type=\"hidden\" name=\"ItemVolume_$requestID\" value=\"$label $currentValue\">\n"; // // -- ItemSubTitle = ancestor::c[@level='series']/did/unittile // $rhs .= "<input type=\"hidden\" name=\"ItemSubTitle_$requestID\" value=\"$seriesLabel\">\n"; // $currentDescription = rtrim($currentDescription); // $rhs .= "<input type=\"hidden\" name=\"ItemDescription_$requestID\" value=\"$currentDescription\">\n"; // aeon // $currentDescription = ""; // aeon // -- do we want/need this? for grouping? //$rhs .= "<input type=\"hidden\" name=\"SubLocation_$requestID\" value=\"$label $currentValue\">\n"; $rhs .= "<br />\n"; } //$rhs .= $currentValue . "\n"; $rhs .= "{$label} {$currentValue}\n"; if ($render != "") { $rhs .= "</{$render}>"; $render = ""; } } else { if ($insideDID && ($current == "unittitle" || $current == "unitdate" || $current == "extent" || $current == "physdesc" || $current == "note" || $current == "extref" && !$scopecontent) && $level == "file") { if ($render != "") { $lhs .= "<{$render}>"; } if (count($nestedC) == 1) { //$lhs .= 'XX'; $lhs .= $reader->value; $currentDescription .= rtrim($reader->value) . " "; } else { //$lhs .= 'YY'; $lhs .= $reader->value; } if ($render != "") { $lhs .= "</{$render}>"; $render = ""; } } else { /*if ($current == 'scopecontent' && $level == 'file' && $reader->value != "") { if ($render != "") print "<$render>"; print '<span class="scope">' . $reader->value . '</span>'; if ($render != "") { print "</$render>"; $render = ""; } } else { */ if ($render != "") { print "<{$render}>"; } print $reader->value; // DEBUG VALUE // print "[$insideDID][level=$level]"; if ($insideUnitTitle && $level == 'series') { $seriesLabel .= $reader->value . " "; } if ($render != "") { print "</{$render}>"; $render = ""; } //} } } } // end IF reader->value } // end WHILE if ($doc == "ldpd_7818783") { echo "</div>"; } echo '<p class="top"><a href="#top">Return to top</a></p>'; // aeon support echo "\n\n</form>\n\n"; }
$date_publication = trim($date_publication); error_log($date_publication); $dt = DateTime::createFromFormat($config->container->item_inner->date_publication->format, $date_publication); if (!is_null($dt) || !empty($dt)) { $temp['date_publication'] = $dt->format('Y-m-d H:i:s'); } } else { $dt = new DateTime(); $temp['date_publication'] = $dt->format('Y-m-d H:i:s'); } } else { $dt = new DateTime(); $temp['date_publication'] = $dt->format('Y-m-d H:i:s'); } } $temp['author'] = getElement($value->find($config->container->item->author->html, $config->container->item->author->counter), $config->container->item->author->element); if (!$objItem->getItemExistByUrl($temp['url'])) { $data = json_encode($temp); echo $data; $article->setArticle($data); } //die('Scrap one article \n'); } } else { // 404 lors de la recherche classique // Donc continue de la boucle de categorie continue; } } else { // 404 lors de la recherche classique // Donc continue de la boucle de categorie
function dt_process() { if (!empty($_POST['func']) && !empty($_POST['action'])) { if ($_POST['action'] == 'wp_dt_ajaxCall') { dt_ajaxCall(); exit; } } if (!empty($_POST['processKey'])) { $_POST = stripslashes_deep($_POST); if ($_POST['processKey'] == $_SESSION['processKey']) { include_once DB_TOOLKIT . 'daiselements.class.php'; include_once DB_TOOLKIT . 'data_form/class.php'; include_once DB_TOOLKIT . 'data_report/class.php'; unset($_SESSION['processKey']); $_SESSION['DF_Post'] = array(); if (!empty($_POST['dr_update'])) { $EID = $_POST['dataForm']['EID']; $Setup = getelement($EID); unset($_POST['dataForm']['dr_update']); unset($_POST['dataForm']['EID']); $Return = df_processUpdate($_POST['dataForm'], $EID); if (!empty($Return['_fail_'])) { $_SESSION['failedProcess'][$EID]['Data'] = $Data; $_SESSION['failedProcess'][$EID]['Fields'] = $Return['_fail_']; $_SESSION['DF_Notification'] = $Return['_error_']; $_SESSION['DF_NotificationTypes'][] = 'error'; header('Location: ' . $_SERVER['HTTP_REFERER']); exit; } if (!empty($Return['Value'])) { dr_trackActivity('Update', $EID, $Return['Value']); $_SESSION['DF_Post_returnID'] = $Return['Value']; $_SESSION['DF_Post_EID'] = $EID; } if (empty($Setup['Content']['_NotificationsOff'])) { if (!empty($Setup['Content']['_inlineNotifications'])) { $_SESSION['DF_Notification'][] = $Return['Message']; $_SESSION['DF_NotificationTypes'][] = $Return['noticeType']; } else { $_SESSION['DF_Post'][] = $Return['Message']; } } } else { foreach ($_POST['dataForm'] as $EID => $Data) { $Return = df_processInsert($EID, $Data); if (!empty($Return['_fail_'])) { $_SESSION['failedProcess'][$EID]['Data'] = $Data; $_SESSION['failedProcess'][$EID]['Fields'] = $Return['_fail_']; $_SESSION['DF_NotificationTypes'][] = 'error'; header('Location: ' . $_SERVER['HTTP_REFERER']); exit; } // Track Activity if (!empty($Return['Value'])) { dr_trackActivity('Insert', $EID, $Return['Value']); } $Setup = getelement($EID); if (empty($Setup['Content']['_NotificationsOff'])) { if (!empty($Setup['Content']['_inlineNotifications'])) { $_SESSION['DF_Notification'][] = $Return['Message']; $_SESSION['DF_NotificationTypes'][] = $Return['noticeType']; } else { $_SESSION['DF_Post'][] = $Return['Message']; } } } } $Redirect = $_SERVER['HTTP_REFERER']; if (!empty($Return['Value'])) { $ReturnValue = $Return['Value']; } if (is_admin()) { if (!empty($Setup['Content']['_ItemViewInterface'])) { $Location = 'admin.php'; } else { $Location = $_SERVER['HTTP_REFERER']; } } else { if (!empty($Setup['Content']['_ItemViewPage'])) { $Location = get_permalink($Setup['Content']['_ItemViewPage']); } else { $Location = $_SERVER['HTTP_REFERER']; } } //echo $Location; //exit; if (!empty($ReturnValue)) { $url = parse_url($_SERVER['HTTP_REFERER']); $returntoken = '?'; if (!empty($url['query'])) { if (empty($Setup['Content']['_ItemViewPage'])) { $Location = str_replace('?' . $url['query'], '', $_SERVER['HTTP_REFERER']); } parse_str($url['query'], $gets); parse_str($ReturnValue, $returngets); if (!empty($Setup['Content']['_ItemViewInterface'])) { $RedirInterface = get_option($Setup['Content']['_ItemViewInterface']); if (!empty($RedirInterface['_ItemGroup'])) { $app = get_option('_' . $RedirInterface['_Application'] . '_app'); if (!empty($app['docked'])) { $gets['page'] = $Setup['Content']['_ItemViewInterface']; } else { $gets['page'] = 'dbt_builder'; $gets['renderinterface'] = $Setup['Content']['_ItemViewInterface']; } } else { $gets['page'] = 'dbt_builder'; $gets['renderinterface'] = $Setup['Content']['_ItemViewInterface']; } } $ReturnValue = htmlspecialchars_decode(@http_build_query(array_merge($gets, $returngets))); } else { if (!empty($Setup['Content']['_ItemViewInterface'])) { $RedirInterface = get_option($Setup['Content']['_ItemViewInterface']); if (!empty($RedirInterface['_ItemGroup'])) { $app = get_option('_' . $RedirInterface['_Application'] . '_app'); if (!empty($app['docked'])) { $gets['page'] = $Setup['Content']['_ItemViewInterface']; } else { $gets['page'] = 'dbt_builder'; $gets['renderinterface'] = $Setup['Content']['_ItemViewInterface']; } } else { $gets['page'] = 'dbt_builder'; $gets['renderinterface'] = $Setup['Content']['_ItemViewInterface']; } $ReturnValue = htmlspecialchars_decode(@http_build_query($gets, $returngets)); } } $Redirect = $Location . $returntoken . $ReturnValue; } //echo $Redirect; //exit; header('Location: ' . $Redirect); exit; } } //vardump($_POST); if (!empty($_POST['importKey'])) { $_POST = stripslashes_deep($_POST); if (empty($_FILES['fileImport']['size'])) { $_SESSION['dataform']['OutScripts'] .= "\n df_buildImportForm('" . $_POST['importInterface'] . "');\n "; $Redirect = $_SERVER['HTTP_REFERER']; header('Location: ' . $Redirect); exit; } $path = wp_upload_dir(); // set filename and paths $Ext = pathinfo($_FILES['fileImport']['name']); $newFileName = $_POST['importInterface'] . '.' . $Ext['extension']; $newLoc = $path['path'] . '/' . $newFileName; $_SESSION['import_' . $_POST['importInterface']]['import'] = wp_upload_bits($newFileName, null, file_get_contents($_FILES['fileImport']['tmp_name'])); $_SESSION['dataform']['OutScripts'] .= "\n df_buildImportManager('" . $_POST['importInterface'] . "');\n "; $Redirect = $_SERVER['HTTP_REFERER']; header('Location: ' . $Redirect); exit; } if (!empty($_POST['importPrepairKey'])) { $Element = getelement($_POST['importInterface']); $_SESSION['import_' . $_POST['importInterface']]['import']['table'] = $Element['Content']['_main_table']; $_SESSION['import_' . $_POST['importInterface']]['import']['delimiter'] = $_POST['importDelimeter']; if (!empty($_POST['importSkipFirst'])) { $_SESSION['import_' . $_POST['importInterface']]['import']['importSkipFirst'] = $_POST['importSkipFirst']; } $_SESSION['import_' . $_POST['importInterface']]['import']['map'] = $_POST['importMap']; $_SESSION['dataform']['OutScripts'] .= "\n df_processImport('" . $_POST['importInterface'] . "');\n "; $Redirect = $_SERVER['HTTP_REFERER']; header('Location: ' . $Redirect); exit; } // API Call //vardump($_SERVER); $pattern = API_getInterfaceRegex(); if (!empty($pattern)) { if (preg_match('/' . $pattern['regex'] . '/s', $_SERVER['REQUEST_URI'], $matches)) { include_once DB_TOOLKIT . 'libs/api_engine.php'; exit; } } /// EXPORT foreach ($_GET as $PDFExport => $Val) { if (!is_array($Val)) { if (strstr($PDFExport, 'format_')) { $export = explode('_dt_', $PDFExport); $exportFormat = $Val; $Media['ID'] = 'dt_' . $export[1]; $Element = getElement($Media['ID']); $Config = $Element['Content']; } } } //error_reporting(E_ALL); //ini_set('display_errors','On'); //esds if (!empty($exportFormat)) { if ($exportFormat == 'pdf') { include_once DB_TOOLKIT . 'daiselements.class.php'; include_once DB_TOOLKIT . 'data_form/class.php'; include_once DB_TOOLKIT . 'data_report/class.php'; include_once DB_TOOLKIT . 'data_itemview/class.php'; include_once DB_TOOLKIT . 'libs/fpdf.php'; include_once DB_TOOLKIT . 'libs/pdfexport.php'; $input_params["return"] = isset($input_params["return"]) ? $input_params["return"] : false; if (empty($Config['_orientation'])) { $Config['_orientation'] = 'P'; } $report = new PDFReport($Config['_orientation'], $Config['_ReportTitle']); //you should use loadlib here //dump($_SESSION['reportFilters'][$Media['ID']]); if (!empty($Config['_FilterMode'])) { $Res = mysql_query("SELECT ID, Content FROM `dais_elements` WHERE `Element` = 'data_report' AND `ParentDocument` = " . $Element['ParentDocument'] . " AND `ID` != '" . $Media['ID'] . "';"); while ($element = mysql_fetch_assoc($Res)) { //dump($element); $eConfig = unserialize($element['Content']); $preReport['ID'] = $element['ID']; $preReport['Config'] = $eConfig; $reportExports[] = $preReport; } } else { $preReport['ID'] = $Media['ID']; $preReport['Config'] = $Config; $reportExports[] = $preReport; } $input_params["return"] = isset($input_params["return"]) ? $input_params["return"] : false; foreach ($reportExports as $key => $reportExport) { //dump($_SESSION); $Continue = true; $Media['ID'] = $reportExport['ID']; $Config = $reportExport['Config']; foreach ($reportExport['Config']['_Field'] as $Key => $Value) { if ($Value == 'viewitem_filter') { if (empty($_SESSION['viewSelector_' . $Media['ID']])) { $Continue = false; } } } if (!empty($Continue)) { $limit = 'full'; if (!empty($_GET['limit'])) { $limit = $_GET['limit']; } $OutData = dr_BuildReportGrid($Media['ID'], false, $_SESSION['report_' . $Media['ID']]['SortField'], $_SESSION['report_' . $Media['ID']]['SortDir'], 'pdf', $limit); //vardump($OutData); $CountStat = array(); if (is_array($OutData)) { if ($key > 0) { $report->addPage(); } // outdata - Headings $report->cf_report_headersMain($OutData, $Config); if (!empty($OutData['Totals'])) { foreach ($OutData['Totals'] as $Field => $Value) { sort($fieldset); $totalData[$Field] = $Value; } $report->cf_report_datagrid($totalData, 7); unset($OutData['Totals']); } } $report->cf_report_spacer(); $Headers = array(); if (!empty($OutData[0])) { foreach ($OutData[0] as $Header => $v) { if (strpos($Config['_IndexType'][$Header], 'hide') === false) { if (!empty($Config['_FieldTitle'][$Header])) { $Headers[] = $Config['_FieldTitle'][$Header]; } else { $Headers[] = $Header; } } } $Total = count($OutData) - 1; $Body = array(); $Counter = 1; for ($i = 0; $i <= $Total; $i++) { if (is_array($OutData[$i])) { foreach ($OutData[$i] as $Field => $v) { if (strpos($Config['_IndexType'][$Field], 'hide') === false) { $Body[$i][] = str_replace(' ', '', html_entity_decode($v)); } } } } } $options["width"] = "100%"; $report->cf_report_data_col_grid($Headers, $Body, $OutData, $Config); $report->cf_report_spacer(); //break; } } $report->cf_report_generate_output(); mysql_close(); exit; } if ($exportFormat == 'csv') { $CSVout = fopen('php://output', 'w'); $prequery = explode('LIMIT', $_SESSION['queries'][$Media['ID']]); $sql_query = $prequery[0]; $filename = uniqid(date('mdHis')) . '.csv'; $out = ''; // Gets the data from the database $result = mysql_query($sql_query); $fields_cnt = mysql_num_fields($result); //dump($Config['_Field']); //dump($Config); //exit; $VisibleFields = array(); $FieldHeaders = array(); foreach ($Config['_Field'] as $Field => $Value) { if ($Config['_IndexType'][$Field] == 'index_show' || $Config['_IndexType'][$Field] == 'noindex_show') { $VisibleFields[] = $Field; $FieldHeaders[] = $Config['_FieldTitle'][$Field]; } } ob_start(); fputcsv($CSVout, $FieldHeaders, ',') . "\r\n"; $out .= ob_get_clean(); while ($exportData = mysql_fetch_assoc($result)) { // run each field type on the result $Row = array(); foreach ($Config['_Field'] as $Field => $Value) { $FieldType = explode('_', $Value); if (in_array($Field, $VisibleFields)) { if (count($FieldType) == 2) { // include fieldtype if (file_exists(DB_TOOLKIT . '/data_form/fieldtypes/' . $FieldType[0] . '/functions.php')) { include_once DB_TOOLKIT . '/data_form/fieldtypes/' . $FieldType[0] . '/functions.php'; } // [type_processValue($Value, $Type, $Field, $Config, $EID, $Data) $Func = $FieldType[0] . '_processvalue'; //$FieldValue = $outRow = $exportData[$Field]; if (function_exists($Func)) { // echo 'yes there is '.$Func.'<br>'; $Row[] = trim(strip_tags(str_replace('<br />', "\r\n", $Func($outRow, $FieldType[1], $Field, $Config, $Media['ID'], $exportData)))); } else { $Row[] = $outRow; } //dump($FieldType); } else { $Row[] = $exportData[$Field]; } } } //combine row ob_start(); fputcsv($CSVout, $Row, ',') . "\r\n"; $out .= ob_get_clean(); } //while($export) // Format the data header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); //header("Content-Length: " . strlen($out)); // Output to browser with appropriate mime type, you choose ;) //header("Content-type: text/x-csv"); //header("Content-type: text/csv"); header("Content-type: application/csv charset=UTF-8"); header("Content-Disposition: attachment; filename={$filename}"); //echo '<pre>'; echo $out; //echo '</pre>'; fclose($CSVout); mysql_close(); exit; } if ($exportFormat == 'template') { echo dt_renderInterface($Media['ID']); exit; } if ($exportFormat != 'pdf') { $Element = getelement($Media['ID']); $Config = $Element['Content']; if (!empty($Config['_Show_Plugins'])) { // to do : configure adding plugins to the tool bar if (file_exists(DB_TOOLKIT . 'data_report/plugins/' . $exportFormat . '/functions.php')) { include_once DB_TOOLKIT . 'data_report/plugins/' . $exportFormat . '/functions.php'; mysql_close(); exit; } } } } }
<?php session_start(); $uid = $_SESSION["uid"]; header("Content-Type:text/plain;charset=utf-8"); include_once 'fun.inc.php'; linkDB(); $arr = getElement($uid); echo json_encode($arr[1], JSON_UNESCAPED_UNICODE);
throw new Exception("Can't find {$archivepath}"); } $feed = new DOMDocument(); $feed->load($appcastpath); $xp = new DOMXPath($feed); $xp->registerNamespace("sparkle", SPARKLE_NS); $item = $xp->query("//item[enclosure/@sparkle:version='{$exactVersion}']")->item(0); if (!$item) { $item = getElement($feed->getElementsByTagName('channel')->item(0), "item"); newline($item); } setText(getElement($item, "title"), "Version {$niceVersion}"); setText(getElement($item, "pubDate"), date(DATE_RSS)); setText(getElement($item, "sparkle:minimumSystemVersion", SPARKLE_NS), $minOSVersion); getElement($item, "description"); $enc = getElement($item, "enclosure"); $enc->setAttributeNS(SPARKLE_NS, "sparkle:version", $exactVersion); $enc->setAttribute("url", $download_url); $enc->setAttribute("length", filesize($archivepath)); $enc->setAttributeNS(SPARKLE_NS, "sparkle:dsaSignature", signUpdate($archivepath, $pempath)); file_put_contents($appcastpath, $feed->saveXML()); function readKey($name) { $plistpath = realpath('Info.plist'); $domain = preg_replace('/\\.plist$/', '', $plistpath); return system("defaults read " . escapeshellarg($domain) . " " . escapeshellarg($name)); } function getElement(DOMElement $parent, $tagname, $ns = NULL) { if ($ns !== NULL) { $el = $parent->getElementsByTagNameNS($ns, preg_replace('/^.*:/', '', $tagname))->item(0);
\t\t<div id="search-results"> \t\t<h3 class="bars">Results</h3> \t\t<ul class="list-group" style="text-align: left;"> TOP; if ($result[1] != "") { $error = "Error finding the user specified."; $results .= getElement("", "", 0, $error); $error = ""; } else { if ($result[0]->num_rows < 1) { $results .= getElement("", "", 0, "No users found."); } else { $i = 0; while ($row = $result[0]->fetch_assoc()) { $results .= getElement($row['username'], $row['id'], $i++); } } } $results .= <<<BOTTOM \t\t</ul> \t\t</div> BOTTOM; } if (isset($_POST['sharetoID']) && isset($_POST['sharefromID'])) { if (is_numeric($_POST['sharetoID']) && is_numeric($_POST['sharefromID'])) { $error = addShare($conn, $_POST['sharefromID'], $_POST['sharetoID']); if (!$error) { $success = "Shared files with user successfully!"; }
function read835($filePath) { $eob = new eob(); $file = file($filePath); if ($file == false) { return false; } else { $line = explode("~", $file[0]); $i = 0; if (getElement($line[$i], 0) == "ISA") { $i++; } else { exit("bad Segment " . $i); } if (getElement($line[$i], 0) == "GS") { $i++; } else { exit("bad Segment " . $i); } if (getElement($line[$i], 0) == "ST") { $i++; } else { exit("bad Segment " . $i); } if (getElement($line[$i], 0) == "BPR") { $eob->setCheckDate(getElement($line[$i], 16)); $eob->setCheckAmount(getElement($line[$i], 2)); $i++; } else { exit("bad Segment " . $i); } if (getElement($line[$i], 0) == "TRN") { $eob->setCheckNumber(getElement($line[$i], 2)); $i++; } else { exit("bad Segment " . $i); } if (getElement($line[$i], 0) == "REF") { $i++; } else { exit("bad Segment " . $i); } if (getElement($line[$i], 0) == "REF") { $i++; } if (getElement($line[$i], 0) == "DTM") { $i++; } else { exit("bad Segment " . $i); } if (getElement($line[$i], 0) == "N1") { $i++; } else { exit("bad Segment " . $i); } if (getElement($line[$i], 0) == "N3") { $i++; } else { exit("bad Segment " . $i); } if (getElement($line[$i], 0) == "N4") { $i++; } else { exit("bad Segment " . $i); } if (getElement($line[$i], 0) == "PER") { $i++; } else { exit("bad Segment " . $i); } if (getElement($line[$i], 0) == "N1") { $i++; } else { exit("bad Segment " . $i); } if (getElement($line[$i], 0) == "N4") { $i++; } else { exit("bad Segment " . $i); } if (getElement($line[$i], 0) == "REF") { $i++; } if (getElement($line[$i], 0) == "LX") { $i++; } else { exit("bad Segment " . $i); } if (getElement($line[$i], 0) == "CLP") { while (getElement($line[$i], 0) == "CLP") { $eobClaim = new eobClaim(); $eobClaim->setEchoField(getElement($line[$i], 1)); $jclincval = "UNDEF"; $dentrix = getDentrix(); if (!$dentrix) { exit("Connection Failed!!"); $jclincval = "CON ERROR"; } else { $jclincvala = explode("_", getElement($line[$i], 1)); $PARM1 = $jclincvala[0]; $sqlstring = "select DDB_RSC.RSCID from DDB_RSC inner join DDB_CLAIM on DDB_RSC.URSCID=DDB_CLAIM.ClinicAppliedTo where DDB_CLAIM.CLAIMID={$PARM1}"; $sr = sqlsrv_query($dentrix, $sqlstring); if (!$sr) { } else { while ($row = sqlsrv_fetch_array($sr, SQLSRV_FETCH_NUMERIC)) { $jclincval = $row[0]; } } } sqlsrv_close($dentrix); $eobClaim->setClinicId($jclincval); $eobClaim->setTCN(getElement($line[$i], 7)); $eobClaim->setClaimCharge(getElement($line[$i], 3)); $eobClaim->setClaimPaid(getElement($line[$i], 4)); $eobClaim->setStatus(getElement($line[$i], 2)); $i++; while (getElement($line[$i], 0) == "CAS") { if (getElement($line[$i], 1) == "CO") { $eobClaim->setAdjustmentCode(getElement($line[$i], 2)); } $i++; } if (getElement($line[$i], 0) == "NM1") { $eobClaim->setLastName(getElement($line[$i], 3)); $eobClaim->setFirstName(getElement($line[$i], 4)); $eobClaim->setMedicaid(getElement($line[$i], 9)); $i++; } else { exit("bad Segment " . $i); } while (getElement($line[$i], 0) == "NM1") { $i++; } while (getElement($line[$i], 0) == "MIA") { $i++; } if (getElement($line[$i], 0) == "MOA") { $eobClaim->setRarCode(getElement($line[$i], 3)); $i++; } while (getElement($line[$i], 0) == "REF") { if (getElement($line[$i], 1) == "9A") { $eobClaim->setRateCode(getElement($line[$i], 2)); } $i++; } if (getElement($line[$i], 0) == "DTM") { $eobClaim->setServiceDate(getElement($line[$i], 2)); $i++; } else { exit("bad Segment " . $i); } while (getElement($line[$i], 0) == "DTM") { $i++; } while (getElement($line[$i], 0) == "PER") { $i++; } while (getElement($line[$i], 0) == "AMT") { $i++; } if (getElement($line[$i], 0) == "SVC") { while (getElement($line[$i], 0) == "SVC") { $eobClaimLine = new eobClaimLine(); $adaCode = explode(":", getElement($line[$i], 1)); $eobClaimLine->setAdaCode($adaCode[1]); $eobClaimLine->setLineCharge(getElement($line[$i], 2)); $eobClaimLine->setLinePaid(getElement($line[$i], 3)); $i++; if (getElement($line[$i], 0) == "DTM") { if (getElement($line[$i], 1) == "472") { $eobClaimLine->setServiceDate(getElement($line[$i], 2)); } $i++; } else { exit("bad Segment " . $i); } while (getElement($line[$i], 0) == "CAS") { if (getElement($line[$i], 1) == "PR") { $eobClaimLine->setServiceAdj(getElement($line[$i], 2)); } if (getElement($line[$i], 1) == "OA") { $eobClaimLine->setServiceAdj(getElement($line[$i], 2)); } if (getElement($line[$i], 1) == "CO") { if (getElement($line[$i], 2) == "94") { $eobClaimLine->setCapAddOn(getElement($line[$i], 3)); } if (getElement($line[$i], 2) == "45") { $eobClaimLine->setOverPay(getElement($line[$i], 3)); } if (getElement($line[$i], 5) == "45") { $eobClaimLine->setOverPay(getElement($line[$i], 6)); } if (getElement($line[$i], 2) != "45" && getElement($line[$i], 2) != "94") { $eobClaimLine->setServiceAdj(getElement($line[$i], 2)); } } $i++; } while (getElement($line[$i], 0) == "REF") { if (getElement($line[$i], 1) == "1S") { $eobClaimLine->setApgNumber(getElement($line[$i], 2)); } $i++; } while (getElement($line[$i], 0) == "AMT") { if (getElement($line[$i], 1) == "B6") { $eobClaimLine->setMaxAllowed(getElement($line[$i], 2)); } if (getElement($line[$i], 1) == "ZK") { $eobClaimLine->setApgPaid(getElement($line[$i], 2)); } if (getElement($line[$i], 1) == "ZL") { $eobClaimLine->setBlendPaid(getElement($line[$i], 2)); } $i++; } while (getElement($line[$i], 0) == "QTY") { if (getElement($line[$i], 1) == "ZK") { $eobClaimLine->setApgWeight(getElement($line[$i], 2)); } if (getElement($line[$i], 1) == "ZL") { $eobClaimLine->setApgPercent(getElement($line[$i], 2)); } $i++; } while (getElement($line[$i], 0) == "LQ") { if (getElement($line[$i], 1) == "HE") { $eobClaimLine->setServiceRarc(getElement($line[$i], 2)); } $i++; } $eobClaim->addClaimLine($eobClaimLine); } // while SVC } // if SVC $eob->addEobClaim($eobClaim); } } else { exit("bad Segment " . $i); } //if CLP if (getElement($line[$i], 0) == "PLB") { $i++; } if (getElement($line[$i], 0) == "SE") { $i++; } else { exit("bad Segment " . $i); } if (getElement($line[$i], 0) == "GE") { $i++; } else { exit("bad Segment " . $i); } if (getElement($line[$i], 0) == "IEA") { $i++; } else { exit("bad Segment " . $i); } return $eob; } }
function readDSC($reader, $section, $validHTML, $openTag, $hrefTag) { // variables $level = ""; $count = 0; $date = $lhs = $rhs = $table = $otherfindaid = $acqinfo = $scopecontent = $accessrestrict = $separatedmaterial = $relatedmaterial = ""; $insideDID = false; $current = ""; $boldMe = false; $class = ""; $nestedC = array(); $render = ""; $isItalics = false; $depth = 0; $reduced = 0; $otherLevel = ""; $subseriesCount = 0; $miscFields = array("relatedmaterial", "separatedmaterial", "scopecontent", "accessrestrict", "acqinfo", "otherfindaid", "arrangement"); $prior = ""; $extentValue = ""; $empty = false; while ($reader->read()) { if ($reader->isEmptyElement) { $empty = true; } if ($reader->name != "#text" && $reader->name != "extref" && !array_key_exists($reader->name, $validHTML)) { $prior = $current; $current = $reader->name; } // debug //echo "CURRENT = " . $current . "<br />"; //echo "PRIOR = " . $prior . "<br />"; //echo "LEVEL = " . $level . "<br />"; if ($reader->name == "#comment") { continue; } if ($reader->name == "parent_heading") { if ($reader->nodeType == XMLReader::ELEMENT) { print "<h2 class=\"parent_heading\">"; } else { print "</h2>"; } } // end IF parent heading if ($reader->getAttribute("level") != "") { $level = $reader->getAttribute("level"); } if ($reader->getAttribute("otherlevel") != "") { $otherLevel = $reader->getAttribute("otherlevel"); } if ($reader->getAttribute("render") != "" && !array_key_exists($reader->name, $validHTML)) { $render = $reader->getAttribute("render"); } // reset count if ($level == "series" || $level == "subseries") { $count = 0; } if ($reader->name == "c" && $reader->getAttribute("level") == "file") { if ($reader->nodeType == XMLReader::ELEMENT) { if ($reduced > 2) { $count++; } print '<div class="c">'; array_push($nestedC, 'c'); $depth++; $reduced = 0; } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { print "</div><!-- class c-->"; array_pop($nestedC); $depth--; $reduced++; } } } // if name is c and level is file // print out any valid HTML // COMMENTING OUT FOR NOW -- DEBUG /* if (in_array($reader->name,$validHTML) && ($level == "series" || $level == "subseries" || $level == "subgrp")) { if ($reader->nodeType == XMLReader::ELEMENT) echo "<" . $validHTML[$reader->name] . ">"; else if ($reader->nodeType == XMLReader::END_ELEMENT) echo "</". $validHTML[$reader->name] . ">"; } */ if (($reader->name == "unittitle" || $reader->name == "unitdate") && ($level == "series" || $level == "subseries" || $level == "subgrp" || $level == "otherlevel")) { //echo $reader->name . "<br>$level<br><br>"; if ($reader->nodeType == XMLReader::ELEMENT) { if ($reader->name == "unittitle") { print '<br /><br /><a name="' . $level . $subseriesCount++ . '"></a>'; } print getElement($level, true, $otherLevel); } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { print getElement($level, false, $otherLevel); if ($otherLevel != "") { $otherLevel == ""; } } } //echo "otherlevel: " . $otherLevel . "<br />"; } if (($reader->name == "arrangement" || $reader->name == "extent" || $reader->name == "scopecontent" || $reader->name == "otherfindaid" || $reader->name == "separatedmaterial" || $reader->name == "relatedmaterial" || $reader->name == "physdesc" || $reader->name == "extent" || $reader->name == "arrangement" || $reader->name == "dimensions") && ($level == "series" || $level == "subseries" || $level == "subgrp" || $level == "otherlevel")) { /* if ($reader->nodeType == XMLReader::ELEMENT) { //echo "<br />\n"; } if (($reader->name == "arrangement" || $reader->name == "extent" || $reader->name=="otherfindaid") && $reader->nodeType == XMLReader::ELEMENT) { //echo '<br />'; } */ if ($reader->nodeType == XMLReader::ELEMENT && $level == "subseries") { echo "\n<div class=\"subseries-" . $reader->name . "\">\n"; } else { if ($reader->nodeType == XMLReader::END_ELEMENT && $level == "subseries") { echo '</div><!-- subseries-' . $reader->name . "-->\n"; } } if ($reader->nodeType == XMLReader::ELEMENT && $level == "subseries" && $reader->name == "extent") { echo "<br />"; } // this is separate because i might want to treat the series differently... if ($reader->nodeType == XMLReader::ELEMENT && $level == "series") { echo "\n<div class=\"series-" . $reader->name . "\">\n"; } else { if ($reader->nodeType == XMLReader::END_ELEMENT && $level == "series") { echo '</div><!-- series-' . $reader->name . "-->\n"; } } if ($reader->nodeType == XMLReader::ELEMENT && $level == "series" && $reader->name == "extent") { echo "<br />"; } $scopecontent = str_replace('".', '', $scopecontent); if (str_replace('..', '', $scopecontent) != "") { echo "<p>" . str_replace('..', '. ', $scopecontent) . "</p><!-- scope-->"; } // REPLACED <br /><br /> in all if ($otherfindaid != "") { echo "<div>" . $otherfindaid . "</div><!-- othf-->\n"; } if (str_replace('..', '', $separatedmaterial) != "") { echo str_replace('..', '. ', $separatedmaterial) . '<!-- sep -->'; } if (str_replace('..', '', $relatedmaterial) != "") { echo str_replace('..', '. ', $relatedmaterial) . "<!-- rel -->"; } $relatedmaterial = $separatedmaterial = $scopecontent = $accessrestrict = $acqinfo = $otherfindaid = ""; } // DEBUG //echo $current . " " . $reader->name . "<br />\n"; if ($current == "did") { $insideDID = true; } if ($reader->name == "c" && ($level == "file" || $level == "item")) { if ($count % 2 == 0) { $class = "even"; } else { $class = "odd"; } if ($reader->nodeType == XMLReader::ELEMENT) { $table = "<table width=\"100%\" class=\"cTable\"><tr>"; } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { $table .= "<td class=\"{$class} left\">"; $lhs = rtrim($lhs); if (substr($lhs, -1) == ":") { $lhs = substr($lhs, 0, -1); } $lhs = str_replace('</div>:', ':</div>', $lhs); $table .= "{$lhs}"; $table .= "</td>\n<td class=\"{$class} middle\">{$rhs}"; if (str_replace('..', '', $scopecontent) != "") { $scopecontent = str_replace('?.', '', str_replace(';.', '', str_replace('".', '"', $scopecontent))); } $table .= "<div class=\"scope\">" . str_replace("..", ". ", $scopecontent) . " " . str_replace('..', '. ', $accessrestrict) . " " . str_replace('..', '. ', $acqinfo); if ($otherfindaid != "") { $table .= $otherfindaid; } if (str_replace('..', '', $separatedmaterial) != "") { $table .= str_replace('..', '. ', $separatedmaterial); } if (str_replace('..', '', $relatedmaterial) != "") { $table .= str_replace('..', '. ', $relatedmaterial); } $table .= "</div></td>\n<td class=\"date\">{$date}</td></tr></table>\n"; print $table; $lhs = $rhs = $table = $date = ""; $relatedmaterial = $separatedmaterial = $scopecontent = $accessrestrict = $acqinfo = $otherfindaid = ""; $insideDID = $boldMe = false; $count++; } } // if END_ELEMENT } // end IF reader name is C //DID or FILE // TESTING HERE // if valid markup, print it out for select fields if (array_key_exists($reader->name, $validHTML)) { if (in_array($current, $miscFields)) { if (!isset(${$current})) { ${$current} = ''; } if ($reader->nodeType == XMLReader::ELEMENT) { ${$current} .= "<" . $validHTML[$reader->name] . ">"; } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { ${$current} .= "</" . $validHTML[$reader->name] . ">"; } } } } // if there is markup that we should print out, do so (only if in $validHTML array) if (array_key_exists($reader->name, $validHTML) && ($level != "file" || $level != "item") || array_key_exists(strtolower($reader->name), $validHTML) && ($level == "file" || $level == "item") && (strtolower($reader->name) == "p" || strtolower($reader->name == "title"))) { if ($reader->nodeType == XMLReader::ELEMENT) { if ($reader->name != "") { if ($level == "c" || $level == "item") { $rhs .= "<" . $validHTML[$reader->name] . '>' . "\n"; if (in_array($current, $miscFields) && $reader->name == "title") { $isItalics = true; } } else { if (!in_array($current, $miscFields) || $reader->name != "title") { print "<" . $validHTML[$reader->name] . '>' . "\n"; } } array_push($openTag, $reader->name); } else { array_push($openTag, $reader->name); } } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { if ($reader->name != "") { if ($level == "c" || $level == "item") { $rhs .= "</" . $validHTML[$reader->name] . '>' . "\n"; } else { if (!in_array($current, $miscFields)) { print "</" . $validHTML[$reader->name] . '>' . "\n"; } } array_pop($openTag); } } } } // end IF reader->name in validHTML array if ($reader->hasAttributes) { if ($reader->getAttribute("level") != "") { $level = $reader->getAttribute("level"); } if ($current != "otherfindaid" && ($reader->name == "extref" || $reader->name == "dao")) { $href = $reader->getAttribute("xlink:href"); if ($reader->nodeType == XMLReader::ELEMENT) { $rhs .= '<a href="' . $href . '">'; } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { $rhs .= '</a> '; } } } // if extref if ($current == "otherfindaid" && $reader->name == "extref") { $href = $reader->getAttribute("xlink:href"); if ($reader->nodeType == XMLReader::ELEMENT) { $otherfindaid .= ' <a href="' . $href . '">'; } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { $otherfindaid .= '</a>'; } } } // need a label for the containers if ($reader->name == "container" || $reader->name == "unitid") { // && ($level == "file" || $level == "item")) { $labelT = $labelL = ""; if ($reader->getAttribute("type")) { $labelT = $reader->getAttribute("type"); } if ($reader->getAttribute("label")) { $labelL = $reader->getAttribute("label"); } if ($labelL != "") { $label = $labelL; } else { $label = $labelT; } if ($reader->nodeType == XMLReader::ELEMENT) { if ($level == "file" || $level == "item") { if ($current == "unitid") { $lhs .= "<br />"; } $lhs .= "<div class=\"label\">" . $label . " "; } } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { if ($level == "file" || $level == "item") { $lhs .= "</div>"; } } } } // if CONTAINER } // if has attributes if ($reader->getAttribute("render") != "") { $render = $reader->getAttribute("render"); if ($reader->nodeType == XMLReader::ELEMENT) { $rhs .= "<span class=\"{$render}\">"; } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { $rhs .= "</span>"; $render = ""; } } } // if RENDER //} // if has attributes if (!array_key_exists($reader->name, $validHTML) && ($level == "file" || $level == "item") && ($current == "unittitle" || $current == "origination" || $current == "name" || $current == "extent" || $current == "physdesc" || $current == "note" || $current == "genreform")) { // put a colon between these things if something else was there if ($current == "genreform" && $prior == "extent" && $reader->nodeType == XMLReader::ELEMENT && $extentValue != "") { $rhs .= ": "; $extentValue = ""; } else { if ($current == "genreform" && $prior == "genreform" && rtrim($reader->value) != "") { $rhs .= ", "; } } if ($reader->nodeType == XMLReader::ELEMENT) { $rhs .= '<div class="' . $current . '">'; } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { $rhs .= '</div><!--' . $current . '-->'; } } } if (($level == "file" || $level == "item") && $current == "unitdate") { if ($reader->nodeType == XMLReader::ELEMENT) { $date .= '<div class="date">'; } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { $date .= '</div><!--' . $current . '-->'; } } } if (($level == "file" || $level == "item") && stristr($current, "restrict") && !array_key_exists($reader->name, $validHTML)) { if ($reader->nodeType == XMLReader::ELEMENT) { print "<div class=\"restrict\">\n"; } else { if ($reader->nodeType == XMLReader::END_ELEMENT) { print "</div><!-- scope -->\n"; } } } if ($reader->hasValue && $reader->value != "") { if ($current == "container" || $current == "unitid") { if (substr($lhs, -6) == "</div>" && $current == "container") { $lhs .= ": "; } if ($render != "") { $lhs .= '<span class="' . $render . '">'; } $lhs .= $reader->value; if ($render != "") { $lhs .= "</span>"; $render = ""; } } else { if ($current == "separatedmaterial" || $current == "relatedmaterial" || $current == "scopecontent" || $current == "acqinfo" || $current == "accessrestrict" || $current == "otherfindaid") { // && !array_key_exists($reader->name,$validHTML)) { //echo '<p>|name=' . $reader->name . '||current=' . $current . '|value=' . $reader->value . '|</p>'; $pattern = "/[\\w+,]/"; preg_match($pattern, $reader->value, $matches); if (count($matches) > 0 || array_key_exists($reader->name, $validHTML)) { if ($current == "scopecontent") { if ($isItalics) { $scopecontent .= "<em>" . $reader->value . "</em>"; $isItalics = false; } else { $scopecontent .= $reader->value . " "; } } else { if ($current == "acqinfo") { $acqinfo .= rtrim($reader->value) . " "; } else { if ($current == "accessrestrict") { $accessrestrict .= rtrim($reader->value) . " "; } else { if ($current == "otherfindaid") { if (array_key_exists($reader->name, $validHTML)) { $otherfindaid .= $validHTML[$reader->name] . rtrim($reader->value) . $validHTML[$reader->name]; } else { //$otherfindaid .= $reader->name . " " . $current . " "; $otherfindaid .= rtrim($reader->value); // DEBUG } } else { if ($current == "separatedmaterial") { $separatedmaterial .= rtrim($reader->value) . " "; } else { if ($current == "relatedmaterial") { $relatedmaterial .= rtrim($reader->value) . " "; } } } } } } } //print "DEBUG: $current $scopecontent $acqinfo $accessrestrict $otherfindaid"; } else { if ($insideDID && ($current == "unittitle" || $current == "origination" || $current == "name" || $current == "genreform" || $current == "extent" || $current == "physdesc" || $current == "note" || $current == "dimensions") && ($level == "file" || $level == "item")) { if (count($nestedC) == 1) { $rhs .= rtrim($reader->value); } else { $rhs .= rtrim($reader->value); } $render = ""; // TODO EXTENT if ($current == "extent" && ($reader->nodeType == XMLReader::ELEMENT || $empty) && $extentValue == "") { $extentValue = rtrim($reader->value); //print "Setting extentvalue1 to |$extentValue|<br />"; } else { if ($current == "extent" && ($reader->nodeType == XMLReader::END_ELEMENT || !$empty)) { $extentValue = $current; //print "Setting extentvalue2 to |$extentValue|<br />"; } } } else { if ($insideDID && $current == "unitdate" && ($level == "file" || $level == "item")) { if ($render != "") { $date .= '<span class="' . $render . '">'; } if (count($nestedC) == 1) { $date .= rtrim($reader->value); } else { $date .= rtrim($reader->value); } if ($render != "") { $date .= "</span>"; $render = ""; } } else { if ($render != "") { print '<span class="' . $render . '">'; } print rtrim($reader->value); if ($render != "") { print "</span>"; $render = ""; } } } } } } // end IF reader->value } // end WHILE echo '<p class="top"><a href="#top">Return to top</a></p>'; }
<?php session_start(); $uid = $_SESSION["uid"]; header("Content-Type:text/plain;charset=utf-8"); include_once 'fun.inc.php'; linkDB(); $data = getElement($uid); echo json_encode($data[0], JSON_UNESCAPED_UNICODE);
if (isset($error) && $error) { echo getElement("", 0, 0, $error); } else { if ($result[1]) { $str = "There was an error retrieving users shared with this" . " account. Please try again."; echo getElement("", 0, 0, $str); } else { if ($result[0]->num_rows < 1) { echo getElement("", 0, 0, "You are not currently sharing files with anyone. You can <a href=\"share.php\">fix</a> that."); } else { $i = 0; while ($row = $result[0]->fetch_assoc()) { $temp = get_info($conn, $row['shareid']); //doesn't print out error which may happen if (!isset($temp['error'])) { echo getElement($temp['username'], $row['shareid'], $i++); } } } } } $conn->close(); ?> </ul> </div> </div> <!-- //container --> </div> <!-- //contact --> </div> </div>