* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
* MA  02110-1301  USA
*
*
* On Debian GNU/Linux systems, the complete text of the GNU General
* Public License can be found in `/usr/share/common-licenses/GPL-2'.
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once 'av_init.php';
Session::logcheck("configuration-menu", "PolicyPolicy");
require_once 'policy_common.php';
$conf = $GLOBALS["CONF"];
$open_source = !preg_match("/pro|demo/i", $conf->get_conf("ossim_server_version")) ? true : false;
$admin = Session::Am_i_admin();
$db = new ossim_db();
$conn = $db->connect();
$login = Session::get_session_user();
$ctx = GET("ctx");
$id = GET('id');
$group = GET('group');
$order = GET('order');
$insert = GET('insertafter') != "" ? GET('insertafter') : GET('insertbefore');
$clone = GET('clone');
if ($open_source && empty($ctx)) {
    $ctx = Session::get_default_ctx();
}
ossim_valid($id, OSS_HEX, OSS_NULLABLE, 'illegal:' . _("id"));
ossim_valid($ctx, OSS_HEX, 'illegal:' . _("ctx"));
ossim_valid($group, OSS_HEX, OSS_NULLABLE, 'illegal:' . _("group"));
Example #2
0
function get_policy_actions($conn, $data)
{
    $ctx = empty($data['ctx']) ? Session::get_default_ctx() : $data['ctx'];
    $id = $data['id'];
    ossim_valid($ctx, OSS_HEX, 'illegal:' . _("CTX"));
    ossim_valid($id, OSS_HEX, OSS_NULLABLE, 'illegal:' . _("CTX"));
    if (ossim_error()) {
        $info_error = "Error: " . ossim_get_error();
        ossim_clean_error();
        $return['error'] = TRUE;
        $return['msg'] = $info_error;
        return $return;
    }
    $actions_saved = array();
    $result = '';
    if ($action_list = Policy_action::get_list($conn, $id)) {
        foreach ($action_list as $action) {
            $actions_saved[] = $action->get_action_id();
        }
    }
    $where = Session::Am_i_admin() ? '' : "AND ctx=UNHEX('{$ctx}')";
    if ($action_list2 = Action::get_list($conn, $where)) {
        foreach ($action_list2 as $act) {
            $sel = in_array($act->get_id(), $actions_saved) ? " selected='selected'" : "";
            $desc1 = strlen($act->get_name()) > 48 ? substr($act->get_name(), 0, 48) . "..." : $act->get_name();
            $result .= "<option value='" . $act->get_id() . "' {$sel}>{$desc1}</option>";
        }
    }
    $return['error'] = FALSE;
    $return['data'] = $result;
    return $return;
}