function eventGetContacts(EventControler $evtcl)
 {
     $plugType = 'email';
     $provider_box = $evtcl->provider_box;
     $email_box = $evtcl->email_box;
     $password_box = $evtcl->password_box;
     $msg = "";
     $contacts = "";
     $ok = false;
     if (empty($email_box)) {
         $msg = "Email missing !";
     }
     if (empty($password_box)) {
         $msg = "Password missing !";
     }
     if (empty($provider_box)) {
         $msg = "Provider missing !";
     }
     if ($msg == "") {
         $inviter = new OpenInviter();
         $inviter->startPlugin($provider_box);
         $internal = $inviter->getInternalError();
         if ($internal) {
             $msg = $internal;
         } elseif (!$inviter->login($email_box, $password_box)) {
             $internal = $inviter->getInternalError();
             $msg = $internal ? $internal : "Login failed. Please check the email and password you have provided and try again later !";
         } elseif (false === ($contacts = $inviter->getMyContacts())) {
             $msg = "Unable to get contacts !";
         } else {
             $msg = "Contacts imported successfully.";
             $ok = true;
             //$_POST['oi_session_id']=$inviter->plugin->getSessionID();
         }
     }
     if ($ok) {
         /*print_r($contacts);
         		exit();*/
         foreach ($contacts as $email => $name) {
             $do_contact = new Contact();
             $do_contact->firstname = $name;
             $do_contact->iduser = $_SESSION['do_User']->iduser;
             $do_contact->add();
             $lastInsertedContId = $do_contact->getPrimaryKeyValue();
             $do_contact->addEmail($email, 'Home');
             $do_contact->free();
             //contact view
             $do_cv = new ContactView();
             $do_cv->idcontact = $lastInsertedContId;
             $do_cv->firstname = $name;
             $do_cv->email_address = $email;
             $do_cv->add();
             $do_cv->free();
         }
     }
     $_SESSION['in_page_message'] = $msg;
 }
Exemple #2
0
 function selectors()
 {
     $sel = array("students" => "All students");
     foreach (ContactView::pset_list(true, false) as $pset) {
         if (Contact::student_can_see_pset($pset)) {
             if (!$pset->gitless || $pset->partner) {
                 $sel[] = array("optgroup", $pset->title);
             }
             if (!$pset->gitless) {
                 $sel[$pset->urlkey . ":workingrepo"] = "{$pset->title}, working repo";
                 $sel[$pset->urlkey . ":brokenrepo"] = "{$pset->title}, broken repo";
                 $sel[$pset->urlkey . ":openrepo"] = "{$pset->title}, open repo";
                 $sel[$pset->urlkey . ":norepo"] = "{$pset->title}, no repo";
             }
             if ($pset->partner) {
                 $sel[$pset->urlkey . ":partner"] = "{$pset->title}, partner";
                 $sel[$pset->urlkey . ":nopartner"] = "{$pset->title}, no partner";
             }
         }
     }
     $sel[] = array("optgroup");
     $sel["pc"] = "TFs";
     foreach (pcTags() as $t) {
         if ($t != "pc") {
             $sel["pc:{$t}"] = "#{$t} TFs";
         }
     }
     $sel["all"] = "All users";
     $usersel = array("all" => "All", "college" => "College", "extension" => "Extension");
     return Ht::select("recipients", $sel, $this->type, array("id" => "recipients", "onchange" => "setmailpsel(this)")) . "  " . Ht::select("userrecipients", $usersel, $this->usertype, array("id" => "userrecipients"));
 }
Exemple #3
0
 private function get_pset_info()
 {
     if (!$this->_info && $this->pset) {
         $this->_info = ContactView::user_pset_info($this->recipient, $this->pset);
         $this->_info->set_commit(null);
     }
     return $this->_info;
 }
 function add_user()
 {
     $do_api_user = new User();
     if ($this->firstname == '' || $this->lastname == '') {
         $this->setMessage("521", "First name, Last name required");
         return false;
     } elseif ($this->email == '') {
         $this->setMessage("522", "Email Id Required");
         return false;
     } elseif ($this->username == '') {
         $this->setMessage("523", "Username required.");
         return false;
     } elseif ($do_api_user->checkDuplicateUserName(trim($this->username))) {
         $this->setMessage("524", "Username is already in use.");
         return false;
     } elseif ($this->password == '') {
         $this->setMessage("525", "Password is required.");
         return false;
     } else {
         $do_api_user->addNew();
         $do_api_user->firstname = $this->firstname;
         $do_api_user->lastname = $this->lastname;
         $do_api_user->email = $this->email;
         $do_api_user->username = $this->username;
         $do_api_user->password = $this->password;
         $do_api_user->company = $this->company;
         $do_api_user->plan = $this->plan;
         $do_api_user->regdate = date("Y-m-d");
         $do_api_user->add();
         $inserted_id = $do_api_user->getPrimaryKeyValue();
         //$do_api_user->addUserAsContact($this->firstname,$this->lastname,$this->company,$this->email,$inserted_id);
         // Lets create the Contact view now
         $ContactView = new ContactView();
         $ContactView->rebuildContactUserTable($inserted_id);
         $this->email_work = $this->email;
         $this->add_contact();
         // adding the contact to the API key user
         //$do_api_user->idcontact = $this->idcontact;
         //$do_api_user->update();
         $this->setValues(array("msg" => "User Added", "stat" => "ok", "code" => "520", "iduser" => $inserted_id, "contact" => $this->idcontact));
         return true;
     }
 }
Exemple #5
0
function user_pset_info()
{
    global $Conf, $User, $Pset, $Info, $Commit, $Qreq;
    $Info = ContactView::user_pset_info($User, $Pset);
    if (($Commit = $Qreq->newcommit) == null) {
        $Commit = $Qreq->commit;
    }
    if (!$Info->set_commit($Commit)) {
        $Conf->ajaxExit(array("ok" => false, "error" => $Info->repo ? "No repository." : "Commit " . htmlspecialchars($Commit) . " isn’t connected to this repository."));
    }
    return $Info;
}
 static function echo_username_form(Contact $user, $first)
 {
     global $Me;
     if (!$first && !$user->seascode_username) {
         return;
     }
     echo Ht::form(hoturl_post("index", array("set_username" => 1, "u" => $Me->user_linkpart($user), "reposite" => "harvardseas"))), '<div class="f-contain">';
     $notes = array();
     if (!$user->seascode_username) {
         $notes[] = array(true, "Please enter your " . self::home_link("code.seas.harvard.edu") . " username and click “Save.”");
     }
     ContactView::echo_group(self::home_link("code.seas") . " username", Ht::entry("username", $user->seascode_username) . "  " . Ht::submit("Save"), $notes);
     echo "</div></form>";
 }
 public function setActiveInactiveTag($iduser, $idcontact)
 {
     $phil_iduser = "******";
     $login_status = $this->GetUserLoginStatus($iduser);
     $do_contact_view = new ContactView();
     $do_contact_view->setUser($phil_iduser);
     $do_tag = new TagInternalMarketing();
     if ($login_status == "Active") {
         $do_contact_view->deleteTag("Inactive", $idcontact);
         $do_contact_view->addTag("Active", $idcontact);
         $do_tag->deleteContactTag("Inactive", $phil_iduser, $idcontact);
         $do_tag->setContactTag("Active", $phil_iduser, $idcontact);
     }
     if ($login_status == "Inactive") {
         $do_contact_view->deleteTag("Active", $idcontact);
         $do_contact_view->addTag("Inactive", $idcontact);
         $do_tag->deleteContactTag("Active", $phil_iduser, $idcontact);
         $do_tag->setContactTag("Inactive", $phil_iduser, $idcontact);
     }
 }
 /**
  * Event Method to add Co Worker as a new user and associate the 
  * user as Co-Worker relation 
  */
 function eventAddCoWorkerOS(EventControler $evtcl)
 {
     $fields = $evtcl->fields;
     $errorpage = $evtcl->errPage;
     if ($evtcl->validation_fail == 'No') {
         // See eventRegistrationValidation() RegisteredUser.class
         $q = new sqlQuery($this->getDbCon());
         $q->query("select * from user where email = '" . $fields["email"] . "'");
         $q1 = new sqlQuery($this->getDbCon());
         $q1->query("select * from user where username = '******'");
         if ($q1->getNumRows() > 0) {
             $msg = "Username is already in use";
             //$errorpage = $evtcl->errorpage;
             $dispError = new Display($errorpage);
             $dispError->addParam("message", $msg);
             $evtcl->setDisplayNext($dispError);
         } elseif ($q->getNumRows() > 0) {
             $msg = "Email  already in use";
             //$errorpage = $evtcl->errorpage;
             $dispError = new Display($errorpage);
             $dispError->addParam("message", $msg);
             $evtcl->setDisplayNext($dispError);
         } else {
             // Add the new user
             $do_user_add = new User();
             $do_user_add->addNew();
             $do_user_add->firstname = $fields["firstname"];
             $do_user_add->lastname = $fields["lastname"];
             $do_user_add->email = $fields["email"];
             $do_user_add->username = $fields["username"];
             $do_user_add->password = $fields["password"];
             $do_user_add->status = "active";
             $do_user_add->add();
             $last_id = $do_user_add->getInsertId();
             //echo $last_id ;exit;
             $co_contact_view = new ContactView();
             $co_contact_view->rebuildContactUserTable($last_id);
             $this->addToCoWorkerRel($_SESSION['do_User']->iduser, $last_id);
             $this->addToCoWorkerRel($last_id, $_SESSION['do_User']->iduser);
             $this->addToAllCoWorker($last_id);
             $msg = $do_user_add->firstname . " is now one of your Co-Workers";
             $dispError = new Display($errorpage);
             $dispError->addParam("message", $msg);
             $evtcl->setDisplayNext($dispError);
         }
     }
 }
Exemple #9
0
function show_pset($info)
{
    global $Me;
    echo "<hr/>\n";
    if ($Me->isPC && get($info->pset, "gitless_grades")) {
        echo '<div style="float:right"><button type="button" onclick="jQuery(\'#upload\').show()">upload</button></div>';
    }
    echo "<h2>", htmlspecialchars($info->pset->title), "</h2>";
    ContactView::echo_partner_group($info);
    ContactView::echo_repo_group($info, $Me != $info->user);
    ContactView::echo_repo_last_commit_group($info, false);
}
 function eventImportContactsFromCsv(EventControler $eventcontroler)
 {
     $iduser = $eventcontroler->iduser;
     $handle = fopen($eventcontroler->targetpath, "r");
     $row = 1;
     while ($data = fgetcsv($handle)) {
         $contact_firstname = "";
         $contact_lastname = "";
         $contact_company = "";
         $company = "";
         $contact_position = "";
         $contact_summary = "";
         $contact_birthday = "";
         $contact_city = "";
         $contact_state = "";
         $contact_street = "";
         $contact_zipcode = "";
         $contact_country = "";
         $contact_address_hm = "";
         $contact_address_hm_type = "";
         $contact_address_wk = "";
         $contact_address_wk_type = "";
         $contact_address_ot = "";
         $contact_address_ot_type = "";
         $contact_email_hm = "";
         $contact_email_hm_type = "";
         $contact_email_wk = "";
         $contact_email_wk_type = "";
         $contact_email_ot = "";
         $contact_email_ot_type = "";
         $contact_phone_hm = "";
         $contact_phone_hm_type = "";
         $contact_phone_wk = "";
         $contact_phone_wk_type = "";
         $contact_phone_ot = "";
         $contact_phone_ot_type = "";
         $contact_phone_mb = "";
         $contact_phone_mb_type = "";
         $contact_phone_fx = "";
         $contact_phone_fx_type = "";
         $contact_website_comp = "";
         $contact_website_comp_type = "";
         $contact_website_blog = "";
         $contact_website_blog_type = "";
         $contact_website_ot = "";
         $contact_website_ot_type = "";
         $contact_website_personal = "";
         $contact_website_personal_type = "";
         $contact_website_twitter = "";
         $contact_website_twitter_type = "";
         $contact_im_aim_wk = "";
         $contact_im_aim_wk_type = "";
         $contact_im_aim_per = "";
         $contact_im_aim_per_type = "";
         $contact_im_aim_ot = "";
         $contact_im_aim_ot_type = "";
         $im_aim = "";
         $contact_im_msn_wk = "";
         $contact_im_msn_wk_type = "";
         $contact_im_msn_per = "";
         $contact_im_msn_per_type = "";
         $contact_im_msn_ot = "";
         $contact_im_msn_ot_type = "";
         $im_msn = "";
         $contact_im_icq_wk = "";
         $contact_im_icq_wk_type = "";
         $contact_im_icq_per = "";
         $contact_im_icq_per_type = "";
         $contact_im_icq_ot = "";
         $contact_im_icq_ot_type = "";
         $im_icq = "";
         $contact_im_jabber_wk = "";
         $contact_im_jabber_wk_type = "";
         $contact_im_jabber_per = "";
         $contact_im_jabber_per_type = "";
         $contact_im_jabber_ot = "";
         $contact_im_jabber_ot_type = "";
         $im_jabber = "";
         $contact_im_yahoo_wk = "";
         $contact_im_yahoo_wk_type = "";
         $contact_im_yahoo_per = "";
         $contact_im_yahoo_per_type = "";
         $contact_im_yahoo_ot = "";
         $contact_im_yahoo_ot_type = "";
         $im_yahoo = "";
         $contact_im_skype_wk = "";
         $contact_im_skype_wk_type = "";
         $contact_im_skype_per = "";
         $contact_im_skype_per_type = "";
         $contact_im_skype_ot = "";
         $contact_im_skype_ot_type = "";
         $im_skype = "";
         $contact_im_gt_wk = "";
         $contact_im_gt_wk_type = "";
         $contact_im_gt_per = "";
         $contact_im_gt_per_type = "";
         $contact_im_gt_ot = "";
         $contact_im_gt_ot_type = "";
         $im_gt = "";
         $contact_note = "";
         $do_contact = new Contact();
         $do_company = new Company();
         $do_contact_notes = new ContactNotes();
         $num = count($data);
         if ($row > 1) {
             for ($c = 0; $c < $num; $c++) {
                 switch ($eventcontroler->fields[$c]) {
                     case "firstname":
                         $contact_firstname = $data[$c];
                         break;
                     case "lastname":
                         $contact_lastname = $data[$c];
                         break;
                     case "company":
                         $company = $data[$c];
                         $contact_company = $data[$c];
                         break;
                     case "position":
                         $contact_position = $data[$c];
                         break;
                     case "summary":
                         $contact_summary = $data[$c];
                         break;
                     case "birthday":
                         $contact_birthday = $data[$c];
                         break;
                     case "city":
                         $contact_city = $data[$c];
                         break;
                     case "state":
                         $contact_state = $data[$c];
                         break;
                     case "street":
                         $contact_street = $data[$c];
                         break;
                     case "zipcode":
                         $contact_zipcode = $data[$c];
                         break;
                     case "country":
                         $contact_country = $data[$c];
                         break;
                     case "address_hm":
                         $contact_address_hm = $data[$c];
                         $contact_address_hm_type = "Home";
                         break;
                     case "address_wk":
                         $contact_address_wk = $data[$c];
                         $contact_address_wk_type = "Work";
                         break;
                     case "address_ot":
                         $contact_address_ot = $data[$c];
                         $contact_address_ot_type = "Other";
                         break;
                     case "email_hm":
                         $contact_email_hm = $data[$c];
                         $contact_email_hm_type = "Home";
                         break;
                     case "email_wk":
                         $contact_email_wk = $data[$c];
                         $contact_email_wk_type = "Work";
                         break;
                     case "email_ot":
                         $contact_email_ot = $data[$c];
                         $contact_email_ot_type = "Other";
                         break;
                     case "phone_number_hm":
                         $contact_phone_hm = $data[$c];
                         $contact_phone_hm_type = "Home";
                         break;
                     case "phone_number_wk":
                         $contact_phone_wk = $data[$c];
                         $contact_phone_wk_type = "Work";
                         break;
                     case "phone_number_ot":
                         $contact_phone_ot = $data[$c];
                         $contact_phone_ot_type = "Other";
                         break;
                     case "phone_number_mb":
                         $contact_phone_mb = $data[$c];
                         $contact_phone_mb_type = "Mobile";
                         break;
                     case "phone_number_fx":
                         $contact_phone_fx = $data[$c];
                         $contact_phone_fx_type = "Fax";
                         break;
                     case "website_comp":
                         $contact_website_comp = $data[$c];
                         $contact_website_comp_type = "Company";
                         break;
                     case "website_blog":
                         $contact_website_blog = $data[$c];
                         $contact_website_blog_type = "Blog";
                         break;
                     case "website_ot":
                         $contact_website_ot = $data[$c];
                         $contact_website_ot_type = "Other";
                         break;
                     case "website_personal":
                         $contact_website_personal = $data[$c];
                         $contact_website_personal_type = "Personal";
                         break;
                     case "website_twitter":
                         $contact_website_twitter = $data[$c];
                         $contact_website_twitter_type = "Twitter";
                         break;
                     case "website_linkedin":
                         $contact_website_linkedin = $data[$c];
                         $contact_website_linkedin_type = "LinkedIn";
                         break;
                     case "website_fb":
                         $contact_website_fb = $data[$c];
                         $contact_website_fb_type = "Facebook";
                         break;
                     case "im_aim_wk":
                         $contact_im_aim_wk = $data[$c];
                         $im_aim = "AIM";
                         $contact_im_aim_wk_type = "Work";
                         break;
                     case "im_aim_per":
                         $contact_im_aim_per = $data[$c];
                         $im_aim = "AIM";
                         $contact_im_aim_per_type = "Personal";
                         break;
                     case "im_aim_ot":
                         $contact_im_aim_ot = $data[$c];
                         $im_aim = "AIM";
                         $contact_im_aim_ot_type = "Other";
                         break;
                     case "im_msn_wk":
                         $contact_im_msn_wk = $data[$c];
                         $im_msn = "MSN";
                         $contact_im_msn_wk_type = "Work";
                         break;
                     case "im_msn_per":
                         $contact_im_msn_per = $data[$c];
                         $im_msn = "MSN";
                         $contact_im_msn_per_type = "Personal";
                         break;
                     case "im_msn_ot":
                         $contact_im_msn_ot = $data[$c];
                         $im_msn = "MSN";
                         $contact_im_msn_ot_type = "Other";
                         break;
                     case "im_icq_wk":
                         $contact_im_icq_wk = $data[$c];
                         $im_icq = "ICQ";
                         $contact_im_icq_wk_type = "Work";
                         break;
                     case "im_icq_per":
                         $contact_im_icq_per = $data[$c];
                         $im_icq = "ICQ";
                         $contact_im_icq_per_type = "Personal";
                         break;
                     case "im_icq_ot":
                         $contact_im_icq_ot = $data[$c];
                         $im_icq = "ICQ";
                         $contact_im_icq_ot_type = "Other";
                         break;
                     case "im_jabber_wk":
                         $contact_im_jabber_wk = $data[$c];
                         $im_jabber = "Jabber";
                         $contact_im_jabber_wk_type = "Work";
                         break;
                     case "im_jabber_per":
                         $contact_im_jabber_per = $data[$c];
                         $im_jabber = "Jabber";
                         $contact_im_jabber_per_type = "Personal";
                         break;
                     case "im_jabber_ot":
                         $contact_im_jabber_ot = $data[$c];
                         $im_jabber = "Jabber";
                         $contact_im_jabber_ot_type = "Other";
                     case "im_yahoo_wk":
                         $contact_im_yahoo_wk = $data[$c];
                         $im_yahoo = "Yahoo";
                         $contact_im_yahoo_wk_type = "Work";
                         break;
                     case "im_yahoo_per":
                         $contact_im_yahoo_per = $data[$c];
                         $im_yahoo = "Yahoo";
                         $contact_im_yahoo_per_type = "Personal";
                         break;
                     case "im_yahoo_ot":
                         $contact_im_yahoo_ot = $data[$c];
                         $im_yahoo = "Yahoo";
                         $contact_im_yahoo_ot_type = "Other";
                         break;
                     case "im_skype_wk":
                         $contact_im_skype_wk = $data[$c];
                         $im_skype = "Skype";
                         $contact_im_skype_wk_type = "Work";
                         break;
                     case "im_skype_per":
                         $contact_im_skype_per = $data[$c];
                         $im_skype = "Skype";
                         $contact_im_skype_per_type = "Personal";
                         break;
                     case "im_skype_ot":
                         $contact_im_skype_ot = $data[$c];
                         $im_skype = "Skype";
                         $contact_im_skype_ot_type = "Other";
                     case "im_gt_wk":
                         $contact_im_gt_wk = $data[$c];
                         $im_gt = "Google Talk";
                         $contact_im_gt_wk_type = "Work";
                         break;
                     case "im_gt_per":
                         $contact_im_gt_per = $data[$c];
                         $im_gt = "Google Talk";
                         $contact_im_gt_per_type = "Personal";
                         break;
                     case "im_gt_ot":
                         $contact_im_gt_ot = $data[$c];
                         $im_gt = "Google Talk";
                         $contact_im_gt_ot_type = "Other";
                         break;
                     case "note":
                         $contact_note .= "<p>" . $data[$c] . "</p>";
                         break;
                 }
             }
             $do_company->name = $company;
             $do_company->iduser = $iduser;
             $do_company->add();
             $idcompany = $do_company->getPrimaryKeyValue();
             $do_contact->idcompany = $idcompany;
             $do_contact->iduser = $iduser;
             $do_contact->firstname = $contact_firstname;
             $do_contact->lastname = $contact_lastname;
             $do_contact->company = $contact_company;
             $do_contact->position = $contact_position;
             $do_contact->summary = $contact_summary;
             $do_contact->birthday = $contact_birthday;
             $do_contact->add();
             $idcontact = $do_contact->getPrimaryKeyValue();
             //In theory this below should not be needed
             $do_contact->idcontact = $idcontact;
             $do_tag = new Tag();
             if (strpos($_SESSION['import_tag'], ",") === false) {
                 $do_tag->addTagAssociation($idcontact, trim($_SESSION['import_tag']), "contact", $_SESSION['do_User']->iduser);
             } else {
                 $tags = explode(",", $_SESSION['import_tag']);
                 foreach ($tags as $tag) {
                     $do_tag->addTagAssociation($idcontact, trim($tag), "contact", $_SESSION['do_User']->iduser);
                 }
             }
             if ($contact_address_hm != "" || $contact_city != "" || $contact_state != "" || $contact_street != "" || $contact_zipcode != "" || $contact_country != "") {
                 $do_contact->addAddress($contact_address_hm, $contact_address_hm_type, $contact_city, $contact_state, $contact_street, $contact_zipcode, $contact_country);
             }
             if ($contact_address_wk != "" || $contact_city != "" || $contact_state != "" || $contact_street != "" || $contact_zipcode != "" || $contact_country != "") {
                 $do_contact->addAddress($contact_address_wk, $contact_address_wk_type, $contact_city, $contact_state, $contact_street, $contact_zipcode, $contact_country);
             }
             if ($contact_address_ot != "" || $contact_city != "" || $contact_state != "" || $contact_street != "" || $contact_zipcode != "" || $contact_country != "") {
                 $do_contact->addAddress($contact_address_ot, $contact_address_ot_type, $contact_city, $contact_state, $contact_street, $contact_zipcode, $contact_country);
             }
             if ($contact_email_hm != "") {
                 $do_contact->addEmail($contact_email_hm, $contact_email_hm_type);
             }
             if ($contact_email_wk != "") {
                 $do_contact->addEmail($contact_email_wk, $contact_email_wk_type);
             }
             if ($contact_email_ot != "") {
                 $do_contact->addEmail($contact_email_ot, $contact_email_ot_type);
             }
             if ($contact_phone_hm != "") {
                 $do_contact->addPhone($contact_phone_hm, $contact_phone_hm_type);
             }
             if ($contact_phone_wk != "") {
                 $do_contact->addPhone($contact_phone_wk, $contact_phone_wk_type);
             }
             if ($contact_phone_ot != "") {
                 $do_contact->addPhone($contact_phone_ot, $contact_phone_ot_type);
             }
             if ($contact_phone_mb != "") {
                 $do_contact->addPhone($contact_phone_mb, $contact_phone_mb_type);
             }
             if ($contact_phone_fx != "") {
                 $do_contact->addPhone($contact_phone_fx, $contact_phone_fx_type);
             }
             if ($contact_website_comp != "") {
                 $do_contact->addWebsite($contact_website_comp, $contact_website_comp_type);
             }
             if ($contact_website_blog != "") {
                 $do_contact->addWebsite($contact_website_blog, $contact_website_blog_type);
             }
             if ($contact_website_ot != "") {
                 $do_contact->addWebsite($contact_website_ot, $contact_website_ot_type);
             }
             if ($contact_website_personal != "") {
                 $do_contact->addWebsite($contact_website_personal, $contact_website_personal_type);
             }
             if ($contact_website_twitter != "") {
                 $do_contact->addWebsite($contact_website_twitter, $contact_website_twitter_type);
             }
             if ($contact_website_linkedin != "") {
                 $do_contact->addWebsite($contact_website_linkedin, $contact_website_linkedin_type);
             }
             if ($contact_website_fb != "") {
                 $do_contact->addWebsite($contact_website_fb, $contact_website_fb_type);
             }
             if ($contact_im_aim_wk != "") {
                 $do_contact->addIM($im_aim, $contact_im_aim_wk_type, $contact_im_aim_wk);
             }
             if ($contact_im_aim_per != "") {
                 $do_contact->addIM($im_aim, $contact_im_aim_per_type, $contact_im_aim_per);
             }
             if ($contact_im_aim_ot != "") {
                 $do_contact->addIM($im_aim, $contact_im_aim_ot_type, $contact_im_aim_ot);
             }
             if ($contact_im_msn_wk != "") {
                 $do_contact->addIM($im_msn, $contact_im_msn_wk_type, $contact_im_msn_wk);
             }
             if ($contact_im_msn_per != "") {
                 $do_contact->addIM($im_msn, $contact_im_msn_per_type, $contact_im_msn_per);
             }
             if ($contact_im_msn_ot != "") {
                 $do_contact->addIM($im_msn, $contact_im_msn_ot_type, $contact_im_msn_ot);
             }
             if ($contact_im_icq_wk != "") {
                 $do_contact->addIM($im_icq, $contact_im_icq_wk_type, $contact_im_icq_wk);
             }
             if ($contact_im_icq_per != "") {
                 $do_contact->addIM($im_icq, $contact_im_icq_per_type, $contact_im_icq_per);
             }
             if ($contact_im_icq_ot != "") {
                 $do_contact->addIM($im_icq, $contact_im_icq_ot_type, $contact_im_icq_ot);
             }
             if ($contact_im_jabber_wk != "") {
                 $do_contact->addIM($im_jabber, $contact_im_jabber_wk_type, $contact_im_jabber_wk);
             }
             if ($contact_im_jabber_per != "") {
                 $do_contact->addIM($im_jabber, $contact_im_jabber_per_type, $contact_im_jabber_per);
             }
             if ($contact_im_jabber_ot != "") {
                 $do_contact->addIM($im_jabber, $contact_im_jabber_ot_type, $contact_im_jabber_ot);
             }
             if ($contact_im_yahoo_wk != "") {
                 $do_contact->addIM($im_yahoo, $contact_im_yahoo_wk_type, $contact_im_yahoo_wk);
             }
             if ($contact_im_yahoo_per != "") {
                 $do_contact->addIM($im_yahoo, $contact_im_yahoo_per_type, $contact_im_yahoo_per);
             }
             if ($contact_im_yahoo_ot != "") {
                 $do_contact->addIM($im_yahoo, $contact_im_yahoo_ot_type, $contact_im_yahoo_ot);
             }
             if ($contact_im_skype_wk != "") {
                 $do_contact->addIM($im_skype, $contact_im_skype_wk_type, $contact_im_skype_wk);
             }
             if ($contact_im_skype_per != "") {
                 $do_contact->addIM($im_skype, $contact_im_skype_per_type, $contact_im_skype_per);
             }
             if ($contact_im_skype_ot != "") {
                 $do_contact->addIM($im_skype, $contact_im_skype_ot_type, $contact_im_skype_ot);
             }
             if ($contact_im_gt_wk != "") {
                 $do_contact->addIM($im_gt, $contact_im_gt_wk_type, $contact_im_gt_wk);
             }
             if ($contact_im_gt_per != "") {
                 $do_contact->addIM($im_gt, $contact_im_gt_per_type, $contact_im_gt_per);
             }
             if ($contact_im_gt_ot != "") {
                 $do_contact->addIM($im_gt, $contact_im_gt_ot_type, $contact_im_gt_ot);
             }
             if ($contact_note != "") {
                 $do_contact_notes->idcontact = $idcontact;
                 $do_contact_notes->iduser = $iduser;
                 $do_contact_notes->note = $contact_note;
                 $do_contact_notes->date_added = date('Y-m-d');
                 $do_contact_notes->add();
             }
             $do_cont_view = new ContactView();
             $do_cont_view->addFromContact($do_contact);
             $do_cont_view->updateFromContact($do_contact);
             // Added the method call updateFromContact() so that the child data is updated just after insert
             $do_cont_view->addTag($_SESSION['import_tag'], $do_contact->idcontact);
             // Update the contact view for tags.
             $do_contact->free();
             $do_company->free();
             $do_contact_notes->free();
         }
         $row++;
     }
     fclose($handle);
     $goto = $eventcontroler->getParam("goto");
     $disp = new Display($goto);
     $disp->addParam("message", "Contacts have been imported successfully.");
     $eventcontroler->setDisplayNext($disp);
 }
Exemple #11
0
 /**
  * eventAddTagMultiple
  * Triggered form the contacts.php page when assigning multiple tags 
  * to a single contact.
  */
 function eventAddTagMultiple(EventControler $event_controler)
 {
     $this->eventSetFilter($event_controler);
     $tags = explode(",", $event_controler->tags);
     $contacts = $event_controler->getParam("ck");
     if (is_array($tags) && is_array($contacts)) {
         $do_tag = new Tag();
         $contact_view = new ContactView();
         foreach ($contacts as $idcontact) {
             $contact_view->getId($idcontact);
             foreach ($tags as $tag) {
                 $tag = trim($tag);
                 $do_tag->addNew();
                 $do_tag->addTagAssociation($idcontact, $tag, "contact");
                 $contact_view->addTag($tag);
             }
         }
     }
     $_SESSION['tag_refresh_now'] = true;
 }
Exemple #12
0
         $name = $name_email;
     } else {
         $name = $contact_email;
     }
     $do_contact->addNew();
     $do_contact->firstname = $name;
     $do_contact->iduser = $iduser;
     $do_contact->add();
     $idcontact = $do_contact->getInsertId();
     $do_contact_email->addNew();
     $do_contact_email->idcontact = $idcontact;
     $do_contact_email->email_address = $contact_email;
     $do_contact_email->email_type = 'Work';
     $do_contact_email->add();
     $do_contact->getId($idcontact);
     $do_contact_view = new ContactView();
     $do_contact_view->setUser($iduser);
     $do_contact_view->addFromContact($do_contact);
     $do_activity->addNew();
     $do_activity->idcontact = $idcontact;
     $do_activity->when = date("Y-m-d H:i:s");
     $do_activity->add();
 }
 // For now add multiple notes for multiple attachment
 if (is_array($attachment) && count($attachment) > 0) {
     $attachment_count = 0;
     foreach ($attachment as $attachment) {
         $attachment_count++;
         $do_contact_note->addNew();
         $do_contact_note->iduser = $iduser;
         $do_contact_note->idcontact = $idcontact;
<?php

/** Ofuz Open Source version is released under the GNU Affero General Public License, please read the full license at: http://www.gnu.org/licenses/agpl-3.0.html **/
// Copyright 2008 - 2010 all rights reserved, SQLFusion LLC, info@sqlfusion.com
/** Ofuz Open Source version is released under the GNU Affero General Public License, please read the full license at: http://www.gnu.org/licenses/agpl-3.0.html **/
/**
 * Rebuild the user contacts table
 * User contacts are accessed from the tables by userid<iduser>_contact
 * The contact table is updated for all the contact related operation and also the user contact table is getting updated on
 * add/edit/delete operation of contact, tag etc.
 * To make it more reliable the following script is used. This is rebuilt all the user contact tables.
 * This script is intensive as the volume of contact and user increases.
 * Wise to set the script once in a week. Also we can ignore rebuiling of user contact tables who have not logged in in certain period by passing the parameter
 * in getUserLoggedInWithinPeriod() default is 7 days
 * @see class/Contact.class.php
 * @see class/ContactView.class.php
 *
 */
include_once "config.php";
$contact_view = new ContactView();
set_time_limit(36000);
$user = new User();
$user->getUserLoggedInWithinPeriod();
while ($user->next()) {
    // if($user->iduser == 20 ){
    echo "\n<br>User id:" . $user->iduser . " Name:" . $user->firstname . " " . $user->lastname;
    $contact_view->setUser($user->iduser);
    $contact_view->rebuildContactUserTable();
    //  }
}
Exemple #14
0
 public function start()
 {
     global $ConfSitePATH, $Conf;
     assert($this->checkt === null && $this->logfile === null);
     // collect user information
     $this->username = "******";
     if ($this->runner->username) {
         $this->username = $this->runner->username;
     } else {
         if ($this->pset->run_username) {
             $this->username = $this->pset->run_username;
         }
     }
     if (!preg_match('/\\A\\w+\\z/', $this->username)) {
         throw new RunnerException("bad run_username");
     }
     $info = posix_getpwnam($this->username);
     $this->userhome = $info ? $info["dir"] : "/home/jail61";
     $this->userhome = preg_replace(',/+\\z,', '', $this->userhome);
     $this->jaildir = preg_replace(',/+\\z,', '', $this->expand($this->pset->run_dirpattern));
     if (!$this->jaildir) {
         throw new RunnerException("bad run_dirpattern");
     }
     $this->jailhomedir = $this->jaildir . "/" . preg_replace(',\\A/+,', '', $this->userhome);
     if (!chdir($ConfSitePATH)) {
         throw new RunnerException("can't cd to main directory");
     }
     if (!is_executable("jail/pa-jail")) {
         throw new RunnerException("the pa-jail program has not been compiled");
     }
     // create logfile and lockfile
     $this->checkt = time();
     $this->logfile = ContactView::runner_logfile($this->info, $this->checkt);
     $this->lockfile = $this->logfile . ".pid";
     file_put_contents($this->lockfile, "");
     $this->inputfifo = $this->logfile . ".in";
     if (!posix_mkfifo($this->inputfifo, 0660)) {
         $this->inputfifo = null;
     }
     $this->logstream = fopen($this->logfile, "a");
     if ($this->queue) {
         Dbl::qe("update ExecutionQueue set runat=?, status=1, lockfile=?, inputfifo=? where queueid=?", $this->checkt, $this->lockfile, $this->inputfifo, $this->queue->queueid);
     }
     register_shutdown_function(array($this, "cleanup"));
     // create jail
     $this->remove_old_jails();
     if ($this->run_and_log("jail/pa-jail init " . escapeshellarg($this->jaildir) . " " . escapeshellarg($this->username))) {
         throw new RunnerException("can't initialize jail");
     }
     // check out code
     $this->checkout_code();
     // save commit settings
     if ($runsettings = $this->info->commit_info("runsettings")) {
         $this->add_run_settings($runsettings);
     }
     // actually run
     $command = "echo; jail/pa-jail run" . " -p" . escapeshellarg($this->lockfile);
     $skeletondir = $this->pset->run_skeletondir ?: $Conf->opt("run_skeletondir");
     $binddir = $this->pset->run_binddir ?: $Conf->opt("run_binddir");
     if ($skeletondir && $binddir) {
         $binddir = preg_replace(',/+\\z,', '', $binddir);
         $contents = "/ <- " . $skeletondir . " [bind-ro]\n" . $this->userhome . " <- " . $this->jailhomedir . " [bind]\n";
         $command .= " -u" . escapeshellarg($this->jailhomedir) . " -F" . escapeshellarg($contents);
         $homedir = $binddir;
     } else {
         $command .= " -h -f" . escapeshellarg($this->expand($this->pset->run_jailfiles));
         if ($skeletondir) {
             $command .= " -S" . escapeshellarg($skeletondir);
         }
         $homedir = $this->jaildir;
     }
     if ($this->runner->timeout > 0) {
         $command .= " -T" . $this->runner->timeout;
     } else {
         if ($this->pset->run_timeout > 0) {
             $command .= " -T" . $this->pset->run_timeout;
         }
     }
     if ($this->inputfifo) {
         $command .= " -i" . escapeshellarg($this->inputfifo);
     }
     $command .= " " . escapeshellarg($homedir) . " " . escapeshellarg($this->username) . " " . escapeshellarg($this->expand($this->runner->command));
     $this->lockfile = null;
     /* now owned by command */
     return $this->run_and_log($command);
 }
 /**
  * saveWebForm()
  * this will check if contact exists with firname, lastname, name and email 
  * If exist add to it, if doesn't exists create a new one.
  */
 function posteventAddContact($fid, $fields, $nxturl, $uid, $tags)
 {
     //echo 'hh';die();
     //$fields = $_REQUEST['fields'];
     //$fields = $event_controler->fields;
     $this->setLog("\n eventAddContact, creating new contact from form, using " . count($fields) . " fields. (" . date("Y/m/d H:i:s") . ")");
     //$dropcode = $_POST['dropcode'];
     $do_contact = new Contact();
     $do_contact->iduser = $uid;
     $do_contact->add();
     $this->setLog("\n new contact:" . $do_contact->idcontact . " for user:"******"\n Processing field:" . $field_name . " with value:" . $field_value);
         $do_webform_fields = new WebFormUserField();
         $do_webform_fields->query("SELECT wfu.name, wff.class as class_name, wff.variable, wff.variable_type, wfu.required \n\t\t                                   FROM webformfields as wff, webformuserfield as wfu \n\t\t\t\t\t\t\t\t\t\t   WHERE wff.name=wfu.name\n\t\t\t\t\t\t\t\t\t\t     AND wfu.name = '" . $field_name . "'\n\t\t\t\t\t\t\t\t\t\t\t AND wfu.idwebformuser= "******"\n Field information class:" . $do_webform_fields->class_name . " Variable:" . $do_webform_fields->variable);
         $this->setLog("\n rows:" . $do_webform_fields->getNumRows());
         if ($do_webform_fields->getNumRows() == 1) {
             if ($do_webform_fields->class_name == "Contact") {
                 $this->setLog("\n     Updating contact");
                 $do_contact->{$do_webform_fields->variable} = $field_value;
                 $do_contact->update();
             } else {
                 $update = false;
                 if (is_object(${'sub_' . $do_webform_fields->class_name})) {
                     if (${'sub_' . $do_webform_fields->class_name}->getType() == $do_webform_fields->variable_type) {
                         $update = true;
                     }
                 }
                 if ($update) {
                     $this->setLog("\n     Updating class:" . $do_webform_fields->class_name);
                     $obj = ${'sub_' . $do_webform_fields->class_name};
                     $obj->{$do_webform_fields->variable} = $field_value;
                     $obj->update();
                 } else {
                     $class_name = $do_webform_fields->class_name;
                     ${'sub_' . $class_name} = new $class_name();
                     $obj = ${'sub_' . $class_name};
                     $obj->{$do_webform_fields->variable} = $field_value;
                     if (method_exists($obj, "setType") && strlen($do_webform_fields->variable_type) > 0) {
                         $obj->setType($do_webform_fields->variable_type);
                     }
                     $obj->idcontact = $do_contact->getPrimaryKeyValue();
                     $obj->add();
                 }
             }
         }
     }
     $contact_view = new ContactView();
     $contact_view->setUser($uid);
     $contact_view->addFromContact($do_contact);
     $tags = explode(",", $tags);
     foreach ($tags as $tag) {
         $tag = trim($tag);
         $do_tag = new Tag();
         $do_tag->addNew();
         $do_tag->addTagAssociation($do_contact->getPrimaryKeyValue(), $tag, "contact", $fid);
         $contact_view->addTag($tag);
     }
     if (strlen($nexturl) > 0) {
         //$event_controler->setUrlNext($this->urlnext);
         header("location:{$nxturl}");
     } else {
         //$event_controler->setUrlNext($GLOBALS['cfg_ofuz_site_http_base'].'web_form_thankyou.php');
         $url = $GLOBALS['cfg_ofuz_site_http_base'] . 'web_form_thankyou.php';
         header("location:{$url}");
     }
     //$event_controler->addParam("do_contact", $do_contact);
 }
Exemple #16
0
 /**
     Method to re-create the tags associated with a contact with the shared Co-Workers
     @param integer idcontact
     @param integer idcoworker
 */
 function addTagOnContactSharing($idcontact, $idcoworker, $iduser = 0)
 {
     if ($iduser == 0) {
         $iduser = $_SESSION['do_User']->iduser;
     }
     $tags = $this->getAllTagNamesForReferer($idcontact, $iduser);
     $comma_separated_tags = '';
     if (is_array($tags) && count($tags) > 0) {
         $do_contact_view = new ContactView();
         foreach ($tags as $tag) {
             $this->addTagAssociation($idcontact, $tag, "", $idcoworker);
         }
         $do_contact_view->setUser($idcoworker);
         $do_contact_view->addTag(implode(",", $tags), $idcontact);
     }
 }
 /**
  * Function to unshare a contact
  * @param integer $idcontact
  * @param interger $idcoworker
  */
 function unshareContact($idcontact, $idcoworker)
 {
     $q = new sqlQuery($this->getDbCon());
     $q->query("delete from " . $this->table . " where idcontact = " . $idcontact . " AND idcoworker = " . $idcoworker . " AND iduser ="******" LIMIT 1");
     $do_contact_view = new ContactView();
     $do_contact_view->setUser($idcoworker);
     $do_contact_view->deleteFromContact($idcontact);
 }
Exemple #18
0
function render_pset_row($pset, $students, $s, $row, $pcmembers)
{
    global $Me, $Now, $Profile;
    $row->sortprefix = "";
    $ncol = 0;
    $t0 = $Profile ? microtime(true) : 0;
    $t = "<td class=\"s61username\">";
    if ($pset->anonymous) {
        $x = $s->anon_username;
    } else {
        $x = $s->seascode_username ?: ($s->huid ?: $s->email);
    }
    $t .= "<a href=\"" . hoturl("pset", array("pset" => $pset->urlkey, "u" => $x, "sort" => @$_REQUEST["sort"])) . "\">" . htmlspecialchars($x) . "</a>";
    if ($Me->privChair) {
        $t .= "&nbsp;" . become_user_link($x, Text::name_html($s));
    }
    $t .= "</td>";
    ++$ncol;
    if (!$pset->anonymous) {
        $t .= "<td>" . Text::name_html($s) . ($s->extension ? " (X)" : "") . "</td>";
        ++$ncol;
    }
    $t .= "<td>";
    if ($s->gradercid) {
        if (isset($pcmembers[$s->gradercid])) {
            $t .= htmlspecialchars($pcmembers[$s->gradercid]->firstName);
        } else {
            $t .= "???";
        }
    }
    $t .= "</td>";
    ++$ncol;
    // are any commits committed?
    if (!$pset->gitless_grades) {
        if (($s->placeholder || $s->gradehash === null) && $s->repoid && ($s->placeholder_at < $Now - 3600 && rand(0, 2) == 0 || $s->placeholder_at < $Now - 600 && rand(0, 10) == 0) && (!$s->repoviewable || !$s->gradehash)) {
            // XXX this is slow given that most info is already loaded
            $info = ContactView::user_pset_info($s, $pset);
            $info->set_commit(null);
            $s->gradehash = $info->commit_hash() ?: null;
            $s->placeholder = 1;
            Dbl::qe("insert into RepositoryGrade (repoid, pset, gradehash, placeholder, placeholder_at) values (?, ?, ?, 1, ?) on duplicate key update gradehash=(if(placeholder=1,values(gradehash),gradehash)), placeholder_at=values(placeholder_at)", $s->repoid, $pset->id, $s->gradehash, $Now);
            if (!$s->repoviewable) {
                $s->repoviewable = $s->can_view_repo_contents($s);
            }
        }
        if (!$s->gradehash || $s->dropped) {
            $row->sortprefix = "~1 ";
        }
    }
    if (count($pset->grades)) {
        if ($pset->gitless_grades) {
            $gi = Contact::contact_grade_for($s, $pset);
            $gi = $gi ? $gi->notes : null;
        } else {
            if ($s->gradehash && !$s->placeholder) {
                $gi = $Me->commit_info($s->gradehash, $pset);
            } else {
                $gi = null;
            }
        }
        if (!$pset->gitless_grades) {
            $t .= "<td>";
            if ($gi && @$gi->linenotes) {
                $t .= "♪";
            } else {
                if ($Me->contactId == $s->gradercid) {
                    $s->incomplete = true;
                }
            }
            if ($gi && $s->gradercid != @$gi->gradercid && $Me->privChair) {
                $t .= "<sup>*</sup>";
            }
            $t .= "</td>";
            ++$ncol;
        }
        $garr = render_grades($pset, $gi, $s);
        $t .= '<td class="r">' . join('</td><td class="r">', $garr->all) . '</td>';
        $ncol += count($garr->all);
    }
    //echo "<td><a href=\"mailto:", htmlspecialchars($s->email), "\">",
    //htmlspecialchars($s->email), "</a></td>";
    $t .= "<td>";
    if ($s->url) {
        $t .= $s->repo_link($s->url, "repo");
        if (!$s->working) {
            $t .= ' <strong class="err">broken</strong>';
        } else {
            if (!$s->repoviewable) {
                $t .= ' <strong class="err">unconfirmed</strong>';
            }
        }
        if ($s->open) {
            $t .= ' <strong class="err">open</strong>';
        }
        if ($s->pcid != $s->rpcid || $s->pcid && (!isset($students[$s->pcid]) || $students[$s->pcid]->repoid != $s->repoid)) {
            $t .= ' <strong class="err">partner</strong>';
        }
    }
    $t .= "</td>";
    ++$ncol;
    if ($Profile) {
        $t .= sprintf("<td class=\"r\">%.06f</td>", microtime(true) - $t0);
        ++$ncol;
    }
    if (!@$row->ncol || $ncol > $row->ncol) {
        $row->ncol = $ncol;
    }
    $s->printed = true;
    return $t;
}
Exemple #19
0
 public function getHTML()
 {
     $contactView = new ContactView(array("title" => "Contact"));
     $html = $contactView->getHTML();
     return $html;
 }
Exemple #20
0
 * @package OfuzPage
 * @license GNU Affero General Public License
 * @version 0.6
 * @date 2010-09-06
 * @since 0.1
 */
$Author = 'SQLFusion LLC';
$Keywords = 'Keywords for search engine';
$Description = 'Description for search engine';
$background_color = 'white';
include_once 'config.php';
include_once 'includes/ofuz_check_access.script.inc.php';
$pageTitle = _('Contacts') . ' :: Ofuz ';
include_once 'includes/header.inc.php';
//rebuilding contact view if it's empty
$do_cv = new ContactView();
if ($do_cv->isContactViewEmpty()) {
    $do_con = new Contact();
    if ($do_con->getTotalNumContactsForUser($_SESSION["do_User"]->iduser)) {
        $do_cv->rebuildContactUserTable();
    }
}
if (!is_object($_SESSION['do_Contacts'])) {
    $do_Contacts = new Contact();
    // $do_Contacts->get_all_contacts();
    $do_Contacts->setRegistry("all_contacts");
    $do_Contacts->sessionPersistent("do_Contacts", "index.php", 36000);
    //$_SESSION['refresh_contacts'] = true;
    $do_Contacts->query("SELECT * FROM " . $do_Contacts->getSqlViewName() . " ORDER BY " . $do_Contacts->sql_view_order . " LIMIT " . $do_Contacts->sql_qry_start . "," . $do_Contacts->sql_view_limit);
} else {
    ///$_SESSION['do_Contacts']->setLog("\n ----------------- \n [Contact] :: contacts page query:".$_SESSION['do_Contacts']->getSqlQuery()."\n --------------\n");
Exemple #21
0
function render_pset_row(Pset $pset, $students, Contact $s, $row, $pcmembers, $anonymous)
{
    global $Conf, $Me, $Now, $Profile;
    $row->sortprefix = "";
    $ncol = 0;
    $t0 = $Profile ? microtime(true) : 0;
    $j = [];
    $j["username"] = $s->github_username ?: $s->seascode_username ?: ($s->email ?: $s->huid);
    if ($anonymous) {
        $j["anon_username"] = $s->anon_username;
    }
    $j["sorter"] = $s->sorter;
    ++$ncol;
    $j["name"] = Text::name_text($s);
    if ($s->extension) {
        $j["x"] = true;
    }
    if (!$anonymous) {
        ++$ncol;
    }
    if ($s->gradercid) {
        $j["gradercid"] = $s->gradercid;
    }
    ++$ncol;
    // are any commits committed?
    if (!$pset->gitless_grades) {
        if (($s->placeholder || $s->gradehash === null) && $s->repoid && ($s->placeholder_at < $Now - 3600 && rand(0, 2) == 0 || $s->placeholder_at < $Now - 600 && rand(0, 10) == 0) && (!$s->repoviewable || !$s->gradehash)) {
            // XXX this is slow given that most info is already loaded
            $info = ContactView::user_pset_info($s, $pset);
            $info->set_commit(null);
            $s->gradehash = $info->commit_hash() ?: null;
            $s->placeholder = 1;
            Dbl::qe("insert into RepositoryGrade (repoid, pset, gradehash, placeholder, placeholder_at) values (?, ?, ?, 1, ?) on duplicate key update gradehash=(if(placeholder=1,values(gradehash),gradehash)), placeholder_at=values(placeholder_at)", $s->repoid, $pset->id, $s->gradehash, $Now);
            if (!$s->repoviewable) {
                $s->repoviewable = $s->can_view_repo_contents($info->repo);
            }
        }
        if (!$s->gradehash || $s->dropped) {
            $row->sortprefix = "~1 ";
        }
    }
    if (count($pset->grades)) {
        $gi = null;
        if ($pset->gitless_grades) {
            $gi = $pset->contact_grade_for($s);
        } else {
            if ($s->gradehash && !$s->placeholder) {
                $gi = $pset->commit_notes($s->gradehash);
            }
        }
        $gi = $gi ? $gi->notes : null;
        if (!$pset->gitless_grades) {
            if ($gi && get($gi, "linenotes")) {
                $j["has_notes"] = true;
            } else {
                if ($Me->contactId == $s->gradercid) {
                    $s->incomplete = true;
                }
            }
            if ($gi && $s->gradercid != get($gi, "gradercid") && $Me->privChair) {
                $j["has_nongrader_notes"] = true;
            }
            ++$ncol;
        }
        $garr = render_grades($pset, $gi, $s);
        $ncol += count($garr->all);
        $j["grades"] = $garr->allv;
        $j["total"] = $garr->totalv;
        if ($garr->differentk) {
            $j["highlight_grades"] = $garr->differentk;
        }
    }
    //echo "<td><a href=\"mailto:", htmlspecialchars($s->email), "\">",
    //htmlspecialchars($s->email), "</a></td>";
    if (!$pset->gitless && $s->url) {
        $j["repo"] = RepositorySite::make_web_url($s->url, $Conf);
        if (!$s->working) {
            $j["repo_broken"] = true;
        } else {
            if (!$s->repoviewable) {
                $j["repo_unconfirmed"] = true;
            }
        }
        if ($s->open) {
            $j["repo_too_open"] = true;
        }
        if ($s->pcid != $s->rpcid || $s->pcid && (!isset($students[$s->pcid]) || $students[$s->pcid]->repoid != $s->repoid)) {
            $j["repo_partner_error"] = true;
        }
    }
    ++$ncol;
    if (!get($row, "ncol") || $ncol > $row->ncol) {
        $row->ncol = $ncol;
    }
    $s->visited = true;
    return $j;
}
Exemple #22
0
<?php

// face.php -- Peteramati face page
// HotCRP and Peteramati are Copyright (c) 2006-2015 Eddie Kohler and others
// See LICENSE for open-source distribution terms
require_once "src/initweb.php";
ContactView::set_path_request(array("/u"));
if ($Me->is_empty()) {
    $Me->escape();
}
global $User, $Pset, $Info;
$User = $Me;
if (isset($_REQUEST["u"])) {
    $User = ContactView::prepare_user($_REQUEST["u"]);
}
if (isset($_REQUEST["imageid"])) {
    if ($User && ($User === $Me || $Me->isPC) && $_REQUEST["imageid"] && ($result = Dbl::qe("select mimetype, `data` from ContactImage where contactId=? and contactImageId=?", $User->contactId, $_REQUEST["imageid"])) && ($row = edb_row($result))) {
        header("Content-Type: {$row['0']}");
        header("Cache-Control: public, max-age=31557600");
        header("Expires: " . gmdate("D, d M Y H:i:s", $Now + 31557600) . " GMT");
        if (!$zlib_output_compression) {
            header("Content-Length: " . strlen($row[1]));
        }
        print $row[1];
    } else {
        header("Content-Type: image/gif");
        if (!$zlib_output_compression) {
            header("Content-Length: 43");
        }
        print "GIF89a€!ù,D;";
    }
 function eventAddContactToTeamCW(Contact $contact)
 {
     $do_teams = new Teams();
     //gets user's teams which are marked as auto-shared
     $do_teams->getUserTeamsAutoShared();
     if ($do_teams->getNumRows()) {
         while ($do_teams->next()) {
             //gets Co-Workers of the team
             $do_teams_cw = new Teams();
             $do_teams_cw->getCoWorkersOfTheTeam($do_teams->idteam);
             if ($do_teams_cw->getNumRows()) {
                 while ($do_teams_cw->next()) {
                     $this->addNew();
                     $this->idcontact = $contact->idcontact;
                     $this->idteam = $do_teams->idteam;
                     $this->idcoworker = $do_teams_cw->idco_worker;
                     $this->add();
                     $this->free();
                     //building contact view table
                     $do_cv = new ContactView();
                     $do_cv->table = "userid" . $do_teams_cw->idco_worker . "_contact";
                     $do_cv->getId($contact->idcontact);
                     if (!$do_cv->hasData()) {
                         $do_cv->addNew();
                         $do_cv->idcontact = $contact->idcontact;
                         $do_cv->firstname = $contact->firstname;
                         $do_cv->lastname = $contact->lastname;
                         $do_cv->company = $contact->company;
                         $do_cv->idcompany = $contact->idcompany;
                         $do_cv->position = $contact->position;
                         $do_cv->picture = $contact->picture;
                         $do_cv->last_activity = date('Y-m-d h:i:s');
                         $do_cv->last_update = date('Y-m-d h:i:s');
                         $do_cv->first_created = date('Y-m-d h:i:s');
                         $do_cv->add();
                         $do_cv->free();
                     }
                     //Conact sharing with Co-Worker
                     $do_cs_check = new ContactSharing();
                     $contact_shared = $do_cs_check->checkCoWorkerContactRel($contact->idcontact, $do_teams_cw->idco_worker);
                     if (!$contact_shared) {
                         $do_cs = new ContactSharing();
                         $do_cs->addNew();
                         $do_cs->iduser = $_SESSION['do_User']->iduser;
                         $do_cs->idcontact = $contact->idcontact;
                         $do_cs->idcoworker = $do_teams_cw->idco_worker;
                         $do_cs->add();
                         $do_cs->free();
                     }
                     $do_cs_check->free();
                 }
             } else {
                 $this->addNew();
                 $this->idcontact = $_SESSION['ContactEditSave']->idcontact;
                 $this->idteam = $do_teams->idteam;
                 $this->add();
                 $this->free();
             }
             $do_teams_cw->free();
         }
     }
     $do_teams->free();
 }
 function add_contact()
 {
     $do_api_contact = new Contact();
     $do_Contact_View = new ContactView();
     $do_api_contact->addNew();
     $do_api_contact->firstname = $this->firstname;
     $do_api_contact->lastname = $this->lastname;
     $do_api_contact->position = $this->position;
     $do_api_contact->iduser = $this->iduser;
     if ($this->tags != '') {
         $tags = explode(",", $this->tags);
     }
     if ($this->firstname == "" && $this->lastname == "") {
         $this->setMessage("610", "First Name OR Last Name is Required");
         return false;
     } elseif (!$this->iduser) {
         $this->setMessage("502", "The User Session is expired");
         return false;
     } elseif ($idcontact = $do_api_contact->duplicateContact($this->iduser, $this->email_work, $this->email_home, $this->email_other)) {
         $this->setMessage("613", "The Contact is duplicated. Contact ID:  " . $idcontact);
         return false;
     } else {
         if ($this->company != "") {
             $do_api_contact->company = $this->company;
             $do_api_company = new Company();
             $idcompany = $do_api_company->isDuplicateCompany($this->company, $this->iduser);
             if (!$idcompany) {
                 $do_api_company->addNew();
                 $do_api_company->iduser = $this->iduser;
                 $do_api_company->name = trim($this->company);
                 $do_api_company->add();
                 $this->idcompany = $do_api_company->getPrimaryKeyValue();
             } else {
                 $this->idcompany = $idcompany;
             }
             $do_api_contact->idcompany = $this->idcompany;
         }
         $do_api_contact->add();
         $this->idcontact = $do_api_contact->getPrimaryKeyValue();
         $do_api_contact->idcontact = $this->idcontact;
         //child data starts here
         // Phones
         if ($this->phone_work != "") {
             $do_api_contact->addPhone($this->phone_work, "Work");
         }
         if ($this->phone_home != "") {
             $do_api_contact->addPhone($this->phone_home, "Home");
         }
         if ($this->mobile_number != "") {
             $do_api_contact->addPhone($this->mobile_number, "Mobile");
         }
         if ($this->fax_number != "") {
             $do_api_contact->addPhone($this->fax_number, "Fax");
         }
         if ($this->phone_other != "") {
             $do_api_contact->addPhone($this->phone_other, "Other");
         }
         //emails
         if ($this->email_work != "") {
             $do_api_contact->addEmail($this->email_work, "Work");
         }
         if ($this->email_home != "") {
             $do_api_contact->addEmail($this->email_home, "Home");
         }
         if ($this->email_other != "") {
             $do_api_contact->addEmail($this->email_other, "Other");
         }
         //Website
         if ($this->company_website != "") {
             $do_api_contact->addWebsite($this->company_website, "Company");
         }
         if ($this->personal_website != "") {
             $do_api_contact->addWebsite($this->personal_website, "Personal");
         }
         if ($this->blog_url != "") {
             $do_api_contact->addWebsite($this->blog_url, "Blog");
         }
         if ($this->twitter_profile_url != "") {
             $do_api_contact->addWebsite($this->twitter_profile_url, "Twitter");
         }
         if ($this->linkedin_profile_url != "") {
             $do_api_contact->addWebsite($this->linkedin_profile_url, "LinkedIn");
         }
         if ($this->facebook_profile_url != "") {
             $do_api_contact->addWebsite($this->facebook_profile_url, "Facebook");
         }
         // API V.02 will have IM and Address
         //Add tags if any
         if (is_array($tags)) {
             $do_api_tags = new Tag();
             foreach ($tags as $tag) {
                 $do_api_tags->addNew();
                 $do_api_tags->addTagAssociation($this->idcontact, $tag, "contact", $this->iduser);
             }
         }
         // Ok here the last thing that needs to be done so that the contact should also on the table
         $do_Contact_View = new ContactView();
         $do_Contact_View->setUser($this->iduser);
         $do_api_contact->getId($this->idcontact);
         $do_Contact_View->addFromContact($do_api_contact);
         $do_Contact_View->updateFromContact($do_api_contact);
         if ($this->tags != '') {
             $do_Contact_View->addTag($this->tags, $this->idcontact);
         }
         $this->setValues(array("msg" => "Contact Added", "stat" => "ok", "code" => "600", "idcontact" => $this->idcontact));
         return true;
     }
 }
Exemple #25
0
    $ofuz_twitter = new Ofuz_Service_Twitter($tw_user_id, $tw_config, $token);
    $friends = $ofuz_twitter->userFriends(array('id' => $tw_user_id));
    if (count($friends->user) > 0) {
        foreach ($friends->user as $user) {
            $user_id = $user->id;
            $name = $user->name;
            // will contain the first and last name
            $screen_name = $user->screen_name;
            $description = $user->description;
            $profile_image_url = $user->profile_image_url;
            $url = $user->url;
            $friend_data = array('user_id' => $user_id, 'name' => $name, 'screen_name' => $screen_name, 'description' => $description, 'profile_image_url' => $profile_image_url, 'url' => $url);
            $do_twitter->importTwitterFriend($friend_data);
        }
        //rebuilding the userXX_contact table
        $contact_view = new ContactView();
        $contact_view->setUser($_SESSION['do_User']->iduser);
        $contact_view->rebuildContactUserTable();
        echo _('Your Twitter contacts have been successfully imported.');
        echo '&nbsp;&nbsp;&nbsp;<a href="contacts.php">', _('Go to the Contacts Page'), '</a>';
    }
    ?>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
    $("#waitimage").hide(0);
});
//]]>
</script>
    <div class="spacerblock_80"></div><div class="spacerblock_80"></div>
</div>
    } else {
        $message = 'already_unsub_from_list';
    }
    $do_cont_note = new ContactNotes();
    $do_cont_note->addNew();
    $do_cont_note->idcontact = $idcontact;
    $do_cont_note->note = $firstname . " " . $lastname . " has unsubscribed from the autoresponder series called " . $responder;
    $do_cont_note->date_added = date("Y-m-d");
    $do_cont_note->iduser = $iduser;
    $do_cont_note->add();
    $do_workfeed_uns = new WorkFeedContactUnsubscibeEmails();
    $do_workfeed_uns->addUnsubscribeEmailWorkfeed($do_cont_note, $responder);
    $q = new sqlQuery($GLOBALS['conx']);
    $sql = "DELETE FROM `tag` WHERE iduser={$iduser} AND idreference={$idcontact} AND idtag={$idtag}";
    $q->query($sql);
    $do_contact_view = new ContactView();
    $do_contact_view->setUser($iduser);
    $do_contact_view->deleteTag($do_tag->tag_name, $idcontact);
    //$message = $firstname." ".$lastname.' '._('you have successfully unsubscribed from the autoresponder series called').' '.$responder;
    $message = 'unsub_list_message';
    $data = array("firstname" => $firstname, "lastname" => $lastname, "responder" => $responder);
    $do_contact->sendMessage(new EmailTemplate("unsubscribe_auto_responder"), $data);
} else {
    $message = 'already_unsub_from_list';
}
//header("Location: http://ofuz.com");
//exit();
?>
<div class="loginbg1">
    <!--<div class="loginheader"><a href="/index.php"><img src="/images/ofuz_logo2.jpg" width="170" height="90" alt="" /></a></div>-->
    <div style = "width:500px;margin: 0 auto; padding: 10px; text-align:left;">
Exemple #27
0
    Dbl::qe_apply("update ContactInfo set " . join($ck, ",") . " where contactId=" . $User->contactId, $cv);
    redirectSelf();
}
$Conf->header("Profile", "profile");
$xsep = " <span class='barsep'>&nbsp;|&nbsp;</span> ";
echo "<div id='homeinfo'>";
echo "<h2 class='homeemail'>", Text::user_html($User), "</h2>";
if ($User->seascode_username || $User->huid) {
    echo '<h3><a href="', hoturl("index", array("u" => $Me->user_linkpart($User))), '">', htmlspecialchars($User->seascode_username ?: $User->huid), '</a>';
    if ($Me->privChair) {
        echo "&nbsp;", become_user_link($User);
    }
    echo "</h3>";
}
if ($User->dropped) {
    ContactView::echo_group("", '<strong class="err">You have dropped the course.</strong> If this is incorrect, contact us.');
}
echo Ht::form(hoturl_post("profile", array("u" => $User->email))), "<div>";
if ($User->disabled || $User->password == "") {
    echo Ht::submit("enable", "Enable user", array("value" => 1));
} else {
    echo Ht::submit("disable", "Disable user", array("value" => 1));
}
echo '<hr>';
echo '<table class="pltable" style="margin-top:1em"><tbody class="pltable pltable_alternate">';
echo '<tr><td class="pl pls">Roles</td><td class="pl">';
echo Ht::radio("pctype", "chair", $User->roles & Contact::ROLE_CHAIR), "&nbsp;", Ht::label("Course instructor"), "<br>";
echo Ht::radio("pctype", "pc", $User->roles & Contact::ROLE_PC && !($User->roles & Contact::ROLE_CHAIR)), "&nbsp;", Ht::label("Course staff"), "<br>";
echo Ht::radio("pctype", "no", !($User->roles & (Contact::ROLE_PC | Contact::ROLE_CHAIR))), "&nbsp;", Ht::label("Not on course staff"), "<br>";
echo "</td></tr>\n";
echo '</tbody></table>';
Exemple #28
0
     SignUpView::show();
     MasterView::showFooter();
     break;
 case "placeOrder":
     MasterView::showHeader();
     placeOrderView::show();
     MasterView::showFooter();
     break;
 case "confirmOrder":
     MasterView::showHeader();
     confirmOrderView::show();
     MasterView::showFooter();
     break;
 case "contact":
     MasterView::showHeader();
     ContactView::show();
     MasterView::showFooter();
     break;
 case "about":
     MasterView::showHeader();
     AboutView::show();
     MasterView::showFooter();
     break;
 case "cart":
     MasterView::showHeader();
     CartView::show();
     MasterView::showFooter();
     break;
 case "suggestions":
     MasterView::showHeader();
     CartView::show();
Exemple #29
0
// space, nbsp
$TABWIDTH = $Info->commit_info("tabwidth") ?: 4;
echo "<table><tr><td><h2>diff</h2></td><td style=\"padding-left:10px;line-height:110%\">", "<div class=\"diffl61 gd\" style=\"padding:2px 5px\"><big><code>", substr($hasha, 0, 7), "</code> ", htmlspecialchars($commita->subject), "</big></div>", "<div class=\"diffl61 gi\" style=\"padding:2px 5px\"><big><code>", substr($hashb, 0, 7), "</code> ", htmlspecialchars($commitb->subject), "</big></div>", "</td></tr></table><hr>\n";
// collect diff and sort line notes
$diff = $User->repo_diff($Info->repo, $hashb, $Pset, $diff_options);
$all_linenotes = $hashb_mine ? $Info->commit_info("linenotes") : array();
$lnorder = new LinenotesOrder($all_linenotes, $Info->can_see_grades);
$lnorder->set_diff($diff);
// print line notes
$notelinks = array();
foreach ($lnorder->seq() as $fl) {
    $f = str_starts_with($fl[0], $Pset->directory_slash) ? substr($fl[0], strlen($Pset->directory_slash)) : $fl[0];
    $notelinks[] = '<a href="#L' . $fl[1] . '_' . html_id_encode($fl[0]) . '" onclick="return gotoline61(this)" class="noteref61' . (!$fl[2] && !$Info->user_can_see_grades ? " hiddennote61" : "") . '">' . htmlspecialchars($f) . ':' . substr($fl[1], 1) . '</a>';
}
if (count($notelinks)) {
    ContactView::echo_group("notes", join(", ", $notelinks));
}
// check for any linenotes
$has_any_linenotes = false;
foreach ($diff as $file => $dinfo) {
    if ($lnorder->file($file)) {
        $has_any_linenotes = true;
        break;
    }
}
// line notes
foreach ($diff as $file => $dinfo) {
    $linenotes = $lnorder->file($file);
    $open = $linenotes || !$dinfo->boring || !$hasha_mine && !$hashb_mine;
    $Info->echo_file_diff($file, $dinfo, $lnorder, $open);
}
Exemple #30
0
 /**
  * Custom add method to add an invoice. Needs a contact for each invocie else 
  * do not add the invoice
  * @param $evtcl -- Object  
  */
 function addInvoice(EventControler $evtcl)
 {
     $_SESSION['in_page_message'] = '';
     $rec_value = $evtcl->recurrent;
     $add_invoice = false;
     $do_contact = new Contact();
     $concat_name_in_address = '';
     if ($evtcl->fields["due_date"] == '') {
         $this->due_date = date('Y-m-d');
     } else {
         $this->due_date = $evtcl->fields["due_date"];
     }
     if ($evtcl->idcontact) {
         $idcontact = $evtcl->idcontact;
         $add_invoice = true;
         $do_contact->getId($idcontact);
     } else {
         $cont_name = $evtcl->contact;
         if ($cont_name != '') {
             $do_Contact_View = new ContactView();
             $do_contact->addNew();
             $do_contact->firstname = $cont_name;
             $do_contact->iduser = $_SESSION['do_User']->iduser;
             $do_contact->add();
             $idcontact = $do_contact->getPrimaryKeyValue();
             $do_Contact_View->setUser($_SESSION['do_User']->iduser);
             $do_contact->getId($idcontact);
             $concat_name_in_address = $do_contact->firstname;
             $do_Contact_View->addFromContact($do_contact);
             $do_Contact_View->updateFromContact($do_contact);
             if ($idcontact) {
                 $add_invoice = true;
                 $do_cont_addr = new ContactAddress();
                 $do_cont_addr->addNew();
                 $do_cont_addr->idcontact = $idcontact;
                 $do_cont_addr->address = $evtcl->fields["invoice_address"];
                 $do_cont_addr->address_type = 'Work';
                 if (strlen($evtcl->fields["invoice_address"]) > 0) {
                     $do_cont_addr->add();
                 }
             }
         }
     }
     if ($add_invoice) {
         // Keep the idcontact in case there is an idcompany
         if ($do_contact->idcompany != '' && !empty($do_contact->idcompany)) {
             $this->idcompany = $do_contact->idcompany;
         }
         //$this->num = $this->getUniqueInvoiceNum();
         $this->num = time();
         $this->iduser = $_SESSION['do_User']->iduser;
         $this->idterms = $evtcl->fields["idterms"];
         $this->description = $evtcl->fields["description"];
         $this->discount = $evtcl->fields["discount"];
         $this->tax = $evtcl->fields["tax"];
         $this->datecreated = date("Y-m-d");
         $this->idcontact = $idcontact;
         $this->status = 'Quote';
         $this->invoice_note = $evtcl->fields["invoice_note"];
         $this->invoice_term = $evtcl->fields["invoice_term"];
         if ($concat_name_in_address == '') {
             $this->invoice_address = $evtcl->fields["invoice_address"];
         } else {
             $this->invoice_address = $concat_name_in_address . '<br />' . $evtcl->fields["invoice_address"];
         }
         $this->add();
         $this->idinvoice = $this->getPrimaryKeyValue();
         // If the user set to have the ivoice added as recurrent Invoice then add
         if ($evtcl->setRec == 'Yes') {
             if (!empty($rec_value) && preg_match('/^[0-9]+$/', $rec_value) && $rec_value != 0) {
                 // Add to recurrent
                 $_SESSION['RecurrentInvoice']->addRecurrentInvoice($this->getPrimaryKeyValue(), $evtcl->recurrent, $evtcl->frequency, date("Y-m-d"));
             } else {
                 $_SESSION['in_page_message'] = _("Recurrent Value is not correct.To set as Recurrent edit the invoice and enter numeric value");
             }
         }
     } else {
         $_SESSION['in_page_message'] = _("Invoice could be created. Possible reason Contact Missing.");
         $evtcl->setDisplayNext(new Display('invoices.php'));
     }
 }