本文整理汇总了PHP中db_res函数的典型用法代码示例。如果您正苦于以下问题:PHP db_res函数的具体用法?PHP db_res怎么用?PHP db_res使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_res函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compile
function compile()
{
$sEval = "return array(\n";
$aFields = array('Caption', 'Name', 'Icon', 'Link', 'Script', 'Target', 'Order', 'Visible');
$sQuery = "SELECT `ID`, `" . implode('`, `', $aFields) . "` FROM `" . $this->sDbTable . "` WHERE `Active`='1' ORDER BY `Order`";
$rMenu = db_res($sQuery);
while ($aItem = $rMenu->fetch()) {
$sEval .= " " . str_pad($aItem['ID'], 2) . " => array(\n";
foreach ($aFields as $sKey => $sField) {
$sCont = $aItem[$sField];
$sCont = str_replace('\\', '\\\\', $sCont);
$sCont = str_replace('"', '\\"', $sCont);
$sCont = str_replace('$', '\\$', $sCont);
$sCont = str_replace("\n", '', $sCont);
$sCont = str_replace("\r", '', $sCont);
$sCont = str_replace("\t", '', $sCont);
$sEval .= " " . str_pad("'{$sField}'", 11) . " => \"{$sCont}\",\n";
}
$sEval .= " ),\n";
}
$sEval .= ");\n";
$aResult = eval($sEval);
$oCache = $GLOBALS['MySQL']->getDbCacheObject();
return $oCache->setData($GLOBALS['MySQL']->genDbCacheKey($this->sCacheKey), $aResult);
}
示例2: PageCompPageMainCode
/**
* page code function
*/
function PageCompPageMainCode()
{
global $site;
global $prof;
$query = "\n\t\tSELECT\n\t\t\t`id_poll`,\n\t\t\t`id_profile`,\n\t\t\t`poll_question`,\n\t\t\t`Profiles`.*\n\t\tFROM `ProfilesPolls`\n\t\tLEFT JOIN `Profiles` ON\n\t\t\t`id_profile` = `Profiles`.`ID`\n\t\tWHERE\n\t\t\t`poll_status` = 'active'\n\t\t\tAND `poll_approval`\n\t\tORDER BY `id_poll` DESC\n\t\t";
//$query = "SELECT `ID`, `Question` FROM `polls_q` WHERE `Active` = 'on' ORDER BY `Question`";
$res = db_res($query);
if ($res and mysql_num_rows($res)) {
$ret = '<div class="clear_both"></div>';
while ($arr = mysql_fetch_array($res)) {
$age_str = _t("_y/o", age($arr['DateOfBirth']));
$y_o_sex = $age_str . ' ' . _t("_" . $arr['Sex']);
$poll_coutry = _t("__" . $prof['countries'][$arr['Country']]);
$ret .= '<div class="pollBody">';
$ret .= '<div class="clear_both"></div>';
$ret .= '<div class="pollInfo">';
$ret .= get_member_icon($arr['id_profile'], 'left');
$ret .= '<div class="pollInfo_nickname">';
$ret .= _t('_Submitted by', $arr['NickName']);
$ret .= '</div>';
$ret .= '<div class="pollInfo_info">';
$ret .= $y_o_sex . '<br />' . $poll_coutry;
$ret .= '</div>';
$ret .= '</div>';
$ret .= '<div class="clear_both"></div>';
$ret .= ShowPoll($arr['id_poll']);
$ret .= '<div class="clear_both"></div>';
$ret .= '</div>';
}
$ret .= '<div class="clear_both"></div>';
} else {
$ret = "<div align=center>" . _t("_No polls available") . "</div>\n";
}
return $ret;
}
示例3: getNewsList
function getNewsList($iLimit = 0)
{
$sqlQuery = "SELECT `News`.`ID` AS `newsID`,\r\n\t\t\t\t\t\t`Header`,\r\n\t\t\t\t\t\t`NewsUri`,\r\n\t\t\t\t\t\t`Snippet`,\r\n\t\t\t\t\t\tUNIX_TIMESTAMP( `Date` ) AS 'Date'\r\n\t\t\t\t FROM `News`\r\n\t\t\t\t ORDER BY `Date`DESC";
$sqlLimit = $iLimit > 0 ? " LIMIT {$iLimit}" : "";
$rNews = db_res($sqlQuery . $sqlLimit);
return $rNews;
}
示例4: PageCompSearchResults
function PageCompSearchResults()
{
global $dir;
global $tmpl;
$keyword = process_db_input($_REQUEST['keyword']);
$sMembersQuery = "\n\t\tSELECT *\n\t\tFROM `Profiles`\n\t\tWHERE\n\t\t" . (is_numeric($keyword) ? "`ID` = '{$keyword}'" : "`NickName` LIKE '%{$keyword}%'") . "";
$rMembers = db_res($sMembersQuery);
if (!mysql_num_rows($rMembers)) {
return '<div class="qsearch_notfound">' . _t('_Sorry, no members found') . '</div>';
}
$sRowTmpl = file_get_contents("{$dir['root']}templates/tmpl_{$tmpl}/qsearch_row.html");
$ret = '';
while ($aMember = mysql_fetch_assoc($rMembers)) {
$aRowTmpl = array();
$aRowTmpl['thumbnail'] = get_member_thumbnail($aMember['ID'], 'none');
$aRowTmpl['NickName'] = "<a href=\"" . getProfileLink($aMember['ID']) . "\" target=\"_blank\">" . htmlspecialchars_adv($aMember['NickName']) . "</a>";
$aRowTmpl['actions'] = "<a href=\"javascript:void(0);\" onclick=\"hMemberAction({$aMember['ID']}, '{$aMember['NickName']}')\">" . _t('_Add member') . "</a>";
$sRow = $sRowTmpl;
foreach ($aRowTmpl as $what => $to) {
$sRow = str_replace("__{$what}__", $to, $sRow);
}
$ret .= $sRow;
}
return $ret;
}
示例5: getProfileInfoExtra
function getProfileInfoExtra()
{
$oPrivacy = new BxDolPrivacy('sys_page_compose_privacy', 'id', 'user_id');
$aRet = array();
$r = db_res("SELECT `pc`.`Caption`, `pc`.`Content`, `pc`.`Func`, `pc`.`ID` AS `BlockID`\n FROM `sys_profile_fields` AS `pf` \n INNER JOIN `sys_page_compose` AS `pc` \n ON ((`pc`.`Func` = 'PFBlock' AND `pc`.`Content` = `pf`.`ID`) OR (`pc`.`Func` = 'GeneralInfo' AND " . BX_BLOCK_GENERALINFO . " = `pf`.`ID`) OR (`pc`.`Func` = 'AdditionalInfo' AND " . BX_BLOCK_ADDITIONALINFO . " = `pf`.`ID`))\n WHERE `pc`.`Page` = 'profile_info' AND `pf`.`Type` = 'block' AND `pc`.`Column` != 0 \n ORDER BY `pc`.`Column`, `pc`.`Order`");
while ($a = $r->fetch()) {
$iPrivacyId = (int) $GLOBALS['MySQL']->getOne("SELECT `id` FROM `sys_page_compose_privacy` WHERE `user_id`='" . $this->_iProfileID . "' AND `block_id`='" . $a['BlockID'] . "' LIMIT 1");
if ($iPrivacyId != 0 && !$oPrivacy->check('view_block', $iPrivacyId, $this->_iViewerId)) {
continue;
}
switch ($a['Func']) {
case 'GeneralInfo':
$i = BX_BLOCK_GENERALINFO;
break;
case 'AdditionalInfo':
$i = BX_BLOCK_ADDITIONALINFO;
break;
default:
$i = $a['Content'];
}
$aBlock = $this->getProfileInfoBlock($a['Caption'], $i);
if (false === $aBlock) {
continue;
}
$aRet[] = $aBlock;
}
if ($this->_iViewerId == $this->_iProfileID) {
$aOwnInfo[] = new xmlrpcval(array('Caption' => new xmlrpcval(_t('_E-mail')), 'Type' => new xmlrpcval('text'), 'Value1' => new xmlrpcval($this->_aProfile['Email'])), "struct");
$aOwnInfo[] = new xmlrpcval(array('Caption' => new xmlrpcval(_t('_Membership2')), 'Type' => new xmlrpcval('text'), 'Value1' => new xmlrpcval(strip_tags(GetMembershipStatus($this->_iProfileID, false, false)))), "struct");
$aOwnInfo[] = new xmlrpcval(array('Caption' => new xmlrpcval(_t('_Status')), 'Type' => new xmlrpcval('text'), 'Value1' => new xmlrpcval(_t('__' . $this->_aProfile['Status']))), "struct");
$aRet[] = new xmlrpcval(array('Info' => new xmlrpcval($aOwnInfo, "array"), 'Title' => new xmlrpcval(_t('_Account Info'))), "struct");
}
return new xmlrpcval($aRet, "array");
}
示例6: _getAllTables
function _getAllTables($data = false)
{
$Query = "SHOW TABLES";
$Result = db_res($Query);
while ($Row = $Result->fetch(PDO::FETCH_NUM)) {
$this->_getTableStruct($Row[0], $data);
}
}
示例7: _getAllTables
function _getAllTables($data = false)
{
$Query = "SHOW TABLES";
$Result = db_res($Query);
while ($Row = mysql_fetch_row($Result)) {
$this->_getTableStruct($Row[0], $data);
}
}
示例8: storeTags
function storeTags($iID, $sTags, $sType)
{
$aTags = explodeTags($sTags);
db_res("DELETE FROM `sys_tags` WHERE `ID` = ? AND `Type` = ?", [$iID, $sType]);
//re-store if exist
foreach ($aTags as $sTag) {
$sTag = addslashes($sTag);
db_res("INSERT INTO `sys_tags` VALUES ( ?, ?, ?, CURRENT_TIMESTAMP )", [$sTag, $iID, $sType]);
}
}
示例9: storeTags
function storeTags($iID, $sTags, $sType)
{
$aTags = explodeTags($sTags);
db_res("DELETE FROM `sys_tags` WHERE `ID` = {$iID} AND `Type` = '{$sType}'");
//re-store if exist
foreach ($aTags as $sTag) {
$sTag = addslashes($sTag);
db_res("INSERT INTO `sys_tags` VALUES ( '{$sTag}', {$iID}, '{$sType}', CURRENT_TIMESTAMP )", 0);
}
}
示例10: MemberEditNews
function MemberEditNews()
{
global $max_l;
global $max_h;
$news_id = (int) $_POST['edit_id'];
$news_text = strlen($_POST['text']) > $max_l ? "LEFT ( '" . process_db_input($_POST['text']) . "', {$max_l} )" : "'" . process_db_input($_POST['text']) . "'";
$news_header = strlen($_POST['header']) > $max_h ? "LEFT ( '" . process_db_input($_POST['header']) . "', {$max_h} )" : "'" . process_db_input($_POST['header']) . "'";
$news_snippet = "'" . process_db_input($_POST['snippet']) . "'";
$res = db_res("UPDATE `News` SET `Date` = NOW(), `Header` = {$news_header}, `Text` = {$news_text}, `Snippet`={$news_snippet} WHERE `ID` = {$news_id}");
return $res;
}
示例11: generateUserNewPwd
function generateUserNewPwd($ID)
{
$sPwd = genRndPwd();
$sSalt = genRndSalt();
$sQuery = "\n UPDATE `Profiles`\n SET\n `Password` = '" . encryptUserPwd($sPwd, $sSalt) . "',\n `Salt` = '{$sSalt}'\n WHERE\n `ID`='{$ID}'\n ";
db_res($sQuery);
createUserDataFile($ID);
require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php';
$oZ = new BxDolAlerts('profile', 'edit', $ID);
$oZ->alert();
return $sPwd;
}
示例12: setTemplate
/**
* Update existing or create new template ;
*
* @param $sTemplateName (string) - name of template ;
* @param $sTemplateSubj (string) - subject of template ;
* @param $sTemplateBody (string) - text of template ;
* @param $iLangID (integer) - needed language's ID;
* @return HTML presentation data ;
*/
function setTemplate($sTemplateName, $sTemplateSubj, $sTemplateBody, $iLangID)
{
if (!db_value("SELECT `ID` FROM `sys_email_templates` WHERE `Name` = '" . process_db_input($sTemplateName) . "' AND `LangID` = '{$iLangID}'")) {
$sQuery = " \r\n\t\t\t\tINSERT INTO \r\n\t\t\t\t\t`sys_email_templates` (`Name`, `Subject`, `Body`, `LangID`) \r\n\t\t\t\tVALUES\r\n\t\t\t\t\t(\r\n\t\t\t\t\t\t'" . process_db_input($sTemplateName) . "', \r\n\t\t\t\t\t\t'" . process_db_input($sTemplateSubj) . "',\r\n\t\t\t\t\t\t'" . process_db_input($sTemplateBody) . "',\r\n\t\t\t\t\t\t'" . (int) $iLangID . "'\r\n\t\t\t\t\t)\r\n\t\t\t";
$sMessage = 'Template was created';
} else {
$sQuery = " \r\n\t\t\t\tUPDATE \r\n\t\t\t\t\t`sys_email_templates` \r\n\t\t\t\tSET \r\n\t\t\t\t\t`Subject` = '" . process_db_input($sTemplateSubj) . "',\r\n\t\t\t\t\t`Body` = '" . process_db_input($sTemplateBody) . "'\r\n\t\t\t\tWHERE \r\n\t\t\t\t\t`Name` = '" . process_db_input($sTemplateName) . "'\r\n\t\t\t\t\t\tAND\r\n\t\t\t\t\t`LangID` = '" . (int) $iLangID . "'\r\n\t\t\t\tLIMIT 1 \r\n\t\t\t";
$sMessage = 'Template was updated';
}
db_res($sQuery);
return $this->genTemplatesForm($sTemplateName, $iLangID, $sMessage);
}
示例13: setTemplate
/**
* Update existing or create new template ;
*
* @param $sTemplateName (string) - name of template ;
* @param $sTemplateSubj (string) - subject of template ;
* @param $sTemplateBody (string) - text of template ;
* @param $iLangID (integer) - needed language's ID;
* @return HTML presentation data ;
*/
function setTemplate($sTemplateName, $sTemplateSubj, $sTemplateBody, $iLangID)
{
if (!db_value("SELECT `ID` FROM `sys_email_templates` WHERE `Name` = '" . process_db_input($sTemplateName) . "' AND `LangID` = '{$iLangID}'")) {
$sQuery = "\n INSERT INTO\n `sys_email_templates` (`Name`, `Subject`, `Body`, `LangID`)\n VALUES\n (\n '" . process_db_input($sTemplateName) . "',\n '" . process_db_input($sTemplateSubj) . "',\n '" . process_db_input($sTemplateBody) . "',\n '" . (int) $iLangID . "'\n )\n ";
$sMessage = 'Template was created';
} else {
$sQuery = "\n UPDATE\n `sys_email_templates`\n SET\n `Subject` = '" . process_db_input($sTemplateSubj) . "',\n `Body` = '" . process_db_input($sTemplateBody) . "'\n WHERE\n `Name` = '" . process_db_input($sTemplateName) . "'\n AND\n `LangID` = '" . (int) $iLangID . "'\n LIMIT 1\n ";
$sMessage = 'Template was updated';
}
db_res($sQuery);
return $this->genTemplatesForm($sTemplateName, $iLangID, $sMessage);
}
示例14: getFriendRequests
function getFriendRequests($sUser, $sPwd, $sLang)
{
if (!($iId = BxDolXMLRPCUtil::checkLogin($sUser, $sPwd))) {
return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1, "int")), "struct"));
}
BxDolXMLRPCUtil::setLanguage($sLang);
$r = db_res("\n SELECT `Profiles`.* FROM `sys_friend_list`\n LEFT JOIN `Profiles` ON `Profiles`.`ID` = `sys_friend_list`.`ID`\n WHERE `sys_friend_list`.`Profile` = {$iId} AND `Check` = 0\n ORDER BY `Profiles`.`NickName` ASC");
$aProfiles = array();
while ($aRow = $r->fetch()) {
$aProfiles[] = new xmlrpcval(BxDolXMLRPCUtil::fillProfileArray($aRow, 'thumb'), 'struct');
}
return new xmlrpcval($aProfiles, "array");
}
示例15: getProfileInfoExtra
function getProfileInfoExtra()
{
$aRet = array();
$r = db_res("SELECT `pc`.`Caption`, `pc`.`Content` FROM `sys_profile_fields` AS `pf` INNER JOIN `sys_page_compose` AS `pc` ON (`pc`.`Func` = 'PFBlock' AND `pc`.`Content` = `pf`.`ID`) WHERE `pc`.`Page` = 'profile' AND `pf`.`Type` = 'block' AND `pc`.`Column` != 0 ORDER BY `pc`.`Column`, `pc`.`Order`");
while ($a = mysql_fetch_array($r)) {
$aBlock = $this->getProfileInfoBlock($a['Caption'], $a['Content']);
if (false === $aBlock) {
continue;
}
$aRet[] = $aBlock;
}
return new xmlrpcval($aRet, "array");
}