/usr/share/horde/ingo/lib/Basic/Script.php is in php-horde-ingo 3.2.8-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | <?php
/**
* Copyright 2002-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file LICENSE for license information (ASL). If you
* did not receive this file, see http://www.horde.org/licenses/apache.
*
* @category Horde
* @copyright 2002-2016 Horde LLC
* @license http://www.horde.org/licenses/apache ASL
* @package Ingo
*/
/**
* Script page.
*
* @author Mike Cochrane <mike@graftonhall.co.nz>
* @author Jan Schneider <jan@horde.org>
* @author Michael Slusarz <slusarz@horde.org>
* @category Horde
* @copyright 2002-2016 Horde LLC
* @license http://www.horde.org/licenses/apache ASL
* @package Ingo
*/
class Ingo_Basic_Script extends Ingo_Basic_Base
{
/**
*/
protected function _init()
{
global $injector, $notification, $session;
/* Redirect if script updating is not available. */
$script = $injector->getInstance('Ingo_Factory_Script');
if (!$script->hasFeature('script_file')) {
Ingo_Basic_Filters::url()->redirect();
}
/* Generate the script. */
$scripts = array();
foreach ($script->createAll() as $script) {
$scripts = array_merge($scripts, $script->generate());
}
/* Token checking. */
$actionID = $this->_checkToken(array(
'action_activate',
'action_deactivate'
));
/* Activate/deactivate script if requested. */
switch ($actionID) {
case 'action_activate':
case 'action_deactivate':
if (!empty($scripts)) {
try {
Ingo_Script_Util::activate($scripts, $actionID == 'action_deactivate');
} catch (Ingo_Exception $e) {
$notification->push($e);
}
}
break;
case 'show_active':
$scripts = array();
foreach ($session->get('ingo', 'backend/transport', Horde_Session::TYPE_ARRAY) as $transport) {
try {
$backend = $injector->getInstance('Ingo_Factory_Transport')->create($transport);
if (method_exists($backend, 'getScript')) {
$scripts[] = $backend->getScript();
}
} catch (Horde_Exception_NotFound $e) {
} catch (Ingo_Exception $e) {
$notification->push($e);
}
}
break;
}
/* Prepare the view. */
$view = new Horde_View(array(
'templatePath' => INGO_TEMPLATES . '/basic/script'
));
$view->addHelper('Text');
if (empty($scripts)) {
$view->scriptexists = false;
} else {
$view->scriptexists = true;
foreach ($scripts as &$script) {
$script['lines'] = preg_split('(\r\n|\n|\r)', trim($script['script']));
$script['width'] = strlen(count($script['lines']));
}
}
$view->scripturl = $this->_addToken(self::url());
$view->showactivate = ($actionID != 'show_active');
if ($view->scriptexists) {
$view->scripts = $scripts;
}
$this->header = _("Filter Script Display");
$this->output = $view->render('script');
}
/**
*/
static public function url(array $opts = array())
{
return Horde::url('basic.php')->add('page', 'script');
}
}
|