GetPluginsInfo() 공개 정적인 메소드

The method have to return an (empty) array.
public static GetPluginsInfo ( boolean $p_selectEnabled = false, boolean $p_reload = false ) : array
$p_selectEnabled boolean
$p_reload boolean
리턴 array
예제 #1
0
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;
}
예제 #2
0
 /**
  * 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)));
             }
         }
     }
 }
예제 #3
0
 /**
  * Class constructor
  */
 public final function __construct()
 {
     global $Campsite, $controller;
     if (!is_null($this->m_properties)) {
         return;
     }
     $this->login_action = (object) array('is_error' => false, 'error_message' => '');
     self::$m_nullMetaArticle = new MetaArticle();
     self::$m_nullMetaSection = new MetaSection();
     // LEGACY PLUGINS
     // register plugin objects and listobjects
     foreach (CampPlugin::GetPluginsInfo(true) as $info) {
         if (is_array($info['template_engine']['objecttypes'])) {
             foreach ($info['template_engine']['objecttypes'] as $objecttype) {
                 $this->registerObjectType($objecttype);
             }
         }
         if (is_array($info['template_engine']['listobjects'])) {
             foreach ($info['template_engine']['listobjects'] as $listobject) {
                 $this->registerListObject($listobject);
             }
         }
     }
     // Register new plugins system list objects
     $pluginsService = \Zend_Registry::get('container')->get('newscoop.plugins.service');
     $collectedData = $pluginsService->collectListObjects();
     $this->m_listObjects = array_merge($collectedData['listObjects'], $this->m_listObjects);
     CampContext::$m_objectTypes = array_merge($collectedData['objectTypes'], CampContext::$m_objectTypes);
     $this->m_properties['htmlencoding'] = false;
     $this->m_properties['subs_by_type'] = null;
     $this->m_readonlyProperties['version'] = $Campsite['VERSION'];
     $this->m_readonlyProperties['current_list'] = null;
     $this->m_readonlyProperties['lists'] = array();
     $this->m_readonlyProperties['prev_list_empty'] = null;
     $this->m_readonlyProperties['default_url'] = new MetaURL();
     $this->m_readonlyProperties['url'] = new MetaURL();
     if (!$this->m_readonlyProperties['default_url']->is_valid) {
         if (!$this->m_readonlyProperties['url']->language->defined) {
             $this->m_readonlyProperties['url']->language = $this->m_readonlyProperties['url']->publication->default_language;
             $this->m_readonlyProperties['default_url'] = $this->m_readonlyProperties['url'];
         }
     }
     $this->m_objects['user'] = $this->m_readonlyProperties['url']->user;
     $this->m_readonlyProperties['preview'] = $this->m_readonlyProperties['url']->preview;
     if (!$this->m_readonlyProperties['preview']) {
         if (!$this->m_readonlyProperties['url']->article->is_published) {
             $this->m_readonlyProperties['default_url']->article = self::$m_nullMetaArticle;
             $this->m_readonlyProperties['url']->article = self::$m_nullMetaArticle;
         }
         if (!$this->m_readonlyProperties['url']->issue->is_published) {
             $this->m_readonlyProperties['default_url']->article = self::$m_nullMetaArticle;
             $this->m_readonlyProperties['url']->article = self::$m_nullMetaArticle;
             $this->m_readonlyProperties['default_url']->section = self::$m_nullMetaSection;
             $this->m_readonlyProperties['url']->section = self::$m_nullMetaSection;
             $this->m_readonlyProperties['default_url']->issue = new MetaIssue();
             $this->m_readonlyProperties['url']->issue = new MetaIssue();
         }
     }
     $this->m_objects['publication'] = $this->m_readonlyProperties['url']->publication;
     $this->m_objects['language'] = $this->m_readonlyProperties['url']->language;
     $this->m_objects['issue'] = $this->m_readonlyProperties['url']->issue;
     $this->m_objects['section'] = $this->m_readonlyProperties['url']->section;
     $this->m_objects['article'] = $this->m_readonlyProperties['url']->article;
     $this->m_objects['template'] = $this->m_readonlyProperties['url']->template;
     if (is_numeric($this->m_readonlyProperties['url']->get_parameter('tpid'))) {
         $this->m_objects['topic'] = new MetaTopic($this->m_readonlyProperties['url']->get_parameter('tpid'));
     }
     $this->m_readonlyProperties['default_template'] = $this->m_objects['template'];
     $this->m_readonlyProperties['default_language'] = $this->m_objects['language'];
     $this->m_readonlyProperties['default_publication'] = $this->m_objects['publication'];
     $this->m_readonlyProperties['default_issue'] = $this->m_objects['issue'];
     $this->m_readonlyProperties['default_section'] = $this->m_objects['section'];
     $this->m_readonlyProperties['default_article'] = $this->m_objects['article'];
     $this->m_readonlyProperties['default_topic'] = $this->topic;
     if (!is_null($commentId = CampRequest::GetVar('acid'))) {
         $this->m_objects['comment'] = new MetaComment($commentId);
     }
     $this->m_readonlyProperties['request_action'] = MetaAction::CreateAction(CampRequest::GetInput(CampRequest::GetMethod()));
     $requestActionName = $this->m_readonlyProperties['request_action']->name;
     $runAction = true;
     if ($requestActionName == 'submit_comment' && $pluginsService->isInstalled('terwey/plugin-newscoop-comments')) {
         $runAction = false;
     }
     if ($requestActionName != 'default' && $runAction) {
         $this->m_readonlyProperties['request_action']->takeAction($this);
     }
     foreach (MetaAction::ReadAvailableActions() as $actionName => $actionAttributes) {
         $propertyName = $actionName . '_action';
         if ($requestActionName == $actionName) {
             $this->m_readonlyProperties[$propertyName] =& $this->m_readonlyProperties['request_action'];
         } else {
             $this->m_readonlyProperties[$propertyName] = MetaAction::DefaultAction();
         }
     }
     // Initialize the default comment attribute at the end, after the
     // submit comment action had run.
     $this->m_readonlyProperties['default_comment'] = $this->comment;
     // add browser info
     $this->m_readonlyProperties['browser'] = new Browser();
     // initialize plugins
     foreach (CampPlugin::GetPluginsInfo(true) as $info) {
         if (function_exists($info['template_engine']['init'])) {
             $plugin_init = $info['template_engine']['init'];
             $plugin_init($this);
         }
     }
     // initialize geo-map holders
     $this->m_properties['map_dynamic_constraints'] = null;
     $this->m_properties['map_dynamic_areas'] = null;
     $this->m_properties['map_dynamic_max_points'] = 0;
     $this->m_properties['map_dynamic_tot_points'] = 0;
     $this->m_properties['map_dynamic_points_raw'] = null;
     $this->m_properties['map_dynamic_points_objects'] = null;
     $this->m_properties['map_dynamic_meta_article_objects'] = null;
     $this->m_properties['map_dynamic_map_label'] = "";
     $this->m_properties['map_dynamic_id_counter'] = 0;
     $this->m_properties['map_common_header_set'] = false;
     $flashMessenger = new \Newscoop\Controller\Helper\FlashMessenger();
     $this->flash_messages = $flashMessenger->getMessages();
 }
예제 #4
0
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);
camp_html_display_msgs();
?>
<P>
<FORM name="plugin_upload" action="/<?php 
echo $ADMIN;
예제 #5
0
    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");
            }
        }
    }
예제 #6
0
    /**
     * 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
예제 #7
0
// 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);
예제 #8
0
 /**
  * Class constructor
  */
 public final function __construct()
 {
     global $Campsite, $controller;
     if (!is_null($this->m_properties)) {
         return;
     }
     $this->login_action = (object) array('is_error' => false, 'error_message' => '');
     self::$m_nullMetaArticle = new MetaArticle();
     self::$m_nullMetaSection = new MetaSection();
     // register plugin objects and listobjects
     foreach (CampPlugin::GetPluginsInfo(true) as $info) {
         if (is_array($info['template_engine']['objecttypes'])) {
             foreach ($info['template_engine']['objecttypes'] as $objecttype) {
                 $this->registerObjectType($objecttype);
             }
         }
         if (is_array($info['template_engine']['listobjects'])) {
             foreach ($info['template_engine']['listobjects'] as $listobject) {
                 $this->registerListObject($listobject);
             }
         }
     }
     $this->m_properties['htmlencoding'] = false;
     $this->m_properties['subs_by_type'] = null;
     $this->m_readonlyProperties['version'] = $Campsite['VERSION'];
     $this->m_readonlyProperties['current_list'] = null;
     $this->m_readonlyProperties['lists'] = array();
     $this->m_readonlyProperties['prev_list_empty'] = null;
     $this->m_readonlyProperties['default_url'] = new MetaURL();
     $this->m_readonlyProperties['url'] = new MetaURL();
     if (!$this->m_readonlyProperties['default_url']->is_valid) {
         header('HTTP/1.0 404 Not Found');
         if (!$this->m_readonlyProperties['url']->language->defined) {
             $this->m_readonlyProperties['url']->language = $this->m_readonlyProperties['url']->publication->default_language;
             $this->m_readonlyProperties['default_url'] = $this->m_readonlyProperties['url'];
         }
     }
     $this->m_objects['user'] = $this->m_readonlyProperties['url']->user;
     $this->m_readonlyProperties['preview'] = $this->m_readonlyProperties['url']->preview;
     if (!$this->m_readonlyProperties['preview']) {
         if (!$this->m_readonlyProperties['url']->article->is_published) {
             $this->m_readonlyProperties['default_url']->article = self::$m_nullMetaArticle;
             $this->m_readonlyProperties['url']->article = self::$m_nullMetaArticle;
         }
         if (!$this->m_readonlyProperties['url']->issue->is_published) {
             $this->m_readonlyProperties['default_url']->article = self::$m_nullMetaArticle;
             $this->m_readonlyProperties['url']->article = self::$m_nullMetaArticle;
             $this->m_readonlyProperties['default_url']->section = self::$m_nullMetaSection;
             $this->m_readonlyProperties['url']->section = self::$m_nullMetaSection;
             $this->m_readonlyProperties['default_url']->issue = new MetaIssue();
             $this->m_readonlyProperties['url']->issue = new MetaIssue();
         }
     }
     $this->m_objects['publication'] = $this->m_readonlyProperties['url']->publication;
     $this->m_objects['language'] = $this->m_readonlyProperties['url']->language;
     $this->m_objects['issue'] = $this->m_readonlyProperties['url']->issue;
     $this->m_objects['section'] = $this->m_readonlyProperties['url']->section;
     $this->m_objects['article'] = $this->m_readonlyProperties['url']->article;
     $this->m_objects['template'] = $this->m_readonlyProperties['url']->template;
     if (is_numeric($this->m_readonlyProperties['url']->get_parameter('tpid'))) {
         $this->m_objects['topic'] = new MetaTopic($this->m_readonlyProperties['url']->get_parameter('tpid'));
     }
     $this->m_readonlyProperties['default_template'] = $this->m_objects['template'];
     $this->m_readonlyProperties['default_language'] = $this->m_objects['language'];
     $this->m_readonlyProperties['default_publication'] = $this->m_objects['publication'];
     $this->m_readonlyProperties['default_issue'] = $this->m_objects['issue'];
     $this->m_readonlyProperties['default_section'] = $this->m_objects['section'];
     $this->m_readonlyProperties['default_article'] = $this->m_objects['article'];
     $this->m_readonlyProperties['default_topic'] = $this->topic;
     if (!is_null($commentId = CampRequest::GetVar('acid'))) {
         $this->m_objects['comment'] = new MetaComment($commentId);
     }
     $this->m_readonlyProperties['request_action'] = MetaAction::CreateAction(CampRequest::GetInput(CampRequest::GetMethod()));
     $requestActionName = $this->m_readonlyProperties['request_action']->name;
     if ($requestActionName != 'default') {
         $this->m_readonlyProperties['request_action']->takeAction($this);
     }
     foreach (MetaAction::ReadAvailableActions() as $actionName => $actionAttributes) {
         $propertyName = $actionName . '_action';
         if ($requestActionName == $actionName) {
             $this->m_readonlyProperties[$propertyName] =& $this->m_readonlyProperties['request_action'];
         } else {
             $this->m_readonlyProperties[$propertyName] = MetaAction::DefaultAction();
         }
     }
     // Initialize the default comment attribute at the end, after the
     // submit comment action had run.
     $this->m_readonlyProperties['default_comment'] = $this->comment;
     // add browser info
     $this->m_readonlyProperties['browser'] = new Browser();
     // initialize plugins
     foreach (CampPlugin::GetPluginsInfo(true) as $info) {
         if (function_exists($info['template_engine']['init'])) {
             $plugin_init = $info['template_engine']['init'];
             $plugin_init($this);
         }
     }
     // initialize geo-map holders
     $this->m_properties['map_dynamic_constraints'] = null;
     $this->m_properties['map_dynamic_areas'] = null;
     $this->m_properties['map_dynamic_max_points'] = 0;
     $this->m_properties['map_dynamic_tot_points'] = 0;
     $this->m_properties['map_dynamic_points_raw'] = null;
     $this->m_properties['map_dynamic_points_objects'] = null;
     $this->m_properties['map_dynamic_meta_article_objects'] = null;
     $this->m_properties['map_dynamic_map_label'] = "";
     $this->m_properties['map_dynamic_id_counter'] = 0;
     $this->m_properties['map_common_header_set'] = false;
     if (defined('APPLICATION_PATH')) {
         $options = $controller->getInvokeArg('bootstrap')->getOptions();
         $form = new \Application_Form_Contact();
         $form->setMethod('POST');
         $request = \Zend_Controller_Front::getInstance()->getRequest();
         if ($request->isPost() && $form->isValid($request->getPost())) {
             $email = new \Zend_Mail('utf-8');
             $email->setFrom($form->email->getValue(), $form->first_name->getValue() . ' ' . $form->last_name->getValue())->setSubject($form->subject->getValue())->setBodyText($form->message->getValue())->addTo($options['email']['contact'])->send();
             $controller->getHelper('flashMessenger')->addMessage("form_contact_done");
             $controller->getHelper('redirector')->gotoUrl($request->getPathInfo());
             exit;
         }
         $this->form_contact = $form;
         $this->flash_messages = $controller->getHelper('flashMessenger')->getMessages();
     }
 }
예제 #9
0
/**
 * 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('"', '&#34;', $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
예제 #10
0
 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;
 }
예제 #11
0
 public static function ExtractPackage($p_uploaded_package, &$p_log = null)
 {
     $plugin_name = false;
     require_once 'Archive/Tar.php';
     $tar = new Archive_Tar($p_uploaded_package);
     if (($file_list = $tar->ListContent()) == 0) {
         $p_log = getGS('The uploaded file format is unsupported.');
         return false;
     } else {
         foreach ($file_list as $v) {
             if (preg_match('/[^\\/]+\\/([^.]+)\\.info\\.php/', $v['filename'], $matches)) {
                 $plugin_name = $matches[1];
             }
             #$p_log .= sprintf("Name: %s  Size: %d   modtime: %s mode: %s<br>", $v['filename'], $v['size'], $v['mtime'], $v['mode']);
         }
     }
     if ($plugin_name === false) {
         $p_log = getGS('The uploaded archive does not contain an valid newscoop plugin.');
         return false;
     }
     $tar->extract(CS_PATH_PLUGINS);
     self::ClearPluginsInfo();
     CampPlugin::GetPluginsInfo(false, true);
 }
예제 #12
0
      </tr>
   </table>
   <?php
} else {
    ?>
    <table cellpadding="0" cellspacing="0" class="action_buttons" style="padding-bottom: 5px;">
      <tr>
        <td class="error_message" ><?php echo $error ?></td>
      </tr>
   </table>
   <?php
}
?>

<P>
<?php if (count($infos = CampPlugin::GetPluginsInfo()) > 0) { ?>
<FORM name="plugins_enabled" action="manage.php">
<?php echo SecurityToken::FormParameter(); ?>
<TABLE BORDER="0" CELLSPACING="1" CELLPADDING="3" class="table_list" width="95%">
    <TR class="table_list_header">
        <TD ALIGN="LEFT" VALIGN="TOP"><B><?php  putGS("Name"); ?></B></TD>
        <TD ALIGN="LEFT" VALIGN="TOP"><B><?php  putGS("Version"); ?></B></TD>
        <TD ALIGN="LEFT" VALIGN="TOP"><B><?php  putGS("Description"); ?></B></TD>
        <TD align="center" VALIGN="TOP"><B><?php  putGS("Enabled"); ?></B></TD>
        <TD align="center" VALIGN="TOP"><B><?php  putGS("Uninstall"); ?></B></TD>
    </TR>
    <?php
    $color=0;
    foreach ($infos as $info) {
        $checked = '';
        if (CampPlugin::isPluginEnabled($info['name'])) {
예제 #13
0
    /**
     * Class constructor
     */
    final public function __construct()
    {
        global $Campsite;

        if (!is_null($this->m_properties)) {
            return;
        }

        self::$m_nullMetaArticle = new MetaArticle();
        self::$m_nullMetaSection = new MetaSection();

        // register plugin objects and listobjects
        foreach (CampPlugin::GetPluginsInfo(true) as $info) {
        	if (is_array($info['template_engine']['objecttypes'])) {
        		foreach ($info['template_engine']['objecttypes'] as $objecttype) {
        			$this->registerObjectType($objecttype);
        		}
        	}

        	if (is_array($info['template_engine']['listobjects'])) {
        		foreach ($info['template_engine']['listobjects'] as $listobject) {
        			$this->registerListObject($listobject);
        		}
        	}
        }

        $this->m_properties['htmlencoding'] = false;
        $this->m_properties['subs_by_type'] = null;

        $this->m_readonlyProperties['version'] = $Campsite['VERSION'];

        $this->m_readonlyProperties['current_list'] = null;
        $this->m_readonlyProperties['lists'] = array();
        $this->m_readonlyProperties['prev_list_empty'] = null;

        $this->m_readonlyProperties['default_url'] = new MetaURL();
        $this->m_readonlyProperties['url'] = new MetaURL();
        if (!$this->m_readonlyProperties['default_url']->is_valid) {
        	header('HTTP/1.0 404 Not Found');
        	if (!$this->m_readonlyProperties['url']->language->defined) {
        		$this->m_readonlyProperties['url']->language = $this->m_readonlyProperties['url']->publication->default_language;
        		$this->m_readonlyProperties['default_url'] = $this->m_readonlyProperties['url'];
        	}
        }

        $this->m_objects['user'] = $this->m_readonlyProperties['url']->user;
        $this->m_readonlyProperties['preview'] = $this->m_readonlyProperties['url']->preview;

        if (!$this->m_readonlyProperties['preview']) {
        	if (!$this->m_readonlyProperties['url']->article->is_published) {
        		$this->m_readonlyProperties['default_url']->article = self::$m_nullMetaArticle;
                $this->m_readonlyProperties['url']->article = self::$m_nullMetaArticle;
        	}
            if (!$this->m_readonlyProperties['url']->issue->is_published) {
                $this->m_readonlyProperties['default_url']->article = self::$m_nullMetaArticle;
                $this->m_readonlyProperties['url']->article = self::$m_nullMetaArticle;
                $this->m_readonlyProperties['default_url']->section = self::$m_nullMetaSection;
                $this->m_readonlyProperties['url']->section = self::$m_nullMetaSection;
                $this->m_readonlyProperties['default_url']->issue = new MetaIssue();
                $this->m_readonlyProperties['url']->issue = new MetaIssue();
            }
        }

        $this->m_objects['publication'] = $this->m_readonlyProperties['url']->publication;
        $this->m_objects['language'] = $this->m_readonlyProperties['url']->language;
        $this->m_objects['issue'] = $this->m_readonlyProperties['url']->issue;
        $this->m_objects['section'] = $this->m_readonlyProperties['url']->section;
        $this->m_objects['article'] = $this->m_readonlyProperties['url']->article;
        $this->m_objects['template'] = $this->m_readonlyProperties['url']->template;
        if (is_numeric($this->m_readonlyProperties['url']->get_parameter('tpid'))) {
            $this->m_objects['topic'] = new MetaTopic($this->m_readonlyProperties['url']->get_parameter('tpid'));
        }

        $this->m_readonlyProperties['default_template'] = $this->m_objects['template'];
        $this->m_readonlyProperties['default_language'] = $this->m_objects['language'];
        $this->m_readonlyProperties['default_publication'] = $this->m_objects['publication'];
        $this->m_readonlyProperties['default_issue'] = $this->m_objects['issue'];
        $this->m_readonlyProperties['default_section'] = $this->m_objects['section'];
        $this->m_readonlyProperties['default_article'] = $this->m_objects['article'];
        $this->m_readonlyProperties['default_topic'] = $this->topic;

        if (!is_null($commentId = CampRequest::GetVar('acid'))) {
            $this->m_objects['comment'] = new MetaComment($commentId);
        }

        $this->m_readonlyProperties['request_action'] = MetaAction::CreateAction(CampRequest::GetInput(CampRequest::GetMethod()));
        $requestActionName = $this->m_readonlyProperties['request_action']->name;
        if ($requestActionName != 'default') {
        	$this->m_readonlyProperties['request_action']->takeAction($this);
        }

        foreach (MetaAction::ReadAvailableActions() as $actionName=>$actionAttributes) {
            $propertyName = $actionName . '_action';
            if ($requestActionName == $actionName) {
                $this->m_readonlyProperties[$propertyName] =& $this->m_readonlyProperties['request_action'];
            } else {
                $this->m_readonlyProperties[$propertyName] = MetaAction::DefaultAction();
            }
        }

        // Initialize the default comment attribute at the end, after the
        // submit comment action had run.
        $this->m_readonlyProperties['default_comment'] = $this->comment;

        // add browser info
        $this->m_readonlyProperties['browser'] = new Browser;

        // initialize plugins
        foreach (CampPlugin::GetPluginsInfo(true) as $info) {
            if (function_exists($info['template_engine']['init'])) {
                $plugin_init = $info['template_engine']['init'];
                $plugin_init($this);
            }
        }
    } // fn __construct
예제 #14
0
 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");
         }
     }
 }