Example #1
0
	/**
	 * Gets the translation for a given language; default language is the
	 * session language.  If no translation is set for that language, we
	 * return the dbTableName.
     *
	 * @param int p_lang
	 *
	 * @return string
	 */
	public function getDisplayName($p_lang = 0)
	{
		if (!$p_lang) {
			$lang = camp_session_get('LoginLanguageId', 1);
		} else {
			$lang = $p_lang;
		}
		$aObj = new ArticleType($this->m_articleTypeName);
		$translations = $aObj->getTranslations();
		if (!isset($translations[$lang])) return substr($aObj->getTableName(), 1);
		return $translations[$lang];

	} // fn getDisplayName
Example #2
0
function read_user_common_parameters()
{
    global $uType, $userOffs, $ItemsPerPage;
    global $defaultUserSearchParameters, $userSearchParameters;
    $uType = Input::Get('uType', 'string', '');
    $userOffs = camp_session_get('userOffs', 0);
    if ($userOffs < 0) {
        $userOffs = 0;
    }
    $ItemsPerPage = Input::Get('ItemsPerPage', 'int', 20);
    foreach ($userSearchParameters as $parameter => $defaultValue) {
        $userSearchParameters[$parameter] = camp_session_get($parameter, $defaultUserSearchParameters[$parameter]);
    }
}
Example #3
0
<?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 
Example #4
0
    }
    ?>
    </SELECT>


	</TD>
</TR>
<tr style="display: none;" id="topic_list">
	<td align="right"><?php 
    putGS("Top element");
    ?>
:</td>
	<td>
		<select name="f_root_topic_id" class="input_select">
<?php 
    $TOL_Language = camp_session_get('LoginLanguageId', 1);
    $lang = new Language($TOL_Language);
    $currentLanguageId = $lang->getLanguageId();
    //$currentLanguages = Language::GetLanguages(null, $TOL_Language);
    //$currentLanguageId = $currentLanguages[0]->getLanguageId();
    $topics = Topic::GetTree();
    foreach ($topics as $topicPath) {
        $printTopic = array();
        foreach ($topicPath as $topicId => $topic) {
            $translations = $topic->getTranslations();
            if (array_key_exists($currentLanguageId, $translations)) {
                $currentTopic = $translations[$currentLanguageId];
            } elseif ($currentLanguageId != 1 && array_key_exists(1, $translations)) {
                $currentTopic = $translations[1];
            } else {
                $currentTopic = end($translations);
Example #5
0
            header("HTTP/1.1 404 Not found");
            exit;
        }
    }

    // Clean up the global namespace before we call the script
    unset($access);
    unset($extension);
    unset($extension_start);
    unset($question_mark);
    unset($no_menu_scripts);
    unset($request_uri);

    // Restore POST request
    $requestId = Input::Get('request', 'string', '', TRUE);
    $request = camp_session_get("request_$requestId", '');
    if (!empty($request)) {
        $request = unserialize($request);

        // Update security token.
        $token_field = SecurityToken::SECURITY_TOKEN;
        $request['post'][$token_field] = SecurityToken::GetToken();

        // Set values.
        foreach ($request['post'] as $key => $val) {
            $_POST[$key] = $_REQUEST[$key] = $val;
        }
    }

    if (file_exists($Campsite['HTML_DIR'] . '/reset_cache')) {
        CampCache::singleton()->clear('user');
Example #6
0
camp_load_translation_strings("logs");
camp_load_translation_strings("api");
require_once($GLOBALS['g_campsiteDir']."/classes/Language.php");
require_once($GLOBALS['g_campsiteDir']."/classes/User.php");
require_once($GLOBALS['g_campsiteDir']."/classes/Input.php");
require_once($GLOBALS['g_campsiteDir']."/classes/Log.php");
require_once($GLOBALS['g_campsiteDir'].'/classes/Event.php');
require_once($GLOBALS['g_campsiteDir'].'/classes/SimplePager.php');

if (!$g_user->hasPermission('ViewLogs')) {
	camp_html_display_error(getGS("You do not have the right to view logs."));
	exit;
}

$f_event_search_id = Input::Get('f_event_search_id', 'int', null, true);
$f_log_page_offset = camp_session_get('f_log_page_offset', 0);
if ($f_event_search_id == 0) {
	$f_event_search_id = null;
}

$events = Event::GetEvents();
if ($f_log_page_offset < 0) {
	$f_log_page_offset = 0;
}
$ItemsPerPage = 15;

$logs = Log::GetLogs($f_event_search_id,
	array('LIMIT' => array('MAX_ROWS' => $ItemsPerPage, 'START' => $f_log_page_offset)));
$numLogLines = Log::GetNumLogs($f_event_search_id);

$pager = new SimplePager($numLogLines, $ItemsPerPage, "f_log_page_offset", "index.php?f_event_search_id=".urlencode($f_event_search_id)."&");
Example #7
0
<?php

camp_load_translation_strings("article_type_fields");
camp_load_translation_strings("api");
require_once $GLOBALS['g_campsiteDir'] . '/classes/Input.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/ArticleType.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Translation.php';
if (!Saas::singleton()->hasPermission('ManageArticleTypes')) {
    camp_html_display_error(getGS("You do not have the right to manage article types."));
    exit;
}
$articleTypeName = Input::Get('f_article_type');
// return value is sorted by language
$allLanguages = Language::GetLanguages(null, null, null, array(), array(), true);
$lang = camp_session_get('LoginLanguageId', 1);
$languageObj = new Language($lang);
$articleType = new ArticleType($articleTypeName);
$fields = $articleType->getUserDefinedColumns(null, true, true);
$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Article Types"), "/{$ADMIN}/article_types/");
$crumbs[] = array($articleTypeName, "");
$crumbs[] = array(getGS("Article type fields"), "");
echo camp_html_breadcrumbs($crumbs);
$row_rank = 0;
if ($g_user->hasPermission("ManageArticleTypes")) {
    include_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/javascript_common.php";
    ?>
<script>
var field_ids = new Array;
var allShown = 0;
Example #8
0
	/**
	 * SimplePager, unlike the PEAR Pager class, is a pager made to work
	 * with template-like layouts. The constructor sets up the variables
	 * you need to render the links, and you can render them
	 * however you like.  There is a default render function for
	 * reference.
	 *
	 * @param int $p_totalItems
	 * 		Total number of items.
	 *
	 * @param int $p_itemsPerPage
	 * 		Number of items to display per page.
	 *
	 * @param string $p_offsetVarName
	 * 		The name of the REQUEST variable which holds the order number
	 * 		of the first item on the selected page.
	 *
	 * @param string $p_baseUrl
	 * 		The url to which we attach the offset variable name.
	 *
	 * @param boolean $p_useSessions
	 * 		Set to TRUE if you want the offset item number to be stored in
	 * 		the session so that the user will return to their previous
	 * 		position in the pager when they leave the screen and come back
	 * 		to it.
	 */
	public function SimplePager($p_totalItems, $p_itemsPerPage, $p_offsetVarName,
	                            $p_baseUrl, $p_useSessions = true, $p_width = 10)
	{
	    global $_REQUEST;

		$this->m_urls["links"] = array();
		if ($p_totalItems < 0) {
			$p_totalItems = 0;
		}
		if ($p_itemsPerPage < 1) {
			$p_itemsPerPage = 1;
		}

		// Get the current page number.
		if ($p_useSessions) {
			$this->m_offset = camp_session_get($p_offsetVarName, 0);
		} else {
			$this->m_offset = isset($_REQUEST[$p_offsetVarName]) ? $_REQUEST[$p_offsetVarName] : 0;
		}
		if ($this->m_offset < 0) {
			$this->m_offset = 0;
		} elseif ( ($this->m_offset) > $p_totalItems) {
		    // If the offset is past the total number of items,
		    // reset it.
		    $this->m_offset = 0;
		    if ($p_useSessions) {
		        camp_session_set($p_offsetVarName, 0);
		    }
		}

		// Only generate pager if there is more than one page of information.
		if ($p_totalItems > $p_itemsPerPage) {

			// Generate the offsets into the list.
			$remainder = $p_totalItems % $p_itemsPerPage;
			if ($remainder == 0) {
				$this->m_offsets = SimplePager::_range(0, $p_totalItems-1, $p_itemsPerPage);
			} else {
				$this->m_offsets = SimplePager::_range(0, $p_totalItems, $p_itemsPerPage);
			}

			$this->m_numPages = count($this->m_offsets);
			$this->m_selectedPageNumber = floor($this->m_offset/$p_itemsPerPage)+1;

			if ($p_width > $this->m_numPages) {
				$p_width = $this->m_numPages;
			}

			// Generate the numbered links
			if ($this->m_selectedPageNumber < ($p_width/2 + 1)) {
				$begin = 0;
				$end = $p_width;
			} else if ($this->m_selectedPageNumber > ($this->m_numPages - ($p_width/2))) {
				$begin = $this->m_numPages - $p_width;
				$end = $this->m_numPages;
			} else {
				$begin = $this->m_selectedPageNumber - ceil($p_width/2) - 1;
				$end = $this->m_selectedPageNumber + ceil($p_width/2);
			}
			for ($index = $begin; $index < $end; $index++) {
				$this->m_urls["links"][$index+1] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[$index];
			}

			// Generate special links.
			if ($this->m_selectedPageNumber > 1) {
    			$this->m_urls["first"] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[0];
	       		$this->m_urls["previous"] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[max(0, $this->m_selectedPageNumber-2)];
			}
	       	if ($this->m_selectedPageNumber > 10) {
				$this->m_urls["previous_10_pages"] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[max(0, $this->m_selectedPageNumber-11)];
			}
			if ($this->m_selectedPageNumber > 100) {
				$this->m_urls["previous_100_pages"] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[max(0, $this->m_selectedPageNumber-101)];
			}
			if ( ($this->m_numPages > $this->m_selectedPageNumber)) {
    			$this->m_urls["next"] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[min($this->m_numPages-1, $this->m_selectedPageNumber)];
			}
    		if ( ($this->m_numPages - $this->m_selectedPageNumber) > 9) {
				$this->m_urls["next_10_pages"] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[min($this->m_numPages-1, $this->m_selectedPageNumber+9)];
			}
			if ( ($this->m_numPages - $this->m_selectedPageNumber) > 99) {
				$this->m_urls["next_100_pages"] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[min($this->m_numPages-1, $this->m_selectedPageNumber+99)];
			}
			if ( ($this->m_numPages > $this->m_selectedPageNumber)) {
    			$this->m_urls["last"] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[$this->m_numPages-1];
			}
		}
	} // constructor
Example #9
0
camp_load_translation_strings('api');
require_once($GLOBALS['g_campsiteDir'].'/include/campsite_constants.php');
require_once($GLOBALS['g_campsiteDir']."/$ADMIN_DIR/articles/article_common.php");
require_once($GLOBALS['g_campsiteDir'].'/classes/Image.php');
require_once($GLOBALS['g_campsiteDir'].'/classes/ImageSearch.php');

if (!$g_user->hasPermission("AttachImageToArticle")) {
	$errorStr = getGS('You do not have the right to attach images to articles.');
	camp_html_display_error($errorStr, null, true);
	exit;
}

$f_language_id = Input::Get('f_language_id', 'int', 0);
$f_language_selected = Input::Get('f_language_selected', 'int', 0);
$f_article_number = Input::Get('f_article_number', 'int', 0);
$f_image_attach_mode = camp_session_get('f_image_attach_mode', 'new');

if (!Input::IsValid()) {
	camp_html_display_error(getGS('Invalid input: $1', Input::GetErrorString()), $_SERVER['REQUEST_URI'], true);
	exit;
}

$articleObj = new Article($f_language_selected, $f_article_number);
?>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <meta http-equiv="Expires" content="now" />
  <link rel="stylesheet" type="text/css" href="<?php echo $Campsite['ADMIN_STYLE_URL']; ?>/admin_stylesheet_new.css" />
  <link rel="stylesheet" type="text/css" href="<?php echo $Campsite['ADMIN_STYLE_URL']; ?>/admin_stylesheet.css" />
  <title><?php putGS("Attach Image To Article"); ?></title>
Example #10
0
<?php

require_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/pub/pub_common.php";
require_once $GLOBALS['g_campsiteDir'] . "/classes/SimplePager.php";
camp_load_translation_strings("api");
// Check permissions
$PubOffs = camp_session_get('PubOffs', 0);
if ($PubOffs < 0) {
    $PubOffs = 0;
}
$ItemsPerPage = 15;
$sqlOptions = array("LIMIT" => array("START" => $PubOffs, "MAX_ROWS" => $ItemsPerPage), "ORDER BY" => array("Name" => "ASC"));
$publications = Publication::GetPublications(null, null, $sqlOptions);
$numPublications = Publication::GetNumPublications();
$pager = new SimplePager($numPublications, $ItemsPerPage, "PubOffs", "index.php?");
camp_html_content_top(getGS('Publication List'), null);
if ($g_user->hasPermission("ManagePub") && SaaS::singleton()->hasPermission("AddPub")) {
    ?>
<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" class="action_buttons">
<TR>
	<TD>
		<A HREF="/<?php 
    echo $ADMIN;
    ?>
/pub/add.php?Back=<?php 
    p(urlencode($_SERVER['REQUEST_URI']));
    ?>
"><IMG SRC="<?php 
    echo $Campsite["ADMIN_IMAGE_BASE_URL"];
    ?>
Example #11
0
                    <select class="input_select" name="<?php 
            echo $dbColumn->getName();
            ?>
" id="<?php 
            echo $dbColumn->getName();
            ?>
" <?php 
            if ($f_edit_mode != "edit") {
                ?>
disabled<?php 
            }
            ?>
>
                    <option value="0"></option>
                    <?php 
            $TOL_Language = camp_session_get('TOL_Language', 'en');
            $currentLanguage = new Language($TOL_Language);
            $currentLanguageId = $currentLanguage->getLanguageId();
            foreach ($subtopics as $topicPath) {
                $printTopic = array();
                foreach ($topicPath as $topicId => $topic) {
                    $translations = $topic->getTranslations();
                    if (array_key_exists($currentLanguageId, $translations)) {
                        $currentTopic = $translations[$currentLanguageId];
                    } elseif ($currentLanguageId != 1 && array_key_exists(1, $translations)) {
                        $currentTopic = $translations[1];
                    } else {
                        $currentTopic = end($translations);
                    }
                    $printTopic[] = $currentTopic;
                }
Example #12
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
Example #13
0
$numArticles = count($articles);
$numArticlesDeleted = 0;
$f_delete_all_section_translations = $f_delete_all_section_translations == 'Y' ? true : false;
$f_delete_all_articles_translations = $f_delete_all_articles_translations == 'Y' ? true : false;
if ($f_delete_all_section_translations == false) {
    $numArticlesDeleted = $sectionObj->delete(true, $f_delete_all_articles_translations);
    $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
    $cacheService->clearNamespace('section');
} else {
    $sectionTranslations = Section::GetSections($f_publication_id, $f_issue_number, null, null, $sectionObj->getName(), null);
    foreach ($sectionTranslations as $key => $sectionTranslation) {
        $numArticlesDeleted += $sectionTranslation->delete(true, $f_delete_all_articles_translations);
    }
}
$offsetVarName = 'SectOffs_' . $f_publication_id . '_' . $f_issue_number . '_' . $f_language_id;
$SectOffs = camp_session_get($offsetVarName, 0);
$totalSections = Section::GetTotalSections($f_publication_id, $f_issue_number, $f_language_id);
if ($SectOffs >= $totalSections) {
    camp_session_set($offsetVarName, 0);
}
$topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj, 'Section' => $sectionObj);
camp_html_content_top($translator->trans('Delete section', array(), 'sections'), $topArray);
?>

<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
<TR>
	<TD COLSPAN="2">
		<B> <?php 
echo $translator->trans("Deleting section", array(), 'sections');
?>
Example #14
0
/**
 * Register a string in the global translation file. (Legacy code for GS files)
 *
 * @param string $p_value
 * @param string $p_key
 * @return void
 */
function regGS($p_key, $p_value)
{
	global $g_translationStrings;
	if (isset($g_translationStrings[$p_key])) {
		if ($p_key!='') {
			print "The global string is already set in ".$_SERVER['PHP_SELF'].": $p_key<BR>";
		}
	}
	else{
		if (substr($p_value, strlen($p_value)-3)==(":".camp_session_get('TOL_Language', 'en'))){
			$p_value = substr($p_value, 0, strlen($p_value)-3);
		}
		$g_translationStrings[$p_key] = $p_value;
	}
} // fn regGS
Example #15
0
<?php

$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
    // ignore for logged user
    return;
}
$f_user_name = Input::Get('f_user_name');
$f_password = Input::Get('f_password');
$f_login_language = Input::Get('f_login_language', 'string', 'en');
$f_is_encrypted = Input::Get('f_is_encrypted', 'int', '1');
$f_captcha_code = Input::Get('f_captcha_code', 'string', '', true);
$xorkey = camp_session_get('xorkey', '');
if (trim($xorkey) == '') {
    return 'xorkey';
}
if (!Input::isValid()) {
    return 'userpass';
}
$t_password = rc4($xorkey, base64ToText($f_password));
//
// Valid logins
//
// if user valid, password valid, encrypted, no CAPTCHA -> login
// if user valid, password valid, encrypted, CAPTCHA valid -> login
// if user valid, password valid, not encrypted, no CAPTCHA -> login, upgrade
// if user valid, password valid, not encrypted, CAPTCHA valid -> login, upgrade
//
// Invalid logins
//
// CAPTCHA invalid -> captcha
Example #16
0
<?php

require_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/country/country_common.php";
require_once $GLOBALS['g_campsiteDir'] . "/classes/SimplePager.php";
camp_load_translation_strings("api");
if (!$g_user->hasPermission('ManageCountries') && !$g_user->hasPermission('DeleteCountries')) {
    camp_html_goto_page("/{$ADMIN}/");
}
$f_country_language_selected = camp_session_get('f_country_language_selected', '');
$f_country_offset = camp_session_get('f_country_offset', 0);
if (empty($f_country_language_selected)) {
    $f_country_language_selected = null;
}
$ItemsPerPage = 20;
$languages = Language::GetLanguages(null, null, null, array(), array(), true);
$countries = Country::GetCountries($f_country_language_selected, null, null, array("LIMIT" => array("START" => $f_country_offset, "MAX_ROWS" => $ItemsPerPage)));
$numCountries = Country::GetNumCountries($f_country_language_selected);
$pager = new SimplePager($numCountries, $ItemsPerPage, "f_country_offset", "index.php?");
$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Countries"), "");
echo camp_html_breadcrumbs($crumbs);
?>

<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="3" class="action_buttons">
<?php 
if ($g_user->hasPermission("ManageCountries")) {
    ?>
<TR>
	<TD>
Example #17
0
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;">
<TR>
	<TD><A HREF="/<?php echo $ADMIN; ?>/pub/"><IMG SRC="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/left_arrow.png" BORDER="0"></A></TD>
	<TD><A HREF="/<?php echo $ADMIN; ?>/pub/"><B><?php  putGS("Publication List"); ?></B></A></TD>
Example #18
0
 case 'move':
     $args = array_merge($_REQUEST, $f_params);
     unset($args["f_article_code"]);
     $argsStr = camp_implode_keys_and_values($args, "=", "&");
     $argsStr .= '&f_mode=multi&f_action=';
     $argsStr .= $f_action == 'move' ? 'move' : 'duplicate';
     $argsStr .= '&f_language_selected=' . (int) camp_session_get('f_language_selected', 0);
     foreach ($flatArticleCodes as $articleCode) {
         $argsStr .= '&f_article_code[]=' . $articleCode;
     }
     return returnJson(0, '', 0, '', $Campsite['WEBSITE_URL'] . "/admin/articles/duplicate.php?" . $argsStr);
     break;
 case 'publish_schedule':
     $args = array_merge($_REQUEST, $f_params);
     $argsStr = camp_implode_keys_and_values($args, "=", "&");
     $argsStr .= '&f_language_selected=' . (int) camp_session_get('f_language_selected', 0);
     foreach ($flatArticleCodes as $articleCode) {
         $argsStr .= '&f_article_code[]=' . $articleCode;
     }
     return returnJson(0, '', 0, '', $Campsite['WEBSITE_URL'] . "/admin/articles/multi_autopublish.php?" . $argsStr);
     break;
 case 'context_box_update':
     $contextContent = prepareContextBoxItems($f_params);
     $articleObj = new Article($f_language_selected, $contextContent['f_article_id']);
     if ($articleObj->userCanModify($g_user)) {
         $contextBoxObj = new ContextBox(null, $contextContent['f_article_id']);
         $contextId = $contextBoxObj->getId();
         $relatedItems = array_filter($contextContent['f_related_items'], 'is_numeric');
         ContextBoxArticle::saveList($contextId, $relatedItems);
         $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
         $cacheService->clearNamespace('boxarticles');
Example #19
0
$f_language_id = Input::Get('Language', 'int', 0);
if (!Input::IsValid()) {
    camp_html_display_error($translator->trans('Invalid input: $1', array('$1' => Input::GetErrorString())), $_SERVER['REQUEST_URI']);
    exit;
}
$publicationObj = new Publication($f_publication_id);
$issueObj = new Issue($f_publication_id, $f_language_id, $f_issue_number);
$newSectionNumber = Section::GetUnusedSectionNumber($f_publication_id, $f_issue_number);
$topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj);
camp_html_content_top($translator->trans('Add new section', array(), 'sections'), $topArray, true, true, array($translator->trans("Sections") => "/{$ADMIN}/sections/?Pub={$f_publication_id}&Issue={$f_issue_number}&Language={$f_language_id}"));
$controller->view->headTitle($translator->trans('Add new section', array(), 'sections') . ' - Newscoop Admin', 'SET');
$languageObj = new Language($f_language_id);
if (!is_object($languageObj)) {
    $languageObj = new Language(1);
}
$editorLanguage = camp_session_get('TOL_Language', $languageObj->getCode());
editor_load_tinymce('f_description', $g_user, 0, $editorLanguage, 'section');
?>
<p>
<form name="section_add" method="POST" action="/<?php 
echo $ADMIN;
?>
/sections/do_add.php" onsubmit="return <?php 
camp_html_fvalidate();
?>
;">
<?php 
echo SecurityToken::FormParameter();
?>
<table border="0" cellspacing="0" cellpadding="0" class="box_table">
<tr>
Example #20
0
<?php

require_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/issues/issue_common.php";
require_once $GLOBALS['g_campsiteDir'] . "/classes/SimplePager.php";
require_once $GLOBALS['g_campsiteDir'] . "/classes/IssuePublish.php";
$translator = \Zend_Registry::get('container')->getService('translator');
$Pub = Input::Get('Pub', 'int', 0);
$IssOffs = camp_session_get("IssOffs_{$Pub}", 0);
if ($IssOffs < 0) {
    $IssOffs = 0;
}
$ItemsPerPage = 15;
if (!Input::IsValid()) {
    camp_html_display_error($translator->trans('Invalid input: $1', array('$1' => Input::GetErrorString()), 'issues'), $_SERVER['REQUEST_URI']);
    exit;
}
$publicationObj = new Publication($Pub);
$allIssues = Issue::GetIssues($Pub, null, null, null, $publicationObj->getLanguageId(), false, array('LIMIT' => array('START' => $IssOffs, 'MAX_ROWS' => $ItemsPerPage)), true);
$totalIssues = Issue::GetNumIssues($Pub);
$pager = new SimplePager($totalIssues, $ItemsPerPage, "IssOffs_{$Pub}", "index.php?Pub={$Pub}&");
include_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/javascript_common.php";
camp_html_content_top($translator->trans('Issue List'), array('Pub' => $publicationObj));
$controller->view->headTitle($translator->trans('Issue List') . ' - Newscoop Admin', 'SET');
?>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" class="action_buttons" style="padding-top: 5px;">
<TR>
    <TD><A HREF="<?php 
echo \Zend_Registry::get('container')->get('router')->generate('newscoop_newscoop_publications_index');
?>
"><IMG SRC="<?php 
echo $Campsite["ADMIN_IMAGE_BASE_URL"];
Example #21
0
<fieldset class="plain" style="margin-top: 13px">
    <input type="submit" name="Save" value="<?php 
echo $translator->trans('Save');
?>
" class="save-button" />
</fieldset>

</form>

</div>

<?php 
// Load tinymce once for all textareas
if (count($loadAsRichtext) > 0) {
    $languageSelectedObj = new Language((int) camp_session_get('LoginLanguageId', 0));
    $editorLanguage = !empty($_COOKIE['TOL_Language']) ? $_COOKIE['TOL_Language'] : $languageSelectedObj->getCode();
    $editorOptions = array('max_chars' => $captionLimit, 'toolbar_length' => 15);
    editor_load_tinymce($loadAsRichtext, $g_user, $editorLanguage, $editorOptions);
}
?>

<script type="text/javascript">
/**
 * Copy field value to all fields of that name.
 *
 * @param string field
 * @param int imageId
 *
 * @return void
 */
Example #22
0
$numArchive = 0;
if (!isset($connectedToOnlineServer)
        || $connectedToOnlineServer == true) {
    $numInbox = ArticleComment::GetComments('unapproved', true, $f_comment_search);
    $numArchive = ArticleComment::GetComments('approved', true, $f_comment_search);

    if ($f_comment_screen == 'inbox') {
        $pager = new SimplePager($numInbox, $f_comment_per_page, 'f_comment_start_inbox', "/$ADMIN/comments/index.php?");
    } elseif ($f_comment_screen == 'archive') {
        $pager = new SimplePager($numArchive, $f_comment_per_page, 'f_comment_start_archive', "/$ADMIN/comments/index.php?");
    }

    // This is here again on purpose because sometimes the pager
    // must correct this value.
    $f_comment_start_inbox = camp_session_get('f_comment_start_inbox', 0);
    $f_comment_start_archive = camp_session_get('f_comment_start_archive', 0);

    if ($f_comment_screen == 'inbox') {
        $comments = ArticleComment::GetComments('unapproved', false,
                                                $f_comment_search,
                                                array('ORDER BY' => array($f_comment_order_by => $f_comment_order_direction),
                                                      'LIMIT' => array('START'=> $f_comment_start_inbox,
                                                                       'MAX_ROWS' => $f_comment_per_page)));
    } elseif ($f_comment_screen == 'archive') {
        $comments = ArticleComment::GetComments('approved', false,
                                                $f_comment_search,
                                                array('ORDER BY' => array($f_comment_order_by => $f_comment_order_direction),
                                                      'LIMIT' => array('START'=> $f_comment_start_archive,
                                                                       'MAX_ROWS' => $f_comment_per_page)));
    }
}
Example #23
0
<?php

require_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/sections/section_common.php";
require_once $GLOBALS['g_campsiteDir'] . '/classes/SimplePager.php';
$translator = \Zend_Registry::get('container')->getService('translator');
$Pub = Input::Get('Pub', 'int', 0);
$Issue = Input::Get('Issue', 'int', 0);
$Language = Input::Get('Language', 'int', 0);
$SectOffs = camp_session_get("SectOffs_" . $Pub . "_" . $Issue . "_" . $Language, 0);
if ($SectOffs < 0) {
    $SectOffs = 0;
}
$ItemsPerPage = 15;
if (!Input::IsValid()) {
    camp_html_display_error($translator->trans('Invalid input: $1', array('$1' => Input::GetErrorString())), $_SERVER['REQUEST_URI']);
    exit;
}
$publicationObj = new Publication($Pub);
$issueObj = new Issue($Pub, $Language, $Issue);
$allSections = Section::GetSections($Pub, $Issue, $Language, null, null, array('ORDER BY' => 'Number', 'LIMIT' => array('START' => $SectOffs, 'MAX_ROWS' => $ItemsPerPage)), true);
$totalSections = Section::GetTotalSections($Pub, $Issue, $Language);
$pager = new SimplePager($totalSections, $ItemsPerPage, "SectOffs_" . $Pub . "_" . $Issue . "_" . $Language, "index.php?Pub={$Pub}&Issue={$Issue}&Language={$Language}&");
$topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj);
camp_html_content_top($translator->trans('Section List'), $topArray);
$controller->view->headTitle($translator->trans('Section List') . ' - Newscoop Admin', 'SET');
?>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" class="action_buttons" style="padding-top: 5px;">
<TR>
	<TD><A HREF="/<?php 
echo $ADMIN;
?>
Example #24
0
<?php

camp_load_translation_strings("article_images");
require_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/articles/article_common.php";
require_once $GLOBALS['g_campsiteDir'] . '/classes/Image.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/ImageSearch.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/SimplePager.php';
$f_order_by = camp_session_get('f_order_by', 'id');
$f_order_direction = camp_session_get('f_order_direction', 'ASC');
$f_image_offset = camp_session_get('f_image_offset', 0);
$f_search_string = camp_session_get('f_search_string', '');
$f_items_per_page = camp_session_get('f_items_per_page', 4);
$f_source_filter_out = !isset($_REQUEST['f_source_all']) ? 'newsfeed' : false;
if ($f_items_per_page < 4) {
    $f_items_per_page = 4;
}
if (!Input::IsValid()) {
    camp_html_display_error(getGS('Invalid input: $1', Input::GetErrorString()), $_SERVER['REQUEST_URI'], true);
    exit;
}
// Build the links for ordering search results
$OrderSign = '';
if ($f_order_direction == 'DESC') {
    $ReverseOrderDirection = "ASC";
    $OrderSign = "<img src=\"" . $Campsite["ADMIN_IMAGE_BASE_URL"] . "/descending.png\" border=\"0\">";
} else {
    $ReverseOrderDirection = "DESC";
    $OrderSign = "<img src=\"" . $Campsite["ADMIN_IMAGE_BASE_URL"] . "/ascending.png\" border=\"0\">";
}
$TotalImages = Image::GetTotalImages();
$imageSearch = new ImageSearch($f_search_string, $f_order_by, $f_order_direction, $f_image_offset, $f_items_per_page);
Example #25
0
 				</table>
 			</TD>
 			</TR>
 			<?php
 			} elseif ($dbColumn->getType() == ArticleTypeField::TYPE_TOPIC) {
 			?>
 			<tr>
 			<TD ALIGN="RIGHT" VALIGN="TOP" style="padding-top: 8px; padding-right: 5px;">
 			</td>
 			<td align="right">
 				<?php echo htmlspecialchars($dbColumn->getDisplayName()); ?>:
 			</td>
 			<td>
                 <?php
                 $topic = new Topic((int)$text);
                 echo $topic->getName(camp_session_get('LoginLanguageId', 1));
                 ?>
 			</td>
 			</tr>
 			<?php
 			} elseif ($dbColumn->getType() == ArticleTypeField::TYPE_SWITCH) {
                 $checked = $srcArticleData->getFieldValue($dbColumn->getPrintName()) ? 'checked' : '';
             ?>
             <tr>
             <TD ALIGN="RIGHT" VALIGN="TOP" style="padding-top: 8px; padding-right: 5px;">
             </td>
             <td align="right"><?php echo htmlspecialchars($dbColumn->getDisplayName()); ?>:</td>
             <td>
             <input type="checkbox" <?php echo $checked; ?> class="input_checkbox" name="<?php echo $dbColumn->getName(); ?>" id="<?php echo $dbColumn->getName(); ?>" disabled>
             </td>
             </tr>
require_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/articles/article_common.php";
if (!SecurityToken::isValid()) {
    camp_html_display_error(getGS('Invalid security token!'));
    exit;
}
// Get input
$f_publication_id = Input::Get('f_publication_id', 'int', 0);
$f_issue_number = Input::Get('f_issue_number', 'int', 0);
$f_section_number = Input::Get('f_section_number', 'int', 0);
$f_language_id = Input::Get('f_language_id', 'int', 0);
$f_language_selected = Input::Get('f_language_selected', 'int', 0);
$f_article_codes = Input::Get('f_article_code', 'array', array(), true);
$f_article_list_action = Input::Get('f_article_list_action');
$f_total_articles = Input::Get('f_total_articles', 'int', 0);
$offsetVarName = "f_article_offset_" . $f_publication_id . "_" . $f_issue_number . "_" . $f_language_id . "_" . $f_section_number;
$f_article_offset = camp_session_get($offsetVarName, 0);
$ArticlesPerPage = 15;
if (sizeof($f_article_codes) == 0) {
    camp_html_add_msg('You must select at least one article to perform an action.');
    camp_html_goto_page("/{$ADMIN}/articles/?f_publication_id={$f_publication_id}&f_issue_number={$f_issue_number}" . "&f_section_number={$f_section_number}&f_language_id={$f_language_id}");
    exit(0);
}
if (!Input::IsValid()) {
    camp_html_display_error(getGS('Invalid input: $1', Input::GetErrorString()));
    exit;
}
if ($f_article_offset < 0) {
    $f_article_offset = 0;
}
// Validate permissions
switch ($f_article_list_action) {
Example #27
0
 /**
  * Gets the translation for a given language; default language is the
  * session language.  If no translation is set for that language, we
  * return the dbTableName.
  *
  * @param int p_lang
  *
  * @return string
  */
 public function getDisplayName($p_lang = 0)
 {
     $lang = !$p_lang ? camp_session_get('LoginLanguageId', 1) : $p_lang;
     $translations = $this->getTranslations();
     if (!isset($translations[$lang])) {
         return $this->getPrintName();
     }
     return $translations[$lang];
 }
Example #28
0
        window.close();
    </script>
    <?php
    exit();
}

?>
<head>
    <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<META HTTP-EQUIV="Expires" CONTENT="now">
	<link rel="stylesheet" type="text/css" href="<?php echo $Campsite['WEBSITE_URL']; ?>/admin-style/admin_stylesheet.css" />
	<title><?php $BlogComment->exists() ? putGS('Edit comment') : putGS('Add new comment'); ?></title>
	<?php include_once($GLOBALS['g_campsiteDir']."/$ADMIN_DIR/javascript_common.php"); ?>
	<style type="text/css">@import url(<?php echo $Campsite["WEBSITE_URL"]; ?>/javascript/jscalendar/calendar-system.css);</style>
    <script type="text/javascript" src="<?php echo $Campsite["WEBSITE_URL"]; ?>/javascript/jscalendar/calendar.js"></script>
    <script type="text/javascript" src="<?php echo $Campsite["WEBSITE_URL"]; ?>/javascript/jscalendar/lang/calendar-<?php echo camp_session_get('TOL_Language', 'en'); ?>.js"></script>
    <script type="text/javascript" src="<?php echo $Campsite["WEBSITE_URL"]; ?>/javascript/jscalendar/calendar-setup.js"></script>

    <script src="<?php echo $Campsite['WEBSITE_URL']; ?>/javascript/jquery/jquery-1.4.2.min.js" type="text/javascript"></script>
</head>

<body>
<?php camp_html_display_msgs(); ?>

<table style="margin-top: 10px; margin-left: 15px; margin-right: 15px;" cellpadding="0" cellspacing="0" width="95%" class="table_input">
    <TR>
    	<TD style="padding: 3px";>
    		<B><?php $BlogComment->exists() ? putGS('Edit comment') : putGS('Add new comment'); ?></B>
    		<hr style="color: #8baed1";>
    	</TD>
    </TR>
Example #29
0
        'articleId': '<?php 
echo Input::Get('f_article_number', 'int', 1);
?>
',
    });
    callServer(['ArticleList', 'doAction'], aoData, fnLoadContextBoxArticleList);
}

function loadMultiDateEvents() {
    if ((window.has_multidates === undefined) || (!window.has_multidates)) {
        return;
    }

<?php 
$f_language_id = Input::Get('f_language_id', 'int', 1);
$f_language_selected = (int) camp_session_get('f_language_selected', 0);
$article_language_use = $f_language_selected;
if (empty($article_language_use)) {
    $article_language_use = $f_language_id;
}
?>

    var url = '<?php 
echo $Campsite['WEBSITE_URL'];
?>
/admin/multidate/getdates';
    callServer(
        {
            method: 'GET',
            url: url
        },
Example #30
0
            } elseif ($dbColumn->getType() == ArticleTypeField::TYPE_TOPIC) {
                ?>
        			<tr>
        			<TD ALIGN="RIGHT" VALIGN="TOP" style="padding-top: 8px; padding-right: 5px;">
        			</td>
        			<td align="right">
        				<?php 
                echo htmlspecialchars($dbColumn->getDisplayName());
                ?>
:
        			</td>
        			<td>
                        <?php 
                $em = Zend_Registry::get('container')->getService('em');
                $repository = $em->getRepository('Newscoop\\NewscoopBundle\\Entity\\Topic');
                $topic = $repository->getTopicByIdOrName((int) $text, camp_session_get('LoginLanguageId', 1))->getOneOrNullResult();
                if ($topic) {
                    echo $topic->getTitle();
                }
                ?>
        			</td>
        			</tr>
        			<?php 
            } elseif ($dbColumn->getType() == ArticleTypeField::TYPE_SWITCH) {
                try {
                    $checked = $srcArticleData->getFieldValue($dbColumn->getPrintName()) ? 'checked' : '';
                } catch (\InvalidPropertyException $e) {
                    $checked = '';
                }
                ?>
                    <tr>