public function connect()
 {
     $this->dataDirectory = App::Get()->settings['puny_datastore_localfile_dir'];
     // Ensure we can write to the directory
     if (!is_writeable($this->dataDirectory)) {
         throw new Exception("Puny can not write to the specified data directory");
     }
 }
 /**
  * If authorization config file exists, require(file_name) file
  */
 public function __construct()
 {
     // Set LDAP constants
     define("AUTH_BASE_DN", App::Get()->settings['authorization_ldap_base_dn']);
     define("AUTH_GROUPS_DN", App::Get()->settings['authorization_ldap_group_dn']);
     define("AUTH_LDAP_HOST", App::Get()->settings['authorization_ldap_host']);
     define("AUTH_LDAP_PORT", App::Get()->settings['authorization_ldap_port']);
 }
 public function connect()
 {
     $dbname = App::Get()->settings['puny_datastore_mongo_db'];
     $coll = App::Get()->settings['puny_datastore_mongo_collection'];
     $this->link = new Mongo();
     $this->dbname = $this->link->selectDB($dbname);
     $this->collection = $this->dbname->{$coll};
 }
Beispiel #4
0
/**
 * hook_before_view
 * 
 * This hook is executed before the contents of the main view are processed.
 */
function hook_before_view()
{
    require_once 'scripts/widgets/BreadcrumbsWidget.php';
    $module = App::Get()->loadModule();
    // Include JavaScript files to be shown with every view in this module
    App::Get()->response->addJavascript($module->moduleStatic . '/js/jquery-1.4.2-min.js');
    App::Get()->response->addJavascript($module->moduleStatic . '/js/jcorner.jquery.js');
    // Include CAS-Browser default CSS stylesheets to be shown with every view in this module
    App::Get()->response->addStylesheet($module->moduleStatic . '/css/cas-browser.css');
    App::Get()->response->addStylesheet($module->moduleStatic . '/css/dataTables.css');
}
 /**
  * (non-PHPdoc)
  * @see Puny_DataStore::connect()
  * @throws PDOException
  */
 public function connect()
 {
     $this->host = App::Get()->settings['puny_datastore_pdo_host'];
     $this->username = App::Get()->settings['puny_datastore_pdo_username'];
     $this->password = App::Get()->settings['puny_datastore_pdo_password'];
     $this->dbname = App::Get()->settings['puny_datastore_pdo_dbname'];
     $this->driver = App::Get()->settings['puny_datastore_pdo_driver'];
     $this->tablePrefix = App::Get()->settings['puny_datastore_pdo_tablePrefix'];
     $dsn = $this->driver . ':host=' . $this->host . ';dbname=' . $this->dbname;
     $this->link = new PDO($dsn, $this->username, $this->password);
 }
Beispiel #6
0
 public function render($bEcho = true)
 {
     $str = '';
     $str .= "<table id=\"productTypeSearch\" class=\"dataTable\">\n\t\t\t  <thead>\n\t\t\t    <tr>";
     // Display the Column Headers
     foreach (App::Get()->settings['browser_pt_search_met'] as $metKey) {
         $str .= "<th>" . ucwords($metKey) . "</th>";
     }
     if (isset(App::Get()->settings['browser_pt_hidden_search_met'])) {
         foreach (App::Get()->settings['browser_pt_hidden_search_met'] as $metKey) {
             $str .= "<th class=\"hidden\">{$metKey}</th>";
         }
     }
     $str .= "</tr></thead><tbody>";
     // Display the Data
     foreach ($this->productTypes as $ptKey => $ptMetadata) {
         if (isset(App::Get()->settings['browser_product_type_ignores']) && in_array($ptKey, App::Get()->settings['browser_product_type_ignores'])) {
             continue;
         }
         $str .= "<tr>";
         foreach (App::Get()->settings['browser_pt_search_met'] as $metKey) {
             if ($metKey == App::Get()->settings['browser_pt_search_linkkey']) {
                 $str .= "<td><a href=\"{$this->urlBase}/products/{$ptKey}\">{$ptMetadata[$metKey][0]}</a>";
                 if (count($ptMetadata[$metKey]) == 2) {
                     $str .= "&nbsp({$ptMetadata[$metKey][1]})";
                 }
                 $str .= "</td>";
             } else {
                 if (count($ptMetadata[$metKey]) > 1) {
                     $str .= "<td>" . implode(", ", $ptMetadata[$metKey]) . "</td>";
                 } else {
                     $str .= "<td>{$ptMetadata[$metKey][0]}</td>";
                 }
             }
         }
         if (isset(App::Get()->settings['browser_pt_hidden_search_met'])) {
             foreach (App::Get()->settings['browser_pt_hidden_search_met'] as $metKey) {
                 if (count($ptMetadata[$metKey]) > 1) {
                     $str .= "<td class=\"hidden\">" . implode(", ", $ptMetadata[$metKey]) . "</td>";
                 } else {
                     $str .= "<td class=\"hidden\">{$ptMetadata[$metKey][0]}</td>";
                 }
             }
         }
         $str .= "</tr>\r\n";
     }
     $str .= "</tbody></table>";
     $str .= "<br>";
     if ($bEcho) {
         echo $str;
     } else {
         return $str;
     }
 }
Beispiel #7
0
 public function render($bEcho = true)
 {
     $str = '';
     $references = $this->client->getProductReferences($this->product);
     if (isset($references['faultCode'])) {
         $str .= "<div class=\"error\">";
         $str .= "Error encountered while attempting to retrieve product references.<br/>";
         $str .= "FAULT CODE: {$references['faultCode']}<br/>";
         $str .= "FAULT STRING: {$references['faultString']}<br/>";
         $str .= "</div>";
         if ($bEcho) {
             echo $str;
         } else {
             return $str;
         }
     }
     $referenceCounter = 0;
     $str .= "<table class=\"pdw_downloadTable\">";
     foreach ($references as $reference) {
         $fileName = end(explode("/", $reference['dataStoreReference']));
         $fileSize = $reference['fileSize'];
         $fileSizeStr = "";
         $fileSize > 1024 * 1024 ? $fileSizeStr = number_format($fileSize / (1024 * 1024), 1) . " MB" : ($fileSize > 1024 ? $fileSizeStr = number_format($fileSize / 1024, 1) . " KB" : ($fileSizeStr = $fileSize . " bytes"));
         $str .= "<tr>";
         $str .= "<td>";
         if ($reference['mimeType'] == 'image/jpeg') {
             $str .= "<img class=\"tn\" src=\"" . $this->dataDeliveryUrl . "/data?refIndex={$referenceCounter}&productID={$this->product->getID()}\">";
         } else {
             $str .= "<img class=\"tn\" src=\"" . App::Get()->request->moduleStatic . "/img/download-icon.gif\"/>";
         }
         $str .= "</td>";
         $str .= "<td style=\"vertical-align:top;\">" . urldecode($fileName) . " <br/><span id=\"product_download_span\">{$fileSizeStr}</span><br/>";
         $str .= "Mime Type: {$reference['mimeType']}<br/>";
         if ($reference['mimeType'] == 'image/jpeg') {
             $str .= "&nbsp;<a href=\"" . $this->dataDeliveryUrl . "/data?refIndex={$referenceCounter}&productID={$this->product->getID()}\" target=\"_new\">view</a> &nbsp;";
             $str .= "<a href=\"getImage.php?productID={$this->product->getID()}&refNumber={$referenceCounter}&fileName={$fileName}\">save</a>&nbsp;";
         } else {
             $str .= "<a href=\"" . $this->dataDeliveryUrl . "/data?refIndex={$referenceCounter}&productID={$this->product->getID()}\">save</a> &nbsp;";
         }
         $str .= "</td>";
         $str .= "</tr>";
         $referenceCounter++;
     }
     $str .= "</table>";
     if ($bEcho) {
         echo $str;
     } else {
         return $str;
     }
 }
Beispiel #8
0
 public function getResponse()
 {
     $this->setAuthenticationProviderInstance();
     $this->setAuthorizationProviderInstance();
     // Interpret the request uri of the current request
     $uri = App::Get()->settings['site_root'] != '/' ? substr($_SERVER['REQUEST_URI'], strlen(App::Get()->settings['site_root'])) : $_SERVER['REQUEST_URI'];
     $this->request = new Org_Apache_Oodt_Balance_Core_ApplicationRequest($this->settings, $uri);
     // Initialize a response object for the request
     $this->response = new Org_Apache_Oodt_Balance_Core_ApplicationResponse($this->settings, $this->request);
     // Process the response
     $this->response->process();
     // Return the processed response object
     return $this->response;
 }
 protected function processAsView()
 {
     // Determine the view to use
     list($thePage) = explode('index.php', parse_url($this->uri, PHP_URL_PATH));
     // we only care about URL path info
     $thePage = ltrim($thePage, '/');
     if ($thePage == '') {
         $thePage = 'index';
     }
     $parts = explode('/', $thePage);
     // Determine whether a module is being requested
     $module = App::Get()->isModule($thePage);
     if ($module) {
         $this->isModule = true;
         $this->modulePath = $module->modulePath;
         $this->moduleRoot = $module->moduleRoot;
         $this->moduleStatic = $module->moduleStatic;
         array_shift($parts);
     }
     // Starting with the full request string, test for the existance of
     // a corresponding view. If none is found in the HOME
     // directory, chop off the last segment and try again. Add the chopped
     // segment to the "segments" array since it is likely a parameter.
     $partCount = count($parts);
     // check for view at least once
     do {
         $testPath = implode('/', $parts);
         $homeTest = ($this->isModule ? "{$this->modulePath}/views" : $this->config['views_dir']) . '/' . $testPath . '.php';
         $homeIdxTest = ($this->isModule ? "{$this->modulePath}/views" : $this->config['views_dir']) . '/' . $testPath . '/index.php';
         if (is_file($homeTest)) {
             $this->viewPath = $homeTest;
             break;
         }
         if (is_file($homeIdxTest)) {
             $this->viewPath = $homeIdxTest;
             break;
         }
         // If here, neither is a valid view, so chop the last segment
         $this->segments[] = $parts[$partCount - 1];
         array_pop($parts);
         $partCount--;
     } while ($partCount > 0);
     // If no view has been found by this point, display a 404 message
     if (!$this->viewPath) {
         $this->viewPath = dirname(dirname(__FILE__)) . "/views/error/404.php";
     }
     // Reverse the segments array so that params appear in the proper order
     $this->segments = array_reverse($this->segments);
 }
Beispiel #10
0
function displayAttributes($userAttr)
{
    $str = '';
    foreach ($userAttr as $key => $keyValue) {
        foreach (App::Get()->settings['attr_titles'] as $attrTitle => $value) {
            if ($key === $value) {
                $str .= '<div class="span-13 prepend-1"><h4 align="left">';
                $str .= $attrTitle;
                $str .= '</h4></div>';
                $str .= '<div class="span-5"><h6 align="left">';
                $str .= $keyValue;
                $str .= '</h6></div>';
            }
        }
    }
    return $str;
}
Beispiel #11
0
 public function render($bEcho = true)
 {
     $module = App::Get()->loadModule();
     $str = '';
     $str .= '<form action="' . $module->moduleRoot . '/queryScript.do" method="POST">';
     $str .= '<input type="hidden" name="Types[0]" value="*"/>';
     $str .= '<input type="hidden" name="Criteria[0][CriteriaType]" value="Term"/>';
     $str .= '<input type="hidden" name="Criteria[0][ElementName]" value="*"/>';
     $str .= '<input type="text" name ="Criteria[0][Value]"/>';
     $str .= '<input type="submit" value="Search"/>';
     $str .= '</form>';
     if ($bEcho) {
         echo $str;
     } else {
         return $st;
     }
 }
Beispiel #12
0
 public function render($bEcho = true)
 {
     $str = '';
     $data = App::Get()->response->data('breadcrumbs');
     if (!empty($data)) {
         foreach ($data as $bc) {
             if (is_array($bc)) {
                 $str .= '<span class="crumb link"><a href="' . $bc[1] . '">' . $bc[0] . "</a></span>{$this->separator}";
             } else {
                 $str .= '<span class="crumb text">' . $bc . '</span>';
             }
         }
     }
     if ($bEcho) {
         echo $str;
     } else {
         return $str;
     }
 }
Beispiel #13
0
function manageAttribute()
{
    $userAttr = App::Get()->getAuthenticationProvider()->retrieveUserAttributes(App::Get()->getAuthenticationProvider()->getCurrentUsername(), App::Get()->settings['profile_modify_attributes']);
    $str = '';
    foreach ($userAttr as $key => $keyValue) {
        foreach (App::Get()->settings['attr_titles'] as $attrTitle => $value) {
            if ($key != App::Get()->settings['username_attr']) {
                if ($key === $value) {
                    $str .= '<div class="span-3 prepend-1"><label for="';
                    $str .= $key . '"> ' . $attrTitle;
                    $str .= '</label></div>';
                    $str .= '<div class="span-12"><input class="profile_input" type="text" maxlength="100" id=';
                    $str .= $key . ' name=' . $key . ' value=' . $keyValue;
                    $str .= '></div>';
                    $str .= '<br class="space"/>';
                }
            }
        }
    }
    return $str;
}
Beispiel #14
0
 public function render($bEcho = true)
 {
     $str = '';
     $module = App::Get()->loadModule($this->moduleName);
     // Display the appropriate information about the user
     if ($this->isLoggedIn) {
         $str .= "Logged in as ";
         if ($this->profileLink) {
             $str .= '<a href="' . $module->moduleRoot . '/">' . $this->username . '</a>&nbsp;|&nbsp;' . '<a href="' . $module->moduleRoot . '/logout.do">Log Out</a>';
         } else {
             $str .= $this->username . '&nbsp;|&nbsp;' . '<a href="' . $module->moduleRoot . '/logout.do">Log Out</a>';
         }
     } else {
         $str .= '<a href="' . $module->moduleRoot . '/login">Log In</a>';
     }
     if ($bEcho) {
         echo $str;
     } else {
         return $str;
     }
 }
Beispiel #15
0
/typesearch/">Browse Across Types</a></li>
		</ul>
		<hr class="space"/>
		
		<div id="section_filter_tools_container">
			<div id="section_filter_tools_buttons">
				<input type="button" id="showFilters" value=<?php 
echo '"' . $filterButtonValue . '"';
?>
 />
			</div>
			<div id="section_filter_tools">
				<div id="filter_widget">
					Filter: <?php 
$crossTypeWidget->render();
?>
				</div>
			</div>
		</div>
		
		<br/>
		<div id="loading_icon_container">
		<img src="<?php 
echo App::Get()->request->moduleStatic . '/img/loading.gif';
?>
"/>
		</div>
		<div id="cas_browser_product_list"></div>
	</div>
</div>
</div>
Beispiel #16
0
<html>
<head>
<title>Untitled OODT Balance Application</title>

<!-- Base stylesheets -->
<link rel="stylesheet" type="text/css" href="<?php 
echo SITE_ROOT . '/static/css/balance/balance.css';
?>
"/>

<!-- Base Javascript -->

<!-- Dynamically Added Stylesheets -->
<!-- STYLESHEETS -->

<!-- Dynamically Added Javascripts -->
<!-- JAVASCRIPTS -->

<!-- Site specific stylesheet overrides -->
<link rel="stylesheet" type="text/css" href="<?php 
echo SITE_ROOT . '/static/css/site.css';
?>
"/>

</head>
<body>
<div class="container">
<?php 
// This retrieves any 'flash' messages that should be displayed to the user
echo App::Get()->GetMessages();
Beispiel #17
0
 public function renderPageDetails($bEcho = true)
 {
     // Variables to determine product range displayed and total count
     $pageNum = $this->pageNum == -1 ? 0 : $this->pageNum;
     $totalPages = $this->totalPages == -1 ? 0 : $this->totalPages;
     $displayCountStart = $totalPages == 0 ? 0 : $this->pageSize * ($pageNum - 1) + 1;
     $displayCountEnd = $totalPages == 0 ? 0 : $displayCountStart + count($this->pageProducts) - 1;
     $displayCountStart = $totalPages > 0 && $displayCountStart == 0 ? 1 : $displayCountStart;
     // 'Previous' and 'Next' page links
     $linkBase = App::Get()->loadModule()->moduleRoot . "/products/{$this->productTypeId}/page";
     $prevPageNum = $this->pageNum - 1;
     $nextPageNum = $this->pageNum + 1;
     $prevPageLink = $prevPageNum >= 1 ? "<a href=\"{$linkBase}/{$prevPageNum}\">&lt;&lt;&nbsp;Previous Page</a>" : '';
     $nextPageLink = $nextPageNum <= $this->totalPages ? "<a href=\"{$linkBase}/{$nextPageNum}\">Next Page&nbsp;&gt;&gt;</a>" : '';
     $rangeInfo = "<span class=\"pp_detail\">Page {$pageNum} of {$totalPages} " . "(products {$displayCountStart} - {$displayCountEnd})</span>";
     $str = "<div class=\"pp_pageLinks\">{$rangeInfo}&nbsp;&nbsp;{$prevPageLink}&nbsp;&nbsp;{$nextPageLink}</div>\r\n";
     if ($bEcho) {
         echo $str;
     } else {
         return $str;
     }
 }
Beispiel #18
0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// Include the main Puny class
require_once App::Get()->settings['puny_module_path'] . '/classes/Puny.class.php';
// Get the configured editor username / password
$punyUsername = App::Get()->settings['puny_editor_username'];
$punyPassword = App::Get()->settings['puny_editor_password'];
// Get the provided credentials from the POST request
$username = $_POST['username'];
$password = $_POST['password'];
// Ensure that the editor credentials are properly configured in config.ini
if (!($punyUsername && $punyPassword)) {
    $_SESSION['puny_error'] = "Unable to launch Puny because the Puny " . "admin credentials are not configured properly.";
    App::Get()->redirect(App::Get()->settings['puny_module_root'] . '/error');
}
// Test the provided values against the configured values
if ($username == $punyUsername && $password == $punyPassword) {
    // Login success
    Puny::initializeEditorSession();
    App::get()->redirect(SITE_ROOT . '/');
} else {
    // Login Failure...
    $_SESSION['puny_error'] = "Invalid editor credentials provided...";
    App::Get()->redirect(App::Get()->settings['puny_module_root'] . '/error');
}
exit;
Beispiel #19
0
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// Grab the most recent error from the session
$errorText = $_SESSION['puny_error'];
unset($_SESSION['puny_error']);
// Don't show a header or footer for this view
App::Get()->response->useHeaderFile(false);
App::Get()->response->useFooterFile(false);
?>

<h1>Puny</h1>
<h2>An error has occurred:</h2>
<p><?php 
echo $errorText;
?>
</p>
Beispiel #20
0
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * PROFILE MANAGER - LOGIN
 * 
 * Attempt to login.
 * 
 * @author s.khudikyan
**/
$module = App::Get()->loadModule();
// Get instance of authentication class
$authentication = App::Get()->getAuthenticationProvider();
$message = '';
// If a user is already logged in, redirect to home page
if ($authentication->isLoggedIn()) {
    App::Get()->Redirect(SITE_ROOT . "/");
} else {
    if (isset($_POST["username"]) && isset($_POST["password"])) {
        // Check the provided login credentials:
        if ($authentication->login($_POST["username"], $_POST["password"])) {
            App::Get()->Redirect(SITE_ROOT . "/");
            // login successful
        } else {
            App::Get()->SetMessage("Invalid Credentials Provided", CAS_MSG_ERROR);
            App::Get()->Redirect($module->moduleRoot . "/login");
        }
    }
}
Beispiel #21
0
 public function renderScript($bEcho = true)
 {
     $module = App::Get()->loadModule();
     $str = '';
     $str .= '<script type="text/javascript">var htmlID = "' . $this->htmlID . '";</script>';
     $str .= '<script type="text/javascript">var ptName = "' . $this->productType->getName() . '";</script>';
     $str .= '<script type="text/javascript">var siteUrl = "' . $this->siteUrl . '";</script>';
     $str .= '<script type="text/javascript">var resultFormat = "' . $this->resultFormat . '";</script>';
     $str .= '<script type="text/javascript" src="' . $module->moduleStatic . '/js/querywidget.js"></script>';
     $str .= '<script type="text/javascript" src="' . $module->moduleStatic . '/js/customsearchwidget.js"></script>';
     if ($bEcho) {
         echo $str;
     } else {
         return $str;
     }
 }
Beispiel #22
0
 *     - json   (default) a json array representing all matching product types
 *              with their defined metadata
 *              
 */
$module = App::Get()->loadModule();
require_once $module->modulePath . "/classes/CasBrowser.class.php";
require_once $module->modulePath . "/scripts/widgets/ProductTypeListWidget.php";
// Get a Cas-Browser XML/RPC Client
$browser = new CasBrowser();
$client = $browser->getClient();
// Get a list of the product types managed by this server
$ptypes = $client->getProductTypes();
// Get the metadata key/val pair that will serve as the needle
$metKey = urldecode($_GET['key']);
$needle = urldecode($_GET['value']);
$productTypes = array();
foreach ($ptypes as $pt) {
    $ptArray = $pt->toAssocArray();
    // Check whether the requested met key value matches desired value
    if ($needle == '*' || isset($ptArray['typeMetadata'][$metKey]) && $ptArray['typeMetadata'][$metKey][0] == $needle) {
        $merged = array_merge($ptArray['typeMetadata'], array("name" => array($ptArray[App::Get()->settings['browser_pt_name_key']]), "description" => array($ptArray[App::Get()->settings['browser_pt_desc_key']]), "id" => array($ptArray[App::Get()->settings['browser_pt_id_key']])));
        $productTypes[] = $merged;
    }
}
// Format output as json
$json = json_encode($productTypes);
// Output the json result
header('Content-Type: application/json');
echo $json;
// We're done.
exit;
Beispiel #23
0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
$module = App::Get()->loadModule();
// Pass the installed site root to javascript
App::Get()->response->addJavascript("var site_root = '" . SITE_ROOT . "';", true);
// Don't show a header or footer on this view
App::Get()->response->useHeaderFile(false);
App::Get()->response->useFooterFile(false);
// Include the main Puny class
require_once App::Get()->settings['puny_module_path'] . '/classes/Puny.class.php';
// Load the requested resource
$resource = Puny::load(App::Get()->request->segments[0]);
// Get the raw contents
$content = $resource->getContent(true);
?>

<!-- JAVASCRIPTS -->
<!-- STYLESHEETS -->
<script type="text/javascript">
	$(document).ready(function() {
		$.GollumEditor();
	});
</script>


<div id="wiki-wrapper" class="edit outer">
  <div id="head">
Beispiel #24
0
<?php

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// Parse the Puny config file
$module = App::Get()->loadModule();
// Include the main Puny class
require_once App::Get()->settings['puny_module_path'] . '/classes/Puny.class.php';
// Get the resource id from the request parameters
$resourceId = $_POST['resourceId'];
$content = $_POST['content'];
// Load the requested resource and update the content
$resource = Puny::load($resourceId)->setContent($content);
// Store the updated content as a new version
Puny::store($resource);
// we're done :)
echo json_encode(array("status" => "ok", "resourceId" => $resourceId, "version" => $resource->getVersion(), "parsedContent" => $resource->parse()->getContent()));
Beispiel #25
0
<?php

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// Parse the Puny config file
$module = App::Get()->loadModule();
// Include the main Puny class
require_once App::Get()->settings['puny_module_path'] . '/classes/Puny.class.php';
// Destroy the editor session
Puny::destroyEditorSession();
// Redirect home
App::Get()->redirect(SITE_ROOT . '/');
exit;
Beispiel #26
0
	// Turn the table into a sortable, searchable table
	$("#productTypeSearch").dataTable();
	// Give the search box the initial focus
	$("#productTypeSearch_filter > input").focus();
}); 
</script>

<div class="container">

<?php 
if ($isAlive) {
    ?>
<hr class="space"/>
<div id="cas_browser_container" class="span-22 last prepend-1 append-1">
	<h2 id="cas_browser_title"><?php 
    echo App::Get()->settings['browser_index_title_text'];
    ?>
</h2>
	<ul class="tabmenu">
		<li class="selected"><a href="<?php 
    echo $module->moduleRoot;
    ?>
/">Browse By Type</a></li>
		<li class=""><a href="<?php 
    echo $module->moduleRoot;
    ?>
/typesearch/">Browse Across Types</a></li>
	</ul>
	<br class="fiftyPx"/>
<?php 
    $productTypeListWidget->render();
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * Profile Manager:
 * Display confirmation of password change and allow user to log back in
 */
$module = App::Get()->loadModule();
?>
	
	<div class="breadcrumbs">
		<a href="<?php 
echo SITE_ROOT;
?>
/">Home</a>
	</div>
    
    <div class='span-22 append-1 prepend-1 last' id="profile_container">
    	<div class="span-24">
    		<br>
			<h3>Password has been changed.</h3>
			<br>
    	</div>
 /**
  * Generates a response by processing the requested view,
  * including any header and footer views (if needed) as specified
  * by the application config file.
  * 
  * Available options:
  *   skipHeader: boolean (default = false) If present, omits header processing
  *   skipFooter: boolean (default = false) If present, omits footer processing
  *   skipHooks:  boolean (default = false) If present, omits hook processing
  *
  * @param array $options
  */
 public function process($options = array())
 {
     // Merge defaults with provided options
     $defaults = array('skipHeader' => false, 'skipFooter' => false, 'skipHooks' => false);
     $options += $defaults;
     if (!$options['skipHooks']) {
         // Include the appropriate hooks.php file
         include (App::Get()->request->isModule ? App::Get()->request->modulePath : HOME) . '/hooks.php';
         // Run 'before_all' hook for all requests
         if (function_exists('hook_before_all')) {
             hook_before_all();
         }
     }
     // Preprocessing for a view
     if (!$this->request->isScript) {
         ob_start();
         // Start buffering the output
         // Check that the requested view exists
         if (file_exists($this->request->viewPath)) {
             // Run the beforeView hook
             if (!$options['skipHooks'] && function_exists('hook_before_view')) {
                 hook_before_view();
             }
             // Process the view
             include $this->request->viewPath;
         } else {
             include HOME . "/views/errors/404.php";
             // 404 error page
         }
         $this->view = ob_get_contents();
         ob_clean();
         // Determine the header view (if any) to include
         if (!$options['skipHeader'] && $this->header && is_file($this->header)) {
             // Run the beforeHeader hook
             if (!$options['skipHooks'] && function_exists('hook_before_header')) {
                 hook_before_header();
             }
             // Process the header
             if (!empty($this->header)) {
                 include $this->header;
             }
             $this->header = ob_get_contents();
             ob_clean();
         }
         // Determine the footer view (if any) to include
         if (!$options['skipFooter'] && $this->footer && is_file($this->footer)) {
             // Run the beforeFooter hook
             if (!$options['skipHooks'] && function_exists('hook_before_footer')) {
                 hook_before_footer();
             }
             // Process the footer
             if (!empty($this->footer)) {
                 include $this->footer;
             }
             $this->footer = ob_get_contents();
             ob_clean();
         }
         ob_end_clean();
         // Stop buffering the output
     } else {
         require_once $this->request->scriptPath;
         exit;
     }
 }
Beispiel #29
0
$metadataWidget->loadMetadata($browser->getVisibleMetadataForProduct($productId));
// Record the product page to send the user back to, if provided
$returnPage = isset(App::Get()->request->segments[1]) ? App::Get()->request->segments[1] : 1;
// Create a ProductDownloadWidget
$productDownloadWidget = new ProductDownloadWidget(array("dataDeliveryUrl" => App::Get()->settings['browser_datadeliv_url']));
$productDownloadWidget->setClient($client);
$productDownloadWidget->load($product);
// Add the cas-browser styles
App::Get()->response->addStylesheet($module->moduleStatic . '/css/cas-browser.css');
// Prepare BreadcrumbWigdet
$bcw = new BreadcrumbsWidget();
$bcw->add('Home', SITE_ROOT . '/');
$bcw->add('Browse By Type', $module->moduleRoot . '/');
$bcw->add($productTypeName, $module->moduleRoot . "/dataset/{$productTypeId}");
$bcw->add('Products', $module->moduleRoot . "/products/{$productTypeId}/page/{$returnPage}");
$bcw->add(App::Get()->request->segments[0]);
?>


<hr class="space"/>
<div class="span-22 last prepend-1 append-1">
	<div id="cas_browser_product_metadata">
		<h2 class="larger loud">Product Metadata: <?php 
echo wordwrap($productName, 62, "<br />", true);
?>
</h2>
		<?php 
$metadataWidget->render();
?>
	</div>
	<div id="cas_browser_product_download">
Beispiel #30
0
 /**
  * Method to get the view name
  *
  * The model name by default parsed using the classname, or it can be set
  * by passing a $config['name'] in the class constructor
  *
  * @return  string  The name of the model
  */
 public function getName()
 {
     if (empty($this->_name)) {
         $this->_name = \App::Get('request')->getCmd('controller');
         if (!$this->_name) {
             $r = null;
             if (!preg_match('/View((view)*(.*(view)?.*))$/i', get_class($this), $r)) {
                 throw new \Exception(\App::get('language')->txt('JLIB_APPLICATION_ERROR_VIEW_GET_NAME'), 500);
             }
             if (strpos($r[3], 'view')) {
                 throw new \Exception(\App::get('language')->txt('JLIB_APPLICATION_ERROR_VIEW_GET_NAME_SUBSTRING'), 500);
             }
             $this->_name = strtolower($r[3]);
         }
     }
     return $this->_name;
 }