Esempio n. 1
0
                                if (strlen($tempfields[$mk[0]]) == 0) {
                                    $missing_tokens .= $missing_link;
                                }
                            } else {
                                $missing_tokens .= $missing_link;
                            }
                        } else {
                            $missing_tokens .= ', ' . $v[1];
                        }
                    }
                }
                $script .= $obj_template . "\n";
            }
        }
        // add footer template
        $script .= F_get_template($footer_tmp_id);
        // save script
        $scriptfile = date('YmdHis') . '_' . md5($script) . '_' . $user_id . '.txt';
        if (file_put_contents(K_PATH_CONFIG_SCRIPTS . $scriptfile, $script) !== false) {
            F_print_error('MESSAGE', $l['m_script_saved'] . ': <a href="' . K_PATH_URL_CONFIG_SCRIPTS . $scriptfile . '" title="' . $l['w_download'] . '" onclick="pdfWindow=window.open(\'' . K_PATH_URL_CONFIG_SCRIPTS . $scriptfile . '\',\'pdfWindow\',\'dependent,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes\'); return false;">' . $scriptfile . '</a>');
            if (!empty($missing_tokens)) {
                F_print_error('ERROR', $l['m_missing_tokens'] . ': ' . substr($missing_tokens, 2));
            }
        } else {
            F_print_error('ERROR', $l['m_file_save_error'] . ': ' . $scriptfile);
        }
        break;
    default:
        break;
}
//end of switch
Esempio n. 2
0
    $footer_tmp_id = intval($_REQUEST['footer_tmp_id']);
} else {
    $footer_tmp_id = 0;
}
switch ($menu_mode) {
    // process submitted data
    case 'generate':
        // generate commands and send them
        // build template
        $template = '';
        // add header template
        $template .= F_get_template($header_tmp_id) . "\n";
        // add body template
        $template .= F_get_template($tmp_id) . "\n";
        // add footer template
        $template .= F_get_template($footer_tmp_id);
        $template = trim($template);
        if (empty($template)) {
            break;
        }
        $missing_tokens = '';
        $script = '#!/usr/bin/expect -f' . "\n";
        $script .= 'set timeout 3600' . "\n\n";
        // *** SET HERE THE MAXIMUM EXECUTION TIME
        // for each selected server
        foreach ($_REQUEST as $k => $v) {
            if (substr($k, 0, 3) == 'so_') {
                ${$k} = true;
                // get object ID
                $object_id = intval(substr($k, 3));
                // get array of all object data