本文整理汇总了PHP中dbi_fetch_row函数的典型用法代码示例。如果您正苦于以下问题:PHP dbi_fetch_row函数的具体用法?PHP dbi_fetch_row怎么用?PHP dbi_fetch_row使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbi_fetch_row函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_palm_events
function delete_palm_events($login)
{
$res = dbi_query("SELECT cal_id FROM webcal_import_data " . "WHERE cal_login = '{$login}'");
if ($res) {
while ($row = dbi_fetch_row($res)) {
dbi_query("DELETE FROM webcal_entry_user WHERE cal_id = {$row['0']}");
dbi_query("DELETE FROM webcal_entry_repeats WHERE cal_id = {$row['0']}");
dbi_query("DELETE FROM webcal_entry_repeats_not WHERE cal_id = {$row['0']}");
dbi_query("DELETE FROM webcal_entry_log WHERE cal_entry_id = {$row['0']}");
dbi_query("DELETE FROM webcal_site_extras WHERE cal_id = {$row['0']}");
dbi_query("DELETE FROM webcal_reminder_log WHERE cal_id = {$row['0']}");
dbi_query("DELETE FROM webcal_import_data WHERE cal_id = {$row['0']}");
dbi_query("DELETE FROM webcal_entry WHERE cal_id = {$row['0']}");
}
}
dbi_free_result($res);
return 1;
}
示例2: check_email
function check_email($uemail)
{
global $control, $error;
if (!strlen($uemail)) {
$error = translate('Email address cannot be blank.');
return false;
}
$res = dbi_execute('SELECT cal_email FROM webcal_user WHERE cal_email = ?', array($uemail));
if ($res) {
$row = dbi_fetch_row($res);
if ($row[0] == $uemail) {
$control = '';
$error = translate('Email address already exists.');
return false;
}
}
return true;
}
示例3: db_load_config
function db_load_config()
{
global $webcalConfig;
while (list($key, $val) = each($webcalConfig)) {
$res = dbi_execute('SELECT cal_value FROM webcal_config
WHERE cal_setting = ?', array($key), false, false);
$sql = 'INSERT INTO webcal_config ( cal_setting, cal_value ) VALUES (?,?)';
if (!$res) {
dbi_execute($sql, array($key, $val));
} else {
// SQLite returns $res always.
$row = dbi_fetch_row($res);
if (!isset($row[0])) {
dbi_execute($sql, array($key, $val));
}
dbi_free_result($res);
}
}
}
示例4: delete_palm_events
function delete_palm_events($login)
{
$res = dbi_execute('SELECT cal_id FROM webcal_import_data
WHERE cal_login = ? AND cal_import_type = ?', array($login, 'palm'));
if ($res) {
while ($row = dbi_fetch_row($res)) {
dbi_execute('DELETE FROM webcal_blob WHERE cal_id = ?', array($row[0]));
dbi_execute('DELETE FROM webcal_entry_log WHERE cal_entry_id = ?', array($row[0]));
dbi_execute('DELETE FROM webcal_entry_repeats WHERE cal_id = ?', array($row[0]));
dbi_execute('DELETE FROM webcal_entry_repeats_not WHERE cal_id = ?', array($row[0]));
dbi_execute('DELETE FROM webcal_import_data WHERE cal_id = ?', array($row[0]));
dbi_execute('DELETE FROM webcal_reminders WHERE cal_id = ?', array($row[0]));
dbi_execute('DELETE FROM webcal_site_extras WHERE cal_id = ?', array($row[0]));
dbi_execute('DELETE FROM webcal_entry_user WHERE cal_id = ?', array($row[0]));
dbi_execute('DELETE FROM webcal_entry WHERE cal_id = ?', array($row[0]));
}
}
dbi_free_result($res);
return 1;
}
示例5: save_layer
function save_layer($layer_user, $layeruser, $layercolor, $dups, $id)
{
global $error, $layers;
if ($layer_user == $layeruser) {
$error = translate('You cannot create a layer for yourself.');
}
load_user_layers($layer_user, 1);
if (!empty($layeruser) && $error == '') {
// Existing layer entry.
if (!empty($layers[$id]['cal_layeruser'])) {
// Update existing layer entry for this user.
$layerid = $layers[$id]['cal_layerid'];
dbi_execute('UPDATE webcal_user_layers SET cal_layeruser = ?,
cal_color = ?, cal_dups = ? WHERE cal_layerid = ?', array($layeruser, $layercolor, $dups, $layerid));
} else {
// New layer entry.
// Check for existing layer for user. Can only have one layer per user.
$res = dbi_execute('SELECT COUNT( cal_layerid ) FROM webcal_user_layers
WHERE cal_login = ? AND cal_layeruser = ?', array($layer_user, $layeruser));
if ($res) {
$row = dbi_fetch_row($res);
if ($row[0] > 0) {
$error = translate('You can only create one layer for each user.');
}
dbi_free_result($res);
}
if ($error == '') {
$res = dbi_execute('SELECT MAX( cal_layerid ) FROM webcal_user_layers');
if ($res) {
$row = dbi_fetch_row($res);
$layerid = $row[0] + 1;
} else {
$layerid = 1;
}
dbi_execute('INSERT INTO webcal_user_layers ( cal_layerid, cal_login,
cal_layeruser, cal_color, cal_dups ) VALUES ( ?, ?, ?, ?, ? )', array($layerid, $layer_user, $layeruser, $layercolor, $dups));
}
}
}
}
示例6: doDbSanityCheck
function doDbSanityCheck()
{
global $db_database, $db_host, $db_login;
$dieMsgStr = 'Error finding WebCalendar tables in database "' . $db_database . '" using db login "' . $db_login . '" on db server "' . $db_host . '".<br /><br />
Have you created the database tables as specified in the
<a href="docs/WebCalendar-SysAdmin.html" ' . ' target="other">WebCalendar System Administrator\'s Guide</a>?';
$res = @dbi_execute('SELECT COUNT( cal_value ) FROM webcal_config', array(), false, false);
if ($res) {
if ($row = dbi_fetch_row($res)) {
// Found database. All is peachy.
dbi_free_result($res);
} else {
// Error accessing table.
// User has wrong db name or has not created tables.
// Note: can't translate this since translate.php is not included yet.
dbi_free_result($res);
die_miserable_death($dieMsgStr);
}
} else {
die_miserable_death($dieMsgStr);
}
}
示例7: doDbSanityCheck
function doDbSanityCheck()
{
global $db_login, $db_host, $db_database;
$res = @dbi_query("SELECT COUNT(cal_value) FROM webcal_config", false, false);
if ($res) {
if ($row = dbi_fetch_row($res)) {
// Found database. All is peachy.
dbi_free_result($res);
} else {
// Error accessing table.
// User has wrong db name or has not created tables.
// Note: cannot translate this since we have not included
// translate.php yet.
dbi_free_result($res);
die_miserable_death("Error finding WebCalendar tables in database '{$db_database}' " . "using db login '{$db_login}' on db server '{$db_host}'.<br/><br/>\n" . "Have you created the database tables as specified in the " . "<a href=\"docs/WebCalendar-SysAdmin.html\" target=\"other\">WebCalendar " . "System Administrator's Guide</a>?");
}
} else {
// Error accessing table.
// User has wrong db name or has not created tables.
// Note: cannot translate this since we have not included translate.php yet.
die_miserable_death("Error finding WebCalendar tables in database '{$db_database}' " . "using db login '{$db_login}' on db server '{$db_host}'.<br/><br/>\n" . "Have you created the database tables as specified in the " . "<a href=\"docs/WebCalendar-SysAdmin.html\" target=\"other\">WebCalendar " . "System Administrator's Guide</a>?");
}
}
示例8: get_ids
function get_ids($sql, $ALL = '')
{
global $sqlLog;
$ids = array();
$sqlLog .= $sql . "<br />\n";
$res = dbi_execute($sql);
if ($res) {
while ($row = dbi_fetch_row($res)) {
if ($ALL == 1) {
$ids[] = $row[0];
} else {
//ONLY Delete event if no other participants.
$ID = $row[0];
$res2 = dbi_execute('SELECT COUNT( * ) FROM webcal_entry_user
WHERE cal_id = ?', array($ID));
if ($res2) {
if ($row2 = dbi_fetch_row($res2)) {
if ($row2[0] == 1) {
$ids[] = $ID;
}
}
dbi_free_result($res2);
}
}
// End if ($ALL)
}
// End while
}
dbi_free_result($res);
return $ids;
}
示例9: user_get_users
/**
* Get a list of users and return info in an array.
*
* @return array Array of user info
*/
function user_get_users($publicOnly = false)
{
global $PUBLIC_ACCESS, $PUBLIC_ACCESS_FULLNAME, $USER_SORT_ORDER;
$count = 0;
$ret = array();
if ($PUBLIC_ACCESS == 'Y') {
$ret[$count++] = array('cal_login' => '__public__', 'cal_lastname' => '', 'cal_firstname' => '', 'cal_is_admin' => 'N', 'cal_email' => '', 'cal_password' => '', 'cal_fullname' => $PUBLIC_ACCESS_FULLNAME);
}
if ($publicOnly) {
return $ret;
}
0 - ($order1 = empty($USER_SORT_ORDER) ? 'cal_lastname, cal_firstname,' : "{$USER_SORT_ORDER},");
$res = dbi_execute('SELECT cal_login, cal_lastname, cal_firstname,
cal_is_admin, cal_email, cal_passwd FROM webcal_user
ORDER BY $order1 cal_login');
if ($res) {
while ($row = dbi_fetch_row($res)) {
if (strlen($row[1]) && strlen($row[2])) {
$fullname = $order1 == 'cal_lastname, cal_firstname,' ? "{$row['1']} {$row['2']}" : "{$row['2']} {$row['1']}";
} else {
$fullname = $row[0];
}
$ret[$count++] = array('cal_login' => $row[0], 'cal_lastname' => $row[1], 'cal_firstname' => $row[2], 'cal_is_admin' => $row[3], 'cal_email' => empty($row[4]) ? '' : $row[4], 'cal_password' => $row[5], 'cal_fullname' => $fullname);
}
dbi_free_result($res);
}
//no need to call sort_users () as the sql can sort for us
return $ret;
}
示例10: user_get_users
function user_get_users()
{
global $public_access, $PUBLIC_ACCESS_FULLNAME;
$count = 0;
$ret = array();
if ($public_access == "Y") {
$ret[$count++] = array("cal_login" => "__public__", "cal_lastname" => "", "cal_firstname" => "", "cal_is_admin" => "N", "cal_email" => "", "cal_password" => "", "cal_fullname" => $PUBLIC_ACCESS_FULLNAME);
}
$res = dbi_query("SELECT cal_login, cal_lastname, cal_firstname, " . "cal_is_admin, cal_email, cal_passwd FROM webcal_user " . "ORDER BY cal_lastname, cal_firstname, cal_login");
if ($res) {
while ($row = dbi_fetch_row($res)) {
if (strlen($row[1]) && strlen($row[2])) {
$fullname = "{$row['2']} {$row['1']}";
} else {
$fullname = $row[0];
}
$ret[$count++] = array("cal_login" => $row[0], "cal_lastname" => $row[1], "cal_firstname" => $row[2], "cal_is_admin" => $row[3], "cal_email" => empty($row[4]) ? "" : $row[4], "cal_password" => $row[5], "cal_fullname" => $fullname);
}
dbi_free_result($res);
}
return $ret;
}
示例11: process_event
function process_event($id, $name, $event_date, $event_time)
{
global $site_extras, $debug, $only_testing;
global $EXTRA_REMINDER_WITH_OFFSET, $EXTRA_REMINDER_WITH_DATE;
if ($debug) {
printf("Event %d: \"%s\" at %s on %s <br />\n", $id, $name, $event_time, $event_date);
}
// Check to see if this event has any reminders
$extras = get_site_extra_fields($id);
for ($j = 0; $j < count($site_extras); $j++) {
$extra_name = $site_extras[$j][0];
$extra_type = $site_extras[$j][2];
$extra_arg1 = $site_extras[$j][3];
$extra_arg2 = $site_extras[$j][4];
//if ( $debug )
// printf ( " name: %s\n type: %d\n arg1: %s\n arg2: %s\n",
// $extra_name, $extra_type, $extra_arg1, $extra_arg2 );
if (!empty($extras[$extra_name]['cal_remind'])) {
if ($debug) {
echo " Reminder set for event. <br />\n";
}
// how many minutes before event should we send the reminder?
$ev_h = (int) ($event_time / 10000);
$ev_m = $event_time / 100 % 100;
$ev_year = substr($event_date, 0, 4);
$ev_month = substr($event_date, 4, 2);
$ev_day = substr($event_date, 6, 2);
$event_time = mktime($ev_h, $ev_m, 0, $ev_month, $ev_day, $ev_year);
if (($extra_arg2 & $EXTRA_REMINDER_WITH_OFFSET) > 0) {
$minsbefore = $extras[$extra_name]['cal_data'];
$remind_time = $event_time - $minsbefore * 60;
} else {
if (($extra_arg2 & $EXTRA_REMINDER_WITH_DATE) > 0) {
$rd = $extras[$extra_name]['cal_date'];
$r_year = substr($rd, 0, 4);
$r_month = substr($rd, 4, 2);
$r_day = substr($rd, 6, 2);
$remind_time = mktime(0, 0, 0, $r_month, $r_day, $r_year);
} else {
$minsbefore = $extra_arg1;
$remind_time = $event_time - $minsbefore * 60;
}
}
if ($debug) {
echo " Mins Before: {$minsbefore} <br />\n";
}
if ($debug) {
echo " Event time is: " . date("m/d/Y H:i", $event_time) . "<br />\n";
echo " Remind time is: " . date("m/d/Y H:i", $remind_time) . "<br />\n";
}
if (time() >= $remind_time) {
// It's remind time or later. See if one has already been sent
$last_sent = 0;
$res = dbi_query("SELECT MAX(cal_last_sent) FROM " . "webcal_reminder_log WHERE cal_id = " . $id . " AND cal_event_date = {$event_date}" . " AND cal_name = '" . $extra_name . "'");
if ($res) {
if ($row = dbi_fetch_row($res)) {
$last_sent = $row[0];
}
dbi_free_result($res);
}
if ($debug) {
echo " Last sent on: " . date("m/d/Y H:i", $last_sent) . "<br />\n";
}
if ($last_sent < $remind_time) {
// Send a reminder
if ($debug) {
echo " SENDING REMINDER! <br />\n";
}
send_reminder($id, $event_date);
// now update the db...
log_reminder($id, $extra_name, $event_date);
}
}
}
}
}
示例12: get_users_event_ids
function get_users_event_ids($user)
{
$events = array();
$res = dbi_execute('SELECT we.cal_id FROM webcal_entry we, webcal_entry_user weu
WHERE we.cal_id = weu.cal_id AND weu.cal_login = ?', array($user));
if ($res) {
while ($row = dbi_fetch_row($res)) {
$events[] = $row[0];
}
}
return $events;
}
示例13: access_load_user_functions
function access_load_user_functions($user)
{
global $is_admin;
static $permissions;
if (!empty($permissions[$user])) {
return $permissions[$user];
}
$ret = '';
$rets = array();
$users = array($user, '__default__');
for ($i = 0, $cnt = count($users); $i < $cnt && empty($ret); $i++) {
$res = dbi_execute('SELECT cal_permissions FROM webcal_access_function
WHERE cal_login = ?', array($users[$i]));
assert('$res');
if ($row = dbi_fetch_row($res)) {
$rets[$users[$i]] = $row[0];
}
dbi_free_result($res);
}
// If still no setting found, then assume access to everything
// if an admin user, otherwise access to all non-admin functions.
if (!empty($rets[$user])) {
$ret = $rets[$user];
} else {
if (!empty($rets['__default__'])) {
$ret = $rets['__default__'];
} else {
for ($i = 0; $i < ACCESS_NUMBER_FUNCTIONS; $i++) {
$ret .= get_default_function_access($i, $user);
}
}
}
// do_debug ( $user . " " . $ret);
$permissions[$user] = $ret;
return $ret;
}
示例14: array
$user = $nid;
// Get event ids for all events this user is a participant
$events = array();
$res = dbi_query("SELECT webcal_entry.cal_id " . "FROM webcal_entry, webcal_entry_user " . "WHERE webcal_entry.cal_id = webcal_entry_user.cal_id " . "AND webcal_entry_user.cal_login = '{$user}'");
if ($res) {
while ($row = dbi_fetch_row($res)) {
$events[] = $row[0];
}
}
// Now count number of participants in each event...
// If just 1, then save id to be deleted
$delete_em = array();
for ($i = 0; $i < count($events); $i++) {
$res = dbi_query("SELECT COUNT(*) FROM webcal_entry_user " . "WHERE cal_id = " . $events[$i]);
if ($res) {
if ($row = dbi_fetch_row($res)) {
if ($row[0] == 1) {
$delete_em[] = $events[$i];
}
}
dbi_free_result($res);
}
}
// Now delete events that were just for this user
for ($i = 0; $i < count($delete_em); $i++) {
dbi_query("DELETE FROM webcal_entry WHERE cal_id = " . $delete_em[$i]);
}
// Delete user participation from events
dbi_query("DELETE FROM webcal_entry_user WHERE cal_login = '{$user}'");
// Delete any layers other users may have that point to this user.
dbi_query("DELETE FROM webcal_user_layers WHERE cal_layeruser = '{$user}'");
示例15: export_pilot_csv
function export_pilot_csv($id)
{
/* to be imported to a Palm with:
* pilot-datebook -r csv -f webcalendar-export.txt -w hotsync
*/
$res = export_get_event_entry($id);
echo "uid,attributes,category,untimed,beginDate,beginTime,endDate,endTime,description,note,alarm,advance,advanceUnit,repeatType,repeatForever,repeatEnd,repeatFrequency,repeatDay,repeatWeekdays,repeatWeekstart\n";
while ($row = dbi_fetch_row($res)) {
// uid (long)
echo $row[0], ',';
// attributes (int)
// 128 = 0x80 : Deleted
// 64 = 0x40 : Dirty
// 32 = 0x20 : Busy
// 16 = 0x10 : Secret/Private
echo $row[7] == 'R' ? '16,' : '0,';
// category (int: 0=Unfiled)
echo '0,';
// untimed (int: 0=Appointment, 1=Untimed)
// note: Palm "Untimed" is WebCalendar "AllDay"
if ($row[4] < 0) {
echo '1,', substr($row[3], 0, 4), '-', substr($row[3], 4, 2), '-', substr($row[3], 6, 2), ',00:00:00,', substr($row[3], 0, 4), '-', substr($row[3], 4, 2), '-', substr($row[3], 6, 2), ',00:00:00,';
} else {
echo '0,', pilot_date_time($row[3], $row[4], 0, ','), ',', pilot_date_time($row[3], $row[4], $row[8], ','), ',';
//endDate,endTime
}
//end if ( $row[4] < 0 )
// description (str)
echo '"', preg_replace("/\r?\n/", "\\n", $row[1]), '",';
// note (str)
echo '"', preg_replace("/\r?\n/", "\\n", $row[9]), '",';
// alarm, advance, advanceUnit
// alarm (int: 0=no alarm, 1=alarm)
// FIXME: verify if WebCal. DB interpreted correctly
// advance (int), advanceUnit (int: 0=minutes, 1=hours, 2=days)
// FIXME: better adjust unit
$ext = get_cal_ent_extras($row[0], 'webcal_site_extras', "cal_name = 'Reminder' AND cal_remind = 1");
if ($ext) {
echo '1,', $ext[5], ',0,';
} else {
echo '0,0,0,';
}
// repeat:
// repeatType (int: 0=none, 1=daily, 2=weekly, 3=monthly, 4=monthly/weekday,
// repeatForever (int: 0=not forever, 1=forever) 5=yearly)
// repeatEnd (time)
// repeatFrequency (int)
// repeatDay (int: day# or 0..6=Sun..Sat 1st, 7..13 2nd, 14..20 3rd,
// 21..27 4th, 28-34 last week)
// repeatWeekdays (int: add - 1=Sun,2=Mon,4=Tue,8=Wed,16=Thu,32=Fri,64=Sat)
// repeatWeekstart (int)
$ext = get_cal_ent_extras($row[0], 'webcal_entry_repeats');
if ($ext) {
switch ($ext[1]) {
case 'daily':
$repType = 1;
break;
case 'weekly':
$repType = 2;
break;
case 'monthlyByDate':
$repType = 3;
break;
case 'monthlyByDay':
$repType = 4;
break;
case 'yearly':
$repType = 5;
break;
default:
$repType = 0;
}
} else {
$repType = 0;
}
if ($repType) {
echo $repType, ',';
// repeatType
if ($ext[2]) {
echo '0,', substr($ext[2], 0, 4), '-', substr($ext[2], 4, 2), '-', substr($ext[2], 6, 2), ' 00:00:00,';
} else {
echo '1,,';
}
// repeatForever,repeatEnd
echo $ext[3], ',';
// repeatFrequency
switch ($repType) {
case 2:
// weekly
echo '0,', bindec(strtr(strrev($ext[4]), 'yn', '10')), ",1\n";
break;
case 3:
// monthly/weekday
// repeatDay (0..6=Sun..Sat 1st, 7..13 2nd, 14..20 3rd,
// 21..27 4th, 28-34 last week)
echo floor(substr($row[3], 6, 2) / 7) * 7 + date('w', date_to_epoch($row[3])), ",0,0\n";
break;
case 1:
// daily
// daily
//.........这里部分代码省略.........