function get_fullname($uid) { global $name, $prefix, $hlpdsk_prefix; $tts = new db(); $query = "select first_name,middle_name,last_name from users where id='{$uid}'"; if ($tts->query($query)) { $tts->next_record(); $fullname = $tts->f('last_name') . ' '; if ($tts->f('middle_name') != '') { $fullname .= $tts->f('middle_name') . ' '; } $fullname .= $tts->f('first_name'); return $fullname; } return ''; }
/** * insert a copy of the default preferences for use by real account_id * * @param $account_id numerical id of account for which to create the prefs */ public function create_defaults($account_id) { return; // not longer needed, as the defaults are merged in on runtime $this->db->query("select * from phpgw_preferences where preference_owner='-2'", __LINE__, __FILE__); $this->db->next_record(); if ($this->db->f('preference_value')) { $this->db->query("insert into phpgw_preferences values ('{$account_id}','" . $this->db->f('preference_value') . "')", __LINE__, __FILE__); } if ($GLOBALS['phpgw_info']['server']['cache_phpgw_info'] && $account_id == $GLOBALS['phpgw_info']['user']['account_id']) { $GLOBALS['phpgw']->session->read_repositories(False); } }
$GO_MODULES->authenticate('messages'); #require($GO_LANGUAGE->get_language_file('messages')); $post_action = isset($_REQUEST['post_action']) ? $_REQUEST['post_action'] : ''; $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : ''; $mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : 'messages'; $receipient_id = isset($_REQUEST['receipient']) ? $_REQUEST['receipient'] : ''; $link_back = isset($_REQUEST['link_back']) && $_REQUEST['link_back'] != '' ? $_REQUEST['link_back'] : $_SERVER['REQUEST_URI']; $db = new db(); switch ($task) { case 'send': if ($_REQUEST['message'] == '') { $feedback .= 'Message is empty'; } else { if ($receipient_id > 0) { if ($db->query("SELECT * FROM messages_users WHERE user_id='{$receipient_id}'") && $db->next_record()) { $has_permission = $GO_SECURITY->has_permission($GO_SECURITY->user_id, $db->f('acl_write')); } else { $has_permission = true; } if ($has_permission) { $msg_id = $db->nextid("messages_messages"); $db->query("INSERT INTO messages_messages (id,user_id,sender_id,ctime, text) VALUES ('{$msg_id}','{$receipient_id}','{$GO_SECURITY->user_id}','" . get_gmt_time() . "','" . smart_addslashes($_REQUEST['message']) . "')"); $db->query("INSERT INTO messages_new (id) VALUES ('{$msg_id}')"); } else { $feedback .= "You are not allowed to send message to the receipient"; } } else { $feedback .= 'You did not specify receipient'; } } break;
if (!$GO_MODULES->write_permissions) { header('Location: ' . $GO_CONFIG->host . 'error_docs/403.php'); exit; } require $GO_LANGUAGE->get_language_file('projects'); require $GO_THEME->theme_path . "header.inc"; $template_id = $_REQUEST['template_id']; $task_id = $_REQUEST['task_id']; if (isset($template_id) && isset($task_id)) { $db = new db(); $db->query('SELECT * FROM task_template_' . $template_id . ' ORDER BY task_order'); if ($db->num_rows() > 0) { $tasks = array(); $tasks[0] = array(0, $pm_status_begin, ''); while ($db->next_record()) { $tasks[$db->f('task_id')] = array($db->f('task_order'), $db->f('task_name'), $db->f('task_predecessors')); } if ($task_id <= 0) { $predecessors = $_REQUEST['predecessors']; if (!isset($predecessors) || $predecessors == '') { $task_pre_list = ''; $predecessors = array(); } else { $task_pre_list = "'" . $predecessors . "'"; $predecessors = explode(",", $predecessors); } display_tasklist($tasks, '', $predecessors); } else { $plist = array(); $task_pre_list = $tasks[$task_id][2]; $pre = $predecessors = explode(",", $task_pre_list);
//------------------------ echo '<tr class="HiLi">'; echo '<td align="center"><b>' . $value . '</b></td>'; echo "<td colspan=\"97\" nowrap><a href='javascript:set_edit({$id}, \"{$name}\", {$parent}, {$count_child})'><b>{$name}</b></a></td>"; if ($count == 1) { echo '<td width="36" align="center"> </a></td>'; } $delitem = sprintf($count_child > 0 ? $ab_ConfirmDeleteStatus2 : $ab_ConfirmDeleteStatus, $name); echo "<td><a href='javascript:delete_status(\"" . div_confirm_id($delitem) . "\"," . $id . ")'>{$trash}</a></td>"; echo '</tr>'; // echo $spliter; if ($count_child > 0) { $val_child = 0; while ($db_child->next_record()) { $val_child++; $name = $db_child->f('category'); $id = $db_child->f('category_id'); $parent = $db_child->f('parent_id'); $delitem = sprintf($ab_ConfirmDeleteStatus, $name); $delitem_hint = "{$strDeleteItem} '{$name}'"; echo '<tr>'; echo '<td align="center"></td>'; echo "<td colspan=\"97\" nowrap><a href='javascript:set_edit({$id}, \"{$name}\", {$value}, 0)'>" . $val_child . " {$name}</a></td>"; if ($count == 1) { echo '<td width="36" align="center"> </a></td>'; } echo "<td><a href='javascript:delete_status(\"" . div_confirm_id($delitem) . "\",{$id})'>{$trash}</a></td>"; echo '</tr>'; // echo $spliter; } }
$view_type = isset($_REQUEST['view_type']) ? $_REQUEST['view_type'] : 0; $calendar_id = isset($_REQUEST['calendar_id']) ? $_REQUEST['calendar_id'] : 0; $db = new db(); switch ($task) { case 'delete_calendar': $calendar = $cal->get_calendar($_POST['delete_calendar_id']); if ($GO_SECURITY->user_id == $calendar['user_id']) { if ($cal->delete_calendar($_POST['delete_calendar_id'])) { $holidays->delete_holidays($GO_SECURITY->user_id, $_POST['delete_calendar_id']); $GO_SECURITY->delete_acl($calendar['acl_write']); $GO_SECURITY->delete_acl($calendar['acl_read']); } } $db->query("SELECT calendar_id FROM cal_config WHERE user_id='" . $GO_SECURITY->user_id . "'"); while ($db->next_record()) { $subscribed[] = $db->f('calendar_id'); } break; case 'save_calendar': $cal->set_default_calendar($GO_SECURITY->user_id, $_POST['default_calendar_id']); if ($_POST['close_action'] == 'true') { header('Location: ' . $return_to); exit; } break; case 'subscribe': $db->query("DELETE FROM cal_config WHERE user_id='" . $GO_SECURITY->user_id . "'"); $subscribed = $_REQUEST['subscribed']; for ($i = 0; $i < sizeof($subscribed); $i++) { $db->query("INSERT INTO cal_config VALUES ('" . $GO_SECURITY->user_id . "','" . $subscribed[$i] . "')"); }
if (!isset($_SESSION['completed']['database_structure'])) { $db = new db(); $db->Halt_On_Error = 'no'; if (!@$db->connect($GO_CONFIG->db_name, $GO_CONFIG->db_host, $GO_CONFIG->db_user, $GO_CONFIG->db_pass)) { print_head(); echo 'Can\'t connect to database!'; echo '<br /><br />Correct this and refresh this page.'; print_foot(); exit; } else { $settings_exist = false; $db->query("SHOW TABLES"); if ($db->num_rows() > 0) { //structure exists see if the settings table exists while ($db->next_record()) { if ($db->f(0) == 'settings') { $settings_exist = true; break; } } } if ($settings_exist) { $db->query("SELECT value FROM settings WHERE name='version'"); if ($db->next_record()) { $db_version = str_replace('.', '', $db->f('value')); require 'lib/updates.inc'; if (!isset($updates[$db_version])) { $db_version = false; } } else { $db_version = false;
function print_config_content($order, $ab, $page) { global $strSexes, $GO_USERS; $db = new db(); for ($i = 0; $i < count($order); $i++) { switch ($order[$i]) { case 'email': if ($page == 0) { echo "<td nowrap>" . mail_to(empty_to_stripe($ab->f("email")), empty_to_stripe($ab->f("email")), 'normal', true, $ab->f("id")) . " </td>\n"; } if ($page == 1) { echo '<td>' . mail_to($ab->f('email'), $ab->f('email')) . '</td>'; } if ($page == 2) { echo "<td>" . mail_to(empty_to_stripe($GO_USERS->f("email"))) . " </td>\n"; } break; case 'sex': echo '<td nowrap> ' . $strSexes[$ab->f('sex')] . ' </td>'; break; case 'birthday': case 'relation_date': $day = $ab->f($order[$i]) > 0 ? db_date_to_date($ab->f($order[$i])) : ''; echo '<td nowrap> ' . empty_to_stripe($day) . ' </td>'; break; case 'company_id': case 'parent': $db->query("SELECT name FROM ab_companies WHERE id = '" . (int) $ab->f($order[$i]) . "'"); echo '<td nowrap> ' . htmlspecialchars(empty_to_stripe($db->next_record() ? $db->f('name') : '')) . ' </td>'; break; case '': break; default: echo "<td nowrap> " . htmlspecialchars(empty_to_stripe($ab->f($order[$i]))) . " </td>\n"; } } }
#$dropbox->add_sql_data("cal","id","name"); while ($cal->next_record()) { if (!isset($subscribed)) { $dropbox->add_value('calendar:' . $cal->f('id'), $cal->f('name')); } else { if (in_array($cal->f('id'), $subscribed)) { $dropbox->add_value('calendar:' . $cal->f('id'), $cal->f('name')); } } } } if ($cal->get_authorised_views($GO_SECURITY->user_id)) { $db = new db(); $db->query("SELECT view_id FROM cal_view_subscriptions WHERE user_id='" . $GO_SECURITY->user_id . "'"); while ($db->next_record()) { $views_subscribed[] = $db->f('view_id'); } $dropbox->add_optgroup($cal_views); #$dropbox->add_value('','----- '.$cal_views.' -----'); while ($cal->next_record()) { if (!isset($views_subscribed)) { $dropbox->add_value('view:' . $cal->f('id'), $cal->f('name')); } else { if (in_array($cal->f('id'), $views_subscribed)) { $dropbox->add_value('view:' . $cal->f('id'), $cal->f('name')); } } } } $dropbox->print_dropbox("calendar_view_id", $calendar_view_id, 'onchange="javascript:change_calendar()"'); echo '</td></tr>';
$link_back = isset($_REQUEST['link_back']) ? $_REQUEST['link_back'] : $_SERVER['REQUEST_URI']; $view_type = isset($_REQUEST['view_type']) ? $_REQUEST['view_type'] : 0; $calendar_id = isset($_REQUEST['calendar_id']) ? $_REQUEST['calendar_id'] : 0; $db = new db(); switch ($task) { case 'delete_view': $view = $cal->get_view($_POST['delete_view_id']); if ($GO_SECURITY->user_id == $view['user_id']) { if (isset($_POST['delete_view_id']) && $cal->delete_view($_POST['delete_view_id'])) { $GO_SECURITY->delete_acl($view['acl_write']); $GO_SECURITY->delete_acl($view['acl_read']); } } $db->query("SELECT view_id FROM cal_view_subscriptions WHERE user_id='" . $GO_SECURITY->user_id . "'"); while ($db->next_record()) { $subscribed[] = $db->f('view_id'); } break; case 'subscribe': $db->query("DELETE FROM cal_view_subscriptions WHERE user_id='" . $GO_SECURITY->user_id . "'"); $subscribed = $_REQUEST['subscribed']; for ($i = 0; $i < sizeof($subscribed); $i++) { $db->query("INSERT INTO cal_view_subscriptions VALUES ('" . $GO_SECURITY->user_id . "','" . $subscribed[$i] . "')"); } if ($_POST['close_action'] == 'true') { header('Location: ' . $return_to); exit; } break; default: $db->query("SELECT view_id FROM cal_view_subscriptions WHERE user_id='" . $GO_SECURITY->user_id . "'");
option) any later version. */ require "../../Group-Office.php"; require $GO_MODULES->path . "classes/calendar.class.inc"; $cal = new calendar(); require $GO_LANGUAGE->get_language_file('calendar'); require $GO_THEME->theme_path . 'header.inc'; echo '<table border="0" cellpadding="10" cellspacing="0"><tr><td><h1>' . $sc_decline_title . '</h1>'; if ($_REQUEST['task'] == 'submit') { if ($_REQUEST['event_id'] > 0 && $_REQUEST['email'] != '') { if ($cal->set_event_status($_REQUEST['event_id'], '2', $_REQUEST['email'])) { $db = new db(); $email = $_REQUEST['email']; $db->query("SELECT first_name, middle_name, last_name FROM users WHERE email='" . $email . "'"); if ($db->next_record()) { $name = $db->f('last_name') . ' ' . $db->f('middle_name') . ' ' . $db->f('first_name'); } // $db->query("SELECT u.email, c.name FROM cal_events c INNER JOIN users u ON c.user_id = u.id WHERE c.id = '".$_REQUEST['event_id']."'"); $db->query("SELECT u.email, u.date_format, u.time_format, u.DST, c.* FROM cal_events c INNER JOIN users u ON c.user_id = u.id WHERE c.id = '" . $_REQUEST['event_id'] . "'"); if ($db->next_record()) { $mail_to = $db->f('email'); $title = $db->f('name'); require 'decline_mail.php'; require_once $GO_CONFIG->root_path . 'lib/tkdlib.php'; echo send_mail($mail_to, $mail_body, $sc_declined_mail_title, $name, $email); echo $sc_decline_confirm; } } } else { echo $sc_bad_event; }
function notify_relevant_members($project_id, $task_id, $person_id, $assigned = true) { global $GO_CONFIG, $php_mailer_lang; $db = new db(); $sql = "SELECT users.* FROM" . " users LEFT JOIN users_groups ON (users.id = users_groups.user_id)" . " WHERE users_groups.group_id='" . $GO_CONFIG->group_root . "'"; if ($db->query($sql) && $db->num_rows() && $db->next_record()) { require_once $GO_CONFIG->class_path . "phpmailer/class.phpmailer.php"; require_once $GO_CONFIG->class_path . "phpmailer/class.smtp.php"; $mail = new PHPMailer(); $mail->PluginDir = $GO_CONFIG->class_path . 'phpmailer/'; $mail->SetLanguage($php_mailer_lang, $GO_CONFIG->class_path . 'phpmailer/language/'); switch ($GO_CONFIG->mailer) { case 'smtp': $mail->Host = $GO_CONFIG->smtp_server; $mail->Port = $GO_CONFIG->smtp_port; $mail->IsSMTP(); break; case 'qmail': $mail->IsQmail(); break; case 'sendmail': $mail->IsSendmail(); break; case 'mail': $mail->IsMail(); break; } $mail->Sender = $db->f('email'); $mail->From = $db->f('email'); $mail->FromName = $GO_CONFIG->title; $mail->AddReplyTo($db->f('email'), $GO_CONFIG->title); $mail->WordWrap = 50; $mail->IsHTML(true); $db->query("SELECT * FROM task WHERE task_id=" . $task_id . " AND task_project_id=" . $project_id); $db->next_record(); $task_name = $db->f('task_name'); $task_person_id = $db->f('task_person_id'); $task_duration = $db->f('task_time'); $db->query('SELECT * ' . 'FROM pmProjects ' . 'WHERE id="' . $project_id . '" '); $db->next_record(); $task_url = $GO_CONFIG->full_url . 'modules/projects/project.php?task=show_task_status&project_id=' . $project_id . '&task_id=' . $task_id . '&task_status=' . (isset($status) ? $status : ''); $project_url = $GO_CONFIG->full_url . 'modules/projects/project.php?project_id=' . $project_id; global $pm_task_status_values; $new_status = $pm_task_status_values[$status]; $project_name = $db->f('name'); $project_description = $db->f('description'); global $subjectTaskAssigneeChanged, $mailTaskAssigneeLeft, $mailTaskAssigneeJoined; $mail->Subject = sprintf($subjectTaskAssigneeChanged, $task_name, $project_name); if ($assigned) { $mail_body = sprintf($mailTaskAssigneeJoined, $project_name, $project_description, $task_name, $task_duration, $task_url); } else { $mail_body = sprintf($mailTaskAssigneeLeft, $project_name, $project_description, $task_name); } $mail->Body = $mail_body; $mail->ClearAllRecipients(); if (isset($status) && $status == TASK_DONE) { $db->query('SELECT users.* ' . 'FROM users,pmProjects ' . 'WHERE users.id=pmProjects.user_id ' . 'AND pmProjects.id="' . $project_id . '"'); } else { $db->query('SELECT * ' . 'FROM users ' . 'WHERE id="' . $task_person_id . '"'); } $db->next_record(); $mail->AddAddress($db->f('email')); // HACK: For some reasons, admin@hptvietnam.com.vn is not accepted by mail.hptvietnam.com.vn :( $mail->From = $db->f('email'); $mail->Sender = $db->f('email'); //if (!$mail->Send()) echo "Failed: ".$mail->ErrorInfo; $mail->Send(); //$mail->Send(); } }
} } else { $email2->disable_auto_check($account['id']); echo '<script language="javascript" type="text/javascript">alert("' . $account['host'] . ' ' . $ml_host_unreachable . '");</script>'; } } } if ($_SESSION['new_mail'] > 0 && $_SESSION['new_mail'] > $_SESSION['notified_new_mail']) { echo '<script language="javascript" type="text/javascript">popup("' . $email_module['url'] . 'notify.php", "400", "120", "email_notify");</script>'; } } $msg_module = $GO_MODULES->get_module('messages'); if ($msg_module) { $db = new db(); $db->query("SELECT messages_messages.* FROM messages_new,messages_messages WHERE messages_messages.user_id='" . $GO_SECURITY->user_id . "' AND messages_new.id=messages_messages.id ORDER BY messages_messages.ctime DESC"); if ($db->next_record()) { $msg = cut_string($db->f('text'), 100); $msg = str_replace("\"", "\\\"", $msg); $msg = str_replace("\n", ' ', $msg); $msg = str_replace("\r", ' ', $msg); $id = $db->f('id'); echo '<script language="javascript">parent.header.SetStatus("Message: ' . $msg . '");</script>'; $db->query("DELETE FROM messages_new WHERE id='{$id}'"); } } ?> </head> <body> </body> </html>
function update_enable($pkgs) { $db = new db(); $db->query("SELECT id FROM modules"); $disabled_modules = array(); while ($db->next_record()) { if (!in_array($db->f('id'), $pkgs)) { $disabled_modules[] = $db->f('id'); } } if (!empty($pkgs)) { $db->query("UPDATE modules SET enable=1 WHERE id in ('" . implode("','", $pkgs) . "')"); } if (!empty($disabled_modules)) { $db->query("UPDATE modules SET enable=0 WHERE id in ('" . implode("','", $disabled_modules) . "')"); } }
function fill_config_content($order, $ab, $page, &$row, &$irow, &$firstrun) { global $strSexes, $GO_USERS; $db = new db(); for ($i = 0; $i < count($order); $i++) { switch ($order[$i]) { case 'email': if ($page == 0) { if ($firstrun) { $row[$irow++] = array('html' => mail_to(empty_to_stripe($ab->f("email")), empty_to_stripe($ab->f("email")), 'normal', true, $ab->f("id"))); } else { $row[$irow++]['html'] = mail_to(empty_to_stripe($ab->f("email")), empty_to_stripe($ab->f("email")), 'normal', true, $ab->f("id")); } } if ($page == 1) { if ($firstrun) { $row[$irow++] = array('html' => mail_to($ab->f('email'), $ab->f('email'))); } else { $row[$irow++]['html'] = mail_to($ab->f('email'), $ab->f('email')); } } if ($page == 2) { if ($firstrun) { $row[$irow++] = array('html' => mail_to(empty_to_stripe($GO_USERS->f("email")))); } else { $row[$irow++]['html'] = mail_to(empty_to_stripe($GO_USERS->f("email"))); } } break; case 'sex': $row[$irow++] = $strSexes[$ab->f('sex')]; break; case 'birthday': case 'relation_date': $day = $ab->f($order[$i]) > 0 ? db_date_to_date($ab->f($order[$i])) : ''; $row[$irow++] = empty_to_stripe($day); break; case 'company_id': case 'parent': $db->query("SELECT name FROM ab_companies WHERE id = '" . (int) $ab->f($order[$i]) . "'"); $row[$irow++] = empty_to_stripe($db->next_record() ? $db->f('name') : ''); break; case '': break; default: $row[$irow++] = empty_to_stripe($ab->f($order[$i])); } } }
require_once $GO_CONFIG->root_path . 'lib/tkdlib.php'; switch ($page) { case $constContactsPage: goURL("index.php?post_action=browse&addressbook_id=" . $_REQUEST['addressbook_id']); break; case $constCompaniesPage: goURL("index.php?post_action=companies&addressbook_id=" . $_REQUEST['addressbook_id'] . "&first=" . $_REQUEST['first'] . "&max_rows=" . $_REQUEST['max_rows'] . "&treeview=" . $_REQUEST['treeview']); break; case $constMembersPage: goURL("index.php?post_action=members&addressbook_id=" . $_REQUEST['addressbook_id']); break; } } $db->query("SELECT order_fields, order_all FROM ab_config WHERE page = '{$page}' AND user_id = '{$user}'"); if ($db->next_record()) { $com = explode(",", $db->f('order_fields')); $s = $db->f('order_all'); if (!empty($s)) { $order_all = explode(",", $db->f('order_all')); } } if ($db->num_rows() == 0) { switch ($page) { case $constContactsPage: $com[] = "email"; $com[] = "home_phone"; $com[] = "work_phone"; break; case $constCompaniesPage: $com[] = "city"; $com[] = "email";