コード例 #1
0
ファイル: email_service.php プロジェクト: IASA-GR/appdb-core
 /**
  * Checks configuration to conclude if EmailService is usable.
  */
 public static function canUse()
 {
     if (isset(self::$_canUse) === false && (self::$_canUse === true || self::$_canUse === false)) {
         return self::$_canUse;
     }
     $canuse = EmailConfiguration::canUse();
     if (strtolower(trim($canuse)) === 'production') {
         $canuse = ApplicationConfiguration::isProductionInstance();
     }
     if ($canuse !== true && $canuse !== false) {
         $canuse = false;
     }
     self::$_canUse = $canuse;
     return self::$_canUse;
 }
コード例 #2
0
 public function indexAction()
 {
     $this->_helper->layout->disableLayout();
     trackPage('/changelog');
     $wiki = ApplicationConfiguration::app('wiki');
     $haswiki = $wiki === "" ? false : true;
     $currentwiki = "/pages/about/changelog";
     if ($haswiki) {
         $currentwiki = $wiki . "main:about:changelog";
         $this->view->currentwiki = $currentwiki;
         return;
     }
     $this->_helper->viewRenderer->setNoRender();
     $s = file_get_contents(APPLICATION_PATH . "/../CHANGELOG");
     $s = str_replace("\n", "<br/>", $s);
     $s = preg_replace("/EGI RT #(\\d+)/", '<a target="_blank" href="https://rt.egi.eu/guest/Ticket/Display.html?id=${1}">EGI RT #${1}</a>', $s);
     $s = preg_replace("/GGUS #(\\d+)/", '<a target="_blank" href="https://gus.fzk.de/ws/ticket_info.php?ticket=${1}">GGUS #${1}</a>', $s);
     echo $s;
 }
コード例 #3
0
ファイル: textPNG.php プロジェクト: IASA-GR/appdb-core
 function __construct()
 {
     $this->font = ApplicationConfiguration::app('pngfont', 'wine-tahoma.ttf');
 }
コード例 #4
0
ファイル: outdatedapp.php プロジェクト: IASA-GR/appdb-core
 public static function sendMessages($isReminder = false)
 {
     $items = db()->query("SELECT * FROM nonvalidated_apps_per_owner")->fetchAll();
     foreach ($items as $item) {
         $text = "";
         $body = "";
         if (is_null($item["contact"])) {
             error_log("[OutdatedApps]: No contact info for " . $item["ownerid"] . ":" . $item["firstname"] . " " . $item["lastname"]);
             //TODO: Case where the owner of the application has no contact point
             continue;
         }
         $recipients = array($item["contact"]);
         $subject = "Notification:";
         if (isnull($item["lastsent"]) == false) {
             $subject = "Reminder:";
         }
         $subject .= "EGI AppDB outdated software profile";
         $appids = $item["appids"];
         $appids = explode(";", $appids);
         $appnames = $item["appnames"];
         $appnames = explode(";", $appnames);
         if (count($appids) == 0) {
             continue;
         }
         if (count($appids) == 1) {
             $template = self::getTemplateBody($item["firstname"] . " " . $item["lastname"]);
             $body = preg_replace("/\\[1\\]/", "<a href='http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "?p=" . base64_encode("/apps/details?id=" . $appids[0]) . "' target='_blank'>" . $appnames[0] . "</a>", $template);
             $body = preg_replace("/\\[2\\]/", "<a href='http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "' target='_blank'>EGI Applications Database</a>", $body);
             $body = "<html><head></head><body><pre>" . $body . "</pre></body></html>";
             $text = preg_replace("/\\[1\\]/", "" . $appnames[0] . " [1]", $template);
             $text = preg_replace("/\\[2\\]/", "EGI Applications Database [2]", $text);
             $text .= "\n\n________________________________________________________________________________________________________\n";
             $text .= "[1]. http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "?p=" . base64_encode("/apps/details?id=" . $appids[0]) . "\n";
             $text .= "[2]. http://" . $_SERVER["APPLICATION_UI_HOSTNAME"];
         } else {
             $template = self::getTemplateListBody($item["firstname"] . " " . $item["lastname"]);
             $listpermalink = "http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "?p=" . base64_encode('{"url":"/apps","query":{"flt":"=application.owner:' . $item["ownerid"] . ' +=application.validated:false"},"ext":{"isBaseQuery":true,"append":true,"filterDisplay":"Search outdated...","mainTitle":"Outdated entries"}}');
             $body = preg_replace("/\\[1\\]/", "<a href='" . $listpermalink . "' target='_blank'>software</a>", $template);
             $body = preg_replace("/\\[2\\]/", "<a href='http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "' target='_blank'>EGI Applications Database</a>", $body);
             $body = "<html><head></head><body><pre>" . $body . "</pre></body></html>";
             $text = preg_replace("/\\[1\\]/", "software [1]", $template);
             $text = preg_replace("/\\[2\\]/", "EGI Applications Database [2]", $text);
             $text .= "\n\n________________________________________________________________________________________________________\n";
             $text .= "[1]. " . $listpermalink . " \n";
             $text .= "[2]. http://" . $_SERVER["APPLICATION_UI_HOSTNAME"];
             $bodylist = "";
             $textlist = "";
             //Make unique arrays of application ids and names
             $unames = array();
             $uids = array();
             for ($i = 0; $i < count($appids); $i += 1) {
                 if (in_array($appids[$i], $uids) === false) {
                     $uids[] = $appids[$i];
                     $unames[] = $appnames[$i];
                 }
             }
             $appids = $uids;
             $appnames = $unames;
             for ($i = 0; $i < count($appids); $i += 1) {
                 $bodylist .= "<div style='padding-left:10px;'>-<a href='http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "?p=" . base64_encode("/apps/details?id=" . $appids[$i]) . "' target='_blank'>" . $appnames[$i] . "</a></div>";
                 $textlist .= "\t- " . $appnames[$i] . "\n";
             }
             $body = preg_replace("/\\[\\*\\]/", $bodylist, $body);
             $text = preg_replace("/\\[\\*\\]/", $textlist, $text);
         }
         if (ApplicationConfiguration::isProductionInstance() === FALSE) {
             error_log("SENDING OUTDATED TO:");
             error_log("SUBJECT:" . $subject);
             error_log("RECIPIENTS: " . var_export($recipients, true));
             error_log("BODY: " . $text);
             echo "<div style='background-color:lightgrey;border:1px solid black'><b>subject:</b>" . $subject . "</div><div style='background-color:lightgrey;margin-bottom:10px;border:1px solid black'><b>TO:</b>" . implode(",", $recipients) . "</div><div style='background-color:lightgreen;border:1px solid black;'>" . $body . "</div><div style='background-color:#99DBFF;margin-bottom:10px;border:1px solid black'><pre>" . $text . "</pre></div>";
         } else {
             //sendMultipartMail($subject,$recipients,$text,$body,'*****@*****.**','enadyskolopassword','*****@*****.**',null, false,array("Precedence"=>"bulk"));
             EmailService::sendBulkReport($subject, $recipients, $text, $body, EmailConfiguration::getSupportAddress());
         }
     }
     if (APPLICATION_ENV === "production") {
         db()->query("INSERT INTO app_validation_log (appid) SELECT DISTINCT id FROM applications, (SELECT string_to_array(array_to_string(array_agg(array_to_string(ids,',')),','),',') as ids FROM (SELECT string_to_array(appids, ';') as ids FROM (SELECT * FROM nonvalidated_apps_per_owner) AS t) as tt) as ttt WHERE id::text = ANY(ttt.ids)")->fetchAll();
     }
     return true;
 }
コード例 #5
0
 private static function sendNotification($notification)
 {
     $subject = $notification["subject"];
     $to = $notification["recipient"];
     $txtbody = $notification["message"];
     if (ApplicationConfiguration::isProductionInstance() === FALSE) {
         self::debugSendMultipart($subject, $to, $txtbody, null, "appdb reports username", "appdb reports password", false, null, false, null);
     } else {
         //sendMultipartMail($subject, $to, $txtbody, null, '*****@*****.**', 'enadyskolopassword', false, null, false, array("Precedence"=>"bulk"));
         EmailService::sendBulkReport($subject, $to, $txtbody);
     }
 }
コード例 #6
0
ファイル: userrequests.php プロジェクト: IASA-GR/appdb-core
 public static function sendEmailResponseNotification($user, $app, $stateid = 0, $type = 'joinapplication')
 {
     $recipients = self::getUserPrimaryEmail($user->id);
     if (($stateid == 2 || $stateid == 3) && count($recipients) > 0) {
         $state = $stateid == 2 ? "Accepted" : "Rejected";
         $subject = "EGI Applications Database: " . $state . " request to join software " . $app->name . " response";
         if ($type == 'releasemanager') {
             $subject = "EGI Applications Database: " . $state . " request to manage releases for software " . $app->name . " response";
         }
         $textbody = self::getResponseEmailBody($user, $app, $stateid, $type);
         $body = preg_replace("/\n/", "<br/>", $textbody);
         $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("/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\\]/", "'" . $app->name . "' [1]", $textbody);
         $textbody .= "\n\n________________________________________________________________________________________________________\n";
         $textbody .= "[1]. http://" . $_SERVER["APPLICATION_UI_HOSTNAME"] . "?p=" . base64_encode("/apps/details?id=" . $app->id) . " \n";
         if (ApplicationConfiguration::isProductionInstance() === FALSE) {
             error_log("SENDING TO: " . $recipients);
             error_log("SUBJECT: " . $subject);
             error_log("MESSAGE: " . $textbody);
         }
         //sendMultipartMail($subject,$recipients, $textbody, $body, '*****@*****.**', 'enadyskolopassword');
         EmailService::sendReport($subject, $recipients, $textbody, $body);
     }
 }
コード例 #7
0
ファイル: SamlController.php プロジェクト: IASA-GR/appdb-core
 /**
  * Checks if requestor is allowed to view saml user information.
  * This function is based on saml.profile.allow values in application.ini. 
  * 
  * @return boolean
  */
 private function isAllowedProfileDataDomain()
 {
     $ref = isset($_SERVER['HTTP_REFERER']) && trim($_SERVER['HTTP_REFERER']) !== '' ? trim($_SERVER['HTTP_REFERER']) : '';
     if ($ref === '') {
         return false;
     }
     $allowed = explode(';', ApplicationConfiguration::saml('profile.allow', ''));
     if (count($allowed) === 0) {
         return false;
     }
     if (count($allowed) === 1) {
         if ($allowed[0] === '') {
             return false;
         } else {
             if ($allowed[0] === '*') {
                 return true;
             }
         }
     }
     $url = parse_url($ref);
     $domain = $url['scheme'] . '://' . $url['host'];
     foreach ($allowed as $allow) {
         $pregallow = '/^' . str_replace('_________', '\\w+', preg_quote(str_replace('*', '_________', trim($allow)), '/')) . '$/';
         $matches = null;
         preg_match($pregallow, $domain, $matches);
         if (count($matches) > 0) {
             return true;
         }
     }
     return false;
 }
コード例 #8
0
 /**
  * Get configured recipient list by given key
  * 
  * @param string $list	Name of list
  * @return array		Array of email addresses of the list
  */
 public static function getList($list)
 {
     $recipients = ApplicationConfiguration::email('list.' . $list, '');
     if (trim($recipients) === '') {
         return array();
     }
     if (strpos(';', $recipients) !== FALSE) {
         $recipients = explode(';', $recipients);
     } else {
         if (strpos(',', $recipients) !== FALSE) {
             $recipients = explode(',', $recipients);
         } else {
             $recipients = array($recipients);
         }
     }
     return array_map('trim', $recipients);
 }
コード例 #9
0
ファイル: globals.php プロジェクト: IASA-GR/appdb-core
 public static function sendVONotification($user, $vappliance, $notificationtype, $vos, $subject, $message)
 {
     $notification = null;
     $usermessage = "" . $message;
     $usersubject = "" . $subject;
     $result = self::createVONotification($user, $vappliance, $notificationtype, $vos, $subject, $message, $notification);
     if ($result !== true) {
         return $result;
     }
     if (!$notification) {
         return "Could not send notification";
     }
     $recipients = $notification["recipients"];
     $subject = $notification["subject"];
     $message = $notification["message"];
     $replyto = $notification["useremail"];
     try {
         foreach ($recipients as $rec) {
             $voname = $rec["vo"];
             $to = array();
             foreach ($rec["contacts"] as $cnt) {
                 $to[] = trim($cnt["email"]);
             }
             $txtbody = preg_replace('/\\{\\{vo\\.name\\}\\}/i', $voname, $message);
             $subj = preg_replace('/\\{\\{vo\\.name\\}\\}/i', $voname, $subject);
             if (ApplicationConfiguration::isProductionInstance() === FALSE) {
                 self::debugSendMultipart($subj, $to, $txtbody, null, "appdb reports username", "appdb reports password", $replyto, null, false, null);
             } else {
                 //sendMultipartMail($subj, $to, $txtbody, null, '*****@*****.**', 'enadyskolopassword', $replyto, null, false, array("Precedence"=>"bulk"));
                 EmailService::sendBulkReport($subj, $to, $txtbody, null, $replyto);
             }
         }
         self::sendVONotificationReportMessage($notification, $user, $vappliance, $notificationtype, $usersubject, $usermessage);
     } catch (Exception $ex) {
         return $ex->getMessage();
     }
     return true;
 }
コード例 #10
0
ファイル: accountconnect.php プロジェクト: IASA-GR/appdb-core
 private static function sendConfirmationEmail($session, $pending)
 {
     $researcher = $pending->getResearcher();
     $email = $researcher->getPrimaryContact();
     $accounttype = str_replace("-", " ", trim($pending->accountType));
     $accountname = trim($pending->accountName) === "" ? $pending->accountID : $pending->accountName;
     $res = "Dear " . $researcher->name . ",\n\n";
     $res .= "    a request has been made to connect the " . $accounttype . " account of " . $accountname . "\n";
     $res .= "to your profile in the EGI Applications Database [1].\n";
     $res .= "If it is really you the one that made this request and you wish to proceed with the account connection\n";
     $res .= " - go to the EGI Applications Database Portal[1] and\n";
     $res .= " - sign in with the same " . $accounttype . " account.\n";
     $res .= "The system will prompt you with a form where you should enter the confirmation code bellow:\n\n";
     $res .= "   Confirmation Code: " . $pending->code . "\n\n";
     $res .= "Note: The confirmation code expires 30 minutes after this message was sent.\n\n";
     $res .= "If you are not the one that made this request, then please report the incident by replying to this message.\n\n";
     $res .= "Best regards,\n";
     $res .= "EGI AppDB team\n";
     $res .= "\n\n__________________________________________________\n";
     $res .= "[1]. http://" . $_SERVER["APPLICATION_UI_HOSTNAME"];
     $subject = "EGI AppDB: Request to connect " . $accounttype . " account to your profile";
     $text = $res;
     $body = $body = preg_replace("/\n/", "<br/>", $res);
     $body = "<div>" . $body . "</div>";
     //DEVELOPMENT CODE
     if (ApplicationConfiguration::isProductionInstance() === FALSE) {
         error_log("\nSending to: " . $email);
         error_log("\n\n" . $res);
     }
     $recipients = array($email);
     //sendMultipartMail($subject,$recipients,$text,$body,'*****@*****.**','enadyskolopassword','*****@*****.**',null, false,array("Precedence"=>"bulk"));
     EmailService::sendBulkReport($subject, $recipients, $text, $body, EmailConfiguration::getSupportAddress());
 }
コード例 #11
0
 /**
  * Checks if current AppDB instance is deployed in production server
  * It checks the deploy.instance value of the application configuration
  * 
  * @return bool
  */
 public static function isProductionInstance()
 {
     $instance = strtolower(trim(ApplicationConfiguration::deploy('instance')));
     if ($instance === 'production') {
         return true;
     } else {
         if ($instance === '' && strtolower($_SERVER["SERVER_NAME"]) === 'appdb.egi.eu') {
             return true;
         }
     }
     return false;
 }
コード例 #12
0
ファイル: samlauth.php プロジェクト: IASA-GR/appdb-core
 public static function getEGIAAIRoleMappings($key)
 {
     $res = array();
     $roles = explode('\\n', ApplicationConfiguration::saml('egiaai.entitlements.' . $key, ''));
     foreach ($roles as $role) {
         $role = explode('=', $role);
         if (count($role) <= 1) {
             continue;
         }
         $local = $role[0];
         $remote = explode(';', $role[1]);
         if (count($remote) === 0) {
             continue;
         }
         $res = array_merge($res, array_fill_keys($remote, $local));
     }
     return $res;
 }
コード例 #13
0
ファイル: AppsController.php プロジェクト: IASA-GR/appdb-core
 public function vmc2appdbAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     if (ApplicationConfiguration::isProductionInstance()) {
         header('HTTP/1.0 404 Not Found');
         header("Status: 404 Not Found");
         return;
     }
     if ($_SERVER['REQUEST_METHOD'] === "GET") {
         echo '<form action="/apps/vmc2appdb" id="vmc2appdb" name="vmc2appdb" method="post" target="_blank">';
         echo '<textarea rows="30" cols="100" name="data" id="data" ></textarea>';
         echo '<div><label for="appid">Application Id:</label><input type="text" value="" name="appdbid" id="appdbid"></div>';
         echo '<div><input type="submit" value="view transformed xml"></div>';
         echo '<div><input type="button" id="submitxml" value="Call API" ></div>';
         echo '<div class="reply"></div>';
         echo '</form>';
         echo '<script type="text/javascript">';
         echo 'appdb.utils.Vm2Appdb.init();';
         echo '</script>';
     } else {
         $this->_helper->layout->disableLayout();
         if (isset($_POST["data"]) === false) {
             echo '<html><head></head><body>';
             echo '<div>no data posted</div>';
             echo '</body></html>';
         } else {
             header('Content-type: text/xml');
             $data = $_POST["data"];
             echo VMCaster::transformXml($data);
         }
     }
 }
コード例 #14
0
ファイル: restapi_base.php プロジェクト: IASA-GR/appdb-core
 /**
  * sets the error state, along with optional extended error info, which may 
  * be encrypted. The appropriate HTTP headers are also set, according to 
  * the error state specified.
  *
  * @e RestErrorEnum the error state
  * @ext string optional extended error information
  * @enc bool whether the extended error information should be encrypted or 
  * not (i.e. sensitive debug data, or not)
  *
  * @access public
  */
 protected function setError($e, $ext = null, $enc = true)
 {
     $this->_error = $e;
     if (!is_null($ext)) {
         if ($enc) {
             $this->_extError = "DEBUG DATA: " . base64_encode(encrypt($ext, ApplicationConfiguration::api('key', '')));
         } else {
             $this->_extError = $ext;
         }
     } else {
         $ext = null;
     }
     switch ($e) {
         case RestErrorEnum::RE_OK:
             header("HTTP/1.0 200 OK");
             break;
         case RestErrorEnum::RE_ACCESS_DENIED:
             header("HTTP/1.0 403 Forbidden");
             break;
         case RestErrorEnum::RE_INVALID_REPRESENTATION:
             header("HTTP/1.0 400 Bad Request");
             break;
         case RestErrorEnum::RE_ITEM_NOT_FOUND:
             header("HTTP/1.0 404 Not Found");
             break;
         case RestErrorEnum::RE_INVALID_METHOD:
             header("HTTP/1.0 405 Method Not Allowed");
             break;
         default:
             header("HTTP/1.0 500 Internal Server Error");
             break;
     }
 }
コード例 #15
0
ファイル: support.php プロジェクト: IASA-GR/appdb-core
 public static function singleVMIPolicy()
 {
     return ApplicationConfiguration::support('singlevmipolicy', true);
 }
コード例 #16
0
			'https://aai.egi.eu/proxy/metadata': 'egi-aai',
			'https://aai.egi.eu/proxy/metadata.php': 'egi-aai',
			'https://aai.egi.eu/google/saml2/idp/metadata.php': 'google',
			'https://aai.egi.eu/linkedin/saml2/idp/metadata.php': 'linkedin',
			'https://aai.egi.eu/facebook/saml2/idp/metadata': 'facebook',
			'https://aai.egi.eu/facebook/saml2/idp/metadata.php': 'facebook',
			'https://extidp.cesnet.cz/idp/shibboleth': 'elixir',
			'https://engine.elixir-czech.org/authentication/idp/metadata': 'elixir',
			'https://engine.elixir-czech.org/authentication/idp/metadata.php': 'elixir',
			'https://www.egi.eu/idp/shibboleth': 'egi sso',
			'https://vho.grnet.gr/idp/shibboleth': 'vho'
		}
	}
};
<?php 
if (ApplicationConfiguration::isProductionInstance() === false) {
    ?>
appdb.config.accounts.available.push({ id: "elixir-sp", source: "elixir", name:"Elixir", image: "/images/elixir.png", canAdd: true, canRemove: true, displayName: true, connectMessage: "If you are already signed in Elixir the system will try to connect to the signed in account of Elixir. Otherwise, please consider to be signed out from Elixir." });
appdb.config.accounts.available.push({ id: "facebook-sp", source: "facebook", name:"Facebook", image: "/images/social_facebook.png", canAdd: true, canRemove: true, displayName: true, connectMessage: "If you are already signed in Facebook the system will try to connect to the signed in account of Facebook. Otherwise, please consider to be signed out from Facebook." });
appdb.config.accounts.available.push({ id: "linkedin-sp", source: "linkedin", name:"LinkedIn", image: "/images/social_linkedin.png", canAdd: true, canRemove: true, displayName: true, connectMessage: "If you are already signed in LinkedIn the system will try to connect to the signed in account of LinkedIn. Otherwise, please consider to be signed out from LinkedIn." });
<?php 
}
?>

appdb.config.cache = {
	expires: 7, //each cache default expiration in days
	resources: {
		expires: 7, //resources cache default expiration in days
		items: [
			"applications/categories",
			"disciplines",
コード例 #17
0
ファイル: accesstokens.php プロジェクト: IASA-GR/appdb-core
 private static function getMaximumAccessTokens()
 {
     $maxtokens = ApplicationConfiguration::api('maxkeys');
     if (is_numeric($maxtokens) && $maxtokens > 0) {
         return intval($maxtokens);
     }
     return null;
 }
コード例 #18
0
 public function submitAction()
 {
     if ($this->session->userid !== null) {
         $this->_helper->layout->disableLayout();
         $this->_helper->viewRenderer->setNoRender();
         $type = $this->_getParam("type");
         $entryID = $this->_getParam("entryID");
         $comment = $this->_getParam("comment");
         $reason = $this->_getParam("reason");
         switch ($reason) {
             case self::REASON_OTHER:
                 $reason_str = 'Other';
                 break;
             case self::REASON_COPYRIGHT_ISSUE:
                 $reason_str = 'Copyright Issue';
                 break;
             case self::REASON_INAPPROPRIATE_CONTENT:
                 $reason_str = 'Inappropriate Content';
                 break;
             case self::REASON_INVALID_DATA:
                 $reason_str = 'Invalid or False Data';
                 break;
             case self::REASON_OUT_OF_DATE:
                 $reason_str = 'Out of Date Information';
                 break;
             case self::REASON_BROKEN_LINK:
                 $reason_str = 'Broken Link';
                 break;
             case self::REASON_SPELLING:
                 $reason_str = 'Typo/Misspelling';
                 break;
             default:
                 $reason_str = 'Other';
                 break;
         }
         $offender = "id={$entryID}";
         $subject = "AppDB report";
         if (ApplicationConfiguration::isEnviroment("production")) {
             $to = EmailConfiguration::getList('ucst');
         } else {
             $to = EmailConfiguration::getList('debug');
         }
         $offenderApp = "";
         $body = "EGI Applications Database Abuse Report \n\n" . "A user has submitted a report concerning a" . (in_array(strtolower(substr($type, 0, 1)), array('a', 'e', 'i', 'o', 'u')) ? "n" : "") . " " . $type . "\n\n";
         $body = "--------------------------------------------------\n";
         $body .= "Please do not reply, this is an automated message.\n";
         $body .= "--------------------------------------------------\n\n";
         if ($type == "application") {
             $subject .= " - problem on content";
             $body .= "EGI Applications Database problem report on content \n\n";
             $body .= "A user has submitted a problem report concerning the software ";
             $apps = new Default_Model_Applications();
             $apps->filter->id->equals($entryID);
             if (count($apps->items) > 0) {
                 $offender = $apps->items[0]->name . ' (http://' . $_SERVER['HTTP_HOST'] . '/?p=' . base64_encode('/apps/details?id=' . $apps->items[0]->id) . ")";
                 $body .= $apps->items[0]->name . " with id: " . $apps->items[0]->id;
             }
         } elseif ($type == "comment") {
             $subject .= " - abuse on comment";
             $body .= "EGI Applications Database abuse report on a comment\n\n";
             $body .= "A user has submitted an abuse report concerning the software ";
             $aprs = new Default_Model_AppRatings();
             $aprs->filter->id->equals($entryID);
             if (count($aprs->items) > 0) {
                 $cid = $apps->items[0]->id;
                 $apps = new Default_Model_Applications();
                 $apps->filter->id->equals($aprs->items[0]->appid);
                 if (count($apps->items[0]) > 0) {
                     $body .= $apps->items[0]->name . " with id: " . $apps->items[0]->id;
                     $rs = new Default_Model_Researchers();
                     $rs->filter->id->equals($aprs->items[0]->submitterid);
                     if (count($rs->items) > 0) {
                         $commentPersonName = $rs->items[0]->firstname . ' ' . $rs->items[0]->lastname;
                     } else {
                         $commentPersonName = 'a guest user';
                     }
                     $commentDate = new DateTime($aprs->items[0]->submittedon);
                     $commentDate = $commentDate->format('Y-m-d H:i');
                     $offenderApp = "Offensive software entry: " . $apps->items[0]->name . ' (http://' . $_SERVER['HTTP_HOST'] . '/?p=' . base64_encode('/apps/details?id=' . $apps->items[0]->id) . ")\n";
                     $offender = "submitted by {$commentPersonName} on {$commentDate} (Comment ID: {$entryID})";
                 }
             }
         }
         $body = $body . "\n\n";
         $body .= $offenderApp . "Offensive " . $type . " entry: " . $offender . "\n" . 'Submitter: ' . $this->session->fullName . ' (http://' . $_SERVER['HTTP_HOST'] . '/?p=' . base64_encode('/people/details?id=' . $this->session->userid) . ")\n" . "Reason: " . $reason_str . "\n\n" . "Description: " . $comment . "\n";
         //sendMultipartMail($subject, $to, $body,"<pre>".$body."</pre>", '*****@*****.**', 'enadyskolopassword');
         EmailService::sendReport($subject, $to, $body, "<pre>" . $body . "</pre>");
     }
 }
コード例 #19
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);
     }
 }
コード例 #20
0
ファイル: AppdbAPIHelper.php プロジェクト: IASA-GR/appdb-core
 private function BuildQuery()
 {
     $this->api->view->isAuthenticated = false;
     $this->api->view->isAdmin = false;
     $q = array();
     $flt = "";
     $ignore = AppdbAPIHelper::GetIgnoreParameterList();
     //Collect query related parameters
     foreach ($this->routeParams as $k => $v) {
         if (in_array($k, $ignore)) {
             continue;
         }
         $q[$k] = $v;
         //Clear retreived parameters from request parameters
         unset($this->routeParams[$k]);
         unset($_GET[$k]);
     }
     if (array_key_exists('userid', $q)) {
         //user ID with hashed password, matched against hash in database
         if (array_key_exists('passwd', $q)) {
             $u = new Default_Model_Researchers();
             $u->filter->id->equals($q["userid"]);
             if (count($u->items) > 0) {
                 if ($u->items[0]->password === $q["passwd"]) {
                     $this->api->view->isAuthenticated = true;
                     $this->api->view->isAdmin = ($u->items[0]->positionTypeID == 5 || $u->items[0]->positionTypeID == 7) && $u->items[0]->roleVerified;
                     $_GET["userid"] = $q["userid"];
                     //									error_log('API call authenticated');
                 }
             }
         }
     } elseif (array_key_exists('username', $q)) {
         //username and real password, matched against LDAP
         error_log('Trying to authenticate user via LDAP');
         $u = new Default_Model_Researchers();
         $u->filter->username->equals($q["username"]);
         if (count($u->items) > 0) {
             $username = $q["username"];
             $userid = $u->items[0]->id;
         } else {
             $username = null;
         }
         if ($username !== null) {
             if (array_key_exists('passwd', $q)) {
                 $ldap = ApplicationConfiguration::service('egi.ldap.host');
                 $username = "******" . $username . ",ou=people,dc=egi,dc=eu";
                 $password = $q['passwd'];
                 $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)) {
                         if (APPLICATION_ENV == 'production') {
                             if (ldap_start_tls($ds)) {
                                 $ldapbind = @ldap_bind($ds, $username, $password);
                             }
                         } else {
                             $ldapbind = @ldap_bind($ds, $username, $password);
                         }
                     }
                 }
                 ldap_close($ds);
                 if ($ldapbind) {
                     //login info was valid
                     $_GET["userid"] = $userid;
                     $this->api->view->isAuthenticated = true;
                     $this->api->view->isAdmin = ($u->items[0]->positionTypeID == 5 || $u->items[0]->positionTypeID == 7) && $u->items[0]->roleVerified;
                 } else {
                     error_log('API call authentication failed');
                 }
             }
         }
     }
     //Remove unwanted fields from flt
     foreach (array("orderbyOp", "orderby", "userid", "passwd", "username", "id") as $ign) {
         if (array_key_exists($ign, $q)) {
             $_GET[$ign] = $q[$ign];
             unset($q[$ign]);
         }
     }
     if (array_key_exists('flt', $q) && count($this->routeModelQuery) === 0) {
         $_GET['flt'] = $q['flt'];
         if (isset($q['fuzzySearch'])) {
             $_GET['fuzzySearch'] = $q['fuzzySearch'];
         }
     } else {
         $q = AppdbAPIRequestProcessor::Transform($this->routeXslt, $this->version, $q);
         if ($q === null) {
             $this->api->view->Error = "Invalid query parameter";
             return;
         }
         if (count($this->routeModelQuery) > 0) {
             $mq = $this->routeModelQuery;
             $this->routeModelQuery = array();
             foreach ($mq as $m) {
                 if (isset($q[$m])) {
                     $this->routeModelQuery[$m] = $q[$m];
                 }
             }
         } else {
             if (count($q) > 0) {
                 //Create json query object for FILTER query
                 $flt = "";
                 foreach ($q as $k => $v) {
                     if (strpos($k, "id") > 0) {
                         $flt .= "+=" . $k . ":" . $v . " ";
                     } else {
                         $flt .= "+" . $k . ":" . $v . " ";
                     }
                 }
             }
         }
         if ($flt != "") {
             $_GET[AppdbAPIHelper::GetQueryKey()] = $flt;
         }
     }
 }