die($license_text);
}
// If --filelist is not set, provide one by default
if (!isset($filelist)) {
    $filelist = 'filelist.csv';
}
if ($filelist == 'stdin') {
    $handler = @fopen('php://stdin', 'r') or die("Error: No valid fileist data found\n");
} else {
    $handler = @fopen($filelist, 'r') or die("\nError: No valid filelist data found\n");
}
stream_set_blocking($handler, 1);
// Call the class Commons and login in
$wiki = new Uploader();
$wiki->url = $project;
$wiki->setUserAgent('User-Agent: FooBot (http://mediawiki.org/wiki/User:FooBot)');
$wiki->login($user, $password);
while (($data = fgetcsv($handler, 2097152, ";", "'")) !== FALSE) {
    // Get the values from the CSV
    $filename = realpath($data[0]);
    $pagename = $data[1];
    $description = str_replace('\\n', "\n", stripcslashes($data[2]));
    $date = $data[3];
    $source = stripcslashes($data[4]);
    $author = stripcslashes($data[5]);
    $optional = stripcslashes($data[6]);
    $license = stripcslashes($data[7]);
    $categories = stripcslashes($data[8]);
    $categories .= "\n[[Category:Files uploaded with Davod Uploader]]";
    $summary = stripcslashes($data[9]);
    var_dump($wiki->upload($filename, $pagename, $description, $date, $source, $author, $optional, $license, $categories, $summary));
Ejemplo n.º 2
0
    die($license_text);
}
// If --filelist is not set, provide one by default
if (!isset($filelist)) {
    $filelist = 'filelist.csv';
}
if ($filelist == 'stdin') {
    $handler = @fopen('php://stdin', 'r') or die("Error: No valid fileist data found\n");
} else {
    $handler = @fopen($filelist, 'r') or die("\nError: No valid filelist data found\n");
}
stream_set_blocking($handler, 1);
// Call the class Commons and login in
$wiki = new Uploader();
$wiki->url = $project;
$wiki->setUserAgent('User-Agent: UploadFile 1.0 (http://mediawiki.org/wiki/User:Amitie_10g) botclasses.php');
$wiki->login($user, $password);
while (($data = fgetcsv($handler, 2097152, ";", "'")) !== FALSE) {
    // Get the values from the CSV
    $filename = realpath($data[0]);
    $pagename = $data[1];
    $description = str_replace('\\n', "\n", stripcslashes($data[2]));
    $date = $data[3];
    $source = stripcslashes($data[4]);
    $author = stripcslashes($data[5]);
    $optional = stripcslashes($data[6]);
    $license = stripcslashes($data[7]);
    $categories = stripcslashes($data[8]);
    $categories .= "\n[[Category:Files uploaded with Davod Uploader]]";
    $summary = stripcslashes($data[9]);
    var_dump($wiki->upload($filename, $pagename, $description, $date, $source, $author, $optional, $license, $categories, $summary));