本文整理汇总了PHP中gdo_db函数的典型用法代码示例。如果您正苦于以下问题:PHP gdo_db函数的具体用法?PHP gdo_db怎么用?PHP gdo_db使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gdo_db函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: core
public static function core($drop = false, &$success)
{
$db = gdo_db();
$tables = self::get_core_tables();
$success = true;
$ret = '<br/><br/>';
foreach ($tables as $classname) {
$ret .= sprintf("Installing %s table ... ", $classname);
if (false === ($result = GDO::table($classname)->createTable($drop))) {
#error
$ret .= '<b class="gwfinstallno">FAILED!<br/>' . PHP_EOL;
$success = false;
} else {
#success
$ret .= '<b class="gwfinstallyes">OK</b><br/>' . PHP_EOL;
}
}
$ret .= '<br/>';
/** Try to set a birthdate **/
if (false === GWF_Settings::getSetting('gwf_site_birthday', false)) {
$ret .= sprintf("Setting up a birthdate ... %s.", date('Ymd'));
if (false === GWF_Settings::setSetting('gwf_site_birthday', date('Ymd'))) {
$ret .= '<b class="gwfinstallno">Cannot set site birthdate.<br/>' . PHP_EOL;
$success = false;
}
}
return $ret;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:28,代码来源:GWF_InstallFunctions.php
示例2: getAllDescr
public static function getAllDescr()
{
$browser_lid = GWF_Language::getCurrentID();
$sites = GWF_TABLE_PREFIX . 'wc_site';
$descr = GWF_TABLE_PREFIX . 'wc_site_descr';
$db = gdo_db();
$back = array();
$query = "SELECT site_id, site_desc_txt FROM {$sites} JOIN {$descr} ON site_desc_sid=site_id WHERE site_desc_lid={$browser_lid}";
if (false === ($result = $db->queryRead($query))) {
return array();
}
while (false !== ($row = $db->fetchRow($result))) {
$back[(int) $row[0]] = $row[1];
}
$db->free($result);
$query = "SELECT site_id, site_desc_txt FROM {$sites} JOIN {$descr} ON site_desc_sid=site_id WHERE site_desc_lid=site_descr_lid";
if (false === ($result = $db->queryRead($query))) {
return array();
}
while (false !== ($row = $db->fetchRow($result))) {
$sid = (int) $row[0];
if (!isset($back[$sid])) {
$back[$sid] = $row[1];
}
}
$db->free($result);
return $back;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:28,代码来源:WC_SiteDescr.php
示例3: selectUsers
/**
* Select Users For Global Ranking.
* @param int $count
* @param int $from
* @return array
*/
private function selectUsers($count, $from)
{
$db = gdo_db();
$count = (int) $count;
$from = (int) $from;
$regat = GDO::table('WC_RegAt')->getTableName();
$users = GDO::table('GWF_User')->getTableName();
$query = "SELECT user_id,user_name,user_level,SUM(regat_score) AS lts, COUNT(regat_score) AS nlinks, regat_langid,user_countryid FROM {$regat} AS B JOIN (SELECT user_id,user_name,user_level,user_countryid FROM {$users} WHERE user_options&0x10000000=0 ORDER BY user_level DESC, user_id ASC LIMIT {$from}, {$count}) AS C ON user_id=regat_uid GROUP by user_id,regat_langid ORDER BY user_level DESC, user_id ASC";
$back = array();
if (false === ($result = $db->queryRead($query))) {
return $back;
}
$current = false;
while (false !== ($row = $db->fetchAssoc($result))) {
if ($current === false) {
$current = new GWF_User($row);
$current->setVar('nlinks', 0);
$back[] = $current;
} elseif ($current->getVar('user_id') !== $row['user_id']) {
if (count($back) === $count) {
break;
}
$current = new GWF_User($row);
$current->setVar('nlinks', 0);
$back[] = $current;
}
$current->setVar('grank_' . $row['regat_langid'], $row['lts']);
$current->setVar('nlinks', $current->getVar('nlinks') + $row['nlinks']);
// var_dump($current->getGDOData());
}
$db->free($result);
// var_dump($back);
return $back;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:40,代码来源:Ranking.php
示例4: smarty_resource_db_timestamp
function smarty_resource_db_timestamp($tpl_name, &$tpl_timestamp, $smarty)
{
$query = 'SELECT page_time t FROM ' . GWF_TABLE_PREFIX . 'page WHERE page_id=' . (int) $tpl_name;
if (false === ($result = gdo_db()->queryFirst($query))) {
$tpl_timestamp = time();
return false;
}
$tpl_timestamp = time();
// $tpl_timestamp = $result['t'];
return true;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:11,代码来源:resource.db.php
示例5: Upgrade_Profile_1_02
function Upgrade_Profile_1_02(Module_Profile $module)
{
$db = gdo_db();
$profile = GWF_TABLE_PREFIX . 'profile';
$query = "ALTER TABLE {$profile} ADD COLUMN prof_poi_score INT(11) DEFAULT 0";
if (false === $db->queryWrite($query)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
echo GWF_HTML::message('Profile', '[+] Profile POI Score', false);
return '';
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:11,代码来源:Upgrade_Profile_1_02.php
示例6: Upgrade_PageBuilder_1_01
function Upgrade_PageBuilder_1_01(Module_PageBuilder $module)
{
$db = gdo_db();
$page = GWF_TABLE_PREFIX . 'page';
$query = "ALTER TABLE {$page} DROP COLUMN `page_menu_pos`";
$addcol = "ALTER TABLE {$page} ADD COLUMN `page_inline_css` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL";
if (false === $db->queryWrite($query) || false === $db->queryWrite($addcol)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return '';
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:11,代码来源:Upgrade_PageBuilder_1_01.php
示例7: warscore_function
function warscore_function($socket, $pid)
{
# Init GWF
$gwf = new GWF3(getcwd(), array('website_init' => false, 'autoload_modules' => false, 'load_module' => false, 'start_debug' => true, 'get_user' => false, 'log_request' => false, 'no_session' => true, 'store_last_url' => false, 'ignore_user_abort' => false));
gdo_db();
GWF_Debug::setDieOnError(false);
GWF_HTML::init();
if (false === ($wechall = GWF_Module::loadModuleDB('WeChall', true, true, true))) {
warscore_error($socket, 'Cannot load WeChall!');
}
$wechall->includeClass('WC_Warbox');
$wechall->includeClass('WC_WarToken');
$wechall->includeClass('WC_Warflag');
$wechall->includeClass('WC_Warflags');
$wechall->includeClass('sites/warbox/WCSite_WARBOX');
if (false === ($input = socket_read($socket, 2048))) {
warscore_error($socket, 'Read Error 1!');
}
warscore_debug("GOT INPUT: {$input}");
if (false === ($username = Common::substrUntil($input, "\n", false))) {
warscore_error($socket, 'No username sent!');
}
if (false === ($user = GWF_User::getByName($username))) {
warscore_error($socket, 'Unknown user!');
}
warscore_debug("GOT USER: {$username}");
if ('' === ($token = Common::substrFrom($input, "\n", ''))) {
warscore_error($socket, 'No token sent!');
}
$token = trim(Common::substrUntil($token, "\n", $token));
if (!WC_WarToken::isValidWarToken($user, $token)) {
warscore_error($socket, 'Invalid Token!');
}
if (!socket_getpeername($socket, $client_ip, $client_port)) {
warscore_error($socket, 'Socket Error 2!');
}
echo "{$client_ip}\n";
$boxes = WC_Warbox::getByIP($client_ip);
if (count($boxes) === 0) {
warscore_error($socket, 'Unknown Warbox!');
}
warscore_debug("GOT N BOXES: " . count($boxes));
$curr_port = 0;
foreach ($boxes as $box) {
$box instanceof WC_Warbox;
if ($curr_port !== $box->getVar('wb_port')) {
$curr_port = $box->getVar('wb_port');
warscore_identd($socket, $box, $user, $client_ip, $client_port);
}
}
socket_write($socket, 'Bailing out! You should not see me.');
socket_close($socket);
die(0);
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:54,代码来源:warserver.php
示例8: Upgrade_GWF_1_04
function Upgrade_GWF_1_04(Module_GWF $module)
{
$db = gdo_db();
$country = GWF_TABLE_PREFIX . 'country';
$query = "ALTER TABLE {$country} ADD COLUMN country_pop INT(11) UNSIGNED NOT NULL DEFAULT 0";
if (false === $db->queryWrite($query)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
GWF_HTML::message('GWF', '[+] GWF 1.04 (country population)', true, true);
return '';
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:11,代码来源:Upgrade_GWF_1_04.php
示例9: Upgrade_Profile_1_01
function Upgrade_Profile_1_01(Module_Profile $module)
{
$db = gdo_db();
$profile = GWF_TABLE_PREFIX . 'profile';
$query = "ALTER TABLE {$profile} ADD COLUMN prof_irc VARCHAR(255) CHARACTER SET ascii COLLATE ascii_bin";
if (false === $db->queryWrite($query)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
echo GWF_HTML::message('Profile', '[+] Profile IRC', false);
return '';
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:11,代码来源:Upgrade_Profile_1_01.php
示例10: Upgrade_WeChall_1_06
function Upgrade_WeChall_1_06(Module_WeChall $module)
{
GWF_Website::addDefaultOutput(GWF_HTML::message('WC5', "Regat table now stores challs_solved. (thx Jinx)"));
$db = gdo_db();
$regat = GWF_TABLE_PREFIX . 'wc_regat';
$query = "ALTER TABLE {$regat} ADD COLUMN regat_challsolved INT(11) NOT NULL DEFAULT -1";
if (false === $db->queryWrite($query)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return '';
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:11,代码来源:Upgrade_WeChall_1_06.php
示例11: Upgrade_Account_1_03
function Upgrade_Account_1_03(Module_Account $module)
{
var_dump('TRIGGERED Upgrade_Account_1_03');
var_dump('The token entropy has been raised from 8 chars to 24.');
$db = gdo_db();
$accc = GWF_TABLE_PREFIX . 'accchange';
$query = "ALTER TABLE {$accc} MODIFY COLUMN token VARCHAR(24) CHARACTER SET ascii COLLATE ascii_bin";
if (false === $db->queryWrite($query)) {
return GWF_HTML::err('ERR_DATABASE', __FILE__, __LINE__);
}
return '';
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:12,代码来源:Upgrade_Account_1_03.php
示例12: Upgrade_GWF_1_02
function Upgrade_GWF_1_02(Module_GWF $module)
{
var_dump('TRIGGERED Upgrade GWF1.02 (Supported Language Flag)');
$db = gdo_db();
# NEW: Module options
$lang = GWF_TABLE_PREFIX . 'language';
$query = "ALTER TABLE {$lang} ADD COLUMN lang_options INT(11) UNSIGNED NOT NULL DEFAULT 0";
if (false === $db->queryWrite($query)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return '';
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:12,代码来源:Upgrade_GWF_1_02.php
示例13: Upgrade_PM_1_05
function Upgrade_PM_1_05(Module_PM $module)
{
echo GWF_HTML::message('PM', 'Triggering Upgrade_PM_1_05');
echo GWF_HTML::message('PM', 'PMO_user_level');
$db = gdo_db();
$pmo = GWF_TABLE_PREFIX . 'pm_options';
$query = "ALTER TABLE {$pmo} ADD COLUMN pmo_level INT(11) UNSIGNED DEFAULT 0";
if (false === $db->queryWrite($query)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return '';
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:12,代码来源:Upgrade_PM_1_05.php
示例14: Upgrade_PM_1_04
function Upgrade_PM_1_04(Module_PM $module)
{
echo GWF_HTML::message('PM', 'Triggering Upgrade_PM_1_04');
echo GWF_HTML::message('PM', 'PM ignore reasons');
$db = gdo_db();
$pmi = GWF_TABLE_PREFIX . 'pm_ignore';
$query = "ALTER TABLE {$pmi} ADD COLUMN pmi_reason TEXT CHARACTER SET utf8 COLLATE utf8_general_ci";
if (false === $db->queryWrite($query)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return '';
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:12,代码来源:Upgrade_PM_1_04.php
示例15: module_PageBuilder_monthly
function module_PageBuilder_monthly()
{
require_once GWF_CORE_PATH . 'module/PageBuilder/GWF_Page.php';
$enabled = GWF_Page::ENABLED;
$langid = GWF_Language::getCurrentID();
$db = gdo_db();
$t = GWF_TABLE_PREFIX . 'page';
$query = "SELECT IFNULL(p2.page_otherid,p1.page_otherid), IFNULL(p2.page_title,p1.page_title), IFNULL(p2.page_url,p1.page_url), IFNULL(p2.page_date,p1.page_date) FROM {$t} p1 LEFT JOIN {$t} p2 ON p1.page_otherid=p2.page_otherid AND p2.page_lang={$langid} WHERE p1.page_lang=0 ORDER BY 4 DESC";
if (false === ($result = $db->queryRead($query))) {
return '';
}
$first = NULL;
$tree = array();
while (false !== ($page = $db->fetchRow($result))) {
if ($first === NULL) {
$first = $page;
}
monthlyAddTree($tree, $page);
}
$db->free($result);
if (count($tree) === 0) {
return '';
}
// $first = $pages[key($pages)];
$currdate = $first[3];
list($y, $m, $d) = monthlySplit($currdate);
$cy = $y;
$cm = $m;
$cd = $d;
// $tree = monthlyGetTree($pages);
$back = '<div class="gwf_pb_monthly fr">' . PHP_EOL;
foreach ($tree as $year => $y2) {
$c = count($y2);
$back .= "<ol id=\"_pby{$year}\"><li>{$year}({$c})</li>\n";
foreach ($y2 as $m1 => $m2) {
$c = count($m2);
$month = GWF_HTML::lang('M' . ($m1 + 0));
$back .= "<li>{$year} {$month} ({$c})<ol>\n";
foreach ($m2 as $page) {
$url = htmlspecialchars(GWF_WEB_ROOT . $page[2]);
$title = htmlspecialchars($page[1]);
$back .= "<li><a href=\"{$url}\" title=\"{$title}\">{$title}</a></li>\n";
}
$back .= "</ol></li>\n";
}
$back .= "</ol>\n";
}
$back .= '</div>' . PHP_EOL;
return $back;
echo $back;
return;
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:52,代码来源:monthly.php
示例16: Upgrade_News_1_01
function Upgrade_News_1_01(Module_News $module)
{
if (false === gdo_db()->query('ALTER TABLE ' . GWF_TABLE_PREFIX . 'newstrans' . ' ADD COLUMN newst_threadid INT(11) UNSIGNED NOT NULL DEFAULT 0')) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
$msg = GWF_HTML::message('News', 'It is now possible to have news in forums.');
if (GWF_OUTPUT_BUFFERING) {
echo $msg;
} else {
GWF_Website::addDefaultOutput($msg);
}
return '';
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:13,代码来源:Upgrade_News_1_01.php
示例17: onMarkRead
private function onMarkRead()
{
$user = GWF_Session::getUser();
$userid = $user->getID();
$sites = GWF_TABLE_PREFIX . 'wc_site';
$regat = GWF_TABLE_PREFIX . 'wc_regat';
$query = "UPDATE {$regat} JOIN {$sites} ON regat_sid=site_id SET regat_challcount=site_challcount WHERE regat_uid={$userid}";
$db = gdo_db();
if (false === $db->queryWrite($query)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return $this->module->message('msg_challs_marked');
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:13,代码来源:ChallNewsRead.php
示例18: Upgrade_GWF_3_04
function Upgrade_GWF_3_04(Module_GWF $module)
{
echo GWF_HTML::message('GWF', 'Triggering Upgrade_GWF_3_04');
echo GWF_HTML::message('GWF', 'The email field in user database is now UTF8.');
$db = gdo_db();
$users = GWF_TABLE_PREFIX . 'user';
$query = "ALTER TABLE `{$users}` CHANGE `user_email` `user_email` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
if (false === $db->queryWrite($query)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
$modules = GWF_TABLE_PREFIX . 'module';
$query = "ALTER TABLE `{$modules}` ADD UNIQUE `module_name` ( `module_name` )";
return '';
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:14,代码来源:Upgrade_GWF_3_04.php
示例19: single
public static function single($name = 'country', $selected = '0')
{
$db = gdo_db();
$table = GDO::table('GWF_Country');
if (false === ($result = $table->select('country_id,country_name', '', 'country_name ASC'))) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
$data = array(array('0', GWF_HTML::lang('sel_country')));
while (false !== ($row = $db->fetchRow($result))) {
$data[] = $row;
}
$db->free($result);
return GWF_Select::display($name, $data, $selected);
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:14,代码来源:GWF_CountrySelect.php
示例20: Upgrade_WeChall_1_03
function Upgrade_WeChall_1_03(Module_WeChall $module)
{
$db = gdo_db();
$sites = GWF_TABLE_PREFIX . 'wc_site';
$query = "ALTER TABLE {$sites} ADD COLUMN site_spc INT(11) UNSIGNED NOT NULL DEFAULT 25";
if (false === $db->queryWrite($query)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
$query = "ALTER TABLE {$sites} ADD COLUMN site_powarg INT(11) UNSIGNED NOT NULL DEFAULT 100";
if (false === $db->queryWrite($query)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
GWF_HTML::message('WC', '[+] Advanced Scoring by Caesum', true, true);
return '';
}
开发者ID:sinfocol,项目名称:gwf3,代码行数:15,代码来源:Upgrade_WeChall_1_03.php
注:本文中的gdo_db函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论