Inheritance: extends BackEndController
 /**
  * Settings page.
  *
  * @param SettingsController $sender
  */
 public function settingsController_hipChat_create($sender)
 {
     $sender->permission('Garden.Settings.Manage');
     $conf = new ConfigurationModule($sender);
     $conf->initialize(array('HipChat.Account' => array('Control' => 'TextBox', 'Type' => 'string', 'LabelCode' => t('Account Name'), 'Options' => array('class' => 'InputBox LargeInput')), 'HipChat.Room' => array('Control' => 'TextBox', 'Type' => 'int', 'LabelCode' => t('Room ID'), 'Options' => array('class' => 'InputBox SmallInput')), 'HipChat.Token' => array('Control' => 'TextBox', 'Type' => 'string', 'LabelCode' => t('Authorization Token'), 'Options' => array('class' => 'InputBox LargeInput'))));
     $sender->addSideMenu();
     $sender->setData('Title', sprintf(T('%s Settings'), 'HipChat'));
     $sender->ConfigurationModule = $conf;
     $conf->renderAll();
 }
Beispiel #2
0
 function getAPICredentials()
 {
     $apiCredInfo = array();
     $settingCtrler = new SettingsController();
     $stList = $settingCtrler->__getAllSettings(true, 1, 'api');
     // loop through settings values
     foreach ($stList as $stInfo) {
         $apiCredInfo[$stInfo['set_name']] = $stInfo['set_val'];
     }
     return $apiCredInfo;
 }
 /**
  * Override the index of the dashboard's settings controller in the to render new statistics.
  *
  * @param SettingsController $sender Instance of the dashboard's settings controller.
  */
 public function settingsController_home_create($sender)
 {
     $statsUrl = $this->AnalyticsServer;
     if (!stringBeginsWith($statsUrl, 'http:') && !stringBeginsWith($statsUrl, 'https:')) {
         $statsUrl = Gdn::request()->scheme() . "://{$statsUrl}";
     }
     Gdn_Theme::section('DashboardHome');
     $sender->setData('IsWidePage', true);
     // Tell the page where to find the Vanilla Analytics provider
     $sender->addDefinition('VanillaStatsUrl', $statsUrl);
     $sender->setData('VanillaStatsUrl', $statsUrl);
     // Load javascript & css, check permissions, and load side menu for this page.
     $sender->addJsFile('settings.js');
     $sender->title(t('Dashboard'));
     $sender->RequiredAdminPermissions = ['Garden.Settings.View', 'Garden.Settings.Manage', 'Garden.Community.Manage'];
     $sender->fireEvent('DefineAdminPermissions');
     $sender->permission($sender->RequiredAdminPermissions, '', false);
     $sender->setHighlightRoute('dashboard/settings');
     if (!Gdn_Statistics::checkIsEnabled() && Gdn_Statistics::checkIsLocalhost()) {
         $sender->render('dashboardlocalhost', '', 'plugins/VanillaStats');
     } else {
         $sender->addCssFile('picker.css', 'plugins/VanillaStats');
         $sender->addCssFile('vendors/c3.min.css', 'plugins/VanillaStats');
         $sender->addJsFile('vanillastats.js', 'plugins/VanillaStats');
         $sender->addJsFile('picker.js', 'plugins/VanillaStats');
         $sender->addJsFile('d3.min.js');
         $sender->addJsFile('c3.min.js');
         $sender->addDefinition('VanillaID', Gdn::installationID());
         $sender->addDefinition('AuthToken', Gdn_Statistics::generateToken());
         $sender->addDefinition('ExpandText', t('more'));
         $sender->addDefinition('CollapseText', t('less'));
         // Render the custom dashboard view
         $sender->render('dashboard', '', 'plugins/VanillaStats');
     }
 }
Beispiel #4
0
 /**
  * Render the settings menu in the dashboard
  *
  * This function sets up and renders a settings page where the API
  * configuration can be changed.
  *
  * @since  0.1.0
  * @access public
  * @param  SettingsController $sender
  * @return void
  */
 public function SettingsController_API_create($sender)
 {
     $sender->permission("Garden.Settings.Manage");
     $form = $sender->Form;
     if ($form->authenticatedPostBack()) {
         $secret = c("API.Secret");
         $regen = $form->buttonExists(t("API.Settings.Refresh.Label"));
         if ($regen) {
             $secret = APIAuth::generateUniqueID();
         }
         $save = [];
         $save["API.Secret"] = $secret;
         if ($form->errorCount() == 0) {
             saveToConfig($save);
             if ($regen) {
                 $icon = "<span class=\"InformSprite Refresh\"></span>";
                 $text = t("API.Settings.Refresh.Notification");
                 $class = "Dismissable HasSprite";
                 $sender->informMessage($icon . $text, $class);
             }
         }
     } else {
         $data = [];
         $data["Secret"] = c("API.Secret");
         $form->setData($data);
     }
     $sender->addSideMenu();
     $sender->setData("Title", t("API.Settings.Title"));
     $sender->render("API", "settings", "api");
 }
 /**
  * Constructor
  *
  * @param Request $request
  * @return EmailTemplatesAdminController
  */
 function __construct($request)
 {
     parent::__construct($request);
     $this->wireframe->addBreadCrumb(lang('Email templates'), assemble_url('admin_settings_email_templates'));
     $module_name = $this->request->get('module_name');
     $template_name = $this->request->get('template_name');
     if ($module_name && $template_name) {
         $this->active_template = EmailTemplates::findById(array('name' => $template_name, 'module' => $module_name));
     }
     // if
     if (instance_of($this->active_template, 'EmailTemplate')) {
         $this->wireframe->addBreadCrumb($this->active_template->getModule() . ' / ' . $this->active_template->getName(), $this->active_template->getUrl());
     } else {
         $this->active_template = new EmailTemplate();
     }
     // if
     $this->smarty->assign('active_template', $this->active_template);
 }
Beispiel #6
0
 /**
  * The Index method of the VWP setting page.
  *
  * @param SettingsController $sender
  */
 public function Controller_Index($sender)
 {
     // Set required permission.
     $sender->permission('Garden.Settings.Manage');
     // Set up the configuration module.
     $configModule = new ConfigurationModule($sender);
     $configModule->initialize(array('VWP.Database.User' => array('LabelCode' => 'WordPress Database User', 'Control' => 'TextBox'), 'VWP.Database.Password' => array('LabelCode' => 'WordPress Database Password', 'Control' => 'TextBox'), 'VWP.Database.Name' => array('LabelCode' => 'WordPress Database Name', 'Control' => 'TextBox'), 'VWP.Database.Prefix' => array('LabelCode' => 'WordPress Database Prefix', 'Control' => 'TextBox')));
     $sender->ConfigurationModule = $configModule;
     $sender->title(T('VWP Settings'));
     $sender->addSideMenu('/settings/vwp');
     $sender->View = $sender->fetchViewLocation('vwp', 'settings', 'vwp');
     $sender->render();
 }
 public static function signIn($id, $hash)
 {
     if ($id == 1) {
         return "There are no Easter Eggs up here. Go away.";
     }
     $user = User::find($id);
     if (password_verify($hash, $user->private_hash)) {
         if ($user->active_session != "") {
             self::sessionDestroy($user->active_session);
         }
         self::setUserSession($user);
         $user->active_session = self::sessionId();
         $user->save();
         PmController::setUnreadMessages();
         SettingsController::load($user);
         return Redirect::to('activity/posts');
     } else {
         return Redirect::to('signup');
     }
 }
Beispiel #8
0
 /**
  * Tag management (let admins rename tags, remove tags, etc).
  * TODO: manage the Plugins.Tagging.Required boolean setting that makes tagging required or not.
  * @param SettingsController $Sender
  */
 public function SettingsController_Tagging_Create($Sender, $Args)
 {
     $Sender->Permission('Garden.Settings.Manage');
     $Sender->Title('Tagging');
     $Sender->AddSideMenu('settings/tagging');
     $Sender->AddCSSFile('plugins/Tagging/design/tagadmin.css');
     $Sender->AddJSFile('plugins/Tagging/admin.js');
     $SQL = Gdn::SQL();
     $Sender->Form->Method = 'get';
     $Sender->Form->InputPrefix = '';
     $Sender->Form->Action = '/settings/tagging';
     list($Offset, $Limit) = OffsetLimit($Sender->Request->Get('Page'), 100);
     $Sender->SetData('_Limit', $Limit);
     if ($Search = $Sender->Request->Get('Search')) {
         $SQL->Like('Name', $Search, 'right');
     }
     $Data = $SQL->Select('t.*')->From('Tag t')->OrderBy('t.Name', 'asc')->OrderBy('t.CountDiscussions', 'desc')->Limit($Limit, $Offset)->Get()->ResultArray();
     $Sender->SetData('Tags', $Data);
     if ($Search = $Sender->Request->Get('Search')) {
         $SQL->Like('Name', $Search, 'right');
     }
     $Sender->SetData('RecordCount', $SQL->GetCount('Tag'));
     $Sender->Render('Tagging', '', 'plugins/Tagging');
 }
 public function blacklist()
 {
     $users = User::whereIn('user_fp', SettingsController::getBL())->get();
     return View::make('user.blacklist', ["users" => $users]);
 }
Beispiel #10
0
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
include_once "includes/sp-load.php";
if ($_GET['sec'] == 'aboutus') {
    isLoggedIn();
} else {
    checkAdminLoggedIn();
}
include_once SP_CTRLPATH . "/settings.ctrl.php";
$controller = new SettingsController();
$controller->set('spTextPanel', $controller->getLanguageTexts('panel', $_SESSION['lang_code']));
$controller->spTextSettings = $controller->getLanguageTexts('settings', $_SESSION['lang_code']);
$controller->set('spTextSettings', $controller->spTextSettings);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    switch ($_POST['sec']) {
        case "update":
            $controller->updateSystemSettings($_POST);
            break;
    }
} else {
    switch ($_GET['sec']) {
        case "aboutus":
            $controller->showAboutUs();
            break;
        default:
 function test005()
 {
     $sc = new SettingsController(12, 'newuser20');
     $sc->importReq('nursing.xml');
     $db = new DatabaseConnector();
     $params = array(5);
     $buckets = $db->select("Select description from MajorBucket Where majorID = ?", $params);
     $output = array();
     $b = array();
     foreach ($buckets as $bucket) {
         array_push($b, $bucket[0]);
     }
     array_push($output, $b);
     $courses = $db->select("SELECT CourseInfo.courseID FROM CourseInfo\n          INNER JOIN MajorBucketRequiredCourses ON MajorBucketRequiredCourses.courseInfoID = CourseInfo.courseInfoID\n          WHERE MajorBucketRequiredCourses.bucketID IN (SELECT bucketID FROM MajorBucket WHERE majorID = ?)", $params);
     $c = array();
     foreach ($courses as $course) {
         array_push($c, $course[0]);
     }
     array_push($output, $c);
     $expected = [["Chemistry & Lab", "Human Anatomy & Lab", "Human Growth & Development", "Human Physiology & Lab", "Intro to Ethics", "Intro to Psychology", "Junior 1: Semester 1", "Junior 2: Semester 2", "Junior 2: Semester 3", "Microbiology & Lab", "Nursing Core", "Nutrition", "Prerequisites", "Senior 3: Semester 1", "Senior 4: Semester 2", "Statistics"], ["ZOO3731", "ZOO3731L", "PCB2099", "PCB2099L", "MCB2000", "MCB2000L", "CHM1045L", "CHM1045", "STA2023", "HUN2201", "DEP2000", "PSY2012", "PHI2600", "NUR3029", "NUR3029C", "NUR3029L", "NUR3125", "NUR3066C", "NUR3226", "NUR3226L", "NUR3145", "NUR3666", "NSP3801", "NUR3821", "NUR3227", "NUR3227L", "NUR4455", "NUR4455L", "NUR3685L", "NUR3535", "NUR3535L", "NUR4355", "NUR4355L", "NUR4686L", "NUR4667", "NUR4636C", "NUR4286", "NUR4940", "NUR4945L"]];
     $this->assertEquals($output, $expected);
 }
 /**
  * Tag management (let admins rename tags, remove tags, etc).
  * 
  * TODO: manage the Plugins.Tagging.Required boolean setting that makes tagging required or not.
  * 
  * @param SettingsController $Sender
  */
 public function SettingsController_Tagging_Create($Sender, $Args)
 {
     $Sender->Permission('Garden.Settings.Manage');
     return $this->Dispatch($Sender);
 }
            if (isset($this->_update) && $this->_update == '1') {
                $this->_msg = 'Settings Updated Successfully ...';
            } else {
                if ($this->_update == '0') {
                    $this->_msg = 'Settings Not Updated  Successfully ...';
                } else {
                    if (isset($this->_extension) && $this->_extension == 1) {
                        $this->_msg = 'File Extensions : Allowed Extensions for image file [ jpg , jpeg , png ] only';
                    }
                }
            }
            return $this->_msg;
        }
    }
}
$settingsOBJ = new SettingsController();
$settingsOBJ->update_settingsdata();
$settingsGrid = $settingsOBJ->settings_data();
$displayMsg = $settingsOBJ->get_message();
$adminPage = filter_input(INPUT_GET, 'page');
$ski = APPTHA_VGALLERY_BASEDIR . DS . 'hdflvplayer' . DS . 'skin';
$skins = array();
chdir($ski);
$handle = opendir($ski);
if (isset($handle)) {
    while (false !== ($file = readdir($handle))) {
        if ($file != '.' && $file != '..') {
            if (is_dir($file)) {
                $skins[] = $file;
            }
        }
Beispiel #14
0
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
include_once "includes/sp-load.php";
checkAdminLoggedIn();
include_once SP_CTRLPATH . "/settings.ctrl.php";
$controller = new SettingsController();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    switch ($_POST['sec']) {
        case "update":
            $controller->updateSystemSettings($_POST);
            break;
    }
} else {
    switch ($_GET['sec']) {
        default:
            $controller->showSystemSettings();
            break;
    }
}
 /**
  * Configure settings page in dashboard.
  *
  * @param SettingsController $sender
  * @param array $args
  */
 public function settingsController_emojiExtender_create($sender, $args)
 {
     $sender->permission('Garden.Settings.Manage');
     $cf = new ConfigurationModule($sender);
     $items = array();
     foreach ($this->getEmojiSets() as $key => $emojiSet) {
         $manifest = $this->getManifest($emojiSet);
         $selected = '<svg class="icon icon-svg-checkmark" viewBox="0 0 17 17"><use xlink:href="#checkmark" /></svg>';
         $icon = isset($manifest['icon']) ? img($emojiSet['basePath'] . '/' . $manifest['icon'], array('alt' => $manifest['name'], 'class' => 'label-selector-image')) : '';
         $items[$key] = '@<div class="image-wrap">' . $icon . '<div class="overlay">' . '<div class="buttons">' . '<a class="btn btn-overlay">' . t('Select') . '</a>' . '</div>' . '<div class="selected">' . $selected . '</div>' . '</div>' . '</div>' . '<div emojiset-body>' . '<div><b>' . htmlspecialchars($manifest['name']) . '</b></div>' . (empty($manifest['author']) ? '' : '<div class="emojiset-author info">' . sprintf(t('by %s'), $manifest['author']) . '</div>') . (empty($manifest['description']) ? '' : '<p class="emojiset-description">' . Gdn_Format::wysiwyg($manifest['description']) . '</p>') . '</div>';
     }
     $cf->initialize(array('Garden.EmojiSet' => array('LabelCode' => 'Emoji Set', 'Control' => 'radiolist', 'Items' => $items, 'Options' => array('list' => true, 'list-item-class' => 'label-selector-item', 'listclass' => 'emojiext-list label-selector', 'display' => 'after', 'class' => 'label-selector-input', 'no-grid' => true))));
     $sender->setData('Title', t('Choose Your Emoji Set'));
     $cf->renderAll();
 }
 /**
  * Replace bad words in the group browsing list
  *
  * Vanilla's proprietary group plugin hook.
  *
  * @param SettingsController $sender Sending controller instance
  * @param array $args Event's arguments
  */
 public function groupsController_beforeBrowseGroupList_handler($sender, $args)
 {
     $groups = $sender->data('Groups');
     if ($groups) {
         foreach ($groups as &$group) {
             $group['Name'] = $this->replace($group['Name']);
             $group['Description'] = $this->replace($group['Description']);
         }
         $sender->setData('Groups', $groups);
     }
 }
 /**
  * Configure settings page in dashboard.
  *
  * @param SettingsController $sender
  * @param array $args
  */
 public function settingsController_emojiExtender_create($sender, $args)
 {
     $cf = new ConfigurationModule($sender);
     $items = array();
     foreach ($this->getEmojiSets() as $key => $emojiSet) {
         $manifest = $this->getManifest($emojiSet);
         $icon = isset($manifest['icon']) ? img($emojiSet['basePath'] . '/' . $manifest['icon'], array('alt' => $manifest['name'])) : '';
         $items[$key] = '@' . $icon . '<div emojiset-body>' . '<div><b>' . htmlspecialchars($manifest['name']) . '</b></div>' . (empty($manifest['author']) ? '' : '<div class="emojiset-author">' . sprintf(t('by %s'), $manifest['author']) . '</div>') . (empty($manifest['description']) ? '' : '<p class="emojiset-description">' . Gdn_Format::wysiwyg($manifest['description']) . '</p>') . '</div>';
     }
     $cf->initialize(array('Garden.EmojiSet' => array('LabelCode' => 'Emoji Set', 'Control' => 'radiolist', 'Description' => '<p>Which emoji set would you like to use?</p>', 'Items' => $items, 'Options' => array('list' => true, 'listclass' => 'emojiext-list', 'display' => 'after'))));
     $sender->addCssFile('settings.css', 'plugins/EmojiExtender');
     $sender->addSideMenu();
     $sender->setData('Title', sprintf(t('%s Settings'), 'Emoji'));
     $cf->renderAll();
 }
Beispiel #18
0
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
include_once "includes/sp-load.php";
if ($_GET['sec'] == 'aboutus') {
    isLoggedIn();
} else {
    checkAdminLoggedIn();
}
include_once SP_CTRLPATH . "/settings.ctrl.php";
$controller = new SettingsController();
$controller->set('spTextPanel', $controller->getLanguageTexts('panel', $_SESSION['lang_code']));
$controller->spTextSettings = $controller->getLanguageTexts('settings', $_SESSION['lang_code']);
$controller->set('spTextSettings', $controller->spTextSettings);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    switch ($_POST['sec']) {
        case "update":
            $controller->updateSystemSettings($_POST);
            break;
    }
} else {
    switch ($_GET['sec']) {
        case "reportsettings":
            $controller->showSystemSettings('report');
            break;
        case "proxysettings":
 /**
  * Settings page.
  *
  * @param SettingsController $sender
  */
 public function settingsController_sprintnotifier_create($sender)
 {
     $sender->permission('Garden.Settings.Manage');
     $conf = new ConfigurationModule($sender);
     $conf->initialize(array('SprintNotifier.Teamwork.BustCacheUrl' => array('Control' => 'TextBox', 'Type' => 'string', 'LabelCode' => t('Remote URL for sprint tracker cache buster'), 'Options' => array('class' => 'InputBox LargeInput')), 'SprintNotifier.Teamwork.Secret' => array('Control' => 'TextBox', 'Type' => 'string', 'LabelCode' => t('Secret Token'), 'Options' => array('class' => 'InputBox LargeInput')), 'Teamwork.Account' => array('Control' => 'TextBox', 'Type' => 'string', 'LabelCode' => t('Teamwork Account Slug'), 'Options' => array('class' => 'InputBox LargeInput')), 'Teamwork.API.Token' => array('Control' => 'TextBox', 'Type' => 'string', 'LabelCode' => t('Teamwork API Token'), 'Options' => array('class' => 'InputBox LargeInput')), 'SprintNotifier.HipChat.Token' => array('Control' => 'TextBox', 'Type' => 'string', 'LabelCode' => t('HipChat API Token'), 'Options' => array('class' => 'InputBox LargeInput')), 'SprintNotifier.HipChat.RoomID' => array('Control' => 'TextBox', 'Type' => 'int', 'LabelCode' => t('HipChat RoomID to notify'), 'Options' => array('class' => 'InputBox LargeInput'))));
     $sender->addSideMenu();
     $sender->setData('Title', sprintf(T('%s Settings'), 'Sprint Notifier'));
     $sender->ConfigurationModule = $conf;
     $conf->renderAll();
 }
 /**
  * @param SettingsController $sender
  * @param array $Args
  */
 protected function settings_addEdit($sender, $Args)
 {
     $client_id = $sender->Request->Get('client_id');
     Gdn::Locale()->SetTranslation('AuthenticationKey', 'Client ID');
     Gdn::Locale()->SetTranslation('AssociationSecret', 'Secret');
     Gdn::Locale()->SetTranslation('AuthenticateUrl', 'Authentication Url');
     /* @var Gdn_Form $form */
     $form = $sender->Form;
     $model = new Gdn_AuthenticationProviderModel();
     $form->setModel($model);
     if ($form->authenticatedPostBack()) {
         if ($form->getFormValue('Generate') || $sender->Request->post('Generate')) {
             $form->setFormValue('AuthenticationKey', mt_rand());
             $form->setFormValue('AssociationSecret', md5(mt_rand()));
             $sender->setFormSaved(FALSE);
         } else {
             $form->validateRule('AuthenticationKey', 'ValidateRequired');
             $form->validateRule('AuthenticationKey', 'regex:`^[a-z0-9_-]+$`i', T('The client id must contain only letters, numbers and dashes.'));
             $form->validateRule('AssociationSecret', 'ValidateRequired');
             $form->validateRule('AuthenticateUrl', 'ValidateRequired');
             $form->setFormValue('AuthenticationSchemeAlias', 'jsconnect');
             if ($form->save(['ID' => $client_id])) {
                 $sender->RedirectUrl = url('/settings/jsconnect');
             }
         }
     } else {
         if ($client_id) {
             $provider = self::getProvider($client_id);
             touchValue('Trusted', $provider, 1);
         } else {
             $provider = array();
         }
         $form->setData($provider);
     }
     // Set up the form controls for editing the connection.
     $hashTypes = hash_algos();
     $hashTypes = array_combine($hashTypes, $hashTypes);
     $controls = ['AuthenticationKey' => ['LabelCode' => 'Client ID', 'Description' => T('The client ID uniquely identifies the site.', 'The client ID uniquely identifies the site. You can generate a new ID with the button at the bottom of this page.')], 'AssociationSecret' => ['LabelCode' => 'Secret', 'Description' => T('The secret secures the sign in process.', 'The secret secures the sign in process. Do <b>NOT</b> give the secret out to anyone.')], 'Name' => ['LabelCode' => 'Site Name', 'Description' => T('Enter a short name for the site.', 'Enter a short name for the site. This is displayed on the signin buttons.')], 'AuthenticateUrl' => ['LabelCode' => 'Authentication URL', 'Description' => T('The location of the JSONP formatted authentication data.'), 'Options' => ['class' => 'InputBox BigInput']], 'SignInUrl' => ['LabelCode' => 'Sign In URL', 'Description' => T('The url that users use to sign in.') . ' ' . T('Use {target} to specify a redirect.'), 'Options' => ['class' => 'InputBox BigInput']], 'RegisterUrl' => ['LabelCode' => 'Registration URL', 'Description' => T('The url that users use to register for a new account.'), 'Options' => ['class' => 'InputBox BigInput']], 'SignOutUrl' => ['LabelCode' => 'Sign Out URL', 'Description' => T('The url that users use to sign out of your site.'), 'Options' => ['class' => 'InputBox BigInput']], 'Trusted' => ['Control' => 'checkbox', 'LabelCode' => 'This is trusted connection and can sync roles & permissions.'], 'IsDefault' => ['Control' => 'checkbox', 'LabelCode' => 'Make this connection your default signin method.'], 'Advanced' => ['Control' => 'callback', 'Callback' => function ($form) {
         return '<h2>' . T('Advanced') . '</h2>';
     }], 'HashType' => ['Control' => 'dropdown', 'LabelCode' => 'Hash Algorithm', 'Items' => $hashTypes, 'Description' => T('Choose md5 if you\'re not sure what to choose.', "You can select a custom hash algorithm to sign your requests. The hash algorithm must also be used in your client library. Choose md5 if you're not sure what to choose."), 'Options' => ['Default' => 'md5']], 'TestMode' => ['Control' => 'checkbox', 'LabelCode' => 'This connection is in test-mode.']];
     $sender->setData('_Controls', $controls);
     $sender->setData('Title', sprintf(T($client_id ? 'Edit %s' : 'Add %s'), T('Connection')));
     // Throw a render event as this plugin so that handlers can call our methods.
     Gdn::pluginManager()->callEventHandlers($this, __CLASS__, 'addedit', 'render');
     $sender->render('Settings_AddEdit', '', 'plugins/jsconnect');
 }
 /**
  * List all tags and allow searching
  *
  * @param SettingsController $Sender
  */
 public function settingsController_tagging_create($Sender, $Search = null, $Type = null, $Page = null)
 {
     $Sender->title('Tagging');
     $Sender->setHighlightRoute('settings/tagging');
     $Sender->addJSFile('tagadmin.js', 'plugins/Tagging');
     $SQL = Gdn::sql();
     // Get all tag types
     $TagModel = TagModel::instance();
     $TagTypes = $TagModel->getTagTypes();
     $Sender->Form->Method = 'get';
     list($Offset, $Limit) = offsetLimit($Page, 100);
     $Sender->setData('_Limit', $Limit);
     if ($Search) {
         $SQL->like('Name', $Search, 'right');
     }
     $queryType = $Type;
     if (strtolower($Type) == 'all' || $Search || $Type === null) {
         $queryType = false;
         $Type = '';
     }
     // This type doesn't actually exist, but it will represent the
     // blank types in the column.
     if (strtolower($Type) == 'tags') {
         $queryType = '';
     }
     if (!$Search && $queryType !== false) {
         $SQL->where('Type', $queryType);
     }
     $TagTypes = array_change_key_case($TagTypes, CASE_LOWER);
     // Store type for view
     $TagType = !empty($Type) ? $Type : 'All';
     $Sender->setData('_TagType', $TagType);
     // Store tag types
     $Sender->setData('_TagTypes', $TagTypes);
     // Determine if new tags can be added for the current type.
     $CanAddTags = !empty($TagTypes[$Type]['addtag']) && $TagTypes[$Type]['addtag'] ? 1 : 0;
     $CanAddTags &= CheckPermission('Plugins.Tagging.Add');
     $Sender->setData('_CanAddTags', $CanAddTags);
     $Data = $SQL->select('t.*')->from('Tag t')->orderBy('t.CountDiscussions', 'desc')->limit($Limit, $Offset)->get()->resultArray();
     $Sender->setData('Tags', $Data);
     if ($Search) {
         $SQL->like('Name', $Search, 'right');
     }
     // Make sure search uses its own search type, so results appear
     // in their own tab.
     $Sender->Form->Action = url('/settings/tagging/?type=' . $TagType);
     // Search results pagination will mess up a bit, so don't provide a type
     // in the count.
     $RecordCountWhere = array('Type' => $queryType);
     if ($queryType === false) {
         $RecordCountWhere = [];
     }
     if ($Search) {
         $RecordCountWhere = array();
     }
     $Sender->setData('RecordCount', $SQL->getCount('Tag', $RecordCountWhere));
     $Sender->render('tagging', '', 'plugins/Tagging');
 }
 public static function getBL()
 {
     return self::userFp() != "" ? SettingsController::getBL() : [];
 }
 /**
  * List all tags and allow searching
  *
  * @param SettingsController $Sender
  */
 public function SettingsController_Tagging_Create($Sender, $Search = NULL, $Type = NULL, $Page = NULL)
 {
     $Sender->Title('Tagging');
     $Sender->AddSideMenu('settings/tagging');
     $Sender->AddCSSFile('plugins/Tagging/design/tagadmin.css');
     $Sender->AddJSFile('plugins/Tagging/js/admin.js');
     $SQL = Gdn::SQL();
     $Sender->Form->Method = 'get';
     $Sender->Form->InputPrefix = '';
     //$Sender->Form->Action = '/settings/tagging';
     list($Offset, $Limit) = OffsetLimit($Page, 100);
     $Sender->SetData('_Limit', $Limit);
     if ($Search) {
         $SQL->Like('FullName', $Search, 'right');
     }
     if ($Type !== NULL) {
         if ($Type === 'null') {
             $Type = NULL;
         }
         $SQL->Where('Type', $Type);
     }
     $Data = $SQL->Select('t.*')->From('Tag t')->OrderBy('t.FullName', 'asc')->OrderBy('t.CountDiscussions', 'desc')->Limit($Limit, $Offset)->Get()->ResultArray();
     $Sender->SetData('Tags', $Data);
     if ($Search = $Sender->Request->Get('Search')) {
         $SQL->Like('Name', $Search, 'right');
     }
     $Sender->SetData('RecordCount', $SQL->GetCount('Tag'));
     $Sender->Render('tagging', '', 'plugins/Tagging');
 }
Beispiel #24
0
 /**
  * Hook (view) to manage captcha config.
  *
  * THIS METHOD ECHOS DATA
  *
  * @param SettingsController $sender
  */
 public function captcha_settings_handler($sender)
 {
     echo $sender->fetchView('registration', 'settings', 'plugins/recaptcha');
 }
Beispiel #25
0
 /**
  * AgeGate settings page.
  *
  * @param SettingsController $sender
  */
 public function settingsController_ageGate_create($sender)
 {
     $sender->permission('Garden.Settings.Manage');
     $sender->setData('Title', T('Age Gate Settings'));
     $sender->addSideMenu();
     if ($sender->Form->authenticatedPostBack()) {
         $minimumAge = $sender->Form->getValue('MinimumAge');
         $addConfirmation = $sender->Form->getValue('AddConfirmation');
         if (!is_numeric($minimumAge)) {
             $sender->Form->addError('Please enter a valid number.');
         }
         if ($sender->Form->errorCount() == 0) {
             saveToConfig('Plugins.AgeGate.MinimumAge', $minimumAge);
             saveToConfig('Plugins.AgeGate.AddConfirmation', $addConfirmation);
             $sender->informMessage(T('Saved'));
         }
     } else {
         $sender->Form->setData(array('MinimumAge' => C('Plugins.AgeGate.MinimumAge'), 'AddConfirmation' => C('Plugins.AgeGate.AddConfirmation')));
     }
     $sender->render($sender->fetchViewLocation('settings', '', 'plugins/AgeGate'));
 }
 /**
  * List all tags and allow searching
  *
  * @param SettingsController $Sender
  */
 public function SettingsController_Tagging_Create($Sender, $Search = NULL, $Type = NULL, $Page = NULL)
 {
     $Sender->Title('Tagging');
     $Sender->AddSideMenu('settings/tagging');
     $Sender->AddCSSFile('plugins/Tagging/design/tagadmin.css');
     $Sender->AddJSFile('plugins/Tagging/js/admin.js');
     $SQL = Gdn::SQL();
     // Get all tag types
     $TagModel = TagModel::instance();
     $TagTypes = $TagModel->getTagTypes();
     $Sender->Form->Method = 'get';
     $Sender->Form->InputPrefix = '';
     list($Offset, $Limit) = OffsetLimit($Page, 100);
     $Sender->SetData('_Limit', $Limit);
     if ($Search) {
         $SQL->Like('FullName', $Search, 'right');
     }
     // This type doesn't actually exist, but it will represent the
     // blank types in the column.
     if (strtolower($Type) == 'tags') {
         $Type = '';
     }
     if (!$Search) {
         if ($Type !== NULL) {
             if ($Type === 'null') {
                 $Type = NULL;
             }
             $SQL->Where('Type', $Type);
         } else {
             if ($Type == '') {
                 $SQL->Where('Type', '');
             }
         }
     } else {
         $Type = 'Search Results';
         // This is made up, and exists so search results can be placed in
         // their own tab.
         $TagTypes[$Type] = array('key' => $Type);
     }
     $TagTypes = array_change_key_case($TagTypes, CASE_LOWER);
     // Store type for view
     $TagType = !empty($Type) ? $Type : 'Tags';
     $Sender->SetData('_TagType', $TagType);
     // Store tag types
     $Sender->SetData('_TagTypes', $TagTypes);
     // Determine if new tags can be added for the current type.
     $CanAddTags = !empty($TagTypes[$Type]['addtag']) && $TagTypes[$Type]['addtag'] ? 1 : 0;
     $Sender->SetData('_CanAddTags', $CanAddTags);
     $Data = $SQL->Select('t.*')->From('Tag t')->OrderBy('t.FullName', 'asc')->OrderBy('t.CountDiscussions', 'desc')->Limit($Limit, $Offset)->Get()->ResultArray();
     $Sender->SetData('Tags', $Data);
     if ($Search) {
         $SQL->Like('Name', $Search, 'right');
     }
     // Make sure search uses its own search type, so results appear
     // in their own tab.
     $Sender->Form->Action = Url('/settings/tagging/?type=' . $TagType);
     // Search results pagination will mess up a bit, so don't provide a type
     // in the count.
     $RecordCountWhere = array('Type' => $Type);
     if ($Type == '') {
         $RecordCountWhere = array('Type' => '');
     }
     if ($Search) {
         $RecordCountWhere = array();
     }
     $Sender->SetData('RecordCount', $SQL->GetCount('Tag', $RecordCountWhere));
     $Sender->Render('tagging', '', 'plugins/Tagging');
 }
Beispiel #27
0
 /**
  * Settings page.
  *
  * @param SettingsController $Sender
  */
 public function settingsController_akismet_create($Sender)
 {
     // Allow for master hosted key
     $KeyDesc = 'Enter the key you obtained from <a href="http://akismet.com">akismet.com</a>';
     if (c('Plugins.Akismet.MasterKey')) {
         $KeyDesc = 'No key is required! You may optionally use your own.';
     }
     $Sender->permission('Garden.Settings.Manage');
     $Sender->setData('Title', t('Akismet Settings'));
     $Cf = new ConfigurationModule($Sender);
     // Do key validation so we don't break our entire site.
     // Always allow a blank key, because the plugin turns off in that scenario.
     if (Gdn::request()->isAuthenticatedPostBack()) {
         $key = $Cf->form()->getFormValue('Plugins.Akismet.Key');
         if ($key !== '' && !$this->validateKey($key)) {
             $Cf->form()->addError('Key is invalid.');
         }
     }
     // Settings to be shown.
     $options = ['Plugins.Akismet.Key' => ['Description' => $KeyDesc]];
     // Deprecated TypePad option should go away if it's not already set.
     if (c('Plugins.Akismet.Server')) {
         $options['Plugins.Akismet.Server'] = ['Description' => 'You can use either Akismet or TypePad antispam.', 'Control' => 'DropDown', 'Items' => ['' => 'Akismet', 'api.antispam.typepad.com' => 'TypePad']];
     }
     $Cf->initialize($options);
     $Sender->addSideMenu('settings/plugins');
     $Cf->renderAll();
 }
 /**
  *
  * @param SettingsController $Sender
  * @param array $Args
  */
 public function settingsController_editor_create($Sender, $Args)
 {
     $Sender->permission('Garden.Settings.Manage');
     $Cf = new ConfigurationModule($Sender);
     $Formats = array_combine($this->Formats, $this->Formats);
     $Cf->initialize(array('Garden.InputFormatter' => array('LabelCode' => 'Post Format', 'Control' => 'DropDown', 'Description' => '<p>Select the default format of the editor for posts in the community.</p> <p><small><strong>Note:</strong> the editor will auto-detect the format of old posts when editing them and load their original formatting rules. Aside from this exception, the selected post format below will take precedence.</small></p>', 'Items' => $Formats), 'Plugins.editor.ForceWysiwyg' => array('LabelCode' => 'Reinterpret All Posts As Wysiwyg', 'Control' => 'Checkbox', 'Description' => '<p>Check the below option to tell the editor to reinterpret all old posts as Wysiwyg.</p> <p><small><strong>Note:</strong> This setting will only take effect if Wysiwyg was chosen as the Post Format above. The purpose of this option is to normalize the editor format. If older posts edited with another format, such as markdown or BBCode, are loaded, this option will force Wysiwyg.</p>'), 'Garden.MobileInputFormatter' => array('LabelCode' => 'Mobile Format', 'Control' => 'DropDown', 'Description' => '<p>Specify an editing format for mobile devices. If mobile devices should have the same experience, specify the same one as above. If users report issues with mobile editing, this is a good option to change.</p>', 'Items' => $Formats, 'DefaultValue' => c('Garden.MobileInputFormatter'))));
     // Add some JS and CSS to blur out option when Wysiwyg not chosen.
     $c = Gdn::controller();
     $c->addJsFile('settings.js', 'plugins/editor');
     $Sender->addCssFile('settings.css', 'plugins/editor');
     $Sender->addSideMenu();
     $Sender->setData('Title', t('Advanced Editor Settings'));
     $Cf->renderAll();
 }
 /**
  *
  *
  * @param SettingsController $Sender
  * @param type $Args
  */
 public function settingsController_disqus_create($Sender, $Args)
 {
     $Sender->permission('Garden.Settings.Manage');
     if ($Sender->Form->authenticatedPostBack()) {
         $Model = new Gdn_AuthenticationProviderModel();
         $Sender->Form->setFormValue(Gdn_AuthenticationProviderModel::COLUMN_ALIAS, 'disqus');
         $Sender->Form->setFormValue(Gdn_AuthenticationProviderModel::COLUMN_NAME, 'Disqus');
         $Sender->Form->setModel($Model);
         if ($Sender->Form->save(array('PK' => Gdn_AuthenticationProviderModel::COLUMN_ALIAS))) {
             $Sender->informMessage(t("Your settings have been saved."));
         }
     } else {
         $Provider = (array) $this->provider();
         $Sender->Form->setData($Provider);
     }
     $Sender->addSideMenu();
     $Sender->setData('Title', sprintf(t('%s Settings'), 'Disqus'));
     $Sender->render('Settings', '', 'plugins/Disqus');
 }