/** * 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; }
public function init() { camp_load_translation_strings('article_images'); $this->renditions = $this->_helper->service('image.rendition')->getRenditions(); $this->_helper->contextSwitch()->addActionContext('edit', 'json')->addActionContext('set-rendition', 'json')->addActionContext('remove-rendition', 'json')->addActionContext('article-attach', 'json')->addActionContext('set-attach', 'json')->addActionContext('set-detach', 'json')->addActionContext('upload', 'json')->addActionContext('edit-image-data', 'json')->initContext(); $this->view->previewWidth = 150; $this->view->previewHeight = 150; }
/** * @var Newscoop\Services\Resource\ResourceId */ public function init() { camp_load_translation_strings('api'); camp_load_translation_strings('articles'); $this->playlistRepository = $this->_helper->entity->getRepository('Newscoop\\Entity\\Playlist'); $this->playlistArticleRepository = $this->_helper->entity->getRepository('Newscoop\\Entity\\PlaylistArticle'); $this->_helper->contextSwitch->addActionContext('list-data', 'json')->addActionContext('save-data', 'json')->addActionContext('delete', 'json')->initContext(); }
public function init() { camp_load_translation_strings('article_images'); $this->_helper->contextSwitch()->addActionContext('add-item', 'json')->addActionContext('set-order', 'json')->addActionContext('remove-item', 'json')->addActionContext('index', 'json')->initContext(); $this->view->previewWidth = 100; $this->view->previewHeight = 100; $this->_helper->layout->setLayout('iframe'); }
/** */ public function init() { camp_load_translation_strings('users'); $this->userService = $this->_helper->service('user'); $this->userTypeService = $this->_helper->service('user_type'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('paginator.phtml'); $this->_helper->contextSwitch->addActionContext('index', 'json')->initContext(); }
public function init() { camp_load_translation_strings('api'); camp_load_translation_strings('users'); camp_load_translation_strings('user_subscriptions'); $currency = new Zend_Currency('en_US'); Zend_Registry::set('Zend_Currency', $currency); $this->_helper->layout->setLayout('modal'); }
public function init() { camp_load_translation_strings('comments'); // get feedback repository $this->feedbackRepository = $this->_helper->entity->getRepository('Newscoop\\Entity\\Feedback'); //$this->form = new Admin_Form_Comment; //$this->editForm = new Admin_Form_Comment_EditForm; return $this; }
public function init() { camp_load_translation_strings('comments'); // get comment repository $this->repository = $this->_helper->entity->getRepository('Newscoop\\Entity\\Comment\\Acceptance'); $this->form = new Admin_Form_CommentAcceptance(); $this->form->setMethod('post'); return $this; }
/** */ public function __construct() { global $Campsite, $ADMIN; // set paths $this->web = $Campsite['WEBSITE_URL']; $this->path = $this->web . '/admin/libs/ArticleList'; camp_load_translation_strings('articles'); camp_load_translation_strings('library'); $this->id = substr(sha1(get_class($this)), -6); }
/** * Unlink a topic from an article. * @param int $p_topicId * @param int $p_articleNumber * @return void */ public static function RemoveTopicFromArticle($p_topicId, $p_articleNumber) { global $g_ado_db; $queryStr = "DELETE FROM ArticleTopics WHERE NrArticle=$p_articleNumber AND TopicId=$p_topicId"; $g_ado_db->Execute($queryStr); if (function_exists("camp_load_translation_strings")) { camp_load_translation_strings("api"); } $logtext = getGS('Article topic $1 deleted from article $2', $p_topicId, $p_articleNumber); Log::Message($logtext, null, 145); } // fn RemoveTopicFromArticle
/** * @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
public function init() { camp_load_translation_strings('user_types'); $this->ruleRepository = $this->_helper->entity->getRepository('Newscoop\\Entity\\Acl\\Rule'); $this->ruleTypes = array('allow' => getGS('Allow'), 'deny' => getGS('Deny')); $this->groups = array('authoring' => getGS('Authoring'), 'structure' => getGS('Structure'), 'layout' => getGS('Layout'), 'users' => getGS('Users'), 'system' => getGS('System'), 'plugins' => getGS('Plugins')); $this->resources = array('authoring' => array('article' => getGS('Articles'), 'image' => getGS('Images'), 'comment' => getGS('Comments'), 'feedback' => getGS('Feedback Messages'), 'file' => getGS('Files'), 'editor' => getGS('Rich-Text Editor Preferences')), 'structure' => array('publication' => getGS('Publications'), 'issue' => getGS('Issues'), 'section' => getGS('Sections'), 'topic' => getGS('Topics'), 'language' => getGS('Languages'), 'playlist' => getGS('Article Playlists')), 'users' => array('user-group' => getGS('User Groups'), 'user' => getGS('Staff'), 'author' => getGS('Authors'), 'subscriber' => getGS('Subscribers'), 'subscription' => getGS('Subscriptions')), 'layout' => array('theme' => getGS('Themes'), 'template' => getGS('Templates'), 'article-type' => getGS('Article Types')), 'system' => array('system-preferences' => getGS('Global'), 'indexer' => getGS('Search Indexer'), 'country' => getGS('Countries'), 'log' => getGS('Log'), 'localizer' => getGS('Localizer'), 'backup' => getGS('Backup'), 'cache' => getGS('Cache'), 'notification' => getGS('Notification')), 'plugins' => array('plugin' => getGS('Plugins'), 'pluginpoll' => getGS('Polls'), 'plugin-recaptcha' => getGS('ReCaptcha'), 'plugin-soundcloud' => getGS('Soundcloud'))); // i18n $this->actions = array('add' => getGS('add'), 'admin' => getGS('admin'), 'attach' => getGS('attach'), 'clear' => getGS('clear'), 'delete' => getGS('delete'), 'edit' => getGS('edit'), 'enable' => getGS('enable'), 'guest' => getGS('guest'), 'manage' => getGS('manage'), 'moderate' => getGS('moderate'), 'moderator' => getGS('moderate'), 'move' => getGS('move'), 'notify' => getGS('notify'), 'publish' => getGS('publish'), 'translate' => getGS('translate'), 'view' => getGS('view'), 'bold' => getGS('bold'), 'charactermap' => getGS('character map'), 'copycutpaste' => getGS('copy/cut/paste'), 'enlarge' => getGS('enlarge'), 'findreplace' => getGS('find/replace'), 'fontcolor' => getGS('font color'), 'fontface' => getGS('font face'), 'fontsize' => getGS('font size'), 'horizontalrule' => getGS('horizontal rule'), 'image' => getGS('image'), 'indent' => getGS('indent'), 'italic' => getGS('italic'), 'link' => getGS('link'), 'listbullet' => getGS('list bullet'), 'listnumber' => getGS('list number'), 'sourceview' => getGS('source view'), 'spellcheckerenabled' => getGS('spell checker enabled'), 'statusbar' => getGS('statusbar'), 'strikethrough' => getGS('strikethrough'), 'subhead' => getGS('subhead'), 'subscript' => getGS('subscript'), 'superscript' => getGS('superscript'), 'table' => getGS('table'), 'textalignment' => getGS('text alignment'), 'textdirection' => getGS('text direction'), 'underline' => getGS('underline'), 'undoredo' => getGS('undo/redo')); $this->_helper->contextSwitch()->addActionContext('edit', 'json')->initContext(); $this->acl = Zend_Registry::get('acl'); $this->resource = $this->_getParam('user', false) ? 'user' : 'user-group'; }
public function init() { camp_load_translation_strings('comments'); // get comment repository $this->commentRepository = $this->_helper->entity->getRepository('Newscoop\\Entity\\Comment'); // get article repository $this->articleRepository = $this->_helper->entity->getRepository('Newscoop\\Entity\\Article'); // get language repository $this->languageRepository = $this->_helper->entity->getRepository('Newscoop\\Entity\\Language'); $this->form = new Admin_Form_Comment(); $this->editForm = new Admin_Form_Comment_EditForm(); return $this; }
/** * @param int $p_authorId * @param int $p_authorTypeId * @return void */ public static function AddAuthorTypeToAuthor($p_authorId, $p_authorTypeId) { global $g_ado_db; $queryStr = 'INSERT IGNORE INTO ' . self::TABLE . ' (fk_author_id, fk_type_id) VALUES (' . (int) $p_authorId . ', ' . (int) $p_authorTypeId . ')'; $g_ado_db->Execute($queryStr); if (function_exists("camp_load_translation_strings")) { camp_load_translation_strings("api"); } $logText = getGS('Author type $1 linked to author $2', $p_authorTypeId, $p_authorId); Log::Message($logText, null, 175); }
public function delete() { $articleNumber = $this->getArticleNumber(); $deleted = parent::delete(); if ($deleted) { if (function_exists("camp_load_translation_strings")) { camp_load_translation_strings("api"); } $logtext = getGS('Scheduled action deleted from Article #$1', $articleNumber); Log::Message($logtext, null, 37); } return $deleted; } // fn delete
/** * Legacy admin bootstrap */ protected function _initNewscoop() { global $ADMIN_DIR, $ADMIN, $g_user, $prefix, $Campsite; defined('WWW_DIR') || define('WWW_DIR', realpath(APPLICATION_PATH . '/../')); defined('LIBS_DIR') || define('LIBS_DIR', WWW_DIR . '/admin-files/libs'); $GLOBALS['g_campsiteDir'] = WWW_DIR; require_once $GLOBALS['g_campsiteDir'] . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'campsite_constants.php'; require_once CS_PATH_CONFIG . DIR_SEP . 'install_conf.php'; // goes to install process if configuration files does not exist yet if (!file_exists(CS_PATH_CONFIG . DIR_SEP . 'configuration.php') || !file_exists(CS_PATH_CONFIG . DIR_SEP . 'database_conf.php')) { header('Location: ' . $Campsite['SUBDIR'] . '/install/'); exit; } require_once CS_PATH_CONFIG . DIR_SEP . 'database_conf.php'; require_once CS_PATH_SITE . DIR_SEP . 'include' . DIR_SEP . 'campsite_init.php'; require_once CS_PATH_SITE . DIR_SEP . 'classes' . DIR_SEP . 'CampTemplateCache.php'; // detect extended login/logout files $prefix = file_exists(CS_PATH_SITE . DIR_SEP . 'admin-files' . DIR_SEP . 'ext_login.php') ? '/ext_' : '/'; require_once CS_PATH_SITE . DIR_SEP . $ADMIN_DIR . DIR_SEP . 'camp_html.php'; require_once CS_PATH_CLASSES . DIR_SEP . 'SecurityToken.php'; // load if possible before setting camp_report_bug error handler // to prevent error messages include_once 'HTML/QuickForm.php'; include_once 'HTML/QuickForm/RuleRegistry.php'; include_once 'HTML/QuickForm/group.php'; if (!defined('IN_PHPUNIT') && !getenv('PLZSTOPTHISERRORHANDLERBIZNIS')) { set_error_handler(function ($p_number, $p_string, $p_file, $p_line) { if (($p_number & error_reporting()) === 0) { return; // respect php settings } global $ADMIN_DIR, $Campsite; require_once $Campsite['HTML_DIR'] . "/{$ADMIN_DIR}/bugreporter/bug_handler_main.php"; camp_bug_handler_main($p_number, $p_string, $p_file, $p_line); }, E_ALL); } camp_load_translation_strings("api"); $plugins = CampPlugin::GetEnabled(true); foreach ($plugins as $plugin) { camp_load_translation_strings("plugin_" . $plugin->getName()); } // Load common translation strings camp_load_translation_strings('globals'); require_once APPLICATION_PATH . "/../{$ADMIN_DIR}/init_content.php"; if (file_exists($Campsite['HTML_DIR'] . '/reset_cache')) { CampCache::singleton()->clear('user'); unlink($GLOBALS['g_campsiteDir'] . '/reset_cache'); } }
public function init() { camp_load_translation_strings('api'); camp_load_translation_strings('users'); camp_load_translation_strings('user_subscription_sections'); $this->repository = $this->_helper->entity->getRepository('Newscoop\\Entity\\SubscriptionSection'); $sections = array(); $sectionRepository = $this->_helper->entity->getRepository('Newscoop\\Entity\\Section'); foreach ($sectionRepository->findAll() as $section) { if (!isset($sections[$section->getNumber()])) { $sections[$section->getNumber()] = $section->getName(); } } $this->view->sections = $sections; }
public function init() { camp_load_translation_strings('api'); camp_load_translation_strings('users'); camp_load_translation_strings('user_subscriptions'); $this->repository = $this->_helper->entity->getRepository('Newscoop\\Entity\\User\\Subscriber'); $this->form = new Admin_Form_Subscriber(); $this->form->setAction('')->setMethod('post'); // set form countries $countries = array('' => getGS('Select country')); foreach (Country::GetCountries(1) as $country) { $countries[$country->getCode()] = $country->getName(); } //$this->form->getElement('country')->setMultioptions($countries); }
public function indexAction() { global $controller; $controller = $this; require_once $GLOBALS['g_campsiteDir'] . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'campsite_constants.php'; require_once CS_PATH_CONFIG . DIR_SEP . 'install_conf.php'; $local_path = dirname(__FILE__) . '/include'; set_include_path($local_path . PATH_SEPARATOR . get_include_path()); require_once CS_PATH_INCLUDES . DIR_SEP . 'campsite_init.php'; if (file_exists(CS_PATH_SITE . DIR_SEP . 'reset_cache')) { CampCache::singleton()->clear('user'); @unlink(CS_PATH_SITE . DIR_SEP . 'reset_cache'); } // initializes the campsite object $campsite = new CampSite(); // loads site configuration settings $campsite->loadConfiguration(CS_PATH_CONFIG . DIR_SEP . 'configuration.php'); // starts the session $campsite->initSession(); if (file_exists(CS_PATH_SITE . DIR_SEP . 'conf' . DIR_SEP . 'upgrading.php')) { $this->upgrade(); exit(0); } // initiates the context $campsite->init(); // dispatches campsite $campsite->dispatch(); // triggers an event before render the page. // looks for preview language if any. $previewLang = $campsite->event('beforeRender'); if (!is_null($previewLang)) { require_once $GLOBALS['g_campsiteDir'] . '/template_engine/classes/SyntaxError.php'; set_error_handler('templateErrorHandler'); // loads translations strings in the proper language for the error messages display camp_load_translation_strings('preview', $previewLang); } else { set_error_handler(create_function('', 'return true;')); } if ($this->_request->getParam('logout') == 'true') { $this->_redirect('/auth/logout/?url=' . urlencode($this->getRequest()->getPathInfo())); } // renders the site $campsite->render(); // triggers an event after displaying $campsite->event('afterRender'); }
public function init() { camp_load_translation_strings('themes'); $resource = new ResourceId(__CLASS__); $themeService = $resource->getService(IThemeService::NAME); /* @var $themeService Newscoop\Service\Implementation\ThemeServiceLocalFileSystem */ $theme = $themeService->findById($this->_getParam('id')); /* @var $theme Newscoop\Entity\Theme */ $this->view->themeId = $this->_getParam('id'); $path = $theme->getPath(); $fullPath = $themeService->toFullPath($theme); $root = str_replace($path, '', $fullPath); $storage = new Storage($fullPath); $repository = $this->_helper->entity->getRepository('Newscoop\\Entity\\Template')->setBasePath($path); $this->service = new Template($storage, $repository); $this->service->setTheme($theme); $this->_helper->contextSwitch->addActionContext('get-items', 'json')->addActionContext('cache-templates', 'json')->initContext(); $this->view->basePath = $path; }
public function init() { camp_load_translation_strings('comments'); // get commenter repository $this->commenterRepository = $this->_helper->entity->getRepository('Newscoop\\Entity\\Comment\\Commenter'); // get acceptance repository $this->acceptanceRepository = $this->_helper->entity->getRepository('Newscoop\\Entity\\Comment\\Acceptance'); // get article repository $this->articleRepository = $this->_helper->entity->getRepository('Newscoop\\Entity\\Article'); // get publication repository $this->publicationRepository = $this->_helper->entity->getRepository('Newscoop\\Entity\\Publication'); // get comment repository $this->commentRepository = $this->_helper->entity->getRepository('Newscoop\\Entity\\Comment'); $this->getHelper('contextSwitch')->addActionContext('index', 'json')->initContext(); // set the default form for comment commenter and set method to post $this->form = new Admin_Form_Commenter(); $this->form->setMethod('post'); return $this; }
/** * Init * * @return void */ public function init() { camp_load_translation_strings('api'); camp_load_translation_strings('users'); $this->repository = $this->_helper->entity->getRepository('Newscoop\\Entity\\User\\Staff'); $this->form = new Admin_Form_Staff($this->_helper->acl->isAllowed('user', 'manage')); $this->form->setAction('')->setMethod('post'); if ($this->_helper->acl->isAllowed('user', 'manage')) { // set form user groups $groups = array(); $groupRepository = $this->_helper->entity->getRepository('Newscoop\\Entity\\User\\Group'); foreach ($groupRepository->findAll() as $group) { $groups[$group->getId()] = $group->getName(); } $this->form->getElement('groups')->setMultioptions($groups); } // set form countries $countries = array('' => getGS('Select country')); foreach (Country::GetCountries(1) as $country) { $countries[$country->getCode()] = $country->getName(); } $this->form->getElement('country')->setMultioptions($countries); }
<?php camp_load_translation_strings("plugin_debate"); if (!SecurityToken::isValid()) { camp_html_display_error(getGS('Invalid security token!')); exit; } // Check permissions if (!$g_user->hasPermission('plugin_debate_admin')) { camp_html_display_error(getGS('You do not have the right to manage debates.')); exit; } $f_debate_nr = Input::Get('f_debate_nr', 'int'); $f_fk_language_id = Input::Get('f_fk_language_id', 'int'); $f_answers = Input::Get('f_answer', 'array'); $f_copy_statistics = Input::Get('f_copy_statistics', 'boolean'); $data = array('title' => Input::Get('f_title', 'string'), 'question' => Input::Get('f_question', 'string'), 'date_begin' => Input::Get('f_date_begin', 'string'), 'date_end' => Input::Get('f_date_end', 'string'), 'votes_per_user' => Input::Get('f_votes_per_user', 'int')); foreach ($f_answers as $answer) { if (isset($answer['number']) && !empty($answer['number']) && strlen($answer['text'])) { $DebateAnswer = new DebateAnswer($f_fk_language_id, $f_debate_nr, $answer['number']); $answers[] = array('number' => $answer['number'], 'text' => $answer['text'], 'nr_of_votes' => $f_copy_statistics ? $DebateAnswer->getProperty('nr_of_votes') : 0, 'value' => $f_copy_statistics ? $DebateAnswer->getProperty('value') : 0); } } $source = new Debate($f_fk_language_id, $f_debate_nr); $copy = $source->createCopy($data, $answers); /* foreach($translation->getAnswers() as $answer) { $answer->setProperty('answer', $f_answers[$answer->getNumber()]); } */ header("Location: index.php");
<?php require_once $GLOBALS['g_campsiteDir'] . '/classes/GeoPreferences.php'; require_once $GLOBALS['g_campsiteDir'] . '/classes/GeoMap.php'; camp_load_translation_strings('api'); camp_load_translation_strings('geolocation'); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Expires" content="now" /> <title><?php putGS('Map Search Example'); ?> </title> <?php include dirname(__FILE__) . '/../../html_head.php'; ?> <link rel="stylesheet" type="text/css" href="<?php echo $Campsite['ADMIN_STYLE_URL']; ?> /map-preview.css" /> <link rel="stylesheet" type="text/css" href="<?php echo $Campsite['WEBSITE_URL']; ?> /js/geocoding/styles/map-info.css" /> <script type="text/javascript" src="<?php echo $Campsite['WEBSITE_URL'];
<?php camp_load_translation_strings("article_type_fields"); camp_load_translation_strings("api"); require_once $GLOBALS['g_campsiteDir'] . '/classes/Input.php'; require_once $GLOBALS['g_campsiteDir'] . '/classes/ArticleType.php'; require_once $GLOBALS['g_campsiteDir'] . "/classes/Topic.php"; // Check permissions if (!$g_user->hasPermission('ManageArticleTypes')) { camp_html_display_error(getGS("You do not have the right to reassign a field type.")); exit; } $articleTypeName = Input::Get('f_article_type'); $articleTypeFieldName = Input::Get('f_field_name'); $articleField = new ArticleTypeField($articleTypeName, $articleTypeFieldName); $crumbs = array(); $crumbs[] = array(getGS("Configure"), ""); $crumbs[] = array(getGS("Article Types"), "/{$ADMIN}/article_types/"); $crumbs[] = array($articleTypeName, ''); $crumbs[] = array(getGS("Article type fields"), "/{$ADMIN}/article_types/fields/?f_article_type=" . urlencode($articleTypeName)); $crumbs[] = array(getGS("Reassign a field type"), ""); echo camp_html_breadcrumbs($crumbs); include_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/javascript_common.php"; $lang = camp_session_get('LoginLanguageId', 1); $languageObj = new Language($lang); // Verify the merge rules $options = array(); $convertibleFromTypes = $articleField->getConvertibleToTypes(); foreach ($convertibleFromTypes as $type) { $options[$type] = ArticleTypeField::VerboseTypeName($type, $languageObj->getLanguageId()); }
<?php camp_load_translation_strings("comments"); require_once($GLOBALS['g_campsiteDir']."/include/phorum_load.php"); require_once($GLOBALS['g_campsiteDir'].'/classes/Phorum_forum.php'); require_once($GLOBALS['g_campsiteDir'].'/classes/Phorum_message.php'); require_once($GLOBALS['g_campsiteDir'].'/classes/Phorum_user.php'); require_once($GLOBALS['g_campsiteDir'].'/include/pear/PHPUnit.php'); class PhorumUser_Test extends PHPUnit_TestCase { function PhorumUser_Test($name) { $this->PHPUnit_TestCase($name); } function testUserCreateDelete() { $user = Phorum_user::GetByUserName('bob'); if ($user) { if (!$user->delete()) { $this->fail("Could not delete pre-existing user"); return; } } $user = new Phorum_user(); $user->create('bob', '*****@*****.**'); if (!$user->exists()) { $this->fail("Could not create user."); } if (!$user->delete()) {
<?php camp_load_translation_strings("sections"); require_once($GLOBALS['g_campsiteDir'].'/classes/Section.php'); require_once($GLOBALS['g_campsiteDir'].'/classes/Issue.php'); require_once($GLOBALS['g_campsiteDir'].'/classes/Publication.php'); require_once($GLOBALS['g_campsiteDir'].'/classes/Language.php'); require_once($GLOBALS['g_campsiteDir'].'/classes/User.php'); require_once($GLOBALS['g_campsiteDir'].'/classes/Input.php'); require_once($GLOBALS['g_campsiteDir'].'/classes/Log.php'); require_once($GLOBALS['g_campsiteDir'].'/classes/Subscription.php'); ?>
<?php require_once $GLOBALS['g_campsiteDir'] . "/conf/configuration.php"; require_once $GLOBALS['g_campsiteDir'] . "/classes/Input.php"; camp_load_translation_strings("localizer"); require_once dirname(__FILE__) . '/Localizer.php'; if (!SecurityToken::isValid()) { camp_html_display_error(getGS('Invalid security token!')); exit; } // Check permissions if (!$g_user->hasPermission('ManageLocalizer')) { camp_html_display_error(getGS("You do not have the right to manage the localizer.")); exit; } $prefix = Input::Get('prefix', 'string', '', true); $newPrefix = Input::Get('new_prefix'); $moveStr = Input::Get('string'); Localizer::ChangeStringPrefix($prefix, $newPrefix, $moveStr); header("Location: /{$ADMIN}/localizer/index.php"); exit;
<?PHP camp_load_translation_strings("plugin_blog"); $f_mode = Input::Get('f_mode', 'string'); // User role depend on path to this file. Tricky: moderator folder is just symlink to admin files! if (strpos($call_script, '/blog/admin/') !== false && $g_user->hasPermission('plugin_blog_admin')) { $is_admin = true; } if (strpos($call_script, '/blog/moderator/') !== false && $g_user->hasPermission('plugin_blog_moderator')) { $is_moderator = true; } // Check permissions if (!$is_admin && !$is_moderator) { camp_html_display_error(getGS('You do not have the right to manage blogs.')); exit; } switch ($f_mode) { case 'blog_topic':// Check permissions $f_blog_id = Input::Get('f_blog_id', 'int'); $topics = Blog::GetTopicTree(); $Blog = new Blog($f_blog_id); $language_id = $Blog->getLanguageId(); $object = 'BlogTopic'; $object_id = $f_blog_id; break; case 'entry_topic': $f_blogentry_id = Input::Get('f_blogentry_id', 'int');
/** * Set the workflow state of the article. * 'Y' = 'Published' * 'S' = 'Submitted' * 'N' = 'New' * * @param string $p_value * @return boolean */ public function setWorkflowStatus($p_value) { require_once($GLOBALS['g_campsiteDir'].'/classes/ArticleIndex.php'); $p_value = strtoupper($p_value); if ( ($p_value != 'Y') && ($p_value != 'S') && ($p_value != 'N') && ($p_value != 'M')) { return false; } // If the article is being published if ( ($this->getWorkflowStatus() != 'Y') && ($p_value == 'Y') ) { $this->setProperty('PublishDate', 'NOW()', true, true); } // Unlock the article if it changes status. if ( $this->getWorkflowStatus() != $p_value ) { $this->setIsLocked(false); } if ($p_value == 'Y' || $p_value == 'M') { $issueObj = new Issue($this->getPublicationId(), $this->getLanguageId(), $this->getIssueNumber()); if (!$issueObj->exists()) { return false; } $p_value = $issueObj->isPublished() ? 'Y' : 'M'; } $oldStatus = $this->getWorkflowStatus(); if (!parent::setProperty('Published', $p_value)) { return false; } CampCache::singleton()->clear('user'); $this->m_cacheUpdate = true; if (function_exists("camp_load_translation_strings")) { camp_load_translation_strings("api"); } $logtext = getGS('Article status changed from $1 to $2.', $this->getWorkflowDisplayString($oldStatus), $this->getWorkflowDisplayString($p_value)); Log::ArticleMessage($this, $logtext, null, 35); return true; } // fn setWorkflowStatus