if ($cSubs == "d") { $numSubscriptionsDeleted = Subscription::DeleteSubscriptionsInSection($Pub, $Section); if ($numSubscriptionsDeleted < 0) { $errors[] = getGS('Error updating subscriptions.'); } } $conflictingSection = array_pop(Section::GetSections($Pub, $Issue, $Language, $cShortName, null, null, true)); if (is_object($conflictingSection) && ($conflictingSection->getSectionNumber() != $Section)) { $conflictingSectionLink = "/$ADMIN/sections/edit.php?Pub=$Pub&Issue=$Issue&Language=$Language&Section=".$conflictingSection->getSectionNumber(); $msg = getGS('The URL name must be unique for all sections in this issue.<br>The URL name you specified ("$1") conflicts with section "$2$3. $4$5"', $cShortName, "<a href='$conflictingSectionLink' class='error_message' style='color:#E30000;'>", $conflictingSection->getSectionNumber(), htmlspecialchars($conflictingSection->getName()), "</a>"); camp_html_add_msg($msg); // placeholder for localization string - we might need this later. // getGS("The section could not be changed."); } else { $modified &= $sectionObj->setUrlName($cShortName); camp_html_add_msg(getGS("Section updated"), "ok"); } $logtext = getGS('Section "$1" ($2) updated. (Publication: $3, Issue: $4)', $cName, $Section, $publicationObj->getPublicationId(), $issueObj->getIssueNumber()); Log::Message($logtext, $g_user->getUserId(), 21); } camp_html_goto_page($editUrl); ?>
} if (camp_html_has_msgs()) { camp_html_goto_page($backLink); } $lastIssueObj = Issue::GetLastCreatedIssue($f_publication_id); $publicationObj = new Publication($f_publication_id); $newIssueObj = new Issue($f_publication_id, $f_language_id, $f_issue_number); $created = $newIssueObj->create($f_url_name, array('Name' => $f_issue_name)); //add default theme $resourceId = new ResourceId('Publication/Edit'); $syncRsc = $resourceId->getService(ISyncResourceService::NAME); $outputService = $resourceId->getService(IOutputService::NAME); $outputSettingIssueService = $resourceId->getService(IOutputSettingIssueService::NAME); $issueService = $resourceId->getService(IIssueService::NAME); $themeManagementService = $resourceId->getService(IThemeManagementService::NAME_1); $publicationThemes = $themeManagementService->getThemes($publicationObj->getPublicationId()); if (is_array($publicationThemes) && count($publicationThemes) > 0) { if ($lastIssueObj instanceof Issue) { $outSetIssues = $outputSettingIssueService->findByIssue($lastIssueObj->getIssueId()); $themePath = null; if (count($outSetIssues) > 0) { $outSetIssue = $outSetIssues[0]; $themePath = $outSetIssue->getThemePath()->getPath(); } if ($themePath == null) { $themePath = $publicationThemes[0]->getPath(); } if ($themePath == null) { $f_theme_id = '0'; } else { $f_theme_id = $themePath;
'PaidTime' => $f_paid, 'TrialTime' => $f_trial, 'UnitCost' => $f_unit_cost, 'UnitCostAllLang' => $f_unit_cost_all_lang, 'Currency' => $f_currency, 'comments_enabled' => $f_comments_enabled, 'comments_article_default_enabled'=> $f_comments_article_default, 'comments_subscribers_moderated' => $f_comments_subscribers_moderated, 'comments_public_moderated' => $f_comments_public_moderated, 'comments_captcha_enabled' => $f_comments_captcha_enabled, 'comments_spam_blocking_enabled' => $f_comments_spam_blocking_enabled, 'seo' => serialize($f_seo)); $created = $publicationObj->create($columns); if ($created) { $alias->setPublicationId($publicationObj->getPublicationId()); $forum = camp_forum_create($publicationObj, $f_comments_public_enabled); camp_forum_update($forum, $f_name, $f_comments_enabled, $f_comments_public_enabled); $setting = new Phorum_setting('mod_emailcomments', 'S'); if (!$setting->exists()) { $setting->create(); } $setting->update(array('addresses' => array($forum->getForumId() => $f_comments_moderator_to))); $setting->update(array('from_addresses' => array($forum->getForumId() => $f_comments_moderator_from))); camp_html_add_msg("Publication created.", "ok"); camp_html_goto_page("/$ADMIN/pub/edit.php?Pub=".$publicationObj->getPublicationId()); } else { $alias->delete(); camp_html_add_msg(getGS('The publication could not be added.'));
public static function GetLastIssue(Publication $publication, $p_langId = null, $p_isPublished = true) { global $g_ado_db; if (!$publication->exists()) { return null; } if (empty($p_langId)) { $p_langId = $publication->getDefaultLanguageId(); } $sql = 'SELECT MAX(Number) AS Number FROM Issues ' . 'WHERE IdPublication = ' . (int) $publication->getPublicationId() . ' AND IdLanguage = ' . (int) $p_langId; if ($p_isPublished == true) { $sql .= " AND Published = 'Y'"; } $issueNo = $g_ado_db->GetOne($sql); if (empty($issueNo)) { return null; } return array($issueNo, $p_langId); }
exit; } $backLink = "/{$ADMIN}/pub/add.php"; if (empty($f_name)) { camp_html_add_msg(getGS('You must fill in the $1 field.', '<B>' . getGS('Name') . '</B>')); } if (empty($f_default_alias)) { camp_html_add_msg(getGS('You must fill in the $1 field.', '<B>' . getGS('Site') . '</B>')); } if (camp_html_has_msgs()) { camp_html_goto_page($backLink); } camp_is_alias_conflicting($f_default_alias); camp_is_publication_conflicting($f_name); if (camp_html_has_msgs()) { camp_html_goto_page($backLink); } $alias = new Alias(); $alias->create(array('Name' => $f_default_alias)); $publicationObj = new Publication(); $columns = array('Name' => $f_name, 'IdDefaultAlias' => $alias->getId(), 'IdDefaultLanguage' => $f_language, 'IdURLType' => $f_url_type, 'TimeUnit' => $f_time_unit, 'PaidTime' => $f_paid, 'TrialTime' => $f_trial, 'UnitCost' => $f_unit_cost, 'UnitCostAllLang' => $f_unit_cost_all_lang, 'Currency' => $f_currency, 'comments_enabled' => $f_comments_enabled, 'comments_article_default_enabled' => $f_comments_article_default, 'comments_subscribers_moderated' => $f_comments_subscribers_moderated, 'comments_public_moderated' => $f_comments_public_moderated, 'comments_public_enabled' => $f_comments_public_enabled, 'comments_captcha_enabled' => $f_comments_captcha_enabled, 'comments_spam_blocking_enabled' => $f_comments_spam_blocking_enabled, 'comments_moderator_to' => $f_comments_moderator_to, 'comments_moderator_from' => $f_comments_moderator_from, 'seo' => serialize($f_seo)); $created = $publicationObj->create($columns); if ($created) { $alias->setPublicationId($publicationObj->getPublicationId()); camp_html_add_msg("Publication created.", "ok"); camp_html_goto_page("/{$ADMIN}/pub/edit.php?Pub=" . $publicationObj->getPublicationId()); } else { $alias->delete(); camp_html_add_msg(getGS('The publication could not be added.')); camp_html_goto_page($backLink); }