#
#
#
#
#
#
#
#
#
require "settings.php";
require "core-settings.php";
require "libs/ext.lib.php";
if (isset($_GET["ccid"]) && isset($_GET["prd"])) {
    $OUTPUT = printCenter($_GET);
} elseif (isset($_POST["key"])) {
    $OUTPUT = export_data($_POST);
} else {
    # Display default output
    $OUTPUT = "<li class=err> - Invalid use of module.";
}
require "template.php";
# show stock
function printCenter($_GET)
{
    # Get vars
    extract($_GET);
    # Query server
    db_connect();
    $sql = "SELECT * FROM costcenters WHERE ccid = '{$ccid}'";
    $ccRslt = db_exec($sql) or errDie("Unable to retrieve Cost centers from database.");
    if (pg_numrows($ccRslt) < 1) {
Ejemplo n.º 2
0
        $s_export = set_export_defaults($s_export['format'], $s_export);
    }
    if (isset($_POST['dt_export_doit'])) {
        $s_export = get_export_form_data($s_export);
        list($warning, $error) = check_export_form_data($s_export);
        if (empty($error) && empty($warning)) {
            // display result in an iframe by iframe_content.php
            if ($s_export['target']['option'] == 'screen') {
                // remove pending dbstat-jobs from session
                $s_iframejobs = array_filter($s_iframejobs, create_function('$a', '$a["job"]!="export";'));
                $iframekey_export = md5(uniqid('export'));
                $s_iframejobs[$iframekey_export] = array('job' => 'export', 'data' => $s_export, 'timestamp' => time());
            } else {
                $filename = export_filename($s_export);
                send_export_headers(get_export_mimetype($s_export['format']), $filename);
                export_data($s_export);
                // if we don't stop the execution, the client will download
                // all the html from the panels ...
                globalize_session_vars();
                exit;
            }
        }
    }
    $js_stack .= js_data_export();
}
//
// the Import button on the csv-panel was pushed
//
if (have_panel_permissions($s_login['user'], 'dt_import', TRUE) && isset($_POST['dt_import_doit'])) {
    // import empty values as NULL option
    $s_csv['import_null'] = isset($_POST['dt_import_null']) ? TRUE : FALSE;
function process_form()
{
    if ($_POST['_form_submit'] == 1) {
        error_log("exporting data step 1");
        $select_all_regexp = ".";
        if (!isset($_POST['first_name']) || $_POST['first_name'] == "") {
            $_SESSION['first_name'] = $select_all_regexp;
        } else {
            $_SESSION['first_name'] = $_POST['first_name'];
        }
        if (!isset($_POST['last_name']) || $_POST['last_name'] == "") {
            $_SESSION['last_name'] = $select_all_regexp;
        } else {
            $_SESSION['last_name'] = $_POST['last_name'];
        }
        if (!isset($_POST['gender']) || $_POST['gender'] == "") {
            $_SESSION['gender'] = $select_all_regexp;
        } else {
            $_SESSION['gender'] = $_POST['gender'];
        }
        if (!isset($_POST['type'])) {
            $_SESSION['type'] = [];
        } else {
            $_SESSION['type'] = $_POST['type'];
        }
        if (!isset($_POST['status']) || $_POST['status'] == "") {
            $_SESSION['status'] = $select_all_regexp;
        } else {
            $_SESSION['status'] = $_POST['status'];
        }
        if (!isset($_POST['start_date']) || $_POST['start_date'] == "") {
            $_SESSION['start_date'] = $select_all_regexp;
        } else {
            $_SESSION['start_date'] = $_POST['start_date'];
        }
        if (!isset($_POST['city']) || $_POST['city'] == "") {
            $_SESSION['city'] = $select_all_regexp;
        } else {
            $_SESSION['city'] = $_POST['city'];
        }
        if (!isset($_POST['zip']) || $_POST['zip'] == "") {
            $_SESSION['zip'] = $select_all_regexp;
        } else {
            $_SESSION['zip'] = $_POST['zip'];
        }
        if (!isset($_POST['phone']) || $_POST['phone'] == "") {
            $_SESSION['phone'] = $select_all_regexp;
        } else {
            $_SESSION['phone'] = $_POST['phone'];
        }
        if (!isset($_POST['email']) || $_POST['email'] == "") {
            $_SESSION['email'] = $select_all_regexp;
        } else {
            $_SESSION['email'] = $_POST['email'];
        }
        error_log("first name = " . $_SESSION['first_name']);
        error_log("last name = " . $_SESSION['last_name']);
        error_log("gender = " . $_SESSION['gender']);
        foreach ($_SESSION['type'] as $t) {
            error_log("type selected " . $t);
        }
        error_log("status = " . $_SESSION['status']);
        error_log("start date = " . $_SESSION['start_date']);
        error_log("city = " . $_SESSION['city']);
        error_log("zip = " . $_SESSION['zip']);
        error_log("phone = " . $_SESSION['phone']);
        error_log("email = " . $_SESSION['email']);
        $result = get_people_for_export("*", $_SESSION['first_name'], $_SESSION['last_name'], $_SESSION['gender'], $_SESSION['type'], $_SESSION['status'], $_SESSION['start_date'], $_SESSION['city'], $_SESSION['zip'], $_SESSION['phone'], $_SESSION['email']);
        $returned_people = [];
        while ($result_row = mysql_fetch_assoc($result)) {
            $person = make_a_person($result_row);
            $returned_people[] = $person;
        }
        $_SESSION['returned_people'] = serialize($returned_people);
        error_log("returns " . count($_SESSION['returned_people']) . "people");
        include 'dataResults.inc.php';
    } else {
        if ($_POST['_form_submit'] == 2) {
            error_log("Exporting data step 2");
            $_SESSION['results'] = $_POST['results_list'];
            if ($_POST['all_export']) {
                $export_people = [];
                error_log("returns " . count(unserialize($_SESSION['returned_people'])) . "people");
                foreach (unserialize($_SESSION['returned_people']) as $p) {
                    $export_people[] = $p->get_id();
                    error_log("Exporting data for " . $p->get_id());
                }
                error_log("Exporting all data.");
                $_SESSION['selected_people'] = $export_people;
                include 'dataExport.inc.php';
            } else {
                if ($_POST['b_export']) {
                    error_log("Exporting selected data");
                    if ($_POST['results_list']) {
                        $_SESSION['selected_people'] = $_POST['results_list'];
                        foreach ($_POST['results_list'] as $export_person) {
                            $temp_dude = retrieve_person($export_person);
                            error_log("Exporting data for " . $temp_dude->get_first_name() . " " . $temp_dude->get_last_name());
                        }
                    }
                    include 'dataExport.inc.php';
                }
            }
        } else {
            if ($_POST['_form_submit'] == 3) {
                error_log("Exporting data step 3");
                $_POST['export_attr'][] = 'id';
                $all_attrs_concat = implode(", ", $_POST['export_attr']);
                echo $all_attrs_concat;
                error_log("All attributes = " . $all_attrs_concat);
                foreach ($_POST['export_attr'] as $attr) {
                    error_log("attr to be exported " . $attr);
                }
                $result = get_people_for_export($all_attrs_concat, $_SESSION['first_name'], $_SESSION['last_name'], $_SESSION['gender'], $_SESSION['type'], $_SESSION['status'], $_SESSION['start_date'], $_SESSION['city'], $_SESSION['zip'], $_SESSION['phone'], $_SESSION['email']);
                $export_data = [];
                while ($result_row = mysql_fetch_assoc($result)) {
                    if (in_array($result_row['id'], $_SESSION['selected_people'])) {
                        $temp_person = [$result_row['id']];
                        foreach ($result_row as $row) {
                            if (!isset($row) || $row == "") {
                                $row = "";
                            }
                            $temp_person[] = $row;
                        }
                        $export_data[] = array_slice($temp_person, 0, count($temp_person) - 1);
                    }
                }
                date_default_timezone_set('America/New_York');
                $current_time = ["Export date: " . date("F j, Y, g:i a")];
                export_data($current_time, array_merge(["id"], $_POST['export_attr']), $export_data);
            }
        }
    }
}
Ejemplo n.º 4
0
    // 3. need to send that dataset to the prepexport function to make the spreadsheet
    // 4. need to provide a link to the finished file
    // 5. need to make sure import templates are created appropriately
    // read the query data from the cached file
    $queryData = file(XOOPS_ROOT_PATH . "/cache/exportQuery_" . intval($_GET['eq']) . ".formulize_cached_query_for_export");
    global $xoopsUser;
    $exportUid = $xoopsUser ? $xoopsUser->getVar('uid') : 0;
    $groups = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS);
    // query fid must match passed fid in URL, and the current user id must match the userid at the time the export file was created
    if (trim($queryData[0]) == intval($_GET['fid']) and trim($queryData[1]) == $exportUid) {
        if ($_GET['type'] == "update") {
            do_update_export($queryData, $frid, $fid, $groups);
        } else {
            $columns = explode(",", $_GET['cols']);
            $include_metadata = 1 == $_POST['metachoice'];
            export_data($queryData, $frid, $fid, $groups, $columns, $include_metadata);
        }
    } else {
        print _formulize_DE_EXPORT_FILE_ERROR;
    }
}
// end of "if the metachoice form has been submitted"
function do_update_export($queryData, $frid, $fid, $groups)
{
    // this is the old export code, which is used for 'update' mode
    $fdchoice = "update";
    $GLOBALS['formulize_doingExport'] = true;
    unset($queryData[0]);
    // get rid of the fid and userid lines
    unset($queryData[1]);
    $queryData = implode(" ", $queryData);
Ejemplo n.º 5
0
Archivo: epg.php Proyecto: bostjang/EPG
function epg_plugin_options_page()
{
    if (!current_user_can('manage_options')) {
        wp_die('Nimate pravice za dostop do željene strani.');
    }
    if (isset($_POST['load'])) {
        global $wpdb;
        $table_name = $wpdb->prefix . 'oddaje_filmi';
        $searchq = esc_html($_POST['seznam_filmi_oddaje']);
        $shows_movies = $wpdb->get_results("SELECT * FROM {$table_name} where naslov = '{$searchq}'");
        foreach ($shows_movies as $show_movie) {
            $naslov = $show_movie->naslov;
            $trajanje = $show_movie->trajanje;
            $tip = $show_movie->tip;
            $kategorija = $show_movie->kategorija;
            $opis = $show_movie->opis;
        }
    }
    if (isset($_POST['epg_add_movie_show_submit'])) {
        global $wpdb;
        $table_name = $wpdb->prefix . 'epg';
        $naslov = esc_html(trim($_POST['epg_title']));
        $kanal = esc_html(stripslashes(trim($_POST['epg_kanal'])));
        $tip = esc_html(stripslashes(trim($_POST['type'])));
        $kategorija = esc_html(stripslashes(trim($_POST['cat'])));
        $dolzina = esc_html(stripslashes(trim($_POST['duration_movie_show'])));
        $datum = esc_html(stripslashes(trim($_POST['izbrani_datum'])));
        $ura_zacetek = esc_html(stripslashes(trim($_POST['ura_zacetek'])));
        $ura_konec = esc_html(stripslashes(trim($_POST['ura_konec'])));
        $opis = esc_textarea(stripslashes(trim($_POST['epg_description'])));
        $content = $_FILES['userfile'];
        $opis = stripslashes(str_replace(array("\r", "\n"), " ", $opis));
        $naslov = str_replace(array("\\"), " ", $naslov);
        $tip = str_replace(array("\\"), " ", $tip);
        $kategorija = str_replace(array("\\"), " ", $kategorija);
        $kanal = str_replace(array("\\"), " ", $kanal);
        if ($naslov == "" || $tip == "" || $kategorija == "" || $dolzina == "" || $opis == "" || $datum == "" || $ura_zacetek == "" || $ura_konec == "") {
            echo "<script>jQuery(document).ready(function(\$){\n    \t\t\talert('Izpolnite prazna polja oziroma naložite sliko!');\n\t\t\t\t});</script>";
        } else {
            if (!function_exists('wp_handle_upload')) {
                require_once ABSPATH . 'wp-admin/includes/file.php';
            }
            $uploadedfile = $_FILES['userfile'];
            $upload_overrides = array('test_form' => false);
            $movefile = wp_handle_upload($uploadedfile, $upload_overrides);
            if ($movefile && !isset($movefile['error'])) {
                $path = $movefile['url'];
                $wpdb->insert($table_name, array('naslov' => $naslov, 'kanal' => $kanal, 'trajanje' => $dolzina, 'tip' => $tip, 'kategorija' => $kategorija, 'opis' => $opis, 'datum' => $datum, 'zacetek_ura' => $ura_zacetek, 'konec_ura' => $ura_konec, 'slika_path' => $path));
                echo "<script>jQuery(document).ready(function(\$){\n\t    \t\t\talert('Uspešno dodano!');\n\t\t\t\t\t});</script>";
                export_data();
            } else {
                /**
                 * Error generated by _wp_handle_upload()
                 * @see _wp_handle_upload() in wp-admin/includes/file.php
                 */
                echo "<script>jQuery(document).ready(function(\$){\n    \t\t\t\talert('Naložite sliko!');\n\t\t\t\t\t});</script>";
            }
        }
    }
    require 'inc/main-page.php';
}
    }
} else {
    // no date submitted, so set $date and $enddate to today
    $date = $_GET['date'];
    $enddate = $_GET['enddate'];
}
$od = new OccupancyData($date, $enddate);
$formattedDate = date("m-d-y", strtotime($date));
$formattedEndDate = date("m-d-y", strtotime($enddate));
// String of this date, including the weekday and such
if ($od instanceof OccupancyData) {
    include_once "dataView.inc";
} else {
    echo "<h3>Occupancy Data for " . $formattedDate . " to " . $formattedEndDate . " not found</h3><br>";
}
export_data($od, $date, $enddate, $formattedDate, $formattedEndDate);
// options to export data or select a different date range
show_options();
?>
			<!--  the footer goes here now -->
			<?php 
include_once "footer.inc";
?>
		</div>
	</div>
</body>
</html>

<?php 
function export_data($od, $date, $enddate, $formattedDate, $formattedEndDate)
{
        $current_time = array("Export date: " . date("m/d/Y g:ia"));
        for ($i = 0; $i <= count($attribute_array); $i++) {
            if ($attribute_array[$i][1] == 'on') {
                $search_attr .= $attribute_array[$i][2] . "=" . $attribute_array[$i][3] . ", ";
            }
        }
        $search_attr = substr($search_attr, 0, -2);
        $data_to_export = array();
        foreach ($returned_people as $p) {
            $data_row = array($p->get_id(), $p->get_first_name(), $p->get_last_name(), $p->get_address(), $p->get_city(), $p->get_state(), $p->get_zip(), $p->get_phone1(), $p->get_phone2(), $p->get_email(), $p->get_type(), $p->get_address(), implode(',', $p->get_group()), implode(',', $p->get_role()), $p->get_status(), $p->get_birthday(), $p->get_start_date(), $p->get_notes());
            $data_to_export[] = $data_row;
        }
        foreach ($returned_shifts as $returned_shift) {
            $data_to_export[] = $returned_shift;
        }
        export_data($current_time, array($search_attr), $data_to_export);
        include 'dataResults.inc.php';
    } else {
        $archived_months = getall_archived_dbMonth_ids();
        $unique_months = array();
        foreach ($archived_months as $archived_month) {
            if (!in_array(substr($archived_month, 0, 5), $unique_months)) {
                $unique_months[] = substr($archived_month, 0, 5);
            }
        }
        include 'dataSearch.inc.php';
        // the form has not been submitted, so show it
    }
}
function export_data($ct, $sa, $ed)
{
                    } else {
                        // connect failed
                        $content .= '<p><span class="err">' . $info_strings['FBError'] . ':</span>' . fbird_errmsg() . "</p>\n";
                        $s_login['password'] = '';
                        $s_connected = FALSE;
                    }
                    cleanup_session();
                }
            } else {
                $error = fbird_errmsg();
            }
            break;
        case 'export':
            include './inc/export.inc.php';
            ob_start();
            export_data($job['data']);
            $content = ob_get_contents();
            ob_end_clean();
            break;
    }
    echo iframe_content($content, $error);
    unset($s_iframejobs[$key]);
    globalize_session_vars();
}
function get_iframejob($iframejobs, $key)
{
    if (isset($iframejobs[$key])) {
        return $iframejobs[$key];
    }
    return FALSE;
}