Exemplo n.º 1
1
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");
?>
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
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;
    $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);
            }
        }
    }
}
    /**
     * 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;
    }
Exemplo n.º 5
0
/**
 * 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
  	/**
  	 * @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
Exemplo n.º 7
0
 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]);
 }
Exemplo n.º 8
0
 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());
     }
 }
Exemplo n.º 9
0
 /**
  * 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;
     }
 }
Exemplo n.º 10
0
 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));
 }
Exemplo n.º 11
0
/**
 * 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);
    }
}
 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;
 }
 /**
  * @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);
     }
 }
Exemplo n.º 14
0
 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;
 }
 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]);
 }
Exemplo n.º 16
0
 /**
  * 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);
     $user = $p_context->user;
     if ($user->defined) {
         $this->m_properties['reader_email'] = $user->email;
     } else {
         if (!isset($this->m_properties['reader_email'])) {
             $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_SUBMIT_COMMENT_ERR_NO_PUBLIC);
             return false;
         }
         if (!$publicationObj->getPublicComments()) {
             $this->m_error = new PEAR_Error('EMail field is empty. You must fill in your EMail address.', ACTION_SUBMIT_COMMENT_ERR_NO_EMAIL);
             return false;
         }
     }
     // Check if the reader was banned from posting comments.
     global $controller;
     $repositoryAcceptance = $controller->getHelper('entity')->getRepository('Newscoop\\Entity\\Comment\\Acceptance');
     $repository = $controller->getHelper('entity')->getRepository('Newscoop\\Entity\\Comment');
     if ($repositoryAcceptance->checkParamsBanned($userRealName, $userEmail, $userIp, $publication_id)) {
         $this->m_error = new PEAR_Error('You are banned from submitting comments.', ACTION_SUBMIT_COMMENT_ERR_BANNED);
         return false;
     }
     $this->m_error = ACTION_OK;
     return true;
 }
Exemplo n.º 17
0
 public function executeAdd(sfWebRequest $request)
 {
     $pubName = $request->getParameter("name");
     $pubId = $request->getParameter("id", null);
     if (!is_null($pubId)) {
         $pub = PublicationPeer::retrieveByPk($pubId);
     } else {
         $pub = new Publication();
     }
     $pub->setName($pubName);
     $pub->save();
     $c = new Criteria();
     $c->addAscendingOrderByColumn(PublicationPeer::NAME);
     $pager = new sfPropelPager("Publication", sfConfig::get("app_items_per_page"));
     $pager->setCriteria($c);
     $pager->setPage(1);
     $pager->init();
     $this->renderPartial("renderList", array("pager" => $pager));
     return sfView::NONE;
 }
 public function run()
 {
     if ($this->title === false) {
         $this->title = Yii::t('PublicationModule.publication', 'News');
     }
     $criteria = new CDbCriteria();
     if ($this->limit > 0) {
         $criteria->limit = (int) $this->limit;
     }
     $models = Publication::model()->sortByDate('DESC')->published()->onMainPage()->findAll($criteria);
     $this->render($this->view, ['models' => $models, 'title' => $this->title]);
 }
Exemplo n.º 19
0
	/**
	* Index page for Magazine controller.
	*/
	public function index() {
		/*// echo '<h2>My magazines</h2>';
		$this->load->model('Publication');
		$this->Publication->publication_name = 'Sandy Shore'; // create the record
		$this->Publication->save();
		// print_r($this->Publication);
		echo '<tt><pre>' . var_export($this->Publication,TRUE) . '<pre><tt>';

		$this->load->model('Issue');
		$issue = new Issue();
		$issue->publication_id = $this->Publication->publication_id;
		$issue->issue_number = 2;
		$issue->issue_date_publication = date('2015-02-01');
		$issue->save();
		echo '<tt><pre>' . var_export($issue,TRUE) . '<pre><tt>';

		$this->load->view('magazines');
		// $this->load->view('magazines');*/

		$data = array();

		$this->load->model('Publication');
		$publication = new Publication();
		$publication->load(2);
		$data['publication'] = $publication;

		$this->load->model('Issue');
		$issue = new Issue();
		$issue->load(2);
		$data['issue'] = $issue;

		$this->load->view('magazines');
		$this->load->view('magazine',$data);

		// echo "<pre>";
		// echo print_r($data);
		// echo "</pre>";

	}
Exemplo n.º 20
0
 /**
  * @param bool $full
  *
  * @return Publication|false
  */
 public function findSingle($full = false)
 {
     $result = parent::findSingle();
     if ($result) {
         $publication = new Publication($result);
         $repo = new AuthorRepository($this->db);
         $publication->setAuthors($repo->where('publication_id', '=', $publication->getId())->order('priority', 'ASC')->find());
         $repo = new FileRepository($this->db);
         $publication->setFiles($repo->where('publication_id', '=', $publication->getId())->find());
         $repo = new UrlRepository($this->db);
         $publication->setUrls($repo->where('publication_id', '=', $publication->getId())->find());
         if ($full === true) {
             $repo = new KeywordRepository($this->db);
             $publication->setKeywords($repo->where('publication_id', '=', $publication->getId())->order('name', 'ASC')->find());
             $repo = new CitationRepository($this->db);
             $publication->setCitations($repo->where('publication_id', '=', $publication->getId())->find());
         }
         return $publication;
     } else {
         return false;
     }
 }
 public function loadData()
 {
     if (!($limit = (int) $this->module->rssCount)) {
         throw new CHttpException(404);
     }
     $criteria = new CDbCriteria();
     $criteria->order = 't.date DESC';
     $criteria->limit = $limit;
     $this->title = $this->yupe->siteName;
     $this->description = $this->yupe->siteDescription;
     $alias = Yii::app()->getRequest()->getQuery('alias');
     if (!empty($categoryId)) {
         $category = PublicationCategory::model()->published()->findByAlias($alias);
         if (is_null($category)) {
             throw new CHttpException(404);
         }
         $this->title = $category->title;
         $this->description = $category->short_text;
         $criteria->scopes(['category' => $category->id]);
     }
     $this->data = Publication::model()->cache($this->yupe->coreCacheTime)->published()->with('user')->findAll($criteria);
 }
Exemplo n.º 22
0
$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);
if (!$srcSectionObj->exists()) {
    camp_html_display_error($translator->trans('Section does not exist.'));
    exit;
}
$dstPublicationObj = new Publication($f_dest_publication_id);
$dstIssueObj = new Issue($f_dest_publication_id, $f_language_id, $f_dest_issue_number);
$dstSectionObj = new Section($f_dest_publication_id, $f_dest_issue_number, $f_language_id, $f_dest_section_number);
$topArray = array('Pub' => $srcPublicationObj, 'Issue' => $srcIssueObj, 'Section' => $srcSectionObj);
camp_html_content_top($translator->trans('Duplicating section', array(), 'sections'), $topArray);
?>
<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
<TR>
	<TD COLSPAN="2">
		<B> <?php 
echo $translator->trans("Duplicating section", array(), 'sections');
?>
 </B>
		<HR NOSHADE SIZE="1" COLOR="BLACK">
	</TD>
Exemplo n.º 23
0
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;
}

$issueObj = new Issue($Pub, $Language, $Issue);
$publicationObj = new Publication($Pub);
$sectionObj = new Section($Pub, $Issue, $Language, $Section);

if (!$publicationObj->exists()) {
    camp_html_display_error(getGS('Publication does not exist.'));
    exit;
}
if (!$issueObj->exists()) {
	camp_html_display_error(getGS('No such issue.'));
	exit;
}

$correct = true;
$modified = false;

$errors = array();
Exemplo n.º 24
0
// 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>');
}

$aliases = 0;
if ($correct) {
	$aliasDups = count(Alias::GetAliases(null, null, $cName));
	if ($aliasDups <= 0) {
		$newAlias = new Alias();
Exemplo n.º 25
0
    // input validation failed, errors should be set by the plugin hook
    forward(REFERER);
}
$new_entity = true;
if (!empty($guid)) {
    $publication = get_entity($guid);
    if (empty($publication)) {
        register_error(elgg_echo('InvalidParameterException:GUIDNotFound', [$guid]));
        forward('publications/all');
    }
    if (!$publication instanceof Publication || !$publication->canEdit()) {
        forward('publications/all');
    }
    $new_entity = false;
} else {
    $publication = new Publication();
    $publication->owner_guid = elgg_get_logged_in_user_guid();
    $publication->container_guid = (int) get_input('container_guid', elgg_get_logged_in_user_guid());
    $publication->access_id = $access;
    $publication->title = $title;
    if (!$publication->save()) {
        register_error(elgg_echo('publication:error'));
        forward(REFERER);
    }
}
$publication->access_id = $access;
$publication->title = $title;
if (!$publication->save()) {
    register_error(elgg_echo('publication:error'));
    forward(REFERER);
}
Exemplo n.º 26
0
if (!SecurityToken::isValid()) {
    camp_html_display_error(getGS('Invalid security token!'));
    exit;
}
// Check permissions
if (!$g_user->hasPermission('DeletePub')) {
    camp_html_display_error(getGS("You do not have the right to delete publications."));
    exit;
}
$Pub = Input::Get('Pub', 'int');
if (!Input::IsValid()) {
    camp_html_display_error(getGS('Invalid input: $1', Input::GetErrorString()), $_SERVER['REQUEST_URI']);
    exit;
}
$doDelete = true;
$publicationObj = new Publication($Pub);
$issuesRemaining = Issue::GetNumIssues($Pub);
$errorMsgs = array();
if ($issuesRemaining > 0) {
    $errorMsgs[] = getGS('There are $1 issue(s) left.', $issuesRemaining);
    $doDelete = false;
}
$sectionsRemaining = Section::GetSections($Pub, null, null, null, null, null, true);
if (count($sectionsRemaining) > 0) {
    $errorMsgs[] = getGS('There are $1 section(s) left.', count($sectionsRemaining));
    $doDelete = false;
}
$articlesRemaining = Article::GetNumUniqueArticles($Pub);
if ($articlesRemaining > 0) {
    $errorMsgs[] = getGS('There are $1 article(s) left.', $articlesRemaining);
    $doDelete = false;
Exemplo n.º 27
0
 /**
  * Return all publications as an array of Publication objects.
  *
  * @param string $p_name
  * @param int $p_aliasId
  * @param array $p_sqlOptions
  *
  * @return array
  */
 public static function GetPublications($p_name = null, $p_aliasId = null, $p_sqlOptions = null)
 {
     global $g_ado_db;
     if (is_null($p_sqlOptions)) {
         $p_sqlOptions = array();
     }
     if (!isset($p_sqlOptions["ORDER BY"])) {
         $p_sqlOptions["ORDER BY"] = array("Name" => "ASC");
     }
     $tmpPub = new Publication();
     $columns = $tmpPub->getColumnNames(true);
     $queryStr = 'SELECT ' . implode(',', $columns) . ', Aliases.Name as Alias' . ', URLTypes.Name as URLType' . ', Languages.OrigName as NativeName' . ' FROM Publications, Languages, Aliases, URLTypes' . ' WHERE Publications.IdDefaultAlias = Aliases.Id ' . ' AND Publications.IdURLType = URLTypes.Id ' . ' AND Publications.IdDefaultLanguage = Languages.Id ';
     if (is_string($p_name)) {
         $queryStr .= " AND Publications.Name=" . $g_ado_db->escape($p_name);
     }
     if (is_numeric($p_aliasId)) {
         $queryStr .= " AND Publications.IdDefaultAlias={$p_aliasId}";
     }
     $queryStr = DatabaseObject::ProcessOptions($queryStr, $p_sqlOptions);
     $publications = DbObjectArray::Create('Publication', $queryStr);
     return $publications;
 }
Exemplo n.º 28
0
 // Error checking
 if (!isset($articles[$articleNumber][$tmpLanguageId])) {
     continue;
 }
 // Grab the first article - it doesnt matter which one.
 $tmpArticle = $articles[$articleNumber][$tmpLanguageId];
 // Copy all the translations requested.
 $newArticles = $tmpArticle->copy($f_destination_publication_id, $f_destination_issue_number, $f_destination_section_number, $g_user->getUserId(), $languageArray);
 // Set properties for each new copy.
 foreach ($newArticles as $newArticle) {
     // Set the name of the new copy
     $newArticle->setTitle($articleNames[$articleNumber][$newArticle->getLanguageId()]);
     // Set the default "comment enabled" status based
     // on the publication config settings.
     if ($f_destination_publication_id > 0) {
         $tmpPub = new Publication($f_destination_publication_id);
         $commentDefault = $tmpPub->commentsArticleDefaultEnabled();
         $newArticle->setCommentsEnabled($commentDefault);
     }
     foreach ($events as $event) {
         //$repo->add($timeSet, $articleId, 'schedule');
         $newEvent = $ArticleDatetimeRepository->getEmpty();
         $newEvent->setArticleId($newArticle->getArticleNumber());
         $newEvent->setArticleType($event->getArticleType());
         $newEvent->setStartDate($event->getStartDate());
         $newEvent->setStartTime($event->getStartTime());
         $newEvent->setEndDate($event->getEndDate());
         $newEvent->setEndTime($event->getEndTime());
         $newEvent->setRecurring($event->getRecurring());
         $newEvent->setFieldName($event->getFieldName());
         $em->persist($newEvent);
Exemplo n.º 29
0
require_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/camp_html.php";
require_once $GLOBALS['g_campsiteDir'] . '/classes/Language.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Publication.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Issue.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Section.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Article.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Input.php';
$maxSelectLength = 60;
$languageId = Input::get('IdLanguage', 'int', 0, true);
$publicationId = Input::get('IdPublication', 'int', 0, true);
$sectionId = Input::get('NrSection', 'int', 0, true);
$issueId = Input::get('NrIssue', 'int', 0, true);
$articleId = Input::get('NrArticle', 'int', 0, true);
$target = Input::get('targetlist', 'string', '', true);
$languages = Language::GetLanguages(null, null, null, array(), array(), true);
$publications = Publication::GetPublications();
if ($languageId != 0 && $publicationId != 0) {
    $issues = Issue::GetIssues($publicationId, $languageId, null, null, null, false, null, true);
}
if ($languageId != 0 && $publicationId != 0 && $issueId != 0) {
    $sections = Section::GetSections($publicationId, $issueId, $languageId, null, null, null, true);
}
if ($languageId != 0 && $publicationId != 0 && $issueId != 0 && $sectionId != 0) {
    $articles = Article::GetArticles($publicationId, $issueId, $sectionId, $languageId);
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>{#campsiteinternallink_dlg.title}</title>
Exemplo n.º 30
0
<?php
require_once($GLOBALS['g_campsiteDir']."/$ADMIN_DIR/issues/issue_common.php");
require_once($GLOBALS['g_campsiteDir'].'/classes/Template.php');
require_once($GLOBALS['g_campsiteDir'].'/classes/Alias.php');

$Language = Input::Get('Language', 'int', 0);
$Pub = Input::Get('Pub', 'int', 0);
$Issue = Input::Get('Issue', 'int', 0);

$errorStr = "";
$languageObj = new Language($Language);
if (!$languageObj->exists()) {
	$errorStr = getGS('There was an error reading the language parameter.');
}
if ($errorStr == "") {
	$publicationObj = new Publication($Pub);
	if (!$publicationObj->exists())
		$errorStr = getGS('There was an error reading the publication parameter.');
}
if ($errorStr == "") {
	$issueObj = new Issue($Pub, $Language, $Issue);
	if (!$issueObj->exists())
		$errorStr = getGS('There was an error reading the issue parameter.');
}
if ($errorStr == "" && ($templateId = $issueObj->getIssueTemplateId()) == 0)
	$errorStr = 'This issue cannot be previewed. Please make sure it has the front page template selected.';

if ($errorStr != "") {
	camp_html_display_error($errorStr, null, true);
}