Example #1
0
 /**
  * Set values
  *
  * @param $commenter
  * @param $values
  */
 public function setValues($p_commenter, $p_values)
 {
     /* @var $name Zend_Form_Element_CheckBox */
     $this->name->setLabel(getGS('Name') . ":" . $p_commenter->getName())->setChecked($p_values['name']);
     $this->email->setLabel(getGS('Email') . ":" . $p_commenter->getEmail())->setChecked($p_values['email']);
     $this->ip->setLabel(getGS('Ip') . ":" . $p_commenter->getIp())->setChecked($p_values['ip']);
 }
Example #2
0
 public function indexAction()
 {
     $this->view->stats = $this->_helper->service('stat')->getAll();
     // saving them here to retrieve later, because these are not available when run in cli
     SystemPref::set('support_stats_server', $this->view->stats['server']);
     SystemPref::set('support_stats_ip_address', $this->view->stats['ipAddress']);
     SystemPref::set('support_stats_ram_total', $this->view->stats['ramTotal']);
     if ($this->getRequest()->isPost() && $this->_getParam('support_send') !== null) {
         $values = $this->getRequest()->getPost();
         try {
             $askTime = new DateTime($values['stat_ask_time']);
         } catch (Exception $e) {
             $askTime = new DateTime('7 days');
         }
         SystemPref::set('stat_ask_time', $askTime->getTimestamp());
         SystemPref::set('support_send', $values['support_send']);
         $this->_helper->flashMessenger(getGS('Support settings saved.'));
         if ($this->_getParam('action') === 'popup') {
             $this->_helper->redirector('index', '');
         } else {
             $this->_helper->redirector('index');
         }
     }
     $this->view->support_send = SystemPref::get('support_send');
 }
Example #3
0
 public static function GetURI($p_publicationId, $p_languageId, $p_issueNo = null, $p_sectionNo = null, $p_articleNo = null)
 {
     $languageObj = new Language($p_languageId);
     if (!$languageObj->exists()) {
         return new PEAR_Error(getGS('Language does not exist.'));
     }
     $uri = $GLOBALS['Campsite']['SUBDIR'] . '/' . $languageObj->getCode() . '/';
     if (!is_null($p_issueNo) && is_null($p_articleNo)) {
         $issueObj = new Issue($p_publicationId, $p_languageId, $p_issueNo);
         if (!$issueObj->exists()) {
             return new PEAR_Error(getGS('Issue does not exist.'));
         }
         $uri .= $issueObj->getUrlName() . '/';
     }
     if (!is_null($p_sectionNo) && is_null($p_articleNo)) {
         $sectionObj = new Section($p_publicationId, $p_issueNo, $p_languageId, $p_sectionNo);
         if (!$sectionObj->exists()) {
             return new PEAR_Error(getGS('Section does not exist.'));
         }
         $uri .= $sectionObj->getUrlName() . '/';
     }
     if (!is_null($p_articleNo)) {
         $articleObj = new Article($p_languageId, $p_articleNo);
         if (!$articleObj->exists()) {
             return new PEAR_Error(getGS('Article does not exist.'));
         }
         $issueObj = new Issue($p_publicationId, $p_languageId, $articleObj->getIssueNumber());
         $sectionObj = new Section($p_publicationId, $articleObj->getIssueNumber(), $p_languageId, $articleObj->getSectionNumber());
         $uri .= $issueObj->getUrlName() . '/';
         $uri .= $sectionObj->getUrlName() . '/';
         $uri .= $articleObj->getUrlName() . '/';
     }
     return $uri;
 }
Example #4
0
function camp_get_permission_list()
{
    $content_group = array('ManagePub' => getGS('User may add/change publications'), 'DeletePub' => getGS('User may delete publications'), 'ManageIssue' => getGS('User may add/change issues'), 'DeleteIssue' => getGS('User may delete issues'), 'ManageSection' => getGS('User may add/change sections'), 'DeleteSection' => getGS('User may delete sections'), 'AddArticle' => getGS('User may add articles'), 'ChangeArticle' => getGS('User may change articles'), 'MoveArticle' => getGS('User may move articles'), 'TranslateArticle' => getGS('User may translate articles'), 'AttachImageToArticle' => getGS('User may attach images to articles'), 'AttachTopicToArticle' => getGS('User may attach topics to articles'), 'Publish' => getGS('User may publish articles'), 'DeleteArticle' => getGS('User may delete articles'), 'AddImage' => getGS('User may add images'), 'ChangeImage' => getGS('User may change images'), 'DeleteImage' => getGS('User may delete images'), 'AddFile' => getGS('User may add article attachments'), 'ChangeFile' => getGS('User may change article attachments'), 'DeleteFile' => getGS('User may delete article attachments'), 'ManageTopics' => getGS('User may manage topics'), 'CommentModerate' => getGS('User may moderate comments'), 'CommentEnable' => getGS('User may enable comments'));
    $templates_group = array('ManageTempl' => getGS('User may manage templates'), 'DeleteTempl' => getGS('User may delete templates'));
    $administrative_group = array('ChangeSystemPreferences' => getGS('User may change system preferences'), 'ClearCache' => getGS('User may clear up the system cache'), 'ManageBackup' => getGS('User may backup and restore the site data'));
    $users_group = array('ManageUsers' => getGS('User may add/change staff accounts and passwords'), 'DeleteUsers' => getGS('User may delete staff accounts'), 'ManageReaders' => getGS('User may add/change subscribers accounts and passwords'), 'ManageSubscriptions' => getGS('User may manage user subscriptions'), 'ManageUserTypes' => getGS('User may manage account types'), 'EditAuthors' => getGS('User may change authors'));
    $article_types_group = array('ManageArticleTypes' => getGS('User may add/change article types'), 'DeleteArticleTypes' => getGS('User may delete article types'));
    $languages_group = array('ManageLanguages' => getGS('User may add languages and manage language information'), 'DeleteLanguages' => getGS('User may delete languages'));
    $countries_group = array('ManageCountries' => getGS('User may add/change country entries'), 'DeleteCountries' => getGS('User may delete country entries'));
    $misc_group = array('ViewLogs' => getGS('User may view audit logs'), 'MailNotify' => getGS('User will be notified on several events'));
    $localizer_group = array('ManageLocalizer' => getGS('User may manage localizer'));
    $editor_group_1 = array('EditorBold' => getGS('User may use bold'), 'EditorItalic' => getGS('User may use italic'), 'EditorUnderline' => getGS('User may use underline'), 'EditorStrikethrough' => getGS('User may use strikethrough'), 'EditorTextAlignment' => getGS('User may change text alignment'), 'EditorCopyCutPaste' => getGS('User may copy, cut, and paste'), 'EditorUndoRedo' => getGS('User may undo/redo'), 'EditorFindReplace' => getGS('User may find and replace'), 'EditorCharacterMap' => getGS('User may add special characters'), 'EditorTextDirection' => getGS('User may change text direction'), 'EditorIndent' => getGS('User may set indents'), 'EditorLink' => getGS('User may add links'), 'EditorSubhead' => getGS('User may add subheads'), 'EditorImage' => getGS('User may insert images'), 'EditorSourceView' => getGS('User may view the HTML source'), 'EditorEnlarge' => getGS('User may enlarge the editor'), 'EditorStatusBar' => getGS('User may use the editor status bar'));
    $editor_group_2 = array('EditorFontFace' => getGS('User may change the font face'), 'EditorFontSize' => getGS('User may change the font size'), 'EditorListBullet' => getGS('User may create bulleted lists'), 'EditorListNumber' => getGS('User may create numbered lists'));
    $editor_group_3 = array('EditorTable' => getGS('User may insert tables'));
    $editor_group_4 = array('EditorHorizontalRule' => getGS('User may insert horizontal rules'), 'EditorFontColor' => getGS('User may change the font color'), 'EditorSuperscript' => getGS('User may use superscripts'), 'EditorSubscript' => getGS('User may use subscripts'), 'EditorSpellcheckerEnabled' => getGS('Enable Firefox spell checking by default'));
    $rights = array(getGS('Content') => $content_group, getGS('Templates') => $templates_group, getGS('Staff/Subscribers Management') => $users_group, getGS('Administrative tasks') => $administrative_group, getGS('Article Types') => $article_types_group, getGS('Languages') => $languages_group, getGS('Countries') => $countries_group, getGS('Miscellaneous') => $misc_group, getGS('Localizer') => $localizer_group, getGS('Editor Basic Settings') => $editor_group_1, getGS('Editor Advanced Font Settings') => $editor_group_2, getGS('Editor Table Settings') => $editor_group_3, getGS('Editor Miscellaneous Settings') => $editor_group_4);
    // plugins: extend permission list
    $rights[getGS('Plugins')] = array('plugin_manager' => 'User may manage Plugins');
    foreach (CampPlugin::GetPluginsInfo(true) as $info) {
        foreach ($info['permissions'] as $permission => $label) {
            $rights[$info['label']][$permission] = getGS($label);
        }
    }
    return $rights;
}
Example #5
0
/**
 * Check if the given parameters match an existing issue.  All parameters
 * should be for the issue you are adding/editing.  If you are adding,
 * set $p_isExistingIssue to FALSE, and if you are editing, set it to TRUE.
 *
 * @param int $p_publicationId
 * @param int $p_issueNumber
 * @param int $p_languageId
 * @param string $p_urlName
 * @param boolean $p_isExistingIssue
 * 		Set this to true if the issue already exists.
 * @return string
 * 		Return empty string on success, error message on failure.
 */
function camp_is_issue_conflicting($p_publicationId, $p_issueNumber, $p_languageId, $p_urlName, $p_isExistingIssue)
{
	global $ADMIN;
	// The tricky part - language ID and URL name must be unique.
	$conflictingIssues = Issue::GetIssues($p_publicationId, $p_languageId, null, $p_urlName, null, false, null, true);
	$conflictingIssue = array_pop($conflictingIssues);

	// Check if the issue conflicts with another issue.

	// If the issue exists, we have to make sure the conflicting issue is not
	// itself.
	$isSelf = ($p_isExistingIssue && is_object($conflictingIssue)
			   && ($conflictingIssue->getIssueNumber() == $p_issueNumber));
	if (is_object($conflictingIssue) && !$isSelf) {
		$conflictingIssueLink = "/$ADMIN/issues/edit.php?"
			."Pub=$p_publicationId"
			."&Issue=".$conflictingIssue->getIssueNumber()
			."&Language=".$conflictingIssue->getLanguageId();

		$errMsg = getGS('The language and URL name must be unique for each issue in this publication.')."<br>".getGS('The values you are trying to set conflict with issue "$1$2. $3 ($4)$5".',
			"<a href='$conflictingIssueLink'>",
			$conflictingIssue->getIssueNumber(),
			$conflictingIssue->getName(),
			$conflictingIssue->getLanguageName(),
			'</a>');
		return $errMsg;
	}
	return "";
}
Example #6
0
function camp_template_path_crumbs($p_path)
{
	global $ADMIN;
	$crumbs = array();
	$crumbs[] = array(getGS("Path").": ", "", false);
	$p_path = str_replace("//", "/", $p_path);
	if ($p_path == "/") {
		$crumbs[] = array("/", "/$ADMIN/templates/?Path=/");
		return $crumbs;
	}
	$dirs = explode("/", $p_path);
	//echo "<pre>";print_r($dirs);echo "</pre>";
	$tmpPath = "";
	$numDirs = count($dirs);
	$count = 1;
	foreach ($dirs as $dir) {
		if ($dir == "") {
			$tmpPath = '/';
		} elseif ($tmpPath == '/') {
			$tmpPath .= $dir;
		} else {
			$tmpPath .= "/$dir";
		}
		$crumbs[] = array("$dir/", "/$ADMIN/templates/?Path=".urlencode($tmpPath), ($count++ == $numDirs));
	}
	return $crumbs;
} // fn camp_template_path_crumbs
Example #7
0
 /**
  */
 public function init()
 {
     $this->addElement('text', 'headline', array('label' => getGS('Headline'), 'required' => true));
     $this->addElement('text', 'slug', array('label' => getGS('Slug')));
     $this->addElement('text', 'description', array('label' => getGS('Description')));
     $this->addElement('submit', 'submit', array('label' => getGS('Save'), 'ignore' => true));
 }
Example #8
0
 /**
  * Check permissions and redirect to error screen if not allowed
  *
  * @params string $resource
  * @params string $action
  * @return void
  */
 public function check($resource, $action)
 {
     if (!$this->isAllowed($resource, $action)) {
         $redirector = $this->getActionController()->getHelper('redirector');
         $redirector->gotoSimple('deny', 'error', 'admin', array('message' => getGS('You are not allowed to $1 $2.', $action, $resource)));
     }
 }
Example #9
0
    public function delete()
    {
        if (!$this->exists()) {
            return false;
        }
        // Deleting the from from disk path is the most common place for
        // something to go wrong, so we do that first.
        $file = $this->getStorageLocation();
        if (file_exists($file) && is_file($file)) {
            unlink($file);
        }

        // Delete all the references to this image.
        ArticleAttachment::OnAttachmentDelete($this->m_data['id']);

        // Delete the description
        Translation::deletePhrase($this->m_data['fk_description_id']);

        $tmpData = $this->m_data;

        // Delete the record in the database
        $success = parent::delete();

        $logtext = getGS('File #$1 "$2" deleted.', $tmpData['id'], $tmpData['file_name']);
        Log::Message($logtext, null, 39);
        return $success;
    } // fn delete
Example #10
0
    /**
     */
    public function __construct()
    {
        parent::__construct();

        $this->model = new Image;

        $this->cols = array(
            'Id' => NULL,
            'ThumbnailFileName' => getGS('Thumbnail'),
            'Description' => getGS('Description'),
            'Photographer' => getGS('Photographer'),
            'Place' => getGS('Place'),
            'Date' => getGS('Date'),
            'TimeCreated' => getGS('Added'),
            'LastModified' => getGS('Last modified'),
            'InUse' => getGS('In use'),
        );

        $this->searchCols = array(
            'Description',
            'Photographer',
            'Place',
        );

        $this->ignoredCols = array('InUse');
        $this->inUseColumn = sizeof($this->cols) - 1;

        // set sorting
        $this->defaultSorting = 6;
        $this->defaultSortingDir = 'desc';
        $this->notSortable[] = 1;
    }
/**
 * Send token via email
 *
 * @param string $p_email
 * @param string $p_token
 * @return void
 */
function send_token($p_email, $p_token)
{
    global $Campsite;

    // reset link
    $link = sprintf('%s/admin/password_check_token.php?token=%s&f_email=%s',
        $Campsite['WEBSITE_URL'],
        $p_token,
        $p_email);

    // email message
    $message = getGS("Hi, \n\nfor password recovery, please follow this link: $1", $link);

    // get from email
    $from = SystemPref::Get('PasswordRecoveryFrom');
    if (empty($from)) {
        $from = 'no-reply@' . $_SERVER['SERVER_NAME'];
    }

    // set headers
    $headers = array(
        'MIME-Version: 1.0',
        'Content-type: text/plain; charset=UTF-8',
        "From: $from",
    );

    // send mail
    mail($p_email,
        '=?UTF-8?B?' . base64_encode(getGS('Password recovery')) . '?=',
        trim(html_entity_decode(strip_tags($message), ENT_QUOTES, 'UTF-8')),
        implode("\r\n", $headers));
}
Example #12
0
/**
 * Check if the alias given is already in use.  If so, a user error message
 * is created.
 *
 * @param mixed $p_alias
 * 		Can be a string or an int.
 * @return void
 */
function camp_is_alias_conflicting($p_alias)
{
	global $ADMIN;

	if (!is_numeric($p_alias)) {
		// The alias given is a name, which means it doesnt exist yet.
		// Check if the name conflicts with any existing alias names.
		$aliases = Alias::GetAliases(null, null, $p_alias);
		$alias = array_pop($aliases);
		if ($alias) {
			$pubId = $alias->getPublicationId();
			$pubObj = new Publication($pubId);
			$pubLink = "<A HREF=\"/$ADMIN/pub/edit.php?Pub=$pubId\">". $pubObj->getName() ."</A>";
			$msg = getGS("The publication alias you specified conflicts with publication '$1'.", $pubLink);
			camp_html_add_msg($msg);
		}
	} else {
		// The alias given is a number, which means it already exists.
		// Check if the alias ID is already in use by another publication.
		$aliases = Alias::GetAliases($p_alias);
		$alias = array_pop($aliases);
		if ($alias) {
			$pubs = Publication::GetPublications(null, $alias->getId());
			if (count($pubs) > 0) {
				$pubObj = array_pop($pubs);
				$pubLink = "<A HREF=\"/$ADMIN/pub/edit.php?Pub=".$pubObj->getPublicationId().'">'. $pubObj->getName() ."</A>";
				$msg = getGS("The publication alias you specified conflicts with publication '$1'.", $pubLink);
				camp_html_add_msg($msg);
			}
		}
	}
}
Example #13
0
/**
 * Campsite user_form block plugin
 *
 * Type:     block
 * Name:     user_form
 * Purpose:  Provides a...
 *
 * @param string
 *     $p_params
 * @param string
 *     $p_smarty
 * @param string
 *     $p_content
 *
 * @return
 *
 */
function smarty_block_user_form($p_params, $p_content, &$p_smarty, &$p_repeat)
{
    $p_smarty->smarty->loadPlugin('smarty_function_get_resource_id');
    $resourceId = smarty_function_get_resource_id($p_params, $p_smarty);
    if (!isset($p_content)) {
        return null;
    }
    $p_smarty->smarty->loadPlugin('smarty_shared_escape_special_chars');
    $campsite = $p_smarty->getTemplateVars('gimme');
    $url = $campsite->url;
    $url->uri_parameter = "";
    $template = null;
    if (isset($p_params['template'])) {
        $template = new MetaTemplate($resourceId);
        if (!$template->defined()) {
            CampTemplate::singleton()->trigger_error('invalid template "' . $p_params['template'] . '" specified in the user form');
            return false;
        }
    } elseif (is_numeric($url->get_parameter('tpl'))) {
        $template = $campsite->default_template;
    }
    if (!isset($p_params['submit_button'])) {
        require_once $GLOBALS['g_campsiteDir'] . '/admin-files/localizer/Localizer.php';
        if (!isGS('Submit')) {
            camp_load_translation_strings("globals", $campsite->language->code);
        }
        $p_params['submit_button'] = getGS('Submit');
    }
    if (!isset($p_params['html_code']) || empty($p_params['html_code'])) {
        $p_params['html_code'] = '';
    }
    if (!isset($p_params['button_html_code']) || empty($p_params['button_html_code'])) {
        $p_params['button_html_code'] = '';
    }
    if (isset($template)) {
        $url->uri_parameter = "template " . str_replace(' ', "\\ ", $template->name);
    }
    if ($campsite->user->defined && $campsite->user->subscription->defined) {
        $subsType = $campsite->user->subscription->type == 'T' ? 'trial' : 'paid';
    } else {
        $subsType = null;
    }
    $html = "<form name=\"edit_user\" action=\"" . $url->uri_path . "\" method=\"post\" " . $p_params['html_code'] . ">\n";
    if (!is_null($subsType)) {
        $html .= "<input type=\"hidden\" name=\"f_substype\" value=\"" . $subsType . "\" />\n";
    }
    if (isset($template)) {
        $html .= "<input type=\"hidden\" name=\"tpl\" value=\"" . $template->identifier . "\" />\n";
    }
    foreach ($campsite->url->form_parameters as $param) {
        if ($param['name'] == 'tpl') {
            continue;
        }
        $html .= '<input type="hidden" name="' . $param['name'] . '" value="' . htmlentities($param['value']) . "\" />\n";
    }
    $html .= $p_content;
    $html .= "<input type=\"submit\" name=\"f_edit_user\" value=\"" . smarty_function_escape_special_chars($p_params['submit_button']) . "\" " . $p_params['button_html_code'] . " />\n</form>\n";
    return $html;
}
Example #14
0
 public function init()
 {
     $this->setAttrib("autocomplete", "off")->setAction('')->setMethod(Zend_Form::METHOD_POST)->addElement('select', 'frontpage', array('label' => getGS('Front page template'), 'required' => true))->addElement('select', 'sectionpage', array('label' => getGS('Section page template'), 'required' => true))->addElement('select', 'articlepage', array('label' => getGS('Article page template'), 'required' => true))->addElement('select', 'errorpage', array('label' => getGS('Error page template'), 'required' => true))->addElement('hidden', 'outputid', array('required' => true))->addElement('hidden', 'themeid', array('required' => true))->addElement('submit', 'submit', array('label' => 'Save'));
     // take out those decorators for the hidden elements
     foreach (array($this->getElement('outputid'), $this->getElement('themeid')) as $elem) {
         $elem->removeDecorator('HtmlTag')->removeDecorator('Label')->removeDecorator('Error')->removeDecorator('Description');
     }
 }
Example #15
0
 public function init()
 {
     //$this->addElement('hash', 'csrf');
     foreach ($this->entities as $entry) {
         $this->addElement('text', $entry->getAction(), array('label' => $entry->getName(), 'value' => $entry->getPoints(), 'filters' => array('stringTrim'), 'validators' => array('int')));
     }
     $this->addElement('submit', 'submit', array('label' => getGS('Save'), 'ignore' => TRUE));
 }
Example #16
0
 public function init()
 {
     $this->addElement('text', 'name', array('label' => getGS('Theme name'), 'required' => True));
     $this->addElement('text', 'required-version', array('label' => getGS('Required Newscoop version'), 'description' => getGS('or higher'), 'class' => 'small', 'readonly' => True));
     $this->addElement('text', 'theme-version', array('label' => getGS('Theme version'), 'class' => 'small', 'readonly' => True));
     $this->setAttrib('autocomplete', 'off');
     $this->setAction('')->setMethod(Zend_Form::METHOD_POST);
 }
Example #17
0
 public function init()
 {
     parent::init();
     if (!$this->isAdmin) {
         return;
     }
     $this->addElement('multiCheckbox', 'groups', array('label' => getGS('User Type'), 'order' => 61));
 }
Example #18
0
 /**
  */
 public function init()
 {
     $this->addElement('hash', 'csrf');
     $this->addElement('text', 'article_type', array('label' => getGS('Article Type'), 'required' => true));
     $this->addElement('select', 'publication', array('label' => getGS('Publication'), 'multioptions' => array(null => getGS('None'))));
     $this->addElement('select', 'section', array('label' => getGS('Section'), 'multioptions' => array(null => getGS('None'))));
     $this->addElement('submit', 'submit', array('label' => getGS('Save'), 'ignore' => true));
 }
 public function render()
 {
     if ($this->getUser()->hasPermission('ChangeArticle') || $this->getUser()->hasPermission('Publish')) {
         parent::render();
     } else {
         echo '<p>', getGS('Access Denied'), '</p>';
     }
 }
 public function createForm()
 {
     $form = new Zend_Form();
     $form->addElement('text', 'ip', array('label' => getGS('Start IP'), 'required' => true, 'validators' => array(array('notEmpty', true, array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => getGS("Value is required and can't be empty")))), array('ip', true, array('messages' => array(Zend_Validate_Ip::NOT_IP_ADDRESS => getGS("'%value%' is not a valid IP Address")))))));
     $form->addElement('text', 'number', array('label' => getGS('Number of addresses'), 'required' => true, 'validators' => array(array('notEmpty', true, array('messages' => array(Zend_Validate_NotEmpty::IS_EMPTY => getGS("Value is required and can't be empty")))), array('greaterThan', true, array(0, 'messages' => array(Zend_Validate_GreaterThan::NOT_GREATER => getGS("'%value%' must be greater than '%min%'")))))));
     $form->addElement('submit', 'submit', array('label' => getGS('Save')));
     return $form;
 }
Example #21
0
 public function init()
 {
     $this->addElement('hash', 'csrf');
     $this->addElement('textarea', 'content', array('required' => TRUE));
     $this->addElement('text', 'cache_lifetime', array('class' => 'short'));
     $this->addElement('button', 'geo_filtering', array('label' => '<span class="ui-icon-polygon"></span>' . getGS('Geo Filtering'), 'class' => 'geo_filtering_button', 'ignore' => TRUE, 'escape' => false));
     $this->addElement('submit', 'submit', array('label' => getGS('Save'), 'ignore' => TRUE));
 }
Example #22
0
 /**
  * Get priority form
  *
  * @return \Zend_Form
  */
 private function getForm()
 {
     $form = new Zend_Form();
     $resourceTypes = $this->auditService->getResourceTypes();
     $actionTypes = $this->auditService->getActionTypes();
     $form->addElement('select', 'resource_type', array('multioptions' => array('' => getGS('All')) + $resourceTypes, 'label' => getGS('Resource Type:'), 'onChange' => 'this.form.submit();'));
     $form->addElement('select', 'action_type', array('multioptions' => array('' => getGS('All')) + $actionTypes, 'label' => getGS('Action Type:'), 'onChange' => 'this.form.submit();'));
     return $form;
 }
Example #23
0
 public function reloadRenditionsAction()
 {
     if (!$this->getRequest()->isPost()) {
         throw new \Zend_Controller_Action_Exception('POST required', 405);
     }
     $this->_helper->service('image.rendition')->reloadRenditions();
     $this->_helper->flashMessenger(getGS('Renditions reloaded'));
     $this->_helper->redirector('index', 'rendition', 'admin');
 }
Example #24
0
 public function init()
 {
     $this->addElement('select', 'language', array('label' => getGS('Language'), 'multioptions' => array('select' => getGS('Individual languages'), 'all' => getGS('Regardless of the language'))));
     $this->addElement('multiselect', 'sections_select', array('label' => getGS('Sections')));
     $this->addElement('multiselect', 'sections_all', array('label' => getGS('Sections')));
     $this->addElement('text', 'start_date', array('label' => getGS('Start'), 'required' => true, 'class' => 'date'));
     $this->addElement('text', 'days', array('label' => getGS('Days'), 'required' => true));
     $this->addElement('submit', 'submit', array('label' => getGS('Save')));
 }
Example #25
0
 public function init()
 {
     $this->addElement('text', 'name', array('label' => getGS('Section'), 'readonly' => true));
     $this->addElement('text', 'language', array('label' => getGS('Language'), 'readonly' => true));
     $this->addElement('text', 'start_date', array('label' => getGS('Start'), 'required' => true, 'class' => 'date'));
     $this->addElement('text', 'days', array('label' => getGS('Days'), 'required' => true));
     $this->addElement('text', 'paid_days', array('label' => getGS('Paid Days'), 'required' => true));
     $this->addElement('submit', 'submit', array('label' => getGS('Save')));
 }
Example #26
0
 /**
  */
 public function init()
 {
     $this->addElement('hash', 'csrf');
     $this->addElement('select', 'type', array('label' => getGS('Type'), 'required' => true, 'multioptions' => array('reuters' => 'Thomson Reuters')));
     $config = new Zend_Form_SubForm();
     $config->addElement('text', 'username', array('label' => getGS('Username'), 'required' => true, 'filters' => array('stringTrim')));
     $config->addElement('text', 'password', array('label' => getGS('Password'), 'required' => true, 'filters' => array('stringTrim')));
     $this->addSubForm($config, 'config');
     $this->addElement('submit', 'submit', array('label' => getGS('Add'), 'ignore' => true));
 }
  	/**
  	 * @param array $p_values
  	 * @return boolean
  	 */
  	public function create($p_values = null)
  	{
  		$success = parent::create($p_values);
  		$publicationObj = new Publication($this->m_data['IdPublication']);
		if (function_exists("camp_load_translation_strings")) {
			camp_load_translation_strings("api");
		}
		$logtext = getGS('The default subscription time for ($1 "$2":$3) has been added.', getGS("Publication"), $publicationObj->getName(), $this->m_data['CountryCode']);
		Log::Message($logtext, null, 4);
		return $success;
  	} // fn create
Example #28
0
 public function logoutAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         Article::UnlockByUser((int) $auth->getIdentity());
         $auth->clearIdentity();
         unset($_SESSION['statDisplayed']);
     }
     $this->_helper->FlashMessenger(getGS('You were logged out.'));
     $this->_helper->redirector('index', 'index');
 }
Example #29
0
 /**
  * Render actions
  *
  * @param array $actions
  * @return void
  */
 public function linkBan($p_url, $p_params = null)
 {
     $params = array_merge(array('name' => getGS('Ban'), 'title' => getGS('Ban'), 'class' => array('ban', 'confirm'), 'attributes' => array()), is_null($p_params) ? array() : $p_params);
     //concatenating the class array into a class string
     $params['class'] = implode(' ', $params['class']);
     $this->view->urlOptions = array_merge(array('action' => 'toggle-ban', 'forum' => 2), $p_url);
     foreach ($params as $key => $value) {
         $this->view->{$key} = $value;
     }
     return $this->view->render('link-ban.phtml');
 }
Example #30
0
 public function addItemAction()
 {
     $slideshow = $this->getSlideshow();
     $image = $this->_helper->service('image')->find(array_pop(explode('-', $this->_getParam('image'))));
     try {
         $item = $this->_helper->service('package')->addItem($slideshow, $image);
         $this->_helper->json(array('item' => $this->view->slideshowItem($item)));
     } catch (\InvalidArgumentException $e) {
         $this->_helper->json(array('error_message' => sprintf(getGS('Sorry that image is too small. Image needs to be at least %dx%d.'), $slideshow->getRendition()->getWidth(), $slideshow->getRendition()->getHeight())));
     }
 }