コード例 #1
0
ファイル: PendingAccount.php プロジェクト: IASA-GR/appdb-core
 public function getResearcher()
 {
     if ($this->_researcher === null) {
         $Researchers = new Default_Model_Researchers();
         $Researchers->filter->id->equals($this->getResearcherID());
         if ($Researchers->count() > 0) {
             $this->_researcher = $Researchers->items[0];
         }
     }
     return $this->_researcher;
 }
コード例 #2
0
ファイル: RelationBase.php プロジェクト: IASA-GR/appdb-core
 public function getHiddenBy()
 {
     if ($this->_hiddenBy === null) {
         $Researchers = new Default_Model_Researchers();
         $Researchers->filter->id->equals($this->getHiddenByID());
         if ($Researchers->count() > 0) {
             $this->_hiddenBy = $Researchers->items[0];
         }
     }
     return $this->_hiddenBy;
 }
コード例 #3
0
 public function updateallAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     return;
     $ldap = ApplicationConfiguration::service('egi.ldap.host');
     $ldapbind = false;
     $ds = ldap_connect($ldap);
     if (ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) {
         if (ldap_set_option($ds, LDAP_OPT_REFERRALS, 0)) {
             $ldapbind = @ldap_bind($ds, ApplicationConfiguration::service('egi.ldap.username'), ApplicationConfiguration::service('egi.ldap.password'));
         }
     }
     if ($ldapbind) {
         $users = new Default_Model_Researchers();
         $users->refresh();
         for ($i = 0; $i < $users->count(); $i++) {
             $u = $users->items[$i];
             if (!isnull($u->username)) {
                 $sr = ldap_search($ds, "ou=people,dc=egi,dc=eu", "(uid=" . $u->username . ")");
                 $info = ldap_get_entries($ds, $sr);
                 if ($info["count"] > 0) {
                     if (array_key_exists('destinationindicator', $info[0])) {
                         $gender = $info[0]['destinationindicator'][0];
                         $u->gender = $gender;
                         $u->save();
                     }
                 }
             }
         }
         ldap_close($ds);
     }
 }
コード例 #4
0
ファイル: globals.php プロジェクト: IASA-GR/appdb-core
 public static function sendPermissionsRequest($userid, $apikeyid, $msg)
 {
     //Get sender
     $users = new Default_Model_Researchers();
     $users->filter->id->equals($userid);
     if ($users->count() == 0) {
         return "Sender not found";
     }
     $user = $users->items[0];
     //Get sender's primary email
     $contacts = new Default_Model_Contacts();
     $contacts->filter->isprimary->equals(true)->and($contacts->filter->researcherid->equals($userid));
     if ($contacts->count() == 0) {
         return "Sender has no primary e-mail set";
     }
     //Check if e-mail has value
     $useremail = $contacts->items[0]->data;
     if (trim($useremail) == '') {
         return "Sender has no valid primary e-mail set";
     }
     //Get api key
     $apikeys = new Default_Model_APIKeys();
     $apikeys->filter->id->equals($apikeyid)->and($apikeys->filter->ownerid->equals($userid));
     if (count($apikeys) == 0) {
         return "Api key not found";
     }
     $apikey = $apikeys->items[0];
     //Get Appdb administrators
     $recipients = array();
     $admins = new Default_Model_Researchers();
     $agmf = new Default_Model_ActorGroupMembersFilter();
     $agmf->groupid->numequals(-1);
     // admins
     $admins->filter->chain($agmf, "AND");
     if (count($admins->items) == 0) {
         return "";
     }
     //Get admins primary emails
     $admins = $admins->items;
     foreach ($admins as $admin) {
         $contacts = new Default_Model_Contacts();
         $contacts->filter->isprimary->equals(true)->and($contacts->filter->researcherid->equals($admin->id))->and($contacts->filter->contacttypeid->equals(7));
         if (count($contacts->items) == 0) {
             continue;
         }
         if (trim($contacts->items[0]->data) !== '') {
             $recipients[] = $contacts->items[0]->data;
         }
     }
     $recipients = array_unique($recipients);
     if (count($recipients) == 0) {
         return "";
     }
     $textbody = self::getMailBody($user, $apikey, $msg);
     //Get text body and also set html body
     $body = preg_replace("/\\</", "&lt;", $textbody);
     $body = preg_replace("/\\>/", "&gt;", $body);
     $body = preg_replace("/\n/", "<br/>", $body);
     $body = preg_replace("/\t/", "<span style='padding-left:10px;'></span>", $body);
     $body = preg_replace("/\\[1\\]/", "<a href='http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "?p=" . base64_encode("/people/details?id=" . $user->id) . "' target='_blank' title='View person's entry in EGI AppDB' >" . $user->firstname . " " . $user->lastname . "</a>", $body);
     $body = preg_replace("/\\[2\\]/", "<b>" . $apikey->key . "</b>", $body);
     $body = "<html><head></head><body>" . $body . "</body></html>";
     $textbody = preg_replace("/\t/", "   ", $textbody);
     $textbody = preg_replace("/\\[1\\]/", $user->firstname . " " . $user->lastname . " [id: " . $user->id . ", url: http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "?p=" . base64_encode("/people/details?id=" . $user->id) . "]", $textbody);
     $textbody = preg_replace("/\\[2\\]/", $apikey->key, $textbody);
     $subject = "EGI AppDB: API Permissions request from user " . $user->firstname . " " . $user->lastname;
     //sendMultipartMail($subject,$recipients, $textbody, $body, '*****@*****.**', 'enadyskolopassword',$useremail);
     EmailService::sendReport($subject, $recipients, $textbody, $body, $useremail);
     return true;
 }
コード例 #5
0
ファイル: VAviewBase.php プロジェクト: IASA-GR/appdb-core
 public function getSubmission()
 {
     if ($this->_submission === null) {
         $Researchers = new Default_Model_Researchers();
         $Researchers->filter->id->equals($this->getSubmissionID());
         if ($Researchers->count() > 0) {
             $this->_submission = $Researchers->items[0];
         }
     }
     return $this->_submission;
 }
コード例 #6
0
 public static function sendMessage($appid, $userid, $recipientid, $message)
 {
     //Get sender
     $users = new Default_Model_Researchers();
     $users->filter->id->equals($userid);
     if ($users->count() == 0) {
         return "Sender not found";
     }
     $user = $users->items[0];
     //Get sender's primary email
     $contacts = new Default_Model_Contacts();
     $contacts->filter->isprimary->equals(true)->and($contacts->filter->researcherid->equals($userid));
     if ($contacts->count() == 0) {
         return "Sender has no primary e-mail set";
     }
     $useremail = $contacts->items[0]->data;
     //Get recipient
     $recipients = new Default_Model_Researchers();
     $recipients->filter->id->equals($recipientid);
     if ($recipients->count() == 0) {
         return "Recipient not found";
     }
     $recipient = $recipients->items[0];
     //Get recipient's primary email
     $contacts = new Default_Model_Contacts();
     $contacts->filter->isprimary->equals(true)->and($contacts->filter->researcherid->equals($recipientid));
     if ($contacts->count() == 0) {
         return "Recipient has no primary e-mail set";
     }
     $recipientmail = $contacts->items[0]->data;
     //Get application
     $applications = new Default_Model_Applications();
     $applications->filter->id->equals($appid);
     if ($applications->count() == 0) {
         return "Software not found";
     }
     $app = $applications->items[0];
     //Decode message
     $message = base64_decode($message);
     if (strlen(trim($message)) === 0) {
         return "Message is empty";
     }
     //Get text body and also set html body
     $textbody = self::getTextBody($app, $user, $useremail, $recipient, $message);
     $body = preg_replace("/\\</", "&lt;", $textbody);
     $body = preg_replace("/\\>/", "&gt;", $body);
     $body = preg_replace("/\n/", "<br/>", $body);
     $body = preg_replace("/\t/", "<span style='padding-left:10px;'></span>", $body);
     $body = preg_replace("/\\[1\\]/", "<a href='http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "' target='_blank' title='Visit EGI Applications Database' >EGI AppDB</a>", $body);
     $body = preg_replace("/\\[2\\]/", "<a href='http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "?p=" . base64_encode("//people/details?id=" . $user->id) . "' target='_blank' title='View person's entry in EGI AppDB' >" . $user->firstname . " " . $user->lastname . "</a>", $body);
     $body = preg_replace("/\\[3\\]/", "'<a href='http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "?p=" . base64_encode("/apps/details?id=" . $app->id) . "' target='_blank' title='View software entry in EGI AppDB' >" . $app->name . "</a>'", $body);
     $body = "<html><head></head><body>" . $body . "</body></html>";
     $textbody = preg_replace("/\t/", "   ", $textbody);
     $textbody = preg_replace("/\\[1\\]/", "EGI AppDB [1]", $textbody);
     $textbody = preg_replace("/\\[2\\]/", $user->firstname . " " . $user->lastname . " [2]", $textbody);
     $textbody = preg_replace("/\\[3\\]/", "'" . $app->name . "' [3]", $textbody);
     $textbody .= "\n\n________________________________________________________________________________________________________\n";
     $textbody .= "[1]. http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "\n";
     $textbody .= "[2]. http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "?p=" . base64_encode("/people/details?id=" . $user->id) . "\n";
     $textbody .= "[3]. http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "?p=" . base64_encode("/apps/details?id=" . $app->id) . " \n";
     $subject = "EGI Applications Database: " . $user->firstname . " " . $user->lastname . " sent you a message";
     if (trim($useremail) === '') {
         $useremail = false;
     }
     //sendMultipartMail($subject,$recipientmail, $textbody, $body, '*****@*****.**', 'enadyskolopassword',$useremail, null, false, array("From"=>$useremail));
     EmailService::sendReportAsUser($useremail, $subject, $recipientmail, $textbody, $body);
 }
コード例 #7
0
 public function pplindex($paging = true, $format = '')
 {
     if ($format == '') {
         $format = $this->_getParam("format");
     }
     $offset = $this->_getParam('ofs');
     $length = $this->_getParam('len');
     if ($length == "-1") {
         $paging = false;
     }
     if ($offset === null) {
         $offset = 0;
     }
     if ($length === null) {
         $length = 23;
     }
     if (array_key_exists("filter", $_GET)) {
         $this->session->pplFlt = null;
     }
     $fltstr = $this->getFltStr();
     $ppl = new Default_Model_Researchers();
     $this->session->pplFlt = $fltstr;
     $ppl->filter = FilterParser::getPeople($fltstr, $this->_getParam("fuzzySearch") == '1');
     if ($this->_getParam("orderby") != '') {
         $orderby = $this->_getParam("orderby");
     } else {
         $orderby = "firstname";
     }
     if ($this->_getParam("orderbyOp") != '') {
         $orderbyop = $this->_getParam("orderbyOp");
     } else {
         $orderbyop = "ASC";
     }
     if ($orderby != '') {
         if ($orderby != "unsorted") {
             if ($orderby == "firstname") {
                 $ppl->filter->orderBy(array("firstname " . $orderbyop, "lastname " . $orderbyop));
             } elseif ($orderby == "lastname") {
                 $ppl->filter->orderBy(array("lastname " . $orderbyop, "firstname " . $orderbyop));
             } else {
                 $ppl->filter->orderBy($orderby . " " . $orderbyop);
             }
         }
         $this->view->orderby = $orderby;
         $this->view->orderbyOp = $orderbyop;
     }
     if ($paging) {
         $ppl->filter->limit($length + 1);
         $ppl->filter->offset($offset);
     }
     $t1 = microtime(true);
     $total = $ppl->count();
     $listType = $this->_getParam("details");
     $ppl->refresh($format, '', $listType);
     $entries = $ppl->items;
     if ($format == '') {
         $this->cacheimages($entries);
     }
     if ($paging) {
         $this->view->offset = $offset;
         $this->view->length = $length;
         $this->view->pageCount = ceil($total / ($length + 1));
         $this->view->currentPage = floor($offset / ($length + 1));
     } else {
         $this->view->offset = 0;
         $this->view->length = $total;
         if ($total != 0) {
             $this->view->pageCount = ceil($total / $total);
             $this->view->currentPage = floor($offset / $total);
         } else {
             $this->view->pageCount = 1;
             $this->view->currentPage = 1;
         }
     }
     $this->view->entries = $entries;
     $this->view->total = $total;
     include 'pplaccounting.php';
     $t2 = microtime(true);
     $dt = $t2 - $t1;
     $this->view->searchTime = round($dt, 2);
     if ($this->_getParam("fuzzySearch") == '1') {
         $this->view->fuzzySearch = '1';
     }
     return $ppl->items;
 }
コード例 #8
0
ファイル: ContextBase.php プロジェクト: IASA-GR/appdb-core
 public function getLastupdatedby()
 {
     if ($this->_lastupdatedby === null) {
         $Researchers = new Default_Model_Researchers();
         $Researchers->filter->id->equals($this->getLastupdatedbyID());
         if ($Researchers->count() > 0) {
             $this->_lastupdatedby = $Researchers->items[0];
         }
     }
     return $this->_lastupdatedby;
 }