| Server IP : 89.117.53.150 / Your IP : 216.73.216.11 Web Server : Apache System : Linux server2.hostofiraq.site 5.15.0-186-generic #196-Ubuntu SMP Sat Jun 20 16:09:34 UTC 2026 x86_64 User : iscmbt-kufa-atu ( 1014) PHP Version : 8.2.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/iscmbt-kufa-atu/quarantine/ |
Upload File : |
<?php
/**
* @file classes/search/SearchHelperParser.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class SearchHelperParser
*
* @ingroup search
*
* @brief Class to extract text from a file using an external helper program.
*/
namespace PKP\search;
use Exception;
use PKP\config\Config;
class SearchHelperParser extends SearchFileParser
{
/** @var string Type should match an index[$type] setting in the "search" section of config.inc.php */
public $type;
private $command;
public function __construct($type, $filePath)
{
parent::__construct($filePath);
$this->type = $type;
}
public function open()
{
$prog = Config::getVar('search', 'index[' . $this->type . ']');
if (isset($prog)) {
$this->command = sprintf($prog, escapeshellarg($this->getFilePath()));
if (!($this->fp = @popen($this->command, 'r'))) {
throw new Exception("Failed to parse file {$this->getFilePath()} through the command: {$this->command}\nLast error: " . error_get_last());
}
return true;
}
return false;
}
public function close()
{
if ($this->fp && ($exitCode = pclose($this->fp))) {
throw new Exception("The indexation process exited with the code \"{$exitCode}\", perhaps the command failed: {$this->command}");
}
}
}
if (!PKP_STRICT_MODE) {
class_alias('\PKP\search\SearchHelperParser', '\SearchHelperParser');
}