/** * Try to autoload class definitions before failing. * This makes the Campsite class definition file inclusion optional. * * @param string $p_className */ function __autoload($p_className) { global $ADMIN, $ADMIN_DIR; require_once $GLOBALS['g_campsiteDir'] . '/classes/CampPlugin.php'; static $classDirectories = array('classes', 'classes/Extension', 'template_engine/classes', 'template_engine/metaclasses'); if (!is_string($p_className)) { return; } foreach ($classDirectories as $dirName) { $fileName = $GLOBALS['g_campsiteDir'] . "/{$dirName}/{$p_className}.php"; if (file_exists($fileName)) { require_once $fileName; return; } } $basePaths = array(); foreach (CampPlugin::GetEnabled() as $CampPlugin) { $basePaths[] = $CampPlugin->getBasePath(); } foreach ($basePaths as $basePath) { foreach ($classDirectories as $dirName) { $fileName = $GLOBALS['g_campsiteDir'] . "/{$basePath}/{$dirName}/{$p_className}.php"; if (file_exists($fileName)) { require_once $fileName; return; } } } }
function camp_get_permission_list() { $content_group = array('ManagePub' => getGS('User may add/change publications'), 'DeletePub' => getGS('User may delete publications'), 'ManageIssue' => getGS('User may add/change issues'), 'DeleteIssue' => getGS('User may delete issues'), 'ManageSection' => getGS('User may add/change sections'), 'DeleteSection' => getGS('User may delete sections'), 'AddArticle' => getGS('User may add articles'), 'ChangeArticle' => getGS('User may change articles'), 'MoveArticle' => getGS('User may move articles'), 'TranslateArticle' => getGS('User may translate articles'), 'AttachImageToArticle' => getGS('User may attach images to articles'), 'AttachTopicToArticle' => getGS('User may attach topics to articles'), 'Publish' => getGS('User may publish articles'), 'DeleteArticle' => getGS('User may delete articles'), 'AddImage' => getGS('User may add images'), 'ChangeImage' => getGS('User may change images'), 'DeleteImage' => getGS('User may delete images'), 'AddFile' => getGS('User may add article attachments'), 'ChangeFile' => getGS('User may change article attachments'), 'DeleteFile' => getGS('User may delete article attachments'), 'ManageTopics' => getGS('User may manage topics'), 'CommentModerate' => getGS('User may moderate comments'), 'CommentEnable' => getGS('User may enable comments')); $templates_group = array('ManageTempl' => getGS('User may manage templates'), 'DeleteTempl' => getGS('User may delete templates')); $administrative_group = array('ChangeSystemPreferences' => getGS('User may change system preferences'), 'ClearCache' => getGS('User may clear up the system cache'), 'ManageBackup' => getGS('User may backup and restore the site data')); $users_group = array('ManageUsers' => getGS('User may add/change staff accounts and passwords'), 'DeleteUsers' => getGS('User may delete staff accounts'), 'ManageReaders' => getGS('User may add/change subscribers accounts and passwords'), 'ManageSubscriptions' => getGS('User may manage user subscriptions'), 'ManageUserTypes' => getGS('User may manage account types'), 'EditAuthors' => getGS('User may change authors')); $article_types_group = array('ManageArticleTypes' => getGS('User may add/change article types'), 'DeleteArticleTypes' => getGS('User may delete article types')); $languages_group = array('ManageLanguages' => getGS('User may add languages and manage language information'), 'DeleteLanguages' => getGS('User may delete languages')); $countries_group = array('ManageCountries' => getGS('User may add/change country entries'), 'DeleteCountries' => getGS('User may delete country entries')); $misc_group = array('ViewLogs' => getGS('User may view audit logs'), 'MailNotify' => getGS('User will be notified on several events')); $localizer_group = array('ManageLocalizer' => getGS('User may manage localizer')); $editor_group_1 = array('EditorBold' => getGS('User may use bold'), 'EditorItalic' => getGS('User may use italic'), 'EditorUnderline' => getGS('User may use underline'), 'EditorStrikethrough' => getGS('User may use strikethrough'), 'EditorTextAlignment' => getGS('User may change text alignment'), 'EditorCopyCutPaste' => getGS('User may copy, cut, and paste'), 'EditorUndoRedo' => getGS('User may undo/redo'), 'EditorFindReplace' => getGS('User may find and replace'), 'EditorCharacterMap' => getGS('User may add special characters'), 'EditorTextDirection' => getGS('User may change text direction'), 'EditorIndent' => getGS('User may set indents'), 'EditorLink' => getGS('User may add links'), 'EditorSubhead' => getGS('User may add subheads'), 'EditorImage' => getGS('User may insert images'), 'EditorSourceView' => getGS('User may view the HTML source'), 'EditorEnlarge' => getGS('User may enlarge the editor'), 'EditorStatusBar' => getGS('User may use the editor status bar')); $editor_group_2 = array('EditorFontFace' => getGS('User may change the font face'), 'EditorFontSize' => getGS('User may change the font size'), 'EditorListBullet' => getGS('User may create bulleted lists'), 'EditorListNumber' => getGS('User may create numbered lists')); $editor_group_3 = array('EditorTable' => getGS('User may insert tables')); $editor_group_4 = array('EditorHorizontalRule' => getGS('User may insert horizontal rules'), 'EditorFontColor' => getGS('User may change the font color'), 'EditorSuperscript' => getGS('User may use superscripts'), 'EditorSubscript' => getGS('User may use subscripts'), 'EditorSpellcheckerEnabled' => getGS('Enable Firefox spell checking by default')); $rights = array(getGS('Content') => $content_group, getGS('Templates') => $templates_group, getGS('Staff/Subscribers Management') => $users_group, getGS('Administrative tasks') => $administrative_group, getGS('Article Types') => $article_types_group, getGS('Languages') => $languages_group, getGS('Countries') => $countries_group, getGS('Miscellaneous') => $misc_group, getGS('Localizer') => $localizer_group, getGS('Editor Basic Settings') => $editor_group_1, getGS('Editor Advanced Font Settings') => $editor_group_2, getGS('Editor Table Settings') => $editor_group_3, getGS('Editor Miscellaneous Settings') => $editor_group_4); // plugins: extend permission list $rights[getGS('Plugins')] = array('plugin_manager' => 'User may manage Plugins'); foreach (CampPlugin::GetPluginsInfo(true) as $info) { foreach ($info['permissions'] as $permission => $label) { $rights[$info['label']][$permission] = getGS($label); } } return $rights; }
/** * Get plugins plugins dir * * @return array */ private static function getPluginsPluginsDir() { $dirs = array(); foreach (CampPlugin::GetEnabled() as $CampPlugin) { $dirs[] = CS_PATH_SITE . "/{$CampPlugin->getBasePath()}/smarty_camp_plugins"; } return $dirs; }
/** * Loads the captcha handler specified by the given name. * @param $p_handler * @return object */ public static function factory($p_handler) { $pluginName = strtolower($p_handler); $path = WWW_DIR . '/plugins/' . $pluginName . '/classes'; $filePath = "{$path}/Captcha_{$p_handler}.php"; if (!file_exists($filePath)) { throw new InvalidCaptchaHandler($p_handler); } // check whether the plugin exists and is enabled $plugin = new CampPlugin($pluginName); if (!$plugin->exists() || !$plugin->isEnabled()) { return NULL; } require_once $filePath; $className = "Captcha_{$p_handler}"; if (!class_exists($className)) { throw new InvalidCaptchaHandler($p_handler); } $captchaObj = new $className(); return $captchaObj; }
/** * Legacy admin bootstrap */ protected function _initNewscoop() { global $ADMIN_DIR, $ADMIN, $g_user, $prefix, $Campsite; defined('WWW_DIR') || define('WWW_DIR', realpath(APPLICATION_PATH . '/../')); defined('LIBS_DIR') || define('LIBS_DIR', WWW_DIR . '/admin-files/libs'); $GLOBALS['g_campsiteDir'] = WWW_DIR; require_once $GLOBALS['g_campsiteDir'] . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'campsite_constants.php'; require_once CS_PATH_CONFIG . DIR_SEP . 'install_conf.php'; // goes to install process if configuration files does not exist yet if (!file_exists(CS_PATH_CONFIG . DIR_SEP . 'configuration.php') || !file_exists(CS_PATH_CONFIG . DIR_SEP . 'database_conf.php')) { header('Location: ' . $Campsite['SUBDIR'] . '/install/'); exit; } require_once CS_PATH_CONFIG . DIR_SEP . 'database_conf.php'; require_once CS_PATH_SITE . DIR_SEP . 'include' . DIR_SEP . 'campsite_init.php'; require_once CS_PATH_SITE . DIR_SEP . 'classes' . DIR_SEP . 'CampTemplateCache.php'; // detect extended login/logout files $prefix = file_exists(CS_PATH_SITE . DIR_SEP . 'admin-files' . DIR_SEP . 'ext_login.php') ? '/ext_' : '/'; require_once CS_PATH_SITE . DIR_SEP . $ADMIN_DIR . DIR_SEP . 'camp_html.php'; require_once CS_PATH_CLASSES . DIR_SEP . 'SecurityToken.php'; // load if possible before setting camp_report_bug error handler // to prevent error messages include_once 'HTML/QuickForm.php'; include_once 'HTML/QuickForm/RuleRegistry.php'; include_once 'HTML/QuickForm/group.php'; if (!defined('IN_PHPUNIT') && !getenv('PLZSTOPTHISERRORHANDLERBIZNIS')) { set_error_handler(function ($p_number, $p_string, $p_file, $p_line) { if (($p_number & error_reporting()) === 0) { return; // respect php settings } global $ADMIN_DIR, $Campsite; require_once $Campsite['HTML_DIR'] . "/{$ADMIN_DIR}/bugreporter/bug_handler_main.php"; camp_bug_handler_main($p_number, $p_string, $p_file, $p_line); }, E_ALL); } camp_load_translation_strings("api"); $plugins = CampPlugin::GetEnabled(true); foreach ($plugins as $plugin) { camp_load_translation_strings("plugin_" . $plugin->getName()); } // Load common translation strings camp_load_translation_strings('globals'); require_once APPLICATION_PATH . "/../{$ADMIN_DIR}/init_content.php"; if (file_exists($Campsite['HTML_DIR'] . '/reset_cache')) { CampCache::singleton()->clear('user'); unlink($GLOBALS['g_campsiteDir'] . '/reset_cache'); } }
/** * Add registered plugins paths to include path */ public function dispatchLoopStartup() { $includePaths = array('classes', 'template_engine/classes', 'template_engine/metaclasses'); // add plugins to path foreach (CampPlugin::GetPluginsInfo(true) as $info) { $name = $info['name']; foreach ($includePaths as $path) { $includePath = APPLICATION_PATH . "/../plugins/{$name}/{$path}"; $realpath = realpath($includePath); if ($realpath) { set_include_path(implode(PATH_SEPARATOR, array(get_include_path(), $realpath))); } } } }
private function __construct() { parent::Smarty(); $config = CampSite::GetConfigInstance(); $this->debugging = $config->getSetting('smarty.debugging'); $this->force_compile = $config->getSetting('smarty.force_compile'); $this->compile_check = $config->getSetting('smarty.compile_check'); $this->use_sub_dirs = $config->getSetting('smarty.use_subdirs'); // cache settings $cacheHandler = SystemPref::Get('TemplateCacheHandler'); if ($cacheHandler) { $this->caching = 1; $this->cache_handler_func = "TemplateCacheHandler_$cacheHandler::handler"; require_once CS_PATH_SITE.DIR_SEP.'classes'.DIR_SEP.'cache'.DIR_SEP."TemplateCacheHandler_$cacheHandler.php"; } else { $this->caching = 0; } // define dynamic uncached block require_once CS_PATH_SMARTY.DIR_SEP.'campsite_plugins/block.dynamic.php'; $this->register_block('dynamic', 'smarty_block_dynamic', false); // define render function require_once CS_PATH_SMARTY.DIR_SEP.'campsite_plugins/function.render.php'; $this->register_function('render', 'smarty_function_render', false); $this->left_delimiter = $config->getSetting('smarty.left_delimeter'); $this->right_delimiter = $config->getSetting('smarty.right_delimeter'); $this->cache_dir = CS_PATH_SITE.DIR_SEP.'cache'; $this->config_dir = CS_PATH_SMARTY.DIR_SEP.'configs'; $plugin_smarty_camp_plugin_paths = array(); foreach (CampPlugin::GetEnabled() as $CampPlugin) { $plugin_smarty_camp_plugin_paths[] = CS_PATH_SITE.DIR_SEP.$CampPlugin->getBasePath().DIR_SEP.'smarty_camp_plugins'; } $this->plugins_dir = array_merge(array(CS_PATH_SMARTY.DIR_SEP.'campsite_plugins', CS_PATH_SMARTY.DIR_SEP.'plugins'), $plugin_smarty_camp_plugin_paths); $this->template_dir = CS_PATH_TEMPLATES; $this->compile_dir = CS_PATH_SITE.DIR_SEP.'templates_cache'; } // fn __constructor
/** * Forward to legacy controller if controller/action not found */ public function preDispatch() { $errors = $this->_getParam('error_handler'); if (!$errors) { return; } $request = $this->getRequest(); $adminControllerFile = __DIR__ . '/../..' . str_replace('/admin', '/admin-files', $request->getPathInfo()); if (file_exists($adminControllerFile)) { $this->_forward('index', 'legacy', 'admin', array()); return; } foreach (\CampPlugin::GetEnabled() as $CampPlugin) { $adminControllerFile = dirname(APPLICATION_PATH) . '/' . $CampPlugin->getBasePath() . str_replace('/admin', '/admin-files', $request->getPathInfo()); if (file_exists($adminControllerFile)) { $this->_forward('index', 'legacy', 'admin', array()); return; } } }
<!-- BEGIN Multi date table --> <?php if ($hasMultiDates) { echo ' <script type="text/javascript"> window.has_multidates = true; </script>'; require 'edit_multidate_box.php'; } ?> <!-- END Multi date table --> <?php CampPlugin::adminHook(__FILE__, array('articleObj' => $articleObj, 'f_edit_mode' => $f_edit_mode)); ?> </div> <script type="text/javascript"> $(document).ready(function() { $('.sidebar .articlebox').each(function() { var box = $(this); var title = box.attr('title'); // main classes box.addClass('ui-widget-content small-block block-shadow'); // wrap content $('> *', box).wrapAll('<div class="padded clearfix" />');
/** * Creates a form for translation. * @param array $p_request */ function translationForm($p_request) { global $g_localizerConfig; $localizerTargetLanguage = camp_session_get('localizer_target_language', $g_localizerConfig['DEFAULT_LANGUAGE']); $localizerSourceLanguage = camp_session_get('localizer_source_language', ''); if (empty($localizerSourceLanguage)) { if (isset($p_request['TOL_Language'])) { $lang = $p_request['TOL_Language']; } else { $lang = $g_localizerConfig['DEFAULT_LANGUAGE']; } $tmpLanguage = new LocalizerLanguage(null, $lang); $localizerSourceLanguage = $tmpLanguage->getLanguageId(); } $prefix = camp_session_get('prefix', ''); $screenDropDownSelection = $prefix; // Load the language files. //echo "Prefix: $prefix<br>"; $sourceLang = new LocalizerLanguage($prefix, $localizerSourceLanguage); $targetLang = new LocalizerLanguage($prefix, $localizerTargetLanguage); $defaultLang = new LocalizerLanguage($prefix, $g_localizerConfig['DEFAULT_LANGUAGE']); $mode = Localizer::GetMode(); if (!empty($prefix)) { // If the language files do not exist, create them. if (!$defaultLang->loadFile($mode)) { $defaultLang->saveFile($mode); } if (!$sourceLang->loadFile($mode)) { $sourceLang->saveFile($mode); } if (!$targetLang->loadFile($mode)) { $targetLang->saveFile($mode); } // Make sure that the languages have the same strings and are in the same // order as the default language file. $modified = $sourceLang->syncToDefault(); if ($modified) { $sourceSaveSuccess = $sourceLang->saveFile($mode); camp_html_add_msg($sourceSaveSuccess); } $modified = $targetLang->syncToDefault(); if ($modified) { $targetSaveSuccess = $targetLang->saveFile($mode); camp_html_add_msg($targetSaveSuccess); } } $defaultStrings = $defaultLang->getTranslationTable(); $searchString = camp_session_get('search_string', ''); if (!empty($searchString)) { $sourceStrings = $sourceLang->search($searchString); } else { $sourceStrings = $sourceLang->getTranslationTable(); } $targetStrings = $targetLang->getTranslationTable(); $languages = Localizer::GetAllLanguages($mode); $missingStrings = Localizer::FindMissingStrings($prefix); $unusedStrings = Localizer::FindUnusedStrings($prefix); // Mapping of language prefixes to human-readable strings. $mapPrefixToDisplay = array(); $mapPrefixToDisplay[] = ""; $mapPrefixToDisplay["globals"] = getGS("Globals"); $mapPrefixToDisplay["home"] = getGS("Dashboard"); $mapPrefixToDisplay["api"] = getGS("API"); $mapPrefixToDisplay["library"] = getGS("Libraries"); $mapPrefixToDisplay["pub"] = getGS("Publications"); $mapPrefixToDisplay["issues"] = getGS("Issues"); $mapPrefixToDisplay["sections"] = getGS("Sections"); $mapPrefixToDisplay["articles"] = getGS("Articles"); $mapPrefixToDisplay["article_images"] = getGS("Article Images"); $mapPrefixToDisplay["article_files"] = getGS("Article Files"); $mapPrefixToDisplay["article_topics"] = getGS("Article Topics"); $mapPrefixToDisplay["article_comments"] = getGS("Article Comments"); $mapPrefixToDisplay["media_archive"] = getGS("Media Archive"); $mapPrefixToDisplay["geolocation"] = getGS("Geo-location"); $mapPrefixToDisplay["comments"] = getGS("Comments"); $mapPrefixToDisplay["system_pref"] = getGS("System Preferences"); $mapPrefixToDisplay["templates"] = getGS("Templates"); $mapPrefixToDisplay["article_types"] = getGS("Article Types"); $mapPrefixToDisplay["article_type_fields"] = getGS("Article Type Fields"); $mapPrefixToDisplay["topics"] = getGS("Topics"); $mapPrefixToDisplay["languages"] = getGS("Languages"); $mapPrefixToDisplay["country"] = getGS("Countries"); $mapPrefixToDisplay["localizer"] = getGS("Localizer"); $mapPrefixToDisplay["logs"] = getGS("Logs"); $mapPrefixToDisplay["users"] = getGS("Users"); $mapPrefixToDisplay["user_subscriptions"] = getGS("User Subscriptions"); $mapPrefixToDisplay["user_subscription_sections"] = getGS("User Subscriptions Sections"); $mapPrefixToDisplay["user_types"] = getGS("Staff User Types"); $mapPrefixToDisplay["bug_reporting"] = getGS("Bug Reporting"); $mapPrefixToDisplay["feedback"] = getGS("Feedback"); $mapPrefixToDisplay["preview"] = getGS("Preview Window"); $mapPrefixToDisplay["tiny_media_plugin"] = getGS("Editor Media Plugin"); $mapPrefixToDisplay["plugins"] = getGS("Plugins"); $mapPrefixToDisplay["extensions"] = getGS("Extensions"); $mapPrefixToDisplay["authors"] = getGS("Authors"); foreach (CampPlugin::GetPluginsInfo(true) as $info) { if (array_key_exists('localizer', $info) && is_array($info['localizer'])) { $mapPrefixToDisplay[$info['localizer']['id']] = getGS($info['localizer']['screen_name']); } } // Whether to show translated strings or not. $hideTranslated = camp_session_get('hide_translated', 'off'); camp_html_display_msgs(); ?> <table> <tr> <td valign="top"> <!-- Begin top control panel --> <form action="index.php" method="post"> <?php echo SecurityToken::FormParameter(); ?> <input type="hidden" name="localizer_lang_id" value="<?php echo $targetLang->getLanguageId(); ?>"> <input type="hidden" name="search_string" value="<?php echo htmlspecialchars($searchString); ?>"> <table border="0" cellpadding="0" cellspacing="0" class="box_table"> <tr> <td> <table> <tr> <td> <?php putGS('Area to localize'); ?>: </td> </tr> <tr> <td> <SELECT name="prefix" class="input_select" onchange="this.form.submit();"> <?PHP foreach ($mapPrefixToDisplay as $prefix => $displayStr) { if (!empty($prefix)) { $transl_status[$prefix] = Localizer::GetTranslationStatus($prefix, $localizerTargetLanguage); } camp_html_select_option($prefix, $screenDropDownSelection, $displayStr, $transl_status[$prefix]['untranslated'] ? array('style' => 'color:red') : array()); } ?> </SELECT> </td> </tr> </table> </td> <td> <table> <tr> <td> <?php putGS('Translate from:'); ?> </td> </tr> <tr> <td> <SELECT NAME="localizer_source_language" onchange="this.form.submit();" class="input_select"> <?php echo LanguageMenu($languages, $localizerSourceLanguage); ?> </select> </td> </tr> </table> </td> <td> <table> <tr> <td> <?php putGS('Translate to:'); ?> </td> </tr> <tr> <td> <SELECT NAME="localizer_target_language" onChange="this.form.submit();" class="input_select"> <?php echo LanguageMenu($languages, $localizerTargetLanguage); ?> </select> </td> </tr> </table> </td> <td> <table> <tr> <td> <?php putGS('Translation status:'); ?> </td> </tr> <tr> <td> <?php if ($screenDropDownSelection) { $all = $transl_status[$screenDropDownSelection]['all']; $transl = $transl_status[$screenDropDownSelection]['translated']; $untransl = $transl_status[$screenDropDownSelection]['untranslated']; } else { foreach ($transl_status as $screen) { $all += $screen['all']; $transl += $screen['translated']; $untransl += $screen['untranslated']; } } if ($all) { putGS("$1 of $2 strings translated", $transl, $all); echo '<br>'.round(100 - 100 / $all * $untransl, 2) . ' %'; } else { echo 'N/A'; } ?> </td> </tr> </table> </td> </tr> <tr> <td align="center" colspan="4"> <table> <tr> <td> <select name="hide_translated" onChange="this.form.submit();" class="input_select"> <?php camp_html_select_option('off', $hideTranslated, getGS('Show translated strings')); ?> <?php camp_html_select_option('on', $hideTranslated, getGS('Hide translated strings')); ?> </select> </td> <td style="padding-left: 10px;"> <INPUT type="submit" value="<?php putGS("Submit"); ?>" class="button"> </td> </tr> </table> </td> </tr> </table> </form> </td><!-- End top controls --> </tr> <!-- Begin search dialog --> <tr> <td valign="top"> <form> <input type="hidden" name="prefix" value="<?php echo $screenDropDownSelection; ?>"> <input type="hidden" name="localizer_source_language" value="<?php echo $sourceLang->getLanguageId(); ?>"> <input type="hidden" name="localizer_target_language" value="<?php echo $targetLang->getLanguageId(); ?>"> <table border="0" cellspacing="0" cellpadding="0" class="box_table"> <tr> <td width="1%" style="padding-left: 5px;"> <img src="<?php echo $g_localizerConfig['ICONS_DIR']; ?>/preview.png"> </td> <td style="padding-left: 10px;"> <input type="text" name="search_string" value="<?php echo $searchString; ?>" class="input_text" size="50"> </td> <td width="1%" nowrap> <input type="button" value="<?php putGS("Search"); ?>" onclick="this.form.submit();" class="button"> </td> </tr> </table> </form> </td> </tr> <!-- Begin Missing and Unused Strings popups --> <tr> <td valign="top"> <?PHP if ((count($missingStrings) > 0) && ($screenDropDownSelection != 'globals')) { ?> <form action="do_add_missing_strings.php" method="post"> <?php echo SecurityToken::FormParameter(); ?> <input type="hidden" name="prefix" value="<?php echo $screenDropDownSelection; ?>"> <input type="hidden" name="localizer_source_language" value="<?php echo $sourceLang->getLanguageId(); ?>"> <input type="hidden" name="localizer_target_language" value="<?php echo $targetLang->getLanguageId(); ?>"> <table border="0" cellspacing="0" cellpadding="0" class="box_table"> <tr> <td> <img src="<?php echo $g_localizerConfig['ICONS_DIR']; ?>/add.png"> </td> <td> <?php putGS("The following strings are missing from the translation files:"); ?> <div style="overflow: auto; height: 50px; background-color: #EEEEEE; border: 1px solid black; padding-left: 3px;"> <?PHP foreach ($missingStrings as $missingString) { echo htmlspecialchars($missingString)."<br>"; } ?> </div> </td> <td> <input type="submit" value="<?php putGS("Add"); ?>" class="button"> </td> </tr> </table> </form> <?php } if ((count($unusedStrings) > 0) && ($screenDropDownSelection != 'globals')) { ?> <form action="do_delete_unused_strings.php" method="post"> <?php echo SecurityToken::FormParameter(); ?> <input type="hidden" name="prefix" value="<?php echo $screenDropDownSelection; ?>"> <input type="hidden" name="localizer_source_language" value="<?php echo $sourceLang->getLanguageId(); ?>"> <input type="hidden" name="localizer_target_language" value="<?php echo $targetLang->getLanguageId(); ?>"> <table border="0" cellspacing="0" cellpadding="0" class="box_table"> <tr> <td> <img src="<?php echo $g_localizerConfig['ICONS_DIR']; ?>/delete.png"> </td> <td> <?php putGS("The following strings are not used:"); ?> <div style="overflow: auto; height: 50px; background-color: #EEEEEE; border: 1px solid black; padding-left: 3px;"> <?PHP foreach ($unusedStrings as $unusedString) { echo htmlspecialchars($unusedString)."<br>"; } ?> </div> </td> <td> <input type="submit" value="<?php putGS("Delete"); ?>" class="button"> </td> </tr> </table> </form> <?php } ?> <!-- Begin translated strings box --> <form action="do_save.php" method="post"> <?php echo SecurityToken::FormParameter(); ?> <INPUT TYPE="hidden" name="prefix" value="<?php echo $screenDropDownSelection; ?>"> <INPUT TYPE="hidden" name="localizer_target_language" value="<?php echo $targetLang->getLanguageId(); ?>"> <INPUT TYPE="hidden" name="localizer_source_language" value="<?php echo $sourceLang->getLanguageId(); ?>"> <INPUT TYPE="hidden" name="search_string" value="<?php echo $searchString; ?>"> <table border="0" cellpadding="0" cellspacing="0" class="box_table"> <?PHP $foundUntranslatedString = false; $count = 0; foreach ($sourceStrings as $sourceKey => $sourceValue) { if (!empty($targetStrings[$sourceKey])) { $targetValueDisplay = str_replace('"', '"', $targetStrings[$sourceKey]); $targetValueDisplay = str_replace("\\", "\\\\", $targetValueDisplay); $pre = ''; $post = ''; } else { $targetValueDisplay = ''; $pre = '<FONT COLOR="red">'; $post = '</FONT>'; } $sourceKeyDisplay = htmlspecialchars(str_replace("\\", "\\\\", $sourceKey)); // Dont display translated strings if ($hideTranslated == 'on' && !empty($targetStrings[$sourceKey])) { ?> <input name="data[<?php echo $count; ?>][key]" type="hidden" value="<?php echo $sourceKeyDisplay; ?>"> <input name="data[<?php echo $count; ?>][value]" type="hidden" value="<?php echo $targetValueDisplay; ?>"> <?php } else { // Display the interface for translating a string. $foundUntranslatedString = true; // Display string ?> <tr> <td style="padding-top: 7px;" width="500px"> <?php // If the string exists in the source language, display that if (!empty($sourceValue)) { ?> <b><?php echo $sourceLang->getLanguageId(); ?>:</b> <?php echo $pre.htmlspecialchars(str_replace("\\", "\\\\", $sourceValue)).$post; ?> <?php } // Otherwise, display it in the default language. else { if (isset($defaultStrings[$sourceKey])) { $defaultValue = $defaultStrings[$sourceKey]; } else { $defaultValue = ''; } ?> <b><?php echo $g_localizerConfig['DEFAULT_LANGUAGE']; ?>:</b> <?php echo $pre.$defaultValue.$post; ?> <?php } ?> </td> </tr> <tr> <td> <input name="data[<?php echo $count; ?>][key]" type="hidden" value="<?php echo $sourceKeyDisplay; ?>"> <table cellpadding="0" cellspacing="0"> <tr> <td style="padding-right: 5px;"> <input type="image" src="<?php echo $g_localizerConfig['ICONS_DIR']; ?>/save.png" name="save" value="save"> </td> <td> <input name="data[<?php echo $count; ?>][value]" type="text" size="<?php echo $g_localizerConfig['INPUT_SIZE']; ?>" value="<?php echo $targetValueDisplay; ?>" class="input_text"> </td> <?php // default language => can change keys if ($targetLang->getLanguageId() == $g_localizerConfig['DEFAULT_LANGUAGE']) { $fileparms = "localizer_target_language=".$targetLang->getLanguageId() ."&localizer_source_language=".$sourceLang->getLanguageId() ."&prefix=".urlencode($screenDropDownSelection) ."&search_string=".urlencode($searchString); if ($count == 0) { // swap last and first entry $prev = count($sourceStrings)-1; $next = $count+1; } elseif ($count == count($sourceStrings)-1) { // swap last and first entry $prev = $count-1; $next = 0; } else { // swap entrys linear $prev = $count-1; $next = $count+1; } $removeLink = "do_delete_string.php?pos=$count&$fileparms" ."&string=".urlencode($sourceKey).'&'.SecurityToken::URLParameter(); $moveUpLink = "do_reorder_string.php?pos1=$count&pos2=$prev&$fileparms&".SecurityToken::URLParameter(); $moveDownLink = "do_reorder_string.php?pos1=$count&pos2=$next&$fileparms&".SecurityToken::URLParameter(); if (empty($searchString)) { ?> <td style="padding-left: 3px;"> <a href="<?php echo $moveUpLink; ?>"><img src="<?php echo $g_localizerConfig['ICONS_DIR']; ?>/up.png" border="0"></a> </td> <td style="padding-left: 3px;"> <a href="<?php echo $moveDownLink; ?>"><img src="<?php echo $g_localizerConfig['ICONS_DIR']; ?>/down.png" border="0"></a> </td> <?php } ?> <td style="padding-left: 3px;"> <a href="<?php echo $removeLink; ?>" onClick="return confirm('<?php putGS('Are you sure you want to delete this entry?'); ?>');"><img src="<?php echo $g_localizerConfig['ICONS_DIR']; ?>/delete.png" border="0" vspace="4"></a> </td> <td style="padding-left: 5px;" nowrap> <SELECT name="change_prefix_<?php echo $count; ?>" class="input_select"> <?PHP foreach ($mapPrefixToDisplay as $prefix => $displayStr) { if ($prefix != $screenDropDownSelection) { camp_html_select_option($prefix, null, $displayStr); } } ?> </SELECT> <input type="button" name="" value="Move" onclick="location.href='do_string_switch_file.php?string=<?php echo urlencode($sourceKey); ?>&new_prefix='+this.form.change_prefix_<?php echo $count; ?>.options[this.form.change_prefix_<?php echo $count; ?>.selectedIndex].value+'&<?php echo $fileparms; ?>&<?php echo SecurityToken::URLParameter(); ?>';" class="button"> </td> <?php } ?> </tr> </table> </td> </tr> <?php } $count++; } if (count($sourceStrings) <= 0) { if (empty($searchString)) { ?> <tr><td align="center" style="padding-top: 10px; font-weight: bold;"><?php putGS("No source strings found.");?> </td></tr> <?php } else { ?> <tr><td align="center" style="padding-top: 10px; font-weight: bold;"><?php putGS("No matches found.");?> </td></tr> <?php } } elseif (!$foundUntranslatedString) { if (empty($searchString)) { ?> <tr><td align="center" style="padding-top: 10px; font-weight: bold;"><?php putGS("All strings have been translated."); ?></td></tr> <?php } else { ?> <tr><td align="center" style="padding-top: 10px; font-weight: bold;"><?php putGS("No matches found.");?> </td></tr> <?php } } ?> </table> <table style="margin-left: 12px; margin-top: 5px;"> <tr> <td> <input type="submit" name="save_button" value="<?php putGS('Save'); ?>" class="button"> </td> </tr> </table> </form> </td> <!-- End translate strings box --> </tr> </table> <?php } // fn translationForm
} ?> </TABLE> </td> <!-- END right column --> <?php } ?> </tr> <?php if (isset($publicationObj)) { ?> <tr> <td colspan="2"> <?php CampPlugin::adminHook(__FILE__, array('publicationObj' => $publicationObj)); ?> </td> </tr> <?php } ?> <TR> <TD COLSPAN="2" align="center" style="padding-left: 8px; padding-right: 8px;"> <table style="border-top: 1px solid black; padding-top: 7px; padding-bottom: 6px; margin-top: 10px;" width="100%"> <tr> <td align="center"> <?php if (isset($publicationObj)) { ?> <INPUT TYPE="HIDDEN" NAME="f_publication_id" VALUE="<?php
<?php } ?> <TR> <TD COLSPAN="2" align="center" style="padding-top: 15px;"> <INPUT TYPE="submit" class="button" NAME="Save" VALUE="<?php putGS('Save'); ?> "> </TD> </TR> </TABLE> </FORM> <P> <?php CampPlugin::adminHook(__FILE__, array('issueObj' => $issueObj)); ?> </td> <td valign="top"> <div class="action_buttons" style="font-size: 10pt; font-weight: bold;"><?php putGS('Issue Publishing Schedule'); ?> </div> <TABLE BORDER="0" CELLSPACING="1" CELLPADDING="3" class="table_list"> <TR class="table_list_header"> <TD ALIGN="LEFT" VALIGN="TOP"><B><?php putGS("Date/Time"); ?> </B></TD> <TD ALIGN="LEFT" VALIGN="TOP"><B><?php
/** * Searches for classes that process actions. Returns an array of * action names. * * @return array */ public static function ReadAvailableActions() { if (is_array(MetaAction::$m_availableActions)) { return MetaAction::$m_availableActions; } if (self::FetchActionsFromCache()) { return self::$m_availableActions; } require_once('File/Find.php'); $actions = array(); $basePaths = array('.'); foreach (CampPlugin::GetEnabled() as $CampPlugin) { $basePaths[] = $CampPlugin->getBasePath(); } foreach ($basePaths as $basePath) { $directoryPath = $GLOBALS['g_campsiteDir'].'/'.$basePath.'/template_engine/metaclasses'; $actionIncludeFiles = File_Find::search('/^MetaAction[^.]*\.php$/', $directoryPath, 'perl', false); foreach ($actionIncludeFiles as $includeFile) { if (preg_match('/MetaAction([^.]+)\.php/', $includeFile, $matches) == 0 || strtolower($matches[1]) == 'request') { continue; } require_once($includeFile); $actionName = $matches[1]; if (class_exists('MetaAction'.$actionName)) { $actions[self::TranslateProperty($actionName)] = array('name'=>$actionName, 'file'=>"$directoryPath/MetaAction$actionName.php"); } } } self::$m_availableActions = $actions; self::StoreActionsInCache(); return self::$m_availableActions; }
// Currently supported types are 'gs' and 'xml'. // You can also set this to the empty string and the code // will do its best to figure out the current type. $g_localizerConfig['DEFAULT_FILE_TYPE'] = 'gs'; // The top-level directory to the set of directories // that need translation files. $g_localizerConfig['BASE_DIR'] = $GLOBALS['g_campsiteDir']; // The top-level directory to the set of directories // that need translation files. $g_localizerConfig['TRANSLATION_DIR'] = $GLOBALS['g_campsiteDir'] . '/admin-files/lang'; // Name of the XML file that contains the list of supported languages. $g_localizerConfig['LANGUAGE_METADATA_FILENAME'] = 'languages.xml'; // File encoding for XML files. $g_localizerConfig['FILE_ENCODING'] = 'UTF-8'; // For the interface - the relative path of the icons directory global $Campsite; $g_localizerConfig['ICONS_DIR'] = $Campsite['ADMIN_IMAGE_BASE_URL']; // The size of the input fields for the admin interface. $g_localizerConfig['INPUT_SIZE'] = 70; // List supported file types, in order of preference. $g_localizerConfig['FILE_TYPES'] = array('xml', 'gs'); $g_localizerConfig['LOADED_FILES'] = array(); // Map of prefixes to directory names. $mapPrefixToDir = array('' => null, 'globals' => null, 'home' => array('/admin-files/', '/application/layouts/scripts', '/application/modules/admin/Bootstrap.php', '/application/modules/admin/views/helpers', '/application/modules/admin/views/scripts'), 'api' => '/classes/*', 'library' => '/admin-files/libs/*', 'pub' => '/admin-files/pub', 'issues' => '/admin-files/issues', 'sections' => '/admin-files/sections', 'articles' => array('/admin-files/articles', '/application/modules/admin/controllers/PlaylistController.php', '/application/modules/admin/controllers/BlogController.php', '/application/modules/admin/controllers/MultidateController.php', '/application/modules/admin/views/scripts/playlist', '/application/modules/admin/views/scripts/blog', '/application/modules/admin/views/scripts/blog'), 'article_images' => array('/admin-files/articles/images', '/application/modules/admin/controllers/ImageController.php', '/application/modules/admin/controllers/SlideshowController.php', '/application/modules/admin/controllers/MediaController.php', '/application/modules/admin/controllers/RenditionController.php', '/application/modules/admin/views/scripts/image', '/application/modules/admin/views/scripts/slideshow', '/application/modules/admin/views/scripts/media', '/application/modules/admin/views/scripts/rendition', '/application/modules/admin/forms/Slideshow.php', '/application/modules/admin/forms/SlideshowCreate.php', '/application/modules/admin/forms/SlideshowItem.php'), 'article_files' => '/admin-files/articles/files', 'article_topics' => '/admin-files/articles/topics', 'article_comments' => '/admin-files/articles/comments', 'media_archive' => '/admin-files/media-archive', 'geolocation' => '/admin-files/articles/locations', 'comments' => array('/admin-files/comments', '/application/modules/admin/views/scripts/comment', '/application/modules/admin/views/scripts/comment-commenter', '/application/modules/admin/views/scripts/comment-acceptance', '/application/modules/admin/views/scripts/feedback', '/application/modules/admin/forms/Ban.php', '/application/modules/admin/forms/Comment.php', '/application/modules/admin/forms/Commenter.php', '/application/modules/admin/forms/CommentAcceptance.php', '/application/modules/admin/forms/Comment', '/application/modules/admin/controllers/CommentController.php', '/application/modules/admin/controllers/CommentAcceptanceController.php', '/application/modules/admin/controllers/CommentCommenterController.php', '/application/modules/admin/controllers/FeedbackController.php'), 'system_pref' => '/admin-files/system_pref', 'themes' => array('/application/modules/admin/views/scripts/themes', '/application/modules/admin/views/scripts/template', '/application/modules/admin/forms/Template.php', '/application/modules/admin/forms/Theme.php', '/application/modules/admin/forms/Theme', '/application/modules/admin/forms/Upload.php', '/application/modules/admin/forms/ReplaceTemplate.php', '/application/modules/admin/controllers/TemplateController.php', '/application/modules/admin/controllers/ThemesController.php'), 'article_types' => '/admin-files/article_types', 'article_type_fields' => '/admin-files/article_types/fields', 'topics' => '/admin-files/topics', 'languages' => array('/admin-files/languages', '/application/modules/admin/controllers/LanguagesController.php', '/application/modules/admin/views/scripts/languages', '/application/modules/admin/forms/Language.php'), 'country' => '/admin-files/country', 'localizer' => '/admin-files/localizer', 'logs' => array('/admin-files/logs', '/application/modules/admin/controllers/LogController.php', '/application/modules/admin/views/scripts/log'), 'users' => array('/admin-files/users', '/application/modules/admin/controllers/UserController.php', '/application/modules/admin/controllers/AuthController.php', '/application/modules/admin/views/scripts/user', '/application/modules/admin/views/scripts/auth', '/application/modules/admin/forms/User.php', '/application/modules/admin/forms/Profile.php'), 'user_subscriptions' => array('/admin-files/users/subscriptions', '/application/modules/admin/controllers/SubscriptionController.php', '/application/modules/admin/controllers/SubscriberController.php', '/application/modules/admin/controllers/SubscriptionIpController.php', '/application/modules/admin/views/scripts/subscription', '/application/modules/admin/views/scripts/subscriber', '/application/modules/admin/views/scripts/subscription-ip', '/application/modules/admin/forms/Subscriber.php', '/application/modules/admin/forms/Subscription.php'), 'user_subscription_sections' => array('/admin-files/users/subscriptions/sections', '/application/modules/admin/controllers/SubscriptionSectionController.php', '/application/modules/admin/views/scripts/subscription-section', '/application/modules/admin/forms/Subscription'), 'user_types' => array('/admin-files/user_types', '/application/modules/admin/controllers/UserGroupController.php', '/application/modules/admin/controllers/AclController.php', '/application/modules/admin/views/scripts/user-group', '/application/modules/admin/views/scripts/acl', '/application/controllers/helpers/Acl.php', '/application/plugins/Acl.php'), 'bug_reporting' => array('/admin-files/bugreporter', '/application/controllers/ErrorController.php', '/application/views/scripts/error'), 'feedback' => '/admin-files/feedback', 'preview' => '/template_engine/classes', 'tiny_media_plugin' => '/js/tinymce/plugins/campsitemedia', 'plugins' => '/admin-files/plugins', 'extensions' => '/extensions/*', 'authors' => '/admin-files/users/authors_ajax', 'help' => array('/application/modules/admin/controllers/ApplicationController.php', '/application/modules/admin/views/scripts/application'), 'support' => array('/application/modules/admin/controllers/SupportController.php', '/application/modules/admin/views/scripts/support')); foreach (CampPlugin::GetPluginsInfo(true) as $info) { if (array_key_exists('localizer', $info) && is_array($info['localizer'])) { $mapPrefixToDir[$info['localizer']['id']] = $info['localizer']['path']; } } $g_localizerConfig['MAP_PREFIX_TO_DIR'] = $mapPrefixToDir; unset($mapPrefixToDir);
?> <INPUT TYPE="hidden" NAME="cSectionTplId" VALUE="<?php echo $issueHasTheme ? $tplSectionPathSafe : '0'; ?> "/> <INPUT TYPE="hidden" NAME="cArticleTplId" VALUE="<?php echo $issueHasTheme ? $tplArticlePathSafe : '0'; ?> "/> <?php } ?> <tr> <td colspan="2"> <?php CampPlugin::adminHook(__FILE__, array('sectionObj' => $sectionObj)); ?> </td> </tr> <tr> <td colspan="2" align="center"> <input type="hidden" name="Pub" value="<?php p($Pub); ?> " /> <input type="hidden" name="Issue" value="<?php p($Issue); ?> " /> <input type="hidden" name="Language" value="<?php p($Language);
/** * Updates plugins if needed * @return void */ public static function OnUpgrade() { $plugins = self::GetNeedsUpdate(); if (!is_array($plugins) || empty($plugins)) { return; // no plugin to update } // update foreach ($plugins as $name => $info) { $CampPlugin = new CampPlugin($name); if (empty($info['current'])) { continue; } $currentVersion = $CampPlugin->getFsVersion(); if ($CampPlugin->getDbVersion() != $currentVersion) { $CampPlugin->delete(); $CampPlugin->create($name, $currentVersion); $CampPlugin->update(); } } }
public function indexAction() { global $controller, $Campsite, $ADMIN_DIR, $ADMIN, $g_user, $g_ado_db, $prefix; $controller = $this; $no_menu_scripts = array($prefix . 'login.php', $prefix . 'logout.php', '/issues/preview.php', '/issues/empty.php', '/ad_popup.php', '/articles/preview.php', '/articles/autopublish.php', '/articles/autopublish_do_add.php', '/articles/images/popup.php', '/articles/images/view.php', '/articles/topics/popup.php', '/articles/files/popup.php', '/articles/empty.php', '/articles/post.php', '/comments/ban.php', '/comments/do_ban.php', '/imagearchive/do_add.php', '/users/authors_ajax/detail.php', '/users/authors_ajax/grid.php', $prefix . 'password_recovery.php', $prefix . 'password_check_token.php', '/articles/locations/popup.php', '/articles/locations/preview.php', '/articles/locations/search.php', '/articles/locations/filter.php', '/articles/context_box/popup.php', '/articles/multidate/popup.php', '/media-archive/edit-attachment.php', '/media-archive/edit.php'); CampPlugin::ExtendNoMenuScripts($no_menu_scripts); $request_uri = $_SERVER['REQUEST_URI']; $call_script = substr($request_uri, strlen("/{$ADMIN}")); // Remove any GET parameters if (($question_mark = strpos($call_script, '?')) !== false) { $call_script = substr($call_script, 0, $question_mark); } // Remove all attempts to get at other parts of the file system $call_script = str_replace('/../', '/', $call_script); $GLOBALS['call_script'] = $call_script; // detect extended login/logout files if ($call_script == '/login.php') { $call_script = $prefix . 'login.php'; } $extension = ''; if (($extension_start = strrpos($call_script, '.')) !== false) { $extension = strtolower(substr($call_script, $extension_start)); } if ($extension == '.php' || $extension == '') { // If its not a PHP file, assume its a directory. if ($extension != '.php') { // If its a directory if ($call_script != '' && $call_script[strlen($call_script) - 1] != '/') { $call_script .= '/'; } $call_script .= 'index.php'; } $this->view->legacy = true; $needs_menu = !(in_array($call_script, $no_menu_scripts) || Input::Get('p_no_menu', 'boolean', false, true)); if (!$needs_menu) { $this->_helper->layout->disableLayout(); } // Verify the file exists $path_name = $Campsite['HTML_DIR'] . "/{$ADMIN_DIR}/{$call_script}"; if (!file_exists($path_name)) { foreach (CampPlugin::GetEnabled() as $CampPlugin) { $plugin_path_name = dirname(APPLICATION_PATH) . '/' . $CampPlugin->getBasePath() . "/{$ADMIN_DIR}/{$call_script}"; if (file_exists($plugin_path_name)) { $path_name = $plugin_path_name; // possible plugin include paths $include_paths = array('/classes', '/template_engine/classes', '/template_engine/metaclasses'); // set include paths for plugin foreach ($include_paths as $path) { $path = dirname(APPLICATION_PATH) . '/' . $CampPlugin->getBasePath() . $path; if (file_exists($path)) { set_include_path(implode(PATH_SEPARATOR, array(realpath($path), get_include_path()))); } } break; } } if (!file_exists($path_name)) { header("HTTP/1.1 404 Not found"); echo '<html><head><title>404 Not Found</title></head><body>'; echo '<h1>Not Found</h1>'; echo '<p>The requested URL ', $_SERVER['REQUEST_URI'], ' was not found on this server.</p>'; echo '</body></html>'; exit; } } // render view require_once $path_name; return; } elseif (file_exists($Campsite['HTML_DIR'] . "/{$ADMIN_DIR}/{$call_script}")) { readfile($Campsite['HTML_DIR'] . "/{$ADMIN_DIR}/{$call_script}"); exit; } header("HTTP/1.1 404 Not found"); exit; }
if ($g_user->hasPermission('SyncPhorumUsers')) { $menu_item =& DynMenuItem::Create(getGS('Synchronize Newscoop and Phorum users'), "/$ADMIN/home.php?sync_users=yes", array('icon' => '')); $menu_users->addItem($menu_item); } if ($g_user->hasPermission('EditAuthors')) { $menu_item =& DynMenuItem::Create(getGS('Authors'), "/$ADMIN/users/authors.php?Back=".urlencode($_SERVER['REQUEST_URI']), array('icon' => '')); $menu_users->addItem($menu_item); } } // Creates the Plugins menu $menu_plugins = CampPlugin::CreatePluginMenu(); // Page title $siteTitle = (!empty($Campsite['site']['title'])) ? htmlspecialchars($Campsite['site']['title']) : putGS("Newscoop") . $Campsite['VERSION']; // locale setting for datepicker $locale = !empty($_COOKIE['TOL_Language']) ? $_COOKIE['TOL_Language'] : 'en'; ?> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Expires" content="now" /> <title><?php p($siteTitle); ?></title> <script type="text/javascript"><!-- var website_url = "<?php echo $Campsite['WEBSITE_URL'];?>";
SystemPref::Set("UseDBReplication", 'N'); } // template filter SystemPref::Set("TemplateFilter", $f_template_filter); // External cron management SystemPref::Set('ExternalCronManagement', $f_external_cron_management); // geolocation foreach ($f_geo as $key => $value) { $name = ''; foreach (explode('_', $key) as $part) { $name .= ucfirst($part); } SystemPref::Set($name, $value); } $logtext = getGS('System preferences updated'); Log::Message($logtext, $g_user->getUserId(), 171); // Success message if everything was ok if ($msg_ok == 1) { camp_html_add_msg(getGS("System preferences updated."), "ok"); } CampPlugin::PluginAdminHooks(__FILE__); camp_html_goto_page("/$ADMIN/system_pref/"); ?>
/** * Get plugins plugins dir. * * @return array */ public static function getPluginsPluginsDir() { $pluginsManager = \Zend_Registry::get('container')->getService('newscoop.plugins.manager'); $availablePlugins = $pluginsManager->getInstalledPlugins(); $dirs = array(); foreach ($availablePlugins as $plugin) { $pluginPath = explode('\\', $plugin); $directoryPath = realpath(__DIR__ . '/../../plugins/' . $pluginPath[0] . '/' . $pluginPath[1] . '/Resources/smartyPlugins'); if ($directoryPath) { $dirs[] = $directoryPath; } } //legacy plugins foreach (CampPlugin::GetEnabled() as $CampPlugin) { $dirs[] = CS_PATH_SITE . "/{$CampPlugin->getBasePath()}/smarty_camp_plugins"; } //comunity ticker $dirs[] = __DIR__ . '/../../src/Newscoop/CommunityTickerBundle/Resources/smartyPlugins'; return $dirs; }
private static function InstallPlugins() { require_once($GLOBALS['g_campsiteDir'].'/include/campsite_constants.php'); require_once(dirname(dirname(dirname(__FILE__))) . DIR_SEP . 'db_connect.php'); require_once(CS_PATH_CONFIG.DIR_SEP.'liveuser_configuration.php'); foreach (CampPlugin::GetPluginsInfo() as $info) { $CampPlugin = new CampPlugin($info['name']); $CampPlugin->create($info['name'], $info['version']); $CampPlugin->install(); if ($CampPlugin->isEnabled()) { $CampPlugin->enable(); } else { $CampPlugin->disable(); } if (function_exists("plugin_{$info['name']}_addPermissions")) { call_user_func("plugin_{$info['name']}_addPermissions"); } } }
/** * Get the default config for all users. * * @return array */ public static function GetDefaultConfig() { global $g_ado_db; static $pluginConfig; // loads rights default config from database $queryStr = 'SELECT right_define_name FROM liveuser_rights'; $rights = $g_ado_db->GetAll($queryStr); if (!is_array($rights) || sizeof($rights) <= 0) { $rights = array(); } foreach ($rights as $right) { self::$m_defaultConfig[$right['right_define_name']] = 'N'; } if (empty($pluginConfig)) { $pluginConfig = true; foreach (CampPlugin::GetPluginsInfo(true) as $info) { self::$m_defaultConfig += $info['userDefaultConfig']; } } return self::$m_defaultConfig; } // fn GetDefaultConfig
// If its not a PHP file, assume its a directory. if ($extension != '.php') { // If its a directory if (($call_script != '') && ($call_script[strlen($call_script)-1] != '/') ) { $call_script .= '/'; } $call_script .= 'index.php'; } $needs_menu = ! (in_array($call_script, $no_menu_scripts) || Input::Get('p_no_menu', 'boolean', false, true)); // Verify the file exists $path_name = $Campsite['HTML_DIR'] . "/$ADMIN_DIR/$call_script"; if (!file_exists($path_name)) { foreach (CampPlugin::GetEnabled() as $CampPlugin) { $plugin_path_name = $Campsite['HTML_DIR'].'/'.$CampPlugin->getBasePath()."/$ADMIN_DIR/$call_script"; if (file_exists($plugin_path_name)) { $path_name = $plugin_path_name; break; } } if (!file_exists($path_name)) { header("HTTP/1.1 404 Not found"); exit; } } // Clean up the global namespace before we call the script unset($access); unset($extension);
$converter = new TemplateConverterNewscoop(); if (!empty($template_files)) { foreach ($template_files as $template_file) { $converter->read($template_file); $converter->parse(); $converter->write(); } } // update plugins CampPlugin::OnUpgrade(); CampRequest::SetVar('step', 'finish'); $install = new CampInstallation(); $install->initSession(); $step = $install->execute(); // update plugins environment CampPlugin::OnAfterUpgrade(); CampTemplate::singleton()->clearCache(); // replace javascript by js in .htaccess file $htaccesspath = $g_documentRoot . '/.htaccess'; if (upgrade_htaccess($htaccesspath) == false) { display_upgrade_error('Could not write .htaccess file.<br />Please read the ' . 'UPGRADE.txt file in this same directory to see what changes need to ' . 'be apply for this specific version of Newscoop.', FALSE); } if (file_exists($upgrade_trigger_path)) { @unlink($upgrade_trigger_path); } function display_upgrade_error($p_errorMessage, $exit = TRUE) { if (defined('APPLICATION_ENV') && APPLICATION_ENV == 'development') { var_dump($p_errorMessage); if ($exit) { exit(1);
private static function InstallPlugins() { require_once $GLOBALS['g_campsiteDir'] . '/include/campsite_constants.php'; require_once dirname(dirname(dirname(__FILE__))) . DIR_SEP . 'db_connect.php'; require_once dirname(dirname(dirname(__FILE__))) . '/classes/CampPlugin.php'; foreach (CampPlugin::GetPluginsInfo() as $info) { $CampPlugin = new CampPlugin($info['name']); $to_enable = true; if (isset($info['enabled_by_default'])) { $to_enable = in_array($info['enabled_by_default'], array(true, 1, 'Y')) ? true : false; } $CampPlugin->create($info['name'], $info['version'], $to_enable); $CampPlugin->install(); if ($CampPlugin->isEnabled()) { $CampPlugin->enable(); } else { $CampPlugin->disable(); } if (function_exists("plugin_{$info['name']}_addPermissions")) { call_user_func("plugin_{$info['name']}_addPermissions"); } } }
} } $redirector = $this->getHelper('redirector'); $redirector->gotoSimple('manage.php', 'plugins', 'admin'); } if (Input::Get('upload_package')) { $file = $_FILES['package']; if ($Plugin = CampPlugin::extractPackage($file['tmp_name'], $log)) { $success = $translator->trans('The plugin $1 was sucessfully installed.', array('$1' => $Plugin->getName()), 'plugins'); } else { $error = $log; } //$Plugin->enable(); } if (Input::Get('p_uninstall')) { $Plugin = new CampPlugin(Input::Get('p_plugin', 'string')); $Plugin->uninstall(); } if (count($infos = CampPlugin::GetPluginsInfo()) > 0) { // check if update was needed CampPlugin::GetPluginsInfo(false, true); if ($needsUpdate = CampPlugin::GetNeedsUpdate()) { camp_html_add_msg($translator->trans("Some plugins have to be updated. Please press the save button.", array(), 'plugins')); } } else { camp_html_add_msg($translator->trans("You have no installed plugins.", array(), 'plugins')); } $crumbs = array(); $crumbs[] = array($translator->trans("Plugins"), ""); $crumbs[] = array($translator->trans("Manage", array(), 'plugins'), ""); echo camp_html_breadcrumbs($crumbs);
public function preparePluginsMenu($menu) { $translator = $this->container->get('translator'); $rootMenu = false; $pluginInfos = \CampPlugin::GetPluginsInfo(true); if ($this->user->hasPermission('plugin_manager')) { $rootMenu = true; } foreach ($pluginInfos as $info) { if (isset($info['menu']['permission']) && $this->user->hasPermission($info['menu']['permission'])) { $rootMenu = true; } elseif (isset($info['menu']['sub']) && is_array($info['menu']['sub'])) { foreach ($info['menu']['sub'] as $menuInfo) { if ($this->user->hasPermission($menuInfo['permission'])) { $rootMenu = true; } } } } $menu->addChild($translator->trans('Plugins'), array('uri' => '#'))->setAttribute('dropdown', true)->setLinkAttribute('data-toggle', 'dropdown'); if (!$rootMenu) { $menu[$translator->trans('Plugins')]->setDisplay(false); return; } if ($this->user->hasPermission('plugin_manager')) { $this->addChild($menu[$translator->trans('Plugins')], $translator->trans('Manage Plugins'), array('uri' => $this->container->get('router')->generate('newscoop_newscoop_plugins_index'))); } $enabled = \CampPlugin::GetEnabled(); $enabledIds = array(); foreach ($enabled as $plugin) { $enabledIds[] = $plugin->getName(); } foreach ($pluginInfos as $info) { if (in_array($info['name'], $enabledIds)) { $parentMenu = false; if (isset($info['menu']['permission']) && $this->user->hasPermission($info['menu']['permission'])) { $parentMenu = true; } elseif (isset($info['menu']['sub']) && is_array($info['menu']['sub'])) { foreach ($info['menu']['sub'] as $menuInfo) { if ($this->user->hasPermission($menuInfo['permission'])) { $parentMenu = true; } } } if ($parentMenu && isset($info['menu'])) { $uri = '#'; if (isset($info['menu']['path'])) { $uri = $this->generateZendRoute('admin') . '/' . $info['menu']['path']; } $this->addChild($menu[$translator->trans('Plugins')], $translator->trans($info['menu']['label']), array('uri' => $uri))->setLinkAttribute('data-toggle', 'rightdrop'); } if (isset($info['menu']['sub']) && is_array($info['menu']['sub'])) { foreach ($info['menu']['sub'] as $menuInfo) { if ($this->user->hasPermission($menuInfo['permission'])) { $uri = '#'; if (isset($menuInfo['path'])) { $uri = $this->generateZendRoute('admin') . '/' . $menuInfo['path']; } $this->addChild($menu[$translator->trans('Plugins')][$translator->trans($info['menu']['label'])], $translator->trans($menuInfo['label']), array('uri' => $uri)); } } } } } return $menu; }
/** * Creates an object of the given type. Returns the created object. * * @param string $p_objectType * @return object */ private function createObject($p_objectType) { $p_objectType = CampContext::TranslateProperty($p_objectType); $classFullPath = $GLOBALS['g_campsiteDir'] . '/template_engine/metaclasses/' . CampContext::ObjectType($p_objectType) . '.php'; if (file_exists($classFullPath)) { require_once $classFullPath; } elseif (class_exists(CampContext::$m_objectTypes[$p_objectType]['class'])) { $className = CampContext::ObjectType($p_objectType); } else { $pluginImplementsClassFullPath = false; foreach (CampPlugin::GetEnabled() as $CampPlugin) { $pluginClassFullPath = $GLOBALS['g_campsiteDir'] . '/' . $CampPlugin->getBasePath() . '/template_engine/metaclasses/' . CampContext::ObjectType($p_objectType) . '.php'; if (file_exists($pluginClassFullPath)) { $pluginImplementsClassFullPath = $pluginClassFullPath; } } if ($pluginImplementsClassFullPath) { require_once $pluginImplementsClassFullPath; } else { throw new InvalidObjectException($p_objectType); } } $className = CampContext::ObjectType($p_objectType); $this->m_objects[$p_objectType] = new $className(); return $this->m_objects[$p_objectType]; }
// replace $campsite by $gimme require_once($g_documentRoot.'/classes/TemplateConverterNewscoop.php'); $template_files = camp_read_files($g_documentRoot.'/templates'); $converter = new TemplateConverterNewscoop(); foreach($template_files as $template_file) { $converter->read($template_file); $converter->parse(); $converter->write(); } // sync phorum users User::SyncPhorumUsers(); // update plugins CampPlugin::OnUpgrade(); CampRequest::SetVar('step', 'finish'); $install = new CampInstallation(); $install->initSession(); $step = $install->execute(); CampTemplate::singleton()->clearCache(); // replace javascript by js in .htaccess file $htaccesspath = $g_documentRoot . '/.htaccess'; if (upgrade_htaccess($htaccesspath) == false) { display_upgrade_error('Could not write .htaccess file.<br />Please read the ' . 'UPGRADE.txt file in this same directory to see what changes need to ' . 'be apply for this specific version of Newscoop.', FALSE); }