作者:radicaldesign
项目:am
function getURL()
{
if (!isset($this->id)) {
return AMP_CONTENT_URL_PETITIONS;
}
return AMP_Url_AddVars(AMP_CONTENT_URL_PETITIONS, array('pid=' . $this->id));
}
作者:radicaldesign
项目:am
function _formFooter()
{
$renderer =& AMP_get_renderer();
$current_section_edit_link = false;
$current_class_edit_link = false;
$base_footer = ' <a href="' . AMP_Url_AddVars(AMP_SYSTEM_URL_ARTICLE, array('nosearch=1')) . '" class="standout">' . sprintf(AMP_TEXT_VIEW_ALL, AMP_pluralize(ucfirst(AMP_TEXT_ARTICLE))) . '</a>';
//sectional edit link
$current_section = isset($_REQUEST['section']) && $_REQUEST['section'] ? $_REQUEST['section'] : false;
if (!$current_section) {
$current_section = isset($_REQUEST['type']) && $_REQUEST['type'] ? $_REQUEST['type'] : false;
}
if ($current_section) {
$section_names = AMPContent_Lookup::instance('sections');
$section_name = isset($section_names[$current_section]) ? $section_names[$current_section] : false;
$current_section_edit_link = $renderer->separator() . $renderer->link(AMP_Url_AddVars(AMP_SYSTEM_URL_SECTION, array('id=' . $current_section)), $renderer->image(AMP_SYSTEM_ICON_EDIT, array('width' => '16', 'height' => '16', 'border' => 0)) . $renderer->space() . AMP_TEXT_EDIT . $renderer->space() . AMP_TEXT_SECTION . $renderer->space() . AMP_trimText($section_name, 20, false));
}
//class edit link
$current_class = isset($_REQUEST['class']) && $_REQUEST['class'] ? $_REQUEST['class'] : false;
if ($current_class) {
$class_names = AMPContent_Lookup::instance('classes');
$class_name = isset($class_names[$current_class]) ? $class_names[$current_class] : false;
$current_class_edit_link = $renderer->separator() . $renderer->link(AMP_Url_AddVars(AMP_SYSTEM_URL_CLASS, array('id=' . $current_class)), $renderer->image(AMP_SYSTEM_ICON_EDIT, array('width' => '16', 'height' => '16', 'border' => 0)) . $renderer->space() . AMP_TEXT_EDIT . $renderer->space() . AMP_TEXT_CLASS . $renderer->space() . AMP_trimText($class_name, 20, false));
}
return $base_footer . $current_section_edit_link . $current_class_edit_link . $renderer->newline();
}
作者:radicaldesign
项目:am
function getURL()
{
if (!isset($this->id)) {
return false;
}
return AMP_Url_AddVars(AMP_CONTENT_URL_TAG, array('id=' . $this->id));
}
作者:radicaldesign
项目:am
function get_url_edit()
{
if (!(isset($this->id) && $this->id)) {
return false;
}
return AMP_Url_AddVars(AMP_SYSTEM_URL_TOOLS, array('id=' . $this->id));
}
作者:radicalsu
项目:am
function getLoginUrl($change_array = null)
{
if (!isset($change_array)) {
return PHP_SELF_QUERY();
}
$vars = array_merge(AMP_Url_Values(), $change_array);
return AMP_Url_AddVars($_SERVER['PHP_SELF'], $vars);
}
作者:radicaldesign
项目:am
function _getScheduleLink($data)
{
$baselink = AMP_Url_AddVars('schedule_item.php', 'action=list');
if (!isset($this->schedule_lookup[$this->currentrow['action_id']])) {
return $baselink;
}
return AMP_Url_AddVars($baselink, 'schedule_id=' . $this->schedule_lookup[$this->currentrow['action_id']]);
}
作者:radicalsu
项目:am
function getTagURL()
{
$tag_id = $this->getTag();
if (!$tag_id) {
return false;
}
return AMP_Url_AddVars(AMP_CONTENT_URL_TAG, array('id=' . $tag_id));
}
作者:radicaldesign
项目:am
function _renderSectionHeader($section)
{
$section_header =& $section->getHeaderRef();
if (!$section_header) {
return false;
}
$section_header_url = AMP_Url_AddVars(AMP_SYSTEM_URL_ARTICLE, array('id=' . $section_header->id));
return AMP_TEXT_SECTION_HEADER . ': ' . AMP_trimText($section_header->getName(), 30, false) . $this->_renderer->space(2) . $this->_renderer->link($section_header_url, '[ ' . AMP_TEXT_EDIT . ' ]' . $this->_renderer->space() . $this->_renderer->image(AMP_SYSTEM_ICON_EDIT, array('width' => '16', 'height' => '16', 'border' => '0'))) . $this->_renderer->newline();
}
作者:radicaldesign
项目:am
function _signupLink(&$source, $fieldname = null)
{
$form_id = $source->getFormId();
if (!$form_id) {
return false;
}
$renderer =& AMP_get_renderer();
return $renderer->link(AMP_Url_AddVars(AMP_SYSTEM_URL_FORM_DATA, array('modin' => 'modin=' . $form_id)), AMP_TEXT_PETITION_SIGNERS);
}
作者:radicaldesign
项目:am
function _makeThumb(&$source, $column_name)
{
require_once 'AMP/Content/Image.inc.php';
$img = $source->getTagImageRef();
if (!$img) {
return false;
}
return $this->inDiv($this->_HTML_image(AMP_Url_AddVars(AMP_SYSTEM_URL_IMAGE_VIEW, array('file=' . $img->getName(), 'class=' . AMP_IMAGE_CLASS_THUMB, 'height=30', 'action=resize')), $this->_thumb_attr), array('class' => 'tag_listing_icon'));
}
作者:radicalsu
项目:am
function getURL()
{
if ($url = $this->getRedirect()) {
return $url;
}
if (!$this->id) {
return false;
}
return AMP_Url_AddVars(AMP_CONTENT_URL_ARTICLE, array("vid=" . $this->id, 'id=' . $this->getArticleId(), 'preview=1'));
}
作者:radicaldesign
项目:am
function _after_init_search($criteria = null)
{
$this->_pager_target = AMP_Url_AddVars(AMP_SYSTEM_URL_ARTICLE_COMMENT, array('action=search'));
if (!isset($criteria)) {
return false;
}
$article_id = isset($criteria['article']) ? $criteria['article'] : false;
if ($article_id) {
$this->_pager_target = AMP_Url_AddVars($this->_pager_target, array('article=' . $article_id));
}
}
作者:radicalsu
项目:am
function output()
{
if (!($class_set =& AMPContent_Lookup::instance('activeClasses'))) {
return false;
}
$output = "";
foreach ($class_set as $id => $name) {
$output .= $this->_renderer->link(AMP_Url_AddVars(AMP_SYSTEM_URL_ARTICLE, array('class' => 'class=' . $id, 'AMPSearch' => 'AMPSearch=1')), $name) . $this->_renderer->newline();
//$output .= '<a href = "article_list.php?class='. $id . '">'. $name . "</a><BR>\n";
//$output .= '<a href = "article_list.php?class='. $class_id . '">'. $class_set[ $class_id ] . "</a> ( ". $class_count ." ) <BR>\n";
}
return $output;
}
作者:radicalsu
项目:am
function _listLink($options = array())
{
if (!isset($options['_linked_uid'])) {
return false;
}
$comment_count_lookup = FormLookup::instance('commentCounts');
$comment_count = isset($comment_count_lookup[$options['_linked_uid']]) ? $comment_count_lookup[$options['_linked_uid']] : 0;
$link_text = ($comment_count ? $comment_count : AMP_TEXT_NO) . ' ' . AMP_pluralize(AMP_TEXT_COMMENT);
$renderer =& $this->_get_renderer();
//current comment count
$comments = $renderer->link(AMP_Url_AddAnchor(AMP_Url_AddVars(PHP_SELF_QUERY(), array('uid=' . $options['_linked_uid'])), 'comments'), $link_text);
//add comment link
$comments .= $renderer->separator() . $renderer->link(AMP_Url_AddVars(AMP_CONTENT_URL_COMMENT_ADD, array('userdata_id=' . $options['_linked_uid'])), AMP_TEXT_ADD);
return $comments . $renderer->newline(2);
}
作者:radicaldesign
项目:am
function _after_init_search($criteria = null)
{
$this->_url_add = AMP_Url_AddVars(AMP_SYSTEM_URL_ARTICLE, array('action=add'));
if (!isset($criteria)) {
return false;
}
$section_id = isset($criteria['section']) ? $criteria['section'] : (isset($criteria['type']) ? $criteria['type'] : false);
$class_id = isset($criteria['class']) ? $criteria['class'] : false;
if ($section_id) {
unset($this->_sort_default['type']);
$this->_url_add = AMP_Url_AddVars($this->_url_add, array('section=' . $section_id));
}
if ($class_id) {
$this->_url_add = AMP_Url_AddVars($this->_url_add, array('class=' . $class_id));
}
}
作者:radicaldesign
项目:am
function init_settings()
{
$domain = explode('/', AMP_SITE_URL);
$website = explode('/', AMP_SITE_URL, 3);
$inits = array('website' => $website[2], 'domain' => $domain[3], 'public_baseurl' => AMP_Url_AddVars(AMP_SITE_URL, 'q=phplist'));
foreach ($inits as $key => $value) {
$this->_dbcon->Execute(sprintf('REPLACE INTO ' . PHPLIST_TABLE_CONFIG . ' (item, value) VALUES (\'%s\', \'%s\')', $key, $value));
}
//variable_set('phplist_version', '2.8.11');
// $group = form_item('', t('If you are on a shared host, it will probably be appreciated if you don\'t send out loads of emails in one go. To do this, you can configure batch processing. Please note, the following two values can be overridden by your ISP by using a server wide configuration. So if you notice these values to be different in reality, that may be the case'));
// $group .= form_textfield(t('Batch email size'), 'phplist_batch_size', variable_get('phplist_batch_size', 0), 40, 40, t('Define the amount of emails you want to send per period. If 0, batch processing is disabled'));
// $group .= form_textfield(t('Batch email period'), 'phplist_batch_period', variable_get('phplist_batch_period', 3600), 40, 40, t('Define the length of one batch processing period, in seconds (3600 is an hour)'));
// $group .= form_checkbox(t('Cron queue processing'), 'phplist_cron_enable', 1, variable_get('phplist_cron_enable', 0), t('Checked: when cron is called the message queue will be processed.'));
// $output .= form_group(t('Batch Processing'), $group);
return $output;
}
作者:radicalsu
项目:am
function display_response()
{
$renderer =& new AMPDisplay_HTML();
$this->message(sprintf(AMP_TEXT_DATA_SAVE_SUCCESS, AMP_TEXT_YOUR_COMMENT));
if ($this->_article_id) {
AMP_lookup_clear_cached('comments_live_by_article', $this->_article_id);
ampredirect(AMP_Url_AddVars(AMP_CONTENT_URL_ARTICLE, array('id=' . $this->_article_id)));
}
if ($this->_userdata_id) {
require_once 'AMP/UserData/Lookups.inc.php';
$form_id_lookup =& FormLookup::instance('modin');
if (isset($form_id_lookup[$this->_userdata_id])) {
$target_modin = $form_id_lookup[$this->_userdata_id];
ampredirect(AMP_Url_AddVars(AMP_CONTENT_URL_FORM_DISPLAY, array('uid=' . $this->_userdata_id, 'modin=' . $target_modin)));
}
}
}
作者:radicaldesign
项目:am
function _update_list_location(&$controller)
{
$model =& $controller->get_model();
$new_data = $_POST;
$display_class = strtolower($this->components['list']);
$list_location_cookie = $display_class . '_ListLocation';
//frontpage content special action
if (isset($new_data['class']) && $new_data['class'] == AMP_CONTENT_CLASS_FRONTPAGE) {
ampredirect(AMP_SYSTEM_URL_ARTICLE_FRONTPAGE);
}
//default list behavior
if (isset($new_data['section']) && (!(isset($new_data['id']) && $new_data['id']) || !(isset($_COOKIE[$list_location_cookie]) && $_COOKIE[$list_location_cookie]))) {
ampredirect(AMP_Url_AddVars(AMP_SYSTEM_URL_ARTICLE, array('section=' . $new_data['section'])));
return;
}
if (isset($new_data['class']) && $model->getClass() != $new_data['class']) {
$controller->update_list_location($new_data['class'], 'class');
}
if (isset($new_data['section']) && $model->getSection() != $new_data['section']) {
$controller->update_list_location($new_data['section'], 'section');
}
}
作者:radicalsu
项目:am
function commit_save()
{
//just-in-time Build call is a performance optimization, sorry for the repetitive code
$this->_init_form();
//check if form validation succeeds
if (!$this->_form->validate()) {
$this->_display->add($this->_form, 'form');
return false;
}
require_once 'AMP/Content/Article.inc.php';
$this->_model =& new Article(AMP_Registry::getDbcon());
$this->_model->setDefaults();
$this->_model->mergeData($this->get_form_data());
//attempt to save the submitted data
if (!$this->_model->save()) {
$this->error($this->_model->getErrors());
$this->_display->add($this->_form);
return false;
}
$this->_model_id = $this->_model->id;
$this->message(sprintf(AMP_TEXT_DATA_SAVE_SUCCESS, $this->_model->getName()));
$this->_form->postSave($this->_model->getData());
$this->redirect(AMP_Url_AddVars(AMP_SYSTEM_URL_CONTENTS, array('type=' . $this->_model->getSection(), 'AMPSearch=Search')));
}
作者:radicaldesign
项目:am
<?php
require_once 'AMP/System/Base.php';
$modid = isset($_GET['modid']) && $_GET['modid'] ? $_GET['modid'] : false;
if (!$modid) {
ampredirect(AMP_SYSTEM_URL_HOME);
}
if ($modid) {
ampredirect(AMP_Url_AddVars(AMP_SYSTEM_URL_TOOLS, 'id=' . $modid));
}