Get() public static method

The default value is returned if the value is not defined in the $_REQUEST array, or if the value does not match the required type. The type 'checkbox' is special - you cannot specify a default value for this. The return value will be TRUE or FALSE, but you can change this by specifying 'numeric' as the 3rd parameter in which case it will return '1' or '0'. Use Input::IsValid() to check if any errors were generated.
public static Get ( string $p_varName, string $p_type = 'string', mixed $p_defaultValue = null, boolean $p_errorsOk = false ) : mixed
$p_varName string The index into the $_REQUEST array.
$p_type string The type of data expected; can be: "int" "string" "array" "checkbox" "boolean" Default is 'string'.
$p_defaultValue mixed The default value to return if the value is not defined in the $_REQUEST array, or if the value does not match the required type.
$p_errorsOk boolean Set to true to ignore any errors for this variable (i.e. Input::IsValid() will still return true even if there are errors for this varaible).
return mixed
コード例 #1
0
 public function action_index($search = null)
 {
     // check for admin
     if (!Auth::member(5)) {
         \Response::redirect_back('home');
     }
     if (Input::Method() === 'POST') {
         $users = Input::POST();
         if (empty($users) === false) {
             // Update the users
             foreach ($users as $user_id => $new_group) {
                 $found_user = Model_User::Find(str_replace('user_role_', '', $user_id));
                 if (empty($found_user) === false) {
                     $found_user->group_id = $new_group;
                     $found_user->save();
                 }
             }
         }
     }
     if (Input::Method() === 'GET' && Input::Get('search')) {
         $data['total_count'] = Controller_Search::get_users();
         $pagination = Settings::pagination($data['total_count']);
         $data['users'] = Controller_Search::get_users($pagination);
         $data['search'] = Input::GET('search');
     } else {
         $data['total_count'] = Model_User::query()->where('id', '!=', static::$user_id)->count();
         $pagination = Settings::pagination($data['total_count']);
         $data['users'] = Model_User::query()->where('id', '!=', static::$user_id)->order_by('username', 'ASC')->rows_offset($pagination->offset)->rows_limit($pagination->per_page)->get();
     }
     $data['pagination'] = $pagination->render();
     $this->template->content = View::Forge('admin/users', $data);
 }
コード例 #2
0
function upload_article_handler(&$request, &$session, &$files) {
	$publication = Input::Get('Pub', 'int', 0);
	$issue = Input::Get('Issue', 'int', 0);
	$section = Input::Get('Section', 'int', 0);
	$language = Input::Get('Language', 'int', 0);
	$sLanguage = Input::Get('sLanguage', 'int', 0);
	$articleNumber = Input::Get('Article', 'int', 0);

	if (!Input::IsValid()) {
		echo "Input Error: Missing input";
		return;
	}

	// Unzip the sxw file to get the content.
	$zip = zip_open($files["filename"]["tmp_name"]);
	if ($zip) {
		$xml = null;
		while ($zip_entry = zip_read($zip)) {
			if (zip_entry_name($zip_entry) == "content.xml") {
		       	if (zip_entry_open($zip, $zip_entry, "r")) {
		           	$xml = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
			        zip_entry_close($zip_entry);
		       	}
			}
		}
		zip_close($zip);

		if (!is_null($xml)) {
			// Write the XML to a file because the XSLT functions
			// require it to be in a file in order to be processed.
			$tmpXmlFilename = tempnam("/tmp", "ArticleImportXml");
			$tmpXmlFile = fopen($tmpXmlFilename, "w");
			fwrite($tmpXmlFile, $xml);
			fclose($tmpXmlFile);

			// Transform the OpenOffice document to DocBook format.
			$xsltProcessor = xslt_create();
			$docbookXml = xslt_process($xsltProcessor,
									   $tmpXmlFilename,
									   "sxwToDocbook.xsl");
			unlink($tmpXmlFilename);

			// Parse the docbook to get the data.
			$docBookParser = new DocBookParser();
			$docBookParser->parseString($docbookXml, true);

			$article = new Article($articleNumber, $language);
			$article->setTitle($docBookParser->getTitle());
			$article->setIntro($docBookParser->getIntro());
			$article->setBody($docBookParser->getBody());

			// Go back to the "Edit Article" page.
			header("Location: /$ADMIN/articles/edit.php?Pub=$publication&Issue=$issue&Section=$section&Article=$articleNumber&Language=$language&sLanguage=$sLanguage");
		} // if (!is_null($xml))
	} // if ($zip)

	// Some sort of error occurred - show the upload page again.
	include("index.php");
} // fn upload_article_handler
コード例 #3
0
/**
 * Campsite blogcomment_edit function plugin
 *
 * Type:     function
 * Name:     bloganswer_edit
 * Purpose:  
 *
 * @param array
 *     $p_params the date in unixtime format from $smarty.now
 * @param object
 *     $p_smarty the date format wanted
 *
 * @return
 *     string the html form element
 *     string empty if something is wrong
 */
function smarty_function_blogcomment_edit($p_params, &$p_smarty)
{
    global $g_ado_db, $Campsite;

    require_once $p_smarty->_get_plugin_filepath('shared','escape_special_chars');

    // gets the context variable
    $campsite = $p_smarty->get_template_vars('gimme');
    $html = '';

    if (!isset($p_params['html_code']) || empty($p_params['html_code'])) {
        $p_params['html_code'] = '';
    }

    switch ($p_params['attribute']) {
        case 'title':
        case 'user_name':
        case 'user_email':
            $attr = $p_params['attribute'];
            $value = htmlspecialchars(isset($_REQUEST['f_blogcomment_'.$attr]) ? Input::Get('f_blogcomment_'.$attr) : $campsite->blogcomment->$attr);
            $html .= "<input type=\"text\" name=\"f_blogcomment_$attr\" value=\"$value\" {$p_params['html_code']} />";
        break;
            
        case 'content':
            $value = isset($_REQUEST['f_blogcomment_content']) ? Input::Get('f_blogcomment_content') : $campsite->blogcomment->content;
            $html .= "<textarea name=\"f_blogcomment_content\" id=\"f_blogcomment_content\" {$p_params['html_code']} />$value</textarea>";
            if ($p_params['wysiwyg']) {
                $html .='<script language="javascript" type="text/javascript" src="' . $Campsite['WEBSITE_URL'] . '/javascript/jquery/jquery-1.4.2.min.js"></script>'.
                        '<script language="javascript" type="text/javascript" src="' . $Campsite['WEBSITE_URL'] . '/javascript/tinymce/tiny_mce.js"></script>'.
                        '<script language="javascript" type="text/javascript">'.
                        '     tinyMCE.init({'.
                        '     	mode : "exact",'.
                        '        elements : "f_blogcomment_content",'.
                        '        theme : "advanced",'.
                        '        plugins : "emotions, paste", '.
                        '        paste_auto_cleanup_on_paste : true, '.
                        '        theme_advanced_buttons1 : "bold, italic, underline, undo, redo, link, emotions", '.
                        '        theme_advanced_buttons2 : "", '.
                        '        theme_advanced_buttons3 : "" '.
                        '     });'.
                        '</script>';
            }
        break;
        
        case 'mood':
             $value = isset($_REQUEST['f_blogcomment_mood_id']) ? Input::Get('f_blogcomment_mood_id') : $campsite->blogcomment->mood_id;
            $html = "<select name=\"f_blogcomment_mood_id\" {$params['html_code']}>";
            
            foreach (Blog::getMoodList($campsite->blog->language_id) as $key => $val) {
                $selected = $value == $key ? 'selected="selected"' : '';
                $html .= "<option value=\"$key\" $selected {$params['html_code']}>$val</option>";
            }
            
            $html .= '</select>';
        break;
    }
    
    return $html;
} // fn smarty_function_blogcomment_edit
コード例 #4
0
function read_utype_common_parameters()
{
	global $uType, $userOffs, $lpp;

	$uType = Input::Get('uType', 'string', '');
	$userOffs = Input::Get('userOffs', 'int', 0);
	if ($userOffs < 0)
		$userOffs = 0;
	$lpp = Input::Get('lpp', 'int', 20);
}
コード例 #5
0
function pageController()
{
    if (Input::Get($counter)) {
        $counter = Input::Has($counter);
    } else {
        $counter = 0;
    }
    $data = ['counter' => $counter];
    return $data;
}
コード例 #6
0
ファイル: plan.php プロジェクト: albertpaulp/PrettyBoot
 public function post_ipbl()
 {
     $price = Input::Get('price');
     if (empty($price) || !is_numeric($price)) {
         return View::make('msg.error')->with('error', 'Invalid price set');
     }
     $settings = IniHandle::readini();
     $settings['ipbl'] = $price;
     IniHandle::write_ini_file($settings);
     return Redirect::to('/admin/plan/blacklist');
 }
コード例 #7
0
 public function action_create()
 {
     $url = Input::Get('url');
     $custom = Input::Get('custom');
     $api = Input::Get('api_key');
     if (empty($api) === true) {
         $api = true;
     }
     if (empty($url) === false) {
         // Check to see if its a valid url
         if (filter_var($url, FILTER_VALIDATE_URL) === false) {
             echo 'You did not enter a valid url in, please try again';
             die;
         }
         // Check black list!
         $blocked = Model_Blacklist::query()->get();
         if (empty($blocked) === false) {
             foreach ($blocked as $block) {
                 // Check aginst the blocked
                 if (preg_match('/' . strtolower($block['blocked']) . '/', strtolower($url))) {
                     echo 'URL Blacklisted';
                     die;
                 }
             }
         }
         // Lets generate them a url
         $safe = \Settings::Get('google_safe_api_key');
         // Is it safe?
         if (empty($safe) === false) {
             $m_url = 'https://sb-ssl.google.com/safebrowsing/api/lookup?client=api&apikey=' . $safe . '&appver=1.0&pver=3.0&url=' . $url;
             $curl_handle = curl_init();
             curl_setopt($curl_handle, CURLOPT_URL, $m_url);
             curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
             curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
             $buffer = curl_exec($curl_handle);
             curl_close($curl_handle);
             if (empty($buffer) === false) {
                 echo 'This website has been blocked because of ' . $buffer;
                 die;
             }
         }
         $length = strlen($url);
         $data['short_url_raw'] = Controller_Url::shortenit($url, $custom, $api);
         $data['url'] = $url;
         $data['short_url'] = $data['short_url_raw']['short_url'];
         echo \Uri::Create($data['short_url']);
         die;
     } else {
         echo 'Error';
         die;
     }
 }
コード例 #8
0
ファイル: users_common.php プロジェクト: nidzix/Newscoop
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]);
    }
}
コード例 #9
0
/**
 * Campsite blogentry_edit function plugin
 *
 * Type:     function
 * Name:     bloganswer_edit
 * Purpose:  
 *
 * @param array
 *     $p_params the date in unixtime format from $smarty.now
 * @param object
 *     $p_smarty the date format wanted
 *
 * @return
 *     string the html form element
 *     string empty if something is wrong
 */
function smarty_function_blogentry_edit($p_params, &$p_smarty)
{
    global $g_ado_db;

    require_once $p_smarty->_get_plugin_filepath('shared','escape_special_chars');

    // gets the context variable
    $campsite = $p_smarty->get_template_vars('gimme');
    $html = '';

    if (!isset($p_params['html_code']) || empty($p_params['html_code'])) {
        $p_params['html_code'] = '';
    }

    switch ($p_params['attribute']) {
        case 'title':
            $value = isset($_REQUEST['f_blogentry_title']) ? Input::Get('f_blogentry_title') : $campsite->blogentry->title;
            $html .= "<input type=\"text\" name=\"f_blogentry_title\" value=\"$value\" {$p_params['html_code']} />";
        break;
            
        case 'content':
            $value = isset($_REQUEST['f_blogentry_content']) ? Input::Get('f_blogentry_content') : $campsite->blogentry->content;
            $html .= "<textarea name=\"f_blogentry_content\" id=\"f_blogentry_content\" {$p_params['html_code']} />$value</textarea>";
            
            if ($p_params['wysiwyg']) {
                $html .='<script language="javascript" type="text/javascript" src="' . $Campsite['WEBSITE_URL'] . '/javascript/tinymce/tiny_mce.js"></script>'.
                        '<script language="javascript" type="text/javascript">'.
                        '     tinyMCE.init({'.
                        '     	mode : "exact",'.
                        '        elements : "f_blogentry_content",'.
                        '        theme : "advanced",'.
                        '        plugins : "emotions, paste", '.
                        '        paste_auto_cleanup_on_paste : true, '.
                        '        theme_advanced_buttons1 : "bold, italic, underline, undo, redo, link, emotions", '.
                        '        theme_advanced_buttons2 : "", '.
                        '        theme_advanced_buttons3 : "" '.
                        '     });'.
                        '</script>';
            }
        break;
       
        case 'mood':
            $value = isset($_REQUEST['f_blogentry_mood']) ? Input::Get('f_blogentry_mood') : $campsite->blogentry->mood;
            $html .= "<input type=\"text\" name=\"f_blogentry_mood\" value=\"$value\" {$p_params['html_code']} />";
        break; 
    }

    return $html;
} // fn smarty_function_blogentry_edit
コード例 #10
0
 public function sendEmail()
 {
     $data = Input::all();
     $user = ['name' => Input::Get('con-fullname'), 'email' => Input::Get('con-email'), 'subject' => Input::Get('con-subject'), 'message' => Input::Get('con-message')];
     $success = "Thank you for contacting us, your email with subject '" . $user['subject'] . "' will be reply by us soon. please check your spam folder as well";
     $validator = Validator::make(Input::all(), $this->rules);
     if ($validator->passes()) {
         Mail::send('emails.contactus', $data, function ($message) use($user) {
             $message->from($user['email'], $user['name'])->to('*****@*****.**', 'Hotel Everyday Smart Hotel - Jakarta')->subject($user['subject']);
         });
         return Redirect::to('/yourbook')->with('success', $success);
     } else {
         return Redirect::to('/yourbook')->withErrors($validator, 'viewBook')->withInput()->with('active', 'active');
     }
 }
コード例 #11
0
ファイル: debate.info.php プロジェクト: nidzix/Newscoop
 /**
  * @param CampContext $p_context
  */
 function plugin_debate_init(&$p_context)
 {
     $debate_nr = Input::Get("f_debate_nr", "int");
     $debate_language_id = Input::Get("f_debate_language_id", "int");
     $p_context->debate = new MetaDebate($debate_language_id, $debate_nr, $p_context->user->identifier);
     $url = $p_context->url;
     /* @var $url MetaURL */
     //if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
     //    $p_context->url->set_parameter('f_debate_ajax_request', 1);
     //}
     // reset the context urlparameters
     foreach (array('f_debate', 'f_debate_nr', 'f_debate_language_id', 'f_debate_ajax_request') as $param) {
         $p_context->url->reset_parameter($param);
         $p_context->default_url->reset_parameter($param);
     }
 }
コード例 #12
0
<?php

require_once $GLOBALS['g_campsiteDir'] . "/conf/configuration.php";
require_once $GLOBALS['g_campsiteDir'] . "/classes/Input.php";
camp_load_translation_strings("localizer");
require_once dirname(__FILE__) . '/Localizer.php';
if (!SecurityToken::isValid()) {
    camp_html_display_error(getGS('Invalid security token!'));
    exit;
}
// Check permissions
if (!$g_user->hasPermission('ManageLocalizer')) {
    camp_html_display_error(getGS("You do not have the right to manage the localizer."));
    exit;
}
$prefix = Input::Get('prefix', 'string', '', true);
$newPrefix = Input::Get('new_prefix');
$moveStr = Input::Get('string');
Localizer::ChangeStringPrefix($prefix, $newPrefix, $moveStr);
header("Location: /{$ADMIN}/localizer/index.php");
exit;
コード例 #13
0
ファイル: popup.php プロジェクト: nistormihai/Newscoop
    camp_html_display_error(getGS('You do not have the right to manage blogs.'));
    exit;
}

switch ($f_mode) {
    case 'blog_topic':// Check permissions
        $f_blog_id = Input::Get('f_blog_id', 'int');
        $topics = Blog::GetTopicTree();
        $Blog = new Blog($f_blog_id);
        $language_id = $Blog->getLanguageId();
        $object = 'BlogTopic';
        $object_id = $f_blog_id;
    break;

    case 'entry_topic':
        $f_blogentry_id = Input::Get('f_blogentry_id', 'int');
        $topics = Blog::GetTopicTree();
        $BlogEntry = new BlogEntry($f_blogentry_id);
        $language_id = $BlogEntry->getLanguageId();
        $object = 'BlogentryTopic';
        $object_id = $f_blogentry_id;
    break;

}

if (!Input::IsValid()) {
	camp_html_display_error(getGS('Invalid input: $1', Input::GetErrorString()), $_SERVER['REQUEST_URI'], true);
	exit;
}
?>
<html>
コード例 #14
0
ファイル: translate.php プロジェクト: nidzix/Newscoop
<?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");
?>
コード例 #15
0
ファイル: index.php プロジェクト: alvsgithub/Newscoop
<?php

require_once $GLOBALS['g_campsiteDir'] . '/classes/Input.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/ArticleType.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Translation.php';
$translator = \Zend_Registry::get('container')->getService('translator');
$request = \Zend_Registry::get('container')->get('request');
$locale = $request->getLocale();
if (!Saas::singleton()->hasPermission('ManageArticleTypes')) {
    camp_html_display_error($translator->trans("You do not have the right to manage article types.", array(), 'article_type_fields'));
    exit;
}
$articleTypeName = Input::Get('f_article_type');
// return value is sorted by language
$allLanguages = Language::GetLanguages(null, null, null, array(), array(), true);
$lang = Language::GetLanguageByCode($locale);
$languageObj = new Language($lang->getLanguageId());
$articleType = new ArticleType($articleTypeName);
$fields = $articleType->getUserDefinedColumns(null, true, true);
$crumbs = array();
$crumbs[] = array($translator->trans("Configure"), "");
$crumbs[] = array($translator->trans("Article Types"), "/{$ADMIN}/article_types/");
$crumbs[] = array($articleTypeName, "");
$crumbs[] = array($translator->trans("Article type fields", array(), '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;
コード例 #16
0
ファイル: add_prev.php プロジェクト: nistormihai/Newscoop
<?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();
コード例 #17
0
ファイル: do_edit.php プロジェクト: nistormihai/Newscoop
if (!$g_user->hasPermission('ManageSection')) {
    camp_html_display_error(getGS("You do not have the right to add sections."));
    exit;
}

$Pub = Input::Get('Pub', 'int', 0);
$Issue = Input::Get('Issue', 'int', 0);
$Section = Input::Get('Section', 'int', 0);
$Language = Input::Get('Language', 'int', 0);
$cSubs = Input::Get('cSubs', 'string', '', true);
$cShortName = trim(Input::Get('cShortName', 'string'));
$cDescription = trim(Input::Get('cDescription'));
$cSectionTplId = Input::Get('cSectionTplId', 'int', 0);
$cArticleTplId = Input::Get('cArticleTplId', 'int', 0);
$cName = Input::Get('cName');


if ($cSectionTplId < 0) {
    $cSectionTplId = 0;
}

if ($cArticleTplId < 0) {
    $cArticleTplId = 0;
}

if (!Input::IsValid()) {
	camp_html_display_error(getGS('Invalid input: $1', Input::GetErrorString()), $_SERVER['REQUEST_URI']);
	exit;
}
コード例 #18
0
    $article_language_use = $f_language_id;
}
?>

    var url = '<?php 
echo $Campsite['WEBSITE_URL'];
?>
/admin/multidate/getdates';
    callServer(
        {
            method: 'GET',
            url: url
        },
        {
            articleId : "<?php 
echo Input::Get('f_article_number', 'int', 1);
?>
",
            languageId : "<?php 
echo $article_language_use;
?>
"
        },
        function(data) {
            var eventList = '';
            eventList += '<ul class="block-list">';

            var dispalyed_all = true;
            
            for(var i=0; i<data.length; i++) {
                if (i >= 20 ) {
コード例 #19
0
ファイル: do_add_alias.php プロジェクト: nistormihai/Newscoop
require_once($GLOBALS['g_campsiteDir']."/$ADMIN_DIR/pub/pub_common.php");
require_once($GLOBALS['g_campsiteDir']."/classes/Alias.php");

if (!SecurityToken::isValid()) {
    camp_html_display_error(getGS('Invalid security token!'));
    exit;
}

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

$cPub = Input::Get('cPub', 'int');
$cName = trim(Input::Get('cName'));

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

$publicationObj = new Publication($cPub);
$backLink = "/$ADMIN/pub/add_alias.php?Pub=$cPub";

$correct = true;
$created = false;
$errorMsgs = array();
if (empty($cName)) {
	$correct = false;
	$errorMsgs[] = getGS('You must fill in the $1 field.', '<B>Name</B>');
コード例 #20
0
ファイル: attachment.php プロジェクト: nidzix/Newscoop
<?php

/**
 * @package Newscoop
 * @copyright 2011 Sourcefabric o.p.s.
 * @license http://www.gnu.org/licenses/gpl-3.0.txt
 */
require_once __DIR__ . '/application.php';
$application->bootstrap('autoloader');
$g_download = Input::Get('g_download', 'int', 0, true);
$g_show_in_browser = Input::Get('g_show_in_browser', 'int', 0, true);
if (preg_match('!attachment.*/(.+)$!U', $_SERVER['REQUEST_URI'], $match)) {
    $attachment = $match[1];
} else {
    header('HTTP/1.0 404 Not Found');
    echo 'Error 404: File not found';
    exit;
}
// Remove any GET parameters
if (($questionMark = strpos($attachment, '?')) !== false) {
    $attachment = substr($attachment, 0, $questionMark);
}
// Remove all attempts to get at other parts of the file system
$attachment = str_replace('/../', '/', $attachment);
$filename = urldecode(basename($attachment));
$extension = '';
if (($extensionStart = strrpos($attachment, '.')) !== false) {
    $extension = strtolower(substr($attachment, $extensionStart + 1));
    $attachment = substr($attachment, 0, $extensionStart);
}
$attachmentId = (int) ltrim($attachment, " 0\t\n\r");
コード例 #21
0
 */

require_once($GLOBALS['g_campsiteDir']. "/$ADMIN_DIR/templates/template_common.php");

if (!SecurityToken::isValid()) {
    camp_html_display_error(getGS('Invalid security token!'));
    exit;
}

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

$f_path = Input::Get('f_path', 'string', '');
$f_charset = Input::Get('f_charset', 'string', '');


$baseUpload = $Campsite['TEMPLATE_DIRECTORY'] . $f_path;
$backLink = "/$ADMIN/templates/upload_templ.php?Path=" . urlencode($f_path);

$nrOfFiles = isset($_POST['uploader_count']) ? $_POST['uploader_count'] : 0;
for ($i = 0; $i < $nrOfFiles; $i++) {
    $tmpnameIdx = 'uploader_' . $i . '_tmpname';
    $nameIdx = 'uploader_' . $i . '_name';
    $statusIdx = 'uploader_' . $i . '_status';
    if ($_POST[$statusIdx] == 'done') {
        $tmpFilePath = CS_TMP_TPL_DIR . DIR_SEP . $_POST[$tmpnameIdx];
        $newFilePath = $baseUpload . DIR_SEP . $_POST[$nameIdx];
        $result = Template::ProcessFile($tmpFilePath, $newFilePath, $f_charset);
    }
コード例 #22
0
ファイル: admin.php プロジェクト: nistormihai/Newscoop
        if (!file_exists($path_name)) {
            header("HTTP/1.1 404 Not found");
            exit;
        }
    }

    // Clean up the global namespace before we call the script
    unset($access);
    unset($extension);
    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')) {
コード例 #23
0
ファイル: retype.php プロジェクト: nidzix/Newscoop
<?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/Topic.php";
// Check permissions
if (!$g_user->hasPermission('ManageArticleTypes')) {
    camp_html_display_error(getGS("You do not have the right to reassign a field type."));
    exit;
}
$articleTypeName = Input::Get('f_article_type');
$articleTypeFieldName = Input::Get('f_field_name');
$articleField = new ArticleTypeField($articleTypeName, $articleTypeFieldName);
$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Article Types"), "/{$ADMIN}/article_types/");
$crumbs[] = array($articleTypeName, '');
$crumbs[] = array(getGS("Article type fields"), "/{$ADMIN}/article_types/fields/?f_article_type=" . urlencode($articleTypeName));
$crumbs[] = array(getGS("Reassign a field type"), "");
echo camp_html_breadcrumbs($crumbs);
include_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/javascript_common.php";
$lang = camp_session_get('LoginLanguageId', 1);
$languageObj = new Language($lang);
// Verify the merge rules
$options = array();
$convertibleFromTypes = $articleField->getConvertibleToTypes();
foreach ($convertibleFromTypes as $type) {
    $options[$type] = ArticleTypeField::VerboseTypeName($type, $languageObj->getLanguageId());
}
コード例 #24
0
ファイル: do_retype.php プロジェクト: sourcefabric/newscoop
require_once $GLOBALS['g_campsiteDir'] . '/classes/Input.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Log.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/ArticleType.php';
$translator = \Zend_Registry::get('container')->getService('translator');
if (!SecurityToken::isValid()) {
    camp_html_display_error($translator->trans('Invalid security token!'));
    exit;
}
// Check permissions
if (!$g_user->hasPermission('ManageArticleTypes')) {
    camp_html_display_error($translator->trans("You do not have the right to reassign article type fields.", array(), 'article_type_fields'));
    exit;
}
$articleTypeName = Input::Get('f_article_type');
$fieldName = trim(Input::Get('f_field_name'));
$fieldType = trim(Input::Get('f_article_field_type'));
$field = new ArticleTypeField($articleTypeName, $fieldName);
$correct = true;
$errorMsgs = array();
if (!$field->exists()) {
    $errorMsgs[] = $translator->trans('The field $1 does not exist.', array('$1' => '<B>' . urlencode($fieldName) . '</B>'), 'article_type_fields');
    $correct = false;
}
if (array_search($fieldType, $field->getConvertibleToTypes()) === false) {
    $errorMsgs[] = $translator->trans('Can not convert the field $1 from $2 to type $3.', array('$1' => $fieldName, '$2' => $field->getType(), '$3' => $fieldType), 'article_type_fields');
    $correct = false;
}
if ($correct) {
    $field->setType($fieldType);
    $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
    $cacheService->clearNamespace('article_type');
コード例 #25
0
ファイル: do_copy.php プロジェクト: nidzix/Newscoop
camp_load_translation_strings("plugin_debate");
if (!SecurityToken::isValid()) {
    camp_html_display_error(getGS('Invalid security token!'));
    exit;
}
// Check permissions
if (!$g_user->hasPermission('plugin_debate_admin')) {
    camp_html_display_error(getGS('You do not have the right to manage debates.'));
    exit;
}
$f_debate_nr = Input::Get('f_debate_nr', 'int');
$f_fk_language_id = Input::Get('f_fk_language_id', 'int');
$f_answers = Input::Get('f_answer', 'array');
$f_copy_statistics = Input::Get('f_copy_statistics', 'boolean');
$data = array('title' => Input::Get('f_title', 'string'), 'question' => Input::Get('f_question', 'string'), 'date_begin' => Input::Get('f_date_begin', 'string'), 'date_end' => Input::Get('f_date_end', 'string'), 'votes_per_user' => Input::Get('f_votes_per_user', 'int'));
foreach ($f_answers as $answer) {
    if (isset($answer['number']) && !empty($answer['number']) && strlen($answer['text'])) {
        $DebateAnswer = new DebateAnswer($f_fk_language_id, $f_debate_nr, $answer['number']);
        $answers[] = array('number' => $answer['number'], 'text' => $answer['text'], 'nr_of_votes' => $f_copy_statistics ? $DebateAnswer->getProperty('nr_of_votes') : 0, 'value' => $f_copy_statistics ? $DebateAnswer->getProperty('value') : 0);
    }
}
$source = new Debate($f_fk_language_id, $f_debate_nr);
$copy = $source->createCopy($data, $answers);
/*
foreach($translation->getAnswers() as $answer) {
    $answer->setProperty('answer', $f_answers[$answer->getNumber()]);
}
*/
header("Location: index.php");
exit;
コード例 #26
0
ファイル: ajax_action.php プロジェクト: nistormihai/Newscoop

    case 'entries_set_online':
    case 'entries_set_offline':
    case 'entries_set_pending':
        $f_entries = Input::Get('f_entries', 'array');
        $status = substr($f_action, 12);

        foreach ($f_entries as $entry_id) {
            $BlogEntry = new BlogEntry($entry_id);
            $BlogEntry->setProperty('admin_status', $status);
        }
    break;

    case 'comments_set_online':
    case 'comments_set_offline':
    case 'comments_set_pending':
        $f_comments = Input::Get('f_comments', 'array');
        $status = substr($f_action, 13);

        foreach ($f_comments as $comment_id) {
            $BlogComment = new BlogComment($comment_id);
            $BlogComment->setProperty('admin_status', $status);
        }
    break;
}

// Need to exit to avoid output of the menue.
exit;
?>
コード例 #27
0
ファイル: access_form.php プロジェクト: nistormihai/Newscoop
<?php

require_once($GLOBALS['g_campsiteDir']. "/$ADMIN_DIR/users/users_common.php");
require_once('permission_list.php');

$uType = 'Staff';
compute_user_rights($g_user, $canManage, $canDelete);
if (!$canManage) {
	$error = getGS("You do not have the right to change user account permissions.");
	camp_html_display_error($error);
	exit;
}

$userId = Input::Get('User', 'int', 0);
if ($userId > 0) {
	$editUser = new User($userId);
	if ($editUser->getUserName() == '') {
		camp_html_display_error(getGS('No such user account.'));
		exit;
	}
} else {
	camp_html_display_error(getGS('No such user account.'));
	exit;
}

$rights = camp_get_permission_list();
?>
<script type="text/javascript" src="<?php echo $Campsite['WEBSITE_URL']; ?>/js/campsite-checkbox.js"></script>
<table border="0" cellspacing="0" cellpadding="3" align="left">
<?php
$rightsList = array();
コード例 #28
0
ファイル: index.php プロジェクト: sourcefabric/newscoop
<?php

require_once LIBS_DIR . '/ArticleList/ArticleList.php';
$translator = \Zend_Registry::get('container')->getService('translator');
$f_publication_id = Input::Get('f_publication_id', 'int', null);
$f_issue_number = Input::Get('f_issue_number', 'int', null);
$f_section_number = Input::Get('f_section_number', 'int', null);
$f_language_id = Input::Get('f_language_id', 'int', 1);
if (isset($_SESSION['f_language_selected'])) {
    $f_old_language_selected = (int) $_SESSION['f_language_selected'];
} else {
    $f_old_language_selected = 0;
}
$f_language_selected = (int) camp_session_get('f_language_selected', 0);
camp_html_content_top($translator->trans('Search'), NULL);
$controller->view->headTitle($translator->trans('Search') . ' - Newscoop Admin', 'SET');
// set up
$articlelist = new ArticleList();
$articlelist->setPublication($f_publication_id);
$articlelist->setIssue($f_issue_number);
$articlelist->setSection($f_section_number);
$articlelist->setLanguage($f_language_id);
$articlelist->setColVis(TRUE);
$articlelist->setSearch(TRUE);
// render
$articlelist->renderFilters();
$articlelist->renderActions();
$articlelist->render();
camp_html_copyright_notice();
?>
</body>
コード例 #29
0
$translator = \Zend_Registry::get('container')->getService('translator');
if (!$g_user->hasPermission("ManageSection")) {
    camp_html_display_error($translator->trans("You do not have the right to add sections.", array(), 'sections'));
    exit;
}
if (!$g_user->hasPermission("AddArticle")) {
    camp_html_display_error($translator->trans("You do not have the right to add articles."));
    exit;
}
$f_src_publication_id = Input::Get('f_src_publication_id', 'int', 0);
$f_src_issue_number = Input::Get('f_src_issue_number', 'int', 0);
$f_src_section_number = Input::Get('f_src_section_number', 'int', 0);
$f_language_id = Input::Get('f_language_id', 'int', 0);
$f_dest_publication_id = Input::Get('f_dest_publication_id', 'int', 0);
$f_dest_issue_number = Input::Get('f_dest_issue_number', 'int', 0);
$f_dest_section_number = Input::Get('f_dest_section_number', 'int', 0);
if (!Input::IsValid()) {
    camp_html_display_error($translator->trans('Invalid input: $1', array('$1' => Input::GetErrorString())));
    exit;
}
$srcPublicationObj = new Publication($f_src_publication_id);
if (!$srcPublicationObj->exists()) {
    camp_html_display_error($translator->trans('Publication does not exist.'));
    exit;
}
$srcIssueObj = new Issue($f_src_publication_id, $f_language_id, $f_src_issue_number);
if (!$srcIssueObj->exists()) {
    camp_html_display_error($translator->trans('Issue does not exist.'));
    exit;
}
$srcSectionObj = new Section($f_src_publication_id, $f_src_issue_number, $f_language_id, $f_src_section_number);
コード例 #30
0
ファイル: duplicate.php プロジェクト: sourcefabric/newscoop
// We create $articleNames, a 2-dimensional array of article names indexed by article ID, language ID.
//
// The user can choose whether to perform an action on articles from page request to page request.
// We create $doAction, a 2-dimensional array of boolean values indexed by article ID, language ID.
$articleNames = array();
$doAction = array();
foreach ($_REQUEST as $key => $value) {
    if (!strncmp($key, "f_article_name_", strlen("f_article_name_"))) {
        $tmpCodeStr = str_replace("f_article_name_", "", $key);
        list($articleId, $languageId) = explode("_", $tmpCodeStr);
        $articleNames[$articleId][$languageId] = Input::Get($key, 'string', '', true);
    }
    if (!strncmp($key, "f_do_copy_", strlen("f_do_copy_"))) {
        $tmpCodeStr = str_replace("f_do_copy_", "", $key);
        list($articleId, $languageId) = explode("_", $tmpCodeStr);
        $doAction[$articleId][$languageId] = Input::Get($key, 'string', '', true);
    }
}
// $articles array:
// The articles that were initially selected to perform the move or duplicate upon.
$articles = array();
$firstArticle = null;
foreach ($f_article_code as $code) {
    list($articleNumber, $languageId) = explode("_", $code);
    $tmpArticle = new Article($languageId, $articleNumber);
    if (is_null($firstArticle)) {
        $firstArticle = $tmpArticle;
    }
    $articles[$articleNumber][$languageId] = $tmpArticle;
    // Initialize the article names on initial page request.
    // Initialize the $doAction array on initial page request.