/**
  * Search for a phrase
  * 
  * note: you can draw your own search-form and add a path-variable. with the
  * path variable you can limit the search to url paths like www/cars/.. or www/bikes ...
  * 
  * @param string Search Phrase
  * @param integer Number of search results to diplay on one page.
  * @param String OPtion for search. Allowed are "any", "exact" and "start"
  */
 function search($searchPhrase, $limit = 20, $options = "any")
 {
     global $c, $phpdig_words_chars;
     define('SEARCH_PAGE', $_SERVER['PHP_SELF']);
     define('DISPLAY_DROPDOWN', 0);
     $relative_script_path = $c["path"] . "ext/phpdig";
     include_once $c["path"] . "ext/phpdig/includes/config.php";
     include_once $c["path"] . "ext/phpdig/libs/search_function.php";
     extract(phpdigHttpVars(array('query_string' => 'string', 'refine' => 'integer', 'refine_url' => 'string', 'site' => 'string', 'limite' => 'integer', 'option' => 'string', 'lim_start' => 'integer', 'browse' => 'integer', 'path' => 'string')), EXTR_SKIP);
     $results = phpdigSearch($id_connect, $searchPhrase, $options, $refine, $refine_url, $lim_start, $limite, $browse, $site, $path, $relative_script_path, 'array');
     return $results["results"];
 }
Developer from inception to and including PhpDig v.1.6.2: Antoine Bajolet
Developer from PhpDig v.1.6.3 to and including current version: Charter
Copyright (C) 2001 - 2003, Antoine Bajolet, http://www.toiletoine.net/
Copyright (C) 2003 - current, Charter, http://www.phpdig.net/
Contributors hold Copyright (C) to their code submissions.
Do NOT edit or remove this copyright or licence information upon redistribution.
If you modify code and redistribute, you may ADD your copyright to this notice.
----------------------------------------------------------------------------------
*/
require_once "../prepend.php";
$no_connect = 0;
include "{$relative_script_path}/includes/config.php";
include "{$relative_script_path}/libs/auth.php";
include "{$relative_script_path}/admin/robot_functions.php";
// extract http vars
extract(phpdigHttpVars(array('type' => 'string')), EXTR_SKIP);
set_time_limit(300);
include $relative_script_path . '/libs/htmlheader.php';
?>
<head>
<title>PhpDig : <?php 
phpdigPrnMsg('statistics');
?>
 </title>
<?php 
include $relative_script_path . '/libs/htmlmetas.php';
?>
</head>
<body bgcolor="white">
<table><tr><td valign="top">
<img src="../phpdig_logo_2.png" width="200" height="114" alt="PhpDig <?php 
Example #3
0
    echo $sid;
    ?>
" target="_top"> [<?php 
    phpdigPrnMsg('StopSpider');
    ?>
]</a></h3>
<?php 
} else {
    phpdigPrnMsg('spidering') . $br;
}
// set the User-Agent for the file() function
@ini_set('user_agent', 'PhpDig/' . PHPDIG_VERSION . ' (+http://www.phpdig.net/robot.php)');
// extract and/or init vars
extract(phpdigHttpVars(array('respider_mode' => 'string', 'mode' => 'string', 'origine' => 'string', 'localdomain' => 'string', 'force_first_reindex' => 'string', 'site_id' => 'integer', 'nofollow' => 'string', 'tempfile' => 'string')), EXTR_SKIP);
if ($run_mode == 'http') {
    extract(phpdigHttpVars(array('url' => 'string', 'limit' => 'integer', 'linksper' => 'integer', 'usetable' => 'string')), EXTR_SKIP);
}
$linksper_flag = 0;
if (!isset($linksper) or (int) $linksper > LINKS_MAX_LIMIT) {
    $linksper_flag = 1;
    if ($run_mode != 'cgi') {
        $linksper = RELINKS_LIMIT;
    } else {
        $linksper = LINKS_MAX_LIMIT;
    }
}
$limit_flag = 0;
if (!isset($limit) or (int) $limit > SPIDER_MAX_LIMIT) {
    $limit_flag = 1;
    if ($run_mode != 'cgi') {
        $limit = RESPIDER_LIMIT;
Example #4
0
api_protect_course_script();
// start of part copied (with some changes) from standard PhpDig search.php
$relative_script_path = '.';
$no_connect = 0;
if (is_file("{$relative_script_path}/includes/config.php")) {
    include "{$relative_script_path}/includes/config.php";
} else {
    die("Cannot find config.php file.\n");
}
if (is_file("{$relative_script_path}/libs/search_function.php")) {
    include "{$relative_script_path}/libs/search_function.php";
} else {
    die("Cannot find PhpDig search_function.php file.\n");
}
// extract vars
extract(phpdigHttpVars(array('query_string' => 'string', 'mdsc' => 'string', 'kwdswere_string' => 'string', 'refine' => 'integer', 'refine_url' => 'string', 'site' => 'string', 'limite' => 'integer', 'option' => 'string', 'lim_start' => 'integer', 'browse' => 'integer', 'path' => 'string')), EXTR_SKIP);
$adlog_flag = 0;
$rssdf = "";
// end of part copied (with some changes) from standard PhpDig search.php
// Course keywords
$_course = api_get_course_info();
$ckw = $_course['path'] . '/CourseKwds.js';
define('KEYWORDS_CACHE', api_get_path(SYS_COURSE_PATH) . $ckw);
if (file_exists(KEYWORDS_CACHE)) {
    $kcdt = htmlspecialchars(date('Y/m/d H:i:s', filemtime(KEYWORDS_CACHE)));
}
$keywordscache = $kcdt ? '<script type="text/javascript" src="' . api_get_path(WEB_COURSE_PATH) . $ckw . '"></script>' . '<br /><small><i>(CourseKwds cache: ' . $kcdt . ')</i></small>' : '';
// Dokeos header
$nameTools = get_lang('Search');
$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="../../../main/metadata/md_styles.css">';
$htmlHeadXtra[] = '<script type="text/javascript" src="../../../main/metadata/md_script.js"></script>';
Example #5
0
Contributors are listed in the CREDITS and CHANGELOG files in this package.
Developer from inception to and including PhpDig v.1.6.2: Antoine Bajolet
Developer from PhpDig v.1.6.3 to and including current version: Charter
Copyright (C) 2001 - 2003, Antoine Bajolet, http://www.toiletoine.net/
Copyright (C) 2003 - current, Charter, http://www.phpdig.net/
Contributors hold Copyright (C) to their code submissions.
Do NOT edit or remove this copyright or licence information upon redistribution.
If you modify code and redistribute, you may ADD your copyright to this notice.
----------------------------------------------------------------------------------
*/
require_once "../prepend.php";
include "{$relative_script_path}/includes/config.php";
include "{$relative_script_path}/libs/auth.php";
include "{$relative_script_path}/admin/robot_functions.php";
// extract http vars
extract(phpdigHttpVars(array('path' => 'string', 'sup' => 'integer', 'exp' => 'integer', 'deny' => 'integer', 'ex_id' => 'integer', 'new_username' => 'integer', 'username' => 'string', 'password' => 'string', 'site_id' => 'integer', 'unlock' => 'integer')), EXTR_SKIP);
set_time_limit(3600);
srand(time());
$site_id = value("site_id", "NUMERIC");
if ($site_id) {
    $site_id = (int) $site_id;
} else {
    $site_id = 0;
}
if ($path) {
    if (!get_magic_quotes_gpc()) {
        $path = addslashes($path);
    }
    $andpath = "AND path = '" . str_replace('%', '\\%', $path) . "'";
} else {
    $andpath = '';
Example #6
0
Developer from PhpDig v.1.6.3 to and including current version: Charter
Copyright (C) 2001 - 2003, Antoine Bajolet, http://www.toiletoine.net/
Copyright (C) 2003 - current, Charter, http://www.phpdig.net/
Contributors hold Copyright (C) to their code submissions.
Do NOT edit or remove this copyright or licence information upon redistribution.
If you modify code and redistribute, you may ADD your copyright to this notice.
----------------------------------------------------------------------------------
*/
require_once "../prepend.php";
$no_connect = 0;
include "{$relative_script_path}/includes/config.php";
include "{$relative_script_path}/libs/auth.php";
include "{$relative_script_path}/admin/robot_functions.php";
$site_id = value("site_id", "NUMERIC");
// extract http vars
extract(phpdigHttpVars(array('spider_id' => 'integer', 'spider' => 'integer', 'sup' => 'integer', 'site_id' => 'integer')), EXTR_SKIP);
$verify = phpdigMySelect($id_connect, 'SELECT locked FROM ' . PHPDIG_DB_PREFIX . 'sites WHERE site_id=' . (int) $site_id);
if (is_array($verify) && !$verify[0]['locked'] && $spider_id) {
    mysql_query('UPDATE ' . PHPDIG_DB_PREFIX . 'sites SET locked=1 WHERE site_id=' . $site_id, $id_connect);
    $query = "SELECT site_id,path,file FROM " . PHPDIG_DB_PREFIX . "spider where spider_id={$spider_id}";
    $result_id = mysql_query($query, $id_connect);
    if (mysql_num_rows($result_id)) {
        list($site_id, $path, $file) = mysql_fetch_row($result_id);
    }
    if ($spider) {
        $query = "DELETE FROM " . PHPDIG_DB_PREFIX . "tempspider WHERE site_id={$site_id}";
        $result_id = mysql_query($query, $id_connect);
        if ($path && strlen($path) > 0 && LIMIT_TO_DIRECTORY) {
            $query_includes = "INSERT INTO " . PHPDIG_DB_PREFIX . "includes SET in_site_id = " . $site_id . ", in_path = '" . $path . "';";
            mysql_query($query_includes, $id_connect);
        }
Developer from inception to and including PhpDig v.1.6.2: Antoine Bajolet
Developer from PhpDig v.1.6.3 to and including current version: Charter
Copyright (C) 2001 - 2003, Antoine Bajolet, http://www.toiletoine.net/
Copyright (C) 2003 - current, Charter, http://www.phpdig.net/
Contributors hold Copyright (C) to their code submissions.
Do NOT edit or remove this copyright or licence information upon redistribution.
If you modify code and redistribute, you may ADD your copyright to this notice.
----------------------------------------------------------------------------------
*/
require_once "../prepend.php";
$no_connect = 0;
include "{$relative_script_path}/includes/config.php";
include "{$relative_script_path}/libs/auth.php";
include "{$relative_script_path}/admin/robot_functions.php";
// extract vars
extract(phpdigHttpVars(array('delete' => 'string', 'site_id' => 'integer', 'site_ids' => 'array')), EXTR_SKIP);
if ($delete) {
    $message = '';
    foreach ($site_ids as $site_id) {
        $verify = phpdigMySelect($id_connect, 'SELECT locked FROM ' . PHPDIG_DB_PREFIX . 'sites WHERE site_id=' . (int) $site_id);
        if (is_array($verify) && !$verify[0]['locked']) {
            // locks site (prevents any operation before erase)
            $query = "UPDATE " . PHPDIG_DB_PREFIX . "sites SET locked=1 WHERE site_id={$site_id}";
            $result_id = mysql_query($query, $id_connect);
            $query = "SELECT spider_id FROM " . PHPDIG_DB_PREFIX . "spider WHERE site_id={$site_id}";
            $result_id = mysql_query($query, $id_connect);
            if (mysql_num_rows($result_id) > 0) {
                $in = "IN (0";
                $ftp_id = phpdigFtpConnect();
                while (list($spider_id) = mysql_fetch_row($result_id)) {
                    phpdigDelText($relative_script_path, $spider_id, $ftp_id);