当前位置: 首页>>代码示例>>PHP>>正文


PHP DatabaseFactory::passinggreen_db方法代码示例

本文整理汇总了PHP中DatabaseFactory::passinggreen_db方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseFactory::passinggreen_db方法的具体用法?PHP DatabaseFactory::passinggreen_db怎么用?PHP DatabaseFactory::passinggreen_db使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DatabaseFactory的用法示例。


在下文中一共展示了DatabaseFactory::passinggreen_db方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: db

 protected function db()
 {
     return DatabaseFactory::passinggreen_db();
 }
开发者ID:htmlgraphic,项目名称:HTMLgraphic-MVC,代码行数:4,代码来源:BusinessCategory.class.inc.php

示例2: execute

 function execute()
 {
     $return = new stdClass();
     $params = Request::_REQUEST();
     Config::set("HideDebugger", true);
     if (isset($params["id"])) {
         $user = new Member($params["id"]);
         if (isset($user) && $user->isValid()) {
             if ($params["passwd"] != "") {
                 $user->setPassword($params["passwd"]);
             }
             $user->setLevel($params["level"]);
             $user->setIsEnabled($params["is_enabled"]);
             $user->setUserFirstname($params["userFirstname"]);
             $user->setUserLastname($params["userLastname"]);
             $user->setUserEmail($params["useremail"]);
             $user->setUserBio($params["userBio"]);
             $user->setWeb($params["web"]);
             $user->setUserCompany($params["userCompany"]);
             $user->setUserCompanyType($params["userCompanyType"]);
             $user->setUserAddr1($params["userAddr1"]);
             $user->setUserAddr2($params["userAddr2"]);
             $user->setUserCity($params["userCity"]);
             $user->setUserState($params["userState"]);
             $user->setUserCountry($params["userCountry"]);
             $user->setUserZip($params["userZip"]);
             $user->setUserPhone($params["userPhone"]);
             $user->setUserAltPhone($params["userAltPhone"]);
             $user->setUserFax($params["userFax"]);
             $user->setSiteAreas($params["siteAreas"]);
             $user->setUpdates($params["updates"]);
             $user->setPaymentType($params["paymentType"]);
             $user->setPaymentTypeDetails($params["paymentTypeDetails"]);
             $user->setShipAddr1($params["shipAddr1"]);
             $user->setShipAddr2($params["shipAddr2"]);
             $user->setShipCity($params["shipCity"]);
             $user->setShipState($params["shipState"]);
             $user->setShipCountry($params["shipCountry"]);
             $user->setShipZip($params["shipZip"]);
             if ($user->save()) {
                 // encrypt any credit card information then set the CC field
                 // check for an existing private key first
                 $existing_privateKey = CryptKey::findCryptKeyByUserID($user->getID());
                 $cc_privateKey = null;
                 if (isset($existing_privateKey) && $existing_privateKey->isValid()) {
                     // retrieve existing key
                     Debugger::log("User crypt private key: " . $existing_privateKey->getKey());
                     $cc_privateKey = $existing_privateKey->getKey();
                 } else {
                     // store key into keys table
                     $user_key = new CryptKey();
                     $user_key->setUserID($user->getID());
                     $user_key->setKey(TwoWayEncryption::genPrivateKey());
                     if ($user_key->save()) {
                         Debugger::log("Saved user crypt private key.");
                         $cc_privateKey = $user_key->getKey();
                     } else {
                         Debugger::log("Saving user crypt private key failed! Refusing to encrypt contents!");
                     }
                 }
                 if (!is_null($cc_privateKey)) {
                     $cc_data = unserialize(TwoWayEncryption::decrypt($user->getCC(), $cc_privateKey));
                     $cc_data = array_merge($cc_data, array("name" => $params["ccc_name"], "ccNum" => $params["ccc_ccNum"], "MM" => $params["ccc_MM"], "YY" => $params["ccc_YY"], "ccCODE" => $params["ccc_ccCode"]));
                     $cc_encrypted_data = TwoWayEncryption::encrypt(serialize($cc_data), $cc_privateKey);
                     $user->setCC($cc_encrypted_data);
                     $user->save();
                 }
                 $return->id = $user->getID();
                 $return->updated = true;
                 echo json_encode($return);
                 return;
             } else {
                 $error = DatabaseFactory::passinggreen_db()->getLastError();
                 $return->error = "could not update Member object because: " . $error;
                 echo json_encode($return);
                 return;
             }
         } else {
             $return->error = "ID is invalid!";
             echo json_encode($return);
             return;
         }
     } else {
         $return->error = "Missing ID!";
         echo json_encode($return);
         return;
     }
 }
开发者ID:htmlgraphic,项目名称:HTMLgraphic-MVC,代码行数:88,代码来源:AdminUserUpdateController.class.inc.php

示例3: execute

 function execute()
 {
     $return = new stdClass();
     $params = Request::_REQUEST();
     Config::set("HideDebugger", true);
     //comment this out to debug
     if (isset($params["id"])) {
         $user = new Member($params["id"]);
         if (isset($user) && $user->isValid()) {
             // retrieve account balance based on transactions
             $user_balance = 0.0;
             $user_commission = 0.0;
             /* $Referral_Join = DBObject::collection("Referral");
                 $Member_Join = DBObject::collection("Member");
                 $Member_Vendor_Join = DBObject::collection("Member");
                 $Transactions = DBObject::collection("Transaction")
                 ->applyJoin("LEFT OUTER", $Referral_Join, array("ReferralID", "AutoID"))
                 ->applyJoin("LEFT OUTER", $Member_Join, array("UserID", "AutoID"))
                 ->applyJoin("LEFT OUTER", $Member_Vendor_Join, array("VendorID", "AutoID"))
                 ->applyUserIDFilter($user->getID());
                 Debugger::log(Var_Dump::display($Transactions->getTransactions(), true));
                */
             $q = "SELECT\n\t\t\t\tt.`amount`,\n\t\t\t\tr.*,\n\t\t\t\tCONCAT(user.`userFirstname`, CONCAT(' ',user.`userLastname`)) as _from,\n\t\t\t\tCONCAT(vendor.`userFirstname`, CONCAT(' ',vendor.`userLastname`)) as _to\n\t\t\tFROM  `transactions` t\n\n\t\t\tLEFT OUTER JOIN `referrals` r\n\t\t\t\tON (t.`ReferralID` = r.`AutoID`)\n\n\t\t\tLEFT OUTER JOIN `user_signup` user\n\t\t\t\tON (r.`UserID` = user.`AutoID`)\n\n\t\t\tLEFT OUTER JOIN `user_signup` vendor\n\t\t\t\tON (r.`VendorID` = vendor.`AutoID`)\n\n\t\t\tWHERE t.`UserID` ='" . $user->getID() . "'";
             $user_transactions = DatabaseFactory::passinggreen_db()->query($q);
             Debugger::log(Var_Dump::display($user_transactions, true));
             while ($user_transactions_row = $user_transactions->fetch_object()) {
                 if ($user_transactions_row->UserID == $user->getID()) {
                     $user_balance += $user_transactions_row->amount;
                     //$referrals_passed[] = $row;
                 } else {
                     if ($user_transactions_row->VendorID == $user->getID()) {
                         $user_commission += $user_transactions_row->amount;
                         //$referrals_received[] = $row;
                     }
                 }
                 #else
                 #echo "PG.com +".$row->amount."<br>";
                 #echo "<pre>".print_r($row, true)."</pre>";
             }
             // referrals
             $user_referrals_passed = DBObject::collection("Referral", DBObject::CONSISTENCY_ABSOLUTE)->applyUserIDFilter($user->getID())->getReferralCount();
             $user_referrals_received = DBObject::collection("Referral", DBObject::CONSISTENCY_ABSOLUTE)->applyVendorIDFilter($user->getID())->getReferralCount();
             Debugger::log("refs passed: {$user_referrals_passed}");
             Debugger::log("refs recvd: {$user_referrals_received}");
             // decrypt cc field if it is not empty
             $user_crypt_key = CryptKey::findCryptKeyByUserID($user->getID());
             if (isset($user_crypt_key) && $user_crypt_key->isValid()) {
                 Debugger::log("User crypt private key: " . $user_crypt_key->getKey());
                 $decoded_cc_data = unserialize(TwoWayEncryption::decrypt($user->getCC(), $user_crypt_key->getKey()));
             } else {
                 $decoded_cc_data = null;
             }
             $return->id = $user->getID();
             // object id
             $return->user = $user->toArray();
             // set the base return, values can be overridden below.
             $return->user["userCompanyType[]"] = $user->getUserCompanyType();
             $return->user["siteAreas[]"] = $user->getSiteAreas();
             $return->user["passwd"] = null;
             $return->user["balance"] = number_format($user_balance, 2);
             if (!is_null($decoded_cc_data)) {
                 $return->user["ccc"] = $decoded_cc_data["details"];
                 $return->user["ccc_status"] = $decoded_cc_data["status"];
                 $return->user["ccc_tcode"] = $decoded_cc_data["tcode"];
                 $return->user["ccc_name"] = $decoded_cc_data["name"];
                 $return->user["ccc_ccNum"] = $decoded_cc_data["ccNum"];
                 $return->user["ccc_MM"] = $decoded_cc_data["MM"];
                 $return->user["ccc_YY"] = $decoded_cc_data["YY"];
                 $return->user["ccc_ccCode"] = $decoded_cc_data["ccCODE"];
             }
             $return->user["referralsPassed"] = $user_referrals_passed;
             $return->user["referralsReceived"] = $user_referrals_received;
             $return->user["accountBalance"] = number_format($user_balance, 2);
             $return->user["commissionDue"] = number_format($user_commission, 2);
             echo json_encode($return);
             return;
         } else {
             $return->error = "ID is invalid.";
             echo json_encode($return);
             return;
         }
     } else {
         $return->error = "Missing ID!";
         echo json_encode($return);
         return;
     }
 }
开发者ID:htmlgraphic,项目名称:HTMLgraphic-MVC,代码行数:87,代码来源:AdminUserGetController.class.inc.php


注:本文中的DatabaseFactory::passinggreen_db方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。