当前位置: 首页>>代码示例>>PHP>>正文


PHP Publication类代码示例

本文整理汇总了PHP中Publication的典型用法代码示例。如果您正苦于以下问题:PHP Publication类的具体用法?PHP Publication怎么用?PHP Publication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Publication类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: require_once

require_once($GLOBALS['g_campsiteDir']."/classes/Country.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;
}

$Pub = Input::Get('Pub', 'int', 0);
$Language = Input::Get('Language', 'int', 1, true);
$CountryCode = Input::Get('CountryCode');

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

$publicationObj = new Publication($Pub);
$defaultTime = new SubscriptionDefaultTime($CountryCode, $Pub);
$defaultTime->delete();

$logtext = getGS('Subscription default time for "$1":$2 deleted', $publicationObj->getName(), $CountryCode);
Log::Message($logtext, $g_user->getUserId(), 5);
camp_html_add_msg(getGS("Country subscription settings deleted."), "ok");
camp_html_goto_page("/$ADMIN/pub/deftime.php?Pub=$Pub&Language=$Language");
?>
开发者ID:nistormihai,项目名称:Newscoop,代码行数:31,代码来源:do_deldeftime.php

示例2: GetURL

 public static function GetURL($p_publicationId, $p_languageId = null, $p_issueNo = null, $p_sectionNo = null, $p_articleNo = NULL, $p_port = null)
 {
     global $g_ado_db;
     global $_SERVER;
     if (is_null($p_port)) {
         if (!isset($_SERVER['SERVER_PORT'])) {
             $_SERVER['SERVER_PORT'] = 80;
         }
         $p_port = $_SERVER['SERVER_PORT'];
     }
     $publicationObj = new Publication($p_publicationId);
     if (!$publicationObj->exists()) {
         return new PEAR_Error(getGS('Publication does not exist.'));
     }
     if (!isset($p_languageId)) {
         $p_languageId = $publicationObj->getDefaultLanguageId();
     }
     $scheme = $_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://';
     $defaultAlias = new Alias($publicationObj->getDefaultAliasId());
     $uri = ShortURL::GetURI($p_publicationId, $p_languageId, $p_issueNo, $p_sectionNo, $p_articleNo);
     if (!is_string($uri) && PEAR::isError($uri)) {
         return $uri;
     }
     return $scheme . $defaultAlias->getName() . $uri;
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:25,代码来源:ShortURL.php

示例3: camp_is_alias_conflicting

/**
 * 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;
    $translator = \Zend_Registry::get('container')->getService('translator');
    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 = $translator->trans("The publication alias you specified conflicts with publication '\$1'.", array('$1' => $pubLink), 'pub');
            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 = $translator->trans("The publication alias you specified conflicts with publication '\$1'.", array('$1' => $pubLink), 'pub');
                camp_html_add_msg($msg);
            }
        }
    }
}
开发者ID:sourcefabric,项目名称:newscoop,代码行数:40,代码来源:pub_common.php

示例4: takeAction

    /**
     * Performs the action; returns true on success, false on error.
     *
     * @param $p_context - the current context object
     * @return bool
     */
    public function takeAction(CampContext &$p_context)
    {
        $p_context->default_url->reset_parameter('f_'.$this->m_name);
        $p_context->url->reset_parameter('f_'.$this->m_name);

        if (!is_null($this->m_error)) {
            return false;
        }

        // Check that the article exists.
        $articleMetaObj = $p_context->default_article;
        if (!$articleMetaObj->defined) {
            $this->m_error = new PEAR_Error('The article was not selected. You must view an article in order to post comments.',
            ACTION_PREVIEW_COMMENT_ERR_NO_ARTICLE);
            return false;
        }
        if (!$articleMetaObj->comments_enabled || $articleMetaObj->comments_locked)  {
            $this->m_error = new PEAR_Error('Comments are not enabled for this publication/article.',
            ACTION_PREVIEW_COMMENT_ERR_NOT_ENABLED);
            return false;
        }

        // Get the publication.
        $publicationObj = new Publication($articleMetaObj->publication->identifier);
        $forum = new Phorum_forum($publicationObj->getForumId());
        if (!$forum->exists()) {
            $forum->create();
            $forum->setName($publicationObj->getName());
            $publicationObj->setForumId($forum->getForumId());
        }
        $forumId = $forum->getForumId();

        $user = $p_context->user;
        if ($user->defined) {
            $this->m_properties['reader_email'] = $user->email;
        } else {
            if ($forum->getPublicPermissions() & (PHORUM_USER_ALLOW_NEW_TOPIC | PHORUM_USER_ALLOW_REPLY)) {
                if (!isset($this->m_properties['reader_email'])) {
                    $this->m_error = new PEAR_Error('EMail field is empty. You must fill in your EMail address.',
                    ACTION_PREVIEW_COMMENT_ERR_NO_EMAIL);
                    return false;
                }
            } else {
                $this->m_error = new PEAR_Error('You must be a registered user in order to submit a comment. Please subscribe or log in if you already have a subscription.',
                ACTION_PREVIEW_COMMENT_ERR_NO_PUBLIC);
                return false;
            }
        }

        // Check if the reader was banned from posting comments.
        if (Phorum_user::IsBanned($userRealName, $userEmail)) {
            $this->m_error = new PEAR_Error('You are banned from submitting comments.',
            ACTION_PREVIEW_COMMENT_ERR_BANNED);
            return false;
        }

        $this->m_error = ACTION_OK;
        return true;
    }
开发者ID:nistormihai,项目名称:Newscoop,代码行数:65,代码来源:MetaActionPreview_Comment.php

示例5: camp_forum_create

/**
 * Create a forum for a publication.
 *
 * @param Publication $p_publicationObj
 * @return Phorum_forum
 */
function camp_forum_create($p_publicationObj)
{
	// create the phorum
    $forum = new Phorum_forum();
    $forum->create();
    $p_publicationObj->setForumId($forum->getForumId());
	return $forum;
} // fn camp_forum_create
开发者ID:nistormihai,项目名称:Newscoop,代码行数:14,代码来源:pub_common.php

示例6: create

  	/**
  	 * @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
开发者ID:nistormihai,项目名称:Newscoop,代码行数:15,代码来源:SubscriptionDefaultTime.php

示例7: view

 public function view($issue_id)
 {
     $this->load->model(['Issue', 'Publication']);
     $issue = new Issue();
     $issue->load($issue_id);
     if (!$issue->issue_id) {
         show_404();
     }
     $publication = new Publication();
     $publication->load($issue->publication_id);
     $this->load->view('bootstrap/main', ['main' => 'magazines/magazine', 'issue' => $issue, 'publication' => $publication]);
 }
开发者ID:TraianAlex,项目名称:ci31,代码行数:12,代码来源:magazine.php

示例8: delete

 public function delete(Publication $publication)
 {
     $table = $publication->getTableName();
     $statement = "DELETE FROM {$table} WHERE id = :id LIMIT 1";
     $query = $this->session->prepare($statement);
     $query->bindParam(":id", $publication->id());
     try {
         $query->execute();
         return $query->rowCount() > 0;
     } catch (PDOException $err) {
         throw new PDOException($err->getMessage());
     }
 }
开发者ID:raigons,项目名称:bureauinteligencia,代码行数:13,代码来源:PublicationDao.php

示例9: getPublicationsLink

 /**
  * Returns the link for given publication and given service.
  *
  * @param Publication $publication The publication
  * @param string      $service     The service
  *
  * @return string
  */
 public static function getPublicationsLink(Publication $publication, $service)
 {
     switch ($service) {
         case 'Google Scholar':
             return 'http://scholar.google.com/scholar?q=allintitle:' . urlencode($publication->getTitle());
             break;
         case 'BASE':
             return 'http://www.base-search.net/Search/Results?lookfor=tit:' . urlencode($publication->getTitle());
             break;
         default:
             return 'unknown service!';
             break;
     }
 }
开发者ID:arkuuu,项目名称:publin,代码行数:22,代码来源:BibLink.php

示例10: Analyse

 public function Analyse($title, Subarea $subarea = null, State $state = null, $date = null)
 {
     $this->name_table = "analysis";
     parent::Publication($title, $subarea, $state, $date);
     $this->comments = new ArrayObject();
     $this->setLink(StringManager::removeSpecialChars($title));
 }
开发者ID:raigons,项目名称:bureauinteligencia,代码行数:7,代码来源:Analyse.php

示例11: smarty_function_set_publication

/**
 * Campsite set_publication function plugin
 *
 * Type:     function
 * Name:     set_publication
 * Purpose:
 *
 * @param array
 *     $p_params[name] The Name of the publication to be set
 *     $p_params[identifier] The Identifier of the publication to be set
 * @param object
 *     $p_smarty The Smarty object
 */
function smarty_function_set_publication($p_params, &$p_smarty)
{
    // gets the context variable
    $campsite = $p_smarty->getTemplateVars('gimme');
    if (isset($p_params['identifier'])) {
        $attrName = 'identifier';
        $attrValue = $p_params['identifier'];
        $publicationId = intval($p_params['identifier']);
    } elseif (isset($p_params['name'])) {
        $attrName = 'name';
        $attrValue = $p_params['name'];
        $publications = Publication::GetPublications($p_params['name']);
        if (!empty($publications)) {
            $publicationId = $publications[0]->getPublicationId();
        } else {
            $campsite->publication->trigger_invalid_value_error($attrName, $attrValue, $p_smarty);
            return false;
        }
    } else {
        $property = array_shift(array_keys($p_params));
        CampTemplate::singleton()->trigger_error("invalid parameter '{$property}' in set_publication");
        return false;
    }
    if ($campsite->publication->defined && $campsite->publication->identifier == $publicationId) {
        return;
    }
    $publicationObj = new MetaPublication($publicationId);
    if ($publicationObj->defined) {
        $campsite->publication = $publicationObj;
    } else {
        $campsite->publication->trigger_invalid_value_error($attrName, $attrValue, $p_smarty);
    }
}
开发者ID:nidzix,项目名称:Newscoop,代码行数:46,代码来源:function.set_publication.php

示例12: loadModel

 public function loadModel($id)
 {
     if (($model = Publication::model()->findByPk($id)) === null) {
         throw new CHttpException(404, Yii::t('PublicationModule.publication', 'Page was not found!'));
     }
     return $model;
 }
开发者ID:kuzmina-mariya,项目名称:4seasons,代码行数:7,代码来源:PublicationBackendController.php

示例13: onGenerate

 /**
  * @param Event $event
  */
 public static function onGenerate(Event $event)
 {
     $generator = $event->getGenerator();
     $provider = new CActiveDataProvider(Publication::model()->published());
     foreach (new CDataProviderIterator($provider) as $item) {
         $generator->addItem(Yii::app()->createAbsoluteUrl('/news/news/view', ['alias' => $item->alias]), strtotime($item->update_time), SitemapHelper::FREQUENCY_WEEKLY, 0.5);
     }
 }
开发者ID:kuzmina-mariya,项目名称:4seasons,代码行数:11,代码来源:PublicationSitemapGeneratorListener.php

示例14: Paper

 public function Paper($title, SubArea $subarea = null, File $file = null, State $state = null, $date = null, $event = null, PublicationType $type = null, $year = null)
 {
     $this->name_table = "paper";
     parent::Publication($title, $subarea, $state, $date);
     $this->file = $file;
     $this->event = $event;
     $this->type = $type;
     $this->year = $year;
 }
开发者ID:raigons,项目名称:bureauinteligencia,代码行数:9,代码来源:Paper.php

示例15: actionView

 public function actionView($alias)
 {
     $model = Publication::model()->published()->with('user')->findByAlias($alias);
     if (is_null($model)) {
         throw new CHttpException(404);
     }
     $this->currentCategory = !empty($model->categories) ? $model->categories[0] : null;
     $this->render('view', ['model' => $model]);
 }
开发者ID:kuzmina-mariya,项目名称:4seasons,代码行数:9,代码来源:PublicationController.php


注:本文中的Publication类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。