/**
  * 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);
     }
 }
예제 #2
0
 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 '';
 }
예제 #3
0
$GO_SECURITY->authenticate();
$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';
            }
        }
예제 #4
0
$GO_MODULES->authenticate('projects');
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];
예제 #5
0
 $db_child->query("SELECT * FROM ab_categories WHERE parent_id = '{$id}' ORDER BY category");
 $count_child = $db_child->num_rows();
 //------------------------
 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">&nbsp;</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 . "&nbsp;&nbsp;&nbsp;{$name}</a></td>";
         if ($count == 1) {
             echo '<td width="36" align="center">&nbsp;</a></td>';
         }
         echo "<td><a href='javascript:delete_status(\"" . div_confirm_id($delitem) . "\",{$id})'>{$trash}</a></td>";
         echo '</tr>';
         //    		echo $spliter;
예제 #6
0
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")) . "&nbsp;</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"))) . "&nbsp;</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]))) . "&nbsp; </td>\n";
        }
    }
}
예제 #7
0
Free Software Foundation; either version 2 of the License, or (at your
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;
예제 #8
0
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();
    }
}
예제 #9
0
$Ticket_Number = isset($_GET['Ticket_Number']) ? Security::htmlsecure($_GET['Ticket_Number']) : 0;
$Ticket_Number = isset($_POST['Ticket_Number']) ? Security::htmlsecure($_POST['Ticket_Number']) : $Ticket_Number;
echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" name="ticket_form">';
echo '<input type="hidden" name="Ticket_Number" value="' . $Ticket_Number . '" />';
global $name;
$textmenu = menu("Show_Tickets", '');
eval($textmenu);
//
// take ownership
if (isset($_GET['take_ownership'])) {
    $query = "select * from acl_items  where id='" . Security::sqlsecure($_GET['acl_write']) . "' and description='ticket write'";
    $mydb = new db($query);
    if ($mydb->next_record()) {
        $query = "select * from acl where acl_id='" . Security::sqlsecure($_GET['acl_write']) . "' and user_id='" . whoami() . "'";
        $mydb = new db($query);
        if (!$mydb->next_record()) {
            $query = "insert into acl (acl_id,user_id) values ('" . Security::sqlsecure($_GET['acl_write']) . "','" . whoami() . "')";
            $mydb = new db($query);
        }
    }
}
//
$return_to = isset($_REQUEST['return_to']) ? $_REQUEST['return_to'] : $_SERVER['HTTP_REFERER'];
$link_back = isset($_REQUEST['link_back']) ? $_REQUEST['link_back'] : $_SERVER['REQUEST_URI'];
$ticket['acl_read'] = get_cross_value("{$prefix}{$hlpdsk_prefix}_tickets", "acl_read", " where Ticket_Number='" . Security::sqlsecure($Ticket_Number) . "'");
$ticket['acl_write'] = get_cross_value("{$prefix}{$hlpdsk_prefix}_tickets", "acl_write", " where Ticket_Number='" . Security::sqlsecure($Ticket_Number) . "'");
$acl_read = $ticket['acl_read'];
$acl_write = $ticket['acl_write'];
$tabtable = new tabtable('ticket_tabtable', $tts_lang_tickets_details, '100%', '400', '120', '', true);
if ($acl_read > 0 and $acl_write > 0) {
    $tabtable->add_tab('properties', $strProperties);
예제 #10
0
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) . "')");
    }
}
예제 #11
0
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]));
        }
    }
}
예제 #12
0
define("NOR_PP_MODE_REGISTER", 4);
define("NOR_PP_MODE_DELETE", 5);
define("NOR_PP_MODE_ACCEPT", 6);
if (!defined("MAIL_DOMAIN")) {
    define("MAIL_DOMAIN", "nordita.org");
}
define("PP_UNDEFINED", "to be allocated");
define("PP_LOGTABLE", "log");
define("PP_RESERVE", "register new preprint");
core_setConfig("redirectMailsInPlaygoundMode", True);
core_setConfig("plygroundEmail", "*****@*****.**");
core_setConfig("remindingPeriod", 7 * 24 * 3600);
// a week
$NOR_modes = array(NOR_PP_MODE_UNRESERVE => array("i" => "b_drop.png", "d" => "cancel preprint reservation"), NOR_PP_MODE_EDIT => array("i" => "b_edit.png", "d" => "edit preprint data"), NOR_PP_MODE_REGISTER => array("i" => "b_tip.png", "d" => "register preprint"), NOR_PP_MODE_DELETE => array("i" => "b_drop.png", "d" => "delete preprint"), NOR_PP_MODE_ACCEPT => array("i" => "b_ok.gif", "d" => "accept preprint"));
$NOR_fields = array("all" => "All", "AP" => "Astrophysics", "CM" => "Condensed Matter", "HE" => "High Energy", "NP" => "Nuclear Physics");
if (!$dbClass) {
    $dbClass = new db($dbName, $dbServer, $dbUser, $dbP);
}
$dbClass->debug = 0;
$authClass->db = $dbClass;
$PPsecretary_email = "*****@*****.**";
$time = time();
$date = getdate();
$year = $date["year"];
$nor_pp_year0 = 1995;
$nor_pp_year = $year;
$q = $dbClass->query("SELECT MIN(Year) AS year0 FROM publications");
while ($r = $dbClass->next_record($q)) {
    $nor_pp_year0 = $r["year0"];
}
list($AUTH_gecos, $AUTH_login, $AUTH_uid) = $authClass->whoami();