Пример #1
0
function main($txt, $cmd)
{
    global $SIDU;
    $eng = $SIDU['eng'];
    $txt = @strip($txt, 1, 0, 1);
    if ($txt && $cmd) {
        $err = @save_data($SIDU, $txt, $eng);
    }
    if (!$txt) {
        $txt = "CREATE TABLE " . ($eng == 'my' ? "`{$SIDU['1']}`.`table_name`" : ($eng == 'pg' ? "\"{$SIDU['2']}\".\"table_name\"" : "table_name")) . "(\ncolname int" . ($eng == 'my' ? "(8)" : "") . ($eng == 'sl' ? "" : " NOT NULL DEFAULT 0") . " PRIMARY KEY,\n\n)";
    }
    echo "<div class='web'><p class='b dot'>", @lang(4101), " <span class='red'>", $eng == 'my' ? $SIDU[1] : "{$SIDU['1']}.{$SIDU['2']}", "</span></p>";
    if ($err) {
        echo "<p class='err'>{$err}</p>";
    }
    echo "<form action='tab-new.php?id={$SIDU['0']},{$SIDU['1']},{$SIDU['2']},{$SIDU['3']},{$SIDU['4']},{$SIDU['5']},{$SIDU['6']}' method='post' name='myform'>\n\t<table><tr><td valign='top'>" . @html_form("textarea", "txt", $txt, 420, 320, "spellcheck='false' class='box'") . "<br /><br />" . @html_form("submit", "cmd", @lang(4102)) . "</td><td valign='top' style='padding-left:10px'>";
    $str = "9|0|smallint|smallint(5)\n0|1|32768|smallint(5) unsigned NOT NULL DEFAULT 0\n1|0|int|int(9)\n0|1|2,147,483,647|int(9) unsigned NOT NULL DEFAULT 0\n1|0|numeric|numeric(7,2)\n0|1|(7,2)|numeric(7,2) unsigned NOT NULL DEFAULT 0.00\n2|0|char|char(255)\n0|1|255|char(255) NOT NULL DEFAULT \\'\\'\n0|0|binary|char(255) binary NOT NULL DEFAULT \\'\\'\n1|0|varchar|varchar(255)\n0|1|255|varchar(255) NOT NULL DEFAULT \\'\\'\n0|0|binary|varchar(255) binary NOT NULL DEFAULT \\'\\'\n1|0|text|text\n0|1|65535|text NOT NULL DEFAULT \\'\\'\n2|0|date|date\n0|1|YYYY-MM-DD|date NOT NULL DEFAULT \\'0000-00-00\\'\n1|0|timestamp|timestamp\n0|1|YmdHis|timestamp NOT NULL DEFAULT \\'0000-00-00 00:00:00\\'\n0|0|now|timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP\n2|0|auto|auto_increment\n0|1|!null|NOT NULL\n0|0|PK|NOT NULL auto_increment PRIMARY KEY\n1|0|PK|PRIMARY KEY\n0|1|PK(a)|PRIMARY KEY (col1,col2)\n0|0|UK|UNIQUE uk (col1,col2)\n0|1|idx|INDEX idx (col1,col2)\n2|0|MyISAM|ENGINE = MyISAM\n0|1|InnoDB|ENGINE = InnoDB";
    if ($eng == 'pg') {
        $str = @strtr($str, @array("smallint(5)" => "smallint", "int(9)" => "int", " DEFAULT \\'0000-00-00\\'" => "", " DEFAULT \\'0000-00-00 00:00:00\\'" => "", "CURRENT_TIMESTAMP" => "now()", "auto|auto_increment" => "serial|serial", "NOT NULL auto_increment" => "serial NOT NULL", "0|0|binary|char(255) binary NOT NULL DEFAULT \\'\\'" => "", "0|0|binary|varchar(255) binary NOT NULL DEFAULT \\'\\'" => "", "MyISAM|ENGINE = MyISAM" => "With OID|WITH (OIDS=TRUE)", "0|1|InnoDB|ENGINE = InnoDB" => "", " unsigned" => "", "PRIMARY KEY (" => "CONSTRAINT pk PRIMARY KEY (", "UNIQUE uk (" => "CONSTRAINT uk UNIQUE (", "idx|INDEX idx (col1,col2)" => "FK|CONSTRAINT fk FOREINGN KEY (col) REFERENCES tab(pk) MATCH SIMPLE\\n\\tON UPDATE NO ACTION ON DELETE NO ACTION"));
    } elseif ($eng == 'sl') {
        $str = "9|0|int|int,\\n\n0|1|PK|int PRIMARY KEY\n1|0|text|text,\\n\n1|0|real|real,\\n";
    }
    $arr = @explode("\n", $str);
    foreach ($arr as $v) {
        @main_add_txt(@trim($v));
    }
    if ($eng == 'my') {
        @main_add_txt("2|0|enum(Y,N)|enum(\\'Y\\',\\'N\\') NOT NULL DEFAULT \\'Y\\',\\n");
    }
    echo "</td></tr></table></form></div>";
}
Пример #2
0
/**
 * Import users into database from a file located on the server.
 * Function registered as service.
 * @param  string The csv (only csv) file containing users tom import
 * @param  string Security key (as found in configuration file)
 * @return string Error message
 */
function import_users_from_file($filepath, $security_key)
{
    global $_configuration;
    $errors_returned = array(0 => 'success', 1 => 'file import does not exist', 2 => 'no users to import', 3 => 'wrong datas in file', 4 => 'security error');
    // Check whether this script is launch by server and security key is ok.
    if (empty($_SERVER['REMOTE_ADDR']) || $_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR'] || $security_key != $_configuration['security_key']) {
        return $errors_returned[4];
    }
    // Libraries
    require_once 'import.lib.php';
    // Check is users file exists.
    if (!is_file($filepath)) {
        return $errors_returned[1];
    }
    // Get list of users
    $users = parse_csv_data($filepath);
    if (count($users) == 0) {
        return $errors_returned[2];
    }
    // Check the datas for each user
    $errors = validate_data($users);
    if (count($errors) > 0) {
        return $errors_returned[3];
    }
    // Apply modifications in database
    save_data($users);
    return $errors_returned[0];
    // Import successfull
}
Пример #3
0
function main($imp, $cmd)
{
    global $SIDU;
    if (!$SIDU[1]) {
        $err = @lang(2201);
    } elseif ($SIDU['eng'] == 'pg' && !$SIDU[2]) {
        $err = @lang(2202);
    }
    echo "<form action='imp.php?id={$SIDU['0']},{$SIDU['1']},{$SIDU['2']}' method='post' enctype='multipart/form-data'>\n\t<div class='web'><p class='dot'><b>", @lang(2203), ": <i class='red'>DB = {$SIDU['1']}", $SIDU[2] ? ".{$SIDU['2']}" : "", "</i></b></p>";
    if ($err) {
        echo "<p class='err'>{$err}</p></div></form>";
        return;
    }
    if ($cmd) {
        $SIDU[4] = $imp['tab'];
    }
    if ($SIDU[4]) {
        $res = @tm("SQL", "SELECT * FROM " . @goodname($SIDU[4]) . " LIMIT 1");
        $col = @get_sql_col($res, $SIDU['eng']);
        foreach ($col as $v) {
            $imp['cols'][] = $v[0];
        }
    }
    if (!$imp['col']) {
        $imp['col'] = @implode("\n", $imp['cols']);
    }
    if ($cmd) {
        $err = @valid_data($SIDU, $imp);
        if ($err) {
            echo "<p class='err'>{$err}</p>";
        } else {
            return @save_data($SIDU, $imp);
        }
    }
    if ($SIDU['eng'] == 'my') {
        $sql = "SHOW TABLES from `{$SIDU['1']}`";
    } elseif ($SIDU['eng'] == 'sl') {
        $sql = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY 1";
    } else {
        $sql = "SELECT relname FROM pg_class a,pg_namespace b\nWHERE a.relnamespace=b.oid AND b.nspname='public' AND a.relkind='r' ORDER BY 1";
    }
    $arr = @sql2arr($sql, 1);
    $tabs[0] = @lang(2204);
    foreach ($arr as $v) {
        $tabs[$v] = $v;
    }
    echo "<table><tr><td>", @lang(2205), ":</td><td>", @html_form("select", "imp[tab]", $SIDU[4], "", "", "onchange=\"location='imp.php?id={$SIDU['0']},{$SIDU['1']},{$SIDU['2']},r,'+this.options[this.selectedIndex].value\"", $tabs), "</td></tr>";
    if ($SIDU[4]) {
        echo "<tr><td valign='top'>", @lang(2206), ":</td><td>", @html_form("textarea", "imp[col]", $imp['col'], 350, 90), "</td></tr>";
    }
    echo "<tr><td valign='top'>", @lang(2207), ":</td><td><input type='file' name='f'/> ", @lang(2208, '2MB'), "</td></tr></table>\n\t<p class='dot'><br/><b>", @lang(2209), ":</b></p>\n\t<p class='dot'>", @lang(2210), ": ", @html_form("text", "imp[sepC]", $imp['sepC'] ? $imp['sepC'] : ',', 50), " eg \\t , ; « | »\n\t<br/>", @lang(2211), " ", @html_form("text", "imp[cut1]", $imp['cut1'], 50), " ", @lang(2212), " ", @html_form("text", "imp[cut2]", $imp['cut2'], 50), " ", @lang(2213), "\n\t<br/>", @lang(2214), ": ", @html_form("text", "imp[pk]", $imp['pk'], 150), " eg. c1;c2\n\t<br/>", @html_form("checkbox", "imp[del]", $imp['del'], "", "", "", array(1 => '')), @lang(2215), "\n\t<br/>", @html_form("checkbox", "imp[merge]", $imp['merge'], "", "", "", array(1 => '')), @lang(2216), "\n\t<br/>", @html_form("checkbox", "imp[stop]", $imp['stop'], "", "", "", array(1 => '')), @lang(2217), "</p>\n\t<p>", @html_form("submit", "cmd", @lang(2218)), "</p></div></form>";
}
Пример #4
0
function main()
{
    global $SIDU;
    $typ = @array("B" => @lang(1705), "S" => "SQL", "E" => @lang(1706), "D" => @lang(1707));
    $css = @array("B" => "grey", "S" => "", "E" => "red", "D" => "green");
    if ($_POST['cmd']) {
        @save_data($_POST['cmd'], $SIDU[0]);
    }
    echo "<form id='dataTab' name='dataTab' action='his.php?id={$SIDU['0']}' method='post'>\n\t<table class='grid' id='dataTable'><tr class='th'><td class='cbox'><input type='checkbox' onclick='checkedAll()'/></td>\n\t<td align='right'><a href='his.php?id={$SIDU['0']}", $_GET['sort'] ? "" : "&#38;sort=a", "'>ID</a></td><td>", @lang(1708), "</td><td>", @lang(1709), "</td><td align='right'>ms</td><td>", @lang(1710), "</td></tr>";
    foreach ($_SESSION['siduhis'][$SIDU[0]] as $i => $his) {
        $arr = @explode(" ", $his, 5);
        $cur = "<tr><td class='cbox'><input type='checkbox' name='his[]' value='{$i}'/></td><td align='right'>{$i}</td><td>{$arr['1']}</td><td>{$typ[$arr[2]]}</td><td align='right'>{$arr['3']}</td><td class='{$css[$arr[2]]}'>" . @nl2br(@html8($arr[4])) . "</td></tr>";
        $str = $_GET['sort'] ? $str . $cur : $cur . $str;
    }
    echo $str, "</table><input type='hidden' name='cmd' id='cmd'/></form>";
}
// Set this option to true to enforce strict purification for usenames.
$purification_option_for_usernames = false;
set_time_limit(0);
$form = new FormValidator('class_user_import');
$form->addElement('header', $tool_name);
$form->addElement('file', 'import_file', get_lang('ImportCSVFileLocation'));
//$form->addElement('checkbox', 'subscribe', get_lang('Action'), get_lang('SubscribeUserIfNotAllreadySubscribed'));
$form->addElement('checkbox', 'unsubscribe', '', get_lang('UnsubscribeUserIfSubscriptionIsNotInFile'));
$form->addElement('style_submit_button', 'submit', get_lang('Import'), 'class="save"');
$errors = array();
if ($form->validate()) {
    $users_classes = parse_csv_data($_FILES['import_file']['tmp_name']);
    $errors = validate_data($users_classes);
    if (count($errors) == 0) {
        $deleteUsersNotInList = isset($_REQUEST['unsubscribe']) && !empty($_REQUEST['unsubscribe']) ? true : false;
        $return = save_data($users_classes, $deleteUsersNotInList);
    }
}
Display::display_header($tool_name);
if (isset($return) && $return) {
    echo $return;
}
if (count($errors) != 0) {
    $error_message = "\n";
    foreach ($errors as $index => $error_class_user) {
        $error_message .= get_lang('Line') . ' ' . $error_class_user['line'] . ': ' . $error_class_user['error'] . '</b>';
        $error_message .= "<br />";
    }
    $error_message .= "\n";
    Display::display_error_message($error_message, false);
}
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
set_time_limit(0);
// Creating the form.
$form = new FormValidator('course_user_import');
$form->addElement('header', '', $tool_name);
$form->addElement('file', 'import_file', get_lang('ImportFileLocation'));
$form->addElement('checkbox', 'subscribe', get_lang('Action'), get_lang('SubscribeUserIfNotAllreadySubscribed'));
$form->addElement('checkbox', 'unsubscribe', '', get_lang('UnsubscribeUserIfSubscriptionIsNotInFile'));
$form->addButtonImport(get_lang('Import'));
$form->setDefaults(array('subscribe' => '1', 'unsubscribe' => 1));
$errors = array();
if ($form->validate()) {
    $users_courses = parse_csv_data($_FILES['import_file']['tmp_name']);
    $errors = validate_data($users_courses);
    if (count($errors) == 0) {
        $inserted_in_course = save_data($users_courses);
        // Build the alert message in case there were visual codes subscribed to.
        if ($_POST['subscribe']) {
            $warn = get_lang('UsersSubscribedToBecauseVisualCode') . ': ';
        } else {
            $warn = get_lang('UsersUnsubscribedFromBecauseVisualCode') . ': ';
        }
        if (!empty($inserted_in_course)) {
            $warn = $warn . ' ' . get_lang('FileImported');
            // The users have been inserted in more than one course.
            foreach ($inserted_in_course as $code => $info) {
                $warn .= ' ' . $info . ' (' . $code . ') ';
            }
        } else {
            $warn = get_lang('ErrorsWhenImportingFile');
        }
Пример #7
0
<?php

date_default_timezone_set("PRC");
include "./sqlite_lib.php";
$raw_name = $_POST["raw_name"];
$target_name = $_POST["target_name"];
$user_name = $_POST["user"];
$filesize = getRealSize("../books/{$target_name}");
$ctime = date("Y-m-d H:i:s", time());
save_data(array($target_name, $raw_name, $user_name, $ctime, "", 0, $filesize, "", ""));
function getRealSize($file)
{
    $size = filesize($file);
    $kb = 1024;
    // Kilobyte
    $mb = 1024 * $kb;
    // Megabyte
    $gb = 1024 * $mb;
    // Gigabyte
    $tb = 1024 * $gb;
    // Terabyte
    if ($size < $kb) {
        return $size . " B";
    } else {
        if ($size < $mb) {
            return round($size / $kb, 2) . " KB";
        } else {
            if ($size < $gb) {
                return round($size / $mb, 2) . " MB";
            } else {
                if ($size < $tb) {
                $es = explode('<p', $events);
                print "PeventsP" . $events;
                foreach ($es as $event) {
                    print "infop";
                    $info = explode('</p>', $event);
                    print_r($info);
                    $data = date_time_place($date, $info[0]);
                    $data['info'] = trim(utf8_encode(strip_tags($info[1])));
                    $urlweek = $week;
                    # - 1;
                    $url = "http://president.ie/index.php?section=6&engagement=" . $urlweek . "&lang=eng";
                    $data['url'] = $url;
                    $data['type'] = "engt";
                    $data['startdate'] = $data['date'] . "T" . $data['time'] . ":00Z";
                    $data['latlng'] = "53.36018,-6.3175";
                    save_data($data);
                }
            } else {
                echo 'No parser for: ' . $events . "\n";
            }
        }
    }
}
function date_time_place($date, $str)
{
    // Grab out the time in hh:mm & the am/pm
    preg_match('|([0-9]{1,2}[:.]{1}[0-9]{1,2}) ?([apm.]{2,4})|i', $str, $timeplace);
    print "timeplace";
    print_r($timeplace);
    $hours = $timeplace[1];
    $apm = $timeplace[2];
Пример #9
0
function save_sticky_data($post_id)
{
    global $box_array;
    // verify nonce
    if (isset($_POST['sticky_meta_box_nonce']) && !wp_verify_nonce($_POST['sticky_meta_box_nonce'], basename(__FILE__))) {
        return $post_id;
    }
    // check autosave
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return $post_id;
    }
    // check permissions
    if (isset($_POST['post_type']) && 'page' == $_POST['post_type']) {
        if (!current_user_can('edit_page', $post_id)) {
            return $post_id;
        }
    } elseif (!current_user_can('edit_post', $post_id)) {
        return $post_id;
    }
    foreach ($box_array as $box) {
        if ($box["fields"][0]["type"] == "datepicker") {
            save_datepicker($box);
        } else {
            save_data($box);
        }
    }
}
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes'));
// Set this option to true to enforce strict purification for usenames.
$purification_option_for_usernames = false;
set_time_limit(0);
$form = new FormValidator('class_user_import');
$form->addElement('header', $tool_name);
$form->addElement('file', 'import_file', get_lang('ImportCSVFileLocation'));
//$form->addElement('checkbox', 'subscribe', get_lang('Action'), get_lang('SubscribeUserIfNotAllreadySubscribed'));
//$form->addElement('checkbox', 'unsubscribe', '', get_lang('UnsubscribeUserIfSubscriptionIsNotInFile'));
$form->addElement('style_submit_button', 'submit', get_lang('Import'), 'class="save"');
if ($form->validate()) {
    $users_classes = parse_csv_data($_FILES['import_file']['tmp_name']);
    $errors = validate_data($users_classes);
    if (count($errors) == 0) {
        $return = save_data($users_classes);
    }
}
Display::display_header($tool_name);
if (isset($return) && $return) {
    echo $return;
}
if (count($errors) != 0) {
    $error_message = "\n";
    foreach ($errors as $index => $error_class_user) {
        $error_message .= get_lang('Line') . ' ' . $error_class_user['line'] . ': ' . $error_class_user['error'] . '</b>';
        $error_message .= "<br />";
    }
    $error_message .= "\n";
    Display::display_error_message($error_message, false);
}
Пример #11
0
    redirectMsg("users.php?" . $q, __('Users deleted successfully!', 'rmcommon'), 0);
}
// get the action
$action = RMHttpRequest::request('action', 'string', '');
switch ($action) {
    case 'new':
        user_form();
        break;
    case 'edit':
        user_form(true);
        break;
    case 'save':
        save_data();
        break;
    case 'saveedit':
        save_data(true);
        break;
    case 'mailer':
        show_mailer();
        break;
    case 'sendmail':
        send_mail();
        break;
    case 'deactivate':
        activate_users(0);
        break;
    case 'activate':
        activate_users(1);
        break;
    case 'delete':
        delete_users();
Пример #12
0
 //$payment_currency = $_POST['mc_currency'];
 //$txn_id = $_POST['txn_id'];
 //$receiver_email = $_POST['receiver_email'];
 //$payer_email = $_POST['payer_email'];
 //variable parsing comes here
 $custom = stripslashes(urldecode($_POST['custom']));
 error_log(date('[Y-m-d H:i e] ') . "custom: {$custom} " . PHP_EOL, 3, LOG_FILE);
 $customArr = json_decode($custom, 1);
 error_log(date('[Y-m-d H:i e] ') . "customArr: " . var_export($customArr, 1) . PHP_EOL, 3, LOG_FILE);
 $id = !empty($customArr['id']) ? $customArr['id'] : '';
 $user_id = !empty($customArr['user_id']) ? $customArr['user_id'] : '';
 $coupon = !empty($customArr['coupon']) ? $customArr['coupon'] : '';
 $data = $_POST;
 error_log(date('[Y-m-d H:i e] ') . "post: " . var_export($_POST, 1) . PHP_EOL, 3, LOG_FILE);
 //custom logic comes here
 save_data($id, $user_id, $data);
 if (!empty($_POST['txn_type'])) {
     switch ($_POST['txn_type']) {
         case 'subscr_signup':
             subscr_signup($id, $user_id, $data, $coupon);
             break;
         case 'subscr_payment':
             subscr_payment($id, $user_id, $data, $coupon);
             break;
         case 'subscr_cancel':
             subscr_cancel($id, $user_id, $data, $coupon);
             break;
         default:
             break;
     }
 }
Пример #13
0
    $ext = explode('.', basename($filenames[$i]));
    $target = "uploads" . DIRECTORY_SEPARATOR . md5(uniqid()) . "." . array_pop($ext);
    if (move_uploaded_file($anexos['tmp_name'][$i], $target)) {
        $success = true;
        $paths[] = $target;
    } else {
        $success = false;
        break;
    }
}
// check and process based on successful status
if ($success === true) {
    // call the function to save all data to database
    // code for the following function `save_data` is not
    // mentioned in this example
    save_data($userid, $username, $paths);
    // store a successful response (default at least an empty array). You
    // could return any additional response info you need to the plugin for
    // advanced implementations.
    $output = [];
    // for example you can get the list of files uploaded this way
    // $output = ['uploaded' => $paths];
} elseif ($success === false) {
    $output = ['error' => 'Error while uploading anexos. Contact the system administrator'];
    // delete any uploaded files
    foreach ($paths as $file) {
        unlink($file);
    }
} else {
    $output = ['error' => 'No files were processed.'];
}
Пример #14
0
      <input type="password" name="password">
      </div>
      <div><button type="submit" name="access">check</button></div>
    </form>
<?php 
} else {
    $f = array();
    for ($i = 1; $i < 200; $i++) {
        $a = find_followers($i);
        $f = array_merge($f, $a);
        if (!$a) {
            break;
        }
    }
    $oald = (array) json_decode(get_oald());
    save_data(json_encode($f));
    $persi = array();
    foreach ($oald as $x) {
        if (!in_array($x, $f)) {
            $persi[] = $x;
        }
    }
    if (!$oald) {
        echo '<h2>' . count($f) . ' followers</h1>' . '<h3>Informations saved, come back later if you\'ve lost some followers.</h3>';
    }
    if ($oald && !$persi) {
        echo '<h2>' . count($f) . ' followers</h1>' . '<h3>No changes since your last check.</h3>';
    }
    if ($oald && $persi) {
        echo '<h2>lost follower(s)</h2><ul>';
    }
Пример #15
0
//
// mails dump back
/*
 * published under the GPL Licence
 *
 * (c) Mar 2010
 *     by Karsten Hinz
 */
require_once "./config.php";
require_once "./formmail.lib.php";
require_once './Template.php';
//testing
extract_csv(0);
$daten_org = recive_formular();
$daten_no_html = $daten_org;
//ka ob das nur die addresse rüber kopiert ist hier aber auch egal
//löscht die zeilenumbrüche
clean_array($daten_no_html, 0);
//ersetzt alle sonderzeichen durch html
clean_array($daten_org, 1);
$stat = statistics($daten_org, $preise);
if (!empty($daten_org["bemerkung"])) {
    sends_info($daten_org, $stat);
}
//die nicht escapte version, damit man die datei einfacher wo anders importieren kann
save_data($daten_no_html);
//erzeugt eine Rechnung aus einen Template
$rechnung = generate_bill($daten_org, $preise);
$fehler = generate_mail($daten_org, $rechnung);
//und auch noch was anzeigen
print_page($daten_org, $rechnung, $fehler);
Пример #16
0
/**
*
* @package ESP8266 Web Server
* @version $Id$
* @author  Michael O'Toole - aka michaelo
* @begin   Saturday, Jan 22, 2015
* @copyright (c) 2015 phpbbireland
* @home    http://www.phpbbireland.com
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
define('IN_CODE', true);
$root_path = defined('ROOT_PATH') ? ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include $root_path . 'common.' . $phpEx;
include $root_path . 'includes/functions_main.' . $phpEx;
include $root_path . 'includes/functions.' . $phpEx;
$action = request_var('action', '');
if ($action == 'submit') {
    $arr = array('esp_id' => request_var('esp', 0), 'esp_chan' => request_var('chan', 0), 'esp_zone' => request_var('zone', 0), 'esp_location' => request_var('location', ''), 'esp_rx_level' => request_var('level', 0), 'esp_batt' => request_var('batt', ''), 'esp_actives' => request_var('actives', 0), 'esp_rx_treshold' => request_var('tresh', ''));
    save_data($arr);
    meta_refresh(0, 'index.php?esp_id=' . request_var('esp', 0));
} else {
    $id = request_var('esp_id', 0);
    $json_array = get_data($id);
}
include 'header.html';
include 'left_blocks.html';
include 'section_form.html';
include 'footer.html';
Пример #17
0
<?php

include '../common.php';
if (isset($_GET['create_tables'])) {
    display_create_tables($important_variables);
    exit;
}
$data = read_post_serialized('systemdata');
if (!$data || !isset($data['install_id']) || !is_string($data['install_id'])) {
    die("Internal server error while processing statistic data: Bad input!");
}
$install_id = $data['install_id'];
unset($data['install_id']);
$data['questions'] = read_post('questions', 'array');
if (!save_data($pdo, $important_variables, $install_id, $data)) {
    die("Internal server error while processing statistic data: Failed to save data!");
}
echo '<p>Thank you for your support! Have fun with your application!</p>';
function read_post($variable, $type)
{
    if (!isset($_POST[$variable]) || gettype($_POST[$variable]) != $type) {
        $x = null;
        settype($x, $type);
        return $x;
    }
    $result = $_POST[$variable];
    if (STRIP) {
        resursive_stripslashes($result);
    }
    return $result;
}
Пример #18
0
function cout_data($SIDU, $link, $conn, $sql)
{
    if ($_POST['cmd'] == 'data_save' || $_POST['cmd'] == 'data_del') {
        @save_data($SIDU, $conn[1], $_POST['cmd']);
    }
    $url = !$sql ? "tab" : "sql";
    echo "<form id='dataTab' name='dataTab' action='{$url}.php?id={$link['0']},{$link['1']},{$link['2']},{$link['3']},{$link['4']},{$SIDU['5']},{$SIDU['6']}' method='post'>";
    if (!$sql) {
        echo "<p style='padding:3px'>where ", @html_form("text", "f[sql]", $SIDU['f']['sql'], 300), " <img src='img/tool-run.png' onclick=\"submitForm('cmd','p1')\" class='vm'/> eg col='abc'</p>";
        foreach ($SIDU['g'] as $j => $gSize) {
            if ($gSize == -1) {
                $hidden .= "<a href='#' onclick=\"submitForm('showCol',{$j})\">{$SIDU[col][$j][0]}</a> ";
            }
        }
        if ($hidden) {
            echo "<p>", @lang(104), ": {$hidden}</p>";
        }
    }
    if (isset($SIDU['pk'])) {
        $pk = $SIDU['pk'];
    }
    foreach ($SIDU['col'] as $j => $v) {
        $disp[$j] = $SIDU['g'][$j] == -1 ? " style='display:none'" : "";
        $title = "{$v['0']} " . @str_replace("'", "", $v[1]);
        $color = '';
        if (@in_array($j, $SIDU['pk'])) {
            $title = "PK {$title}";
            $color = '06c';
        }
        if ($v[5] == 'auto_increment' || $v[1] == 'serial' || $v[1] == 'bigserial') {
            $color = 'c00';
        }
        $colH .= "<td class='td{$j}' title='{$title}'{$disp[$j]}><div class='gridH' id='gH{$j}'" . (!$SIDU['gridMode'] ? " style='width:{$SIDU[g][$j]}px'" : "") . ">";
        if (!$sql) {
            $colH .= "<a" . @get_sort_css($v[0], $SIDU[5], $SIDU[6]) . " href='#' onclick=\"submitForm('sidu7','{$v['0']}')\">" . ($color ? "<span style='color:#{$color}'>{$v['0']}</span>" : $v[0]) . "</a>";
        } else {
            $colH .= "<a>{$v['0']}</a>";
        }
        $colH .= "</div></td>";
        $jsStr .= "xHRD.init('gH{$j}',10);";
        $filter .= "<td class='td{$j}'{$disp[$j]}><input type='text' size='1' id='f{$j}' name='f[{$j}]' value='" . @html8($SIDU['f'][$j]) . "'/></td>";
        $grid .= "<td class='td{$j}'{$disp[$j]}><input type='text' size='1' name='g[{$j}]' id='g{$j}' value='" . $SIDU['g'][$j] . "'/></td>";
        if (!$sql) {
            $gridShow .= "<td class='td{$j}'{$disp[$j]}><img src='img/tool-sys.png' title='" . @lang(124) . "' onclick=\"submitForm('sidu7','del:{$v['0']}')\"/> <a href='#' onclick=\"submitForm('hideCol',{$j})\">" . @html_img('img/tool-x') . "</a></td>";
        }
        if ($v[3] == 'CURRENT_TIMESTAMP' || $v[3] == 'now()') {
            $v[3] = "'+his.getFullYear()+'-'+(parseInt(his.getMonth())+1)+'-'+his.getDate()+' '+his.getHours()+':'+his.getMinutes()+':'+his.getSeconds()+'";
        } elseif (@substr($v[3], 0, 9) == "nextval('") {
            $v[3] = '';
        } else {
            $v[3] = @html8($v[3] ? $v[3] : ($v[2] == 'YES' || $v[2] == 'f' ? 'NULL' : ''));
        }
        $align = $SIDU['col'][$j][8] == 'i' ? ' style="text-align:right"' : '';
        $id = 'data_new\'+id+\'_' . $j;
        $is_blob = @is_blob($SIDU['col'][$j]) ? ' onclick="editBlob(\\\'' . $id . '\\\')"' : '';
        $jsColNew .= '<td class="blue td' . $j . '"' . @str_replace("'", "\"", $disp[$j]) . '>';
        if ($is_blob) {
            $jsColNew .= '<input type="hidden" name="' . $id . '" id="' . $id . '" value="' . $v[3] . '"/><input type="text" value="' . $v[3] . '" size="1" id="blob' . $id . '"' . $is_blob . ' style="background:#ddc"/></td>';
        } else {
            $jsColNew .= '<input type="text" size="1" name="' . $id . '" id="' . $id . '" value="' . $v[3] . '"' . $align . $is_blob . ' onchange="document.dataTab.cbox_data_new\'+id+\'.checked=\\\'checked\\\'"/></td>';
        }
        if (!isset($SIDU['pk'])) {
            $pk[] = $j;
        }
        //no pk table with blob col will be slow here
    }
    echo "\n<table class='grid' id='dataTable'>";
    if (!$sql) {
        echo "\n<tr id='trhide' title='", @lang(105), "' style='opacity:0.6", $SIDU['gridShow'] ? "" : ";display:none", "'><td class='cbox'></td>{$gridShow}</tr>";
    }
    echo "\n<tr class='th'><td class='cbox'><input type='checkbox' onclick='checkedAll()'/></td>{$colH}</tr>";
    if (!$sql) {
        echo "\n<tr id='trgrid' title='", @lang(106), "'", $SIDU['gridShow'] ? "" : " style='display:none'", " class='grey'><td class='cbox'></td>{$grid}</tr>\n\t\t<tr class='gridf' title='", @lang(107), " eg: =12'><td class='cbox'><a href='tab.php?id={$SIDU['0']},{$SIDU['1']},{$SIDU['2']},{$SIDU['3']},{$SIDU['4']}' title='", @lang(108), "'>", @html_img("img/tool-find"), "</a></td>{$filter}</tr>";
    }
    foreach ($SIDU['data'] as $i => $row) {
        echo "\n<tr id='tr_{$i}'><td class='cbox'><input type='checkbox' name='cbox_data_{$i}'/></td>";
        foreach ($row as $j => $v) {
            $align = $SIDU['col'][$j][8] == 'i' ? " style='text-align:right'" : "";
            if (is_null($v)) {
                $v = 'NULL';
                $classNull = " null";
            } else {
                $classNull = "";
            }
            $v8 = @html8($v);
            $id = "data_{$i}" . "_{$j}";
            $is_blob = @is_blob($SIDU['col'][$j]) ? " onclick=\"editBlob('{$id}')\"" : "";
            echo "<td class='td{$j}{$classNull}'{$disp[$j]}{$align}>";
            if ($SIDU['gridMode']) {
                if ($is_blob || $sql) {
                    echo @nl2br($v8);
                } else {
                    $v8str = $v8 === 'NULL' ? "IS NULL" : "=\\'" . @strtr($v8, @array("&#039;" => "\\&#039;\\&#039;", "\\" => "\\\\\\\\")) . "\\'";
                    echo "<a href='#' onclick=\"setv('f{$j}','{$v8str}');submitForm('cmd','p1')\">" . @nl2br($v8) . "</a>";
                }
            } else {
                if ($is_blob) {
                    echo "<input type='hidden' name='{$id}' id='{$id}' value='{$v8}'/><input type='text' value='" . @substr($v8, 0, 30) . "' size='1' id='blob{$id}'{$is_blob} style='background:#ddc", $classNull ? ";color:#888;font-style:italic" : "", "'/>";
                } else {
                    echo "<input type='text' size='1'", $classNull ? " class='null'" : "", " name='{$id}' id='{$id}' value='{$v8}' onchange=\"document.dataTab.cbox_data_{$i}.checked='checked'\"{$align}/>";
                }
            }
            if (!$sql && @in_array($j, $pk)) {
                echo "<input type='hidden' name='pkV[{$i}][{$j}]' value='{$v8}'/>";
            }
            echo "</td>";
        }
        echo "</tr>";
    }
    echo "\n</table>";
    $arrH = @array('cmd', 'sidu7', 'sidu8', 'sidu9', 'showCol', 'hideCol');
    foreach ($arrH as $v) {
        echo @html_form("hidden", $v);
    }
    echo "<input type='hidden' id='gridShow' name='gridShow' value='{$SIDU['gridShow']}'/><input type='hidden' id='gridMode' name='gridMode' value='{$SIDU['gridMode']}'/>";
    echo "</form>\n<div id='blobDiv' style='display:none;width:99%;max-width:700px'>\n<input type='button' value='", @lang(109), "' onclick='editBlobSave()'/><input type='button' value='", @lang(110), "' onclick=\"showHide('blobDiv',-1)\"/><input type='hidden' id='blobTxtID'/>\n<br/><textarea id='blobTxt' style='width:99%;height:280px'></textarea>\n</div>\n<iframe name='hiddenfr' src='#' style='width:600px;height:200px;display:none'></iframe>\n<script type='text/javascript'>\nwindow.onload = function(){" . $jsStr . "}";
    if (!$sql) {
        echo "\nfunction addRow(){\n\tvar his = new Date();\n\tvar id = his.getHours()+his.getMinutes()+his.getSeconds();\n\tvar row = document.getElementById('dataTable').insertRow(4);\n\trow.innerHTML='<td class=\"cbox\"><input type=\"checkbox\" name=\"cbox_data_new'+id+'\"></td>{$jsColNew}';\n}";
    }
    echo "</script>";
}
Пример #19
0
            $item['enclosure']['_params']['type'] = $type;
            $item['enclosure']['_params']['length'] = $length;
            $data['cache'][$cacheid] = array('type' => $type, 'length' => $length);
        }
    } elseif (isset($data['cache'][$cacheid])) {
        $item['enclosure']['_params']['type'] = $data['cache'][$cacheid]['type'];
        $item['enclosure']['_params']['length'] = $data['cache'][$cacheid]['length'];
    }
    // Still no content type?
    if (!isset($item['enclosure']['_params']['type'])) {
        $item['enclosure']['_params']['type'] = 'application/octet-stream';
    }
}
// Any data changes?
if ($data != $olddata) {
    save_data();
}
// We got everything! Now to print out a lovely, formatted feed
echo '<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle"' . (appcast_info('format') == 'sparkledotnet' ? ' xmlns:sparkleDotNET="http://bitbucket.org/ikenndac/sparkledotnet"' : '') . ' xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>' . "\n";
echo '<title>' . (appcast_info('title') ? appcast_info('title') : 'Untitled') . '</title>';
echo appcast_info('description') ? '<description>' . appcast_info('description') . '</description>' : '';
echo appcast_info('language') ? '<language>' . appcast_info('language') . '</language>' : '';
echo "\n";
foreach ($items as &$item) {
    echo "<item>\n" . array_to_xml($item) . "</item>\n";
}
echo '</channel>
</rss>';
function array_to_xml($arr, $fromrecurse = false)
$tool_name = get_lang('AddUsersToAClass') . ' CSV';
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'class_list.php', 'name' => get_lang('Classes'));
// Set this option to true to enforce strict purification for usenames.
$purification_option_for_usernames = false;
set_time_limit(0);
$form = new FormValidator('class_user_import');
$form->addElement('file', 'import_file', get_lang('ImportFileLocation'));
$form->addElement('checkbox', 'subscribe', get_lang('Action'), get_lang('SubscribeUserIfNotAllreadySubscribed'));
$form->addElement('checkbox', 'unsubscribe', '', get_lang('UnsubscribeUserIfSubscriptionIsNotInFile'));
$form->addElement('style_submit_button', 'submit', get_lang('Import'), 'class="save"');
if ($form->validate()) {
    $users_classes = parse_csv_data($_FILES['import_file']['tmp_name']);
    $errors = validate_data($users_classes);
    if (count($errors) == 0) {
        save_data($users_classes);
        header('Location: class_list.php?action=show_message&message=' . urlencode(get_lang('FileImported')));
        exit;
    }
}
Display::display_header($tool_name);
api_display_tool_title($tool_name);
if (count($errors) != 0) {
    $error_message = "\n";
    foreach ($errors as $index => $error_class_user) {
        $error_message .= get_lang('Line') . ' ' . $error_class_user['line'] . ': ' . $error_class_user['error'] . '</b>';
        $error_message .= "<br />";
    }
    $error_message .= "\n";
    Display::display_error_message($error_message, false);
}
Пример #21
0
<?php

/**
 * @author Rick Burgess
 * @copyright 2011
 */
$sql = 'SELECT * FROM reports';
$data = get_tweets_by_day('drupal');
save_data($qid, serialize($data));
map_tweets($data);
//timesplit_tweets($data);
function timesplit_tweets($data)
{
    $hours = array();
    for ($i = 0; $i <= 23; $i++) {
        $hours[$i] = 0;
    }
    foreach ($data['results'] as $result) {
        $timestamp = strtotime($result->created_at);
        $hours[date('G', $timestamp)]++;
    }
    $js = '';
    $i = 0;
    foreach ($hours as $key => $hour) {
        $js .= "data.setValue(" . $key . ", 0, '" . $key . "');" . "\n";
        $js .= "data.setValue(" . $key . ", 1, " . $hour . ");" . "\n\n";
    }
    $tokens = array('{js}' => $js, '{results_count}' => $data['total_records']);
    $template = file_get_contents('line-chart.html');
    $template = str_replace(array_keys($tokens), array_values($tokens), $template);
    print $template;
Пример #22
0
            $image_res = false;
    }
    if ($image_res) {
        $img_info = pathinfo($img_name);
        $img_extension = strtolower($img_info["extension"]);
        $img_name_only = strtolower($img_info["filename"]);
        $new_file_name = $img_name_only . "_" . rand(0, 9999999999) . '.' . $img_extension;
        $thumb_folder = $img_folder . $thumb_prefix . $new_file_name;
        $image_folder = $img_folder . $new_file_name;
        if (!scale_image($image_res, $thumb_folder, $img_type, $img_width, $img_height, $jpg_quality, 'thumb')) {
            die("Error creating thumb :(");
        }
        if (!scale_image($image_res, $image_folder, $img_type, $img_width, $img_height, $jpg_quality, 'original')) {
            die("Error creating image :(");
        }
        if (save_data($_POST, $thumb_prefix, $new_file_name, $twidth, $theight, $fwidth, $fheight)) {
            echo '<IMG SRC="../photos/' . $thumb_prefix . $new_file_name . '">';
        }
        imagedestroy($image_res);
    }
}
function save_data($post, $tmb, $img, $twidth, $theight, $fwidth, $fheight)
{
    $title = $post["image_title"];
    $date = $post["image_date"];
    $category = $post["image_category"];
    $gear = $post["image_gear"];
    $description = $post["image_description"];
    $host = "localhost";
    $user = "******";
    $pass = "";
Пример #23
0
// Setting the name of the tool.
$tool_name = get_lang('ImportClassListCSV');
// Displaying the header.
Display::display_header($tool_name);
set_time_limit(0);
$form = new FormValidator('import_classes');
$form->addElement('file', 'import_file', get_lang('ImportCSVFileLocation'));
$group = array();
$group[] = $form->createElement('radio', 'file_type', '', 'CSV (<a href="example_class.csv" target="_blank">' . get_lang('ExampleCSVFile') . '</a>)', 'csv');
$form->addGroup($group, '', get_lang('FileType'), '<br/>');
$form->addElement('style_submit_button', 'submit', get_lang('Import'), 'class="save"');
if ($form->validate()) {
    $classes = Import::csv_to_array($_FILES['import_file']['tmp_name']);
    $errors = validate_data($classes);
    if (count($errors) == 0) {
        $number_of_added_classes = save_data($classes);
        Display::display_normal_message($number_of_added_classes . ' ' . get_lang('Added'));
    } else {
        $error_message = get_lang('ErrorsWhenImportingFile');
        $error_message .= '<ul>';
        foreach ($errors as $index => $error_class) {
            $error_message .= '<li>' . $error_class['error'] . ' (' . get_lang('Line') . ' ' . $error_class['line'] . ')';
            $error_message .= '</li>';
        }
        $error_message .= '</ul>';
        $error_message .= get_lang('Error');
        Display::display_error_message($error_message, false);
    }
}
$form->display();
?>
Пример #24
0
set_time_limit(0);
Display::display_header($tool_name);
if (isset($_POST['formSent']) && $_POST['formSent']) {
    if (empty($_FILES['import_file']['tmp_name'])) {
        $error_message = get_lang('UplUploadFailed');
        Display::display_error_message($error_message, false);
    } else {
        $allowed_file_mimetype = array('csv');
        $ext_import_file = substr($_FILES['import_file']['name'], strrpos($_FILES['import_file']['name'], '.') + 1);
        if (!in_array($ext_import_file, $allowed_file_mimetype)) {
            Display::display_error_message(get_lang('YouMustImportAFileAccordingToSelectedOption'));
        } else {
            $courses = parse_csv_data($_FILES['import_file']['tmp_name']);
            $errors = validate_data($courses);
            if (count($errors) == 0) {
                save_data($courses);
            }
        }
    }
}
if (isset($errors) && count($errors) != 0) {
    $error_message = '<ul>';
    foreach ($errors as $index => $error_course) {
        $error_message .= '<li>' . get_lang('Line') . ' ' . $error_course['line'] . ': <strong>' . $error_course['error'] . '</strong>: ';
        $error_message .= get_lang('Course') . ': ' . $error_course['Title'] . ' (' . $error_course['Code'] . ')';
        $error_message .= '</li>';
    }
    $error_message .= '</ul>';
    Display::display_error_message($error_message, false);
}
?>
Пример #25
0
     foreach ($errors as $my_errors) {
         $user_id_error[] = $my_errors[$keyToCheck];
     }
 }
 if (is_array($users)) {
     foreach ($users as $my_user) {
         if (!in_array($my_user[$keyToCheck], $user_id_error)) {
             $users_to_insert[] = $my_user;
         }
     }
 }
 $inserted_in_course = array();
 if (strcmp($file_type, 'csv') === 0) {
     save_data($users_to_insert);
 } elseif (strcmp($file_type, 'xml') === 0) {
     save_data($users_to_insert);
 } else {
     $error_message = get_lang('YouMustImportAFileAccordingToSelectedOption');
 }
 if (count($errors) > 0) {
     $see_message_import = get_lang('FileImportedJustUsersThatAreNotRegistered');
 } else {
     $see_message_import = get_lang('FileImported');
 }
 if (count($errors) != 0) {
     $warning_message = '<ul>';
     foreach ($errors as $index => $error_user) {
         $email = isset($error_user['Email']) ? ' - ' . $error_user['Email'] : null;
         $warning_message .= '<li><b>' . $error_user['error'] . '</b>: ';
         $warning_message .= '<strong>' . $error_user['UserName'] . '</strong> - ' . api_get_person_name($error_user['FirstName'], $error_user['LastName']) . '
             ' . $email;
Пример #26
0
function scraping_jumia($link, $cat, $provider)
{
    $insert_arr = array();
    $html = file_get_html($link, false);
    $lis = $html->find('#productsCatalog li');
    if (count($lis) > 0) {
        for ($i = 0; $i < count($lis); $i++) {
            $li = $lis[$i];
            //0,1,2,3
            //-- for thumbe
            $images = $li->find('img.itm-img');
            //itm-img loading // itm-img
            $dflt_thumb = $images[0]->src;
            //--- 1
            //echo $dflt_thumb."<br>";
            $insert_arr[0] = $dflt_thumb;
            //  title + link
            $atext = $li->find('em.itm-title');
            //itm-listview-title //itm-title
            $title = $atext[0]->plaintext;
            // 2
            //echo $title."<br>";
            $insert_arr[1] = $title;
            $alink = $li->find('a');
            $p_link = "https://www.jumia.com.eg" . $alink[0]->href . "?lang=ar_EG";
            // 3
            //echo $p_link."<br>";
            $insert_arr[2] = $p_link;
            //original_price
            $price = $li->find('span[class=itm-price old]');
            $original_price = preg_replace("/[^\\d|.]/", "", $price[0]->innertext);
            //4
            //echo $original_price."<br>";
            $insert_arr[3] = $original_price;
            //Price
            $td3 = $li->find('span[class=itm-price special]');
            //itm-price special bold //itm-price special
            $price = preg_replace("/[^\\d|.]/", "", $td3[0]->innertext);
            // 7
            //echo $price."<br>";
            $insert_arr[4] = $price;
            /*
            //$describe
            $td4=  $li->find('div[class=shortListViewShortDescription]'); //itm-price special bold //itm-price special
            $describe  = $td4[0]->innertext;  // 7
            echo $describe."<br>"; 
            */
            $insert_arr[5] = $cat;
            $insert_arr[6] = $provider;
            save_data($insert_arr);
        }
    }
    $html->clear();
    unset($html);
}
Пример #27
0
    $html = '<input type="text" name="info[' . $name . '][value]" value="' . htmlentities($field_value['value']) . '" placeholder="' . $name . '" />';
    if ($with_checkbox === true) {
        $checkboxs = '';
        foreach ($privacy as $privacy_level => $label) {
            $status = $field_value['privacy'] == $privacy_level ? 'checked="checked"' : '';
            $checkboxs .= '<span><input type="radio" name="info[' . $name . '][privacy]" class="toggle-on" value="' . $privacy_level . '" ' . $status . '"/>' . $label . '</span>';
        }
        $html .= $checkboxs;
    }
    return $html;
}
/**
 * Logic to save the form into a file if triggered
 */
if (isset($_POST['info'])) {
    save_data($_POST['info']);
    header("Location:management.php");
    exit;
}
?>

<?php 
/*
 * ------------ Code page ---------
 */
?>

<?php 
$url = 'management';
include 'header-user.inc.php';
?>
Пример #28
0
$tool_name = get_lang('AddUsersToACourse') . ' CSV';
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
set_time_limit(0);
// Creating the form.
$form = new FormValidator('course_user_import');
$form->addElement('header', '', $tool_name);
$form->addElement('file', 'import_file', get_lang('ImportFileLocation'));
$form->addElement('checkbox', 'subscribe', get_lang('Action'), get_lang('SubscribeUserIfNotAllreadySubscribed'));
$form->addElement('checkbox', 'unsubscribe', '', get_lang('UnsubscribeUserIfSubscriptionIsNotInFile'));
$form->addElement('style_submit_button', 'submit', get_lang('Import'), 'class="save"');
if ($form->validate()) {
    $users_courses = parse_csv_data($_FILES['import_file']['tmp_name']);
    $errors = validate_data($users_courses);
    if (count($errors) == 0) {
        $inserted_in_course = array();
        save_data($users_courses);
        // Build the alert message in case there were visual codes subscribed to.
        if ($_POST['subscribe']) {
            $warn = get_lang('UsersSubscribedToBecauseVisualCode') . ': ';
        } else {
            $warn = get_lang('UsersUnsubscribedFromBecauseVisualCode') . ': ';
        }
        if (count($inserted_in_course) > 1) {
            // The users have been inserted in more than one course.
            foreach ($inserted_in_course as $code => $info) {
                $warn .= ' ' . $info . ' (' . $code . '),';
            }
            $warn = substr($warn, 0, -1);
        }
        Security::clear_token();
        $tok = Security::get_token();
Пример #29
0
 if (is_array($errors)) {
     foreach ($errors as $my_errors) {
         $skill_id_error[] = $my_errors['SkillName'];
     }
 }
 if (is_array($skills)) {
     foreach ($skills as $my_skill) {
         if (!in_array($my_skill['SkillName'], $skill_id_error)) {
             $skills_to_insert[] = $my_skill;
         }
     }
 }
 if (strcmp($file_type, 'csv') === 0) {
     save_data($skills_to_insert);
 } elseif (strcmp($file_type, 'xml') === 0) {
     save_data($skills_to_insert);
 } else {
     $error_message = get_lang('YouMustImportAFileAccordingToSelectedOption');
 }
 if (count($errors) > 0) {
     $see_message_import = get_lang('FileImportedJustSkillsThatAreNotRegistered');
 } else {
     $see_message_import = get_lang('FileImported');
 }
 if (count($errors) != 0) {
     $warning_message = '<ul>';
     foreach ($errors as $index => $error_skill) {
         $warning_message .= '<li><b>' . $error_skill['error'] . '</b>: ';
         $warning_message .= '<strong>' . $error_skill['SkillName'] . '</strong>&nbsp;(' . $error_skill['SkillName'] . ')';
         $warning_message .= '</li>';
     }
Пример #30
0
<?php

@(include "inc.page.php");
$SIDU['page']['nav'] = 'defa';
@save_data($opt, $cmd);
@uppe();
@main();
@down();
function save_data($opt, $cmd)
{
    global $SIDU;
    if (!$cmd) {
        return;
    }
    $opt['pgSize'] = @ceil($opt['pgSize']);
    if ($opt['pgSize'] < -1 || !$opt['pgSize']) {
        $opt['pgSize'] = 15;
    }
    $SIDU['page'] = $opt;
    $cook = @explode('.', $_COOKIE['SIDUMODE']);
    $cook = "{$opt['lang']}.{$cook['1']}.{$opt['pgSize']}.{$opt['tree']}.{$opt['sortObj']}.{$opt['sortData']}.{$opt['menuTextSQL']}.{$opt['menuText']}.{$opt['his']}.{$opt['hisErr']}.{$opt['hisSQL']}.{$opt['hisData']}.{$opt['dataEasy']}.{$opt['oid']}";
    //0lang.1gridMode.2pgSize.3tree.4sortObj.5sortData.6menuTextSQL.7menuText.8his.9hisErr.10hisSQL.11hisData.12dataEasy(pg).13oid(pg)
    @setcookie('SIDUMODE', $cook, @time() + 311040000);
    $_COOKIE['SIDUMODE'] = $cook;
}
function main()
{
    global $SIDU;
    $opt = $SIDU['page'];
    $opt['pgSize'] = @ceil($opt['pgSize']);
    if ($opt['pgSize'] < -1 || !$opt['pgSize']) {