/**
 * Campsite set_language function plugin
 *
 * Type:     function
 * Name:     set_language
 * Purpose:
 *
 * @param array
 *     $p_params The English name of the language to be set
 * @param object
 *     $p_smarty The Smarty object
 */
function smarty_function_set_language($p_params, &$p_smarty)
{
    // gets the context variable
    $campsite = $p_smarty->get_template_vars('gimme');

    if (isset($p_params['name'])) {
    	$languageName = $p_params['name'];
    } else {
    	$property = array_shift(array_keys($p_params));
        CampTemplate::singleton()->trigger_error("invalid parameter '$property' in set_language");
    	return false;
    }

    if ($campsite->language->defined
            && $campsite->language->english_name == $languageName) {
        return;
    }

    $languages = Language::GetLanguages(null, null, $languageName);
    if (empty($languages)) {
    	$campsite->language->trigger_invalid_value_error('name', $languageName, $p_smarty);
    	return false;
    }
    $campsite->language = new MetaLanguage($languages[0]->getLanguageId());
} // fn smarty_function_set_language
示例#2
0
 /**
  * Creates the list of objects. Sets the parameter $p_hasNextElements to
  * true if this list is limited and elements still exist in the original
  * list (from which this was truncated) after the last element of this
  * list.
  *
  * @param int $p_start
  * @param int $p_limit
  * @param array $p_parameters
  * @param int &$p_count
  * @return array
  */
 protected function CreateList($p_start = 0, $p_limit = 0, array $p_parameters, &$p_count)
 {
     $context = CampTemplate::singleton()->context();
     if ($p_parameters['of_article']) {
         $metaLanguagesList = $context->article->languages_list($p_parameters['exclude_current'], $this->m_order);
     } elseif ($p_parameters['of_issue']) {
         $metaLanguagesList = $context->issue->languages_list($p_parameters['exclude_current'], $this->m_order);
     } elseif ($p_parameters['of_publication']) {
         $metaLanguagesList = $context->publication->languages_list($p_parameters['exclude_current'], $this->m_order);
     } else {
         if ($p_parameters['exclude_current']) {
             $excludeList = array($context->language->number);
         } else {
             $excludeList = array();
         }
         $languagesList = Language::GetLanguages(null, null, null, $excludeList, $this->m_order);
         $metaLanguagesList = array();
         foreach ($languagesList as $language) {
             $metaLanguagesList[] = new MetaLanguage($language->getLanguageId());
         }
     }
     return $metaLanguagesList;
 }
示例#3
0
 /**
  * Returns true if the article was translated in to the language
  * identified by the given language code
  *
  * @param string $p_language - language code
  * @return bool
  */
 public function translated_to($p_language) {
     if (is_string($p_language)) {
         $languages = Language::GetLanguages(null, $p_language);
         if (sizeof($languages) == 0) {
             return (int)false;
         }
         $language = $languages[0];
     } else {
         $language = $p_language;
     }
     $article = new Article($language->getLanguageId(),
     $this->m_dbObject->getArticleNumber());
     return (int)$article->exists()
     && ($article->isPublished() || CampTemplate::singleton()->context()->preview);
 }
示例#4
0
/**
 * Campsite Map function plugin
 *
 * Type:     function
 * Name:     count
 * Purpose:  Triggers a statistics counting request
 *
 * @param array
 *     $p_params List of parameters from template
 * @param object
 *     $p_smarty Smarty template object
 *
 * @return
 *     string The html content
 */
function smarty_function_count($p_params, &$p_smarty)
{
    global $Campsite;
    $campsite = $p_smarty->getTemplateVars('gimme');
    $content = '';
    $art_number = 0;
    $art_language_num = 0;
    $art_language_code = '';
    if (isset($p_params['article']) && is_numeric($p_params['article'])) {
        $art_number = $p_params['article'];
    }
    if (isset($p_params['language'])) {
        $langs = array();
        if (is_numeric($p_params['language'])) {
            $langs = \Language::GetLanguages($p_params['language']);
        } else {
            $langs = \Language::GetLanguages(null, $p_params['language']);
        }
        if (!isset($langs[0])) {
            return '';
            // 'no lang'
        }
        $art_language_obj = $langs[0];
        $art_language_num = $art_language_obj->getLanguageId();
        $art_language_code = $art_language_obj->getCode();
    }
    $count_automatically = true;
    if (isset($p_params['dont_count_automatically'])) {
        $count_automatically = false;
    }
    if (!$art_number || !$art_language_num) {
        $meta_article = $campsite->article;
        if ($meta_article->defined) {
            if (!$art_number) {
                $art_number = $meta_article->number;
            }
            if (!$art_language_num) {
                $art_language_meta = $meta_article->language;
                $art_language_num = $art_language_meta->number;
                $art_language_code = $art_language_meta->code;
            }
        }
    }
    if (!$art_language_num) {
        $art_language_meta = $campsite->language;
        $art_language_num = $art_language_meta->number;
        $art_language_code = $art_language_meta->code;
    }
    if (!$art_number || !$art_language_num) {
        return '';
        // 'no art_num or lang'
    }
    $article = new \Article($art_language_num, $art_number);
    if (!$article->exists()) {
        return '';
        // 'no art'
    }
    try {
        $requestObjectId = $article->getProperty('object_id');
        $updateArticle = empty($requestObjectId);
        $objectType = new \ObjectType('article');
        $object_type_id = $objectType->getObjectTypeId();
        if ($updateArticle) {
            $requestObject = new \RequestObject($requestObjectId);
            if (!$requestObject->exists()) {
                $requestObject->create(array('object_type_id' => $objectType->getObjectTypeId()));
                $requestObjectId = $requestObject->getObjectId();
            }
            $article->setProperty('object_id', $requestObjectId);
        }
        // statistics shall be only gathered if the site admin set it on (and not for editor previews)
        if (!$campsite->preview) {
            $stat_web_url = $Campsite['WEBSITE_URL'];
            if ('/' != $stat_web_url[strlen($stat_web_url) - 1]) {
                $stat_web_url .= '/';
            }
            $article_number = $article->getProperty('Number');
            $name_spec = '_' . $article_number . '_' . $art_language_code;
            $content .= \Statistics::JavaScriptTrigger(array('count_automatically' => $count_automatically, 'name_spec' => $name_spec, 'object_type_id' => $object_type_id, 'request_object_id' => $requestObjectId));
        }
    } catch (\Exception $ex) {
        return '';
    }
    return $content;
}
示例#5
0
    camp_html_display_error($errorStr, $BackLink);
    exit;
}
// When the user selects a language the form is submitted to the same page (translation.php).
// Read article translation form input values for the case when the page has been reloaded
// because of language select.
$f_translation_title = Input::Get('f_translation_title', 'string', '', true);
$f_language_selected = Input::Get('f_translation_language', 'int', 0, true);
$f_translation_language = Input::Get('f_translation_language', 'int', 0, true);
if ($f_publication_id > 0) {
    $f_translation_issue_name = Input::Get('f_issue_name', 'string', $issueObj->getName(), true);
    $f_translation_issue_urlname = Input::Get('f_issue_urlname', 'string', $issueObj->getUrlName(), true);
    $f_translation_section_name = Input::Get('f_section_name', 'string', $sectionObj->getName(), true);
    $f_translation_section_urlname = Input::Get('f_section_urlname', 'string', $sectionObj->getUrlName(), true);
}
$allLanguages = Language::GetLanguages(null, null, null, array(), array(array('field' => 'byname', 'dir' => 'asc')), true);
$articleLanguages = $articleObj->getLanguages();
$articleLanguages = DbObjectArray::GetColumn($articleLanguages, "Id");
if ($f_language_selected > 0 && $f_issue_number > 0) {
    $translationIssueObj = new Issue($f_publication_id, $f_language_selected, $f_issue_number);
    $translationSectionObj = new Section($f_publication_id, $f_issue_number, $f_language_selected, $f_section_number);
}
if ($f_publication_id > 0) {
    $topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj, 'Section' => $sectionObj, 'Article' => $articleObj);
    camp_html_content_top(getGS('Translate article'), $topArray, true, true);
} else {
    $crumbs = array();
    $crumbs[] = array(getGS("Actions"), "");
    $crumbs[] = array(getGS('Translate article'), "");
    echo camp_html_breadcrumbs($crumbs);
}
示例#6
0
require_once($GLOBALS['g_campsiteDir']."/classes/Language.php");
require_once($GLOBALS['g_campsiteDir']."/classes/Alias.php");
require_once($GLOBALS['g_campsiteDir']."/include/phorum_load.php");
require_once($GLOBALS['g_campsiteDir'].'/classes/Phorum_forum.php');
require_once($GLOBALS['g_campsiteDir'].'/classes/Phorum_setting.php');
require_once($GLOBALS['g_campsiteDir']."/$ADMIN_DIR/camp_html.php");
camp_load_translation_strings("api");

// Check permissions
if (!$g_user->hasPermission('ManagePub')) {
	camp_html_display_error(getGS("You do not have the right to add publications."));
	exit;
}

$languages = Language::GetLanguages(null, null, null, array(), array(), true);
$defaultLanguage = array_pop(Language::GetLanguages(null, camp_session_get('TOL_Language', 'en'), null, array(), array(), true));
$urlTypes = UrlType::GetUrlTypes();
$allTemplates = Template::GetAllTemplates(null, true, true, true);
$timeUnits = TimeUnit::GetTimeUnits(camp_session_get('TOL_Language', 'en'));
$shortNameUrlType = UrlType::GetByName('short names');
$aliases = array();

$crumbs = array();
$crumbs[] = array(getGS("Publications"), "/$ADMIN/pub/");
$crumbs[] = array(getGS("Add new publication"), "");
echo camp_html_breadcrumbs($crumbs);

include_once($GLOBALS['g_campsiteDir']."/$ADMIN_DIR/javascript_common.php");

?>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" class="action_buttons" style="padding-top: 5px;">
 /**
  * Get language by code
  *
  * @param  string          $code
  * @param  MetaPublication $publication
  * @return MetaLanguage
  */
 private function _getLanguage($code, MetaPublication $publication)
 {
     $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
     $cacheKey = $cacheService->getCacheKey(array('CampURIShortNameLanguage', $code, $publication->name), 'language');
     if ($cacheService->contains($cacheKey)) {
         return $cacheService->fetch($cacheKey);
     } else {
         $language = $publication->default_language;
         if (!empty($code)) {
             $langArray = Language::GetLanguages(null, $code);
             if (is_array($langArray) && sizeof($langArray) == 1) {
                 $language = new MetaLanguage($langArray[0]->getLanguageId());
             }
         }
         if (!$language->defined()) {
             throw new InvalidArgumentException("Invalid language identifier in URL.", self::INVALID_LANGUAGE);
         }
         $cacheService->save($cacheKey, $language);
         return $language;
     }
 }
示例#8
0
}
?>
	</select></dd>
</dl>
<dl>
	<dt><label for="filter_language"><?php 
putGS('Language');
?>
</label></dt>
	<dd><select id="filter_name" name="language">
		<option value=""><?php 
putGS('All');
?>
</option>
		<?php 
foreach (Language::GetLanguages() as $language) {
    ?>
		<option value="<?php 
    echo $language->getLanguageId();
    ?>
"><?php 
    echo htmlspecialchars($language->getNativeName());
    ?>
</option>
		<?php 
}
?>
	</select></dd>
</dl>
</div>
</dd>
示例#9
0
    private function getFormMask($p_owner=false, $p_admin=false)
    {
        global $g_user;

        $data = $this->getData();

        foreach (User::GetUsers() as $User) {
            if (1 || $User->hasPermission('PLUGIN_BLOG_USER')) {
                $ownerList[$User->getUserId()] = "{$User->getRealName()} ({$User->getUserName()})";
            }
        }
        asort($ownerList);

        $languageList = array('' => getGS("---Select language---"));
        foreach (Language::GetLanguages() as $Language) {
            $languageList[$Language->getLanguageId()] = $Language->getNativeName();
        }
        asort($languageList);

        foreach ($data as $k => $v) {
            // clean user input
            if (!in_array($k, self::$m_html_allowed_fields)) {
                $data[$k] = camp_html_entity_decode_array($v);
            }
        }

        // load possible topic list
        foreach ($this->GetTopicTreeFlat() as $topicId => $topicName) {
            $topics[$topicId]  = $topicName;
        }

        // get the topics used
        foreach ($this->getTopics() as $Topic) {
            $active_topics[$Topic->getTopicId()] = $Topic->getName($this->getLanguageId());
        }

        $languageSelectedObj = new Language($data['fk_language_id']);
        $editorLanguage = !empty($_COOKIE['TOL_Language']) ? $_COOKIE['TOL_Language'] : $languageSelectedObj->getCode();

        $mask = array(
            'f_blog_id'    => array(
                'element'   => 'f_blog_id',
                'type'      => 'hidden',
                'constant'  => $data['blog_id']
            ),
            SecurityToken::SECURITY_TOKEN => array(
            	'element'   => SecurityToken::SECURITY_TOKEN,
            	'type'      => 'hidden',
            	'constant'  => SecurityToken::GetToken()
            ),
            'language' => array(
                    'element'   => 'Blog[fk_language_id]',
                    'type'      => 'select',
                    'label'     => getGS('Language'),
                    'default'   => $data['fk_language_id'],
                    'options'   => $languageList,
                    'required'  => true
            ),
            'title'     => array(
                'element'   => 'Blog[title]',
                'type'      => 'text',
                'label'     => getGS('Title'),
                'default'   => $data['title'],
                'required'  => true
            ),
            'tiny_mce'  => array(
                'element'   => 'tiny_mce',
                'text'      => self::GetEditor('tiny_mce_box', $g_user, $editorLanguage),
                'type'      => 'static'
            ),
            'info'      => array(
                'element'   => 'Blog[info]',
                'type'      => 'textarea',
                'label'     => getGS('Info'),
                'default'   => $data['info'],
                'required'  => true,
                'attributes'=> array('cols' => 86, 'rows' => 16, 'id' => 'tiny_mce_box', 'class' => 'tinymce')
            ),
            'feature'     => array(
                'element'   => 'Blog[feature]',
                'type'      => 'text',
                'label'     => getGS('Feature'),
                'default'   => $data['feature'],
            ),
            'status' => array(
                'element'   => 'Blog[status]',
                'type'      => 'select',
                'label'     => getGS('Status'),
                'default'   => $data['status'],
                'required'  => true,
                'options'   => array(
                    'online'        => getGS('online'),
                    'offline'       => getGS('offline'),
                    'moderated'     => getGS('moderated'),
                    'readonly'      => getGS('read only'),
                ),

            ),
            'admin_status' => array(
                'element'   => 'Blog[admin_status]',
                'type'      => 'select',
                'label'     => getGS('Admin status'),
                'default'   => $data['admin_status'],
                'required'  => true,
                'options'   => array(
                    'online'        => getGS('online'),
                    'offline'       => getGS('offline'),
                    'pending'       => getGS('pending'),
                    'moderated'     => getGS('moderated'),
                    'readonly'      => getGS('read only'),
                ),
            ),
            'owner' => array(
                    'element'   => 'Blog[fk_user_id]',
                    'type'      => 'select',
                    'label'     => getGS('Owner'),
                    'default'   => $data['fk_user_id'],
                    'options'   => $ownerList,
            ),
            'image'     => array(
                'element'   => 'Blog_Image',
                'type'      => 'file',
                'label'     => getGS('Image (.jpg, .png, .gif)'),
            ),
            'image_display'  => array(
                'element'   => 'image_display',
                'text'      => '<img src="'.$data['images']['100x100'].'">',
                'type'  => 'static',
                'groupit'   => true
            ),
            'image_remove' => array(
                'element'   => 'Blog_Image_remove',
                'type'      => 'checkbox',
                'label'     => getGS('Remove this image'),
                'groupit'   => true
            ),
            'image_label'  => array(
                'element'   => 'image_label',
                'text'      => getGS('Remove this image'),
                'type'  => 'static',
                'groupit'   => true
            ),
            'image_group' =>  isset($data['images']['100x100']) ? array(
                'group'     => array('image_display', 'Blog_Image_remove', 'image_label'),

            ) : null,
            'admin_remark'      => array(
                'element'   => 'Blog[admin_remark]',
                'type'      => 'textarea',
                'label'     => getGS('Admin remark'),
                'default'   => $data['admin_remark'],
                'attributes'=> array('cols' => 86, 'rows' => 10)
            ),
            'reset'     => array(
                'element'   => 'reset',
                'type'      => 'reset',
                'label'     => getGS('Reset'),
                'groupit'   => true
            ),
            'xsubmit'     => array(
                'element'   => 'xsubmit',
                'type'      => 'button',
                'label'     => getGS('Submit'),
                'attributes'=> array('onclick' => 'tinyMCE.triggerSave(); if (this.form.onsubmit()) this.form.submit()'),
                'groupit'   => true
            ),
            'cancel'     => array(
                'element'   => 'cancel',
                'type'      => 'button',
                'label'     => getGS('Cancel'),
                'attributes' => array('onClick' => 'window.close()'),
                'groupit'   => true
            ),
            'buttons'   => array(
                'group'     => array('cancel', 'reset', 'xsubmit')
            )
        );

        return $mask;
    }
示例#10
0
文件: index.php 项目: nidzix/Newscoop
<?php

require_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/topics/topics_common.php";
$f_show_languages = camp_session_get('f_show_languages', array());
$topics = Topic::GetTree();
// return value is sorted by language
$allLanguages = Language::GetLanguages(null, null, null, array(), array(), true);
$loginLanguageId = 0;
$loginLanguage = Language::GetLanguages(null, camp_session_get('TOL_Language', 'en'), null, array(), array(), true);
if (is_array($loginLanguage) && count($loginLanguage) > 0) {
    $loginLanguage = array_pop($loginLanguage);
    $loginLanguageId = $loginLanguage->getLanguageId();
}
if (count($f_show_languages) <= 0) {
    $f_show_languages = DbObjectArray::GetColumn($allLanguages, 'Id');
}
$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Topics"), "");
echo camp_html_breadcrumbs($crumbs);
camp_html_display_msgs("0.5em", 0);
?>

<form action="" method="post">
<fieldset class="controls">
    <legend><?php 
putGS("Show languages");
?>
</legend>
    <div class="buttons">
        <input type="button" value="<?php 
示例#11
0
    /**
     * Sets the URL values.
     *
     * Algorithm:
	 * - identify object (e.g.: publication, language, issue, section, article)
	 *     - object defined
	 *         - valid object?
	 *             - yes: set
	 *             - no: return error
	 *     - object undefined
	 *         - has default value?
	 *             - yes: set
	 *             - no:
	 *                 - object mandatory?
	 *                     - yes: return error
	 *                     - no: continue
     *
     * @return PEAR_Error
     *
     */
    private function setURL()
    {
        $this->setQueryVar('acid', null);

        $this->m_publication = null;
        $this->m_language = null;
        $this->m_issue = null;
        $this->m_section = null;
        $this->m_article = null;

        // gets the publication object based on site name (URI host)
        $alias = preg_replace('/^'.$this->getScheme().':\/\//', '', $this->getBase());
        $aliasObj = new Alias($alias);
        if ($aliasObj->exists()) {
            $this->m_publication = new MetaPublication($aliasObj->getPublicationId());
        }
        if (is_null($this->m_publication) || !$this->m_publication->defined()) {
            return new PEAR_Error("Invalid site name '$alias' in URL.", self::INVALID_SITE_NAME);
        }

        // reads parameters values if any
        $params = str_replace($this->m_config->getSetting('SUBDIR'), '', $this->getPath());
        $cParams = explode('/', trim($params, '/'));
        $cParamsSize = sizeof($cParams);
        if ($cParamsSize >= 1) {
            $cLangCode = $cParams[0];
        }
        if ($cParamsSize >= 2) {
            $cIssueSName = $cParams[1];
        }
        if ($cParamsSize >= 3) {
            $cSectionSName = $cParams[2];
        }
        if ($cParamsSize >= 4) {
            $cArticleSName = $cParams[3];
        }

        // gets the language identifier and sets the language code
        if (!empty($cLangCode)) {
            $langArray = Language::GetLanguages(null, $cLangCode);
            if (is_array($langArray) && sizeof($langArray) == 1) {
                $this->m_language = new MetaLanguage($langArray[0]->getLanguageId());
            }
        } else {
            $this->m_language = new MetaLanguage($this->m_publication->default_language->number);
        }
        if (is_null($this->m_language) || !$this->m_language->defined()) {
            return new PEAR_Error("Invalid language identifier in URL.", self::INVALID_LANGUAGE);
        }

        // gets the issue number and sets the issue short name
        if (!empty($cIssueSName)) {
        	$publishedOnly = !$this->m_preview;
            $issueArray = Issue::GetIssues($this->m_publication->identifier,
            $this->m_language->number, null, $cIssueSName, null, $publishedOnly);
            if (is_array($issueArray) && sizeof($issueArray) == 1) {
                $this->m_issue = new MetaIssue($this->m_publication->identifier,
                $this->m_language->number,
                $issueArray[0]->getIssueNumber());
            } else {
                return new PEAR_Error("Invalid issue identifier in URL.", self::INVALID_ISSUE);
	        }
        } else {
            $issueObj = Issue::GetCurrentIssue($this->m_publication->identifier,
            $this->m_language->number);
            $this->m_issue = new MetaIssue($this->m_publication->identifier,
            $this->m_language->number, $issueObj->getIssueNumber());
            if (!$this->m_issue->defined()) {
                return new PEAR_Error("No published issue was found.", self::INVALID_ISSUE);
            }
        }

        // gets the section number and sets the section short name
        if (!empty($cSectionSName)) {
            $sectionArray = Section::GetSections($this->m_publication->identifier,
            $this->m_issue->number,
            $this->m_language->number,
            $cSectionSName);
            if (is_array($sectionArray) && sizeof($sectionArray) == 1) {
                $this->m_section = new MetaSection($this->m_publication->identifier,
                $this->m_issue->number,
                $this->m_language->number,
                $sectionArray[0]->getSectionNumber());
            } else {
                return new PEAR_Error("Invalid section identifier in URL.", self::INVALID_SECTION);
            }
        }

        // gets the article number and sets the article short name
        if (!empty($cArticleSName)) {
            // we pass article short name as article identifier as they are
            // the same for Campsite, we will have to change this in the future
            $articleObj = new Article($this->m_language->number, $cArticleSName);
            if (!$articleObj->exists() || (!$this->m_preview && !$articleObj->isPublished())) {
                return new PEAR_Error("Invalid article identifier in URL.", self::INVALID_ARTICLE);
            }
            $this->m_article = new MetaArticle($this->m_language->number,
            $articleObj->getArticleNumber());
        }

        $templateId = CampRequest::GetVar(CampRequest::TEMPLATE_ID);
        $this->m_template = new MetaTemplate($this->getTemplate($templateId));
        if (!$this->m_template->defined()) {
            return new PEAR_Error("Invalid template in URL or no default template specified.",
            self::INVALID_TEMPLATE);
        }

        $this->m_validURI = true;
        $this->validateCache(false);
    } // fn setURL
示例#12
0
 public static function GetCampLanguagesList()
 {
     foreach (Language::GetLanguages() as $Language) {
         $languageList[$Language->getLanguageId()] = $Language->getNativeName();
     }
     asort($languageList);
     return $languageList;
 }
示例#13
0
 /**
  * Get language by code
  *
  * @param string $code
  * @param MetaPublication $publication
  * @return MetaLanguage
  */
 private function _getLanguage($code, MetaPublication $publication)
 {
     if (!empty($code)) {
         $langArray = Language::GetLanguages(null, $code);
         if (is_array($langArray) && sizeof($langArray) == 1) {
             $language = new MetaLanguage($langArray[0]->getLanguageId());
         }
     } else {
         $language = $publication->default_language;
     }
     if (empty($language) || !$language->defined()) {
         throw new InvalidArgumentException("Invalid language identifier in URL.", self::INVALID_LANGUAGE);
     }
     return $language;
 }
示例#14
0
 /**
  * Get language
  *
  * @param string $code
  * @return int
  */
 public function getLanguage($code)
 {
     $languages = \Language::GetLanguages(null, $code);
     if (empty($languages)) {
         throw new \InvalidArgumentException("Language with code '{$code}' not found");
     }
     return array_shift($languages)->getLanguageId();
 }
示例#15
0
<?php

camp_load_translation_strings("plugin_debate");
// Check permissions
if (!$g_user->hasPermission('plugin_debate_admin')) {
    camp_html_display_error(getGS('You do not have the right to manage debates.'));
    exit;
}
$allLanguages = Language::GetLanguages();
$f_debate_nr = Input::Get('f_debate_nr', 'int');
$f_fk_language_id = Input::Get('f_fk_language_id', 'int');
$debate = new Debate($f_fk_language_id, $f_debate_nr);
if ($debate->exists()) {
    foreach ($debate->getTranslations() as $translation) {
        $existing[$translation->getLanguageId()] = true;
    }
    $title = $debate->getProperty('title');
    $question = $debate->getProperty('question');
    $is_used_as_default = false;
}
echo camp_html_breadcrumbs(array(array(getGS('Plugins'), $Campsite['WEBSITE_URL'] . '/admin/plugins/manage.php'), array(getGS('Debates'), $Campsite['WEBSITE_URL'] . '/admin/debate/index.php'), array(getGS('Translate Debate'), '')));
?>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" class="action_buttons" style="padding-top: 5px;">
<TR>
    <TD><A HREF="index.php"><IMG SRC="<?php 
echo $Campsite["ADMIN_IMAGE_BASE_URL"];
?>
/left_arrow.png" BORDER="0"></A></TD>
    <TD><A HREF="index.php"><B><?php 
putGS("Debate List");
?>
示例#16
0
文件: Topic.php 项目: nidzix/Newscoop
 /**
  * Returns a topic object identified by the full name in the
  * format topic_name:language_code
  *
  * @param string $p_fullName
  * @return Topic object
  */
 public static function GetByFullName($p_fullName)
 {
     $p_fullName = trim($p_fullName);
     $last_colon_pos = strrpos($p_fullName, ':');
     if (!$last_colon_pos) {
         // both none colon and a single colon as a string start are wrong
         return null;
     }
     $name = substr($p_fullName, 0, $last_colon_pos);
     $languageCode = substr($p_fullName, $last_colon_pos + 1);
     $languages = Language::GetLanguages(null, $languageCode, null, array(), array(), false);
     if (count($languages) < 1) {
         return null;
     }
     $languageObject = $languages[0];
     $topics = Topic::GetTopics(null, $languageObject->getLanguageId(), $name);
     if (count($topics) < 1) {
         return null;
     }
     return $topics[0];
 }
示例#17
0
<?php
require_once($GLOBALS['g_campsiteDir']."/$ADMIN_DIR/issues/issue_common.php");

// Check permissions
if (!$g_user->hasPermission('ManageIssue')) {
	camp_html_display_error(getGS('You do not have the right to add issues.'));
	exit;
}

$Pub = Input::Get('Pub', 'int');
if (!Input::IsValid()) {
	camp_html_display_error(getGS('Invalid Input: $1', Input::GetErrorString()));
	exit;
}
$publicationObj = new Publication($Pub);
$allLanguages = Language::GetLanguages(null, null, null, array(), array(), true);
$newIssueId = Issue::GetUnusedIssueId($Pub);
$lastCreatedIssue = Issue::GetLastCreatedIssue($Pub);

include_once($GLOBALS['g_campsiteDir']."/$ADMIN_DIR/javascript_common.php");

camp_html_content_top(getGS('Copy previous issue'), array('Pub' => $publicationObj), true, true, array(getGS("Issues") => "/$ADMIN/issues/?Pub=$Pub"));


if (is_null($lastCreatedIssue)) { ?>
    <BLOCKQUOTE>
	<LI><?php  putGS('No previous issue.'); ?></LI>
    </BLOCKQUOTE>
    <?php
} else {
	camp_html_display_msgs();
示例#18
0
	/**
	 * Returns a topic object identified by the full name in the
	 * format topic_name:language_code
	 *
	 * @param string $p_fullName
	 * @return Topic object
	 */
	public static function GetByFullName($p_fullName)
	{
	    $components = preg_split('/:/', trim($p_fullName));
	    if (count($components) < 2) {
	        return null;
	    }
	    $name = $components[0];
	    $languageCode = $components[1];

	    $languages = Language::GetLanguages(null, $languageCode, null, array(), array(), false);
	    if (count($languages) < 1) {
	        return null;
	    }
        $languageObject = $languages[0];

        $topics = Topic::GetTopics(null, $languageObject->getLanguageId(), $name);
	    if (count($topics) < 1) {
	        return null;
	    }

	    return $topics[0];
	} // fn GetByFullName