예제 #1
0
<?php

include 'functions.php';
// In this file we will update the values in the database.
if (!empty($_POST["uid"])) {
    $uid = $_POST['uid'];
    updateValue("Name", $_POST["name"], $uid);
    updateValue("UserID", $_POST["username"], $uid);
    updateValue("Access", $_POST["Access"], $uid);
    updateValue("Phone", $_POST["Phone"], $uid);
    if ($_POST["Access"] == "Deactive") {
        updateValue("Active", "0", $uid);
    } else {
        updateValue("Active", "1", $uid);
    }
}
// Redirect to users.php
header('Location: ./users.php');
// Updates a single value.
function updateValue($valueName, $newValue, $valueID)
{
    // Prevents writting an empty value to the table.
    if (empty($valueName) or empty($newValue) or empty($valueID)) {
        return;
    }
    $conn = connectTODB();
    $sql = "UPDATE Users SET " . $valueName . "='" . $newValue . "' WHERE UID=" . $valueID;
    if ($conn->query($sql) === TRUE) {
        echo $valueName . "updated successfully";
    } else {
        echo "Error updating record: " . $conn->error . "<br>";
예제 #2
0
include 'functions.php';
// In this file we will update the values in the database.
if (!empty($_POST["vid"])) {
    $vid = $_POST['vid'];
    updateValue("VendorName", $_POST["venderName"], $vid);
    updateValue("Address", $_POST["address"], $vid);
    updateValue("City", $_POST["city"], $vid);
    updateValue("State", $_POST["state"], $vid);
    updateValue("Country", $_POST["country"], $vid);
    updateValue("Zip", $_POST["zip"], $vid);
    updateValue("UCRAccount", $_POST["UCRAccID"], $vid);
    updateValue("POC", $_POST["contact"], $vid);
    updateValue("Phone", $_POST["phone"], $vid);
    updateValue("Fax", $_POST["fax"], $vid);
    updateValue("Website", $_POST["website"], $vid);
}
// Redirect to venders.php
header('Location: ./vender.php');
// Updates a single value.
function updateValue($valueName, $newValue, $valueID)
{
    // Prevents writting an empty value to the table.
    if (empty($valueName) or empty($newValue) or empty($valueID)) {
        return;
    }
    $conn = connectTODB();
    $sql = "UPDATE ListOfVendors SET " . $valueName . "='" . $newValue . "' WHERE VID=" . $valueID;
    if ($conn->query($sql) === TRUE) {
        echo $valueName . "updated successfully";
    } else {
예제 #3
0
function change_docx($file, $docname, $leadData)
{
    //	$dir = getcwd();
    //	echo $dir, "\n";
    //	echo $docname, "\n";
    //file_put_contents("file.txt", "1");
    // making a temp directory
    if (!is_dir("temp")) {
        mkdir("temp");
    } else {
        recursive_remove_directory("temp", true);
    }
    file_put_contents("file.txt", "2");
    //add for test
    //safeify the directory
    //$edir = escapeshellarg($dir);
    //unzip everything
    //system("unzip $file -d temp");
    shell_exec("unzip {$file} -d temp");
    // replace the tokens
    $c = file_get_contents("temp/word/document.xml");
    $strres = updateValue($c, $leadData);
    unlink("temp/word/document.xml");
    unlink("file.txt");
    //@file_put_contents("temp/word/document1.xml",$c);
    @file_put_contents("temp/word/document.xml", $strres);
    // rezip
    if (is_file($docname)) {
        unlink($docname);
    }
    //выжные параметры для упаковки zip -> docx
    $toZip = array("_rels", "docProps", "word", "[Content_Types].xml", "customXml");
    $cmd = "cd temp && zip -r ../files/{$docname} " . implode(" ", $toZip);
    shell_exec($cmd);
    //$fdocxname = "/files/$docname";
    //rename($fdocxname,$fdocxname.'.docx');
    //system($cmd);
}
예제 #4
0
파일: user.php 프로젝트: yang7hua/hunshe
 $data = array();
 foreach ($user_list as &$value) {
     if (empty($value['email'])) {
         $value['email'] = 'ts_' . $value['uid'] . '@thinksns.com';
     }
     $salt = rand(11111, 99999);
     $salt = mysql_escape_string($salt);
     $password = md5($value['password'] . $salt);
     $password = mysql_escape_string($password);
     $sex = $value['sex'] == 1 ? 1 : 2;
     $sex = mysql_escape_string($sex);
     $first_letter = getFirstLetter($value['uname']);
     $first_letter = mysql_escape_string($first_letter);
     $search_key = $value['uname'] . ' ' . $Py->Pinyin($value['uname']);
     $search_key = mysql_escape_string($search_key);
     $value = updateValue($value);
     $data[] = "('" . $value['uid'] . "','" . $value['email'] . "','" . $password . "','" . $salt . "','" . $value['uname'] . "','" . $value['email'] . "','" . $sex . "','" . $value['location'] . "','1','" . $value['is_active'] . "','" . $value['is_init'] . "','" . $value['ctime'] . "','1',null,'" . $value['domain'] . "','" . $value['province'] . "','" . $value['city'] . "','0', '127.0.0.1', 'zh-cn', 'PRC', '0', '" . $first_letter . "', '', null, null, '0', '" . $search_key . "', null, 0, 0)";
     // 添加用户组信息 - todo
     $user_group_link_sql = 'SELECT * FROM `' . $old_db_conf['DB_PREFIX'] . 'user_group_link` WHERE `uid` = ' . $value['uid'] . ' LIMIT 1';
     $user_group_info = $old_db->query($user_group_link_sql);
     // 获取管理用户组
     $admin_group_sql = 'SELECT p.* FROM `' . $old_db_conf['DB_PREFIX'] . 'user_group_popedom` AS p LEFT JOIN `' . $old_db_conf['DB_PREFIX'] . 'node` AS n ON p.`node_id` = n.`node_id` WHERE n.`app_name` = \'admin\' AND n.`mod_name` = \'*\' AND n.`act_name` = \'*\'';
     $admin_group_info = $old_db->query($admin_group_sql);
     if (empty($user_group_info) || $user_group_info[0]['user_group_id'] != $admin_group_info[0]['user_group_id']) {
         $user_group_data[] = "(null, '" . $value['uid'] . "', '3')";
     } else {
         if ($user_group_info[0]['user_group_id'] == $admin_group_info[0]['user_group_id']) {
             $user_group_data[] = "('" . $user_group_info[0]['id'] . "', '" . $user_group_info[0]['uid'] . "', '1')";
         }
     }
 }
예제 #5
0
         // failed to update the value
         if (!updateValue($voteid, "votepoints", $votepoints, $server)) {
             $errorMessage = sprintf(Flux::message("FailedToUpdate"), "Vote Points");
         } else {
             $hasUpdate = TRUE;
         }
     }
 }
 // imageurl value has changed
 if (is_null($errorMessage) && isChanged($voteid, "imgurl", $imageurl, $server) && $imageurl !== "") {
     // imageurl is not a valid url
     if (!filter_var($imageurl, FILTER_VALIDATE_URL)) {
         $errorMessage = sprintf(Flux::message("InvalidURL"), 'Image URL');
     } else {
         // failed to update the value
         if (!updateValue($voteid, "imgurl", $imageurl, $server)) {
             $errorMessage = sprintf(Flux::message("FailedToUpdate"), "Image URL");
         } else {
             $hasUpdate = TRUE;
         }
     }
 }
 // updating imagename
 if (is_null($errorMessage) && $imageurl === "" && $uploadimg['error'] === 0) {
     $ext = explode(".", $uploadimg['name']);
     $ext = end($ext);
     // invalid image type
     if (!preg_match("/image\\//", $uploadimg['type']) && !in_array(str_replace("image/", "", $uploadimg['type']), $imgtypes) && !in_array($ext, $imgtypes)) {
         $errorMessage = Flux::message("InvalidImageType");
     } else {
         // invalid file size
예제 #6
0
include 'functions.php';
// In this file we will update the values in the database.
if (!empty($_POST["fid"])) {
    $fid = $_POST['fid'];
    updateValue("FundName", $_POST["fundName"], $fid);
    updateValue("Activity", $_POST["activity"], $fid);
    updateValue("Fund", $_POST["fund"], $fid);
    updateValue("Function", $_POST["function"], $fid);
    updateValue("CostCenter", $_POST["costCenter"], $fid);
    updateValue("ProjectCode", $_POST["projectCode"], $fid);
    updateValue("Balance", $_POST["balance"], $fid);
    updateValue("Users", $_POST["users"], $fid);
    updateValue("Active", $_POST["active"], $fid);
    // Update the date on the fund, because the balance has been updated.
    updateValue("BalanceAsOf", date("m/d/y"), $fid);
}
// Redirect to funds.php
header('Location: ./funds.php');
// Updates a single value.
function updateValue($valueName, $newValue, $valueID)
{
    // Prevents writting an empty value to the table.
    if (empty($valueName) or empty($newValue) or empty($valueID)) {
        return;
    }
    $conn = connectTODB();
    $sql = "UPDATE ListOfFunds SET " . $valueName . "='" . $newValue . "' WHERE FID=" . $valueID;
    if ($conn->query($sql) === TRUE) {
        echo $valueName . "updated successfully";
    } else {
예제 #7
0
 * It is also available through the world-wide-web at this URL:
 * http://ecommerce.aheadworks.com/AW-LICENSE.txt
 *
 * =================================================================
 *                 MAGENTO EDITION USAGE NOTICE
 * =================================================================
 * This software is designed to work with Magento community edition and
 * its use on an edition other than specified is prohibited. aheadWorks does not
 * provide extension support in case of incorrect edition use.
 * =================================================================
 *
 * @category   AW
 * @package    AW_Mobile
 * @version    1.6.7
 * @copyright  Copyright (c) 2010-2012 aheadWorks Co. (http://www.aheadworks.com)
 * @license    http://ecommerce.aheadworks.com/AW-LICENSE.txt
 */
function updateValue(Mage_Eav_Model_Entity_Setup $setup, $entityTypeId, $code, $key, $value)
{
    $id = $setup->getAttribute($entityTypeId, $code, 'attribute_id');
    $setup->updateAttribute($entityTypeId, $id, $key, $value);
}
$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->removeAttribute('catalog_product', 'mobile_description');
$setup->addAttribute('catalog_product', 'mobile_description', array('type' => 'text', 'backend' => '', 'frontend' => '', 'label' => 'Mobile Description', 'input' => 'textarea', 'class' => '', 'source' => '', 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 'visible' => true, 'group' => 'Mobile Options', 'required' => false, 'user_defined' => false, 'default' => '', 'searchable' => true, 'filterable' => false, 'comparable' => false, 'is_wysiwyg_enabled' => true, 'is_html_allowed_on_front' => true, 'visible_on_front' => false, 'visible_in_advanced_search' => false, 'unique' => false));
updateValue($setup, 'catalog_product', 'mobile_description', 'is_global', 0);
updateValue($setup, 'catalog_product', 'mobile_description', 'is_wysiwyg_enabled', true);
updateValue($setup, 'catalog_product', 'mobile_description', 'is_html_allowed_on_front', true);
$installer->endSetup();