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


PHP DB::GetOne方法代码示例

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


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

示例1: auth

 private function auth($user, $pass)
 {
     $error = '';
     $t = Variable::get('host_ban_time');
     if ($t > 0) {
         $fails = DB::GetOne('SELECT count(*) FROM user_login_ban WHERE failed_on>%d AND from_addr=%s', array(time() - $t, $_SERVER['REMOTE_ADDR']));
         if ($fails >= 3) {
             $error = 'Host banned.';
         }
     }
     if ($error === '') {
         $ret = Base_User_LoginCommon::check_login($user, $pass);
         if (!$ret) {
             $error = 'Login failed.';
             if ($t > 0) {
                 DB::Execute('DELETE FROM user_login_ban WHERE failed_on<=%d', array(time() - $t));
                 DB::Execute('INSERT INTO user_login_ban(failed_on,from_addr) VALUES(%d,%s)', array(time(), $_SERVER['REMOTE_ADDR']));
                 $fails = DB::GetOne('SELECT count(*) FROM user_login_ban WHERE failed_on>%d AND from_addr=%s', array(time() - $t, $_SERVER['REMOTE_ADDR']));
                 if ($fails >= 3) {
                     $error .= ' Host banned.';
                 }
             }
         } else {
             $uid = Base_UserCommon::get_user_id($user);
             Acl::set_user($uid, true);
         }
     }
     return $error;
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:29,代码来源:soap.php

示例2: exportValue

	function exportValue(&$submitValues, $assoc = false) {
		$val = parent::exportValue($submitValues, $assoc);
		$currency_field_name = '__'.str_replace(array('[',']'),'',$this->getName()).'__currency';
		if(isset($submitValues[$currency_field_name]))
    		$currency = $submitValues[$currency_field_name];
        else
            return null;
		if ($assoc) {
			if (!isset($val[$this->getName()])) {
				$key = explode('[', $this->getName());
				$key[1] = str_replace(']','',$key[1]);
				$val = $val[$key[0]][$key[1]];
			} else $val = $val[$this->getName()];
		}
		$cur = explode(Utils_CurrencyFieldCommon::get_decimal_point(), $val);
		if (!isset($cur[1])) $ret = $cur[0]; else {
			$this->dec_digits = DB::GetOne('SELECT decimals FROM utils_currency WHERE id=%d', array($currency));
			$cur[1] = str_pad($cur[1], $this->dec_digits, '0');
			$cur[1] = substr($cur[1], 0, $this->dec_digits);
			$ret = $cur[0] + (($cur[0]<0?-1:1)*$cur[1]/pow(10,$this->dec_digits));
		}
		$ret .= '__'.$currency;
		if($assoc) {
			$val = array();
			if (isset($key)) {
				$val[$key[0]][$key[1]] = $ret;
			} else $val[$this->getName()] = $ret;
			return $val;
		} else {
			return $ret;
		}
	}
开发者ID:62BRAINS,项目名称:EPESI,代码行数:32,代码来源:currency.php

示例3: DeleteContact

 /**
  * Delete contact
  *
  * @param Contact $contact
  * @param array $extra Extra fields
  * @return bool
  */
 public function DeleteContact(Contact $contact, $extra = array())
 {
     $this->FireEvent('BeforeDeleteContact', $contact);
     try {
         $Resp = $this->RegModule->DeleteContact($contact, $extra);
         $this->ValidateModuleResponse($Resp, 'DeleteContactResponse');
     } catch (ProhibitedTransformException $e) {
         $linked_domain_cnt = $this->DB->GetOne("\r\n\t\t\t\t\tSELECT COUNT(*) FROM domains \r\n\t\t\t\t\tWHERE c_registrant = ? OR c_admin = ? OR c_billing = ? OR c_tech = ?", array($contact->CLID, $contact->CLID, $contact->CLID, $contact->CLID));
         if (!$linked_domain_cnt) {
             $this->DBContact->Delete($contact);
             $this->FireEvent('ContactDeleted', $contact);
             return true;
         }
         throw new Exception(_('Contact couldn\'t be deleted due to linked domains'));
     }
     if ($Resp->IsFailed()) {
         Log::Log(sprintf('DeleteContact failed. Registry error: %s', $Resp->ErrMsg), E_USER_ERROR);
         throw new RegistryException($Resp->ErrMsg, $Resp->Code);
     }
     if ($Resp->Succeed()) {
         $this->DBContact->Delete($contact);
         $this->FireEvent('ContactDeleted', $contact);
     } else {
         if ($Resp->Pending()) {
             $this->AddPendingOperation($contact, self::OP_DELETE, $Resp->OperationId);
         }
     }
     return true;
 }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:36,代码来源:class.Registry.php

示例4: allow_sending

 public static function allow_sending($flush = false)
 {
     static $cache = -1;
     if ($cache === -1 || $flush) {
         $cache = DB::GetOne('SELECT allow FROM base_lang_trans_contrib WHERE user_id=%d', Acl::get_user());
     }
     return $cache;
 }
开发者ID:62BRAINS,项目名称:EPESI,代码行数:8,代码来源:AdministratorCommon_0.php

示例5: GetOneInfoByArrayKeys

 public function GetOneInfoByArrayKeys($Array = array())
 {
     $DB = new DB();
     $KeyInfo = array_keys($Array);
     $Where = '1';
     foreach ($KeyInfo as $Value) {
         $Where .= ' and `' . $Value . '`=\'' . $Array[$Value] . '\'';
     }
     return $DB->GetOne('select * from ' . $this->TableName . ' where ' . $Where);
 }
开发者ID:baiduXM,项目名称:agent,代码行数:10,代码来源:class.ProjectModule.php

示例6: jump_to_new_event

 public function jump_to_new_event($option, $timestamp, $timeless)
 {
     list($label, $id, $int_id) = explode('__', $option);
     $callback = DB::GetOne('SELECT handler_callback FROM crm_calendar_custom_events_handlers WHERE id=%d', $id);
     $callback = explode('::', $callback);
     call_user_func($callback, 'new_event', $timestamp, $timeless, $int_id, null, $this);
     /*		if (!is_numeric($timestamp)) $timestamp = strtotime($timestamp);
     		$x = ModuleManager::get_instance('/Base_Box|0');
     		if(!$x) trigger_error('There is no base box module instance',E_USER_ERROR);
     		$x->push_main('CRM_Calendar','new_event',array($option, $timestamp, $timeless));*/
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:11,代码来源:Calendar_0.php

示例7: GetOneInfoByArrayKeys

 public function GetOneInfoByArrayKeys($Array = array())
 {
     $DB = new DB();
     $MysqlWhere = '';
     foreach ($Array as $Key => $Value) {
         $MysqlWhere .= $Key . ' = \'' . $Value . '\' and ';
     }
     $MysqlWhere = substr($MysqlWhere, 0, -5);
     $MysqlWhere = trim($MysqlWhere);
     return $DB->GetOne('select * from ' . $this->TableName . ' where ' . $MysqlWhere);
 }
开发者ID:baiduXM,项目名称:agent,代码行数:11,代码来源:class.FuwuqiModule.php

示例8: Delete

 public function Delete($PictureID, $UserID)
 {
     $DB = new DB();
     $Sql = 'SELECT Path, Title, Keywords,UserID, IsPublic FROM tbl_pictures WHERE PictureID=' . $PictureID . ' and UserID=' . $UserID;
     $RS = $DB->GetOne($Sql);
     if ($RS) {
         if (@unlink(DocumentRoot . $RS['Path'])) {
             $DB->Delete('DELETE FROM tbl_pictures WHERE PictureID=' . $PictureID);
             return 0;
         } else {
             return 1;
         }
     } else {
         return 2;
     }
 }
开发者ID:baiduXM,项目名称:agent,代码行数:16,代码来源:class.PicturesModule.php

示例9: get_my_homepage

 public static function get_my_homepage()
 {
     $clearance = Base_AclCommon::get_clearance();
     $sql = 'SELECT home_page FROM base_home_page AS bhp WHERE ';
     $vals = array();
     if ($clearance != null) {
         $sql .= ' NOT EXISTS (SELECT * FROM base_home_page_clearance WHERE home_page_id=bhp.id AND ' . implode(' AND ', array_fill(0, count($clearance), 'clearance!=%s')) . ')';
         $vals = array_values($clearance);
     } else {
         $sql .= ' NOT EXISTS (SELECT * FROM base_home_page_clearance WHERE home_page_id=bhp.id)';
     }
     $sql .= ' ORDER BY priority';
     $page = DB::GetOne($sql, $vals);
     $pages = self::get_home_pages();
     return isset($pages[$page]) ? $pages[$page] : array();
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:16,代码来源:HomePageCommon_0.php

示例10: install

 public function install()
 {
     $fields = array('name' => _M('County'), 'type' => 'commondata', 'required' => false, 'param' => array('Countries', 'Country', 'Zone'), 'extra' => false, 'QFfield_callback' => array('CRM_Contacts_CountyCommon', 'QFfield_county'), 'position' => 'Zone');
     Utils_RecordBrowserCommon::new_record_field('company', $fields);
     $fields = array('name' => _M('County'), 'type' => 'commondata', 'required' => false, 'param' => array('Countries', 'Country', 'Zone'), 'extra' => false, 'QFfield_callback' => array('CRM_Contacts_CountyCommon', 'QFfield_county'), 'position' => 'Zone');
     Utils_RecordBrowserCommon::new_record_field('contact', $fields);
     $fields = array('name' => _M('Home County'), 'type' => 'commondata', 'required' => false, 'param' => array('Countries', 'Home Country', 'Home Zone'), 'extra' => false, 'QFfield_callback' => array('CRM_Contacts_CountyCommon', 'QFfield_county'), 'position' => 'Home Zone');
     Utils_RecordBrowserCommon::new_record_field('contact', $fields);
     $hc_pos = DB::GetOne('SELECT position FROM contact_field WHERE field=\'Home City\'');
     $bd_pos = DB::GetOne('SELECT position FROM contact_field WHERE field=\'Birth Date\'');
     if ($hc_pos + 1 < $bd_pos) {
         DB::Execute('UPDATE contact_field SET position = position+1 WHERE position>%d AND position<%d', array($hc_pos, $bd_pos));
         DB::Execute('UPDATE contact_field SET position = %d WHERE field=\'Birth Date\'', array($hc_pos));
     }
     return true;
 }
开发者ID:62BRAINS,项目名称:EPESI,代码行数:16,代码来源:CountyInstall.php

示例11: set_profile

 public static function set_profile($prof)
 {
     if (preg_match('/^c([0-9,]+)$/', $prof, $reqs)) {
         $ret = $reqs[1];
         if (strpos($ret, ',') === false) {
             $desc = CRM_ContactsCommon::contact_format_no_company($ret, true);
         } else {
             $desc = __('Custom filter');
         }
     } elseif (is_numeric($prof)) {
         $cids = DB::GetAssoc('SELECT contact_id, contact_id FROM crm_filters_contacts');
         $c = DB::GetCol('SELECT p.contact_id FROM crm_filters_contacts p WHERE p.group_id=%d', array($prof));
         if ($c) {
             $ret = implode(',', $c);
         } else {
             $ret = '-1';
         }
         $desc = DB::GetOne('SELECT name FROM crm_filters_group WHERE id=%d', array($prof));
     } elseif ($prof == 'my') {
         $ret = CRM_FiltersCommon::get_my_profile();
         $desc = __('My records');
     } else {
         //all and undefined
         $ret = '';
         /*$contacts = Utils_RecordBrowserCommon::get_records('contact', array(), array(), array('last_name'=>'ASC'));
         		$contacts_select = array();
         		foreach($contacts as $v)
         			$contacts_select[] = $v['id'];
         		if($contacts_select)
         			$ret = implode(',',$contacts_select);
         		else
         			$ret = '-1';*/
         $desc = __('All records');
     }
     //		$this->set_module_variable('profile',$ret);
     $_SESSION['client']['filter_' . Acl::get_user()]['value'] = $ret;
     $_SESSION['client']['filter_' . Acl::get_user()]['desc'] = $desc;
     location(array());
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:39,代码来源:FiltersCommon_0.php

示例12: edit_permissions

 public function edit_permissions($permission_name = null)
 {
     if ($this->is_back()) {
         Base_BoxCommon::pop_main();
     }
     Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
     Base_ThemeCommon::load_css('Base_Acl', 'edit_permissions');
     $gb = $this->init_module('Utils_GenericBrowser', 'acl_editor', 'acl_editor');
     $gb->set_table_columns(array(array('name' => '&nbsp;', 'width' => 20)));
     $sql = 'SELECT id, name FROM base_acl_permission';
     $args = array();
     $perm_id = null;
     if ($permission_name) {
         $sql .= ' WHERE name=%s';
         $args[] = $permission_name;
         $perm_id = DB::GetOne('SELECT id FROM base_acl_permission WHERE name=%s', array($permission_name));
     }
     $sql .= ' ORDER BY name ASC';
     $perms = DB::GetAssoc($sql, $args);
     Base_ActionBarCommon::add('add', __('Add rule'), $this->create_callback_href(array($this, 'edit_rule'), array(null, $perm_id)));
     foreach ($perms as $p_id => $p_name) {
         $gb_row = $gb->get_new_row();
         $gb_row->add_data(array('value' => _V($p_name), 'class' => 'Base_Acl__permission', 'attrs' => 'colspan="2"'));
         $gb_row->no_actions();
         $perms = DB::GetAssoc('SELECT id, id FROM base_acl_rules WHERE permission_id=%d', array($p_id));
         foreach ($perms as $r_id) {
             $clearances = DB::GetAssoc('SELECT id, clearance FROM base_acl_rules_clearance WHERE rule_id=%d', array($r_id));
             $gb_row = $gb->get_new_row();
             $gb_row->add_action($this->create_confirm_callback_href(__('Are you sure you want to delete this rule?'), array($this, 'delete_rule'), array($r_id)), 'delete', __('Delete Rule'));
             $gb_row->add_action($this->create_callback_href(array($this, 'edit_rule'), array($r_id, $p_id)), 'edit', __('Edit Rule'));
             $gb_row->add_data(Base_AclCommon::display_clearances($clearances));
         }
     }
     $this->display_module($gb);
     eval_js('base_acl__initialized = false;');
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:36,代码来源:Acl_0.php

示例13: TopicDetail

 function TopicDetail($TopicID)
 {
     $DB = new DB();
     return $DB->GetOne('select * from tbl_topics where TopicID=' . $TopicID);
 }
开发者ID:baiduXM,项目名称:agent,代码行数:5,代码来源:class.ArticlesModule.php

示例14: clear_search_index

 public static function clear_search_index($tab)
 {
     $tab_id = DB::GetOne('SELECT id FROM recordbrowser_table_properties WHERE tab=%s', array($tab));
     if ($tab_id) {
         DB::Execute('DELETE FROM recordbrowser_words_map WHERE tab_id=%d', array($tab_id));
         DB::Execute('UPDATE ' . $tab . '_data_1 SET indexed=0');
         return true;
     }
     return false;
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:10,代码来源:RecordBrowserCommon_0.php

示例15: reset_cron

 /**
  * Queues cron method to be run asap.
  *
  * @param string $module Module class name - usually $this->get_type()
  * @param string $method cron method name
  * @return boolean true - queued, false - already running
  */
 public static function reset_cron($module, $method)
 {
     $func = $module . 'Common::' . $method;
     if (!is_callable(array($module . 'Common', $method))) {
         trigger_error('Invalid cron method: ' . $func);
     }
     $func_md5 = md5($func);
     $running = DB::GetOne('SELECT running FROM cron WHERE func=%s', array($func_md5));
     if ($running) {
         return false;
     }
     DB::Execute('UPDATE cron SET last=0 WHERE func=%s', array($func_md5));
     return true;
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:21,代码来源:module_manager.php


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