of the string
*/
function strToLower($string) {
return strtr($string, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
}
/**
* ASCII version of PHP's strtoupper().
* @param string $string
* @return string uppercase version of the string
*/
function strToUpper($string) {
return strtr($string, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
}
/**
* Checks whether the given HTTP header is safe.
*
* PHP versions before PHP 4.4.2 / PHP 5.1.2 allowed for HTTP header injection (HTTP RS).
* This function ensures that servers running older PHP versions are protected as well.
*
* @param string $header
* @return bool true if the given header is safe
*/
function isSafeHttpHeader($header) {
if (!is_string($header)) {
return false;
}
/* Don't allow plain occurrences of CR or LF */
if (strpos($header, chr(13)) !== false || strpos($header, chr(10)) !== false) {
return false;
}
/* Don't allow (x times) url encoded versions of CR or LF */
if (preg_match('/%(25)*(0a|0d)/i', $header)) {
return false;
}
return true;
}
}
?>
= GalleryCoreApi::updateMapEntry('GalleryCacheMap',
array('userId' => $userIdForSql,
'timestamp' => new GallerySqlFragment('< ?', (int)$cutoff), 'isEmpty' => 0),
array('value' => null, 'isEmpty' => 1));
if ($ret) {
return $ret;
}
return null;
}
}
?>
eleteFastDownloadFileById($entityId) {
GalleryCoreApi::requireOnce(
'modules/core/classes/helpers/GalleryEntityHelper_medium.class');
return GalleryEntityHelper_medium::deleteFastDownloadFileById($entityId);
}
/**
* Create a small PHP file containing all the information we need to send a data item or
* derivative to the browser.
* Note that fast-downloads are only created for items with public permissions
*
* @param object $entity GalleryDataItem or GalleryDerivative object
* @param bool $runEvenInUnitTest (optional) force this to run, even in the unit test framework
* @return GalleryStatus a status code
*/
function createFastDownloadFile($entity, $runEvenInUnitTest=false) {
GalleryCoreApi::requireOnce(
'modules/core/classes/helpers/GalleryEntityHelper_medium.class');
return GalleryEntityHelper_medium::createFastDownloadFile($entity, $runEvenInUnitTest);
}
/**
* Get id of the album to display by default.
* @return array GalleryStatus a status code
* int album id
*/
function getDefaultAlbumId() {
global $gallery;
$defaultId = $gallery->getConfig('defaultAlbumId');
if (empty($defaultId)) {
list ($ret, $defaultId) = GalleryCoreApi::getPluginParameter(
'module', 'core', 'id.rootAlbum');
if ($ret) {
return array($ret, null);
}
}
return array(null, (int)$defaultId);
}
/**
* Get id of the guest user.
*
* @return array GalleryStatus a status code
* int user id
*/
function getAnonymousUserId() {
global $gallery;
$id = $gallery->getConfig('anonymousUserId');
if (empty($id)) {
list ($ret, $id) =
GalleryCoreApi::getPluginParameter('module', 'core', 'id.anonymousUser');
if ($ret) {
return array($ret, null);
}
}
return array(null, $id);
}
/**
* Is the user a guest?
*
* @param int $userId id of user (default is current user)
* @return array GalleryStatus a status code
* boolean true if anonymous
*/
function isAnonymousUser($userId=null) {
if (empty($userId)) {
global $gallery;
$userId = $gallery->getActiveUserId();
}
list ($ret, $anonymousId) = GalleryCoreApi::getAnonymousUserId();
if ($ret) {
return array($ret, null);
}
return array(null, $userId == $anonymousId);
}
/**
* Remove the given sort order from any thing in the framework that uses it
* (albums and the default sort order).
*
* @param string $sortOrder
* @return GalleryStatus a status code
*/
function deleteSortOrder($sortOrder) {
GalleryCoreApi::requireOnce(
'modules/core/classes/helpers/GalleryItemHelper_advanced.class');
return GalleryItemHelper_advanced::deleteSortOrder($sortOrder);
}
/**
* Remove the given renderer from all items that are using it.
*
* @param string $rendererClassName
* @return GalleryStatus a status code
*/
function deleteRenderer($rendererClassName) {
GalleryCoreApi::requireOnce(
'modules/core/classes/helpers/GalleryItemHelper_advanced.class');
return GalleryItemHelper_advanced::deleteRenderer($rendererClassName);
}
/**
* Load template data for a theme settings form
*
* @param string $themeId if empty, site default theme is used
* @param int $itemId
* @param GalleryTemplate $template
* @param array $form
* @return GalleryStatus a status code
*/
function loadThemeSettingsForm($themeId, $itemId, &$template, &$form) {
GalleryCoreApi::requireOnce('modules/core/classes/helpers/GalleryThemeHelper_medium.class');
return GalleryThemeHelper_medium::loadThemeSettingsForm(
$themeId, $itemId, $template, $form);
}
/**
* Load the block configuration files from every module
*
* @param bool $getInactive (optional) by default, only active modules' blocks are returned
* @return array GalleryStatus a status code
* array block configurations
*/
function loadAvailableBlocks($getInactive=false) {
GalleryCoreApi::requireOnce('modules/core/classes/helpers/GalleryThemeHelper_medium.class');
return GalleryThemeHelper_medium::loadAvailableBlocks($getInactive);
}
/**
* Handle theme settings form submission
*
* @param string $themeId if empty, site default theme is used
* @param int $itemId
* @param array $form form values
* @return array GalleryStatus a status code
* array error messages
* string localized status message
*/
function handleThemeSettingsRequest($themeId, $itemId, $form) {
GalleryCoreApi::requireOnce('modules/core/classes/helpers/GalleryThemeHelper_medium.class');
return GalleryThemeHelper_medium::handleThemeSettingsRequest($themeId, $itemId, $form);
}
/**
* Return true if this username is not allowed to log in (generally due to automated abuse).
* The username doesn't have to correspond to a real user in the system.
*
* @param string $userName a username
* @return array GalleryStatus a status code
* bool true if the account is disabled
*/
function isDisabledUsername($userName) {
GalleryCoreApi::requireOnce('modules/core/classes/helpers/GalleryUserHelper_medium.class');
return GalleryUserHelper_medium::isDisabledUsername($userName);
}
/**
* Get a list of entity members which are allowed to be shown / set by external systems (e.g.
* via remote protocols like WebDAV, XML-RPC, etc).
* This does not include any permission checking.
* @param string $entityName name of the entity
* @return array GalleryStatus a status code
* array(string memberName =>
* array('read' => boolean true if it's ok to show,
* 'write' => boolean true if it's ok to set))
*/
function getExternalAccessMemberList($entityName) {
GalleryCoreApi::requireOnce(
'modules/core/classes/helpers/GalleryEntityHelper_medium.class');
return GalleryEntityHelper_medium::getExternalAccessMemberList($entityName);
}
/**
* Copy the translations for a given plugin into our locale hierarchy.
*
* @param string $pluginType 'module' or 'theme'
* @param string $pluginId the id of the plugin
* @return GalleryStatus a status code
*/
function installTranslationsForPlugin($pluginType, $pluginId) {
GalleryCoreApi::requireOnce(
'modules/core/classes/helpers/GalleryTranslatorHelper_medium.class');
return GalleryTranslatorHelper_medium::installTranslationsForPlugin($pluginType, $pluginId);
}
/**
* Remove the translations for a given plugin from our locale hierarchy.
*
* @param string $pluginType 'module' or 'theme'
* @param string $pluginId the id of the plugin
* @return GalleryStatus a status code
*/
function removeTranslationsForPlugin($pluginType, $pluginId) {
GalleryCoreApi::requireOnce(
'modules/core/classes/helpers/GalleryTranslatorHelper_medium.class');
return GalleryTranslatorHelper_medium::removeTranslationsForPlugin($pluginType, $pluginId);
}
/**
* Copy the translations for a given locale into our locale hierarchy.
* Copies for all available (even uninstalled) plugins.
* @param string $locale (optional) Defaults to translator's current locale
* @return GalleryStatus a status code
*/
function installTranslationsForLocale($locale=null) {
GalleryCoreApi::requireOnce(
'modules/core/classes/helpers/GalleryTranslatorHelper_medium.class');
return GalleryTranslatorHelper_medium::installTranslationsForLocale($locale);
}
/**
* Return the list of languages that we support.
* @return array['language code']['country code'] =
* array('description', 'right-to-left'?)
*/
function getSupportedLanguages() {
GalleryCoreApi::requireOnce(
'modules/core/classes/helpers/GalleryTranslatorHelper_medium.class');
return GalleryTranslatorHelper_medium::getSupportedLanguages();
}
/**
* Returns the language description of the specified language-country code.
* eg. en_US => English (US)
*
* @param string $languageCode
* @return array GalleryStatus a status code
* string language description
*/
function getLanguageDescription($languageCode) {
GalleryCoreApi::requireOnce(
'modules/core/classes/helpers/GalleryTranslatorHelper_medium.class');
return GalleryTranslatorHelper_medium::getLanguageDescription($languageCode);
}
/**
* Get the local path to the Gallery code base path (not URL or web root). Optionally append a
* relative path.
* @param string $relativePath (optional) Relative path to append to the code base path.
* @return string local path to the Gallery code base. If the optional parameter has not been
* supplied the return value will have the trailing slash appended.
*/
function getCodeBasePath($relativePath=null) {
static $codeBaseDirectory;
if (!isset($codeBaseDirectory)) {
$codeBaseDirectory = dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR;
}
return ($relativePath == null) ? $codeBaseDirectory : $codeBaseDirectory . $relativePath;
}
/**
* Check whether modification checks should be done to see if the compiled templates
* are still up to date. The result is cached in memory.
* @return boolean false if the compiled templates should be used without any checking
*/
function shouldDoCompileCheck() {
GalleryCoreApi::requireOnce('modules/core/classes/GalleryTemplate.class');
return GalleryTemplate::shouldDoCompileCheck();
}
/**
* Allows the application to programmatically set Gallery into or out of maintenance mode.
* @param mixed $mode This can either be a boolean flag or a string representing the url of the
* custom maintenance mode page.
* @return GalleryStatus a status code
*/
function setMaintenanceMode($mode) {
GalleryCoreApi::requireOnce('modules/core/classes/helpers/MaintenanceHelper_simple.class');
return MaintenanceHelper_simple::setMaintenanceMode($mode);
}
/**
* Store a value in the event log.
* @param string $type a short string with the type of event
* (e.g.: 'Gallery Error', 'PHP Error', 'comment module')
* @param string $summary a brief summary of the event
* @param string $detail the event details
* @return GalleryStatus a status code
*/
function addEventLogEntry($type, $summary, $details) {
GalleryCoreApi::requireOnce(
'modules/core/classes/helpers/GalleryEventLogHelper_medium.class');
return GalleryEventLogHelper_medium::addEventLogEntry($type, $summary, $details);
}
}
?>
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/sasineta/public_html/gallery/modules/core/classes/GalleryUtilities.class:1646) in /home/sasineta/public_html/gallery/lib/support/GallerySetupUtilities.class on line 357
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/sasineta/public_html/gallery/modules/core/classes/GalleryUtilities.class:1646) in /home/sasineta/public_html/gallery/lib/support/GallerySetupUtilities.class on line 357
while (isset($data['arg' . $i])) {
$args[] = $data['arg' . $i];
$i++;
/* Catch runaways */
if ($i > 100) {
return array(GalleryCoreApi::error(ERROR_UNKNOWN), null);
}
}
/* If we have arguments, then feed the localized string and the arguments into sprintf */
if (count($args) > 0) {
$localized = vsprintf($localized, $args);
}
/*
* This is a useful debug routine. Uncomment it to have every string prefixed with the
* domain it was localized in.
*/
// $localized = "$domain/{$this->_languageCode}:$localized";
return array(null, $localized);
}
/**
* Convert the locale to the language code
* @param string $locale The locale code to be converted (i.e. en_US, en_GB, etc.)
* @return array GalleryStatus a status code
* string language code (i.e. en, en_GB, etc.)
*/
function getLanguageCodeFromLocale($locale) {
list ($language, $country) = explode('_', $locale . '_' );
/* Don't apply default to Chinese for political correctness */
if ($language == 'zh') {
return array(null, $locale);
}
list ($value, $defaultCountries) = $this->getLanguageData();
if (!isset($defaultCountries[$language])) {
return array(GalleryCoreApi::error(ERROR_BAD_PARAMETER, __FILE__, __LINE__,
"No default country defined for \"$locale\"."), null);
}
return array(null, ($country == $defaultCountries[$language]) ? $language : $locale);
}
/**
* Determine the language and country given the language code (i.e. en, en_GB)
* @param string $langCode The language code to be converted.
* @return array GalleryStatus a status code
* string language
* string country
*/
function getLanguageAndCountryFromLanguageCode($langCode) {
list ($language, $country) = explode('_', $langCode . '_');
if (empty($country)) {
list ($value, $defaultCountries) = $this->getLanguageData();
if (!isset($defaultCountries[$language])) {
return array(GalleryCoreApi::error(ERROR_BAD_PARAMETER, __FILE__, __LINE__,
"No default country defined for \"$langCode\"."), null, null);
}
$country = $defaultCountries[$language];
}
return array(null, $language, $country);
}
}
?>
|
||||||||||||||||||||||||||||
|
Install 0% complete WelcomeGetting Gallery 2 installed on your webserver requires 11 steps. This installer will guide you through these steps and provide assistance along the way if additional steps are required to get your Gallery up and running. Once a step has been completed, you can go back and make changes at any time. Please read the Installer Help File before proceeding. |
|||||||||||||||||||||||||||