<?php

require 'abstractclass.php';
$person = new people();
$person->name = "Bob";
$person->age = 7;
echo $person->description();
echo $person->welcome();
Пример #2
0
if (!isset($GLOBALS['QUERY']['original'])) {
    $GLOBALS['QUERY']['original'] = "";
}
if ($_DDATA['online'] && count($_RESULTS)) {
    $_REQUEST['start'] = !isset($_REQUEST['start']) ? 1 : (count($_RESULTS) <= $resultsPerPage ? 1 : (int) $_REQUEST['start']);
    $_REQUEST['end'] = min($_REQUEST['start'] + $resultsPerPage - 1, count($_RESULTS));
}
//debug::rr($GLOBALS["nw_categories"]);
// --------------------------------------------------------------------------
// -- PREPARE OUTPUT
// --------------------------------------------------------------------------
// --------------------
// Create $peopleresult
// --------------------
if (isset($_REQUEST['qry'])) {
    $peopleresult = people::getSearchPeople($_REQUEST['qry'], "box", "people-list", "", "");
    if ($peopleresult !== false) {
        $peopleresult = trim($peopleresult);
    }
} else {
    $peopleresult = false;
}
// --------------------
// Create $searchform
// --------------------
// Method should be GET to ensure back-button functionality on result page
$searchform = "  <form action='" . $_SERVER['PHP_SELF'] . "' method='get' id='os_search' " . " enctype='application/x-www-form-urlencoded'>\r\n" . "    <div>\r\n";
if (isset($_LANG)) {
    $searchform .= "      <input type='text' id='qry' name='qry' " . "value='" . htmlspecialchars($GLOBALS['QUERY']['original']) . "'>\r\n";
    if (isset($_SDATA['categories']) && count($_SDATA['categories']) > 1) {
        $searchform .= "      <label>\r\n" . "        &nbsp; &nbsp; \r\n" . "        <select name='ctg' size='1'>\r\n" . "          <option value=''" . ($GLOBALS['QUERY']['category'] == "" ? " selected='selected'" : "") . ">in the entire Nordita web</option>\r\n";
Пример #3
0
 private static function clearCallbackFunction()
 {
     self::$callbackarray = array();
     return true;
 }
Пример #4
0
 public static function getAllValidUsers($ownerUid = 0)
 {
     $users = $uids = array();
     // -- In the unexpected event that the user with UID=$ownerUid cannot be found in the usual ways
     $dummyOwnerRecord = array("name" => "dummy", "uid" => $ownerUid, "gecos" => "uid=" . $ownerUid);
     // -- Fetch special users from local DB
     foreach (auth::getSpecialUsers(TRUE) as $row) {
         $users[strtolower(functions::strip_accents($row["gecos"]))] = array("name" => $row["name"], "uid" => $row["uid"], "gecos" => $row["gecos"]);
         $uids[$row["uid"]] = 1;
     }
     // -- Fetch active users from EA
     foreach (people::getPeopleArray("all") as $row) {
         $name = "";
         $row["nw_fullname"] = functions::utf8encode($row["nw_fullname"]);
         // Use SU usernames before trying KTH usernames
         if (!empty($row["nw_acc_su"])) {
             $name = $row["nw_acc_su"];
         } elseif (!empty($row["nw_acc_kth"])) {
             $name = $row["nw_acc_kth"];
         }
         // Get UID from local passwd file
         $u = posix_getpwnam($name);
         if (!empty($u["uid"]) && !preg_match("/20[0-9][0-9]/i", $name)) {
             // Not sure what the YYYY test is for
             $users[strtolower(functions::strip_accents($row["nw_fullname"]))] = array("name" => $name, "uid" => $u["uid"], "gecos" => $row["nw_fullname"]);
             $uids[$u["uid"]] = 1;
         }
     }
     if (!empty($ownerUid) && !in_array($ownerUid, array_keys($uids))) {
         $users["~~owner"] = $dummyOwnerRecord;
     }
     ksort($users);
     return $users;
 }
Пример #5
0
 function getDotnameArray($table = "", $where = "")
 {
     $sql = "SELECT " . "  AV.av_identity, " . "  AV.av_firstname, " . "  AV.av_lastname, " . "  AV.av_von " . "FROM " . "  zzz_avatars AS AV " . "  LEFT JOIN zzz_unit_members AS UM ON AV.av_id=UM.um_avid " . "  LEFT JOIN zzz_lists AS L ON AV.av_id=L.l_parent " . "  LEFT JOIN zzz_list_members AS LM ON L.l_id=LM.lm_lid " . "WHERE " . "  (UM.um_uid='" . MYPEAR_NORDITA_EMPLOYEES . "') " . "  AND (UM.um_status REGEXP '" . MYPEAR_REGEXP_IS_EMPLOYEE_OR_VISITOR . "') " . "  AND (LM.lm_option REGEXP '" . MYPEAR_REGEXP_NORDITA_IS_HOME_INSTITUTE . "') " . "  AND ('2007-01-01'<=LM.lm_status)";
     // We are only interested in Nordita Stockholm era
     $result = $this->query($sql);
     if ($this->num_rows($result) == 0) {
         return "";
     }
     $dotname = array();
     while ($rec = $this->next_record_assoc($result)) {
         $all = array();
         $dn = functions::dotname(preg_replace("/\\s+/", " ", $rec["av_firstname"] . " " . $rec["av_von"] . " " . $rec["av_lastname"]));
         // Add basic dotname to $all:
         $all = array($dn => 1);
         // Add any username-like field to $all:
         foreach ($this->usernameFields as $field) {
             if ($field == "av_identity") {
                 // NB: not many users have the "av_identity" field set
                 $users = explode(",", $rec["av_identity"]);
                 foreach ($users as $usr) {
                     if (!empty($usr)) {
                         $all[$usr] = 1;
                     }
                 }
             } elseif (!empty($rec[$field]) && !is_numeric($rec[$field])) {
                 $all[$rec[$field]] = 1;
             }
         }
         // Add usernames with "-" replaced by ".":
         $more = array();
         foreach ($all as $d => $value) {
             if (strpos($d, "-") !== FALSE) {
                 $more[str_replace("-", ".", $d)] = 1;
             }
         }
         $all = array_merge($all, $more);
         // Add any ad-hoc modifications of dotnames to $all
         foreach ($all as $d) {
             $ddn = people::getSpecialDotname($dn);
             if (!empty($ddn)) {
                 $all[$ddn] = 1;
             }
         }
         // Assign $all to return array
         foreach ($all as $d => $value) {
             $dotname[$d] = $all;
         }
         /*
               $dotname[$dn] = $all;
         	  foreach ($this->usernameFields as $field) {
         		if ($field=="av_identity") {
         		  foreach ($users as $usr) if (!empty($usr)) $dotname[$usr] = $all;
         		} elseif (!empty($rec[$field]) && !is_numeric($rec[$field])) {
         		  $dotname[$rec[$field]] = $all;
         		}
         	  } // end foreach
         */
     }
     // end while
     return $dotname;
 }
Пример #6
0
            echo "<br>{$words}";
        } else {
            echo "<br>Путин хамло";
        }
    }
    function sayName()
    {
        if ($this->name == "Владимир") {
            echo "<br> Хамло";
        } else {
            echo "<br>" . $this->name;
        }
    }
    static function noice()
    {
        echo "<br>la-la-la";
    }
}
$obj = new People();
$obj->name = "Владимир";
$obj->lname = "Путин";
/*echo "Имя обьекта = " . $obj ->name."<br>Фамилия обьекта = " . $obj ->lname;
$obj ->say('Привет хамло');
$obj ->say();*/
$obj->sayName();
People::noice();
$dima = new people();
$dima->name = "Дмитрий";
$dima->lname = "Медведев";
$dima->sayName();
People::noice();