Exemple #1
0
function update_tables_to_300()
{
    $dbupdater = new WfdownloadsDbupdater();
    if (!wfdownloads_TableExists('wfdownloads_meta')) {
        // Create table wfdownloads_meta
        $table = new WfdownloadsTable('wfdownloads_meta');
        $table->setStructure("CREATE TABLE %s (\n        \t\t\t\t\t\tmetakey varchar(50) NOT NULL default '',\n        \t\t\t\t\t\tmetavalue varchar(255) NOT NULL default '',\n        \t\t\t\t\t\tPRIMARY KEY (metakey))\n        \t\t\t\t\t\tENGINE=MyISAM;");
        $table->setData(sprintf("'version', %s", round($GLOBALS['xoopsModule']->getVar('version') / 100, 2)));
        if ($dbupdater->updateTable($table)) {
            echo "wfdownloads_meta table created<br />";
        }
    }
    $download_fields = array("lid" => array("Type" => "int(11) unsigned NOT NULL auto_increment", "Default" => false), "cid" => array("Type" => "int(5) unsigned NOT NULL default '0'", "Default" => true), "title" => array("Type" => "varchar(100) NOT NULL default ''", "Default" => true), "url" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "filename" => array("Type" => "varchar(150) NOT NULL default ''", "Default" => true), "filetype" => array("Type" => "varchar(100) NOT NULL default ''", "Default" => true), "homepage" => array("Type" => "varchar(100) NOT NULL default ''", "Default" => true), "version" => array("Type" => "varchar(20) NOT NULL default ''", "Default" => true), "size" => array("Type" => "int(8) NOT NULL default '0'", "Default" => true), "platform" => array("Type" => "varchar(50) NOT NULL default ''", "Default" => true), "screenshot" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "submitter" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "publisher" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "status" => array("Type" => "tinyint(2) NOT NULL default '0'", "Default" => true), "date" => array("Type" => "int(10) NOT NULL default '0'", "Default" => true), "hits" => array("Type" => "int(11) unsigned NOT NULL default '0'", "Default" => true), "rating" => array("Type" => "double(6,4) NOT NULL default '0.0000'", "Default" => true), "votes" => array("Type" => "int(11) unsigned NOT NULL default '0'", "Default" => true), "comments" => array("Type" => "int(11) unsigned NOT NULL default '0'", "Default" => true), "license" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "mirror" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "price" => array("Type" => "varchar(10) NOT NULL default 'Free'", "Default" => true), "paypalemail" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "features" => array("Type" => "text NOT NULL", "Default" => false), "requirements" => array("Type" => "text NOT NULL", "Default" => false), "homepagetitle" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "forumid" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "limitations" => array("Type" => "varchar(255) NOT NULL default '30 day trial'", "Default" => true), "dhistory" => array("Type" => "text NOT NULL", "Default" => false), "published" => array("Type" => "int(11) NOT NULL default '1089662528'", "Default" => true), "expired" => array("Type" => "int(10) NOT NULL default '0'", "Default" => true), "updated" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "offline" => array("Type" => "tinyint(1) NOT NULL default '0'", "Default" => true), "description" => array("Type" => "text NOT NULL", "Default" => false), "ipaddress" => array("Type" => "varchar(120) NOT NULL default '0'", "Default" => true), "notifypub" => array("Type" => "int(1) NOT NULL default '0'", "Default" => true), "summary" => array("Type" => "text NOT NULL", "Default" => false));
    $renamed_fields = array("logourl" => "screenshot");
    echo "<br /><B>Checking Download table</B><br />";
    $download_handler = xoops_getmodulehandler('download', 'wfdownloads');
    $download_table = new WfdownloadsTable("wfdownloads_downloads");
    $fields = get_table_info($download_handler->table, $download_fields);
    // Check for renamed fields
    rename_fields($download_table, $renamed_fields, $fields, $download_fields);
    update_table($download_fields, $fields, $download_table);
    if ($dbupdater->updateTable($download_table)) {
        echo "Downloads table updated<br />";
    }
    unset($fields);
    $mod_fields = array("requestid" => array("Type" => "int(11) NOT NULL auto_increment", "Default" => false), "lid" => array("Type" => "int(11) unsigned NOT NULL default '0'", "Default" => true), "cid" => array("Type" => "int(5) unsigned NOT NULL default '0'", "Default" => true), "title" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "url" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "filename" => array("Type" => "varchar(150) NOT NULL default ''", "Default" => true), "filetype" => array("Type" => "varchar(100) NOT NULL default ''", "Default" => true), "homepage" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "version" => array("Type" => "varchar(20) NOT NULL default ''", "Default" => true), "size" => array("Type" => "int(8) NOT NULL default '0'", "Default" => true), "platform" => array("Type" => "varchar(50) NOT NULL default ''", "Default" => true), "screenshot" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "submitter" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "publisher" => array("Type" => "text NOT NULL", "Default" => false), "status" => array("Type" => "tinyint(2) NOT NULL default '0'", "Default" => true), "date" => array("Type" => "int(10) NOT NULL default '0'", "Default" => true), "hits" => array("Type" => "int(11) unsigned NOT NULL default '0'", "Default" => true), "rating" => array("Type" => "double(6,4) NOT NULL default '0.0000'", "Default" => true), "votes" => array("Type" => "int(11) unsigned NOT NULL default '0'", "Default" => true), "comments" => array("Type" => "int(11) unsigned NOT NULL default '0'", "Default" => true), "license" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "mirror" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "price" => array("Type" => "varchar(10) NOT NULL default 'Free'", "Default" => true), "paypalemail" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "features" => array("Type" => "text NOT NULL", "Default" => false), "requirements" => array("Type" => "text NOT NULL", "Default" => false), "homepagetitle" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "forumid" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "limitations" => array("Type" => "varchar(255) NOT NULL default '30 day trial'", "Default" => true), "dhistory" => array("Type" => "text NOT NULL", "Default" => false), "published" => array("Type" => "int(10) NOT NULL default '0'", "Default" => true), "expired" => array("Type" => "int(10) NOT NULL default '0'", "Default" => true), "updated" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "offline" => array("Type" => "tinyint(1) NOT NULL default '0'", "Default" => true), "summary" => array("Type" => "text NOT NULL", "Default" => false), "description" => array("Type" => "text NOT NULL", "Default" => false), "modifysubmitter" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "requestdate" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true));
    $renamed_fields = array("logourl" => "screenshot");
    echo "<br /><B>Checking Modified Downloads table</B><br />";
    $mod_handler = xoops_getmodulehandler('modification', 'wfdownloads');
    $mod_table = new WfdownloadsTable("wfdownloads_mod");
    $fields = get_table_info($mod_handler->table, $mod_fields);
    rename_fields($mod_table, $renamed_fields, $fields, $mod_fields);
    update_table($mod_fields, $fields, $mod_table);
    if ($dbupdater->updateTable($mod_table)) {
        echo "Modified Downloads table updated <br />";
    }
    unset($fields);
    $cat_fields = array("cid" => array("Type" => "int(5) unsigned NOT NULL auto_increment", "Default" => false), "pid" => array("Type" => "int(5) unsigned NOT NULL default '0'", "Default" => true), "title" => array("Type" => "varchar(50) NOT NULL default ''", "Default" => true), "imgurl" => array("Type" => "varchar(255) NOT NULL default ''", "Default" => true), "description" => array("Type" => "text NOT NULL default ''", "Default" => true), "total" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "summary" => array("Type" => "text NOT NULL", "Default" => false), "spotlighttop" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "spotlighthis" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "dohtml" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true), "dosmiley" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true), "doxcode" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true), "doimage" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true), "dobr" => array("Type" => "tinyint(1) NOT NULL default '1'", "Default" => true), "weight" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true));
    echo "<br /><B>Checking Category table</B><br />";
    $cat_handler = xoops_getmodulehandler('category', 'wfdownloads');
    $cat_table = new WfdownloadsTable("wfdownloads_cat");
    $fields = get_table_info($cat_handler->table, $cat_fields);
    update_table($cat_fields, $fields, $cat_table);
    if ($dbupdater->updateTable($cat_table)) {
        echo "Category table updated<br />";
    }
    unset($fields);
    $broken_fields = array("reportid" => array("Type" => "int(5) NOT NULL auto_increment", "Default" => false), "lid" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "sender" => array("Type" => "int(11) NOT NULL default '0'", "Default" => true), "ip" => array("Type" => "varchar(20) NOT NULL default ''", "Default" => true), "date" => array("Type" => "varchar(11) NOT NULL default '0'", "Default" => true), "confirmed" => array("Type" => "enum('0','1') NOT NULL default '0'", "Default" => true), "acknowledged" => array("Type" => "enum('0','1') NOT NULL default '0'", "Default" => true));
    echo "<br /><B>Checking Broken Report table</B><br />";
    $broken_handler = xoops_getmodulehandler('report', 'wfdownloads');
    $broken_table = new WfdownloadsTable("wfdownloads_broken");
    $fields = get_table_info($broken_handler->table, $broken_fields);
    update_table($broken_fields, $fields, $broken_table);
    if ($dbupdater->updateTable($broken_table)) {
        echo "Broken Reports table updated<br />";
    }
    unset($fields);
}
Exemple #2
0
function csv_reader($dry_run, $options)
{
    /*
     * This function does all the work of removing unwanted characters,
     * spaces, exclamation marks and such from the names in the users.csv
     * file.  
     */
    $filename = $options['file'];
    $conn = open_db_connection($options);
    $table_exists = check_table_exists($conn, $options);
    if (!$table_exists) {
        echo "\nWarning! Table does not exist\n";
    }
    if (($handle = fopen($filename, "r")) !== FALSE) {
        while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
            $num = count($data);
            //Lower case then capitalise first
            $data[0] = ucfirst(strtolower($data[0]));
            //Lower case then capitalise first
            $data[1] = ucfirst(strtolower($data[1]));
            //Lower case the email
            $data[2] = strtolower($data[2]);
            //$data[2] = preg_replace('/\s+/', "", $data[2]);
            // Remove trailing whitespaces
            $data[0] = rtrim($data[0]);
            // Remove trailing whitespaces
            $data[1] = rtrim($data[1]);
            // Remove trailing whitespaces
            $data[2] = rtrim($data[2]);
            // Remove non alphas from firstname
            $data[0] = preg_replace('/[^a-z]+\\Z/i', "", $data[0]);
            // Remove non alphas (except apostrophes) from surname
            $data[1] = preg_replace('/[^a-z\']+\\Z/i', "", $data[1]);
            // Add backslashes to escape the apostrophes
            $data[0] = addslashes($data[0]);
            $data[1] = addslashes($data[1]);
            $data[2] = addslashes($data[2]);
            echo "   email is " . $data[2] . "\n";
            if (validEmail($data[2])) {
                if ($dry_run) {
                    echo $data[0] . " " . $data[1] . " " . $data[2] . " would be written to database\n";
                } else {
                    if (!$dry_run) {
                        update_table($data, $conn);
                    }
                }
            } else {
                echo $data[0] . " " . $data[1] . " " . $data[2] . " will NOT be written to database as email is invalid\n";
            }
        }
        fclose($handle);
        $conn = null;
    }
}
function csv_reader($dry_run, $options)
{
    /*
     *       Somewhere in this function there will be an if/else statement
     *       to test valid emails, if not valid, write to STDOUT
     *       else, call update table
     */
    $filename = $options['file'];
    /* if (dry_run)
    		open connection
    		check if table exists
    		parse file
                    don't write to table
    		write to STDOUT
               else if (!dry_run)
    		open connection
    		check if table exists
    		parse file
                    write to table */
    $conn = open_db_connection($options);
    check_table_exists($conn);
    $row = 1;
    if (($handle = fopen($filename, "r")) !== FALSE) {
        while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
            $num = count($data);
            $data[0] = ucfirst(strtolower($data[0]));
            $data[1] = ucfirst(strtolower($data[1]));
            $data[2] = strtolower($data[2]);
            if (validEmail($data[2])) {
                if ($dry_run) {
                    echo "\ndry_run is set\n";
                    echo $data[0] . " " . $data[1] . " " . $data[2] . " would be written to database";
                } else {
                    if (!$dry_run) {
                        echo "\ndry_run is not set\n";
                        update_table($data, $conn);
                    }
                }
            } else {
                //echo "\nThis email is not valid\n";
                echo "\n" . $data[0] . " " . $data[1] . " " . $data[2] . " will not be written to database as email is invalid\n";
            }
            //       echo " $num fields in line $row: \n";
            $row++;
            //                         for ($c=0; $c < $num; $c++) {
            //    echo $data[$c] . "\n";
            //                        }
        }
        fclose($handle);
    }
}
        // Audit log
        $risk_id = 1000;
        $message = "The likelihood naming convention was modified by the \"" . $_SESSION['user'] . "\" user.";
        write_log($risk_id, $_SESSION['uid'], $message);
        // There is an alert message
        $alert = true;
        $alert_message = "The likelihood naming convention was updated successfully.";
    }
}
// Check if the mitigation effort update was submitted
if (isset($_POST['update_mitigation_effort'])) {
    $new_name = $_POST['new_name'];
    $value = (int) $_POST['mitigation_effort'];
    // Verify value is an integer
    if (is_int($value)) {
        update_table("mitigation_effort", $new_name, $value);
        // Audit log
        $risk_id = 1000;
        $message = "The mitigation effort naming convention was modified by the \"" . $_SESSION['user'] . "\" user.";
        write_log($risk_id, $_SESSION['uid'], $message);
        // There is an alert message
        $alert = true;
        $alert_message = "The mitigation effort naming convention was updated successfully.";
    }
}
?>

<!doctype html>
<html>
  
  <head>
    <div class="panel-heading">
        ประเภท
    </div>
    <div class="panel-body">
        <form method="POST" class="form-inline">
            <input type="hidden" name="type_id">
            <spen class="title">เพิ่ม : </spen>
            <input type="text" class="form-control" name="type_name" placeholder="เพิ่ม / แก้ไข">
            <span id="cate"><input type="radio" value="1" name="type_cat"> สิ้นเปลือง <input type="radio" value="2" name="type_cat"> ไม่สิ้นเปลือง</span>
            <button type="submit" class="btn btn-default"><i class="glyphicon glyphicon-ok"></i> ตกลง</button>
            <a href="javascript:void(0)" class="btn btn-success btn-add pull-right"><i class="glyphicon glyphicon-plus"></i> เพิ่ม</a>
        </form>
        <?php 
if (isset($_POST['type_name'])) {
    if ($_POST['type_id'] != '') {
        update_table('type_product', array('tp_name' => $_POST['type_name'], 'tp_category' => $_POST['type_cat']), 'tp_id', $_POST['type_id'], $con);
    } elseif ($_POST['type_name'] != '') {
        insert_table('type_product', array('tp_name' => $_POST['type_name'], 'tp_category' => $_POST['type_cat']), $con);
    }
}
if (isset($_GET['del'])) {
    delete_data('type_product', 'tp_id', $_GET['id'], $con);
    echo "<script>window.location='index.php?system=3&module=system_products&action=list_type_products'</script>";
}
$rs = getTable('type_product', $con);
?>
        <table class="table table-bordered" width="100%">
            <thead>
                <tr>
                    <th>รหัส</th>
                    <th>ประเภท</th>
Exemple #6
0
$con = connect_db();
?>
    <div class="panel panel-default">
    <div class="panel-heading">ประเภทสินค้า</div>
    <div class="panel-body">
        <form method="POST" class="form-inline">
            <input type="hidden" name="type_id">
            <spen class="title">เพิ่ม : </spen><input type="text" class="form-control" name="type_name" placeholder="เพิ่ม / แก้ไข">
            <button type="submit" class="btn btn-default"><i class="glyphicon glyphicon-ok"></i> ตกลง</button>
            <a href="javascript:void(0)" class="btn btn-success btn-add pull-right"><i class="glyphicon glyphicon-plus"></i> เพิ่ม</a>
        </form>
    </div>
    <?php 
if (isset($_POST['type_name'])) {
    if ($_POST['type_id'] != '') {
        update_table('type_repair', array('tr_name' => $_POST['type_name']), 'tr_id', $_POST['type_id'], $con);
    } elseif ($_POST['type_name'] != '') {
        insert_table('type_repair', array('tr_name' => $_POST['type_name']), $con);
    }
}
if (isset($_GET['del'])) {
    delete_data('type_repair', 'tr_id', $_GET['id'], $con);
    echo "<script>window.location='index.php?system=1&module=control&action=type_repair'</script>";
}
$tr = getTable('type_repair', $con);
?>
    <table id="table-data" class="display table-data" border="1" cellspacing="0" width="100%">
        <thead>
            <tr>
                <th>รหัส</th>
                <th>ชื่อลูกค้า</th>
Exemple #7
0
function new_topic($username,$title,$message,$id_board){	
        $message=mysql_real_escape_string($message);

	$result = mysql_query("SELECT * FROM smf_members WHERE member_name='$username'") or die(mysql_error());
	$member_data = mysql_fetch_array($result) or die(mysql_error());
	
	$id_member = $member_data['id_member'];
	$posts     = $member_data['posts'];
	$email     = $member_data['email_address'];
	//add to topics
	$new_id_topic   = find_next('smf_topics','id_topic');
	$new_id_message = find_next('smf_messages','id_msg');
	mysql_query("INSERT INTO smf_topics (id_topic, is_sticky, id_board, id_first_msg, id_last_msg, id_member_started, id_member_updated, id_poll, id_previous_board, id_previous_topic, num_replies, num_views, locked, unapproved_posts, approved) VALUES ('$new_id_topic','0','$id_board','$new_id_message','$new_id_message','$id_member','$id_member','0','0','0','0','0','0','0','1')") or die(mysql_error()); 
	$time=time();
	//add to messages
mysql_query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'");
	mysql_query("INSERT INTO smf_messages (id_msg, id_topic, id_board, poster_time, id_member, id_msg_modified, subject, poster_name, poster_email, poster_ip, smileys_enabled, modified_time, modified_name, body, icon, approved) VALUES ('$new_id_message','$new_id_topic','$id_board','$time','$id_member','$new_id_message','$title','$username','$email','','1','0','','$message','xx','1')") or die(mysql_error());

	//post count
       	update_table('smf_members','id_member',$id_member,'posts',$posts+1);

	//insert log_topics
//	mysql_query("INSERT INTO smf_log_topics (id_member, id_topic, id_msg) VALUES ('$id_member','$new_id_topic','$new_id_message')") or die(mysql_error());

	//insert log_digest
//	mysql_query("INSERT INTO smf_log_digest (id_topic, id_msg, note_type, daily, exclude) VALUES ('$new_id_topic','$new_id_message','topic','0','1')") or die(mysql_error());
	
	//update log_boards
	mysql_query("UPDATE smf_log_boards SET id_msg='$new_id_message' WHERE id_member='$id_member' AND id_board='$id_board'") or die(mysql_error());

	//update log_activity
  //      $result = mysql_query("SELECT * FROM smf_log_activity") or die(mysql_error());
    //    while($row = mysql_fetch_array($result)){
//		$last_date   = $row['date'];
//		$last_posts  = $row['posts'];
//		$last_topics = $row['topics'];
//	}
//	update_table('smf_log_activity','date',$last_date,'posts',$last_posts+1);
//	update_table('smf_log_activity','date',$last_date,'topics',$last_topics+1);

	//update boards
	$result = mysql_query("SELECT * FROM smf_boards WHERE id_board='$id_board'") or die(mysql_error());
	$row = mysql_fetch_array($result);
	$ntopics=$row['num_topics'];
        $nposts=$row['num_posts'];
        update_table('smf_boards','id_board',$id_board,'id_last_msg',$new_id_message);
      	update_table('smf_boards','id_board',$id_board,'id_msg_updated',$new_id_message);
	update_table('smf_boards','id_board',$id_board,'num_posts',$nposts+1);
	update_table('smf_boards','id_board',$id_board,'num_topics',$ntopics+1);
	return $new_id_topic;
}
Exemple #8
0
/**
 * Admin Site Page
 *  @param App $a
 */
function admin_page_site_post(&$a)
{
    if (!x($_POST, "page_site")) {
        return;
    }
    check_form_security_token_redirectOnErr('/admin/site', 'admin_site');
    // relocate
    if (x($_POST, 'relocate') && x($_POST, 'relocate_url') && $_POST['relocate_url'] != "") {
        $new_url = $_POST['relocate_url'];
        $new_url = rtrim($new_url, "/");
        $parsed = @parse_url($new_url);
        if (!$parsed || (!x($parsed, 'host') || !x($parsed, 'scheme'))) {
            notice(t("Can not parse base url. Must have at least <scheme>://<domain>"));
            goaway($a->get_baseurl(true) . '/admin/site');
        }
        /* steps:
         * replace all "baseurl" to "new_url" in config, profile, term, items and contacts
         * send relocate for every local user
         * */
        $old_url = $a->get_baseurl(true);
        function update_table($table_name, $fields, $old_url, $new_url)
        {
            global $db, $a;
            $dbold = dbesc($old_url);
            $dbnew = dbesc($new_url);
            $upd = array();
            foreach ($fields as $f) {
                $upd[] = "`{$f}` = REPLACE(`{$f}`, '{$dbold}', '{$dbnew}')";
            }
            $upds = implode(", ", $upd);
            $q = sprintf("UPDATE %s SET %s;", $table_name, $upds);
            $r = q($q);
            if (!$r) {
                notice("Failed updating '{$table_name}': " . $db->error);
                goaway($a->get_baseurl(true) . '/admin/site');
            }
        }
        // update tables
        update_table("profile", array('photo', 'thumb'), $old_url, $new_url);
        update_table("term", array('url'), $old_url, $new_url);
        update_table("contact", array('photo', 'thumb', 'micro', 'url', 'nurl', 'request', 'notify', 'poll', 'confirm', 'poco'), $old_url, $new_url);
        update_table("unique_contacts", array('url'), $old_url, $new_url);
        update_table("item", array('owner-link', 'owner-avatar', 'author-name', 'author-link', 'author-avatar', 'body', 'plink', 'tag'), $old_url, $new_url);
        // update config
        $a->set_baseurl($new_url);
        set_config('system', 'url', $new_url);
        // send relocate
        $users = q("SELECT uid FROM user WHERE account_removed = 0 AND account_expired = 0");
        foreach ($users as $user) {
            proc_run('php', 'include/notifier.php', 'relocate', $user['uid']);
        }
        info("Relocation started. Could take a while to complete.");
        goaway($a->get_baseurl(true) . '/admin/site');
    }
    // end relocate
    $sitename = x($_POST, 'sitename') ? notags(trim($_POST['sitename'])) : '';
    $hostname = x($_POST, 'hostname') ? notags(trim($_POST['hostname'])) : '';
    $sender_email = x($_POST, 'sender_email') ? notags(trim($_POST['sender_email'])) : '';
    $banner = x($_POST, 'banner') ? trim($_POST['banner']) : false;
    $shortcut_icon = x($_POST, 'shortcut_icon') ? notags(trim($_POST['shortcut_icon'])) : '';
    $touch_icon = x($_POST, 'touch_icon') ? notags(trim($_POST['touch_icon'])) : '';
    $info = x($_POST, 'info') ? trim($_POST['info']) : false;
    $language = x($_POST, 'language') ? notags(trim($_POST['language'])) : '';
    $theme = x($_POST, 'theme') ? notags(trim($_POST['theme'])) : '';
    $theme_mobile = x($_POST, 'theme_mobile') ? notags(trim($_POST['theme_mobile'])) : '';
    $maximagesize = x($_POST, 'maximagesize') ? intval(trim($_POST['maximagesize'])) : 0;
    $maximagelength = x($_POST, 'maximagelength') ? intval(trim($_POST['maximagelength'])) : MAX_IMAGE_LENGTH;
    $jpegimagequality = x($_POST, 'jpegimagequality') ? intval(trim($_POST['jpegimagequality'])) : JPEG_QUALITY;
    $register_policy = x($_POST, 'register_policy') ? intval(trim($_POST['register_policy'])) : 0;
    $daily_registrations = x($_POST, 'max_daily_registrations') ? intval(trim($_POST['max_daily_registrations'])) : 0;
    $abandon_days = x($_POST, 'abandon_days') ? intval(trim($_POST['abandon_days'])) : 0;
    $register_text = x($_POST, 'register_text') ? notags(trim($_POST['register_text'])) : '';
    $allowed_sites = x($_POST, 'allowed_sites') ? notags(trim($_POST['allowed_sites'])) : '';
    $allowed_email = x($_POST, 'allowed_email') ? notags(trim($_POST['allowed_email'])) : '';
    $block_public = x($_POST, 'block_public') ? True : False;
    $force_publish = x($_POST, 'publish_all') ? True : False;
    $global_directory = x($_POST, 'directory_submit_url') ? notags(trim($_POST['directory_submit_url'])) : '';
    $thread_allow = x($_POST, 'thread_allow') ? True : False;
    $newuser_private = x($_POST, 'newuser_private') ? True : False;
    $enotify_no_content = x($_POST, 'enotify_no_content') ? True : False;
    $private_addons = x($_POST, 'private_addons') ? True : False;
    $disable_embedded = x($_POST, 'disable_embedded') ? True : False;
    $allow_users_remote_self = x($_POST, 'allow_users_remote_self') ? True : False;
    $no_multi_reg = x($_POST, 'no_multi_reg') ? True : False;
    $no_openid = !(x($_POST, 'no_openid') ? True : False);
    $no_regfullname = !(x($_POST, 'no_regfullname') ? True : False);
    $no_utf = !(x($_POST, 'no_utf') ? True : False);
    $community_page_style = x($_POST, 'community_page_style') ? intval(trim($_POST['community_page_style'])) : 0;
    $max_author_posts_community_page = x($_POST, 'max_author_posts_community_page') ? intval(trim($_POST['max_author_posts_community_page'])) : 0;
    $verifyssl = x($_POST, 'verifyssl') ? True : False;
    $proxyuser = x($_POST, 'proxyuser') ? notags(trim($_POST['proxyuser'])) : '';
    $proxy = x($_POST, 'proxy') ? notags(trim($_POST['proxy'])) : '';
    $timeout = x($_POST, 'timeout') ? intval(trim($_POST['timeout'])) : 60;
    $delivery_interval = x($_POST, 'delivery_interval') ? intval(trim($_POST['delivery_interval'])) : 0;
    $poll_interval = x($_POST, 'poll_interval') ? intval(trim($_POST['poll_interval'])) : 0;
    $maxloadavg = x($_POST, 'maxloadavg') ? intval(trim($_POST['maxloadavg'])) : 50;
    $dfrn_only = x($_POST, 'dfrn_only') ? True : False;
    $ostatus_disabled = !(x($_POST, 'ostatus_disabled') ? True : False);
    $ostatus_poll_interval = x($_POST, 'ostatus_poll_interval') ? intval(trim($_POST['ostatus_poll_interval'])) : 0;
    $diaspora_enabled = x($_POST, 'diaspora_enabled') ? True : False;
    $ssl_policy = x($_POST, 'ssl_policy') ? intval($_POST['ssl_policy']) : 0;
    $force_ssl = x($_POST, 'force_ssl') ? True : False;
    $old_share = x($_POST, 'old_share') ? True : False;
    $hide_help = x($_POST, 'hide_help') ? True : False;
    $suppress_language = x($_POST, 'suppress_language') ? True : False;
    $suppress_tags = x($_POST, 'suppress_tags') ? True : False;
    $use_fulltext_engine = x($_POST, 'use_fulltext_engine') ? True : False;
    $itemcache = x($_POST, 'itemcache') ? notags(trim($_POST['itemcache'])) : '';
    $itemcache_duration = x($_POST, 'itemcache_duration') ? intval($_POST['itemcache_duration']) : 0;
    $max_comments = x($_POST, 'max_comments') ? intval($_POST['max_comments']) : 0;
    $lockpath = x($_POST, 'lockpath') ? notags(trim($_POST['lockpath'])) : '';
    $temppath = x($_POST, 'temppath') ? notags(trim($_POST['temppath'])) : '';
    $basepath = x($_POST, 'basepath') ? notags(trim($_POST['basepath'])) : '';
    $singleuser = x($_POST, 'singleuser') ? notags(trim($_POST['singleuser'])) : '';
    $proxy_disabled = x($_POST, 'proxy_disabled') ? True : False;
    $old_pager = x($_POST, 'old_pager') ? True : False;
    $only_tag_search = x($_POST, 'only_tag_search') ? True : False;
    if ($ssl_policy != intval(get_config('system', 'ssl_policy'))) {
        if ($ssl_policy == SSL_POLICY_FULL) {
            q("update `contact` set\n\t\t\t\t`url`     = replace(`url`    , 'http:' , 'https:'),\n\t\t\t\t`photo`   = replace(`photo`  , 'http:' , 'https:'),\n\t\t\t\t`thumb`   = replace(`thumb`  , 'http:' , 'https:'),\n\t\t\t\t`micro`   = replace(`micro`  , 'http:' , 'https:'),\n\t\t\t\t`request` = replace(`request`, 'http:' , 'https:'),\n\t\t\t\t`notify`  = replace(`notify` , 'http:' , 'https:'),\n\t\t\t\t`poll`    = replace(`poll`   , 'http:' , 'https:'),\n\t\t\t\t`confirm` = replace(`confirm`, 'http:' , 'https:'),\n\t\t\t\t`poco`    = replace(`poco`   , 'http:' , 'https:')\n\t\t\t\twhere `self` = 1");
            q("update `profile` set\n\t\t\t\t`photo`   = replace(`photo`  , 'http:' , 'https:'),\n\t\t\t\t`thumb`   = replace(`thumb`  , 'http:' , 'https:')\n\t\t\t\twhere 1 ");
        } elseif ($ssl_policy == SSL_POLICY_SELFSIGN) {
            q("update `contact` set\n\t\t\t\t`url`     = replace(`url`    , 'https:' , 'http:'),\n\t\t\t\t`photo`   = replace(`photo`  , 'https:' , 'http:'),\n\t\t\t\t`thumb`   = replace(`thumb`  , 'https:' , 'http:'),\n\t\t\t\t`micro`   = replace(`micro`  , 'https:' , 'http:'),\n\t\t\t\t`request` = replace(`request`, 'https:' , 'http:'),\n\t\t\t\t`notify`  = replace(`notify` , 'https:' , 'http:'),\n\t\t\t\t`poll`    = replace(`poll`   , 'https:' , 'http:'),\n\t\t\t\t`confirm` = replace(`confirm`, 'https:' , 'http:'),\n\t\t\t\t`poco`    = replace(`poco`   , 'https:' , 'http:')\n\t\t\t\twhere `self` = 1");
            q("update `profile` set\n\t\t\t\t`photo`   = replace(`photo`  , 'https:' , 'http:'),\n\t\t\t\t`thumb`   = replace(`thumb`  , 'https:' , 'http:')\n\t\t\t\twhere 1 ");
        }
    }
    set_config('system', 'ssl_policy', $ssl_policy);
    set_config('system', 'delivery_interval', $delivery_interval);
    set_config('system', 'poll_interval', $poll_interval);
    set_config('system', 'maxloadavg', $maxloadavg);
    set_config('config', 'sitename', $sitename);
    set_config('config', 'hostname', $hostname);
    set_config('config', 'sender_email', $sender_email);
    set_config('system', 'suppress_language', $suppress_language);
    set_config('system', 'suppress_tags', $suppress_tags);
    set_config('system', 'shortcut_icon', $shortcut_icon);
    set_config('system', 'touch_icon', $touch_icon);
    if ($banner == "") {
        // don't know why, but del_config doesn't work...
        q("DELETE FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1", dbesc("system"), dbesc("banner"));
    } else {
        set_config('system', 'banner', $banner);
    }
    if ($info == "") {
        del_config('config', 'info');
    } else {
        set_config('config', 'info', $info);
    }
    set_config('system', 'language', $language);
    set_config('system', 'theme', $theme);
    if ($theme_mobile === '---') {
        del_config('system', 'mobile-theme');
    } else {
        set_config('system', 'mobile-theme', $theme_mobile);
    }
    if ($singleuser === '---') {
        del_config('system', 'singleuser');
    } else {
        set_config('system', 'singleuser', $singleuser);
    }
    set_config('system', 'maximagesize', $maximagesize);
    set_config('system', 'max_image_length', $maximagelength);
    set_config('system', 'jpeg_quality', $jpegimagequality);
    set_config('config', 'register_policy', $register_policy);
    set_config('system', 'max_daily_registrations', $daily_registrations);
    set_config('system', 'account_abandon_days', $abandon_days);
    set_config('config', 'register_text', $register_text);
    set_config('system', 'allowed_sites', $allowed_sites);
    set_config('system', 'allowed_email', $allowed_email);
    set_config('system', 'block_public', $block_public);
    set_config('system', 'publish_all', $force_publish);
    if ($global_directory == "") {
        // don't know why, but del_config doesn't work...
        q("DELETE FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1", dbesc("system"), dbesc("directory_submit_url"));
    } else {
        set_config('system', 'directory_submit_url', $global_directory);
    }
    set_config('system', 'thread_allow', $thread_allow);
    set_config('system', 'newuser_private', $newuser_private);
    set_config('system', 'enotify_no_content', $enotify_no_content);
    set_config('system', 'disable_embedded', $disable_embedded);
    set_config('system', 'allow_users_remote_self', $allow_users_remote_self);
    set_config('system', 'block_extended_register', $no_multi_reg);
    set_config('system', 'no_openid', $no_openid);
    set_config('system', 'no_regfullname', $no_regfullname);
    set_config('system', 'community_page_style', $community_page_style);
    set_config('system', 'max_author_posts_community_page', $max_author_posts_community_page);
    set_config('system', 'no_utf', $no_utf);
    set_config('system', 'verifyssl', $verifyssl);
    set_config('system', 'proxyuser', $proxyuser);
    set_config('system', 'proxy', $proxy);
    set_config('system', 'curl_timeout', $timeout);
    set_config('system', 'dfrn_only', $dfrn_only);
    set_config('system', 'ostatus_disabled', $ostatus_disabled);
    set_config('system', 'ostatus_poll_interval', $ostatus_poll_interval);
    set_config('system', 'diaspora_enabled', $diaspora_enabled);
    set_config('config', 'private_addons', $private_addons);
    set_config('system', 'force_ssl', $force_ssl);
    set_config('system', 'old_share', $old_share);
    set_config('system', 'hide_help', $hide_help);
    set_config('system', 'use_fulltext_engine', $use_fulltext_engine);
    set_config('system', 'itemcache', $itemcache);
    set_config('system', 'itemcache_duration', $itemcache_duration);
    set_config('system', 'max_comments', $max_comments);
    set_config('system', 'lockpath', $lockpath);
    set_config('system', 'temppath', $temppath);
    set_config('system', 'basepath', $basepath);
    set_config('system', 'proxy_disabled', $proxy_disabled);
    set_config('system', 'old_pager', $old_pager);
    set_config('system', 'only_tag_search', $only_tag_search);
    info(t('Site settings updated.') . EOL);
    goaway($a->get_baseurl(true) . '/admin/site');
    return;
    // NOTREACHED
}
Exemple #9
0
<?php

$con = connect_db();
update_table('claim', array('cl_status' => 3), 'cl_id', $_GET['id'], $con);
close_db($con);
?>
<script type="text/javascript">
    window.location="?module=system_claim&action=list_claim";
</script>
Exemple #10
0
<?php

$con = connect_db();
update_table('admin_user', $_POST['u'], 'am_id', $_POST['id'], $con);
?>
<script type="text/javascript">
alert('แก้ไขข้อมูลเรียบร้อย');
window.location="index.php?module=system_staff&action=form_edit_staff&id=<?php 
echo $_POST['id'];
?>
";
</script>
Exemple #11
0
<?php

$con = connect_db();
$data['rp_status'] = '4';
update_table('repair_tb', $data, 'rp_id', $_GET['id'], $con);
?>
<script>
	alert('ยกเลิกใบแจ้งซ่อมเรียบร้อยแล้ว');
	window.location='?module=system_repair&action=list_repair';
</script>
<?php

$con = connect_db();
insert_table('send_repair', $_POST['send'], $con);
update_table('repair', array('rp_status' => '3'), 'rp_id', $_POST['send']['rp_id'], $con);
?>


<script>alert('เพิ่มข้อมูลใบส่งซ่อมเรียบร้อยแล้ว');</script>
<script>window.location='index.php?system=1&module=control&action=list_send_repair'</script>
<?php

$con = connect_db();
//dieArray($_POST['send']);
update_table('repair', array('rp_status' => 2), 'rp_id', $_POST['sr_rp'], $con);
// อัพตารางใบแจ้งซ่อม
update_table('send_repair', $_POST['send'], 'sr_id', $_POST['sr_id'], $con);
?>


<script>
    alert('แก้ไขข้อมูลเรียบร้อยแล้ว');
    window.location='index.php?system=1&module=control&action=list_send_repair';
</script>
<?php

$con = connect_db();
update_table('customer_fix', $_POST['fix'], 'c_id', $_POST['id'], $con);
close_db($con);
?>


<script>
    alert('แก้ไขข้อมูลเรียบร้อย');
    window.location='index.php?system=1&module=control&action=list_customer';
</script>
Exemple #15
0
}
if (!is_dir(DISCUZ_ROOT . 'source/plugin/yiqixueba/template')) {
    dmkdir(DISCUZ_ROOT . 'source/plugin/yiqixueba/template');
}
$github_ver = '1.0';
if (!C::t('common_setting')->skey_exists('yiqixueba_siteurlkey')) {
    $salt = random(6);
    $yiqixueba_settings = array('yiqixueba_salt' => $salt, 'yiqixueba_siteurlkey' => md5($_G['siteurl'] . $salt), 'yiqixueba_mainver' => '1.0');
    C::t('common_setting')->update_batch($yiqixueba_settings);
}
$sitekey = C::t('common_setting')->fetch('yiqixueba_siteurlkey');
$pages = $tables = $templates = array();
$mokuaiver = array('main' => '1.0', 'server' => '1.0', 'shop' => '1.0', 'yqxb' => '1.0', 'wxq123' => '1.0', 'yikatong' => '1.0', 'cheyouhui' => '1.0');
foreach ($mokuaiver as $k => $v) {
    update_pages($k, $v);
    update_table($k, $v);
    update_template($k, $v);
    update_lang($k, $v);
}
writelangfile($nplang);
C::t('common_setting')->update('yiqixueba_pages', serialize($pages));
C::t('common_setting')->update('yiqixueba_tables', serialize($tables));
C::t('common_setting')->update('yiqixueba_templates', serialize($templates));
unset($sitekey);
//更新page页面
function update_pages($mokuai, $ver)
{
    global $sitekey, $pages;
    $pages_dir = MOKUAI_DIR . '/' . $mokuai . '/' . $ver . '/Controler';
    if ($handle = opendir($pages_dir)) {
        while (false !== ($file = readdir($handle))) {
<?php

$con = connect_db();
update_table('products', $_POST['pd'], 'p_id', $_POST['id'], $con);
close_db($con);
?>
<script>
    alert('แก้ไขข้อมูลเรียบร้อยแล้ว');
    window.location='index.php?system=3&module=system_products&action=edit_products&id=<?php 
echo $_POST['id'];
?>
';
</script>
    $query = "SELECT * from TABLES WHERE Table_Number={$table_id}";
    $table = mysql_query($query);
    $num_fields = mysql_num_fields($table);
    for ($i = 0; $i < $num_fields; $i++) {
        echo "<tr>" . "\n";
        echo "<td>" . "\n";
        $field = mysql_field_name($table, $i);
        echo "<b>" . $field . "</b>" . "\n";
        echo "</td>" . "\n";
        echo "<td>" . "\n";
        $res = mysql_result($table, 0, $i);
        if ($i) {
            echo "<input type = \"text\" name = \"{$field}\" value=\"{$res}\">";
        } else {
            echo "<input type = \"text\" name = \"{$field}\" value=\"{$res}\" readonly=\"readonly\">";
        }
        echo "</td>" . "\n";
        echo "</tr>" . "\n";
    }
    echo "</table>" . "\n" . "<br/>";
    echo "<input type=\"submit\" name=\"submitbutton\" value=\"Update\">" . "\n";
    echo "</form>" . "\n";
}
?>
<body background="1.png">
<?php 
update_table($_POST["table"]);
?>
</body>
</html>
Exemple #18
0
<?php

$con = connect_db();
$repair = getTable_where('repair', 'rp_id', $_GET['id'], $con);
$rs_repair = assoc_get($repair);
$customer = getTable_where('customer_fix', 'c_id', $rs_repair['c_id'], $con);
$rs_customer = assoc_get($customer);
$t_repair = getTable('type_repair', $con);
$item = unserialize($rs_repair['rp_item']);
if (isset($_POST['repair-submit'])) {
    $item = @array('item1' => $_POST['item']['item1'], 'item2' => $_POST['item']['item2'], 'item3' => $_POST['item']['item3']);
    $item_submit = serialize($item);
    $data = array('rp_datereturn' => $_POST['date_return'], 'rp_version' => $_POST['version'], 'rp_symptom' => $_POST['symptom'], 'rp_status' => $_POST['rp_status'], 'rp_item' => $item_submit, 'tr_id' => $_POST['pd_type_id']);
    update_table('repair', $data, 'rp_id', $_POST['rp_id'], $con);
    echo '<script>window.location="index.php?system=1&module=control&action=inform_repair"</script>';
}
?>
<div class="panel panel-default">
    <div class="panel-heading">แก้ไขข้อมูลใบแจ้งซ่อม</div>
    <div class="panel-body">
        <form action="" method="POST">
        <table class="table table-bordered">
            <input type="hidden" name="rp_id" value="<?php 
echo $rs_repair['rp_id'];
?>
">
            <tr><td>รหัสลูกค้า : </td><td colspan="3"><input type="text" name="c_id" class="form-control" readonly value="<?php 
echo $rs_customer['c_id'];
?>
"></td></tr>
            <tr><td width="15%">ชื่อ-นามสกุล : </td><td colspan="3"><input type="text" name="flname" class="form-control" readonly value="<?php 
Exemple #19
0
    session_start();
    $uid = $_SESSION['uid'];
    //要存储的目录位置
    $wine_pic_dir = "../../wine_pic/";
    //存储图片,并返回文件路径
    $winePicURL = "";
    $hasImgFile = true;
    if ($_FILES['file']['name'] !== "") {
        $winePicURL = save_file($_FILES['file']['name'], $wine_pic_dir, $_FILES['file']['tmp_name']);
    } else {
        $hasImgFile = false;
        $winePicURL = "";
    }
    // update wine info
    $info_arr = get_wine_basic_info($winePicURL, $uid);
    $wine_id = update_table($conn, $info_arr, $hasImgFile);
    // update wine to online
    $onlineArr = get_online_info($_POST['online_channels'], $_POST['online_links'], $_POST['wine_to_online_ids']);
    update_online($onlineArr, $wine_id, $conn);
    // update wine to offline
    $offlineArr = get_offline_info($_POST['offline_ids'], $_POST['shops'], $_POST['cities'], $_POST['addresses'], $_POST['phones'], $uid);
    update_offline($offlineArr, $wine_id, $conn);
    header("location: manage_wine.php");
}
function update_table($conn, $info_arr, $hasImgFile)
{
    if ($_POST['wine_id'] != "") {
        // update
        if ($hasImgFile == true) {
            $sql = "UPDATE web_wine \n\t\t\t\t\tSET zh_wine_name='{$info_arr['zh_wine_name']}',\n\t\t\t\t\ten_wine_name='{$info_arr['en_wine_name']}',\n\t\t\t\t\tzh_country='{$info_arr['zh_country_name']}',\n\t\t\t\t\tzh_place='{$info_arr['zh_place_name']}',\n\t\t\t\t\ten_place='{$info_arr['en_place_name']}',\n\t\t\t\t\tzh_chateau='{$info_arr['zh_chateau_name']}',\n\t\t\t\t\ten_chateau='{$info_arr['en_chateau_name']}',\n\t\t\t\t\tzh_wine_type='{$info_arr['zh_wine_type_name']}',\n\t\t\t\t\ten_wine_type='{$info_arr['en_wine_type_name']}',\n\t\t\t\t\tzh_grape_type='{$info_arr['zh_grape_name']}',\n\t\t\t\t\ten_grape_type='{$info_arr['en_grape_name']}',\n\t\t\t\t\tvolume = '{$info_arr['volume']}',\n\t\t\t\t\tyear='{$info_arr['wine_year']}',\n\t\t\t\t\tprice='{$info_arr['wine_price']}',\n\t\t\t\t\tseller_id='{$info_arr['seller_id']}',\n\t\t\t\t\timage_name='{$info_arr['image_link']}',\n\t\t\t\t\tcreate_time='{$info_arr['add_time']}'\n\t\t\t\t\tWHERE id='{$_POST['wine_id']}'\n\t\t\t\t\t;";
        } else {
                } else {
                    $notUrgent = $notUrgent + 1;
                    update_parameter($notUrgent, $col_notUrgent, $table_general);
                    $symptom_true = 1;
                    update_symptom($symptom_true, $symptom, $table_notUrgent);
                }
            }
            $question_id = $question_id + 1;
            update_parameter($question_id, $col_qID, $table_general);
        } elseif ($question_id > $number_rows) {
            $id = $id + 1;
            update_parameter($id, $col_ID, $table_general);
            $question_id = $question_id = 1;
            update_parameter($question_id, $col_qID, $table_general);
            $use_table = $animal_table;
            update_table($use_table);
            header('Refresh: 0; url=question.php');
            // refresh the page
        }
    }
} else {
    header("Location: result_system.php");
    //go to result page
    exit;
}
echo '
</div> 
<button class="play"></button>
<button class="pause"></button>
<p class = "small" > Click on blue for yes, click on yellow for no.</p>
<form method="get" action="question.php">
	<br><br>
	Note : Give <a href="http://plugins.svn.wordpress.org/kush-micro-news/trunk/readme.txt" target="_blank">readme.txt</a> a try before experimenting stuff if you have no idea what you are doing.
	
</div>
<script type="text/javascript">
	function check_custom_color(obj,elem){		
		jQuery(document).ready(function() {
			//changing values of sibling input field corresponding
			jQuery(obj).parent().find("input[type = text]").attr("value", obj.value);
		});
	}	
</script>
<?php 
}
if (isset($_GET['updatedb']) && $_GET['updatedb'] == 'true') {
    update_table();
}
function update_table()
{
    $ver = get_option('kush_mn_db_version', '0');
    $text = "";
    global $wpdb;
    $table_name = $wpdb->prefix . "kushmicronews";
    $rows_affected = 0;
    $rows_affected = $wpdb->query("ALTER TABLE `{$table_name}` CONVERT TO CHARACTER SET utf8");
    if ($ver == "1.0") {
        $rows_affected += $wpdb->query("ALTER TABLE `{$table_name}` ADD `category` varchar(20) DEFAULT 'default'");
    }
    if ($rows_affected > 0) {
        $text .= "Updated Successfully! ";
        update_option('kush_mn_db_version', '1.1');
}
// -----------------------------------------------------------------------------
update_table(WHOLE_COL, 'page_events', 'round_id');
update_table(WHOLE_COL, 'access_log', 'activity');
update_table(WHOLE_COL, 'past_tallies', 'tally_name');
update_table(WHOLE_COL, 'best_tally_rank', 'tally_name');
update_table(WHOLE_COL, 'current_tallies', 'tally_name');
update_table(WHOLE_COL, 'site_tally_goals', 'tally_name');
update_table(WHOLE_COL, 'news_items', 'news_page_id');
update_table(WHOLE_COL, 'news_pages', 'news_page_id');
update_table(WHOLE_COL, 'queue_defns', 'round_id');
// --------------------------------------------
update_table(PART_OF_COL, 'job_logs', 'comments');
update_table(PART_OF_COL, 'user_filters', 'filtertype');
update_table(PART_OF_COL, 'usersettings', 'setting');
update_table(PART_OF_COL, 'project_state_stats', 'state');
update_table(PART_OF_COL, 'projects', 'state');
update_table(PART_OF_COL, 'project_pages', 'state', TRUE);
$project_res = mysql_query("\n    SELECT projectid\n    FROM projects\n    ORDER BY projectid\n") or die(mysql_error());
while (list($projectid) = mysql_fetch_row($project_res)) {
    update_table(PART_OF_COL, $projectid, 'state', TRUE);
}
// ---------------------------------------------------------
if (count($already_appears) > 0) {
    echo "\nThe following cases were skipped because '{$dst_round_id}' was\nfound in the column.  This may just be because you've already\nrun this script, and these cases have already been handled.\nBut if not, you should determine whether the pre-existing\noccurrence(s) of '{$dst_round_id}' will cause an ambiguity\nif/when the occurences of '{$src_round_id}' are changed.\n";
    foreach ($already_appears as $case) {
        echo "    {$case}\n";
    }
}
echo "\nDone!\n";
// vim: sw=4 ts=4 expandtab
Exemple #23
0
function msql_modifs($defs, $defsb, $folder, $pre, $node, $basename, $modif)
{
    switch ($modif) {
        case 'restore':
            $defs = read_vars($folder, $node . '_sav', $defsb);
            break;
        case 'import_old':
            $defs = ${$table};
            break;
        case 'del_menus':
            unset($defs['_menus_']);
            break;
        case 'del_file':
            save_vars($folder, $node . '_sav', $defs);
            unlink($basename . '.php');
            relod('/' . $folder . $pre);
            break;
        case 'del_table':
            $r["_menus_"] = $defs["_menus_"];
            $defs = $r;
            break;
            //auto
        //auto
        case 'append_update':
            $defs = append_update($defs, $_GET["append_update"]);
            break;
        case 'import_defs':
            $defs = import_defs($defsb, $_GET["import_defs"]);
            break;
        case 'import_keys':
            $defs = import_keys($defs, $_GET["import_keys"]);
            break;
        case 'merge_defs':
            $defs = merge_defs($defs, $_GET["merge_defs"]);
            break;
        case 'permut':
            $defs = permut($defs, $_GET["permut"]);
            break;
        case 'reset_menus':
            $defs = reset_menus($defs);
            break;
        case 'add_col':
            $defs = add_col($defs);
            break;
        case 'del_col':
            $defs = del_col($defs, $_GET["del_col"]);
            break;
        case 'repair_cols':
            $defs = repair_cols($defs);
            break;
        case 'sort':
            $defs = sort_table($defs, $_GET['sort'], 1);
            $_GET['del_file'] = 1;
            break;
        case 'sort_table':
            $defs = sort_table($defs, $_GET['sort_table']);
            break;
        case 'append_values':
            $defs = append_values($defs, $_GET["append_values"]);
            break;
        case 'del_multi':
            $defs = del_multi($defs);
            break;
        case 'reorder':
            $defs = reorder($defs);
            break;
        case 'add_keys':
            $defs = add_keys($defs);
            break;
        case 'del_keys':
            $defs = del_keys($defs);
            break;
            //post
        //post
        case 'import_conn':
            $defs = import_conn($defs, $_POST["import_conn"], $_POST["aid"]);
            break;
        case 'inject_defs':
            $defs = inject_defs($defs, $_POST["inject_defs"]);
            break;
        case 'edit_csv':
            $defs = edit_csv($defs, $_POST["edit_csv"]);
            break;
        case 'update':
            $defs = update_table($node, $defs);
            break;
        case 'repair':
            $defs = repair($defs);
            break;
        case 'newfrom':
            $defs = new_from_defs($defs, $_GET["newfrom"], $folder, $node);
            break;
            //default:msq_filters($defs,$modif); break;
    }
    if (!$_GET["del_file"] && $defs) {
        save_vars($folder, $node, $defs);
    }
    return $defs;
}
    $existing_column_names = dpsql_fetch_all_keyed($res);
    echo "{$table_name}: ";
    mysql_query("\n\t\tUPDATE {$table_name}\n\t\tSET state={$case}\n\t") or die(mysql_error());
    echo "State field changed on " . mysql_affected_rows(), " rows. ";
    $n_columns_to_add = 0;
    $adds_sql = "";
    for ($rn = 1; $rn <= MAX_NUM_PAGE_EDITING_ROUNDS; $rn++) {
        $round = get_Round_for_round_number($rn);
        if (!array_key_exists($round->time_column_name, $existing_column_names)) {
            $n_columns_to_add += 3;
            if ($adds_sql) {
                $adds_sql .= ',';
            }
            $adds_sql .= "\n\t\t\t\tADD COLUMN {$round->time_column_name} int(20)     NOT NULL default '0',\n\t\t\t\tADD COLUMN {$round->user_column_name} varchar(25) NOT NULL default '',\n\t\t\t\tADD COLUMN {$round->text_column_name} longtext    NOT NULL\n\t\t\t";
        }
    }
    if ($n_columns_to_add > 0) {
        // echo $adds_sql, "\n";
        mysql_query("\n\t\t\tALTER TABLE {$table_name}\n\t\t\t{$adds_sql}\n\t\t") or die(mysql_error());
    }
    echo "Added {$n_columns_to_add} columns.";
    echo "\n";
}
// --------------------------------------------
$project_res = mysql_query("\n\tSELECT projectid\n\tFROM projects\n") or die(mysql_error());
while (list($projectid) = mysql_fetch_row($project_res)) {
    update_table($projectid);
}
// project_pages too
update_table('project_pages');
echo "\nDone!\n";
Exemple #25
0
 public function update($cachename)
 {
     global $_G;
     $sys = true;
     //$syn = false,代表不写入缓存,每次都读取
     if (strpos($cachename, '_cate') !== false) {
         $tmp = explode('_', $cachename);
         $cate = new cate($tmp[0], $tmp[0]);
         $cache_data = $cate->get_cate();
         $this->set($cachename, $cache_data, true, 1);
         return $cache_data;
     }
     switch ($cachename) {
         case 'all_channel':
             $all_channel = DB::fetch_all("SELECT * FROM " . DB::table('channel') . " ORDER BY `sort` DESC,fid ASC ", 'fid');
             $tmp = array();
             foreach ($all_channel as $k => $v) {
                 $v[org_url] = $v[url];
                 $v[url] = '/index.php?fid=' . $v[fid];
                 $tmp['k' . $k] = $v;
             }
             $cache_data = $tmp;
             break;
         case 'channels':
             $all_channel = DB::fetch_all("SELECT * FROM " . DB::table('channel') . " ORDER BY `sort` DESC,fid ASC ", 'fid');
             $channel = array();
             //一级
             foreach ($all_channel as $k => $v) {
                 if ($v[fup] == 0) {
                     //$v[count] = getcount('goods'," AND fid = ".$v[fid]);
                     $v[org_url] = $v[url];
                     $v[url] = '/index.php?fid=' . $v[fid];
                     $channel[$k] = $v;
                 }
             }
             //二级
             $tmps = $all_channel;
             foreach ($channel as $k => $v) {
                 $sub = array();
                 $fid_in = array();
                 unset($tmps[$v[fid]]);
                 foreach ($all_channel as $kk => $vv) {
                     if ($vv['fup'] == $k) {
                         //$vv[count] = getcount('goods'," AND fid = ".$vv[fid]);
                         $vv[org_url] = $vv[url];
                         $vv[url] = '/index.php?fid=' . $vv[fid];
                         $sub[$kk] = $vv;
                         //二级栏目
                         $fid_in2 = array();
                         unset($tmps[$vv[fid]]);
                         foreach ($all_channel as $k3 => $v3) {
                             if ($v3['fup'] == $kk) {
                                 $v3[org_url] = $v3[url];
                                 $v3[url] = '/index.php?fid=' . $v3[fid];
                                 //$v3[count] = getcount('goods'," AND fid = ".$v3[fid]);
                                 unset($tmps[$v3[fid]]);
                                 $sub[$kk]['sub'][$k3] = $v3;
                                 //三级栏目
                                 $fid_in2[] = $v3['fid'];
                                 $fid_in[] = $v3['fid'];
                                 $sub[$kk]['sub'][$k3]['fid_in'] = $v3['fid'];
                             }
                         }
                         $fid_in[] = $vv['fid'];
                         $fid_in2[] = $vv['fid'];
                         $sub[$kk]['fid_in'] = implode(',', $fid_in2);
                     }
                 }
                 $fid_in[] = $v['fid'];
                 $channel[$k]['fid_in'] = implode(',', $fid_in);
                 if ($sub) {
                     $channel[$k]['sub'] = $sub;
                 }
             }
             if (count($tmps) > 0) {
                 foreach ($tmps as $k => $v) {
                     if (!array_key_exists($k)) {
                         $v[fid_in] = $v[fid];
                         $channel[$k] = $v;
                     }
                 }
             }
             $cache_data = $channel;
             break;
         case 'setting':
             set_setting('time', TIMESTAMP);
             $st = DB::fetch_all("SELECT * FROM " . DB::table('setting'));
             foreach ($st as $k => $v) {
                 $setting[$v['name']] = $v['value'];
             }
             if ($setting['qq']) {
                 $setting['qq'] = explode(',', $setting['qq']);
             }
             if ($setting['flag']) {
                 $setting['flag'] = explode(',', $setting['flag']);
                 $setting['flag'] = array_filter($setting['flag']);
             }
             if ($setting['shop_tag']) {
                 $setting['shop_tag'] = explode(',', $setting['shop_tag']);
                 $setting['shop_tag'] = array_filter($setting['shop_tag']);
             }
             if ($setting['goods_tag']) {
                 $setting['goods_tag'] = explode(',', $setting['goods_tag']);
                 $setting['goods_tag'] = array_filter($setting['goods_tag']);
             }
             if ($setting['article_tag']) {
                 $setting['article_tag'] = explode(',', $setting['article_tag']);
                 $setting['article_tag'] = array_filter($setting['article_tag']);
             }
             if ($setting['filter_field']) {
                 $setting['filter_field'] = explode(',', $setting['filter_field']);
             }
             if ($setting['shiyong_status']) {
                 $setting['shiyong_status'] = explode(',', $setting['shiyong_status']);
             }
             if ($setting['duihuan_status']) {
                 $setting['duihuan_status'] = explode(',', $setting['duihuan_status']);
             }
             if ($setting['shiyong_tags']) {
                 $setting['shiyong_tags'] = explode(',', $setting['shiyong_tags']);
             }
             if ($setting['activity_tags']) {
                 $setting['activity_tags'] = explode(',', $setting['activity_tags']);
             }
             if ($setting['style_tags']) {
                 $setting['style_tags'] = explode(',', $setting['style_tags']);
             }
             if ($setting['movie_tags']) {
                 $setting['movie_tags'] = explode(',', $setting['movie_tags']);
             }
             if ($setting['zj_tags']) {
                 $setting['zj_tags'] = explode(',', $setting['zj_tags']);
             }
             if ($setting['shishang_flag']) {
                 $setting['shishang_flag'] = explode(',', $setting['shishang_flag']);
             }
             if ($setting['tags']) {
                 $setting['tags'] = explode(',', $setting['tags']);
                 $tags = array();
                 foreach ($setting['tags'] as $k => $v) {
                     $uname = urlencode_utf8($v);
                     $tags[$uname] = $v;
                 }
                 $setting['tags'] = $tags;
             }
             if ($setting['sign_jf']) {
                 $setting['sign_jf'] = (array) dunserialize($setting['sign_jf']);
             }
             if ($setting['sign_tb']) {
                 $setting['sign_tb'] = (array) dunserialize($setting['sign_tb']);
             }
             if ($setting['syn_table']) {
                 $setting['syn_table'] = explode(',', $setting['syn_table']);
             }
             if ($setting['syn_domain']) {
                 $setting['syn_domain'] = explode("\r\n", $setting['syn_domain']);
             }
             if ($setting['uz_tag']) {
                 $setting['uz_tag'] = explode(',', $setting['uz_tag']);
             }
             if ($setting['uz_type']) {
                 $setting['uz_type'] = explode(',', $setting['uz_type']);
             }
             $setting['time'] = TIMESTAMP;
             if ($setting['email']) {
                 $setting['email'] = (array) dunserialize($setting['email']);
             }
             $cache_data = $setting;
             break;
         case 'friend_link':
             //友情链接
             $friend_link = DB::fetch_all("SELECT * FROM " . DB::table('friend_link') . " ORDER BY sort DESC,id DESC", 'id');
             foreach ($friend_link as $k => $v) {
                 $friend_link[$k]['dateline'] = dgmdate($v['dateline'], 'u');
             }
             $cache_data = $friend_link;
             break;
         case 'pics_type':
             $cache_data = DB::fetch_all("SELECT * FROM " . DB::table('pics_type') . " ORDER BY id DESC", 'id');
             break;
         case 'pics':
             $pics_type = DB::fetch_all("SELECT * FROM " . DB::table('pics_type') . " ORDER BY id DESC", 'id');
             $pics_tmp = DB::fetch_all("SELECT * FROM " . DB::table('pics') . " ORDER BY sort ASC,id DESC ", 'id');
             $pics = array();
             foreach ($pics_type as $k => $v) {
                 $pics[$k] = array();
                 foreach ($pics_tmp as $k1 => $v1) {
                     $v1['org_dateline'] = $v1['dateline'];
                     $v1['dateline'] = dgmdate($v1['dateline'], 'u');
                     if ($v1['fup'] == $k) {
                         $pics[$k][$k1] = $v1;
                     }
                 }
             }
             $cache_data = set_key($pics);
             break;
         case 'ad':
             $ad = DB::fetch_all("SELECT * FROM " . DB::table('ad') . " ORDER BY id DESC ", 'id');
             foreach ($ad as $k => $v) {
                 $ad[$k]['org_dateline'] = $v[dateline];
                 $ad[$k]['dateline'] = dgmdate($v[dateline], 'u');
                 $ad[$k]['start_time'] = dgmdate($v[start_time], 'dt');
                 $ad[$k]['end_time'] = dgmdate($v[end_time], 'dt');
                 $ad[$k]['show'] = false;
                 $ad[$k]['show_html'] = '';
                 //先判断是否在显示时间内
                 $show = 0;
                 if ($v['start_time'] < TIMESTAMP && ($v['end_time'] == 0 || $v['end_time'] > TIMESTAMP)) {
                     $show = 1;
                 }
                 if ($show == true && $v['hide'] == 0) {
                     $html = '';
                     if ($v['type'] == 1) {
                         $html = $v['content'];
                     } elseif ($v['type'] == 2) {
                         $width = $v['width'] > 0 ? "width='" . $v['width'] . "'" : '';
                         $height = $v['height'] > 0 ? "height='" . $v['height'] . "'" : '';
                         $img = "<img class='ads_" . $k . "' src='" . $v['picurl'] . "' " . $width . "" . $height . " />";
                         if ($v['url']) {
                             $target = $v['target'] == 1 ? "target='_blank'" : '';
                             $html = "<a href='" . $v['url'] . "' " . $target . " >" . $img . "</a>";
                         } else {
                             $html = $img;
                         }
                     } else {
                         $html = $v['html'];
                     }
                     if (!empty($html)) {
                         $ad[$k]['show'] = true;
                         $ad[$k]['show_html'] = $html;
                     } else {
                         $ad[$k]['show_html'] = '';
                     }
                 }
             }
             $cache_data = set_key($ad);
             break;
         case 'goods_cate':
             $cate = new cate('goods', 'goods');
             $cache_data = $cate->get_cate();
             break;
         case 'shop':
             $shop = DB::fetch_all("SELECT * FROM " . DB::table('shop') . " ORDER BY sort DESC,id DESC", 'id');
             foreach ($shop as $k => $v) {
                 $shop[$k] = parse('shop', $v);
             }
             $cache_data = $shop;
             break;
         case 'shop_cate':
             $cate = new cate('shop', 'shop');
             $cache_data = $cate->get_cate();
             break;
         case 'prize':
             $rs = DB::fetch_all("SELECT * FROM " . DB::table('prize') . " ORDER BY sort DESC ,id DESC ", 'id');
             foreach ($rs as $k => $v) {
                 //统计每个分类,还未中奖的中奖码..
                 $rs[$k][num] = $rs[$k][count] = getcount('ticket', "prizeid = " . $v[id] . " AND is_use=0");
                 $rs[$k][total] = getcount('ticket', "prizeid = " . $v[id]);
             }
             $cache_data = $rs;
             break;
         case 'table':
             $cache_data = update_table();
             break;
         case 'group':
             $rs = DB::fetch_all("SELECT * FROM " . DB::table('group') . " ORDER BY id ASC", 'id');
             foreach ($rs as $k => $v) {
                 $rs[$k][power] = dunserialize($v['power']);
             }
             $cache_data = $rs;
             break;
         case 'rank':
             $rs = DB::fetch_all("SELECT * FROM " . DB::table('rank') . " ORDER BY id ASC", 'id');
             $cache_data = $rs;
             break;
         default:
             $sys = false;
             $cache_data = '';
             break;
     }
     if ($sys == true) {
         $this->set($cachename, $cache_data, true, 1);
     }
     return $cache_data;
 }
<?php

$con = connect_db();
$data['sp_list'] = serialize($_SESSION['sale_product']);
$data['sp_total'] = $_POST['total'];
$data['sp_income'] = $_POST['income'];
$data['sp_change'] = $_POST['change'];
$data['am_id'] = $_SESSION['am_id'];
//dieArray($_SESSION['sale_product']);
foreach ($_SESSION['sale_product'] as $k => $v) {
    $result = getTable_where('products', 'p_barcode', $v['p_barcode'], $con);
    $r = assoc_get($result);
    $amount['p_amount'] = $r['p_amount'] - $v['p_amount'];
    update_table('products', $amount, 'p_barcode', $v['p_barcode'], $con);
}
insert_table('saleproduct_tb', $data, $con);
unset($_SESSION['sale_product']);
$result_sale = getTable_order('saleproduct_tb', 'sp_id', 'DESC LIMIT 1', $con);
$rs = assoc_get($result_sale);
//echo $rs['sp_id'];
?>
<script>
    var id = <?php 
echo $rs['sp_id'];
?>
;
    js_popup('index.php?module=system_pos&action=receipt&id='+id,783,600);
    function js_popup(theURL,width,height) { //v2.0
	leftpos = (screen.availWidth - width) / 2;
    	toppos = (screen.availHeight - height) / 2;
  	    window.open(theURL, "viewdetails","width=" + width + ",height=" + height + ",left=" + leftpos + ",top=" + toppos);