Example #1
0
function getSearchResultString($query)
{
    $search_results = get_search_results("{$query}", "", "", "and", "", "");
    extract($search_results);
    global $urlRequestRoot, $cmsFolder;
    $resultHTML = "<link rel='stylesheet' media='print' type='text/css' href=\"{$urlRequestRoot}/{$cmsFolder}/templates/common/search.css\" />";
    if ($search_results['did_you_mean']) {
        $dym = quote_replace(addmarks($search_results['did_you_mean']));
        $resultHTML .= <<<DIDYOUMEAN
\t\t\t<div id="did_you_mean">
\t\t\t\tDid You Mean: <a href="./+search&query={$dym}&search=1">{$search_results['did_you_mean_b']}</a>
\t\t\t</div>
DIDYOUMEAN;
    }
    if ($search_results['ignore_words']) {
        $resultHTML .= '<div id="common_report">';
        $ignored = '';
        while ($thisword = each($ignore_words)) {
            $ignored .= " " . $thisword[1];
        }
        $resultHTML .= '</div>';
    }
    if ($search_results['total_results'] == 0) {
        $resultHTML .= '<div id ="result_report">';
        $resultHTML .= str_replace('%query', $ent_query, "Sorry! No matches found.");
        $resultHTML .= '</div>';
    }
    if ($total_results != 0 && $from <= $to) {
        $resultHTML .= '<div id ="result_report">';
        $res = 'Results';
        $res = str_replace('%from', $from, $res);
        $res = str_replace('%to', $to, $res);
        $res = str_replace('%all', $total_results, $res);
        $matchword = "matches";
        if ($total_results == 1) {
            $matchword = "match";
        } else {
            $matchword = "matches";
        }
        $res = str_replace('%matchword', $matchword, $res);
        $res = str_replace('%secs', $time, $res);
        $resultHTML .= $res;
        $resultHTML .= '</div>';
    }
    if (isset($qry_results)) {
        $resultHTML .= '<div id="results">';
        foreach ($qry_results as $_key => $_row) {
            $last_domain = $domain_name;
            extract($_row);
            if ($sph_show_query_scores == 0) {
                $weight = '';
            } else {
                $weight = "[{$weight}%]";
            }
            if ($domain_name == $last_domain && $sph_merge_site_results == 1 && $domain == "") {
                $resultHTML .= '<div class="idented">';
            }
            $resultHTML .= "<b>{$num}.</b> {$weight} \n";
            $resultHTML .= "<a href=\"{$url}\" class=\"sph_title\">" . ($title ? $title : 'Untitled') . "</a><br/>\n";
            $resultHTML .= "<div class=\"description\">{$fulltxt}</div>\n";
            $resultHTML .= "<div class=\"url\">{$url2} - {$page_size}</div>\n";
            if ($domain_name == $last_domain && $sph_merge_site_results == 1 && $domain == "") {
                $q = quote_replace(addmarks($query));
                $resultHTML .= "[ <a href=\"./+search&query={$q}&search=1&results={$results_per_page}&domain={$domain_name}\">More results from {$domain_name}</a> ]";
                $resultHTML .= "</div class=\"idented\">\n";
            }
            $resultHTML .= "<br />\n";
        }
        $resultHTML .= '</div>';
    }
    if (isset($other_pages)) {
        if ($adv == 1) {
            $adv_qry = "&adv=1";
        }
        if ($type != "") {
            $type_qry = "&type={$type}";
        }
        $resultHTML .= "<div id=\"other_pages\">\nResult page: ";
        if ($start > 1) {
            $q = quote_replace(addmarks($query));
            $resultHTML .= "<a href=\"./+search&query={$q}&start={$prev}&search=1&results={$results_per_page}{$type_qry}{$adv_qry}&domain={$domain}\">Previous</a>";
        }
        foreach ($other_pages as $page_num) {
            if ($page_num != $start) {
                $q = quote_replace(addmarks($query));
                $resultHTML .= "<a href=\"./+search&query={$q}&start={$page_num}&search=1&results={$results_per_page}{$type_qry}{$adv_qry}&domain={$domain}\">{$page_num}</a>";
            } else {
                $resultHTML .= "<b>{$page_num}</b>";
            }
        }
        if ($next <= $pages) {
            $q = quote_replace(addmarks($query));
            $resultHTML .= "<a href=\"./+search&query={$q}&start={$next}&search=1&results={$results_per_page}{$type_qry}{$adv_qry}&domain={$domain}\">Next</a>";
        }
        $resultHTML .= '</div>';
    }
    return $resultHTML;
}
Example #2
0
                        <?php 
                    } else {
                        ?>
	
                        <b><?php 
                        print $page_num;
                        ?>
</b>
                        <?php 
                    }
                }
                if ($next <= $pages) {
                    ?>
	
                    <a href="<?php 
                    print 'search.php?query=' . quote_replace(addmarks($query)) . '&start=' . $next . '&search=1&category=' . $category . '&catid=' . $catid . '&mark=' . $mark . '&results=' . $results_per_page . $type_qry . $adv_qry . '&domain=' . $domain;
                    ?>
"><?php 
                    print $sph_messages['Next'];
                    ?>
</a>
                    <?php 
                }
                ?>
	
                </div>
                <?php 
            }
        }
        break;
    default:
Example #3
0
function statisticsForm($type)
{
    echo "<div class='submenu y3'>\r\n\t\t\t\t<ul>\r\n\t\t\t\t\t<li><a href='" . WEBROOT_DIR . "/admin/?f=statistics&amp;type=keywords' title='Show list of Top 60 Keywords'>Top keywords</a></li>\r\n\t\t\t\t\t<li><a href='" . WEBROOT_DIR . "/admin/?f=statistics&amp;type=pages' title='Show list of Largest Pages and their indexed file size'>Largest pages</a></li>\r\n\t\t\t\t\t<li><a href='" . WEBROOT_DIR . "/admin/?f=statistics&amp;type=spidering_log' title='Show list of Spidering Logs'>Spidering logs</a></li>\r\n\t\t\t\t\t<li><a href='" . WEBROOT_DIR . "/admin/?f=statistics&amp;type=server_info' title='Show all available server info'>Server Info</a></li>\r\n\t\t\t\t\t<li><a href='" . WEBROOT_DIR . "/admin/?f=statistics&amp;type=log' title='Show Search Log activity'>Search log</a></li>\r\n\t\t\t\t\t<li><a href='" . WEBROOT_DIR . "/admin/?f=statistics&amp;type=top_searches' title='Show list of the most popular on-line Searches'>Most popular searches</a></li>\r\n\t\t\t\t\t<li><a href='" . WEBROOT_DIR . "/admin/?f=statistics&amp;type=top_links' title='Show list of the most popular links, clicked by the user'>Most popular links</a></li>\r\n\t\t\t\t</ul>\r\n\t\t\t</div>\r\n\t\t";
    if ($type == "") {
        $cachedSumQuery = "select sum(length(fulltxt)) from " . TABLE_PREFIX . "links";
        $result = mysql_query("select sum(length(fulltxt)) from " . TABLE_PREFIX . "links");
        if (DEBUG > '0') {
            echo mysql_error();
        }
        if ($row = mysql_fetch_array($result)) {
            $cachedSumSize = $row[0];
        }
        $cachedSumSize = number_format($cachedSumSize / 1024, 2);
        $sitesSizeQuery = "select sum(size) from " . TABLE_PREFIX . "links";
        $result = mysql_query("{$sitesSizeQuery}");
        if (DEBUG > '0') {
            echo mysql_error();
        }
        if ($row = mysql_fetch_array($result)) {
            $sitesSize = $row[0];
        }
        $sitesSize = number_format($sitesSize, 2);
        $result = mysql_query("select count(*) from " . TABLE_PREFIX . "query_log");
        if (DEBUG > '0') {
            echo mysql_error();
        }
        if ($row = mysql_fetch_array($result)) {
            $query_tot = $row[0];
        }
        $result = mysql_query("select sum(click_counter) from " . TABLE_PREFIX . "links");
        if (!mysql_error()) {
            if ($row = mysql_fetch_array($result)) {
                $click_tot = $row[0];
            }
            $stats = getStatistics();
            echo "<div class='panel w60'>\r\n\t\t\t\t\t<dl class='tblhead'>\r\n\t\t\t\t\t\t<dt class='headline x2'>Overall Statistics:</dt><dd class='headline'>&nbsp;Details</dd>\r\n\t\t\t\t\t\t<dt class='odrow bd x2'>Sites:</dt><dd class='odrow'>&nbsp;" . $stats['sites'] . "</dd>\r\n\t\t\t\t\t\t<dt class='evrow bd x2'>Links:</dt><dd class='evrow'>&nbsp;" . $stats['links'] . "</dd>\r\n\t\t\t\t\t\t<dt class='odrow bd x2'>Categories:</dt><dd class='odrow'>&nbsp;" . $stats['categories'] . "</dd>\r\n\t\t\t\t\t\t<dt class='evrow bd x2'>Keywords:</dt><dd class='evrow'>&nbsp;" . $stats['keywords'] . "</dd>\r\n\t\t\t\t\t\t<dt class='odrow bd x2'>Keyword link-relations:</dt><dd class='odrow'>&nbsp;" . $stats['index'] . "</dd>\r\n\t\t\t\t\t\t<dt class='evrow bd x2'>Cached texts total:</dt><dd class='evrow'>&nbsp;{$cachedSumSize} kb</dd>\r\n\t\t\t\t\t\t<dt class='odrow bd x2'>Sites size total:</dt><dd class='odrow'>&nbsp;{$sitesSize} kb</dd>\r\n\t\t\t\t\t\t<dt class='evrow bd x2'>Queries total:</dt><dd class='evrow'>&nbsp;{$query_tot}</dd>\r\n\t\t\t\t\t\t<dt class='odrow bd x2'>Link clicks total:</dt><dd class='odrow'>&nbsp;{$click_tot}</dd>\r\n\t\t\t\t\t</dl>\r\n\t\t\t\t</div>\r\n\t\t\t\t";
        } else {
            echo "\r\n\t\t\t\t\t<div class='submenu cntr'>\r\n\t\t\t\t\t<span class='warnadmin'>\r\n\t\t\t\t";
            if (DEBUG > '0') {
                echo mysql_error();
            }
            echo "<br /><br /><br />\r\n\t\t\t\t\tPlease run the .../admin/install_bestclick.php file.\r\n\t\t\t\t\t<b r />\r\n\t\t\t\t\t</span>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<br /><br />\r\n\t\t\t\t";
            die;
        }
        exit;
    }
    if ($type == 'keywords') {
        $class = "evrow";
        for ($i = 0; $i <= 15; $i++) {
            $char = dechex($i);
            $result = mysql_query("select keyword, count(" . TABLE_PREFIX . "link_keyword{$char}.keyword_id) as x from " . TABLE_PREFIX . "keywords, " . TABLE_PREFIX . "link_keyword{$char} where " . TABLE_PREFIX . "keywords.keyword_id = " . TABLE_PREFIX . "link_keyword{$char}.keyword_id group by keyword order by x desc limit 30");
            if (DEBUG > '0') {
                echo mysql_error();
            }
            while ($row = mysql_fetch_row($result)) {
                $topwords[$row[0]] = $row[1];
            }
        }
        arsort($topwords);
        echo "<div class='panel'>\r\n\t\t\t\t<p class='headline cntr'>Top 60 Keywords</p>\r\n\t\t\t";
        $nloops = 1;
        do {
            $nloops++;
            $count = 1;
            echo "<div class='ltfloat x3'>\r\n\t\t\t\t\t<dl>\r\n\t\t\t\t\t\t<dt class='headline x2'>Keyword</dt><dd class='headline'>:&nbsp;Instances</dd>\r\n\t\t\t\t";
            while ((list($word, $weight) = each($topwords)) && $count < 21) {
                $word = quote_replace($word);
                $count++;
                if ($class == "evrow") {
                    $class = "odrow";
                } else {
                    $class = "evrow";
                }
                echo "<dt class='{$class}'><a href='../" . WEBROOT_DIR . "/admin/?query={$word}&amp;search=1' target='rel' title='View search results in new window'>" . trim(substr($word, 0, 35)) . "</a></dt>\r\n\t\t\t\t\t\t<dd class='{$class}'>:&nbsp;" . $weight . "</dd>\r\n\t\t\t\t\t";
            }
            echo "</dl>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t";
        } while ($nloops <= 3);
        echo "<div class='clear'></div>\r\n\t\t\t\t\t<br />\r\n\t\t\t\t\t<a class='navup' href='#head' title='Jump to Page Top'>Top</a>\r\n\t\t\t\t\t<br />\r\n\t\t\t\t\t</div>\r\n\t\t\t\t";
        exit;
    }
    if ($type == 'pages') {
        $class = "evrow";
        echo "<div class='panel'>\r\n                <dl class='tblhead'>\r\n                <dt class='headline x8'>File Size</dt><dd class='headline cntr'>Links to Largest Pages</dd>\r\n            ";
        $result = mysql_query("select " . TABLE_PREFIX . "links.link_id, url, length(fulltxt)  as x from " . TABLE_PREFIX . "links order by x desc limit 20");
        if (DEBUG > '0') {
            echo mysql_error();
        }
        while ($row = mysql_fetch_row($result)) {
            if ($class == "evrow") {
                $class = "odrow";
            } else {
                $class = "evrow";
            }
            $url = $row[1];
            $sum = number_format($row[2] / 1024, 2);
            echo "<dt class='{$class} x8'>" . $sum . "kb&nbsp;&nbsp;&nbsp;</dt>\r\n                    <dd class='{$class}'><a href='{$url}' title='Open this page in new window' target='_blank'>" . $url . "</a></dd>\r\n                ";
        }
        echo "</dl>\r\n                    <br />\r\n                    <a class='navup' href='#head' title='Jump to Page Top'>Top</a>                    \r\n                    <br />\r\n            \r\n                </div>\r\n            ";
        exit;
    }
    if ($type == 'top_searches') {
        $class = "evrow";
        echo "<div class='panel'>\r\n                <p class='headline cntr'>Most Popular Searches (Top 50)</p>\r\n                <table width='100%'>\r\n                    <tr>\r\n                        <td class='tblhead'>Query</td>\r\n                        <td class='tblhead'>Count</td>\r\n                        <td class='tblhead'>Average results</td>\r\n                        <td class='tblhead'>Last queried</td>\r\n                </tr>\r\n            ";
        $allthese = '1';
        $result = mysql_query("select query, count(*) as c, date_format(max(time), '%Y-%m-%d %H:%i:%s'), avg(results)  from " . TABLE_PREFIX . "query_log group by query order by c desc");
        if (DEBUG > '0') {
            echo mysql_error();
        }
        while (($row = mysql_fetch_row($result)) && $allthese <= '50') {
            if ($class == "evrow") {
                $class = "odrow";
            } else {
                $class = "evrow";
            }
            $word = $row[0];
            $times = $row[1];
            $date = $row[2];
            $avg = number_format($row[3], 0);
            $word = str_replace("\"", "", $word);
            echo "<tr class='{$class} '>\r\n                    <td><a href='../" . WEBROOT_DIR . "/admin/?query={$word}&amp;search=1' target='rel' title='View search results in new window'>" . $word . "</a></td>\r\n                    <td class='cntr'> " . $times . "</td>\r\n                    <td class='cntr'> " . $avg . "</td><td class='cntr'> " . $date . "</td>\r\n                    </tr>\r\n                ";
            $allthese++;
        }
        echo "\r\n                </table>\r\n                <br />\r\n                <a class='navup' href='#head' title='Jump to Page Top'>Top</a>                    \r\n                <br />            \r\n                </div>\r\n            ";
        exit;
    }
    if ($type == 'top_links') {
        $class = "evrow";
        echo "<div class='panel'>\r\n                <p class='headline cntr'>Most Popular Links (Top 50)</p>\r\n                <table width='100%'>\r\n                <tr>\r\n                    <td class='tblhead'>Link</td>\r\n                    <td class='tblhead'>Total clicks</td>\r\n                    <td class='tblhead'>Last clicked</td>\r\n                    <td class='tblhead'>Last query</td>\r\n                </tr>\r\n            ";
        $allthese = '1';
        $result = mysql_query("select url, click_counter, last_click, last_query  from " . TABLE_PREFIX . "links order by click_counter DESC, url");
        if (DEBUG > '0') {
            echo mysql_error();
        }
        while (($row = mysql_fetch_row($result)) && $allthese <= '50') {
            if ($class == "evrow") {
                $class = "odrow";
            } else {
                $class = "evrow";
            }
            $url = $row[0];
            $click_counter = $row[1];
            $Timestamp = $row[2];
            $last_query = $row[3];
            if ($Timestamp != '0') {
                $last_click = date("Y-m-d H:i:s", $Timestamp);
                echo "<tr class='{$class}'>\r\n                        <td><a href='{$url}' target='rel' title='View link in new window'>" . htmlentities($url) . "</a></td>\r\n                        <td class='cntr sml'> " . $click_counter . "</td>\r\n                        <td class='cntr sml'> " . $last_click . "</td>\r\n                        <td class='cntr sml'> " . $last_query . "</td>\r\n                        </tr>\r\n                    ";
                $allthese++;
            }
        }
        echo "\r\n                </table>\r\n                <br />\r\n                <a class='navup' href='#head' title='Jump to Page Top'>Top</a>                    \r\n                <br />            \r\n                </div>\r\n            ";
        exit;
    }
    if ($type == 'log') {
        $class = "evrow";
        echo "<div class='panel w75'>\r\n                <p class='headline cntr'>Search Log (Latest 100)</p>\r\n                <table width='100%'>\r\n                <tr>\r\n                    <td class='tblhead'>Query</td>\r\n                    <td class='tblhead x6'>Results</td>\r\n                    <td class='tblhead x3'>Queried at:</td>\r\n                    <td class='tblhead x5'>Time taken</td>\r\n                </tr>\r\n            ";
        $num = '1';
        $result = mysql_query("select query,  date_format(time, '%Y-%m-%d %H:%i:%s'), elapsed, results from " . TABLE_PREFIX . "query_log order by time desc");
        if (DEBUG > '0') {
            echo mysql_error();
        }
        while (($row = mysql_fetch_row($result)) && $num <= '100') {
            if ($class == "evrow") {
                $class = "odrow";
            } else {
                $class = "evrow";
            }
            $word = $row[0];
            $time = $row[1];
            $elapsed = $row[2];
            $results = $row[3];
            echo "<tr class='{$class}'>\r\n                    <td><a href='../" . WEBROOT_DIR . "/admin/?query={$word}&amp;search=1' target='rel' title='View search results in new window'>" . $word . "</a></td>\r\n                    <td class='cntr'> " . $results . "</td>\r\n                    <td class='cntr'> " . $time . "</td>\r\n                    <td class='cntr'> " . $elapsed . "</td>\r\n                    </tr>\r\n                ";
            $num++;
        }
        echo "\r\n                </table>\r\n                <br />\r\n                <a class='navup' href='#head' title='Jump to Page Top'>Top</a>                    \r\n                <br />                \r\n                </div>\r\n            ";
        exit;
    }
    if ($type == 'spidering_log') {
        $class = "evrow";
        $files = get_dir_contents(LOG_DIR);
        if (count($files) > 0) {
            echo "<div class='panel w75'>\r\n                    <p class='headline cntr'>Spidering Logs</p>\r\n                        <form action='' id='fdelfm'>\r\n                        <table width='100%'>\r\n                        <tr>\r\n                            <td class='tblhead'>File</td>\r\n                            <td class='tblhead'>Created</td>\r\n                            <td class='tblhead' width='22%'>Option</td>\r\n                        </tr>\r\n                        <tr>\r\n                            <td colspan='3' class='odrow cntr bd'>\r\n                            <input type='hidden' name='f' value='44' />\r\n                            <input class='sbmt' id='submit1' type='submit' value='Delete ALL log files' title='Start Log File deletion' onclick=\"return confirm('Are you sure you want to delete ALL log files?')\" />\r\n                            </td>\r\n                        </tr>\r\n                    ";
            for ($i = 0; $i < count($files); $i++) {
                $file = $files[$i];
                $year = substr($file, 0, 2);
                $month = substr($file, 2, 2);
                $day = substr($file, 4, 2);
                $hour = substr($file, 6, 2);
                $minute = substr($file, 8, 2);
                if ($class == "evrow") {
                    $class = "odrow";
                } else {
                    $class = "evrow";
                }
                echo "<tr class='{$class}'>\r\n                        <td class='cntr'>\r\n                        <a href='" . LOG_DIR . "/{$file}' target='_blank' title='Open this Log File in new window'>{$file}</a></td>\r\n                        ";
                if (strlen($file) > '13') {
                    echo "  <td class='cntr'>20{$year}-{$month}-{$day} {$hour}:{$minute}</td>\r\n                                    <td class='cntr options'><a href='?f=delete_log&amp;file={$file}' class='options' title='Click to Delete this Log File' onclick=\"return confirm('Are you sure you want to delete? {$file} Indexing Log File will be lost.')\">Delete</a></td>\r\n                            ";
                } else {
                    echo "  <td></td><td></td\r\n                            ";
                }
                echo "\r\n                    </tr>\r\n                    ";
            }
            echo "\r\n\t\t\t\t\t</table></form>\r\n\t\t\t\t\t<br />\r\n\t\t\t\t\t<a class='navup' href='#head' title='Jump to Page Top'>Top</a>\r\n\t\t\t\t\t<br />\r\n\t\t\t\t\t</div>\r\n\t\t\t\t";
        } else {
            echo "<br />\r\n\t\t\t\t\t<p class='cntr msg'>Note: <span class='warnadmin'>No saved spidering logs exist!</span></p>\r\n\t\t\t\t\t<br /> <br />\r\n\t\t\t\t";
        }
        exit;
    }
    if ($type = 'server_info') {
        $s_infos = $_SERVER;
        $e_infos = $_ENV;
        echo "<div class='submenu'>\r\n\t\t\t\t\t<ul>\r\n\t\t\t\t\t\t<li><a href='#serv_info'>Server</a></li>\r\n\t\t\t\t\t\t<li><a href='#en_info'>Environment</a></li>\r\n\t\t\t\t\t\t<li><a href='#mysql_info'>MySQL</a></li>\r\n\t\t\t\t\t\t<li><a href='#pdf_con'>PDF-converter</a></li>\r\n\t\t\t\t\t\t<li><a href='#php_ini'>php.ini file</a></li>\r\n\t\t\t\t\t\t<li><a href='" . WEBROOT_DIR . "/admin/?f=35'>PHP integration</a></li>\r\n\t\t\t\t\t\t<li><a href='#php_sec'>PHP security info</a></li>\r\n\t\t\t\t\t</ul>\r\n\t\t\t\t</div>\r\n\t\t\t\t<table width='98%'>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td class='headline' colspan='6'>\r\n\t\t\t\t\t\t\t<div class='headline cntr'><a name='serv_info'>Server</a></span> </div>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td width='20%' class='tblhead'>Key</td>\r\n\t\t\t\t\t\t<td class='tblhead'>Value</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t";
        $bgcolor = 'odrow';
        $i = 0;
        reset($s_info);
        while (list($key, $value) = each($s_infos)) {
            echo "<tr class='{$bgcolor} cntr'>\r\n\t\t\t\t\t\t<td>{$key}</td>\r\n\t\t\t\t\t\t<td class='bordl'>{$value}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t";
            $i++;
            if ($bgcolor == 'odrow') {
                $bgcolor = 'evrow';
            } else {
                $bgcolor = 'odrow';
            }
        }
        echo "\r\n\t\t\t\t</table><br />\r\n\t\t\t\t<a class='navup' href='#head' title='Jump to Page Top'>Top</a>\r\n\t\t\t\t<br /><br />\r\n\t\t\t\t<table width='98%'>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td class='headline' colspan='6'>\r\n\t\t\t\t\t\t\t<div class='headline cntr'><a name='en_info'>Environment</a></span> </div>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td width='20%' class='tblhead'>Key</td>\r\n\t\t\t\t\t\t<td class='tblhead'>Value</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t";
        $bgcolor = 'odrow';
        $i = 0;
        reset($e_info);
        while (list($key, $value) = each($e_infos)) {
            echo "<tr class='{$bgcolor} cntr'>               \r\n                        <td>{$key}</td>\r\n                        <td  class='bordl'>{$value}</td>\r\n                    </tr>\r\n                ";
            $i++;
            if ($bgcolor == 'odrow') {
                $bgcolor = 'evrow';
            } else {
                $bgcolor = 'odrow';
            }
        }
        echo "\r\n                </table><br />\r\n                <a class='navup' href='#head' title='Jump to Page Top'>Top</a>\r\n            ";
        $server_version = mysql_get_server_info();
        $host_info = mysql_get_host_info();
        $client_info = mysql_get_client_info();
        $protocol_version = mysql_get_proto_info();
        echo "<br /><br />\r\n            \t<table width='98%'>\r\n            \t<tr>\r\n            \t\t<td class='headline' colspan='6'>\r\n            \t\t<div class='headline cntr'><a name='mysql_info'>MySQL Info</a></span> </div>\r\n            \t\t</td>\r\n            \t</tr>\r\n               \t<tr>\r\n                \t<td width='35%' class='tblhead'>Key</td>\r\n                \t<td  class='tblhead'>Value</td>\r\n                </tr>\r\n            ";
        $bgcolor = 'odrow';
        echo "\r\n                <tr class='{$bgcolor} cntr'>\r\n                    <td>MySQL Server version</td>\r\n                    <td  class='bordl'>{$server_version}</td>\r\n                </tr>\r\n            ";
        $bgcolor = 'evrow';
        echo "\r\n                <tr class='{$bgcolor} cntr'>\r\n                    <td>Connection info</td>\r\n                    <td  class='bordl'>{$host_info}</td>\r\n                </tr>\r\n            ";
        $bgcolor = 'odrow';
        echo "\r\n                <tr class='{$bgcolor} cntr'>\r\n                    <td>Client library info</td>\r\n                    <td  class='bordl'>{$client_info}</td>\r\n                </tr>\r\n            ";
        $bgcolor = 'evrow';
        echo "\r\n                <tr class='{$bgcolor} cntr'>\r\n                    <td>MySQL protocol version</td>\r\n                    <td  class='bordl'>{$protocol_version}</td>\r\n                </tr>\r\n            ";
        $bgcolor = 'odrow';
        echo "\r\n                <tr class='{$bgcolor} cntr'>\r\n                    <td>Support for mysqli</td>\r\n                    <td  class='bordl'>See below as part of your PHP installation</td>\r\n                </tr>\r\n                </table><br />                \r\n                <a class='navup' href='#head' title='Jump to Page Top'>Top</a>\r\n            ";
        $os = '';
        $os = $_ENV['OS'];
        // not all shared hosting server will supply this info
        $admin_path = $_ENV['ORIG_PATH_TRANSLATED'];
        // that might work for shared hosting server
        $admin_file = $_SERVER['SCRIPT_FILENAME'];
        // should present the physical path
        $sdoc_root = $_SERVER['DOCUMENT_ROOT'];
        // this should provide every hoster (???)
        $edoc_root = $_ENV['DOCUMENT_ROOT'];
        // this should provide every hoster (???)
        echo "<br /><br />\r\n        \t<table width='98%'>\r\n        \t<tr>\r\n        \t\t<td class='headline' colspan='6'>\r\n        \t\t<div class='headline cntr'><a name='pdf_con'>PDF-converter relevant Info</a></span> </div>\r\n        \t\t</td>\r\n        \t</tr>\r\n           \t<tr>\r\n            \t<td width='35%' class='tblhead'>Key</td>\r\n            \t<td  class='tblhead'>Value</td>\r\n            </tr>\r\n            ";
        $bgcolor = 'odrow';
        if ($os) {
            echo "\r\n                    <tr class='{$bgcolor} cntr'>\r\n                        <td>Operating System</td>\r\n                        <td  class='bordl'>{$os}</td>\r\n                    </tr>\r\n                ";
            $bgcolor = 'evrow';
        }
        if (!$os) {
            $s_soft = $_SERVER['SERVER_SOFTWARE'];
            $sys_os = stripos($s_soft, "lin");
            if (!$sys_os) {
                $sys_os = stripos($s_soft, "uni");
                if (!$sys_os) {
                    $sys_os = stripos($s_soft, "win");
                }
            }
            if ($sys_os) {
                $os = substr($s_soft, $sys_os, '5');
                echo "\r\n                        <tr class='{$bgcolor} cntr'>\r\n                            <td>Operating System</td>\r\n                            <td  class='bordl'>{$os}</td>\r\n                        </tr>\r\n                    ";
                $bgcolor = 'evrow';
            } else {
                $s_sig = $_SERVER['SERVER_SIGNATURE'];
                $sys_os = stripos($s_sig, "lin");
                if (!$sys_os) {
                    $sys_os = stripos($s_sig, "uni");
                    if (!$sys_os) {
                        $sys_os = stripos($s_sig, "win");
                    }
                }
            }
            if ($sys_os) {
                $os = substr($s_sig, $sys_os, '5');
                echo "\r\n                        <tr class='{$bgcolor} cntr'>\r\n                            <td>Operating System</td>\r\n                            <td  class='bordl'>{$os}</td>\r\n                        </tr>\r\n                    ";
                $bgcolor = 'evrow';
            }
        }
        //  if ENV or SERVER_SIGNATURE or SERVER_SOFTWARE do not deliver OperatingSystem info, we will use the PHPinfo to extract it
        if (!$os) {
            $phpinfo = '';
            ob_start();
            // redirect output into buffer
            phpinfo();
            $phpinfo = ob_get_contents();
            // get all from phpinfo
            ob_end_clean();
            // clean buffer and close it
            //  extract OS information
            $start = stripos($phpinfo, "\"v\"") + 4;
            $end = stripos($phpinfo, "</td>", $start);
            $length = $end - $start;
            $os = substr($phpinfo, $start, $length);
            echo "\r\n                    <tr class='{$bgcolor} cntr'>\r\n                        <td>Operating System</td>\r\n                        <td  class='bordl'>{$os}</td>\r\n                    </tr>\r\n                ";
            $bgcolor = 'evrow';
        }
        if ($admin_path) {
            $admin_path = str_replace("\\\\", "/", $admin_path);
            $admin_path = str_replace("\\", "/", $admin_path);
            $pdf_path = str_replace("admin/index.php", "converter/", $admin_path);
            echo "\r\n                    <tr class='{$bgcolor} cntr'>\r\n                        <td>Physical path to Sphider-plus Admin</td>\r\n                        <td  class='bordl'>{$admin_path}</td>\r\n                    </tr>                    \r\n                ";
            $bgcolor = 'odrow';
            echo "\r\n                    <tr class='{$bgcolor} cntr'>\r\n                        <td>Physical path to the Linux / UNIX PDF-converter</td>\r\n                        <td  class='bordl'>{$pdf_path}</td>\r\n                    </tr>                    \r\n                ";
            $bgcolor = 'evrow';
        } else {
            if ($admin_file) {
                $admin_file = str_replace("\\\\", "/", $admin_file);
                $admin_file = str_replace("\\", "/", $admin_file);
                $pdf_path = str_replace("admin/index.php", "converter/", $admin_file);
                echo "\r\n                        <tr class='{$bgcolor} cntr'>\r\n                            <td>Physical path to Sphider-plus Admin</td>\r\n                            <td  class='bordl'>{$admin_file}</td>\r\n                        </tr>\r\n                    ";
                $bgcolor = 'odrow';
                echo "\r\n                        <tr class='{$bgcolor} cntr'>\r\n                            <td>Physical path to the Linux / UNIX PDF-converter</td>\r\n                            <td  class='bordl'>{$pdf_path}</td>\r\n                        </tr>                    \r\n                    ";
                $bgcolor = 'evrow';
            }
        }
        if ($sdoc_root) {
            echo "                \r\n                    <tr class='{$bgcolor} cntr'>\r\n                        <td>Physical path to document root</td>\r\n                        <td  class='bordl'>{$sdoc_root}</td>\r\n                    </tr>                    \r\n                ";
        } else {
            if ($edoc_root) {
                echo "                \r\n                        <tr class='{$bgcolor} cntr'>\r\n                            <td>Physical path to document root</td>\r\n                            <td  class='bordl'>{$edoc_root}</td>\r\n                        </tr>                    \r\n                    ";
            }
        }
        if (!$admin_path && !$admin_file) {
            if ($sdoc_root) {
                echo "                \r\n                        <tr class='{$bgcolor} cntr'>\r\n                            <td>Physical path to document root</td>\r\n                            <td  class='bordl'>{$sdoc_root}</td>\r\n                        </tr>                    \r\n                    ";
            }
            if ($edoc_root) {
                echo "                \r\n                        <tr class='{$bgcolor} cntr'>\r\n                            <td>Physical path to document root</td>\r\n                            <td  class='bordl'>{$edoc_root}</td>\r\n                        </tr>                    \r\n                    ";
            } else {
                echo "\r\n                        </table>\r\n                    \t<table width='98%'>\r\n                    \t<tr>\r\n                            <td>\r\n                            <span class='cntr warnadmin'><br />\r\n                            Attention: Your server does not deliver information about the physical path to Sphider-plus.<br />\r\n                            For LINUX and UNIX systems you will have to initialize the PDF converter manually.<br />\r\n                            For details see the file readme.pdf, chapter: PDF converter for Linux/UNIX systems.<br />\r\n                            <br /></span>\r\n                            </td>\r\n                        </tr>\r\n                    ";
            }
        }
        echo "\r\n                </table><br />\r\n                <a class='navup' href='#head' title='Jump to Page Top'>Top</a><br /><br />\r\n            ";
        echo "                \r\n            \t<table width='98%'>\r\n            \t<tr>\r\n            \t\t<td class='headline' colspan='6'>\r\n            \t\t<div class='headline cntr'>PHP Info</span> </div>\r\n            \t\t</td>\r\n            \t</tr>\r\n                </table>\r\n            ";
        echo "<br />\r\n            \t<table width='98%'>\r\n            \t<tr>\r\n            \t\t<td class='headline' colspan='6'>\r\n            \t\t<div class='headline cntr'><a name='php_ini'>php.ini file</a></span> </div>\r\n            \t\t</td>\r\n            \t</tr>\r\n            \t<tr>\r\n            \t\t<td width='20%' class='tblhead'>Key</td>\r\n            \t\t<td class='tblhead'>Value</td>\r\n\r\n            \t</tr>\r\n        \t";
        $php_ini = ini_get_all();
        $bgcolor = 'odrow';
        $i = 0;
        reset($php_ini);
        while (list($key, $value) = each($php_ini)) {
            echo "<tr class='{$bgcolor} cntr'>               \r\n                        <td>{$key}</td>\r\n                        <td   class='bordl'>\r\n                        ";
            // print_r($value);
            "</td>\r\n                    </tr>\r\n                ";
            $i++;
            if ($bgcolor == 'odrow') {
                $bgcolor = 'evrow';
            } else {
                $bgcolor = 'odrow';
            }
        }
        echo "\r\n                </table>\r\n                <br /><br />\r\n                <a class='navup' href='#head' title='Jump to Page Top'>Top</a>\r\n                <br /><br />\r\n            \t<table width='98%'>\r\n            \t<tr>\r\n            \t\t<td class='headline' colspan='6'>\r\n            \t\t<div class='headline cntr'><a name='php_sec'>PHP security info</a></span> </div>\r\n            \t\t</td>\r\n            \t</tr>\r\n            \t<tr>\r\n            \t\t<td width='20%' class='tblhead'></td>\r\n            \t\t<td class='tblhead'></td>\r\n\r\n            \t</tr>\r\n        \t";
        //phpsecinfo();   //  get PHP security information
        echo "\r\n                </table>\r\n                <br /><br />\r\n                <a class='navup' href='#head' title='Jump to Page Top'>Top</a>\r\n                <br /><br />\r\n                </div>\r\n            ";
        exit;
    }
}
Example #4
0
    function pagination($result_label = null)
    {
        global $sph_messages;
        $return = '';
        if (isset($this->search_results['other_pages'])) {
            if ($this->adv == 1) {
                $adv_qry = '&amp;adv=1';
            }
            if ($this->type != '') {
                $type_qry = '&amp;type=' . $this->type;
            }
            if ($result_label === false) {
                // do nothing (don't label the pagination)
            } else {
                if ($result_label == null) {
                    $return .= $sph_messages["Result page"];
                } else {
                    $return .= $result_label;
                }
            }
            $return .= '
				<ul>' . "\r\n";
            if ($this->start > 1) {
                // if we do have more than 1 result page
                $return .= '<li class="previouslink">
					<a href="' . WEBROOT_DIR . '/?query=' . quote_replace($this->addmarks($this->query)) . '&amp;start=' . $this->search_results['prev'] . '&amp;search=1&category=' . $category . '&catid=' . $catid . '&mark=' . Configure::read('mark') . '&results=' . '&results=' . Configure::read('results_per_page') . $type_qry . $adv_qry . '&domain=' . $domain . '">' . $sph_messages['Previous'] . '</a>
				</li>' . "\r\n";
            }
            foreach ($this->search_results['other_pages'] as $page_num) {
                if ($page_num != $this->start) {
                    $return .= '<li class="pagelink">
							<a href="' . WEBROOT_DIR . '/?query=' . quote_replace($this->addmarks($this->query)) . '&amp;start=' . $page_num . '&amp;search=1&amp;category=' . $this->search_results['category'] . '&amp;catid=' . $this->search_results['catid'] . '&amp;mark=' . Configure::read('mark') . '&amp;results=' . Configure::read('results_per_page') . $type_qry . $adv_qry . '&amp;domain=' . $this->domain . '">' . $page_num . '</a>
						</li>' . "\r\n";
                } else {
                    $return .= '<li class="pagelink current-page"><span>' . $page_num . '</span></li>';
                }
            }
            if ($this->search_results['next'] <= $this->search_results['pages']) {
                $return .= '<li class="nextlink">
						<a href="' . WEBROOT_DIR . '/?query=' . quote_replace($this->addmarks($this->query)) . '&amp;start=' . $this->search_results['next'] . '&amp;search=1&amp;category=' . $category . '&amp;catid=' . $catid . '&amp;mark=' . Configure::read('mark') . '&amp;results=' . Configure::read('results_per_page') . $type_qry . $adv_qry . '&amp;domain=' . $domain . '">' . $sph_messages['Next'] . '</a>
					</li>' . "\r\n";
            }
            $return .= '</ul>';
        }
        return $return;
    }