Esempio n. 1
0
 public function syncsitesAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $islocal = localRequest();
     $update = $this->_getParam("update") != null ? $this->_getParam("update") : "true";
     $update = strtolower(trim($update)) === "false" ? false : true;
     $force = $this->_getParam("force") != null ? $this->_getParam("force") : "true";
     $force = strtolower(trim($force)) === "true" ? true : false;
     if (!$islocal) {
         header('HTTP/1.0 404 Not Found');
         header("Status: 404 Not Found");
         return;
     }
     header('Content-type: text/xml');
     echo '<' . '?xml version="1.0" encoding="UTF-8"?' . '>' . "\n";
     $result = Gocdb::syncSites($update, $force);
     db()->query("REFRESH MATERIALIZED VIEW CONCURRENTLY sites;");
     db()->query("SELECT request_permissions_refresh();");
     db()->query("REFRESH MATERIALIZED VIEW site_services_xml;");
     db()->query("REFRESH MATERIALIZED VIEW site_service_images_xml;");
     if (is_array($result)) {
         echo "<result success='true'";
         if (isset($result["inserted"])) {
             echo " inserted='" . $result["inserted"] . "'";
         }
         if (isset($result["updated"])) {
             echo " updated='" . $result["updated"] . "'";
         }
         if (isset($result["deleted"])) {
             echo " deleted='" . $result["deleted"] . "'";
         }
         echo " />";
         return;
     }
     $error_message = trim($result);
     if (is_string($result) === false) {
         $error_message = 'Unknown error';
     }
     ExternalDataNotification::sendNotification('Sites::syncSites', $error_message, ExternalDataNotification::MESSAGE_TYPE_ERROR);
     echo "<result success='false' error='" . htmlspecialchars($error_message, ENT_QUOTES) . "' />";
 }
Esempio n. 2
0
 public function initrelationsAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $updateonly = $this->_getParam("updateonly");
     set_time_limit(300);
     // Prevent malicious calls
     if (localRequest()) {
         ob_start();
         flush();
         ob_flush();
         $unrelateold = true;
         if (trim($updateonly) === "true") {
             $unrelateold = false;
         }
         $res = HarvesterInitRelations::initResearchersOrganizations($unrelateold);
         if ($res !== true) {
             echo "ERROR: " . $res;
         } else {
             echo "SUCCESS";
         }
         ob_end_flush();
     }
 }
Esempio n. 3
0
 public function syncsitecontactsAction()
 {
     if (localRequest()) {
         $this->syncSiteContacts();
     } else {
         $this->getResponse()->clearAllHeaders();
         $this->getResponse()->setRawHeader("HTTP/1.0 403 Forbidden");
         $this->getResponse()->setHeader("Status", "403 Forbidden");
     }
 }
Esempio n. 4
0
 public function buildcacheAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     if (localRequest() == false) {
         return;
     }
     $ver = appdbVerInfo();
     $customBuild = true;
     if (substr($_SERVER['APPLICATION_ENV'], 0, 5) === 'devel' && (isset($_GET['cb']) && $_GET['cb'] == "1")) {
         $customBuild = true;
     } elseif (substr($_SERVER['APPLICATION_ENV'], 0, 5) === 'devel') {
         $customBuild = false;
     }
     $customBuild = true;
     $res = "CACHE MANIFEST\n";
     $res .= "# " . date("Y/m/d H:M:i") . "\n";
     $res .= "\n";
     $res .= "CACHE:\n";
     if ($customBuild) {
         $res .= "/js/dijit/themes/tundra/tundra.css\n";
         $res .= "/js/dojo/dojo.js?v=" . $ver . "\n";
         $res .= "/js/dojo/appdb.jgz?v=" . $ver . "\n";
         $res .= "/css/appdb.min.css?v=" . $ver . "\n";
         $res .= "/js/jQuery.js?v=" . $ver . "\n";
         $res .= "/js/d3.v3.min.js?v=" . $ver . "\n";
         $res .= "/js/countdown.min.js?v=" . $ver . "\n";
         $res .= "/js/appdb.min.js?v=" . $ver . "\n";
         $res .= "/js/tinymce/tiny_mce.js?v=" . $ver . "\n";
         $imgs = file_get_contents(__DIR__ . "/../../bin/imglist");
         if ($imgs === false) {
             echo "Could not load image list file";
         } else {
             $images = explode("\n", $imgs);
             foreach ($images as $img) {
                 $res .= str_replace("../public", "", $img) . "\n";
             }
         }
         $res .= "/images/appdb-logo-new-small.png\n";
         $res .= "/images/appdb_logo_moto.png\n";
         $res .= " /images/homepage.png\n";
     } else {
         $res .= "/js/dojo/appdb.jgz\n";
         $res .= "/js/dojox/grid/_grid/tundraGrid.css?v=" . $ver . "\n";
         $res .= "/js/jQuery.js?v=" . $ver . "\n";
         $res .= "/js/d3.v3.min.js?v=" . $ver . "\n";
         $res .= "/css/main.css?v=" . $ver . "\n";
         $res .= "/css/view.css?v=" . $ver . "\n";
         $res .= "/css/menu.css?v=" . $ver . "\n";
         $res .= "/css/repository.css?v=" . $ver . "\n";
         $res .= "/css/tabbar.css?v=" . $ver . "\n";
         $res .= "/css/jquery-ui.css?v=" . $ver . "\n";
         $res .= "/css/newsfeed.css?v=" . $ver . "\n";
         $res .= "/js/jquery-autocomplete/jquery.autocomplete.css?v=" . $ver . "\n";
         $res .= "/js/archive.js?v=" . $ver . "\n";
         $res .= "/js/brsdet.js?v=" . $ver . "\n";
         $res .= "/js/shortcut.js?v=" . $ver . "\n";
         $res .= "/js/ajaxLoading.js?v=" . $ver . "\n";
         $res .= "/js/json2.js?v=" . $ver . "\n";
         $res .= "/js/appdb.utils.js?v=" . $ver . "\n";
         $res .= "/js/appdb.models.js?v=" . $ver . "\n";
         $res .= "/js/appdb.views.js?v=" . $ver . "\n";
         $res .= "/js/appdbbase.js?v=" . $ver . "\n";
         $res .= "/js/appdb.template.js?v=" . $ver . "\n";
         $res .= "/js/jquery.cookie.js?v=" . $ver . "\n";
         $res .= "/js/jquery.form.js?v=" . $ver . "\n";
         $res .= "/js/jquery.center.js?v=" . $ver . "\n";
         $res .= "/js/jquery.escape.js?v=" . $ver . "\n";
         $res .= "/js/jquery.outerhtml.js?v=" . $ver . "\n";
         $res .= "/js/jquery.scrollTo-min.js?v=" . $ver . "\n";
         $res .= "/js/jquery.tinysort.min.js?v=" . $ver . "\n";
         $res .= "/js/jquery.tagcloud.js?v=" . $ver . "\n";
         $res .= "/js/jquery-autocomplete/jquery.autocomplete.js?v=" . $ver . "\n";
         $res .= "/js/jquery.hashchange.js?v=" . $ver . "\n";
         $res .= "/js/itemview.js?v=" . $ver . "\n";
         $res .= "/js/appdbgui.js?v=" . $ver . "\n";
         $res .= "/js/jquery.google_menu.js?v=" . $ver . "\n";
         $res .= "/js/appdb.pages.js?v=" . $ver . "\n";
         $res .= "/js/appdb.routes.js?v=" . $ver . "\n";
         $res .= "/js/appdb.social.js?v=" . $ver . "\n";
         $res .= "/js/jquery-ui.js?v=" . $ver . "\n";
         $res .= "/js/jquery.form.js?v=" . $ver . "\n";
         $res .= "/js/jquery.center.js?v=" . $ver . "\n";
         $res .= "/js/editForm.js?v=" . $ver . "\n";
         $res .= "/js/tinymce/tiny_mce.js?v=" . $ver . "\n";
         $res .= "/js/tinymce/jquery.tinymce.js?v=" . $ver . "\n";
         $res .= "/js/plupload.full.js?v=" . $ver . "\n";
         $res .= "/js/appdb.repository.js?v=" . $ver . "\n";
         $res .= "/js/appdb.statistics.js?v=" . $ver . "\n";
         $res .= "/js/appdb.vappliance.js?v=" . $ver . "\n";
         $res .= "/js/countdown.min.js?v=" . $ver . "\n";
         $res .= "/js/dojo/appdb.jgz?v=" . $ver . "\n";
         $res .= "/js/dojo/dojo.js?v=" . $ver . "\n";
         $dh = glob(__DIR__ . "/../../public/images/*.png");
         foreach ($dh as $d) {
             $res .= "/images/" . basename($d) . "\n";
         }
         $dh = glob(__DIR__ . "/../../public/images/*.gif");
         foreach ($dh as $d) {
             $res .= "/images/" . basename($d) . "\n";
         }
     }
     $res .= "\n";
     $res .= "\n# Resources that require the user to be online.\n";
     $res .= "NETWORK:\n";
     $res .= "https://" . $_SERVER["HTTP_HOST"] . "/\n";
     $res .= "http://" . $_SERVER["HTTP_HOST"] . "/\n";
     $res .= "https://" . $_SERVER["HTTP_HOST"] . "/auth/\n";
     $res .= "https://" . $_SERVER["HTTP_HOST"] . "/saml/\n";
     $res .= "*\n";
     $res .= "#FALLBACK:\n\n";
     unlink(__DIR__ . "/../../public/appdb.cache");
     $saved = file_put_contents(__DIR__ . "/../../public/appdb.appcache", $res);
     if ($saved === false) {
         echo "Could not save appdb.appcache file\n";
     } else {
         echo "Saved appdb.appcache file\n";
         $hash = md5($res);
         $saved = file_put_contents(__DIR__ . "/../../public/appdb.appcache.hash", $hash);
         if ($saved === false) {
             echo "Could not save appdb.appcache.hash";
         } else {
             echo "Saved appdb.appcache.hash file\n";
         }
     }
 }
Esempio n. 5
0
 public function appdbsyncinitAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     if (localRequest() == false || $_SERVER["REQUEST_METHOD"] != "GET") {
         return;
     }
     RepositoryServices::AppDBSyncInitData();
 }
Esempio n. 6
0
 public function cleararchivedvappversionsAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $islocal = localRequest();
     $appid = isset($_GET["id"]) ? $_GET["id"] : "0";
     $fromindex = isset($_GET["fromindex"]) ? $_GET["fromindex"] : "200";
     if (!is_numeric($appid) || intval($appid) <= 0 || !$islocal) {
         header('HTTP/1.0 404 Not Found');
         header("Status: 404 Not Found");
         return;
     }
     $appid = intval($appid);
     $fromindex = intval($fromindex);
     echo VMCaster::cleararchivedvappversions($appid, $fromindex);
 }
Esempio n. 7
0
 public function dispatchobsoleteimagelistAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $dispatch = isset($_GET["dispatch"]) ? $_GET["dispatch"] : "false";
     $islocal = localRequest();
     $isAdmin = userIsAdminOrManager($this->session->userid);
     if (strtolower(trim($dispatch)) === "true") {
         $dispatch = true;
     } else {
         $dispatch = false;
     }
     if ($dispatch === true && $islocal === false || $dispatch === false && $isAdmin === false) {
         header('HTTP/1.0 404 Not Found');
         header("Status: 404 Not Found");
         return;
     }
     if ($dispatch === false) {
         $res = VoAdminNotifications::createVOObsoleteNotifications();
         echo "<h2>VO Obsolete Images Notifications:</h2>";
         foreach ($res as $r) {
             echo "<div class='notification' style='border:1px solid #aaa;background-color:#f8f8f8;margin: 5px;margin-bottom:20px;padding:10px;'>";
             echo "<div class='recipient'>recipients:  <pre style='display:inline;white-space:pre-wrap;color: #333;'>" . implode(", ", $r["recipients"]) . "</pre></div>";
             echo "<div class='subject'>subject:    <pre style='display:inline;'>" . $r["subject"] . "</pre></div>";
             echo "<div style='padding:5px;border:1px solid #bbb;background-color:#fefefe;margin-top:5px;padding:3px;'><pre style='padding:5px;'>" . htmlentities($r["message"]) . "</pre></div>";
             echo "</div>";
         }
     } else {
         VoAdminNotifications::sendVOObsoleteNotifications();
     }
 }
Esempio n. 8
0
 public function cleardraftsAction()
 {
     if (!localRequest()) {
         header('HTTP/1.0 404 Not Found');
         header("Status: 404 Not Found");
         return;
     }
     $offset = intval(trim($this->_getParam('offset')));
     if ($offset < 1) {
         $offset = 1;
     }
     Storage::clearDrafts($offset);
 }