/** * CampCache class constructor. * */ private function __construct($p_cacheEngine) { global $Campsite; if (empty($p_cacheEngine)) { return; } $this->m_cacheEngine = CacheEngine::Factory($p_cacheEngine); if (is_null($this->m_cacheEngine) || !$this->m_cacheEngine->isSupported()) { self::$m_enabled = false; SystemPref::Set('DBCacheEngine', ''); CampSession::singleton()->setData('system_preferences', null, 'default', true); return; } else { self::$m_enabled = true; } if (isset($Campsite['CAMP_SECRET'])) { $this->m_secret = $Campsite['CAMP_SECRET']; } else { $this->m_secret = $Campsite['DATABASE_USER'] .$Campsite['DATABASE_NAME'] .$Campsite['DATABASE_SERVER_ADDRESS'] .$Campsite['WWW_DIR']; } } // fn __construct
if (Input::Get('save')) { if (!SecurityToken::isValid()) { camp_html_display_error(getGS('Invalid security token!')); exit; } $f_recaptcha_enabled = Input::Get('f_recaptcha_enabled', 'string', 'N'); $f_recaptcha_subscriptions_enabled = Input::Get('f_recaptcha_subscriptions_enabled', 'string', 'N'); $f_recaptcha_public_key = Input::Get('f_recaptcha_public_key', 'string'); $f_recaptcha_private_key = Input::Get('f_recaptcha_private_key', 'string'); SystemPref::Set('PLUGIN_RECAPTCHA_ENABLED', $f_recaptcha_enabled); SystemPref::Set('PLUGIN_RECAPTCHA_SUBSCRIPTIONS_ENABLED', $f_recaptcha_subscriptions_enabled); SystemPref::Set('PLUGIN_RECAPTCHA_PUBLIC_KEY', $f_recaptcha_public_key); SystemPref::Set('PLUGIN_RECAPTCHA_PRIVATE_KEY', $f_recaptcha_private_key); camp_html_add_msg(getGS('reCAPTCHA preferences updated.'), 'ok'); } echo camp_html_breadcrumbs(array( array(getGS('Plugins'), $Campsite['WEBSITE_URL'] . '/admin/plugins/manage.php'), array(getGS('reCAPTCHA'), ''), array(getGS('reCAPTCHA Settings'), ''), )); camp_html_display_msgs(); ?> <p></p> <table border="0" width="600" cellspacing="0" cellpadding="0" class="box_table">
SystemPref::Set("UseDBReplication", 'N'); } // template filter SystemPref::Set("TemplateFilter", $f_template_filter); // External cron management SystemPref::Set('ExternalCronManagement', $f_external_cron_management); // geolocation foreach ($f_geo as $key => $value) { $name = ''; foreach (explode('_', $key) as $part) { $name .= ucfirst($part); } SystemPref::Set($name, $value); } $logtext = getGS('System preferences updated'); Log::Message($logtext, $g_user->getUserId(), 171); // Success message if everything was ok if ($msg_ok == 1) { camp_html_add_msg(getGS("System preferences updated."), "ok"); } CampPlugin::PluginAdminHooks(__FILE__); camp_html_goto_page("/$ADMIN/system_pref/"); ?>
if (!SecurityToken::isValid()) { camp_html_display_error(getGS('Invalid security token!')); exit; } $f_blogcomment_use_captcha = Input::Get('f_blogcomment_use_captcha', 'string', 'N'); $f_blogcomment_mode = Input::Get('f_blogcomment_mode', 'string', 'registered'); $f_blog_root_topic_id = Input::Get('f_blog_root_topic_id', 'int', 0); $f_blog_root_mood_id = Input::Get('f_blog_root_mood_id', 'int', 0); $f_blog_image_derivates = Input::Get('f_blog_image_derivates', 'string'); SystemPref::Set('PLUGIN_BLOGCOMMENT_USE_CAPTCHA', $f_blogcomment_use_captcha); SystemPref::Set('PLUGIN_BLOGCOMMENT_MODE', $f_blogcomment_mode); SystemPref::Set('PLUGIN_BLOG_ROOT_TOPIC_ID', $f_blog_root_topic_id); SystemPref::Set('PLUGIN_BLOG_ROOT_MOOD_ID', $f_blog_root_mood_id); SystemPref::Set('PLUGIN_BLOG_IMAGE_DERIVATES', $f_blog_image_derivates); camp_html_add_msg(getGS("Blog preferences updated."), "ok"); } echo camp_html_breadcrumbs(array( array(getGS('Plugins'), $Campsite['WEBSITE_URL'] . '/admin/plugins/manage.php'), array(getGS('Blogs'), $Campsite['WEBSITE_URL'] . '/admin/blog/admin/list_blogs.php'), array(getGS('Blog Settings'), ''), )); camp_html_display_msgs(); ?> <FORM name="selector" method="post"> <?php echo SecurityToken::FormParameter(); ?>
/** * Set default widgets for all existing users (called after install/upgrade) * @return void */ public static function SetDefaultWidgetsAll() { // do only once if (SystemPref::Get(self::SETTING) != NULL) { return; } SystemPref::Set(self::SETTING, time()); // set widgets per user $users = (array) $GLOBALS['controller']->getHelper('service')->getService('user')->findBy(array('is_admin' => 1)); foreach ($users as $user) { WidgetManager::SetDefaultWidgets($user->getUserId()); } }
} SystemPref::Set("DBReplicationPort", $f_db_repl_port); } else { SystemPref::Set("UseDBReplication", 'N'); } // template filter SystemPref::Set("TemplateFilter", $f_template_filter); // External cron management SystemPref::Set('ExternalCronManagement', $f_external_cron_management); // geolocation foreach ($f_geo as $key => $value) { $name = ''; foreach (explode('_', $key) as $part) { $name .= ucfirst($part); } SystemPref::Set($name, $value); } $f_mysql_client_command_path = Input::Get('f_mysql_client_command_path', 'string'); SystemPref::Set('MysqlClientCommandPath', $f_mysql_client_command_path); require_once $GLOBALS['g_campsiteDir'] . '/bin/cli_script_lib.php'; global $Campsite; global $g_ado_db; if (!camp_geodata_loaded($g_ado_db) && !empty($f_mysql_client_command_path)) { camp_load_geodata($f_mysql_client_command_path, $Campsite['db']); } // Success message if everything was ok if ($msg_ok == 1) { camp_html_add_msg(getGS("System preferences updated."), "ok"); } CampPlugin::PluginAdminHooks(__FILE__); camp_html_goto_page("/{$ADMIN}/system_pref/");
if (!$g_user->hasPermission('ChangeSystemPreferences')) { camp_html_display_error(getGS("You do not have the right to change system preferences.")); exit; } $crumbs = array(); $crumbs[] = array(getGS("Configure"), ""); $crumbs[] = array(getGS("System Preferences"), ""); echo camp_html_breadcrumbs($crumbs); include_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/javascript_common.php"; $htmlFormData['SiteTitle'] = htmlspecialchars(SystemPref::Get("SiteTitle")); $htmlFormData['SiteMetaKeywords'] = htmlspecialchars(SystemPref::Get("SiteMetaKeywords")); $htmlFormData['SiteMetaDescription'] = htmlspecialchars(SystemPref::Get("SiteMetaDescription")); $htmlFormData['SiteSecretKey'] = htmlspecialchars(SystemPref::Get("SiteSecretKey")); $max_upload_filesize = SystemPref::Get("MaxUploadFileSize"); if (empty($max_upload_filesize) || $max_upload_filesize == 0) { SystemPref::Set("MaxUploadFileSize", ini_get('upload_max_filesize')); } $availableCacheEngines = CacheEngine::AvailableEngines(); $availableTemplateCacheHandlers = CampTemplateCache::availableHandlers(); ?> <p></p> <?php camp_html_display_msgs(); ?> <form action="/<?php echo $ADMIN; ?> /system_pref/do_edit.php" onsubmit="return <?php camp_html_fvalidate();
/** * Set default widgets for all existing users (called after install/upgrade) * @return void */ public static function SetDefaultWidgetsAll() { require_once dirname(__FILE__) . '/../User.php'; // do only once if (SystemPref::Get(self::SETTING) != NULL) { return; } SystemPref::Set(self::SETTING, time()); // set widgets per user $users = (array) User::GetUsers(); foreach ($users as $user) { WidgetManager::SetDefaultWidgets($user->getUserId()); } }
camp_html_display_error(getGS('You do not have the right to manage SoundCloud preferences.')); exit; } if (Input::Get('save') || Input::Get('check')) { if (!SecurityToken::isValid()) { camp_html_display_error(getGS('Invalid security token!')); exit; } $f_soundcloud_client_id = Input::Get('f_soundcloud_client_id', 'string'); $f_soundcloud_client_secret = Input::Get('f_soundcloud_client_secret', 'string'); $f_soundcloud_username = Input::Get('f_soundcloud_username', 'string'); $f_soundcloud_password = Input::Get('f_soundcloud_password', 'string'); SystemPref::Set('PLUGIN_SOUNDCLOUD_CLIENT_ID', $f_soundcloud_client_id); SystemPref::Set('PLUGIN_SOUNDCLOUD_CLIENT_SECRET', $f_soundcloud_client_secret); SystemPref::Set('PLUGIN_SOUNDCLOUD_USERNAME', $f_soundcloud_username); SystemPref::Set('PLUGIN_SOUNDCLOUD_PASSWORD', $f_soundcloud_password); SystemPref::Set('PLUGIN_SOUNDCLOUD_USER_ID', ''); if (Input::Get('check')) { $soundcloud = new SoundcloudAPI(); if ($soundcloud->login()) { camp_html_add_msg(getGS('SoundCloud checked successfully.'), 'ok'); } else { camp_html_add_msg(getGS('SoundCloud reports an error:') . ' ' . $soundcloud->error, 'error'); } } else { camp_html_add_msg(getGS('SoundCloud preferences updated.'), 'ok'); } } echo camp_html_breadcrumbs(array(array(getGS('Plugins'), $Campsite['WEBSITE_URL'] . '/admin/plugins/manage.php'), array(getGS('SoundCloud'), ''), array(getGS('SoundCloud Preferences'), ''))); camp_html_display_msgs(); include 'templates/preferences.php';
function profile() { if (!$this->_token && !$this->login()) { return array(); } $ch = curl_init(); $url = "https://api.soundcloud.com/me.json"; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: OAuth ' . $this->_token)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 15); $result = curl_exec($ch); curl_close($ch); $aResult = json_decode($result, true); if (empty($aResult['error']) && empty($aResult['errors']) && is_array($aResult)) { SystemPref::Set('PLUGIN_SOUNDCLOUD_USER_ID', $aResult['id']); return $aResult; } elseif (@$aResult['error'] == '401 - Unauthorized' || empty($aResult)) { $this->_token = null; return $this->profile(); } $this->_setError($aResult); return array(); }