本文整理汇总了PHP中gdo_db函数的典型用法代码示例。如果您正苦于以下问题:PHP gdo_db函数的具体用法?PHP gdo_db怎么用?PHP gdo_db使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gdo_db函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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 '';
}
示例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 '';
}
示例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);
}
示例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 '';
}
示例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 '';
}
示例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 '';
}
示例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 '';
}
示例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 '';
}
示例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 '';
}
示例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 '';
}
示例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;
}