예제 #1
0
 function next_travel_record($handler = 0)
 {
     global $recordCounter, $charset;
     if ($row = $this->next_record($handler)) {
         /*
          * reply from queryForEdit, nordita database
          */
         if ($row['Leave']) {
             $row['date'] = $row['Leave'];
             $row['duration'] = ($row['Return'] - $row['Leave']) / 24 / 3600;
             $row['p_name'] = $row['Location'];
             // Id is ambiguos, lets use 'uid' instead
             if ($row['Id']) {
                 $row['uid'] = $row['Id'];
             } else {
                 $row['uid'] = $row['id'];
             }
             unset($row['Id']);
             unset($row['id']);
             if ($row['full_name']) {
                 $row['login'] = $row['username'];
                 $row['gecos'] = core_latin2utf($row['full_name']);
             } else {
                 if ($u1 = posix_getpwuid($row['uid'])) {
                     $row['login'] = $u1['name'];
                     $row['gecos'] = core_latin2utf($u1['gecos']);
                 } else {
                     $row['login'] = $row['username'];
                     $row['gecos'] = $row['username'];
                 }
             }
         }
         $row['duration'] = (int) ($row['duration'] + 0.5);
         /*
          * tooltips
          */
         $cs = array();
         if ($row['placeid'] == 'other') {
             $row['p_name'] = $row['comment'];
             $row['tooltip'] = $row['comment'];
         } else {
             $cs[] = $row['p_name'];
             if ($row['comment']) {
                 $cs[] = $row['comment'];
             }
             if ($row['info']) {
                 $cs[] = $row['info'];
             }
             if ($row['Contact']) {
                 $cs[] = "Contact: " . $row['Contact'];
             }
             $row['tooltip'] = join(";\n", $cs);
             $row['tooltip'] = eregi_replace("_", " ", $row['tooltip']);
             $row['tooltip'] = eregi_replace("<br>", "\n", $row['tooltip']);
         }
         $row['comment'] = info2comment($row);
         if (!$row['login']) {
             if ($row['uid']) {
                 $u = posix_getpwuid($row['uid']);
             }
             if ($u) {
                 $row['login'] = $u['name'];
             }
             if (!$row['login'] && eregi('@', $row['Contact'])) {
                 $row['login'] = $row['Contact'];
             }
         }
         if (!$row['gecos']) {
             if ($row['uid']) {
                 $uu = core_getpwuid($row['uid'], $this);
             }
             if ($row['login'] && !$uu) {
                 $uu = core_getpwnam($row['login'], $this);
             }
             if ($uu) {
                 $row['gecos'] = core_latin2utf($uu['gecos']);
             }
         }
         if (!$row['login']) {
             $row['login'] = '******';
         }
         if (!$row['gecos']) {
             $row['gecos'] = $row['login'];
         }
         while (list($k, $v) = each($row)) {
             $row[$k] = eregi_replace("\"", "'", $row[$k]);
             $row[$k] = eregi_replace("_", " ", $row[$k]);
             $row[$k] = eregi_replace(",", ", ", $row[$k]);
         }
         reset($row);
     }
     return $row;
 }
예제 #2
0
// ============================================================================
// PREPRINTS/RESERVE_PPN.PHP
// ============================================================================
include_once "config.manage.php";
core_declare_input("res_UID");
core_declare_input("field");
core_declare_input("authors", "");
core_declare_input("title", "");
startPage("Reserve Preprint Number");
if (!$title) {
    errorPage("Preprint title is missing", "Submit Preprint", "Error");
}
if (!$authors) {
    errorPage("Authors list is missing", "Submit Preprint", "Error");
}
if (!($account = core_getpwuid($res_UID, $dbClass))) {
    bugPage("no account found for UID='{$res_UID}'");
}
$res_login = $account["name"];
if (!$authClass->isAdmin() && $res_login != $AUTH_login) {
    errorPage("Reserving of preprint nbrs for others is only " . "permitted for administrative staff.");
}
$res_gecos = $account["gecos"];
$res_ppn = pp_reserveNumber($nor_pp_year, $res_UID, $field, $authors, $title);
// reread back the record
$q = $dbClass->query("SELECT * FROM publications WHERE Year={$nor_pp_year} AND Report={$res_ppn} AND Field='{$field}'");
$row = $dbClass->next_record($q);
$_POST["rowId"] = $row["RowId"];
require "update_preprint.inc.php";
mail2secretary("Reserved");
mail_PPsubmitter("Reserved");
예제 #3
0
function uid2gecos($uid)
{
    if (!$_SESSION["uid2gecos"][$uid]) {
        if ($uid) {
            if ($account = core_getpwuid($uid, $GLOBALS["dbClass"], $checkSU = False)) {
                $_SESSION["uid2login"][$uid] = $account["name"];
                $_SESSION["uid2gecos"][$uid] = $account["gecos"];
            } else {
                $_SESSION["uid2gecos"][$uid] = "?uid" . $uid;
            }
        }
    }
    return $_SESSION["uid2gecos"][$uid];
}
예제 #4
0
function core_getpw($id, $appsDB = False)
{
    if (preg_match("/^-?\\d+/", $id)) {
        return core_getpwuid($id, $appsDB);
    } else {
        return core_getpwnam($id, $appsDB);
    }
}