$thepath = get_resource_path($resource, true, getval("previewsize", ""), false, 'jpg', -1, 1, false, "", $results[$n]["ref"]); if (file_exists($thepath) && count($results[$n]) != 1) { $results[$n]['preview'] = $thepath; } } } if (!is_array($results) || isset($results[0]) && count($results[0]) == 1) { $results = array(); } if (getval("content", "") == "json") { header('Content-type: application/json'); echo json_encode($results); } else { if (getval("content", "") == "xml") { header('Content-type: application/xml'); echo '<?xml version="1.0" encoding="UTF-8"?><results>'; foreach ($results as $result) { echo '<resource>'; foreach ($result as $resultitem => $value) { echo '<' . $resultitem . '>'; echo xml_entities($value); echo '</' . $resultitem . '>'; } echo '</resource>'; } echo '</results>'; } else { echo json_encode($results); } } // echo json without headers by default
/** * Send back the data for a batch test (just the list of test ID's) * * @param mixed $id * @param mixed $testPath */ function BatchResult($id, $testPath) { header('Content-type: text/xml'); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; echo "<response>"; if (strlen($_REQUEST['r'])) { echo "<requestId>{$_REQUEST['r']}</requestId>"; } $tests = null; if (gz_is_file("{$testPath}/bulk.json")) { $tests = json_decode(gz_file_get_contents("{$testPath}/bulk.json"), true); } elseif (gz_is_file("{$testPath}/tests.json")) { $legacyData = json_decode(gz_file_get_contents("{$testPath}/tests.json"), true); $tests = array(); $tests['variations'] = array(); $tests['urls'] = array(); foreach ($legacyData as &$legacyTest) { $tests['urls'][] = array('u' => $legacyTest['url'], 'id' => $legacyTest['id']); } } if (count($tests['urls'])) { echo "<statusCode>200</statusCode>"; echo "<statusText>Ok</statusText>"; if (strlen($_REQUEST['r'])) { echo "<requestId>{$_REQUEST['r']}</requestId>"; } $host = $_SERVER['HTTP_HOST']; $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\'); echo "<data>"; foreach ($tests['urls'] as &$test) { echo "<test>"; echo "<testId>{$test['id']}</testId>"; echo "<testUrl>" . xml_entities($test['u']) . "</testUrl>"; echo "<xmlUrl>http://{$host}{$uri}/xmlResult/{$test['id']}/</xmlUrl>"; echo "<userUrl>http://{$host}{$uri}/result/{$test['id']}/</userUrl>"; echo "<summaryCSV>http://{$host}{$uri}/result/{$test['id']}/page_data.csv</summaryCSV>"; echo "<detailCSV>http://{$host}{$uri}/result/{$test['id']}/requests.csv</detailCSV>"; echo "</test>"; // go through all of the variations as well foreach ($test['v'] as $variationIndex => $variationId) { echo "<test>"; echo "<testId>{$variationId}</testId>"; echo "<testUrl>" . xml_entities(CreateUrlVariation($test['u'], $tests['variations'][$variationIndex]['q'])) . "</testUrl>"; echo "<xmlUrl>http://{$host}{$uri}/xmlResult/{$variationId}/</xmlUrl>"; echo "<userUrl>http://{$host}{$uri}/result/{$variationId}/</userUrl>"; echo "<summaryCSV>http://{$host}{$uri}/result/{$variationId}/page_data.csv</summaryCSV>"; echo "<detailCSV>http://{$host}{$uri}/result/{$variationId}/requests.csv</detailCSV>"; echo "</test>"; } } echo "</data>"; } else { echo "<statusCode>404</statusCode>"; echo "<statusText>Invalid Test ID: {$id}</statusText>"; echo "<data>"; echo "</data>"; } echo "</response>"; }
//submit a link for processing if ($_POST['submit'] and $_POST['link']) { //extract info from link $content = file_get_contents($_POST['link']); $title = explode('<title>', $content); $title = explode('</title>', $title[1]); $title = $title[0]; $description = ""; $link = $_POST['link']; //add to feed $xml = ' <item> <title>' . xml_entities($title) . '</title> <description>' . xml_entities($description) . '</description> <link>' . xml_entities($link) . '</link> </item> '; if ($title and $link) { $query = $db->connection->prepare("\n \t\tINSERT INTO items (user, time, title, description, link)\n VALUES(:user, :time, :title, :description, :link);\n ")->execute(array(':user' => $_SESSION['user_id'], ':time' => time(), ':title' => $title, ':description' => $description, ':link' => $link)); echo "<p>Added <b>{$title}</b></p>"; } else { echo ' <p class="error"> Could not retrieve link. <br><br> ' . print_r($content, true) . ' </p>'; } } $code = $_SESSION['rss_key']; ?>
function array2xml_push(&$string, &$r, $compact, $ind = -1) { $old_ind = ++$ind - 1; if ($old_ind < 0) { $old_ind = 0; } foreach ($r as $i => $d) { $d =& $r[$i]; if (is_scalar($d)) { $string .= xml_entities($d); } elseif (is_array($d)) { if ($compact) { $i = strtok($i, ","); } $ls = str_repeat(" ", $ind); $string .= "\n{$ls}<{$i}>"; $string .= array2xml_push($string, $d, $compact, $ind); $ls = str_repeat(" ", $old_ind); $string .= "</{$i}>\n{$ls}"; } } }
eval($df[$x]['value_filter']); } else { if (file_exists($plugin)) { include $plugin; } else { if ($df[$x]["type"] == 4 || $df[$x]["type"] == 6 || $df[$x]["type"] == 10) { $value = NiceDate($value, true, false); } } } if ($rss_show_field_titles) { $add_desc .= $df[$x]['title'] . ": "; } } } $add_desc .= xml_entities(strip_tags($value)) . "<![CDATA[<br/>]]>"; } } } $description = "<![CDATA[<img src='{$imgurl}' align='left' height='75' border='0' />]]>" . $add_desc; $val["pubDate"] = $pubdate; //$val["Category"] = $category; $val["guid"] = $ref; // function AddArticle($title, $link, $description, $author, $optional = '') // $r->AddArticle($category." - ".substr($title,0,20)."...", $url, $title, "", $val); $r->AddArticle($title, $url, $description, $val); } //Header("content-type: text/xml"); $r->Output(); } else { $r->Output();
function ArrayToXML($array) { $ret = ''; if (is_array($array)) { foreach ($array as $key => $val) { if (is_numeric($key)) { $key = 'value'; } $key = preg_replace('/[^a-zA-Z0-9\\.\\-_]/', '_', $key); $ret .= "<{$key}>"; if (is_array($val)) { $ret .= "\n" . ArrayToXML($val); } else { $ret .= xml_entities($val); } $ret .= "</{$key}>\n"; } } return $ret; }
$vars['path1'] = htmlentities($path1, ENT_QUOTES, 'UTF-8'); $vars['safepath1'] = htmlentities($path1, ENT_QUOTES, 'UTF-8'); $vars['path2'] = htmlentities($path2, ENT_QUOTES, 'UTF-8'); $vars['safepath2'] = htmlentities($path2, ENT_QUOTES, 'UTF-8'); $vars['rev1'] = $rev1; $vars['rev2'] = $rev2; // Set variables used for the more recent of the two revisions $rev = max($rev1, $rev2); $history = $svnrep->getLog($path, $rev, $rev, false, 1); if ($history) { $logEntry = $history->curEntry; $vars['rev'] = $logEntry->rev; $vars['peg'] = $peg; $vars['date'] = $logEntry->date; $vars['author'] = $logEntry->author; $vars['log'] = xml_entities($logEntry->msg); } else { $vars['warning'] = 'Problem with comparison.'; } $noinput = empty($path1) || empty($path2); // Generate the diff listing $relativePath1 = $path1; $relativePath2 = $path2; $svnpath1 = encodepath($svnrep->getSvnPath(str_replace(DIRECTORY_SEPARATOR, '/', $path1))); $svnpath2 = encodepath($svnrep->getSvnPath(str_replace(DIRECTORY_SEPARATOR, '/', $path2))); $debug = false; if (!$noinput) { $cmd = $config->getSvnCommand() . ' diff ' . ($ignoreWhitespace ? '-x -w ' : '') . $rep->svnParams() . quote($svnpath1 . '@' . $rev1) . ' ' . quote($svnpath2 . '@' . $rev2); } function clearVars() {
if (empty($rev)) { $rev = $youngest; } $history = $svnrep->getLog($path, $rev, '', false, 2, $peg); if ($path[0] != '/') { $ppath = '/' . $path; } else { $ppath = $path; } $prevrev = @$history->entries[1]->rev; $vars['path'] = htmlentities($ppath, ENT_QUOTES, 'UTF-8'); $vars['rev1'] = $rev; $vars['rev2'] = $prevrev; $vars['prevrev'] = $prevrev; if ($history) { $vars['log'] = xml_entities($history->entries[0]->msg); $vars['date'] = $history->entries[0]->date; $vars['author'] = $history->entries[0]->author; $vars['rev'] = $vars['rev1'] = $history->entries[0]->rev; $vars['peg'] = $peg; } createPathLinks($rep, $ppath, $passrev, $peg); $passRevString = createRevAndPegString($passrev, $peg); if ($rev != $youngest) { $vars['goyoungesturl'] = $config->getURL($rep, $path, 'diff') . ($peg ? 'peg=' . $peg : ''); $vars['goyoungestlink'] = '<a href="' . $vars['goyoungesturl'] . '">' . $lang['GOYOUNGEST'] . '</a>'; } $vars['revurl'] = $config->getURL($rep, $path, 'revision') . $passRevString; $vars['revlink'] = '<a href="' . $vars['revurl'] . '">' . $lang['LASTMOD'] . '</a>'; $vars['logurl'] = $config->getURL($rep, $path, 'log') . $passRevString; $vars['loglink'] = '<a href="' . $vars['logurl'] . '">' . $lang['VIEWLOG'] . '</a>';
$prevRev = $history->entries[1]->rev; $prevPath = $history->entries[1]->path; $vars['prevrev'] = $prevRev; $vars['prevrevurl'] = $revurl . 'rev=' . $prevRev; //echo 'PREV='.$vars['prevrevurl'].'<br/>'; } // Save the entry from which we pull information for the current revision. $logEntry = isset($history->entries[0]) ? $history->entries[0] : null; $bugtraq = new Bugtraq($rep, $svnrep, $ppath); $vars['action'] = ''; $vars['rev'] = $rev; $vars['peg'] = $peg; $vars['path'] = htmlentities($ppath, ENT_QUOTES, 'UTF-8'); $vars['date'] = $logEntry ? $logEntry->date : ''; $vars['author'] = $logEntry ? $logEntry->author : ''; $vars['log'] = $logEntry ? nl2br($bugtraq->replaceIDs(create_anchors(xml_entities($logEntry->msg)))) : ''; $isDir = @$_REQUEST['isdir'] == 1 || $path == '' || $path == '/'; $vars['logurl'] = $config->getURL($rep, $path, 'log') . $passRevString . ($isDir ? '&isdir=1' : ''); $vars['loglink'] = '<a href="' . $vars['logurl'] . '">' . $lang['VIEWLOG'] . '</a>'; $dirPath = $isDir ? $path : dirname($path) . '/'; $vars['directoryurl'] = $config->getURL($rep, $dirPath, 'dir') . $passRevString . '#' . anchorForPath($dirPath); $vars['directorylink'] = '<a href="' . $vars['directoryurl'] . '">' . $lang['LISTING'] . '</a>'; if ($path != $dirPath) { $vars['filedetailurl'] = $config->getURL($rep, $path, 'file') . $passRevString; $vars['filedetaillink'] = '<a href="' . $vars['filedetailurl'] . '">' . $lang['FILEDETAIL'] . '</a>'; $vars['blameurl'] = $config->getURL($rep, $path, 'blame') . $passRevString; $vars['blamelink'] = '<a href="' . $vars['blameurl'] . '">' . $lang['BLAME'] . '</a>'; } if ($rep->isRssEnabled()) { $vars['rssurl'] = $config->getURL($rep, $path, 'rss') . ($peg ? 'peg=' . $peg : ''); $vars['rsslink'] = '<a href="' . $vars['rssurl'] . '">' . $lang['RSSFEED'] . '</a>';
function db_query_series($mysqli, $where_clause) { if (empty($where_clause)) { $query = "SELECT * FROM series"; } else { $where_clause = trim($where_clause); $query = "SELECT * FROM series WHERE title='" . $where_clause . "'"; } if ($result = $mysqli->query($query)) { $return_str = ""; while ($row = $result->fetch_assoc()) { $title = $row["title"]; // $title = xmlsafe($title); $poster = $row["poster"]; $poster = substr($poster, 34); $poster = image_exists($poster); $plot = $row["plot"]; $plot = xml_entities($plot); $return_str .= "<series>"; // echo $row["title"]; $return_str .= '<title>' . $title . '</title>'; $return_str .= '<year>' . $row["year"] . '</year>'; $return_str .= '<rated>' . $row["rated"] . '</rated>'; $return_str .= '<released>' . $row["released"] . '</released>'; $return_str .= '<runtime>' . $row["runtime"] . '</runtime>'; $return_str .= '<genre>' . $row["genre"] . '</genre>'; $return_str .= '<director>' . $row["director"] . '</director>'; $return_str .= '<actors>' . $row["actors"] . '</actors>'; $return_str .= '<plot>' . $plot . '</plot>'; $return_str .= '<language>' . $row["language"] . '</language>'; $return_str .= '<country>' . $row["country"] . '</country>'; // $return_str .= '<awards>'.$row["awards"].'</awards>'; $return_str .= '<poster>' . $poster . '</poster>'; $return_str .= "</series>"; } mysqli_free_result($result); return $return_str; } }
/** Export the mail information of an account * @return: str, string containing the complete configuration * of the email for the current acccount. */ function alternc_export_conf() { global $db, $err, $mail_localbox; $err->log("mail", "export"); $domain = $this->enum_domains(); $str = "<mail>\n"; foreach ($domain as $d) { $str .= " <domain>\n <name>" . xml_entities($d["domain"]) . "</name>\n"; $s = $this->enum_domain_mails($d["id"]); if (count($s)) { while (list($key, $val) = each($s)) { $str .= " <address>\n"; $str .= " <name>" . xml_entities($val["address"]) . "</name>\n"; $str .= " <enabled>" . xml_entities($val["enabled"]) . "</enabled>\n"; if (is_array($val["islocal"])) { $str .= " <islocal>1</islocal>\n"; $str .= " <quota>" . $val["quota"] . "</quota>\n"; $str .= " <path>" . $val["path"] . "</path>\n"; } else { $str .= " <islocal>0</islocal>\n"; } if (!empty($val["recipients"])) { $r = explode("\n", $val["recipients"]); foreach ($r as $recip) { $str .= " <recipients>" . $recip . "<recipients>\n"; } } $str .= " </address>\n"; } } $str .= " </domain>\n"; } $str .= "</mail>\n"; return $str; }
} } // Find the parent path (or the whole path if it's already a directory) $pos = strrpos($rpath, '/'); $parent = substr($rpath, 0, $pos + 1); $compareValue = ($isDir ? $parent : $rpath) . '@' . $thisrev; $listing[$index]['compare_box'] = '<input type="checkbox" name="compare[]" value="' . $compareValue . '" onclick="checkCB(this)" />'; $url = $config->getURL($rep, $rpath, 'revision') . $thisRevString; $listing[$index]['revlink'] = '<a href="' . $url . '">' . $thisrev . '</a>'; $url = $config->getURL($rep, $rpath, $isDir ? 'dir' : 'file') . $thisRevString; $listing[$index]['revpathlink'] = '<a href="' . $url . '">' . $rpath . '</a>'; $listing[$index]['revpath'] = $rpath; $listing[$index]['revauthor'] = $revision->author; $listing[$index]['revdate'] = $revision->date; $listing[$index]['revage'] = $revision->age; $listing[$index]['revlog'] = nl2br($bugtraq->replaceIDs(create_anchors(xml_entities($revision->msg)))); $listing[$index]['rowparity'] = $row; if ($showchanges) { // Aggregate added/deleted/modified paths for display in table $modpaths = array(); foreach ($revision->mods as $mod) { $modpaths[$mod->action][] = $mod->path; } ksort($modpaths); foreach ($modpaths as $action => $paths) { sort($paths); $modpaths[$action] = $paths; } $listing[$index]['revadded'] = isset($modpaths['A']) ? implode('<br/>', $modpaths['A']) : ''; $listing[$index]['revdeleted'] = isset($modpaths['D']) ? implode('<br/>', $modpaths['D']) : ''; $listing[$index]['revmodified'] = isset($modpaths['M']) ? implode('<br/>', $modpaths['M']) : '';
/** * Print the console log if requested * @param TestStepResult $testResult Result data of affected run */ private function printConsoleLog($testResult) { if (!$this->shouldPrintInfo(self::INFO_CONSOLE)) { return; } $consoleLog = $testResult->getConsoleLog(); if (isset($consoleLog) && is_array($consoleLog) && count($consoleLog)) { echo "<consoleLog>\n"; foreach ($consoleLog as &$entry) { echo "<entry>\n"; echo "<source>" . xml_entities($entry['source']) . "</source>\n"; echo "<level>" . xml_entities($entry['level']) . "</level>\n"; echo "<message>" . xml_entities($entry['text']) . "</message>\n"; echo "<url>" . xml_entities($entry['url']) . "</url>\n"; echo "<line>" . xml_entities($entry['line']) . "</line>\n"; echo "</entry>\n"; } echo "</consoleLog>\n"; } }