* | IMPORTANT: Your use of this Software is subject to the terms of | * | the Licence provided in the file licence.txt. If you cannot find | * | this file please contact Squiz (www.squiz.com.au) so we may provide| * | you a copy. | * +--------------------------------------------------------------------+ * * $Id: keywords.php,v 1.1 2013/09/24 01:10:35 ewang Exp $ * */ require_once dirname(__FILE__) . '/../../../../core/include/init.inc'; require_once dirname(__FILE__) . '/../../../../core/lib/html_form/html_form.inc'; $assetid = array_get_index($_GET, 'assetid'); if (is_null($assetid)) { return FALSE; } assert_valid_assetid($assetid); $asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid); if (is_null($asset) || !$asset->writeAccess()) { exit; } $all = array_get_index($_REQUEST, 'all', FALSE); require_once dirname(__FILE__) . '/../../../../core/include/backend_outputter.inc'; $o = new Backend_Outputter(); $o->openSection('Metadata Keyword Replacements'); $o->openField('', 'wide_col'); ?> <p>The following keyword replacements may be used for metadata values. Note that the percentage signs (%) are required.</p> <?php $o->openSection('Asset Information');
<tr> <td valign="top" width="100%" colspan=2> <fieldset> <legend><b><?php echo translate('General'); ?> </b></legend> <table> <tr> <td class="label" nowrap="nowrap"><?php echo translate('Image URL'); ?> :</td> <td> <?php asset_finder('f_imageid', assert_valid_assetid($_GET['f_imageid'], '', TRUE, FALSE) ? $_GET['f_imageid'] : 0, array('image' => 'D', 'image_variety' => 'D'), 'sq_wysiwyg_popup_sidenav', false, 'setImageInfo'); ?> </td> </tr> <tr> <td class="label" nowrap="nowrap"><?php echo translate('Alternate text'); ?> :</td> <td> <input type="text" size="70" name="alt" id="f_alt" title="For browsers that don't support images" value="<?php echo htmlspecialchars($_REQUEST['f_alt']); ?> " /> </td> </tr>
* +--------------------------------------------------------------------+ * | IMPORTANT: Your use of this Software is subject to the terms of | * | the Licence provided in the file licence.txt. If you cannot find | * | this file please contact Squiz (www.squiz.com.au) so we may provide| * | you a copy. | * +--------------------------------------------------------------------+ * * $Id: page_contents_keywords.php,v 1.1 2013/09/24 01:10:35 ewang Exp $ * */ require_once dirname(__FILE__) . '/../../../../core/include/init.inc'; require_once dirname(__FILE__) . '/../../../../core/lib/html_form/html_form.inc'; if (!isset($_GET['assetid'])) { return FALSE; } assert_valid_assetid($_GET['assetid']); $asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($_GET['assetid']); if (!$asset instanceof Form) { trigger_error('Asset is not a form'); return FALSE; } if ($asset->readAccess()) { ?> <html> <head> <title>'<?php echo $asset->attr('name'); ?> ' Page Contents Keyword Replacements</title> <style>
short_usage(); exit(1); case 4: error_line('You must tell the script if it should apply for SAML/Oauth linked user or all users'); short_usage(); exit(1); break; } list($SYSTEM_ROOT, $ROOT_ASSETID, $DISALLOW_SETTING, $LINKED_ONLY) = array_slice($ARGV, 1, 4); if (!is_dir($SYSTEM_ROOT) || !is_readable($SYSTEM_ROOT . '/core/include/init.inc')) { error_line('ERROR: Path provided doesn\'t point to a Matrix installation\'s System Root. Please provide correct path and try again.'); exit(1); } require_once $SYSTEM_ROOT . '/core/include/init.inc'; // Have we been passed a dodgy root asset ID? if (!assert_valid_assetid($ROOT_ASSETID, '', TRUE, FALSE)) { error_line('Root asset ID "' . $ROOT_ASSETID . '" does not appear to be valid'); exit(1); } $root_assetid_details = $GLOBALS['SQ_SYSTEM']->am->getAssetInfo($ROOT_ASSETID); if (empty($root_assetid_details)) { error_line('Root asset ID "' . $ROOT_ASSETID . '" does not exist'); exit(1); } // The "disallow" seting is valid or not? if ($DISALLOW_SETTING !== '0' && $DISALLOW_SETTING !== '1') { error_line('The disallow password login setting is not invalid - it must be either "1" (disallow) or "0" (allow)'); exit(1); } // The "linked only" seting is valid or not? if ($DISALLOW_SETTING !== '0' && $DISALLOW_SETTING !== '1') {
echo "This script needs to be run in the following format:\n\n"; echo "\tphp system_integrity_fix_public_files.php SYSTEM_ROOT ROOT_ID\n\n"; exit(1); } $SYSTEM_ROOT = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : ''; if (empty($SYSTEM_ROOT)) { echo "ERROR: You need to supply the path to the System Root as the first argument\n"; exit; } if (!is_dir($SYSTEM_ROOT) || !is_readable($SYSTEM_ROOT . '/core/include/init.inc')) { echo "ERROR: Path provided doesn't point to a Matrix installation's System Root. Please provide correct path and try again.\n"; exit; } require_once $SYSTEM_ROOT . '/core/include/init.inc'; $ROOT_ID = isset($_SERVER['argv'][2]) ? $_SERVER['argv'][2] : ''; assert_valid_assetid($ROOT_ID, "The ROOT_ID '{$ROOT_ID}' specified is invalid"); $root_user = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('root_user'); if (!$GLOBALS['SQ_SYSTEM']->setCurrentUser($root_user)) { echo "ERROR: Failed login in as root user\n"; exit; } //get children of the tree root asset which are file and its descendant types $assetids = $GLOBALS['SQ_SYSTEM']->am->getChildren($ROOT_ID, 'file', FALSE); //if the tree root asset is file type, include it if ($ROOT_ID != '1') { $asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($ROOT_ID); if ($GLOBALS['SQ_SYSTEM']->am->isTypeDecendant($asset->type(), 'file')) { $assetids[$asset->id] = array(0 => array('type_code' => $asset->type())); } } foreach ($assetids as $assetid => $asset_info) {
* +--------------------------------------------------------------------+ * * $Id: tag_suggestion.php,v 1.13 2012/08/30 01:09:21 ewang Exp $ * */ define('SQ_SYSTEM_ROOT', dirname(dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))))); require_once SQ_SYSTEM_ROOT . '/core/include/init.inc'; require_once SQ_LIB_PATH . '/html_form/html_form.inc'; if (!isset($_GET['assetid'])) { return FALSE; } if (!isset($_GET['prefix'])) { return FALSE; } $assetid = $_GET['assetid']; if (!assert_valid_assetid($assetid)) { exit; } //Sanitise $prefix = preg_replace('/[\'"\\(\\);\\[\\]{}<>=]+/', '', $_GET['prefix']); $asset =& $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid); if (is_null($asset)) { exit; } // Make sure the current user has read access on this asset if (!$asset->writeAccess()) { $GLOBALS['SQ_SYSTEM']->paintLogin(translate('Login'), sprintf(translate('You must login to access the backend'), $asset->name)); exit; } $button_name = 'sq_asset_finder_' . $prefix . '_tags_more_btn'; $labelname = 'sq_asset_finder_' . $prefix . '_tags';
exit; } if (Backend_Search::isAvailable()) { $quick_search_for_text = translate('Enter keywords, asset ID or URL'); } else { $quick_search_for_text = translate('Enter asset ID or URL'); } $search_for = trim(array_get_index($_GET, 'quick-search-for', '')); // If we are searching for something if ($search_for != '') { // check for a url first $asset_by_url = $GLOBALS['SQ_SYSTEM']->am->getAssetFromURL('', strip_url($search_for, TRUE), TRUE, TRUE); if (!is_a($asset_by_url, 'image') || !$asset_by_url->readAccess()) { $asset_by_url = NULL; } if (assert_valid_assetid($search_for, '', TRUE, FALSE)) { $asset_by_id = $GLOBALS['SQ_SYSTEM']->am->getAsset($search_for, '', TRUE); if (!is_a($asset_by_id, 'image') || !$asset_by_id->readAccess()) { $asset_by_id = NULL; } } $html = ''; $found_asset_line = ''; $results = array(); if (!empty($asset_by_url)) { $found_asset =& $asset_by_url; $found_asset_line .= '<strong>' . 'Matched on URL:' . '</strong>'; } if (!empty($asset_by_id)) { $found_asset =& $asset_by_id; $found_asset_line .= '<strong>' . 'Matched on Asset ID:' . '</strong>';
function check_permissions_args($permissions) { foreach ($permissions as $p) { if ($p['type'] > 3 || $p['type'] < 1) { trigger_error("Invalid permission type in permissions string.\n", E_USER_ERROR); } if ($p['granted'] != '+' && $p['granted'] != '-' && $p['granted'] != '/') { trigger_error("Invalid granted flag in permissions string.\n", E_USER_ERROR); } if (!assert_valid_assetid($p['userid'])) { trigger_error("Invalid userid in permissions string.\n", E_USER_ERROR); } } }
if (ini_get('memory_limit') != '-1') { ini_set('memory_limit', '-1'); } $count = 0; $count_rm = 0; $count_2 = 0; $count_rm_2 = 0; $form_assetids = $GLOBALS['SQ_SYSTEM']->am->getTypeAssetIds('form', FALSE); foreach ($form_assetids as $assetid) { $asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid); $complete_link = $GLOBALS['SQ_SYSTEM']->am->getLink($assetid, SQ_LINK_TYPE_2, 'folder', TRUE, 'submissions_folder'); $path = $asset->data_path; $path .= '/incomplete_attachments'; $files = list_dirs($path); foreach ($files as $file) { if (strpos($file, 's') === 0 && assert_valid_assetid(substr($file, 1), '', TRUE, FALSE)) { // This is an incomplete submission, so check if the submission is still valid $incomplete_submission_assetid = substr($file, 1); $incomplete_submission = $GLOBALS['SQ_SYSTEM']->am->getAsset($incomplete_submission_assetid, '', TRUE); if (is_null($incomplete_submission)) { // Report only echo 'Form #' . $assetid . ' still has some incomplete attachment directories for non-existent Submission #' . $incomplete_submission_assetid . '.'; $count++; if ($CORRECT) { // Remove the dir, not needed echo ' Removing.'; delete_directory($path . '/' . $file); $count_rm++; echo ' Done.'; } //end if