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


PHP SQL::update方法代码示例

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


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

示例1: save

 function save()
 {
     global $objDatabase, $_ARRAYLANG;
     $arrFields = array('title' => $this->title, 'UserRestriction' => $this->surveyType, 'description' => $this->description, 'textAfterButton' => $this->textBeginSurvey, 'text1' => $this->textBeforeSubscriberInfo, 'text2' => $this->textBelowSubmit, 'thanksMSG' => $this->textFeedbackMsg, 'isHomeBox' => (int) $this->isStandred(), 'additional_salutation' => $this->salutation, 'additional_nickname' => $this->nickname, 'additional_forename' => $this->forename, 'additional_surname' => $this->surname, 'additional_agegroup' => $this->agegroup, 'additional_email' => $this->email, 'additional_phone' => $this->phone, 'additional_street' => $this->street, 'additional_zip' => $this->zip, 'additional_city' => $this->city);
     if (empty($this->id)) {
         $query = \SQL::insert('module_survey_surveygroup', $arrFields, array('escape' => true));
     } else {
         $arrFields['updated'] = date("Y-m-d H:i:s");
         $query = \SQL::update('module_survey_surveygroup', $arrFields, array('escape' => true)) . " WHERE `id` = {$this->id}";
     }
     // echo $query;
     if ($objDatabase->Execute($query)) {
         $this->okMsg[] = empty($this->id) ? $_ARRAYLANG['TXT_SURVEY_ADDED_SUC_TXT'] : $_ARRAYLANG['TXT_SURVEY_UPDATE_SUC_TXT'];
         return true;
     } else {
         $this->errorMsg[] = $_ARRAYLANG['TXT_SURVEY_ERROR_IN_SAVING'];
         return true;
     }
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:19,代码来源:SurveyEntry.class.php

示例2: PUT

 public static function PUT($req)
 {
     $table = Common::route($req);
     $sql['table'] = $table;
     $data = Common::where($req, $table);
     if (isset($data['unknown'])) {
         print 'unknown columns: ' . implode(',', $data['unknown']);
     } else {
         if (isset($data['where'])) {
             foreach ($data['where'] as $idx => $val) {
                 if ($idx == 0) {
                     $sql['where'] = $val;
                 } else {
                     $sql['set'][] = str_replace("NULL", "", $val);
                 }
             }
             SQL::update($sql);
         } else {
             print 'invalid request';
         }
     }
 }
开发者ID:skiv71,项目名称:BMSLink-API,代码行数:22,代码来源:methods.php

示例3: update

 /**
  * Update job
  * @global     object    $objDatabase
  * @return    boolean   result
  */
 function update()
 {
     global $objDatabase, $_ARRAYLANG;
     if (empty($_POST['id'])) {
         return true;
     }
     $objFWUser = \FWUser::getFWUserObject();
     $id = intval($_POST['id']);
     $userId = $objFWUser->objUser->getId();
     $changelog = mktime();
     $title = get_magic_quotes_gpc() ? strip_tags($_POST['jobsTitle']) : addslashes(strip_tags($_POST['jobsTitle']));
     $text = get_magic_quotes_gpc() ? $_POST['jobsText'] : addslashes($_POST['jobsText']);
     $title = str_replace("ß", "ss", $title);
     $text = $this->filterBodyTag($text);
     $text = str_replace("ß", "ss", $text);
     $workloc = get_magic_quotes_gpc() ? strip_tags($_POST['workloc']) : addslashes(strip_tags($_POST['workloc']));
     $workload = get_magic_quotes_gpc() ? strip_tags($_POST['workload']) : addslashes(strip_tags($_POST['workload']));
     if (empty($_POST['work_start'])) {
         $work_start = "0000-00-00";
     } else {
         $work_start = $_POST['work_start'];
     }
     //start 'n' end
     $dateparts = explode("-", $work_start);
     $work_start = mktime(00, 00, 00, $dateparts[1], $dateparts[2], $dateparts[0]);
     $catId = intval($_POST['jobsCat']);
     $status = !empty($_POST['status']) ? intval($_POST['status']) : 0;
     $startDate = get_magic_quotes_gpc() ? strip_tags($_POST['startDate']) : addslashes(strip_tags($_POST['startDate']));
     $endDate = get_magic_quotes_gpc() ? strip_tags($_POST['endDate']) : addslashes(strip_tags($_POST['endDate']));
     $author = get_magic_quotes_gpc() ? strip_tags($_POST['author']) : addslashes(strip_tags($_POST['author']));
     $date = $this->_checkDate(date('H:i:s d.m.Y'));
     $dberr = false;
     $locset = '';
     //set of location that is associated with this job in the POST Data
     $locset_indb = '';
     //set of locations that is associated with this job in the db
     $rel_loc_jobs = '';
     //used to generate INSERT Statement
     foreach ($_POST['associated_locations'] as $value) {
         $locset[] = $value;
     }
     $query = "SELECT DISTINCT l.name as name,\n                  l.id as id\n                  FROM `" . DBPREFIX . "module_jobs_location` l\n                  LEFT JOIN `" . DBPREFIX . "module_jobs_rel_loc_jobs` as j on j.location=l.id\n                  WHERE j.job = {$id}";
     //Compare Post data and database
     $objResult = $objDatabase->Execute($query);
     if (!$objResult) {
         $dberr = true;
     }
     while (!$objResult->EOF && !$dberr) {
         if (in_array($objResult->fields['id'], $locset)) {
             $locset_indb[] = $objResult->fields['id'];
         } else {
             $query = "DELETE FROM `" . DBPREFIX . "module_jobs_rel_loc_jobs` WHERE job = " . $id . " AND location = " . $objResult->fields['id'];
             if (!$objDatabase->Execute($query)) {
                 $dberr = true;
             }
         }
         $objResult->MoveNext();
     }
     unset($value);
     if (count($locset) - count($locset_indb) > 0 && !$dberr) {
         foreach ($locset as $value) {
             if (!in_array($value, $locset_indb)) {
                 $rel_loc_jobs .= " ({$id},{$value}),";
             }
         }
         $rel_loc_jobs = substr_replace($rel_loc_jobs, "", -1);
         $query = "INSERT INTO `" . DBPREFIX . "module_jobs_rel_loc_jobs` (job,location) VALUES {$rel_loc_jobs} ";
         if (!$objDatabase->Execute($query)) {
             $dberr = true;
         }
     }
     $query = \SQL::update('module_jobs', array('date' => array('val' => $this->_checkDate($_POST['creation_date']), 'omitEmpty' => true), 'title' => $title, 'author' => $author, 'text' => array('val' => $text, 'omitEmpty' => true), 'workloc' => $workloc, 'workload' => $workload, 'work_start' => array('val' => $work_start, 'omitEmpty' => true), 'catid' => array('val' => $cat, 'omitEmpty' => true), 'lang' => array('val' => $this->langId, 'omitEmpty' => true), 'startdate' => array('val' => $startDate, 'omitEmpty' => true), 'enddate' => array('val' => $endDate, 'omitEmpty' => true), 'status' => array('val' => $status, 'omitEmpty' => true), 'userid' => array('val' => $userid, 'omitEmpty' => true), 'changelog' => array('val' => $date, 'omitEmpty' => true), 'catId' => array('val' => $catId, 'omitEmpty' => true))) . " WHERE id = {$id};";
     if (!$objDatabase->Execute($query) or $dberr) {
         $this->strErrMessage = $_ARRAYLANG['TXT_DATABASE_QUERY_ERROR'];
     } else {
         $this->createRSS();
         $this->strOkMessage = $_ARRAYLANG['TXT_DATA_RECORD_UPDATED_SUCCESSFUL'];
     }
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:84,代码来源:JobsManager.class.php

示例4: modifyCompanySize

 /**
  * update the company size
  * 
  * @global object $objDatabase
  * @global array  $_ARRAYLANG
  * @param  array  $fields  post values
  * 
  * @return null
  */
 function modifyCompanySize($fields)
 {
     global $objDatabase, $_ARRAYLANG;
     $objTpl = $this->_objTpl;
     $objTpl->addBlockfile('CRM_SETTINGS_FILE', 'settings_block', 'module_' . $this->moduleNameLC . '_settings_modify_company_size.html');
     $id = isset($_GET['id']) ? $_GET['id'] : 0;
     //Get the company size
     $this->getCompanySize($id);
     //parse the placeholders
     $this->parseCompanySizePlaceholders();
     if ($_POST['save']) {
         if (!empty($id)) {
             //update
             $query = \SQL::update('module_' . $this->moduleNameLC . '_company_size', $fields, array('escape' => true)) . ' WHERE `id` = ' . $id;
         }
         $objResult = $objDatabase->Execute($query);
         if ($objResult) {
             $_SESSION['strOkMessage'] = $_ARRAYLANG['TXT_CRM_ENTRY_UPDATED_SUCCESS'];
             \Cx\Core\Csrf\Controller\Csrf::header("location:./index.php?cmd=" . $this->moduleName . "&act=settings&tpl=companySize");
             exit;
         } else {
             $_SESSION['strErrMessage'] = $_ARRAYLANG['TXT_CRM_ENTRY_UPDATE_ERROR'];
         }
     }
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:34,代码来源:CrmSettings.class.php

示例5: PSPaymaster

}
$rs = $ST->select("SELECT * FROM sc_pay_system WHERE name='paymaster'");
if ($rs->next() && $_GET) {
    $ps = new PSPaymaster(unserialize($rs->get('config')));
    if ($ps->checkSignature($_POST)) {
        //Данные прошли проверку
        $rs = $ST->select("SELECT * FROM sc_income \r\n\t\t\t\tWHERE \r\n\t\t\t\t\tpay_id=" . intval($_POST['LMI_PAYMENT_NO']) . "\r\n\t\t\t\t\tAND type='paymaster'");
        if ($rs->next()) {
            //перевод уже был, всё ок
            echo 'OK' . $_POST['LMI_PAYMENT_NO'];
            exit;
        } else {
            //если указан номер заявки
            if (isset($_POST['LMI_PAYMENT_NO'])) {
                $rs = $ST->select("SELECT * FROM sc_shop_order WHERE id=" . intval($_POST['LMI_PAYMENT_NO']));
                if ($rs->next()) {
                    if (floatval($_POST['LMI_PAYMENT_AMOUNT']) == $rs->getFloat('total_price')) {
                        $ST->update('sc_shop_order', array('pay_time' => date('Y-m-d H:i:s'), 'pay_status' => '1'), 'id=' . intval($_POST['LMI_PAYMENT_NO']));
                        //Оплата заказа
                        $ST->insert('sc_income', array('userid' => $rs->getInt('userid'), 'sum' => floatval($_POST['LMI_PAYMENT_AMOUNT']), 'type' => 'paymaster', 'description' => "Оплата заказа {$_POST['LMI_PAYMENT_NO']}", 'pay_id' => intval($_POST['LMI_PAYMENT_NO']), 'pay_string' => http_build_query($_POST)));
                        /*Уведомление*/
                        $mail = new Mail();
                        $mail->sendTemplateMail($CONFIG['MAIL'], 'notice_admin_user_buy', $rs->getRow());
                        //							$mail->sendTemplateMail($user['mail'],'notice_user_buy',$rs->getRow());
                    }
                }
            }
            echo 'OK' . $_POST['LMI_PAYMENT_NO'];
        }
    }
}
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:31,代码来源:result.php

示例6: update

 public function update($data, $fields = false)
 {
     if (empty($data)) {
         return false;
     }
     $this->adjustDataAndFields($data, $fields);
     return parent::update($data, $fields);
 }
开发者ID:evgeny-v-z,项目名称:framework,代码行数:8,代码来源:TableDataGateway.php

示例7: SQL

<?php

if ($_GET['url'] && $_GET['r'] && $_GET['k'] && $_GET['p']) {
    include_once "config.php";
    include 'session.php';
    include_once "core/function.php";
    $ST = new SQL();
    $ST->connect(DB_HOST, DB_LOGIN, DB_PASSWORD, DB_BASE);
    if ($_GET['k'] == md5(session_id() . $_GET['r'] . $_GET['url'])) {
        $ST->update('sc_advertising', array('click=click+1'), "id=" . intval($_GET['p']));
    }
    header('Location: ' . $_GET['url']);
}
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:13,代码来源:redirect.php

示例8: dirname

if (date('Y-m-d', strtotime($last_start)) == date('Y-m-d')) {
    exit;
}
ini_set('log_errors', 'On');
ini_set('error_log', dirname(__FILE__) . '/php_errors_bonus.log');
include dirname(__FILE__) . "/../../config.php";
include dirname(__FILE__) . "/../../core/function.php";
set_time_limit(1000);
include_once dirname(__FILE__) . "/../../core/lib/SQL.class.php";
include_once dirname(__FILE__) . "/../../modules/shop/ShopBonus.class.php";
$ST = new SQL(DB_HOST, DB_LOGIN, DB_PASSWORD, DB_BASE);
$r = $ST->select("SELECT UPPER(name) AS name,value FROM sc_config ");
while ($r->next()) {
    if ($r->get('value')) {
        $CONFIG[$r->get('name')] = $r->get('value');
    }
}
$q = "SELECT * FROM sc_shop_order WHERE userid>0 AND order_status=3 AND stop_time BETWEEN '" . date('Y-m-d', strtotime('-1 day')) . "' AND '" . date('Y-m-d') . "'";
$rs = $ST->select($q);
while ($rs->next()) {
    $percent = ShopBonus::getBonusPercent($rs->getInt('userid'));
    $bonus = round($rs->getInt('price') / 20) * 20 / 100 * $percent * 10;
    $rs1 = $ST->select("SELECT * FROM sc_users WHERE u_id={$rs->getInt('userid')}");
    if ($rs1->next()) {
        $inc = array('userid' => $rs->getInt('userid'), 'sum' => $bonus, 'balance' => $bonus + $rs1->getInt('bonus'), 'type' => 'bonus', 'description' => 'Начисление бонуса', 'time' => date('Y-m-d H:i:s'));
        $ST->insert('sc_income', $inc);
        $ST->update('sc_users', array('bonus' => $bonus + $rs1->getInt('bonus')), "u_id={$rs->getInt('userid')}");
    }
}
file_put_contents(dirname(__FILE__) . '/bonus_last_start_log.txt', date('Y-m-d H:i:s') . "\n", FILE_APPEND);
file_put_contents(dirname(__FILE__) . '/bonus_last_start.txt', date('Y-m-d H:i:s'));
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:31,代码来源:bonus.php

示例9: delete

 /**
  * 删除记录
  *
  * @param string $table
  * @param array $where
  * @return int
  */
 public static function delete($table, $where)
 {
     if (!is_array($where) && count($where) > 0) {
         return false;
     }
     $table = SQL::escape($table);
     $where = SQL::_parseWhere($where);
     $sql = "DELETE FROM `{$table}` WHERE {$where}";
     return SQL::update($sql);
 }
开发者ID:AutumnsWindsGoodBye,项目名称:leiphp,代码行数:17,代码来源:leiphp.php

示例10: save


//.........这里部分代码省略.........
         }
     }
     $access = isset($data['access']) ? intval($data['access']) : 0;
     $priority = isset($data['priority']) ? intval($data['priority']) : 0;
     $placeMediadir = isset($data['placeMediadir']) ? intval($data['placeMediadir']) : 0;
     $hostMediadir = isset($data['hostMediadir']) ? intval($data['hostMediadir']) : 0;
     $price = isset($data['price']) ? contrexx_addslashes(contrexx_strip_tags($data['price'])) : 0;
     $link = isset($data['link']) ? contrexx_addslashes(contrexx_strip_tags($data['link'])) : '';
     $pic = isset($data['picture']) ? contrexx_addslashes(contrexx_strip_tags($data['picture'])) : '';
     $attach = isset($data['attachment']) ? contrexx_addslashes(contrexx_strip_tags($data['attachment'])) : '';
     $catId = isset($data['category']) ? intval($data['category']) : '';
     $showIn = isset($data['showIn']) ? contrexx_addslashes(contrexx_strip_tags(join(",", $data['showIn']))) : '';
     $invited_groups = isset($data['selectedGroups']) ? join(',', $data['selectedGroups']) : '';
     $invited_mails = isset($data['invitedMails']) ? contrexx_addslashes(contrexx_strip_tags($data['invitedMails'])) : '';
     $send_invitation = isset($data['sendInvitation']) ? intval($data['sendInvitation']) : 0;
     $invitationTemplate = isset($data['invitationEmailTemplate']) ? contrexx_input2db($data['invitationEmailTemplate']) : 0;
     $registration = isset($data['registration']) ? intval($data['registration']) : 0;
     $registration_form = isset($data['registrationForm']) ? intval($data['registrationForm']) : 0;
     $registration_num = isset($data['numSubscriber']) ? intval($data['numSubscriber']) : 0;
     $registration_notification = isset($data['notificationTo']) ? contrexx_addslashes(contrexx_strip_tags($data['notificationTo'])) : '';
     $email_template = isset($data['emailTemplate']) ? contrexx_input2db($data['emailTemplate']) : 0;
     $ticket_sales = isset($data['ticketSales']) ? intval($data['ticketSales']) : 0;
     $num_seating = isset($data['numSeating']) ? json_encode(explode(',', $data['numSeating'])) : '';
     $related_hosts = isset($data['selectedHosts']) ? $data['selectedHosts'] : '';
     $locationType = isset($data['eventLocationType']) ? (int) $data['eventLocationType'] : $this->arrSettings['placeData'];
     $hostType = isset($data['eventHostType']) ? (int) $data['eventHostType'] : $this->arrSettings['placeDataHost'];
     $place = isset($data['place']) ? contrexx_input2db(contrexx_strip_tags($data['place'])) : '';
     $street = isset($data['street']) ? contrexx_input2db(contrexx_strip_tags($data['street'])) : '';
     $zip = isset($data['zip']) ? contrexx_input2db(contrexx_strip_tags($data['zip'])) : '';
     $city = isset($data['city']) ? contrexx_input2db(contrexx_strip_tags($data['city'])) : '';
     $country = isset($data['country']) ? contrexx_input2db(contrexx_strip_tags($data['country'])) : '';
     $placeLink = isset($data['placeLink']) ? contrexx_input2db($data['placeLink']) : '';
     $placeMap = isset($data['placeMap']) ? contrexx_input2db($data['placeMap']) : '';
     $update_invitation_sent = $send_invitation == 1;
     if (!empty($placeLink)) {
         if (!preg_match('%^(?:ftp|http|https):\\/\\/%', $placeLink)) {
             $placeLink = "http://" . $placeLink;
         }
     }
     if ($objInit->mode == 'frontend') {
         $unique_id = intval($_REQUEST[self::MAP_FIELD_KEY]);
         if (!empty($unique_id)) {
             $picture = $this->_handleUpload('mapUpload', $unique_id);
             if (!empty($picture)) {
                 $placeMap = $picture;
             }
         }
     }
     $orgName = isset($data['organizerName']) ? contrexx_input2db($data['organizerName']) : '';
     $orgStreet = isset($data['organizerStreet']) ? contrexx_input2db($data['organizerStreet']) : '';
     $orgZip = isset($data['organizerZip']) ? contrexx_input2db($data['organizerZip']) : '';
     $orgCity = isset($data['organizerCity']) ? contrexx_input2db($data['organizerCity']) : '';
     $orgCountry = isset($data['organizerCountry']) ? contrexx_input2db($data['organizerCountry']) : '';
     $orgLink = isset($data['organizerLink']) ? contrexx_input2db($data['organizerLink']) : '';
     $orgEmail = isset($data['organizerEmail']) ? contrexx_input2db($data['organizerEmail']) : '';
     if (!empty($orgLink)) {
         if (!preg_match('%^(?:ftp|http|https):\\/\\/%', $orgLink)) {
             $orgLink = "http://" . $orgLink;
         }
     }
     // create thumb if not exists
     if (!file_exists(\Env::get('cx')->getWebsitePath() . "{$placeMap}.thumb")) {
         $objImage = new \ImageManager();
         $objImage->_createThumb(dirname(\Env::get('cx')->getWebsitePath() . "{$placeMap}") . "/", '', basename($placeMap), 180);
     }
     //frontend picture upload & thumbnail creation
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:67,代码来源:CalendarEvent.class.php

示例11: _modifyTask

 /**
  * add /edit task
  *
  * @global array $_ARRAYLANG
  * @global object $objDatabase
  * @return true
  */
 public function _modifyTask()
 {
     global $_ARRAYLANG, $objDatabase, $objJs, $objFWUser;
     \JS::registerCSS("modules/Crm/View/Style/contact.css");
     if (gettype($objFWUser) === 'NULL') {
         $objFWUser = \FWUser::getFWUserObject();
     }
     $objtpl = $this->_objTpl;
     $_SESSION['pageTitle'] = empty($_GET['id']) ? $_ARRAYLANG['TXT_CRM_ADDTASK'] : $_ARRAYLANG['TXT_CRM_EDITTASK'];
     $this->_objTpl->loadTemplateFile('module_' . $this->moduleNameLC . '_addtasks.html');
     $objtpl->setGlobalVariable("MODULE_NAME", $this->moduleName);
     $settings = $this->getSettings();
     $id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : '';
     $date = date('Y-m-d H:i:s');
     $title = isset($_POST['taskTitle']) ? contrexx_input2raw($_POST['taskTitle']) : '';
     $type = isset($_POST['taskType']) ? (int) $_POST['taskType'] : 0;
     $customer = isset($_REQUEST['customerId']) ? (int) $_REQUEST['customerId'] : '';
     $duedate = isset($_POST['date']) ? $_POST['date'] : $date;
     $assignedto = isset($_POST['assignedto']) ? intval($_POST['assignedto']) : 0;
     $description = isset($_POST['description']) ? contrexx_input2raw($_POST['description']) : '';
     $notify = isset($_POST['notify']);
     $taskId = isset($_REQUEST['searchType']) ? intval($_REQUEST['searchType']) : 0;
     $taskTitle = isset($_REQUEST['searchTitle']) ? contrexx_input2raw($_REQUEST['searchTitle']) : '';
     $redirect = isset($_REQUEST['redirect']) ? $_REQUEST['redirect'] : base64_encode('&act=task');
     // check permission
     if (!empty($id)) {
         $objResult = $objDatabase->Execute("SELECT `added_by`,\n                                                       `assigned_to`\n                                                    FROM `" . DBPREFIX . "module_{$this->moduleNameLC}_task`\n                                                 WHERE `id` = '{$id}'\n                                               ");
         $added_user = (int) $objResult->fields['added_by'];
         $assigned_user = (int) $objResult->fields['assigned_to'];
         if ($objResult) {
             list($task_edit_permission) = $this->getTaskPermission($added_user, $assigned_user);
             if (!$task_edit_permission) {
                 \Permission::noAccess();
             }
         }
     }
     if (isset($_POST['addtask'])) {
         if (!empty($id)) {
             if ($objFWUser->objUser->getAdminStatus() || $added_user == $objFWUser->objUser->getId() || $assigned_user == $assignedto) {
                 $fields = array('task_title' => $title, 'task_type_id' => $type, 'customer_id' => $customer, 'due_date' => $duedate, 'assigned_to' => $assignedto, 'description' => $description);
                 $query = \SQL::update("module_{$this->moduleNameLC}_task", $fields, array('escape' => true)) . " WHERE `id` = {$id}";
                 $_SESSION['strOkMessage'] = $_ARRAYLANG['TXT_CRM_TASK_UPDATE_MESSAGE'];
             } else {
                 $_SESSION['strErrMessage'] = $_ARRAYLANG['TXT_CRM_TASK_RESPONSIBLE_ERR'];
             }
         } else {
             $addedDate = date('Y-m-d H:i:s');
             $fields = array('task_title' => $title, 'task_type_id' => $type, 'customer_id' => $customer, 'due_date' => $duedate, 'assigned_to' => $assignedto, 'added_by' => $objFWUser->objUser->getId(), 'added_date_time' => $addedDate, 'task_status' => '0', 'description' => $description);
             $query = \SQL::insert("module_{$this->moduleNameLC}_task", $fields, array('escape' => true));
             $_SESSION['strOkMessage'] = $_ARRAYLANG['TXT_CRM_TASK_OK_MESSAGE'];
         }
         $db = $objDatabase->Execute($query);
         if ($db) {
             if ($notify) {
                 $cx = \Cx\Core\Core\Controller\Cx::instanciate();
                 $id = !empty($id) ? $id : $objDatabase->INSERT_ID();
                 $info['substitution'] = array('CRM_ASSIGNED_USER_NAME' => contrexx_raw2xhtml(\FWUser::getParsedUserTitle($assignedto)), 'CRM_ASSIGNED_USER_EMAIL' => $objFWUser->objUser->getUser($assignedto)->getEmail(), 'CRM_DOMAIN' => ASCMS_PROTOCOL . "://{$_SERVER['HTTP_HOST']}" . $cx->getCodeBaseOffsetPath(), 'CRM_TASK_NAME' => $title, 'CRM_TASK_LINK' => "<a href='" . ASCMS_PROTOCOL . "://{$_SERVER['HTTP_HOST']}" . $cx->getCodeBaseOffsetPath() . $cx->getBackendFolderName() . "/index.php?cmd=" . $this->moduleName . "&act=task&tpl=modify&id={$id}'>{$title}</a>", 'CRM_TASK_URL' => ASCMS_PROTOCOL . "://{$_SERVER['HTTP_HOST']}" . $cx->getCodeBaseOffsetPath() . $cx->getBackendFolderName() . "/index.php?cmd=" . $this->moduleName . "&act=task&tpl=modify&id={$id}", 'CRM_TASK_DUE_DATE' => $duedate, 'CRM_TASK_CREATED_USER' => contrexx_raw2xhtml(\FWUser::getParsedUserTitle($objFWUser->objUser->getId())), 'CRM_TASK_DESCRIPTION_TEXT_VERSION' => contrexx_html2plaintext($description), 'CRM_TASK_DESCRIPTION_HTML_VERSION' => $description);
                 //setting email template lang id
                 $availableMailTempLangAry = $this->getActiveEmailTemLangId('Crm', CRM_EVENT_ON_TASK_CREATED);
                 $availableLangId = $this->getEmailTempLang($availableMailTempLangAry, $objFWUser->objUser->getUser($assignedto)->getEmail());
                 $info['lang_id'] = $availableLangId;
                 $dispatcher = CrmEventDispatcher::getInstance();
                 $dispatcher->triggerEvent(CRM_EVENT_ON_TASK_CREATED, null, $info);
             }
             \Cx\Core\Csrf\Controller\Csrf::header("Location:./index.php?cmd=" . $this->moduleName . base64_decode($redirect));
             exit;
         }
     } elseif (!empty($id)) {
         $objValue = $objDatabase->Execute("SELECT task_id,\n                                                            task_title,\n                                                            task_type_id,\n                                                            due_date,\n                                                            assigned_to,\n                                                            description,\n                                                            c.id,\n                                                            c.customer_name,\n                                                            c.contact_familyname\n                                                       FROM `" . DBPREFIX . "module_{$this->moduleNameLC}_task` AS t\n                                                       LEFT JOIN `" . DBPREFIX . "module_{$this->moduleNameLC}_contacts` AS c\n                                                            ON t.customer_id = c.id\n                                                       WHERE t.id='{$id}'");
         $title = $objValue->fields['task_title'];
         $type = $objValue->fields['task_type_id'];
         $customer = $objValue->fields['id'];
         $customerName = !empty($objValue->fields['customer_name']) ? $objValue->fields['customer_name'] . " " . $objValue->fields['contact_familyname'] : '';
         $duedate = $objValue->fields['due_date'];
         $assignedto = $objValue->fields['assigned_to'];
         $description = $objValue->fields['description'];
         $taskAutoId = $objValue->fields['task_id'];
     }
     $this->_getResourceDropDown('Members', $assignedto, $settings['emp_default_user_group']);
     $this->taskTypeDropDown($objtpl, $type);
     if (!empty($customer)) {
         // Get customer Name
         $objCustomer = $objDatabase->Execute("SELECT customer_name, contact_familyname  FROM `" . DBPREFIX . "module_crm_contacts` WHERE id = {$customer}");
         $customerName = $objCustomer->fields['customer_name'] . " " . $objCustomer->fields['contact_familyname'];
     }
     $objtpl->setVariable(array('CRM_LOGGED_USER_ID' => $objFWUser->objUser->getId(), 'CRM_TASK_AUTOID' => contrexx_raw2xhtml($taskAutoId), 'CRM_TASK_ID' => (int) $id, 'CRM_TASKTITLE' => contrexx_raw2xhtml($title), 'CRM_DUE_DATE' => contrexx_raw2xhtml($duedate), 'CRM_CUSTOMER_ID' => intval($customer), 'CRM_CUSTOMER_NAME' => contrexx_raw2xhtml($customerName), 'CRM_TASK_DESC' => new \Cx\Core\Wysiwyg\Wysiwyg('description', contrexx_raw2xhtml($description)), 'CRM_BACK_LINK' => base64_decode($redirect), 'TXT_CRM_ADD_TASK' => empty($id) ? $_ARRAYLANG['TXT_CRM_ADD_TASK'] : $_ARRAYLANG['TXT_CRM_EDITTASK'], 'TXT_CRM_TASK_ID' => $_ARRAYLANG['TXT_CRM_TASK_ID'], 'TXT_CRM_TASK_TITLE' => $_ARRAYLANG['TXT_CRM_TASK_TITLE'], 'TXT_CRM_TASK_TYPE' => $_ARRAYLANG['TXT_CRM_TASK_TYPE'], 'TXT_CRM_SELECT_TASK_TYPE' => $_ARRAYLANG['TXT_CRM_SELECT_TASK_TYPE'], 'TXT_CRM_CUSTOMER_NAME' => $_ARRAYLANG['TXT_CRM_CUSTOMER_NAME'], 'TXT_CRM_TASK_DUE_DATE' => $_ARRAYLANG['TXT_CRM_TASK_DUE_DATE'], 'TXT_CRM_TASK_RESPONSIBLE' => $_ARRAYLANG['TXT_CRM_TASK_RESPONSIBLE'], 'TXT_CRM_SELECT_MEMBER_NAME' => $_ARRAYLANG['TXT_CRM_SELECT_MEMBER_NAME'], 'TXT_CRM_OVERVIEW' => $_ARRAYLANG['TXT_CRM_OVERVIEW'], 'TXT_CRM_TASK_DESCRIPTION' => $_ARRAYLANG['TXT_CRM_TASK_DESCRIPTION'], 'TXT_CRM_FIND_COMPANY_BY_NAME' => $_ARRAYLANG['TXT_CRM_FIND_COMPANY_BY_NAME'], 'TXT_CRM_SAVE' => $_ARRAYLANG['TXT_CRM_SAVE'], 'TXT_CRM_BACK' => $_ARRAYLANG['TXT_CRM_BACK'], 'TXT_CRM_NOTIFY' => $_ARRAYLANG['TXT_CRM_NOTIFY'], 'TXT_CRM_MANDATORY_FIELDS_NOT_FILLED_OUT' => $_ARRAYLANG['TXT_CRM_MANDATORY_FIELDS_NOT_FILLED_OUT']));
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:94,代码来源:CrmTask.class.php

示例12: build

 /**
  * Builds the different types of SQL queries
  * This uses the SQL class to build stuff.
  *
  * @param string $type (select, update, insert)
  * @return string The final query
  */
 public function build($type)
 {
     $sql = new SQL($this->db);
     switch ($type) {
         case 'select':
             return $sql->select(array('table' => $this->table, 'columns' => $this->select, 'join' => $this->join, 'distinct' => $this->distinct, 'where' => $this->where, 'group' => $this->group, 'having' => $this->having, 'order' => $this->order, 'offset' => $this->offset, 'limit' => $this->limit));
         case 'update':
             return $sql->update(array('table' => $this->table, 'where' => $this->where, 'values' => $this->values));
         case 'insert':
             return $sql->insert(array('table' => $this->table, 'values' => $this->values));
         case 'delete':
             return $sql->delete(array('table' => $this->table, 'where' => $this->where));
     }
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:21,代码来源:query.php

示例13: proPhotoUploadFinished

 /**
  * the upload is finished
  * rewrite the names
  * write the uploaded files to the database
  *
  * @param string     $tempPath    the temporary file path
  * @param string     $tempWebPath the temporary file path which is accessable by web browser
  * @param array      $data        the data which are attached by uploader init method
  * @param integer    $uploadId    the upload id
  * @param array      $fileInfos   the file infos  
  * 
  * @return array the target paths
  */
 public static function proPhotoUploadFinished($tempPath, $tempWebPath, $data, $uploadId, $fileInfos, $response)
 {
     global $objDatabase, $objFWUser;
     $cx = \Cx\Core\Core\Controller\Cx::instanciate();
     $depositionTarget = $cx->getWebsiteImagesCrmProfilePath() . '/';
     //target folder
     $h = opendir($tempPath);
     if ($h) {
         while (false != ($file = readdir($h))) {
             $info = pathinfo($file);
             //skip . and ..
             if ($file == '.' || $file == '..') {
                 continue;
             }
             if ($file != '..' && $file != '.') {
                 //do not overwrite existing files.
                 $prefix = '';
                 while (file_exists($depositionTarget . $prefix . $file)) {
                     if (empty($prefix)) {
                         $prefix = 0;
                     }
                     $prefix++;
                 }
                 // move file
                 try {
                     $objFile = new \Cx\Lib\FileSystem\File($tempPath . '/' . $file);
                     $objFile->copy($depositionTarget . $prefix . $file, false);
                     // create thumbnail
                     if (empty($objImage)) {
                         $objImage = new \ImageManager();
                     }
                     $imageName = trim($prefix . $file);
                     $objImage->_createThumbWhq($cx->getWebsiteImagesCrmProfilePath() . '/', $cx->getWebsiteImagesCrmProfileWebPath() . '/', $imageName, 40, 40, 70, '_40X40.thumb');
                     $objImage->_createThumbWhq($cx->getWebsiteImagesCrmProfilePath() . '/', $cx->getWebsiteImagesCrmProfileWebPath() . '/', $imageName, 121, 160, 70);
                     // write the uploaded files into database
                     $fields = array('profile_picture' => $imageName);
                     $sql = \SQL::update("module_crm_contacts", $fields, array('escape' => true)) . " WHERE `id` = {$data[0]}";
                     $objDatabase->Execute($sql);
                     $accountId = $objDatabase->getOne("SELECT user_account FROM `" . DBPREFIX . "module_crm_contacts` WHERE id = {$data[0]}");
                     if (!empty($accountId) && !empty($imageName)) {
                         $objUser = $objFWUser->objUser->getUser($accountId);
                         if (!file_exists($cx->getWebsiteImagesAccessProfilePath() . '/' . $imageName)) {
                             $file = $cx->getWebsiteImagesCrmProfilePath() . '/';
                             if (($imageName = self::moveUploadedImageInToPlace($objUser, $file . $imageName, $imageName, true)) == true) {
                                 // create thumbnail
                                 $objImage = new \ImageManager();
                                 $objImage->_createThumbWhq($cx->getWebsiteImagesAccessProfilePath() . '/', $cx->getWebsiteImagesAccessProfileWebPath() . '/', $imageName, 80, 60, 90);
                                 $objUser->setProfile(array('picture' => array(0 => $imageName)));
                                 $objUser->store();
                             }
                         }
                     }
                 } catch (\Cx\Lib\FileSystem\FileSystemException $e) {
                     \DBG::msg($e->getMessage());
                 }
             }
             $arrFiles[] = $file;
         }
         closedir($h);
     }
     // return web- and filesystem path. files will be moved there.
     return array($tempPath, $tempWebPath);
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:76,代码来源:CrmManager.class.php

示例14: intval

         $params[substr($key, 3)] = $val;
     }
 }
 $ps->params = $params;
 if ($ps->checkSignature($_GET['SignatureValue'])) {
     //Данные прошли проверку
     //if($ps->params['Type']=='balance'){
     $rs = $ST->select("SELECT * FROM sc_income \r\n\t\t\t\tWHERE \r\n\t\t\t\t\tuserid=" . intval($ps->params['UserId']) . "\r\n\t\t\t\t\tAND pay_id=" . intval($ps->InvId) . "\r\n\t\t\t\t\tAND type='robokassa'");
     if ($rs->next()) {
         //перевод уже был, всё ок
         echo 'OK' . $_GET['InvId'];
         exit;
     } else {
         if ($ps->params['Type'] == 'balance') {
             //пополним баланс
             $ST->update('sc_users', array('balance=balance+' . floatval($ps->OutSum)), "u_id=" . intval($ps->params['UserId']));
             $rs = $ST->execute("SELECT balance FROM sc_users WHERE u_id=" . intval($ps->params['UserId']));
             if ($rs->next()) {
                 $ST->insert('sc_income', array('userid' => intval($ps->params['UserId']), 'sum' => floatval($ps->OutSum), 'balance' => floatval($rs->getFloat('balance')), 'type' => 'robokassa', 'description' => 'Приход с робокассы', 'pay_id' => intval($ps->InvId), 'pay_string' => $_SERVER['QUERY_STRING']));
             }
         }
         //если указан номер заявки
         if (isset($ps->params['OrderId'])) {
             $rs = $ST->select("SELECT * FROM sc_users WHERE u_id=" . intval($ps->params['UserId']));
             if ($rs->next()) {
                 $user = $rs->getRow();
                 //						$rs=$ST->execute("SELECT * FROM sc_cc_order WHERE userid=".intval($ps->params['UserId'])." AND id=".intval($ps->params['OrderId']));
                 $rs = $ST->select("SELECT * FROM sc_shop_order WHERE userid=" . intval($ps->params['UserId']) . " AND id=" . intval($ps->params['OrderId']));
                 if ($rs->next() && floatval($ps->OutSum) >= $rs->getInt('total_price')) {
                     //							$ST->update('sc_users',array('balance=balance-'.$rs->getInt('summ')),"u_id=".intval($ps->params['UserId']));
                     $ST->update('sc_shop_order', array('pay_time' => date('Y-m-d H:i:s'), 'pay_status' => 'ok'), 'id=' . intval($ps->params['OrderId']));
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:31,代码来源:result.php

示例15: date

<?php

require_once '../config.php';
require_once '../core/lib/SQL.class.php';
require_once '../core/lib/PSPayonline.class.php';
file_put_contents('log.txt', date("Y-m-d H:i:s") . " {$_SERVER['REQUEST_URI']}\r\n", FILE_APPEND);
//exit;
$ST = new SQL();
$ST->connect(DB_HOST, DB_LOGIN, DB_PASSWORD, DB_BASE);
$rs = $ST->select("SELECT * FROM sc_pay_system WHERE name='payonline'");
if ($rs->next() && $_GET) {
    $ps = new PSPayonline(unserialize($rs->get('config')));
    $ps->OrderId = $_GET['OrderId'];
    $ps->Amount = $_GET['Amount'];
    $ps->Currency = $_GET['Currency'];
    $ps->TransactionID = $_GET['TransactionID'];
    $ps->DateTime = $_GET['DateTime'];
    if (isset($_GET['ValidUntil'])) {
        $ps->ValidUntil = $_GET['ValidUntil'];
    }
    if ($ps->checkSignature($_GET['SecurityKey']) && isset($_GET['UserId']) && isset($_GET['OrderNum'])) {
        $ST->update('sc_shop_order', array('pay_status' => 'paid', 'pay_time' => date('Y-m-d H:i:s'), 'pay_system' => 'payonline'), "id='" . intval($_GET['OrderNum']) . "'");
        //OrderNum доп параметр
    }
}
开发者ID:AlexanderWhi,项目名称:tplshop2,代码行数:25,代码来源:result.php


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