SproutCMS

This is the code documentation for the SproutCMS project

class id

Source code (568 results)

/config/config.php   Highlighted file source

Line 6: * is _bootstrap_config.php which provides the value for IN_PRODUCTION

/config/require_ssl.php   Highlighted file source

Line 21: * If you have a cert, it's probably not a bad idea to protect dbtools too

/config/sprout.php   Highlighted file source

Line 8: use Sprout\Helpers\WidgetArea;
Line 12: // An example is provided
Line 14: // 'test' => ['uid' => 1, 'hash' => '$2a$12$J/qUFM9j6KRb7lXvXtFhH.J8RhJYdP/3oeNetR3taDmNhTYMCJfkG', 'salt' => '109Du9gMwI'],
Line 97: // The default widgets are listed in sprout/sprout_load.php
Line 98: // You can still add widgets in here if you really want though
Line 101: * Define the widget area: embedded
Line 103: $config['widget_areas'][1] = $area = new WidgetArea('embedded', 1);
Line 106: $area->setOrientation(WidgetArea::ORIENTATION_WIDE);
Line 111: * Define the widget area: sidebar
Line 113: $config['widget_areas'][2] = $area = new WidgetArea('sidebar', 2);
Line 115: $area->setNiceName('Sidebar');
Line 116: $area->setOrientation(WidgetArea::ORIENTATION_TALL);
Line 121: * Define the widget area: email
Line 123: $config['widget_areas'][4] = $area = new WidgetArea('email', 4);
Line 126: $area->setOrientation(WidgetArea::ORIENTATION_EMAIL);
Line 131: * List of controllers (shorthand notation) to hide from admin tiles
Line 139: $config['admin_tile_hidden'] = [];
Line 156: * Restrict admin access to given IPs or CIDR ranges
Line 309: * Complexity requirements for password validation using the {@see Validity::password} method

/config/super_ops.php   Highlighted file source

Line 3: 'chris' => ['uid' => 100000, 'hash' => '$2y$12$AXlkoYo5QoaTD42.iLhQVur1vhJlmSmPWpnFTFJMDdwnOjzRY9skG', 'salt' => 'FMRe'],

/config/_bootstrap_config.php   Highlighted file source

Line 16: const TIMEZONE = 'Australia/Adelaide';

/index.php   Highlighted file source

Line 24: // information is provided when errors occur, among other things.
Line 46: // The timezone is explicitly set to avoid warnings from bad server configuration

/modules/Demo/config/routes.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/modules/Demo/Controllers/Admin/DemoItemAdminController.php   Highlighted file source

Line 16: use InvalidArgumentException;
Line 92: * Saves the provided POST data into a new record in the database
Line 94: * @param int $item_id After saving, the new record id will be returned in this parameter
Line 97: public function _addSave(&$item_id)
Line 99: return parent::_addSave($item_id);
Line 107: protected function _editPreRender($view, $item_id)
Line 109: parent::_editPreRender($view, $item_id);
Line 117: public function _getEditSubActions($item_id)
Line 119: $actions = parent::_getEditSubActions($item_id);
Line 128: * @param int $item_id The record to save
Line 131: public function _editSave($item_id)
Line 133: $item_id = (int) $item_id;
Line 134: if ($item_id <= 0) throw new InvalidArgumentException('$item_id must be greater than 0');
Line 136: return parent::_editSave($item_id);
Line 147: if (!empty($_GET['id'])) {
Line 148: $q = "SELECT name AS label FROM ~words WHERE id = ?";
Line 149: $res = Pdb::q($q, [$_GET['id']], 'arr');
Line 153: $q = "SELECT id, name AS value
Line 168: $q = "SELECT id, CONCAT('#', id, ' - ', name) AS value

/modules/Demo/Controllers/Admin/WordAdminController.php   Highlighted file source

Line 16: use InvalidArgumentException;
Line 74: * Saves the provided POST data into a new record in the database
Line 76: * @param int $item_id After saving, the new record id will be returned in this parameter
Line 79: public function _addSave(&$item_id)
Line 81: return parent::_addSave($item_id);
Line 89: protected function _editPreRender($view, $item_id)
Line 91: parent::_editPreRender($view, $item_id);
Line 99: public function _getEditSubActions($item_id)
Line 101: $actions = parent::_getEditSubActions($item_id);
Line 110: * @param int $item_id The record to save
Line 113: public function _editSave($item_id)
Line 115: $item_id = (int) $item_id;
Line 116: if ($item_id <= 0) throw new InvalidArgumentException('$item_id must be greater than 0');
Line 118: return parent::_editSave($item_id);

/modules/Demo/Controllers/DemoController.php   Highlighted file source

Line 16: use InvalidArgumentException;
Line 47: throw new InvalidArgumentException();
Line 73: $skin = new View('skin/wide');

/modules/Demo/Controllers/MultiStepDemoController.php   Highlighted file source

Line 16: use Sprout\Helpers\Validator;
Line 84: ['email', 'Validity::email'],
Line 85: ['email', 'Validity::length', 0, 60],
Line 87: $this->validate($step, $required, $rules);
Line 95: ['phone', 'Validity::phone'],
Line 96: ['phone', 'Validity::length', 0, 20],
Line 97: ['mobile', 'Validity::phone'],
Line 98: ['mobile', 'Validity::length', 0, 20],
Line 101: Validator::trim($_POST);
Line 102: $valid = new Validator($_POST);
Line 103: $valid->multipleCheck(['phone', 'mobile'], 'Validity::oneRequired');
Line 104: $this->validate($step, $required, $rules, $valid);
Line 110: Validator::trim($_POST);
Line 111: $valid = new Validator($_POST);
Line 112: $valid->setFieldLabel('why_love', 'Why you love us');
Line 115: ['how_heard', 'Validity::inEnum', 'multistep_demo_submissions', 'how_heard'],
Line 116: ['why_love', 'Validity::length', 0, PHP_INT_MAX],
Line 118: $this->validate($step, $required, $rules, $valid);

/modules/Demo/views/admin/demo_item_delete.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/modules/Demo/views/steps/complete.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/modules/Demo/views/steps/details.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 28: Form::nextFieldDetails('How did you hear about us?', false);

/modules/Demo/views/steps/email.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/modules/Demo/views/steps/phone.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/modules/HarborAndSprout/Controllers/HarborController.php   Highlighted file source

Line 21: * @return void Echos HTML directly
Line 42: * @return void Echos HTML directly
Line 73: * @return void Redirects
Line 85: * @return void Redirects

/modules/HarborAndSprout/Helpers/GoogleDriveApi.php   Highlighted file source

Line 31: * @return void Redirects
Line 39: 'client_id' => $config['client_id'],
Line 63: 'client_id' => $config['client_id'],
Line 73: if (empty($resp['access_token'])) $errors[] = 'Did not receive "access_token" field';
Line 74: if (empty($resp['refresh_token'])) $errors[] = 'Did not receive "refresh_token" field';
Line 93: * @return void
Line 103: 'client_id' => $config['client_id'],

/modules/HarborAndSprout/views/admin/drive_api_form.php   Highlighted file source

Line 26: echo Form::multiline('extra', ['placeholder' => '{"pageSize": 10, "fields": "nextPageToken, files(id, name)"}'])

/modules/HomePage/Controllers/Admin/HomePageAdminController.php   Highlighted file source

Line 34: * Return the fields to show in the sidebar when adding or editing a record.
Line 44: public function _identifier(array $row)
Line 46: return Pdb::q("SELECT name FROM ~subsites WHERE id = ?", [$row['subsite_id']], 'val');
Line 80: public function _addSave(&$id) { return null; }

/modules/HomePage/Controllers/HomePageController.php   Highlighted file source

Line 33: * @return void Outputs HTML directly
Line 59: 'id' => $file['id'],
Line 62: 'url' => $file['mimeType'] == 'application/vnd.google-apps.folder' ? sprintf('?folder=%s', $file['id']): null,

/modules/HomePage/Helpers/HomePages.php   Highlighted file source

Line 27: * @param int $subsite_id Sub-site record ID. Default of zero/auto
Line 31: public static function getForSubSite($subsite_id = 0)
Line 33: $subsite_id = (int) $subsite_id;
Line 34: if ($subsite_id < 1) $subsite_id = SubsiteSelector::$subsite_id;
Line 38: WHERE home.subsite_id = ?";
Line 40: return Pdb::query($q, [$subsite_id], 'row');
Line 47: * @param int $homepage_id Home page record ID
Line 51: public static function getActiveBanners($homepage_id, $limit = 0)
Line 65: ON file.id = banner.file_id
Line 68: AND banner.homepage_id = ?
Line 70: banner.id
Line 76: return Pdb::query($q, [$homepage_id], 'arr');
Line 83: * @param int $homepage_id Home page record ID
Line 87: public static function getActivePromos($homepage_id, $limit)
Line 101: ON file.id = promo.file_id
Line 104: AND promo.homepage_id = ?
Line 106: promo.id
Line 112: return Pdb::query($q, [$homepage_id], 'arr');
Line 119: * @param int $homepage_id Home page record ID
Line 123: public static function getRandomActiveBanner($homepage_id)
Line 135: ON file.id = banner.file_id
Line 138: AND banner.homepage_id = ?
Line 140: banner.id
Line 145: return Pdb::query($q, [$homepage_id], 'row');

/modules/HomePage/Helpers/SitemapGenHome.php   Highlighted file source

Line 32: $q = "SELECT date_modified FROM ~homepages WHERE subsite_id = ?";
Line 33: $row = Pdb::q($q, [SubsiteSelector::$subsite_id], 'row');

/modules/Welcome/config/routes.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/modules/Welcome/config_tmpl/database.php   Highlighted file source

Line 49: // accidently become public), it's much better to include this in
Line 50: // a separate file, preferably outside of DOCROOT.

/modules/Welcome/Controllers/WelcomeController.php   Highlighted file source

Line 38: use Sprout\Helpers\Validator;
Line 280: $_SESSION['db_conf']['field_values'] = Validator::trim($_POST);
Line 282: $valid = new Validator($_POST);
Line 283: $valid->required(['production', 'host', 'user', 'pass', 'database']);
Line 285: if ($valid->hasErrors()) {
Line 286: $_SESSION['db_conf']['field_errors'] = $valid->getFieldErrors();
Line 497: * @return void Echos directly
Line 507: $config .= "' => ['uid' => {$user['uid']}, " . "'hash' => '" . Enc::html(Enc::js($user['hash']));
Line 548: * @return void Redirects
Line 552: $_SESSION['super_op']['field_values'] = Validator::trim($_POST);
Line 554: $valid = new Validator($_POST);
Line 555: $valid->required(['username', 'password1', 'password2']);
Line 556: $valid->check('username', 'Validity::length', 0, 50);
Line 559: $valid->check('username', 'Validity::uniqueValue', 'operators', 'username', 0, 'An operator already exists with that username');
Line 561: Notification::error('Please configure Database - Step 1 of checklist. It\'s required for validation!');
Line 565: $valid->check('username', 'Validity::regex', '/^[a-zA-Z0-9]+$/');
Line 566: $valid->check('password1', 'Validity::length', 8, 60);
Line 567: $valid->check('password2', 'Validity::length', 8, 60);
Line 568: $valid->multipleCheck(['password1', 'password2'], 'Validity::allMatch');
Line 573: $valid->addFieldError('password1', 'Not complex enough');
Line 574: $valid->addFieldError('password2', 'Not complex enough');
Line 583: if ($valid->hasErrors()) {
Line 584: $_SESSION['super_op']['field_errors'] = $valid->getFieldErrors();
Line 658: Pdb::query("DELETE FROM ~page_widgets", [], 'null');
Line 681: $cat_id = Pdb::insert('files_cat_list', $data);
Line 683: $file_id = 0;
Line 687: $file_id += 1;
Line 692: $data['id'] = $file_id;
Line 694: $data['filename'] = "{$file_id}_{$filename}";
Line 703: $data['file_id'] = $file_id;
Line 704: $data['cat_id'] = $cat_id;
Line 707: File::putExisting("{$file_id}_{$filename}", $orig);
Line 709: File::postUploadProcessing("{$file_id}_{$filename}", $file_id, FileConstants::TYPE_IMAGE);
Line 722: $page_id = 0;
Line 728: $page_id += 1;
Line 731: $parent_id = $parent_lookup[(string)$elem['parent']];
Line 733: $parent_id = 0;
Line 737: $data['id'] = $page_id;
Line 738: $data['parent_id'] = $parent_id;
Line 739: $data['subsite_id'] = 1;
Line 748: $parent_lookup[$name] = $page_id;
Line 751: $data['page_id'] = $page_id;
Line 758: $revision_id = Pdb::insert('page_revisions', $data);
Line 761: $data['page_revision_id'] = $revision_id;
Line 762: $data['area_id'] = 1;
Line 767: Pdb::insert('page_widgets', $data);
Line 779: . '<p>This being said, the ownership issues inherent in dominant thematic implementations cannot be understated</p>';
Line 780: Pdb::update('homepages', $data, ['id' => 1]);
Line 783: $data['homepage_id'] = 1;
Line 785: $data['file_id'] = 1;
Line 793: $data['homepage_id'] = 1;
Line 796: $data['file_id'] = 2;
Line 803: $data['homepage_id'] = 1;
Line 806: $data['file_id'] = 3;
Line 814: $data['homepage_id'] = 1;
Line 817: $data['file_id'] = 4;

/modules/Welcome/views/checklist.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 23: max-width: 900px;
Line 29: border: 1px solid #CED2DC;
Line 34: border-left: #F77450 solid 10px;
Line 37: border-left: #28943E solid 10px;
Line 43: vertical-align: middle;

/modules/Welcome/views/db_conf_form.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 23: max-width: 900px;

/modules/Welcome/views/db_conf_result.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 23: max-width: 900px;
Line 60: store the password in a separate file outside the document root.

/modules/Welcome/views/phpinfo.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 23: max-width: 1200px;
Line 35: <table width="600" cellpadding="3" border="0">

/modules/Welcome/views/super_op_form.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 23: max-width: 900px;

/modules/Welcome/views/super_op_result.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 24: max-width: 1200px;
Line 53: echo "' =&gt; ['uid' => {$user['uid']}, 'hash' =&gt; '", Enc::html(Enc::js($user['hash']));

/modules/Welcome/views/sync.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 21: max-width: 900px;
Line 26: .update-log b { display: inline-block; width: 100px; }

/skin/default/config/sprout.php   Highlighted file source

Line 35: * Image gallery widget
Line 43: 'slider_size' => 'c800x450'
Line 89: * Specify the number of nav groups for each top-level page id
Line 91: * Syntax is page_id => num_groups / columns
Line 112: * Override the dropdown logic for a given top-level page in the mega menu
Line 114: * Key Top-level page id
Line 135: $config['admin_richtext_width'] = 700;
Line 141: * 1 - no slideout
Line 142: * 2 - single level of slideout
Line 143: * 3 - two levels of slideout
Line 154: $config['related_heading'] = '<h3 class="widget-title">SECTION</h3>';
Line 158: * Widget heading/title
Line 160: * Anywhere where the string TITLE is found, it will be replaced with the user given widget heading
Line 162: $config['widget_title'] = '<h2 class="widget-title">TITLE</h2>';
Line 185: * The profile id of this site in Google Analytics
Line 188: $config['google_analytics_id'] = '';
Line 209: 'skin/wide' => 'Full-width',
Line 220: * Widget wrapper templates
Line 222: * Your partial must contain HTML with the merge tag: {{widget}}
Line 223: * to be replaced with the actual widget's HTML
Line 225: $config['widget_templates'] = array(

/skin/default/email.php   Highlighted file source

Line 11: <meta name="viewport" content="width=device-width, initial-scale=1">
Line 29: width:100%;
Line 33: width:100%;
Line 112: @media only screen and (max-device-width: 619px), screen and (max-width: 619px){
Line 125: .deviceWidth,
Line 126: .paddedDeviceWidth {
Line 128: max-width:100%!important;
Line 130: .deviceWidth {
Line 131: width:480px!important;
Line 134: .paddedDeviceWidth {
Line 135: width:440px!important;
Line 138: @media only screen and (max-device-width: 560px), screen and (max-width: 560px){
Line 145: .deviceWidth {
Line 146: width:380px!important;
Line 148: .paddedDeviceWidth {
Line 149: width:340px!important;
Line 152: @media only screen and (max-device-width: 420px), screen and (max-width: 420px){
Line 159: .deviceWidth,
Line 160: .paddedDeviceWidth {
Line 161: width:100%!important;
Line 167: <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="width:100%; margin:0; padding:0;background-color: #ededed;font-size: 16px; color: #303030; font-weight: normal; text-align: left; font-family: 'Open Sans', Arial, Helvetica, sans-serif; mso-line-height-rule:exactly; line-height: 26px;">
Line 170: <table width="100%" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#ededed">
Line 172: <td class="wrappper" width="100%" valign="top" style="padding: 20px;">
Line 174: <table width="600" class="deviceWidth" border="0" cellpadding="25" cellspacing="0" align="center" bgcolor="#ffffff">
Line 184: <table width="600" class="deviceWidth" border="0" cellpadding="25" cellspacing="0" align="center" bgcolor="#ffffff">
Line 194: <table width="600" class="deviceWidth" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#ededed">

/skin/default/exception.php   Highlighted file source

Line 12: #main {width: 600px; margin: 0 auto; padding: 0;}
Line 14: img {margin: 0; width: 227px; height: 300px; margin: 0 auto; display:block;background:url(data:image/gif;base64,R0lGODlhBQAEAKEBAAAAAP%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FyH5BAEKAAIALAAAAAAFAAQAAAIHDBypBncJCgA7) 50% 50% no-repeat;}
Line 20: <div id="main">
Line 22: <img src="<?php echo Sprout::absRoot(); ?>media/images/system_error3.jpg" width="227" height="300">
Line 23: <div id="nice">
Line 25: <p>When reporting this error, quote the code <?php echo 'SE' . str_pad($log_id, 5, '0', STR_PAD_LEFT); ?>.</p>
Line 27: <div id="tech">

/skin/default/home.php   Highlighted file source

Line 9: use Sprout\Helpers\Widgets;
Line 27: <?php Skin::css('normalize', 'flexboxgrid', 'global', 'frankenmenu'); ?>
Line 35: <a class="-vis-hidden" href="#content">Skip to Content</a>
Line 39: <div id="wrap">
Line 47: <div id="content" class="section section--content bg-white">
Line 66: <div class="sidebar">
Line 68: <?php echo Widgets::renderArea('sidebar'); ?>

/skin/default/inner.php   Highlighted file source

Line 12: use Sprout\Helpers\Widgets;
Line 38: <?php Skin::css('normalize', 'flexboxgrid', 'global', 'frankenmenu'); ?>
Line 48: <div id="wrap">
Line 49: <a class="-vis-hidden" href="#content">Skip to Content</a>
Line 53: <div id="content" class="section section--content bg-white">
Line 78: <div class="sidebar">
Line 80: <?php echo Widgets::renderArea('sidebar'); ?>

/skin/default/partials/_footer.php   Highlighted file source

Line 7: <footer id="footer">
Line 55: <div class="field-element field-element--text field-element--white field-element--hidden-label">
Line 60: <input id="enews-first-name" class="textbox" type="text" name="first_name" placeholder="Name">
Line 63: <div class="field-element field-element--text field-element--white field-element--hidden-label">
Line 68: <input id="enews-email" class="textbox" type="text" name="email" placeholder="Email Address">
Line 93: <a href="http://getsproutcms.com" target="_blank" rel="nofollow">Powered by SproutCMS<span class="-vis-hidden">, view the website in a new window</span></a>
Line 102: <span class="-vis-hidden">Follow us on Facebook</span>
Line 108: <span class="-vis-hidden">Follow us on Twitter</span>
Line 114: <span class="-vis-hidden">Follow us on Instagram</span>
Line 120: <span class="-vis-hidden">Follow us on YouTube</span>
Line 126: <span class="-vis-hidden">Follow us on Pinterest</span>

/skin/default/partials/_google_analytics.php   Highlighted file source

Line 5: $analytics_id = Kohana::config('sprout.google_analytics_id');
Line 12: } else if (!$analytics_id or AdminAuth::isLoggedIn()) {
Line 24: ga('create', '<?php echo $analytics_id; ?>', 'auto');

/skin/default/partials/_header.php   Highlighted file source

Line 6: <header id="header">
Line 38: <div class="field-element field-element--text field-element--white field-element--hidden-label">
Line 48: <input id="fm-site-search" class="textbox" type="text" name="q" value="<?php echo Enc::html(@$_GET['q']); ?>" placeholder="Enter your search here">
Line 79: <nav id="frankenmenu">

/skin/default/partials/_meta-data.php   Highlighted file source

Line 10: <meta name="viewport" content="width=device-width, initial-scale=1">

/skin/default/partials/_mobile-header.php   Highlighted file source

Line 1: <div id="mobile-header">
Line 3: <button type="button" id="mobile-menu-button">
Line 4: <span class="-vis-hidden">Toggle menu</span>
Line 6: <span class="mobile-menu-button-middle"></span>

/skin/default/popup.php   Highlighted file source

Line 4: <div id="popup-wrap">

/skin/default/wide.php   Highlighted file source

Line 37: <?php Skin::css('normalize', 'flexboxgrid', 'global', 'frankenmenu'); ?>
Line 47: <div id="wrap">
Line 48: <a class="-vis-hidden" href="#content">Skip to Content</a>
Line 52: <div id="content" class="section section--content bg-white">
Line 56: <div class="mainbar mainbar--wide">

/skin/harbor/config/sprout.php   Highlighted file source

Line 35: * Image gallery widget
Line 43: 'slider_size' => 'c800x450'
Line 89: * Specify the number of nav groups for each top-level page id
Line 91: * Syntax is page_id => num_groups / columns
Line 112: * Override the dropdown logic for a given top-level page in the mega menu
Line 114: * Key Top-level page id
Line 135: $config['admin_richtext_width'] = 700;
Line 141: * 1 - no slideout
Line 142: * 2 - single level of slideout
Line 143: * 3 - two levels of slideout
Line 154: $config['related_heading'] = '<h3 class="widget-title">SECTION</h3>';
Line 158: * Widget heading/title
Line 160: * Anywhere where the string TITLE is found, it will be replaced with the user given widget heading
Line 162: $config['widget_title'] = '<h2 class="widget-title">TITLE</h2>';
Line 185: * The profile id of this site in Google Analytics
Line 188: $config['google_analytics_id'] = '';
Line 209: 'skin/wide' => 'Full-width',
Line 214: * Widget wrapper templates
Line 216: * Your partial must contain HTML with the merge tag: {{widget}}
Line 217: * to be replaced with the actual widget's HTML
Line 219: $config['widget_templates'] = array(

/skin/harbor/home.php   Highlighted file source

Line 9: use Sprout\Helpers\Widgets;
Line 44: <?php if (!empty($file['url'])): ?><a bp="grid vertical-center" href="<?= Enc::html($file['url']); ?>"><?php else: ?><div bp="grid vertical-center"><?php endif; ?>

/skin/harbor/_meta-data.php   Highlighted file source

Line 10: <meta name="viewport" content="width=device-width, initial-scale=1">

/skin/sprout_load.php   Highlighted file source

Line 6: // Convert file/download/id(/size) links to actual file names e.g. 'files/123_example.jpg'

/skin/unavailable/coming_soon.php   Highlighted file source

Line 11: <meta name="viewport" content="width=device-width, initial-scale=1">

/skin/unavailable/maintenance.php   Highlighted file source

Line 11: <meta name="viewport" content="width=device-width, initial-scale=1">

/sprout/cli_bootstrap.php   Highlighted file source

Line 23: // These are identical to those in .htaccess and nginx.conf.

/sprout/composer_bootstrap.php   Highlighted file source

Line 15: date_default_timezone_set('Australia/Adelaide');

/sprout/config/admin_seo.php   Highlighted file source

Line 74: "becomes", "becoming", "been", "before", "beforehand", "behind", "being", "below", "beside", "besides", "between", "beyond",
Line 86: "side", "since", "sincere", "six", "sixty", "so", "some", "somehow", "someone", "something", "sometime", "sometimes", "somewhere",

/sprout/config/cache.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/config/cache_memcache.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/config/cache_xcache.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/config/config.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 66: * server bandwidth usage, at the cost of slightly higher CPU usage. Set to

/sprout/config/cookie.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/config/database.php   Highlighted file source

Line 41: // accidently become public), it's much better to include this in
Line 42: // a separate file, preferably outside of DOCROOT.

/sprout/config/encryption.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/config/file.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 26: * ResizeImageTransform ( width , height )
Line 27: * CropImageTransform ( width , height , top_pos = 'center' , left_pos = 'center')
Line 29: * Transformations get applied in the order they are provided in the array.

/sprout/config/image.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 34: 'width' => 2048,
Line 44: 'width' => 2048,

/sprout/config/inflector.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/config/locale.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 21: * First item must be a valid i18n directory name, subsequent items are alternative locales
Line 22: * for OS's that don't support the first (e.g. Windows). The first valid locale in the array will be used.

/sprout/config/mimes.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 25: * expected MIME type, as well as any additional information you can provide.
Line 37: 'asf' => array('video/x-ms-asf'),
Line 38: 'asr' => array('video/x-ms-asf'),
Line 39: 'asx' => array('video/x-ms-asf'),
Line 41: 'avi' => array('video/avi', 'video/msvideo', 'video/x-msvideo'),
Line 60: 'divx' => array('video/divx'),
Line 74: 'flc' => array('video/flc'),
Line 75: 'fli' => array('video/fli'),
Line 76: 'flv' => array('video/x-flv'),
Line 106: 'm4p' => array('video/mp4v-es'),
Line 107: 'm4v' => array('video/mp4'),
Line 110: 'midi' => array('audio/midi'),
Line 111: 'mid' => array('audio/midi'),
Line 114: 'mkv' => array('video/x-matroska'),
Line 115: 'mov' => array('video/quicktime'),
Line 116: 'movie' => array('video/x-sgi-movie'),
Line 119: 'mp4' => array('application/mp4','audio/mp4','video/mp4'),
Line 120: 'mpa' => array('video/mpeg'),
Line 121: 'mpe' => array('video/mpeg'),
Line 122: 'mpeg' => array('video/mpeg'),
Line 123: 'mpg' => array('video/mpeg'),
Line 124: 'mpg4' => array('video/mp4'),
Line 127: 'mpv' => array('video/x-matroska'),
Line 128: 'mpv2' => array('video/mpeg'),
Line 145: 'ogv' => array('video/ogg'),
Line 173: 'qt' => array('video/quicktime'),
Line 183: 'rv' => array('video/vnd.rn-realvideo'),
Line 211: 'wm' => array('video/x-ms-wm'),
Line 215: 'wmv' => array('video/x-ms-wmv', 'application/octet-stream'),
Line 216: 'wmx' => array('video/x-ms-wmx'),
Line 221: 'wvx' => array('video/x-ms-wvx'),
Line 236: 'xvid' => array('video/x-xvid'),

/sprout/config/page.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/config/require_ssl.php   Highlighted file source

Line 6: * @author David Cruz
Line 7: * @copyright (c) 2009 David Cruz

/sprout/config/routes.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 29: $config['admin_ajax/widget_settings/([^/]+)'] = 'AdminAjaxController/widgetSettings/$1';
Line 30: $config['admin_ajax/widget_disp_conds'] = 'AdminAjaxController/widgetDispConds';
Line 31: $config['admin_ajax/widget_disp_cond_params'] = 'AdminAjaxController/widgetDispCondParams';
Line 45: $config['admin_ajax/style_guide_demo_conditions'] = 'AdminAjaxController/styleGuideDemoConditions';
Line 54: $config['admin/style_guide'] = 'AdminController/styleGuide/index';
Line 55: $config['admin/style_guide/([_a-z]+)'] = 'AdminController/styleGuide/$1';
Line 96: $config['page/view_by_id/([0-9]+)'] = 'Sprout\\Controllers\\PageController/viewById/$1';
Line 120: $config['tinymce4/video'] = 'Tinymce4Controller/video';
Line 121: $config['tinymce4/video_list/([0-9]+)'] = 'Tinymce4Controller/videoList/$1';
Line 122: $config['tinymce4/video_search'] = 'Tinymce4Controller/videoSearch';
Line 142: $config['embed_video/thumb/([^/]+)/([^/]+)/([^/]+)'] = 'EmbedVideoController/thumb/$1/$2/$3';

/sprout/config/session.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 36: * Session parameters to validate: userAgent, ip_address, expiration.
Line 38: $config['validate'] = array();
Line 54: * Number of page loads before the session id is regenerated.
Line 55: * A value of 0 will disable automatic session id regeneration.

/sprout/config/sql_types.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/config/upload.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/config/user_agents.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 21: * User Agent library to help identify browser, platform, robot, and
Line 22: * mobile device data. The array keys are used to identify the device
Line 68: // multiple browser types so we want to identify the sub-type first.
Line 114: 'android' => 'Android',

/sprout/config/view.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/Controllers/Admin/ActionLogAdminController.php   Highlighted file source

Line 30: use Sprout\Helpers\RefineWidgetSelect;
Line 31: use Sprout\Helpers\RefineWidgetTextbox;
Line 45: protected $main_where = ['item.parent_id = 0'];
Line 55: $this->main_order = 'item.id DESC';
Line 62: 'Record' => [new ColModifierActionLogData(), 'id'],
Line 67: $this->refine_bar->addWidget(new RefineWidgetSelect('type', 'Type', $types));
Line 68: $this->refine_bar->addWidget(new RefineWidgetTextbox('record_table', 'Table'));
Line 69: $this->refine_bar->addWidget(new RefineWidgetTextbox('record_id', 'Record ID'));
Line 70: $this->refine_bar->addWidget(new RefineWidgetTextbox('modified_editor', 'Editor'));
Line 74: public function _addSave(&$item_id) { return false; }
Line 75: public function _isEditSaved($item_id) { return false; }
Line 76: public function _editSave($item_id) { return false; }
Line 95: * Return the fields to show in the sidebar when adding or editing a record.
Line 111: protected function _editPreRender($view, $item_id)
Line 114: $q = "SELECT id
Line 116: WHERE record_table = ? AND id < ?
Line 117: ORDER BY id DESC
Line 120: $row = Pdb::q($q, [$view->data['record_table'], $item_id], 'row');
Line 121: $view->prev_id = $row['id'];
Line 127: $q = "SELECT id
Line 129: WHERE record_table = ? AND id > ?
Line 130: ORDER BY id ASC
Line 133: $row = Pdb::q($q, [$view->data['record_table'], $item_id], 'row');
Line 134: $view->next_id = $row['id'];
Line 154: $q = "SELECT record_table, COUNT(id) AS num FROM ~history_items GROUP BY record_table ORDER BY record_table";
Line 176: $q = "SELECT * FROM ~login_attempts ORDER BY id DESC LIMIT 25";
Line 209: $q = "DELETE FROM ~history_items WHERE id = ?";
Line 213: $q = "SELECT id, type, restored_date, data
Line 224: Pdb::execute($del_st, [$row['id']], 'null');

/sprout/Controllers/Admin/CategoryAdminController.php   Highlighted file source

Line 29: use Sprout\Helpers\Validator;
Line 107: * Return the fields to show in the sidebar when adding or editing a record.
Line 159: * Saves the provided POST data into a new record in the database
Line 161: * @param int $item_id After saving, the new record id will be returned in this parameter
Line 164: public function _addSave(&$item_id)
Line 168: $valid = new Validator($_POST);
Line 169: $valid->required(['name']);
Line 170: $valid->check('name', 'Validity::length', 0, 50);
Line 171: if ($valid->hasErrors()) {
Line 172: $_SESSION['admin']['field_errors'] = $valid->getFieldErrors();
Line 173: $valid->createNotifications();
Line 183: $item_id = Pdb::insert($this->table_name, $update_fields);
Line 194: * @param int $id The id of the record to get the edit form of
Line 196: public function _getEditForm($id)
Line 198: if (! $this->parent_inst->catAllowEdit($id)) {
Line 203: $id = (int) $id;
Line 206: $q = "SELECT * FROM ~{$this->table_name} WHERE id = ?";
Line 207: $item = Pdb::query($q, [$id], 'row');
Line 219: $view->id = $id;
Line 229: $this->_editPreRender($view, $id);
Line 232: 'title' => 'Editing ' . Enc::html(Inflector::singular($this->friendly_name)) . ' <strong>' . Enc::html($this->_identifier($item)) . '</strong>',
Line 239: * Saves the provided POST data the specified record
Line 241: * @param int $item_id The record to update
Line 244: public function _editSave($item_id)
Line 246: if (! $this->parent_inst->catAllowEdit($item_id)) {
Line 248: Url::redirect('admin/edit/' . $this->controller_name . '/' . $item_id);
Line 251: $item_id = (int) $item_id;
Line 253: // Validate
Line 254: $valid = new Validator($_POST);
Line 255: $valid->required(['name']);
Line 256: $valid->check('name', 'Validity::length', 0, 50);
Line 257: if ($valid->hasErrors()) {
Line 259: $_SESSION['admin']['field_errors'] = $valid->getFieldErrors();
Line 260: $valid->createNotifications();
Line 275: Pdb::update($this->table_name, $update_fields, ['id' => $item_id]);
Line 287: * @param int $id The category id
Line 289: public function _getDeleteForm($id)
Line 291: if (! $this->parent_inst->catAllowDelete($id)) {
Line 301: $q = "SELECT * FROM ~{$cat_table} WHERE id = ?";
Line 302: $category = Pdb::q($q, [$id], 'row');
Line 304: $q = "SELECT COUNT(main.id) AS C
Line 306: INNER JOIN ~{$joiner_table} AS joiner ON joiner.{$main_controller}_id = main.id
Line 307: WHERE joiner.cat_id = ?";
Line 308: $num_in_cat = Pdb::q($q, [$id], 'val');
Line 315: $view->id = $id;
Line 328: * @param int $id The record to delete
Line 331: public function _deleteSave($id)
Line 333: $id = (int) $id;
Line 335: if (! $this->parent_inst->catAllowDelete($id)) {
Line 337: Url::redirect('admin/delete/' . $this->controller_name . '/' . $id);
Line 350: $q = "SELECT main.id
Line 352: INNER JOIN ~{$joiner_table} AS joiner ON joiner.{$main_controller}_id = main.id
Line 353: WHERE joiner.cat_id = ?
Line 354: ORDER BY main.id";
Line 355: $res = Pdb::q($q, [$id], 'col');
Line 357: foreach ($res as $row_id) {
Line 358: $res = $this->parent_inst->_deleteSave($row_id);
Line 364: $this->deleteRecord($this->table_name, $id);
Line 368: Pdb::delete($joiner_table, ['cat_id' => $id]);
Line 379: public function _extraReorder($category_id)
Line 381: $category_id = (int) $category_id;
Line 392: $q = "SELECT * FROM ~{$this->table_name} WHERE id = ?";
Line 394: $page = Pdb::q($q, [$category_id], 'row');
Line 396: return new AdminError('Invalid id specified - category does not exist');
Line 403: ON item.id = joiner.{$item_name}_id
Line 404: WHERE joiner.cat_id = ?
Line 406: $items = Pdb::q($q, [$category_id], 'arr');
Line 413: $item['name'] = $this->parent_inst->_identifier($item);
Line 418: $view->id = $category_id;
Line 431: public function reorderSave($category_id)
Line 433: $category_id = (int) $category_id;
Line 448: foreach ($_POST['items'] as $id) {
Line 449: $id = (int) $id;
Line 451: $where = ['cat_id' => $category_id, "{$item_name}_id" => $id];
Line 458: Url::redirect("admin/contents/{$item_name}?_category_id={$category_id}");
Line 474: $q = "SELECT id, name FROM ~{$this->table_name} ORDER BY record_order, name";
Line 505: foreach ($_POST['items'] as $id) {
Line 506: $id = (int) $id;
Line 508: Pdb::update($this->table_name, ['record_order' => $record_order], ['id' => $id]);
Line 522: public function ajaxArchiveAction($category_id)
Line 528: Pdb::update($this->table_name, $data, ['id' => $category_id]);
Line 537: public function ajaxUnarchiveAction($category_id)
Line 543: Pdb::update($this->table_name, $data, ['id' => $category_id]);

/sprout/Controllers/Admin/ContentSubscriptionAdminController.php   Highlighted file source

Line 19: use Sprout\Helpers\RefineWidgetSelect;
Line 20: use Sprout\Helpers\RefineWidgetTextbox;
Line 43: 'Module' => [new ColModifierContentSubscription(), 'id'],
Line 48: $this->refine_bar->addWidget(new RefineWidgetTextbox('name', 'Name'));
Line 49: $this->refine_bar->addWidget(new RefineWidgetTextbox('email', 'Email'));

/sprout/Controllers/Admin/CronJobAdminController.php   Highlighted file source

Line 22: use Sprout\Helpers\RefineWidgetSelect;
Line 23: use Sprout\Helpers\RefineWidgetTextbox;
Line 58: $this->refine_bar->addWidget(new RefineWidgetTextbox('name', 'Name'));
Line 59: $this->refine_bar->addWidget(new RefineWidgetSelect('status', 'Status', array('Incomplete', 'Complete')));
Line 81: * Return the fields to show in the sidebar when adding or editing a record.
Line 95: public function _addSave(&$item_id) { return false; }
Line 96: public function _editSave($item_id) { return false; }
Line 159: // Instance class - this may throw an exception if class not found or invalid

/sprout/Controllers/Admin/DocumentTypeAdminController.php   Highlighted file source

Line 16: use InvalidArgumentException;
Line 48: * Return the fields to show in the sidebar when adding or editing a record.
Line 80: * Saves the provided POST data into a new record in the database
Line 82: * @param int $item_id After saving, the new record id will be returned in this parameter
Line 85: public function _addSave(&$item_id)
Line 88: if (!parent::_addSave($item_id)) return false;
Line 90: $this->fixRecordOrder($item_id);
Line 99: protected function _editPreRender($view, $item_id)
Line 101: parent::_editPreRender($view, $item_id);
Line 109: public function _getEditSubActions($item_id)
Line 111: $actions = parent::_getEditSubActions($item_id);
Line 118: * Saves the provided POST data into the specified record
Line 120: * @param int $item_id The record to update
Line 123: public function _editSave($item_id)
Line 125: $item_id = (int) $item_id;
Line 126: if ($item_id <= 0) throw new InvalidArgumentException('$item_id must be greater than 0');
Line 128: return parent::_editSave($item_id);

/sprout/Controllers/Admin/EmailTextAdminController.php   Highlighted file source

Line 18: use Sprout\Helpers\Validator;
Line 54: public function _addSave(&$item_id)
Line 63: protected function _editPreRender($view, $item_id)
Line 65: parent::_editPreRender($view, $item_id);
Line 75: public function _getEditSubActions($item_id)
Line 77: $actions = parent::_getEditSubActions($item_id);
Line 84: * Saves the provided POST data the specified record
Line 89: public function _editSave($id)
Line 91: $id = (int) $id;
Line 93: $_SESSION['admin']['field_values'] = Validator::trim($_POST);
Line 95: // Validate form fields
Line 96: $valid = new Validator($_POST);
Line 97: $valid->required(['text']);
Line 98: $valid->check('text', 'Validity::length', 0, 5000);
Line 99: if ($valid->hasErrors()) {
Line 100: $_SESSION['admin']['field_errors'] = $valid->getFieldErrors();
Line 101: $valid->createNotifications();
Line 112: $logdata = $this->loadRecord($this->table_name, $id);
Line 114: Pdb::update($this->table_name, $update_fields, ['id' => $id]);
Line 116: $this->logEdit($this->table_name, $id, $logdata);

/sprout/Controllers/Admin/ExtraPageAdminController.php   Highlighted file source

Line 20: use Sprout\Helpers\RefineWidgetSelect;
Line 22: use Sprout\Helpers\Validator;
Line 52: 'subsite_id = ' . ((int)$_SESSION['admin']['active_subsite']),
Line 56: $this->refine_bar->addWidget(new RefineWidgetSelect('type', 'Type', $this->extra_page_types));
Line 74: $q = "SELECT id, type
Line 76: WHERE subsite_id = ?
Line 83: $snippets[$row['id']] = $this->extra_page_types[$row['type']];
Line 87: $view = new View('sprout/admin/extra_page_sidebar');
Line 94: * Return the fields to show in the sidebar when adding or editing a record.
Line 108: * Validates incoming POST data.
Line 112: private function validate()
Line 114: $_SESSION['admin']['field_values'] = Validator::trim($_POST);
Line 117: $valid = new Validator($_POST);
Line 118: $valid->required(['type', 'text']);
Line 120: if ($valid->hasErrors()) {
Line 121: $_SESSION['admin']['field_errors'] = $valid->getFieldErrors();
Line 122: $valid->createNotifications();
Line 139: WHERE subsite_id = ?";
Line 141: foreach ($extant_types as $type_id) {
Line 142: unset($types[$type_id]);
Line 162: * Saves the provided POST data into a new record in the database
Line 164: * @param int $item_id After saving, the new record id will be returned in this parameter
Line 167: public function _addSave(&$item_id)
Line 169: $res = $this->validate();
Line 179: $update_fields['subsite_id'] = $_SESSION['admin']['active_subsite'];
Line 183: $item_id = Pdb::insert('extra_pages', $update_fields);
Line 185: $res = $this->logAdd('extra_pages', $item_id);
Line 198: protected function _editPreRender($view, $item_id)
Line 200: parent::_editPreRender($view, $item_id);
Line 208: public function _getEditSubActions($item_id)
Line 210: $actions = parent::_getEditSubActions($item_id);
Line 222: * Saves the provided POST data the specified record
Line 224: * @param int $item_id The record to update
Line 227: public function _editSave($item_id)
Line 229: $item_id = (int) $item_id;
Line 231: $res = $this->validate();
Line 243: $logdata = $this->loadRecord('extra_pages', $item_id);
Line 245: Pdb::update('extra_pages', $update_fields, ['id' => $item_id]);
Line 247: $res = $this->logEdit('extra_pages', $item_id, $logdata);
Line 257: * Creates the identifier used in the heading.
Line 261: public function _identifier(array $item)

/sprout/Controllers/Admin/FileAdminController.php   Highlighted file source

Line 43: use Sprout\Helpers\RefineWidgetSelect;
Line 44: use Sprout\Helpers\RefineWidgetTextbox;
Line 52: use Sprout\Helpers\Validator;
Line 92: $this->refine_bar->addWidget(new RefineWidgetTextbox('name', 'Name'));
Line 93: $this->refine_bar->addWidget(new RefineWidgetSelect('type', 'Type', FileConstants::$type_names));
Line 94: $this->refine_bar->addWidget(new RefineWidgetTextbox('filename', 'Filename'));
Line 97: $this->refine_bar->addWidget(new RefineWidgetSelect('document_type', 'Document Type', Pdb::lookup('document_types')));
Line 99: $this->main_modes['thumb'] = array('Thumbnails', 'grid');
Line 106: * Return the fields to show in the sidebar when adding or editing a record.
Line 115: $file_id = Admin::getRecordId();
Line 116: $file = !empty($file_id) ? Pdb::get('files', $file_id) : null;
Line 129: * These may be false if the UI provides its own save mechanism (e.g. multi-add)
Line 165: * @return void Outputs JSON
Line 170: Json::error('Invalid "index" param');
Line 173: Json::error('Invalid "code" param');
Line 199: * Other keys provided are passed to the ajaxDragdropForm method.
Line 203: * @return void Outputs JSON
Line 208: Json::error('Invalid "num" param');
Line 211: Json::error('Invalid "code" param');
Line 294: * @return void Outputs HTML
Line 340: if ($view->shrunk_img['original_width'] > $max_dims['width']) {
Line 358: $view->data['category_id'] = key($view->categories);
Line 359: } else if (!empty($_GET['form']['category_id'])) {
Line 360: $view->data['category_id'] = $_GET['form']['category_id'];
Line 363: $q = "SELECT id, name
Line 380: * @return void Outputs JSON
Line 433: $file_id = Pdb::insert('files', $update_fields);
Line 438: $filename = $file_id . '_' . File::filenameMakeSane($_POST['orig_name']);
Line 440: // Filename is only set after upload because the ID is in the name
Line 444: Pdb::update('files', $update_fields, ['id' => $file_id]);
Line 450: if (!empty($_POST['category_id'])) {
Line 451: Category::insertInto('files', $file_id, $_POST['category_id']);
Line 460: if ($size[0] > $max_dims['width'] or $size[1] > $max_dims['height']) {
Line 464: $img->resize($max_dims['width'], $max_dims['height']);
Line 483: File::postUploadProcessing($filename, $file_id, $type);
Line 491: $html .= '<p class="file-upload__item__feedback__name"><a href="admin/edit/file/' . $file_id . '" target="_blank">' . Enc::html($filename) . '</a></p>';
Line 497: 'file_id' => $file_id,
Line 506: * May receive two different variations on the provided POST data:
Line 510: * @return void
Line 522: * @return void Outputs JSON directly (see {@see Json::out})
Line 549: public function _addSave(&$item_id)
Line 560: Json::out(array('valid' => 0, 'error' => $message));
Line 577: $result = $this->doUpload(@$_POST['category_id']);
Line 585: * @param int $category_id ID of category to store file in
Line 587: private function doUpload($category_id)
Line 589: $category_id = (int) $category_id;
Line 591: // Check upload exists and has valid metadata
Line 645: $file_id = Pdb::insert('files', $update_data);
Line 656: $category_id = Category::create('files', $_POST['category_new']);
Line 663: if ($category_id) {
Line 665: Category::insertInto('files', $file_id, $category_id);
Line 671: // Upload the file - uses the file id
Line 672: $filename = $file_id . '_' . $filename;
Line 680: File::postUploadProcessing($filename, $file_id, $file_type);
Line 689: 'id' => $file_id,
Line 692: 'cat_id' => $category_id,
Line 701: public function _editPreRender($view, $item_id)
Line 743: public function _getEditSubActions($item_id)
Line 745: $actions = parent::_getEditSubActions($item_id);
Line 748: 'url' => 'admin/extra/' . $this->controller_name . '/find_usage/' . $item_id,
Line 758: * Saves the provided POST data into this file in the database
Line 760: * @param int $item_id The record to update
Line 764: public function _editSave($item_id)
Line 766: $item_id = (int) $item_id;
Line 768: $file = Pdb::get('files', $item_id);
Line 770: $_SESSION['admin']['field_values'] = Validator::trim($_POST);
Line 772: $valid = new Validator($_POST);
Line 773: $valid->required(['name']);
Line 774: $valid->check('name', 'Validity::length', 1, 200);
Line 775: $valid->check('description', 'Validity::length', 1, 10000);
Line 776: $valid->check('author', 'Validity::length', 1, 80);
Line 779: // Check upload is valid
Line 780: if (!Upload::valid($_FILES['replace'])) {
Line 782: $valid->addFieldError('replace', 'File upload failed');
Line 789: $valid->addFieldError('replace', 'File must be of type: ' . FileConstants::$type_names[$file['type']]);
Line 793: if ($valid->hasErrors()) {
Line 794: $_SESSION['admin']['field_errors'] = $valid->getFieldErrors();
Line 795: $valid->createNotifications();
Line 805: $new_filename = $item_id . '_' . File::filenameMakeSane($_FILES['replace']['name']);
Line 862: throw new Exception('Invalid image manipulation "' . $_POST['manipulate'] . '"');
Line 934: Pdb::update('files', $data, ['id' => $item_id]);
Line 936: $this->reindexItem($item_id, $_POST['name'], $file['plaintext'], $data['enable_indexing']);
Line 944: $this->updateCategories($item_id, @$_POST['categories']);
Line 958: $new_path = 'file/download/' . $item_id;
Line 1002: * @param int $item_id The record to delete
Line 1006: public function _deleteSave($item_id)
Line 1008: return parent::_deleteSave($item_id);
Line 1015: * @param int $item_id
Line 1021: private function reindexItem($item_id, $name, $plaintext, $enabled = true)
Line 1024: Search::selectIndex('file_keywords', $item_id);
Line 1056: $q = "SELECT id, name, filename, plaintext, enable_indexing FROM ~files";
Line 1068: Pdb::update('files', ['plaintext' => $plain], ['id' => $row['id']]);
Line 1073: $this->reindexItem($row['id'], $row['name'], $plain ?: $row['plaintext'], $row['enable_indexing']);
Line 1090: public function frontEndSearch($item_id, $relevancy, $keywords)
Line 1092: $q = "SELECT name, filename, plaintext, enable_indexing FROM sprout_files WHERE id = ?";
Line 1093: $row = Pdb::q($q, [$item_id], 'row');
Line 1141: * Return the list of sidebar tools
Line 1148: $tools[] = '<li class="config"><a href="admin/extra/file/cleanup_invalid">Cleanup invalid files</a></li>';
Line 1159: * Provides a UI for doing a 'cleanup' - removes invalid files
Line 1161: public function _extraCleanupInvalid()
Line 1163: $view = new View("sprout/admin/file_cleanup_invalid");
Line 1166: $q = "SELECT id, filename, name, type FROM ~files";
Line 1182: 'title' => 'Cleanup invalid files',
Line 1191: public function cleanupInvalidAction()
Line 1197: $this->cleanupInvalidActionInner();
Line 1200: Url::redirect('admin/extra/file/cleanup_invalid');
Line 1211: public function cronCleanupInvalid()
Line 1213: Cron::start('Cleanup invalid files');
Line 1214: $this->cleanupInvalidActionInner();
Line 1220: * Remove invalid files, such as:
Line 1227: private function cleanupInvalidActionInner()
Line 1233: $q = "SELECT id, filename, name, type FROM ~files";
Line 1247: Pdb::delete('files', ['id' => $file['id']]);
Line 1249: Pdb::delete($joiner_table, ['file_id' => $file['id']]);
Line 1298: * The width and height is specified width . 'x' . height (e.g. 200x100)
Line 1352: * @return void
Line 1391: $_GET['category_id'] = (int) $_GET['category_id'];
Line 1397: if ($_GET['category_id'] > 0) {
Line 1399: ON files.id = joiner.file_id AND joiner.cat_id = ?";
Line 1400: $params[] = $_GET['category_id'];
Line 1429: $q = "SELECT COUNT(DISTINCT id) AS C
Line 1437: $q = "SELECT DISTINCT files.id, files.name, files.filename
Line 1464: 'id' => $row['id'],
Line 1522: * @param int $file_id
Line 1525: public function _extraFindUsage($file_id)
Line 1527: $file = Pdb::get('files', $file_id);
Line 1576: * Provide the contents of a temporarily uploaded file, for e.g. listening to uploaded audio
Line 1578: * @return void Sets headers and outputs file content

/sprout/Controllers/Admin/HasCategoriesAdminController.php   Highlighted file source

Line 16: use InvalidArgumentException;
Line 32: use Sprout\Helpers\RefineWidgetSelect;
Line 83: $this->refine_bar->addWidget(new RefineWidgetSelect('_category_id', 'Category', $records));
Line 109: public function catAllowEdit($category_id)
Line 118: public function catAllowDelete($category_id)
Line 133: $columns[] = 'categories.id';
Line 164: ON categories.id = joiner.cat_id
Line 166: GROUP BY categories.id
Line 173: $q = "SELECT COUNT(item.id) AS c
Line 175: LEFT JOIN ~{$this->table_name}_cat_join AS joiner ON joiner.{$joiner_ref_col} = item.id
Line 183: 'id' => '0',
Line 226: * Return the WHERE clause to use for a given key which is provided by the RefineBar
Line 242: case '_category_id':
Line 246: WHERE joiner.{$joiner_ref_col} = item.id LIMIT 1) IS NULL";
Line 251: WHERE joiner.{$joiner_ref_col} = item.id AND joiner.cat_id = ? LIMIT 1) = 1";
Line 270: if (@$_GET['_category_id'] == '0') {
Line 274: } else if (empty($_GET['_category_id'])) {
Line 280: $_GET['_category_id'] = (int) $_GET['_category_id'];
Line 281: $q = "SELECT * FROM ~{$this->table_name}_cat_list WHERE id = ?";
Line 282: $category = Pdb::q($q, [$_GET['_category_id']], 'row');
Line 295: Pdb::validateIdentifier($_GET['order']);
Line 303: } else if (isset($_GET['_category_id'])) {
Line 307: $cat_id = (int) $_GET['_category_id'];
Line 310: WHERE {$joiner_ref_col} = item.id AND cat_id = ?
Line 312: $params[] = $cat_id;
Line 332: // If a mode is set and valid, save in the session
Line 339: // If no valid mode set, use a default
Line 462: $q = "SELECT category.id, category.name
Line 477: * @param int $record_id The id of the record that was inserted or updated.
Line 483: protected function _importPostRecord($record_id, $new_data, $existing_record, $type, $raw_data)
Line 485: if (! parent::_importPostRecord ($record_id, $new_data, $existing_record, $type, $raw_data)) return false;
Line 488: foreach ($_POST['categories'] as $cat_id) {
Line 489: Category::insertInto($this->table_name, $record_id, $cat_id);
Line 523: $q = "SELECT category.id, category.name
Line 529: if (!empty($_GET['category_id'])) {
Line 530: $data['categories'][] = (int) $_GET['category_id'];
Line 538: $view->id = 0;
Line 564: * @param int $id The id of the record to get the edit form of
Line 566: public function _getEditForm($id)
Line 568: $id = (int) $id;
Line 573: $q = "SELECT * FROM ~{$this->table_name} WHERE id = ?";
Line 575: $item = Pdb::q($q, [$id], 'row');
Line 578: return new AdminError("Invalid id specified - {$single} does not exist");
Line 587: $q = "SELECT category.id, category.name
Line 594: $q = "SELECT cat_id
Line 597: $data['categories'] = Pdb::q($q, [$id], 'col');
Line 607: $default_link = Inflector::singular($this->table_name) . '_id';
Line 608: $data = array_merge($data, JsonForm::loadMultiEditData($conf, $default_link, $id, []));
Line 609: $data = array_merge($data, JsonForm::loadAutofillListData($conf, $this->table_name, $id, []));
Line 629: $view->id = $id;
Line 635: $this->_editPreRender($view, $id);
Line 639: 'title' => $title . ' <strong>' . Enc::html($this->_identifier($item)) . '</strong>',
Line 647: * @param int $id The id of the record to get the data from
Line 649: public function _getDuplicateForm($id)
Line 651: $id = (int) $id;
Line 652: if ($id <= 0) throw new InvalidArgumentException('$id must be greater than 0');
Line 655: $q = "SELECT * FROM ~{$this->table_name} WHERE id = ?";
Line 656: $data = $item = Pdb::q($q, [$id], 'row');
Line 663: $q = "SELECT category.id, category.name
Line 690: $q = "SELECT cat_id
Line 692: WHERE {$this->controller_name}_id = ?";
Line 693: $data['categories'] = Pdb::q($q, [$id], 'col');
Line 703: $default_link = Inflector::singular($this->table_name) . '_id';
Line 704: $data = array_merge($data, JsonForm::loadMultiEditData($conf, $default_link, $id, []));
Line 705: $data = array_merge($data, JsonForm::loadAutofillListData($conf, $this->table_name, $id, []));
Line 712: $view->id = $id;
Line 718: $this->_duplicatePreRender($view, $id);
Line 722: 'title' => $title . ' <strong>' . Enc::html($this->_identifier($item)) . '</strong>',
Line 731: * This method should not be overridden unless absolutely necessary.
Line 733: * @param int $item_id The record to delete
Line 737: public function _deleteSave($item_id)
Line 739: $item_id = (int) $item_id;
Line 741: if (!$this->_isDeleteSaved($item_id)) return false;
Line 748: $this->deleteRecord($this->table_name, $item_id);
Line 754: Pdb::delete($cat_table, [$record_col => $item_id]);
Line 765: * so that the records for the specified item match the category ids provided.
Line 767: * @param array $categories A list of category-ids which the specified item should be associated with
Line 768: * @param int $id The id of the item to set the categories for
Line 774: protected function updateCategories($item_id, $categories)
Line 776: $item_id = (int) $item_id;
Line 780: $item_column = $this->controller_name . '_id';
Line 783: $q = "SELECT cat_id FROM ~{$table_name} WHERE {$item_column} = ?";
Line 784: $res = Pdb::q($q, [$item_id], 'arr');
Line 789: $idx = array_search($row['cat_id'], $categories);
Line 790: if ($idx === false) {
Line 791: $delete[] = $row['cat_id'];
Line 793: unset ($categories[$idx]);
Line 799: foreach ($categories as $cat_id) {
Line 800: $cat_id = (int) $cat_id;
Line 803: $update_fields[$item_column] = $item_id;
Line 804: $update_fields['cat_id'] = $cat_id;
Line 808: $this->logAddCategory(Inflector::plural($this->controller_name), $item_id, $cat_id);
Line 813: foreach ($delete as $cat_id) {
Line 814: $cat_id = (int) $cat_id;
Line 815: $q = "DELETE FROM ~{$table_name} WHERE {$item_column} = ? AND cat_id = ?";
Line 816: Pdb::q($q, [$item_id, $cat_id], 'count');
Line 818: $this->logDeleteCategory(Inflector::plural($this->controller_name), $item_id, $cat_id);
Line 835: if (empty($_GET['ids'])) {
Line 846: $view->ids = $_GET['ids'];
Line 850: $q = "SELECT category.id, category.name
Line 857: $where = Pdb::buildClause([['item.id', 'IN', $_GET['ids']]], $params);
Line 858: $q = $this->_getContentsQuery($where, 'item.id', $params);
Line 883: if (empty($_POST['ids'])) {
Line 897: foreach ($_POST['ids'] as $item_id) {
Line 898: $res = $this->updateCategories($item_id, $_POST['categories']);
Line 907: foreach ($_POST['ids'] as $item_id) {
Line 908: foreach ($_POST['categories'] as $cat_id) {
Line 909: Category::insertInto($this->table_name, $item_id, $cat_id);
Line 917: $this->_invalidateCaches('multi_categorise');

/sprout/Controllers/Admin/ListAdminController.php   Highlighted file source

Line 32: * id
Line 53: $q = "SELECT id, name FROM ~{$this->table_name} ORDER BY record_order";
Line 61: $view->record_id = (int) Admin::getRecordId();
Line 89: * @param int $item_id The record to delete.
Line 92: final public function _deleteSave($item_id)
Line 94: $item_id = (int) $item_id;
Line 96: if (!$this->_isDeleteSaved($item_id)) return false;
Line 98: $this->deleteRecord($this->table_name, $item_id);
Line 111: $q = "SELECT id, name
Line 141: foreach ($_POST['items'] as $id) {
Line 142: $id = (int) $id;
Line 146: WHERE id = ?";
Line 147: Pdb::q($q, [$record_order, $id], 'count');
Line 152: $this->_invalidateCaches('reorder');
Line 163: * @param int $item_id Record-id to update
Line 165: protected function fixRecordOrder($item_id)
Line 169: WHERE id = ?";
Line 171: $order = Pdb::q($q, [$item_id], 'val');
Line 188: WHERE id = ?";
Line 189: Pdb::q($q, [$order, $item_id], 'count');

/sprout/Controllers/Admin/ManagedAdminController.php   Highlighted file source

Line 17: use InvalidArgumentException;
Line 39: use Sprout\Helpers\RefineWidgetSelect;
Line 40: use Sprout\Helpers\RefineWidgetTextbox;
Line 44: use Sprout\Helpers\Validator;
Line 52: * id
Line 69: * The friendly name used in the sidebar navigation. Defaults to matching the friendly name.
Line 136: * Typically, we don't want to import the ID, and just let autoinc do it's thing
Line 138: protected $import_id_column = false;
Line 141: * If a client is providing CSVs which don't have headings
Line 142: * You'll need to provide them in this array
Line 157: * Defines the widgets for the refine bar
Line 172: * Should a UI for editing the "subsite_id" field on a record be shown?
Line 173: * If enabled by extending classes, then the table should contain a 'subsite_id' INT UNSIGNED column
Line 202: $this->refine_bar->addWidget(new RefineWidgetSelect('_date_modified', 'Date modified', Constants::$recent_dates));
Line 203: $this->refine_bar->addWidget(new RefineWidgetSelect('_date_added', 'Date added', Constants::$recent_dates));
Line 204: $this->refine_bar->addWidget(new RefineWidgetTextbox('_all_tag', 'All the tags'));
Line 205: $this->refine_bar->addWidget(new RefineWidgetTextbox('_any_tag', 'Any of the tags'));
Line 216: * Initialises the refine bar if it isn't already set, with a search widget for the 'name' field if it exists
Line 217: * Most controllers which need a custom refine bar should call this before adding their own search widgets
Line 218: * @return void The new {@see RefineBar} is set as $this->refine_bar
Line 228: $this->refine_bar->addWidget(new RefineWidgetTextbox('name', 'Name'));
Line 237: * @return void
Line 290: * If true, then a UI for editing the "subsite_id" for a record should be shown
Line 318: ORDER BY item.id";
Line 520: foreach ($headings as $idx => $h) {
Line 521: $csv_heading = trim($headings[$idx]);
Line 574: $_SESSION['admin']['field_values'] = Validator::trim($_POST);
Line 589: $valid = new Validator($_POST);
Line 590: $valid->required(['duplicates']);
Line 593: $valid->required(['match_field']);
Line 601: $_POST['columns']['id'] = 'id';
Line 620: if ($valid->hasErrors()) {
Line 621: $_SESSION['admin']['field_errors'] = $valid->getFieldErrors();
Line 622: $valid->createNotifications();
Line 648: Pdb::validateIdentifier($match_db);
Line 651: WHERE {$match_db} = ? ORDER BY id";
Line 680: // Kill off the id column
Line 681: if (! $this->import_id_column) {
Line 682: unset ($field_values['id']);
Line 692: $record_id = Pdb::insert($this->table_name, $field_values);
Line 707: Pdb::update($this->table_name, $field_values, ['id' => $existing_record['id']]);
Line 708: $record_id = $existing_record['id'];
Line 721: $record_id = Pdb::insert($this->table_name, $field_values);
Line 726: $res = $this->_importPostRecord($record_id, $new_data, $existing_record, $type, $line);
Line 744: * @param string $csv_heading The exact heading provided in the CSV file.
Line 782: * @param int $record_id The id of the record that was inserted or updated.
Line 789: protected function _importPostRecord ($record_id, $new_data, $existing_record, $type, $raw_data) { return true; }
Line 801: * Return the WHERE clause to use for a given key which is provided by the RefineBar
Line 826: $valid_intervals = [
Line 848: if (!in_array($interval, $valid_intervals)) {
Line 849: throw new InvalidArgumentException('Invalid interval');
Line 865: return "(SELECT COUNT(id) FROM sprout_tags WHERE record_table = ? AND record_id = item.id AND name IN ({$tagwhere})) = " . count($tags);
Line 870: return "(SELECT COUNT(id) FROM sprout_tags WHERE record_table = ? AND record_id = item.id AND name IN ({$tagwhere})) >= 1";
Line 926: ON rec_perm.controller = ? AND item.id = rec_perm.item_id";
Line 964: Pdb::validateIdentifier($_GET['order']);
Line 990: // If a mode is set and valid, save in the session
Line 997: // If no valid mode set, use a default
Line 1166: } else if ($icon === "grid") {
Line 1170: echo ' icon-', $icon, '" title="', Enc::html($label), '"><span class="-vis-hidden">' . Enc::html($label) . "</span>";
Line 1213: $view->id = 0;
Line 1237: * These may be false if the UI provides its own save mechanism (e.g. multi-add)
Line 1260: * Return the fields to show in the sidebar when adding or editing a record.
Line 1294: 'name' => 'subsite_id',
Line 1323: protected function _preSave($id, &$data)
Line 1325: if ($id == 0) {
Line 1334: * @param int $item_id The new record id should be returned in this variable
Line 1337: public function _addSave(&$item_id)
Line 1343: return $this->saveJsonData($conf, $item_id);
Line 1348: * Fetch the record with a given id
Line 1350: * @param int $id Record to fetch
Line 1353: protected function _getRecord($id)
Line 1355: return Pdb::get($this->table_name, $id);
Line 1362: * @param int $id The id of the record to get the edit form of
Line 1365: public function _getEditForm($id)
Line 1367: $id = (int) $id;
Line 1368: if ($id <= 0) throw new InvalidArgumentException('$id must be greater than 0');
Line 1372: $item = $this->_getRecord($id);
Line 1376: return new AdminError("Invalid id specified - {$single} does not exist");
Line 1386: $default_link = Inflector::singular($this->table_name) . '_id';
Line 1387: $data = array_merge($data, JsonForm::loadMultiEditData($conf, $default_link, $id, []));
Line 1388: $data = array_merge($data, JsonForm::loadAutofillListData($conf, $this->table_name, $id, []));
Line 1408: $view->id = $id;
Line 1412: $this->_editPreRender($view, $id);
Line 1416: 'title' => $title . ' <strong>' . Enc::html($this->_identifier($item)) . '</strong>',
Line 1424: * These may be false if the UI provides its own save mechanism
Line 1428: public function _isEditSaved($item_id)
Line 1440: public function _getCustomEditSaveHTML($item_id)
Line 1451: * url => URL to link to, e.g. "admin/delete/thing/$item_id"
Line 1456: public function _getEditSubActions($item_id)
Line 1460: if ($this->_isDeleteSaved($item_id)) {
Line 1462: 'url' => 'admin/delete/' . $this->controller_name . '/' . $item_id,
Line 1475: * @param int $item_id Record which is being editied
Line 1479: public function _getEditLiveUrl($item_id)
Line 1491: protected function _editPreRender($view, $item_id) {}
Line 1497: * @param int $item_id The ID of the record to save the data into
Line 1500: public function _editSave($item_id)
Line 1502: $item_id = (int) $item_id;
Line 1503: if ($item_id <= 0) throw new InvalidArgumentException('$item_id must be greater than 0');
Line 1508: return $this->saveJsonData($conf, $item_id);
Line 1518: public function _getCustomDuplicateSaveHTML($item_id)
Line 1530: public function _getDuplicateSubActions($item_id)
Line 1539: * @param int $id The id of the record to get the original data from
Line 1541: public function _getDuplicateForm($id)
Line 1543: $id = (int) $id;
Line 1544: if ($id <= 0) throw new InvalidArgumentException('$id must be greater than 0');
Line 1547: $data = $item = $this->_getRecord($id);
Line 1574: $default_link = Inflector::singular($this->table_name) . '_id';
Line 1575: $data = array_merge($data, JsonForm::loadMultiEditData($conf, $default_link, $id, []));
Line 1576: $data = array_merge($data, JsonForm::loadAutofillListData($conf, $this->table_name, $id, []));
Line 1583: $view->id = $id;
Line 1588: $this->_duplicatePreRender($view, $id);
Line 1592: 'title' => $title . ' <strong>' . Enc::html($this->_identifier($item)) . '</strong>',
Line 1604: protected function _duplicatePreRender($view, $item_id)
Line 1606: $this->_editPreRender($view, $item_id);
Line 1613: * @param int $id The record to save
Line 1616: public function _duplicateSave($id)
Line 1618: return $this->_editSave($id);
Line 1625: * @param int $id The record to show the delete form for
Line 1628: public function _getDeleteForm($id)
Line 1630: $id = (int) $id;
Line 1639: $view->id = $id;
Line 1643: $view->item = $this->_getRecord($id);
Line 1647: 'content' => "Invalid id specified - {$this->controller_name} does not exist",
Line 1652: 'title' => 'Deleting ' . Enc::html(Inflector::singular($this->friendly_name)) . ' <strong>' . Enc::html($this->_identifier($view->item)) . '</strong>',
Line 1660: * This method may be overridden if ignoring the $main_delete property is desired
Line 1661: * @param int $item_id
Line 1664: public function _isDeleteSaved($item_id)
Line 1676: public function _getDeleteSubActions($item_id)
Line 1681: 'url' => 'admin/edit/' . $this->controller_name . '/' . $item_id,
Line 1691: * @param int $item_id The record to delete
Line 1692: * @return void
Line 1695: public function _deletePreSave($item_id)
Line 1702: * @param int $item_id The record to delete
Line 1703: * @return void
Line 1705: public function _deletePostSave($item_id)
Line 1712: * @param int $item_id The record to delete
Line 1715: public function _deleteSave($item_id)
Line 1717: $item_id = (int) $item_id;
Line 1719: if (!$this->_isDeleteSaved($item_id)) return false;
Line 1721: $this->deleteRecord($this->table_name, $item_id);
Line 1732: * @param int $item_id The item which was affected. Bulk actions (e.g. reorders) will have this set to NULL.
Line 1734: public function _invalidateCaches($action, $item_id = null) {}
Line 1770: * Creates the identifier used in the heading, and for reordering.
Line 1774: public function _identifier(array $item)
Line 1777: if (isset($item['id'])) return "#{$item['id']}";
Line 1782: // This may even be a really bad idea, I haven't decided yet
Line 1783: /* Optional: _extra_<command>($id) */
Line 1789: public function _extraMultiDelete()
Line 1795: if (empty($_GET['ids'])) {
Line 1803: $view->ids = $_GET['ids'];
Line 1811: public function postMultiDelete()
Line 1820: if (empty($_POST['ids'])) {
Line 1827: foreach ($_POST['ids'] as $item_id) {
Line 1829: $res = $this->_deleteSave($item_id);
Line 1841: $this->_invalidateCaches('multi_delete');
Line 1865: if (empty($_POST['ids'])) {
Line 1875: foreach ($_POST['ids'] as $item_id) {
Line 1876: Tags::update($this->table_name, $item_id, $new_tags, false);
Line 1879: $this->_invalidateCaches('multi_edit');
Line 1889: * @return void Echos JSON directly
Line 1891: * @throws InvalidArgumentException
Line 1899: if (!empty($_GET['id'])) {
Line 1900: $q = "SELECT name AS label FROM ~{$this->table_name} WHERE id = ?";
Line 1901: $records = Pdb::query($q, [$_GET['id']], 'arr');
Line 1905: $q = "SELECT id, name AS value FROM ~{$this->table_name} WHERE name LIKE CONCAT('%', ?, '%')";
Line 1915: * @return void Echos JSON directly
Line 1917: * @throws InvalidArgumentException
Line 1925: if (!empty($_GET['ids'])) {
Line 1929: $conditions[] = ['id', 'IN', explode(',', $_GET['ids'])];
Line 1933: $q = "SELECT id, name AS label FROM ~{$this->table_name} WHERE {$where}";
Line 1938: $q = "SELECT id, name AS value FROM ~{$this->table_name} WHERE name LIKE CONCAT('%', ?, '%')";

/sprout/Controllers/Admin/MySettingsAdminController.php   Highlighted file source

Line 26: use Sprout\Helpers\Validator;
Line 77: * @return void Redirects
Line 82: $_SESSION['admin_my_settings']['field_values'] = Validator::trim($_POST);
Line 84: $valid = new Validator($_POST);
Line 85: $valid->required(['name', 'email']);
Line 86: $valid->check('name', 'Validity::length', 1, 200);
Line 87: $valid->check('email', 'Validity::length', 1, 200);
Line 88: $valid->check('email', 'Validity::email');
Line 89: $valid->multipleCheck(['password1', 'password2'], 'Validity::allMatch');
Line 93: $result = AdminAuth::checkPassword($_POST['old_password'], AdminAuth::getId());
Line 95: $valid->addFieldError('old_password', 'Old password is incorrect');
Line 101: $valid->addFieldError('password1', 'Not complex enough');
Line 102: $valid->addFieldError('password2', 'Not complex enough');
Line 110: if ($valid->hasErrors()) {
Line 111: $_SESSION['admin_my_settings']['field_errors'] = $valid->getFieldErrors();
Line 121: Pdb::update('operators', $data, ['id' => AdminAuth::getId()]);
Line 124: AdminAuth::changePassword($_POST['password1'], AdminAuth::getId());
Line 140: $q = "SELECT tfa_method, username FROM ~operators WHERE id = ?";
Line 141: $operator = Pdb::query($q, [AdminAuth::getLocalId()], 'row');
Line 190: Pdb::update('operators', $data, ['id' => AdminAuth::getLocalId()]);
Line 206: Pdb::update('operators', $data, ['id' => AdminAuth::getLocalId()]);

/sprout/Controllers/Admin/NoRecordsAdminController.php   Highlighted file source

Line 18: * Provides a base class for controllers which don't manage records, but are just a set of tools
Line 31: public function _getEditForm($item_id) { return ''; }
Line 32: public function _getDeleteForm($item_id) { return ''; }
Line 34: public function _addSave(&$item_id) { return false; }
Line 35: public function _editSave($item_id) { return false; }
Line 36: public function _deleteSave($item_id) { return false; }

/sprout/Controllers/Admin/OperatorAdminController.php   Highlighted file source

Line 27: use Sprout\Helpers\Validator;
Line 67: $this->main_where[] = "(SELECT 1 FROM ~operators_cat_join WHERE operator_id = item.id AND cat_id IN ({$cats}) LIMIT 1) = 1";
Line 130: public function _getEditForm($item_id)
Line 132: if (!AdminPerms::canEditOperator($item_id) and $item_id != AdminAuth::getId()) {
Line 136: return parent::_getEditForm($item_id);
Line 143: public function _getDeleteForm($item_id)
Line 145: if (!AdminPerms::canEditOperator($item_id)) {
Line 149: if ($item_id == AdminAuth::getLocalId()) {
Line 153: return parent::_getDeleteForm($item_id);
Line 170: * Saves the provided POST data into a new record in the database
Line 172: * @param int $item_id After saving, the new record id will be returned in this parameter
Line 175: public function _addSave(&$item_id)
Line 179: $_SESSION['admin']['field_values'] = Validator::trim($_POST);
Line 182: $valid = new Validator($_POST);
Line 183: $valid->required(['name', 'email', 'username', 'password1', 'password2']);
Line 184: $valid->check('name', 'Validity::length', 0, 200);
Line 185: $valid->check('email', 'Validity::email');
Line 186: $valid->check('email', 'Validity::length', 0, 200);
Line 187: $valid->check('username', 'Validity::length', 0, 50);
Line 188: $valid->check('username', 'Validity::uniqueValue', 'operators', 'username', 0, 'An operator already exists with that username');
Line 189: $valid->check('username', 'Validity::regex', '/^[a-zA-Z0-9]+$/');
Line 190: $valid->check('password1', 'Validity::length', 8, self::MAX_PASSWORD_LENGTH);
Line 191: $valid->check('password2', 'Validity::length', 8, self::MAX_PASSWORD_LENGTH);
Line 192: $valid->multipleCheck(['password1', 'password2'], 'Validity::allMatch');
Line 194: if ($valid->hasErrors()) {
Line 195: $_SESSION['admin']['field_errors'] = $valid->getFieldErrors();
Line 220: foreach ($_POST['categories'] as $cat_id) {
Line 221: if (!$this->manage_cats[$cat_id]) {
Line 222: Notification::error('You do not have access to manage category id ' . $cat_id);
Line 243: $item_id = Pdb::insert('operators', $update_fields);
Line 245: $this->logAdd('operators', $item_id);
Line 247: AdminAuth::changePassword($_POST['password1'], $item_id);
Line 250: $this->updateCategories($item_id, $_POST['categories']);
Line 273: protected function _editPreRender($view, $item_id)
Line 275: parent::_editPreRender($view, $item_id);
Line 277: if (AdminAuth::hasDatabaseRecord() and $item_id == AdminAuth::getId()) {
Line 283: foreach ($view->data['categories'] as $cat_id) {
Line 284: if (!$this->manage_cats[$cat_id]) {
Line 285: Notification::error('This operator is in a category you do not have permission to manage - category id ' . $cat_id);
Line 293: * Saves the provided POST data the specified record
Line 295: * @param int $item_id The record to update
Line 298: public function _editSave($item_id)
Line 300: $item_id = (int) $item_id;
Line 302: if (AdminAuth::hasDatabaseRecord() and $item_id == AdminAuth::getId()) {
Line 306: $can_access = AdminPerms::canEditOperator($item_id);
Line 309: $_SESSION['admin']['field_values'] = Validator::trim($_POST);
Line 312: $valid = new Validator($_POST);
Line 313: $valid->required(['username', 'name', 'email']);
Line 314: $valid->check('username', 'Validity::length', 0, 50);
Line 315: $valid->check('username', 'Validity::uniqueValue', 'operators', 'username', $item_id, 'An operator already exists with that username');
Line 316: $valid->check('username', 'Validity::regex', '/^[a-zA-Z0-9]+$/');
Line 317: $valid->check('name', 'Validity::length', 0, 200);
Line 318: $valid->check('email', 'Validity::length', 0, 200);
Line 319: $valid->check('password1', 'Validity::length', 8, self::MAX_PASSWORD_LENGTH);
Line 320: $valid->check('password2', 'Validity::length', 8, self::MAX_PASSWORD_LENGTH);
Line 321: $valid->multipleCheck(['password1', 'password2'], 'Validity::allMatch');
Line 323: if ($valid->hasErrors()) {
Line 324: $_SESSION['admin']['field_errors'] = $valid->getFieldErrors();
Line 325: $valid->createNotifications();
Line 350: foreach ($_POST['categories'] as $cat_id) {
Line 351: if (!$this->manage_cats[$cat_id]) {
Line 352: Notification::error('You do not have access to manage category id ' . $cat_id);
Line 370: $logdata = $this->loadRecord('operators', $item_id);
Line 372: Pdb::update('operators', $update_fields, ['id' => $item_id]);
Line 374: $this->logEdit('operators', $item_id, $logdata);
Line 377: AdminAuth::changePassword($_POST['password1'], $item_id);
Line 378: $this->logAction('operators', $item_id, 'Change password');
Line 382: $this->updateCategories($item_id, $_POST['categories']);
Line 393: * @param int $item_id The record to delete
Line 394: * @return void
Line 397: public function _deletePreSave($item_id)
Line 399: $item_id = (int) $item_id;
Line 401: if (!AdminPerms::canEditOperator($item_id)) {
Line 405: if ($item_id == AdminAuth::getLocalId()) {

/sprout/Controllers/Admin/OperatorCategoryAdminController.php   Highlighted file source

Line 16: use Sprout\Exceptions\ValidationException;
Line 22: use Sprout\Helpers\Validator;
Line 23: use Sprout\Helpers\Validity;
Line 46: public function _getEditForm($item_id)
Line 49: return parent::_getEditForm($item_id);
Line 52: public function _getDeleteForm($item_id)
Line 55: return parent::_getDeleteForm($item_id);
Line 59: public function _editPreRender($view, $item_id)
Line 61: parent::_editPreRender($view, $item_id);
Line 81: $view->data['multiedit_permissions'] = MultiEdit::load('operatorcategory_permissions', ['operatorcategory_id' => $item_id], 'controller');
Line 88: $q = "SELECT subsite_id
Line 90: WHERE ~operatorcategory_subsites.operatorcategory_id = ?";
Line 91: $subs_ops = Pdb::q($q, [$item_id], 'arr');
Line 96: $subsites_permitted[] = $sub_op['subsite_id'];
Line 102: $q = "SELECT manage_category_id
Line 104: WHERE operatorcategory_id = ?";
Line 105: $view->data['manage_categories'] = Pdb::q($q, [$item_id], 'col');
Line 110: * Saves the provided POST data the specified record
Line 112: * @param int $item_id The record to update
Line 115: public function _editSave($item_id)
Line 117: $item_id = (int) $item_id;
Line 122: $_SESSION['admin']['field_values'] = Validator::trim($_POST);
Line 127: // Validate
Line 128: $valid = new Validator($_POST);
Line 129: $valid->setFieldLabel('allowed_ips', 'Restrict access to specific IPs');
Line 130: $valid->required(['name']);
Line 131: $valid->check('name', 'Validity::length', 0, 200);
Line 132: $valid->check('allowed_ips', 'Validity::length', 0, 200);
Line 136: Validity::ipv4AddrOrCidr($ip);
Line 137: } catch (ValidationException $ex) {
Line 139: $valid->addFieldError('allowed_ips', $err);
Line 143: if ($valid->hasErrors()) {
Line 144: $_SESSION['admin']['field_errors'] = $valid->getFieldErrors();
Line 145: $valid->createNotifications();
Line 163: Pdb::update($this->table_name, $update_fields, ['id' => $item_id]);
Line 174: $update_fields['id'] = (int) $data['id'];
Line 175: $update_fields['operatorcategory_id'] = $item_id;
Line 191: $this->replaceSet('operatorcategory_permissions', $new_set, ['operatorcategory_id' => $item_id]);
Line 198: foreach ($_POST['subsites_permitted'] as $idx => $subsite_id) {
Line 200: $update_fields['subsite_id'] = (int) $subsite_id;
Line 201: $update_fields['operatorcategory_id'] = $item_id;
Line 207: $this->replaceSet('operatorcategory_subsites', $new_set, ['operatorcategory_id' => $item_id]);
Line 214: foreach ($_POST['manage_categories'] as $idx => $category_id) {
Line 216: $update_fields['manage_category_id'] = (int) $category_id;
Line 217: $update_fields['operatorcategory_id'] = $item_id;
Line 223: $this->replaceSet('operatorcategory_manage_categories', $new_set, ['operatorcategory_id' => $item_id]);

/sprout/Controllers/Admin/PageAdminController.php   Highlighted file source

Line 24: use Sprout\Exceptions\ValidationException;
Line 56: use Sprout\Helpers\RefineWidgetTextbox;
Line 68: use Sprout\Helpers\Validator;
Line 70: use Sprout\Helpers\WidgetArea;
Line 91: $this->refine_bar->addWidget(new RefineWidgetTextbox('name', 'Name'));
Line 94: $this->refine_bar->addWidget(new RefineWidgetTextbox('_keyword', 'Keyword search'));
Line 95: $this->refine_bar->addWidget(new RefineWidgetTextbox('_phrase', 'Exact phrase'));
Line 107: * Return the WHERE clause to use for a given key which is provided by the RefineBar
Line 124: return "item.id IN (SELECT record_id FROM ~page_keywords AS pk
Line 125: INNER JOIN ~search_keywords AS k ON pk.keyword_id = k.id WHERE k.name LIKE ?)";
Line 130: return "item.id IN (SELECT page_id FROM ~page_revisions AS rev
Line 143: * @param int $item_id The item which was affected. Bulk actions (e.g. reorders) will have this set to NULL.
Line 145: public function _invalidateCaches($action, $item_id = null)
Line 161: $q = "SELECT id FROM ~homepages WHERE subsite_id = ?";
Line 164: $view->home_page_id = Pdb::q($q, [$_SESSION['admin']['active_subsite']], 'val');
Line 168: $view->record_id = Admin::getRecordId();
Line 219: 'parent_id' => (int) @$_GET['parent_id'],
Line 286: * Saves the provided POST data into a new page in the database
Line 288: * @param int $page_id After saving, the new record id will be returned in this parameter
Line 291: public function _addSave(&$page_id)
Line 301: $valid = new Validator($_POST);
Line 302: $valid->required(['name']);
Line 303: $valid->check('name', 'Validity::length', 1, 200);
Line 304: $valid->check('meta_description', 'Validity::length', 0, 200);
Line 309: 'subsite_id' => $_SESSION['admin']['active_subsite'],
Line 310: 'parent_id' => (int)@$_POST['parent_id']
Line 313: } catch (ValidationException $exp) {
Line 314: $valid->addFieldError('name', 'this will result in a conflicting URL, please try another.');
Line 318: // Validate fields specific to tool pages
Line 319: $valid->required(['controller_entrance']);
Line 320: $valid->check('controller_entrance', 'Validity::length', 1, 200);
Line 321: if (!self::checkControllerEntrance($_POST['controller_entrance'], $page_id)) {
Line 322: $valid->addFieldError('controller_entrance', 'Invalid value');
Line 325: // Tell core AdminController the right URL to redirect to upon validation error
Line 329: if ($valid->hasErrors()) {
Line 331: $_SESSION['admin']['field_errors'] = $valid->getFieldErrors();
Line 332: $valid->createNotifications();
Line 350: $update_fields['parent_id'] = $_POST['parent_id'];
Line 354: $update_fields['subsite_id'] = $_SESSION['admin']['active_subsite'];
Line 375: $page_id = Pdb::insert('pages', $update_fields);
Line 377: $this->fixRecordOrder($page_id);
Line 380: $res = $this->addHistoryItem($page_id, 'Created empty new page');
Line 385: $update_fields['page_id'] = $page_id;
Line 407: foreach ($_POST['admin_permissions'] as $id) {
Line 408: $id = (int) $id;
Line 409: if ($id == 0) continue;
Line 413: $update_fields['item_id'] = $page_id;
Line 414: $update_fields['category_id'] = $id;
Line 423: foreach ($_POST['user_permissions'] as $id) {
Line 424: $id = (int) $id;
Line 425: if ($id == 0) continue;
Line 429: $update_fields['item_id'] = $page_id;
Line 430: $update_fields['category_id'] = $id;
Line 444: return 'admin/edit/' . $this->controller_name . '/' . $page_id . '?suppress=true';
Line 479: // Validate upload
Line 481: $error = 'No file provided';
Line 483: $error = 'No file provided';
Line 484: } else if (! Upload::valid($_FILES['import'])) {
Line 523: // Check the result is valid XML
Line 606: echo '<p><i>Invalid import type</i></p>';
Line 672: // Basic validation
Line 682: $cat_id = Category::lookupOrCreate('files', 'Imported document images');
Line 699: $file_id = Pdb::insert('files', $update_fields);
Line 700: $image_filename = $file_id . '_' . $image_filename;
Line 702: // Set filename to contain file id
Line 705: Pdb::update('files', $update_fields, ['id' => $file_id]);
Line 708: Category::insertInto('files', $file_id, $cat_id);
Line 763: throw new Exception("Invalid import type '{$_POST['import_type']}'.");
Line 770: $result = $this->createPageTreenode($child, (int)$_POST['parent_id'], $images, $headings, $operator);
Line 784: private function createPageTreenode($node, $parent_id, $images, $headings, $operator)
Line 796: $update_fields['parent_id'] = $parent_id;
Line 797: $update_fields['subsite_id'] = $_SESSION['admin']['active_subsite'];
Line 801: $page_id = Pdb::insert('pages', $update_fields);
Line 803: $this->fixRecordOrder($page_id);
Line 807: $update_fields['page_id'] = $page_id;
Line 814: $rev_id = Pdb::insert('page_revisions', $update_fields);
Line 821: $update_fields['page_revision_id'] = $rev_id;
Line 822: $update_fields['area_id'] = 1;
Line 827: Pdb::insert('page_widgets', $update_fields);
Line 830: $res = $this->addHistoryItem($page_id, "Imported page from uploaded file");
Line 834: $res = $this->reindexItem($page_id, $node['name'], $html);
Line 840: $count += $this->createPageTreenode($child, $page_id, $images, $headings, $operator);
Line 847: public function _getCustomEditSaveHTML($item_id)
Line 851: $user_id = AdminAuth::getId();
Line 852: $q = "SELECT operators.id, operators.name
Line 854: INNER JOIN ~operators_cat_join AS joiner ON joiner.operator_id = operators.id
Line 855: AND operators.id != ?
Line 856: INNER JOIN ~operators_cat_list AS cat ON joiner.cat_id = cat.id
Line 859: $approval_admins = Pdb::q($q, [$user_id], 'map');
Line 862: $view->id = (int) $item_id;
Line 863: $view->preview_url = Subsites::getAbsRootAdmin() . 'admin/call/page/preview/' . $item_id;
Line 865: $view->allow_delete = $this->_isDeleteSaved($item_id);
Line 876: * @param int $item_id Record which is being editied
Line 880: public function _getEditLiveUrl($item_id)
Line 882: return Page::url($item_id);
Line 889: * @param int $id The record to show the edit form for
Line 892: public function _getEditForm($id)
Line 894: $id = (int) $id;
Line 897: $q = "SELECT * FROM ~subsites WHERE id = ?";
Line 901: return new AdminError("Invalid id specified - current subsite does not exist");
Line 905: $q = "SELECT * FROM ~pages WHERE id = ?";
Line 907: $page = Pdb::q($q, [$id], 'row');
Line 909: return new AdminError("Invalid id specified - page does not exist");
Line 918: $res = AdminPerms::checkPermissionsTree('pages', $id);
Line 924: WHERE page_id = ?
Line 926: $revs = Pdb::q($q, [$id], 'arr');
Line 928: return new AdminError("Invalid id specified - page does not have any revisions");
Line 935: $sel_rev = ['id' => 0];
Line 937: if (!empty($_SESSION['admin']['field_values']['rev_id'])) {
Line 939: if ($rev['id'] == $_SESSION['admin']['field_values']['rev_id']) {
Line 947: $rev_id = (int)$_GET['revision'];
Line 949: if ($rev['id'] == $rev_id) {
Line 977: // Type override caused by clicking a sidebar 'change to' option
Line 982: // Remember the edit type for use in sidebar; i.e. _getCustomEditSaveHTML
Line 998: // Load widgets and collate rich text as page text
Line 1000: $widgets = [];
Line 1001: $q = "SELECT area_id, type, settings, conditions, active, heading, template
Line 1002: FROM ~page_widgets
Line 1003: WHERE page_revision_id = ?
Line 1004: ORDER BY area_id, record_order";
Line 1005: $wids = Pdb::q($q, [$sel_rev['id']], 'arr');
Line 1007: foreach ($wids as $widget) {
Line 1008: $widgets[$widget['area_id']][] = $widget;
Line 1010: // Embedded rich text widgets
Line 1011: if ($widget['area_id'] == 1 and $widget['type'] == 'RichText') {
Line 1012: $settings = json_decode($widget['settings'], true);
Line 1029: AdminSeo::addLinks(Page::determineRelatedLinks($id));
Line 1032: $widgets = [];
Line 1035: return new AdminError("Invalid page type");
Line 1039: $admin_permissions = AdminPerms::getAccessableGroups('pages', $id);
Line 1048: $user_permissions = UserPerms::getAccessableGroups('pages', $id);
Line 1068: WHERE page_id = ?
Line 1070: $history = Pdb::q($q, [$id], 'arr');
Line 1093: $attributes = MultiEdit::load('page_attributes', ['page_id' => $id]);
Line 1121: // Richtext width and height
Line 1122: $richtext_width = Kohana::config('sprout.admin_richtext_width');
Line 1124: if (!$richtext_width) $richtext_width = 700;
Line 1136: $view->id = $id;
Line 1141: $view->widgets = $widgets;
Line 1152: $view->richtext_width = $richtext_width;
Line 1156: $view->sel_rev_id = $sel_rev['id'];
Line 1181: * @param int $id The revision to get the text of
Line 1183: public function ajaxGetRev($id)
Line 1185: $id = (int) $id;
Line 1187: $rev = Pdb::get('page_revisions', $id);
Line 1214: $out['changes_made'] = "...... (based on revision {$rev['id']}: '{$changes}')";
Line 1226: public function ajaxGetMenuGroups($parent_page_id)
Line 1229: $parent_page_id = (int) $parent_page_id;
Line 1232: if ($parent_page_id === 0) {
Line 1239: $node = $root->findNodeValue('id', $parent_page_id);
Line 1240: if ($node === null) Json::error('Invalid parent page');
Line 1245: $groups = NavigationGroups::getGroupsAdmin($top_parent['id']);
Line 1248: foreach ($groups as $id => $row) {
Line 1249: $names[$id] = $row['name'];
Line 1257: * Makes the provided html text be in a standard format to ensure the integrity of the change check
Line 1266: * Saves the provided POST data into this page in the database
Line 1268: * @param int $page_id The record to update
Line 1271: public function _editSave($page_id)
Line 1273: $res = AdminPerms::checkPermissionsTree('pages', $page_id);
Line 1276: $page_id = (int) $page_id;
Line 1277: $rev_id = (int) $_POST['rev_id'];
Line 1281: INNER JOIN ~page_revisions AS rev ON page.id = rev.page_id
Line 1282: AND rev.id = ?
Line 1283: WHERE page.id = ?";
Line 1284: $orig_page = Pdb::q($q, [$rev_id, $page_id], 'row');
Line 1294: // Collate POSTed widgets.
Line 1295: $new_widgets = [];
Line 1296: if (@count($_POST['widgets'])) {
Line 1297: foreach ($_POST['widgets'] as $area_name => $widgets) {
Line 1298: $area = WidgetArea::findAreaByName($area_name);
Line 1302: foreach ($widgets as $info) {
Line 1306: if ($_POST['widget_deleted'][$area_name][$index] == '1') {
Line 1310: $settings = @$_POST['widget_settings_' . $index];
Line 1316: if (isset($_POST['widget_active'][$area_name][$index])) {
Line 1317: $active = (int) (bool) $_POST['widget_active'][$area_name][$index];
Line 1321: if (isset($_POST['widget_conds'][$area_name][$index])) {
Line 1322: $conditions = $_POST['widget_conds'][$area_name][$index];
Line 1326: if (isset($_POST['widget_heading'][$area_name][$index])) {
Line 1327: $heading = $_POST['widget_heading'][$area_name][$index];
Line 1331: if (isset($_POST['widget_template'][$area_name][$index])) {
Line 1332: $template = $_POST['widget_template'][$area_name][$index];
Line 1335: $new_widgets[] = [
Line 1336: 'area_id' => $area->getIndex(),
Line 1349: // Compare new widgets with old ones -- if changed, need a new revision
Line 1350: $q = "SELECT area_id, active, type, settings, conditions, heading, template, record_order
Line 1351: FROM ~page_widgets
Line 1352: WHERE page_revision_id = ?
Line 1353: ORDER BY area_id, record_order";
Line 1354: $old_widgets = Pdb::query($q, [$rev_id], 'arr');
Line 1355: if (count($new_widgets) != count($old_widgets)) {
Line 1358: foreach ($old_widgets as $key => $widget) {
Line 1359: if ($widget != @$new_widgets[$key]) {
Line 1368: $q = "SELECT rev.*, page.parent_id
Line 1370: INNER JOIN ~pages AS page ON page.id = rev.page_id
Line 1371: WHERE rev.id = ?";
Line 1372: $orig_rev = Pdb::q($q, [$rev_id], 'row');
Line 1388: foreach($_POST['mediareplace_fr'] as $idx => $replace_from) {
Line 1389: $replace_to = $_POST['mediareplace_to'][$idx];
Line 1398: foreach ($new_widgets as &$widget) {
Line 1399: if ($widget['area_id'] != 1 or $widget['type'] != 'RichText') continue;
Line 1400: $settings = json_decode($widget['settings'], true);
Line 1404: $widget['settings'] = json_encode($settings);
Line 1408: unset($widget);
Line 1420: if ((int) $orig_page['parent_id'] != (int) $_POST['parent_id']) {
Line 1428: // Set up validation rules
Line 1429: $valid = new Validator($_POST);
Line 1430: $valid->setLabels([
Line 1431: 'parent_id' => 'Parent page',
Line 1436: $valid->required(['name', 'slug']);
Line 1437: $valid->check('name', 'Validity::length', 1, 200);
Line 1438: $valid->check('slug', 'Validity::length', 1, 200);
Line 1439: $valid->check('slug', 'Slug::valid');
Line 1442: 'subsite_id' => $_SESSION['admin']['active_subsite'],
Line 1443: 'parent_id' => (int)$_POST['parent_id'],
Line 1444: ['id', '!=', $page_id],
Line 1446: $valid->check('slug', 'Slug::unique', 'pages', $slug_conditions);
Line 1448: $valid->check('meta_keywords', 'Validity::length', 0, 200);
Line 1449: $valid->check('meta_description', 'Validity::length', 0, 200);
Line 1450: $valid->check('alt_browser_title', 'Validity::length', 0, 200);
Line 1451: $valid->check('alt_nav_title', 'Validity::length', 0, 200);
Line 1454: $valid->check('redirect', 'Validity::length', 0, 200);
Line 1457: $valid->check('changes_made', 'Validity::length', 0, 250);
Line 1461: $valid->required(['approval_operator_id']);
Line 1464: $q = "SELECT * FROM ~operators WHERE ID = ?";
Line 1465: $approval_operator = Pdb::query($q, [(int) $_POST['approval_operator_id']], 'row');
Line 1467: $valid->addFieldError('approval_operator_id', 'Invalid value');
Line 1472: $valid->required(['date_launch']);
Line 1476: $valid->required(['controller_entrance', 'controller_argument']);
Line 1477: $valid->check('controller_entrance', 'Validity::length', 1, 200);
Line 1478: if (!self::checkControllerEntrance($_POST['controller_entrance'], $page_id)) {
Line 1479: $valid->addFieldError('controller_entrance', 'Invalid value');
Line 1482: $valid->required(['redirect']);
Line 1483: $valid->check('redirect', function($value) {
Line 1484: if (!Lnk::valid($_POST['redirect'])) {
Line 1485: throw new ValidationException('Invalid redirect target');
Line 1490: if ($orig_page['id'] == $_POST['parent_id']) {
Line 1491: $valid->addFieldError('parent_id', 'A page can\'t be its own parent.');
Line 1496: $new_parent = $root_node->findNodeValue('id', $_POST['parent_id']);
Line 1500: if ($anc['id'] == $page_id) {
Line 1501: $valid->addFieldError('parent_id', 'You can\'t set a descendent of this page as its parent');
Line 1508: // Check validation
Line 1509: if ($valid->hasErrors()) {
Line 1511: $_SESSION['admin']['field_errors'] = $valid->getFieldErrors();
Line 1512: $valid->createNotifications();
Line 1576: $update_fields['parent_id'] = (int) $_POST['parent_id'];
Line 1580: Pdb::update('pages', $update_fields, ['id' => $page_id]);
Line 1582: if ($parent_changed) $this->fixRecordOrder($page_id);
Line 1590: $update_fields['operator_id'] = $operator['id'];
Line 1605: Pdb::update('page_revisions', $update_fields, ['page_id' => $page_id, 'id' => $rev_id]);
Line 1607: $res = $this->addHistoryItem($page_id, "Updated revision {$rev_id}");
Line 1612: $update_fields['page_id'] = $page_id;
Line 1613: $update_fields['approval_operator_id'] = (int) @$_POST['approval_operator_id'];
Line 1616: $rev_id = Pdb::insert('page_revisions', $update_fields);
Line 1618: $res = $this->addHistoryItem($page_id, "Created new revision {$rev_id}");
Line 1624: Page::activateRevision($rev_id);
Line 1627: // Widgets
Line 1628: Pdb::delete('page_widgets', ['page_revision_id' => $rev_id]);
Line 1630: foreach ($new_widgets as $widget) {
Line 1631: $update_fields = $widget;
Line 1632: $update_fields['page_revision_id'] = $rev_id;
Line 1633: Pdb::insert('page_widgets', $update_fields);
Line 1642: Pdb::update('page_revisions', $update_fields, ['page_id' => $page_id, 'id' => $rev_id]);
Line 1668: Pdb::delete('page_admin_permissions', ['item_id' => $page_id]);
Line 1671: foreach ($_POST['admin_permissions'] as $id) {
Line 1672: $id = (int) $id;
Line 1673: if ($id == 0) continue;
Line 1677: $update_fields['item_id'] = $page_id;
Line 1678: $update_fields['category_id'] = $id;
Line 1687: Pdb::delete('page_user_permissions', ['item_id' => $page_id]);
Line 1690: foreach ($_POST['user_permissions'] as $id) {
Line 1691: $id = (int) $id;
Line 1692: if ($id == 0) continue;
Line 1696: $update_fields['item_id'] = $page_id;
Line 1697: $update_fields['category_id'] = $id;
Line 1706: Pdb::delete('page_attributes', ['page_id' => $page_id]);
Line 1709: foreach ($_POST['multiedit_attrs'] as $idx => $data) {
Line 1713: $update_fields['page_id'] = (int) $page_id;
Line 1722: // Do indexing on the page text, which is found in the embedded widgets
Line 1723: $text = Page::getText($page_id, $rev_id, $_SESSION['admin']['active_subsite']);
Line 1732: $view->url = Sprout::absRoot() . "page/view_specific_rev/{$page_id}/{$rev_id}/{$approval_code}";
Line 1748: $view->url = Sprout::absRoot() . "page/view_specific_rev/{$page_id}/{$rev_id}";
Line 1765: $res = $this->reindexItem($page_id, $_POST['name'], $text);
Line 1770: $this->addHistoryItem($page_id, "Changed the page type");
Line 1783: return "admin/edit/page/{$page_id}?revision={$rev_id}";
Line 1844: foreach ($all_groups as $page_id => $groups) {
Line 1845: foreach ($groups as $id => $name) {
Line 1847: $update_data['name'] = @$_POST['groups'][$id]['name'];
Line 1851: $conditions['subsite_id'] = (int)$_SESSION['admin']['active_subsite'];
Line 1852: $conditions['page_id'] = (int)$page_id;
Line 1853: $conditions['id'] = (int)$id;
Line 1860: $update_data['subsite_id'] = (int)$_SESSION['admin']['active_subsite'];
Line 1861: $update_data['page_id'] = (int)$page_id;
Line 1864: $update_data['text'] = $_POST['extras'][$page_id]['text'];
Line 1867: if (empty($_POST['extras'][$page_id]['image'])) {
Line 1868: $_POST['extras'][$page_id]['image'] = null;
Line 1870: $update_data['image'] = $_POST['extras'][$page_id]['image'];
Line 1877: unset($update_data['page_id']);
Line 1878: Pdb::update('menu_extras', $update_data, array('page_id' => $page_id));
Line 1891: private function addHistoryItem($page_id, $changes_made, $editor = null)
Line 1901: $update_fields['page_id'] = $page_id;
Line 1914: * @param int $id The record to show the edit form for
Line 1917: public function _getDeleteForm($id)
Line 1919: $id = (int) $id;
Line 1922: $view->id = $id;
Line 1925: $q = "SELECT * FROM ~pages WHERE id = ?";
Line 1927: $view->page = Pdb::q($q, [$id], 'row');
Line 1929: return new AdminError("Invalid id specified - page does not exist");
Line 1933: $res = AdminPerms::checkPermissionsTree('pages', $id);
Line 1938: $node = $root->findNodeValue('id', $id);
Line 1957: * @param int $item_id The record to delete
Line 1958: * @return void
Line 1961: public function _deletePreSave($item_id)
Line 1963: if (!AdminPerms::checkPermissionsTree('pages', $item_id)) {
Line 1971: * @param int $item_id The record to delete
Line 1972: * @return void
Line 1974: public function _deletePostSave($item_id)
Line 1983: public function _extraLinks($id)
Line 1985: $id = (int) $id;
Line 1987: $res = AdminPerms::checkPermissionsTree('pages', $id);
Line 1991: $view->id = $id;
Line 1997: ON revs.page_id = pages.id AND revs.status = ?
Line 1998: WHERE pages.id = ?";
Line 1999: $view->page = Pdb::q($q, ['live', $id], 'row');
Line 2002: $node = $root->findNodeValue('id', $id);
Line 2006: $q = "SELECT pages.id, pages.name, revs.text
Line 2009: ON revs.page_id = pages.id
Line 2020: $items[] = array('id' => $row['id'], 'name' => $row['name'], 'text' => $matches[1]);
Line 2041: $items[] = array('id' => $match[1], 'url' => $match[1], 'text' => $match[2]);
Line 2075: $q = "SELECT pages.id, pages.name, DATE_FORMAT(pages.date_modified, '%d/%m/%Y') AS date_modified,
Line 2078: WHERE subsite_id = ?
Line 2094: $q = "SELECT pages.id, pages.name, DATE_FORMAT(page_revisions.date_modified, '%d/%m/%Y') AS date_modified,
Line 2097: INNER JOIN ~pages AS pages ON page_revisions.page_id = pages.id
Line 2099: AND subsite_id = ?
Line 2125: private function reindexItem($item_id, $name, $text)
Line 2127: Search::selectIndex('page_keywords', $item_id);
Line 2153: $q = "SELECT pages.id, pages.name, pages.active, widget.settings
Line 2156: ON rev.page_id = pages.id AND rev.status = ?
Line 2157: LEFT JOIN ~page_widgets AS widget ON rev.id = widget.page_revision_id
Line 2158: AND widget.area_id = 1 AND widget.active = 1 AND widget.type = 'RichText'
Line 2159: ORDER BY widget.record_order";
Line 2165: $pages[$row['id']] = ['name' => $row['name'], 'text' => ''];
Line 2169: if (!isset($pages[$row['id']])) {
Line 2170: $pages[$row['id']] = ['name' => $row['name'], 'text' => $settings['text']];
Line 2172: $pages[$row['id']]['text'] .= "\n" . $settings['text'];
Line 2183: foreach ($pages as $id => $page) {
Line 2184: $this->reindexItem($id, $page['name'], $page['text']);
Line 2194: * Validate given controller implements FrontEndEntrance
Line 2197: * @param int $page_id Page record ID
Line 2200: private static function checkControllerEntrance($controller, $page_id)
Line 2202: $page_id = (int) $page_id;
Line 2223: $_GET['record_id'] = (int) $_GET['record_id'];
Line 2228: $top_node = $root->findNodeValue('id', basename($_POST['dir']));
Line 2247: $admin_perms = AdminPerms::checkPermissionsTree('pages', $top_node['id']);
Line 2250: if ($top_node['id'] == $_GET['record_id']) $class .= ' current-edit';
Line 2260: $rel = Enc::html($_POST['dir'] . $child['id']);
Line 2262: $admin_perms = AdminPerms::checkPermissionsTree('pages', $child['id']);
Line 2268: if ($child['id'] == $_GET['record_id']) $class .= ' current-edit';
Line 2284: echo "&#43; <a href=\"SITE/admin/add/page?parent_id={$top_node['id']}\">Add Child</a>";
Line 2286: echo "&#8597; <a href=\"SITE/page/reorder/{$top_node['id']}\" onclick=\"$.facebox({'ajax':this.href}); return false;\">Re-order</a>";
Line 2320: $q = "SELECT id, name
Line 2322: WHERE subsite_id = ? AND parent_id = 0
Line 2334: $view->id = 0;
Line 2348: * @param int $item_id Record-id to update
Line 2350: protected function fixRecordOrder($item_id)
Line 2352: $q = "SELECT record_order, subsite_id, parent_id FROM ~{$this->table_name} WHERE id = ?";
Line 2353: $item = Pdb::q($q, [$item_id], 'row');
Line 2359: WHERE subsite_id = ?
Line 2360: AND parent_id = ?";
Line 2362: $max = Pdb::q($q, [$item['subsite_id'], $item['parent_id']], 'val');
Line 2367: $q = "UPDATE ~{$this->table_name} SET record_order = ? WHERE id = ?";
Line 2368: Pdb::q($q, [$max + 1, $item_id], 'count');
Line 2383: $q = "SELECT id, page_id
Line 2389: Cron::message("Launching revision {$row['id']} on page {$row['page_id']}");
Line 2392: Pdb::update('page_revisions', ['status' => 'live'], ['id' => $row['id']]);
Line 2394: $this->addHistoryItem($row['page_id'], "AutoLaunched revision {$row['id']}", 'n/a');
Line 2397: 'page_id' => $row['page_id'],
Line 2398: ['id', '!=', $row['id']],
Line 2426: $q = "SELECT id
Line 2435: Cron::message("De-activating page {$row['id']}");
Line 2438: Pdb::update('pages', ['active' => 0], ['id' => $row['id']]);
Line 2440: $this->addHistoryItem($row['id'], "Deactivated page {$row['id']}", 'n/a');
Line 2528: Notification::error("Invalid 'send_to' argument");
Line 2533: Notification::error("You didn't enter an email address");
Line 2549: Url::redirect('admin/extra/page/link_checker_info/' . $info['job_id']);
Line 2556: public function _extraLinkCheckerInfo($id)
Line 2558: $id = (int) $id;
Line 2581: $q = "SELECT pages.id, pages.name, revs.date_modified, revs.modified_editor
Line 2583: INNER JOIN ~pages AS pages ON revs.page_id = pages.id
Line 2585: AND pages.subsite_id = ?
Line 2586: GROUP BY pages.id
Line 2621: * @return void
Line 2632: $q = "SELECT page.id, page.subsite_id, page.name,
Line 2634: op.id AS op_id, op.name AS operator, op.email
Line 2637: ON page.id = rev.page_id AND rev.status = 'live' AND rev.type = 'standard'
Line 2639: ON rev.operator_id = op.id
Line 2644: ORDER BY age DESC, page.id";
Line 2659: foreach ($res as $id => $row) {
Line 2660: $url = Page::url($id);
Line 2663: $url = Subsites::getAbsRoot($row['subsite_id']) . $url;
Line 2666: 'id' => $row['id'],
Line 2675: $op = $row['op_id'];
Line 2685: 'id' => $row['id'],
Line 2692: foreach ($op_emails as $id => $details) {
Line 2701: $view->show_op = ($id == 0);
Line 2719: $conds = [['id', 'IN', array_keys($res)]];
Line 2743: public function preview($item_id = 0) {
Line 2744: $item_id = (int) $item_id;
Line 2748: 'page_revisions' => ['id' => $_POST['rev_id']],
Line 2749: 'page_widgets' => 0,
Line 2763: $item_id = Preview::load($this, $tables, $item_id);
Line 2766: Preview::run($ctlr, 'viewById', [$item_id]);
Line 2771: * Return JSON list of custom widget templates as defined by skin config
Line 2775: * @return void Echos HTML directly
Line 2777: public function ajaxListWidgetTemplates()
Line 2779: $templates = Kohana::config('sprout.widget_templates');

/sprout/Controllers/Admin/PerRecordPermissionAdminController.php   Highlighted file source

Line 58: // case for restricting access to individual form submissions
Line 141: $q = "UPDATE ~per_record_controllers SET active = 0 WHERE id = ?";
Line 144: $q = "UPDATE ~per_record_controllers SET active = 1 WHERE id = ?";
Line 150: $q = "SELECT id, name, active
Line 157: Pdb::execute($activate, [$row['id']], 'null');
Line 158: $this->logEdit('per_record_controllers', $row['id'], $row);
Line 162: Pdb::execute($deactivate, [$row['id']], 'null');
Line 163: $this->logEdit('per_record_controllers', $row['id'], $row);
Line 166: $extant[$row['name']] = $row['id'];
Line 174: $id = Pdb::getLastInsertId();
Line 175: $this->logAdd('per_record_controllers', $id);
Line 209: unset($all_cats[AdminAuth::getPrimaryCategoryId()]);
Line 216: $all .= '<div class="fieldset-input"><input type="checkbox" value="1" name="_prm_all_cats" id="_prm_all"';
Line 250: Notification::error('Invalid tab specified');
Line 255: $q = "SELECT id FROM ~{$table}";
Line 260: foreach ($res as $id) {
Line 261: PerRecordPerms::save($ctlr, $id);

/sprout/Controllers/Admin/RedirectAdminController.php   Highlighted file source

Line 20: use Sprout\Helpers\RefineWidgetTextbox;
Line 21: use Sprout\Helpers\Validator;
Line 57: 'Subsite' => [new ColModifierLookupTable('subsites'), 'subsite_id'],
Line 63: $this->refine_bar->addWidget(new RefineWidgetTextbox('path_exact', 'Path exact match'));
Line 64: $this->refine_bar->addWidget(new RefineWidgetTextbox('path_contains', 'Path contains'));
Line 71: * Do any additional validation prior to saving the record
Line 73: * @param int $id Record ID or 0 for adds
Line 74: * @param Validator $validator Validator instance to attach your errors to
Line 75: * @return void
Line 77: protected function jsonExtraValidate($id, Validator $validator)
Line 79: $validator->multipleCheck(
Line 80: ['path_exact', 'path_contains', 'subsite_id', 'domain_contains'],
Line 81: 'Validity::oneRequired'

/sprout/Controllers/Admin/SubsiteAdminController.php   Highlighted file source

Line 22: use Sprout\Helpers\Validator;
Line 49: * Validates incoming POST data.
Line 53: private function validate()
Line 55: $_SESSION['admin']['field_values'] = Validator::trim($_POST);
Line 58: $valid = new Validator($_POST);
Line 59: $valid->required(['name', 'code']);
Line 60: $valid->check('name', 'Validity::length', 0, 50);
Line 61: $valid->check('code', 'Validity::length', 0, 15);
Line 62: $valid->check('cond_directory', 'Validity::length', 0, 150);
Line 63: $valid->check('override_site_title', 'Validity::length', 0, 150);
Line 65: if ($valid->hasErrors()) {
Line 66: $_SESSION['admin']['field_errors'] = $valid->getFieldErrors();
Line 67: $valid->createNotifications();
Line 80: $view->subsites = Pdb::lookup('subsites', ['content_id' => 0]);
Line 97: * Saves the provided POST data into a new record in the database
Line 99: * @param int $item_id After saving, the new record id will be returned in this parameter
Line 102: public function _addSave(&$item_id)
Line 104: $res = $this->validate();
Line 116: $update_fields['content_id'] = $_POST['content_id'];
Line 122: $item_id = Pdb::insert('subsites', $update_fields);
Line 124: $res = $this->logAdd('subsites', $item_id);
Line 128: $update_fields['subsite_id'] = $item_id;
Line 139: public function _editPreRender($view, $item_id)
Line 141: parent::_editPreRender($view, $item_id);
Line 144: $view->subsites = Pdb::lookup('subsites', ['content_id' => 0, ['id', '!=', $item_id]]);
Line 152: public function _getEditSubActions($item_id)
Line 154: $actions = parent::_getEditSubActions($item_id);
Line 161: * Saves the provided POST data the specified record
Line 163: * @param int $item_id The record to update
Line 166: public function _editSave($item_id)
Line 168: $item_id = (int) $item_id;
Line 170: $res = $this->validate();
Line 183: $update_fields['content_id'] = (int) @$_POST['content_id'];
Line 189: $logdata = $this->loadRecord('subsites', $item_id);
Line 191: Pdb::update('subsites', $update_fields, ['id' => $item_id]);
Line 193: $this->logEdit('subsites', $item_id, $logdata);
Line 205: * @param int $id The record to show the delete form for
Line 208: public function _getDeleteForm($id)
Line 210: $q = "SELECT COUNT(id) FROM ~subsites";
Line 217: return parent::_getDeleteForm($id);
Line 223: * @param int $item_id The record to delete
Line 224: * @return void
Line 227: public function _deletePreSave($item_id)
Line 229: $q = "SELECT COUNT(id) FROM ~subsites";

/sprout/Controllers/Admin/TreeAdminController.php   Highlighted file source

Line 34: * id
Line 36: * parent_id
Line 51: $this->add_defaults['parent_id'] = @$_GET['parent_id'];
Line 106: protected function _editPreRender($view, $item_id)
Line 109: $view->tree_nodes = $root->getAllChildren($item_id);
Line 116: * @param int $item_id The record to show the delete form for
Line 119: public function _getDeleteForm($item_id)
Line 121: $item_id = (int) $item_id;
Line 130: $view->id = $item_id;
Line 134: $view->item = Pdb::get($this->table_name, $item_id);
Line 138: 'content' => "Invalid id specified - {$this->controller_name} does not exist",
Line 144: $node = $root->findNodeValue('id', $item_id);
Line 155: 'title' => 'Deleting ' . Enc::html(Inflector::singular($this->friendly_name)) . ' <strong>' . Enc::html($this->_identifier($view->item)) . '</strong>',
Line 164: * @param int $item_id The record to delete.
Line 166: * @param int $log_id Log ID referring to deleted parent, if applicable
Line 169: final public function _deleteSave($item_id, $depth = 0, $log_id = 0)
Line 171: $item_id = (int) $item_id;
Line 173: if (!$this->_isDeleteSaved($item_id)) return false;
Line 182: $parent_log_id = $log_id;
Line 183: if ($log_id > 0) {
Line 184: $this->deleteRecord($this->table_name, $item_id, $log_id);
Line 185: } else if ($depth == 0 and $log_id == 0) {
Line 186: $parent_log_id = $this->deleteRecord($this->table_name, $item_id);
Line 188: $this->deleteRecord($this->table_name, $item_id);
Line 192: $q = "SELECT id FROM ~{$this->table_name} WHERE parent_id = ?";
Line 193: $children = Pdb::q($q, [$item_id], 'col');
Line 195: foreach ($children as $child_id) {
Line 196: $res = $this->_deleteSave($child_id, $depth + 1, $parent_log_id);
Line 212: public function reorder($id)
Line 214: $id = (int) $id;
Line 221: if ($id == 0) {
Line 227: $q = "SELECT * FROM ~{$this->table_name} WHERE id = ?";
Line 229: $item = Pdb::q($q, [$id], 'row');
Line 231: echo "<p>Invalid id specified - item does not exist</p>";
Line 236: $q = "SELECT id, name
Line 238: WHERE parent_id = ?
Line 240: $children = Pdb::q($q, [$id], 'arr');
Line 244: echo $this->reorder($item->parent_id);
Line 256: $view->id = $id;
Line 277: $q = "SELECT id, name
Line 279: WHERE parent_id = 0
Line 291: $view->id = 0;
Line 302: public function reorderSave($parent_id)
Line 312: $parent_id = (int) $parent_id;
Line 316: foreach ($_POST['items'] as $id) {
Line 317: $id = (int) $id;
Line 319: $where = ['id' => $id, 'parent_id' => $parent_id];
Line 325: $this->_invalidateCaches('reorder');
Line 336: * @param int $item_id Record-id to update
Line 338: protected function fixRecordOrder($item_id)
Line 340: $q = "SELECT record_order, parent_id FROM ~{$this->table_name} WHERE id = ?";
Line 341: $item = Pdb::q($q, [$item_id], 'row');
Line 347: WHERE parent_id = ?";
Line 348: $order = 1 + Pdb::query($q, [$item['parent_id']], 'val');
Line 350: Pdb::update($this->table_name, ['record_order' => $order], ['id' => $item_id]);
Line 372: * @return void Admin will be redirected to a follow-up page
Line 388: $node['id'] = (int) @$node['id'];
Line 389: if (!$node['id']) continue;
Line 393: $deletes[] = $node['id'];
Line 406: $update_data['parent_id'] = $node['parent'];
Line 409: Pdb::update($this->table_name, $update_data, ['id' => $node['id']]);
Line 416: foreach ($deletes as $id) {
Line 417: $this->_deleteSave($id, 1);
Line 435: $parent_id = (int) basename($_POST['dir']);
Line 443: $top_node = Pdb::get($this->table_name, $parent_id);
Line 455: $q = "SELECT child.id, child.name, COUNT(sub.id) AS num_children
Line 457: LEFT JOIN ~{$this->table_name} AS sub ON sub.parent_id = child.id
Line 458: WHERE child.parent_id = ?
Line 459: GROUP BY child.id
Line 460: ORDER BY child.record_order, child.id";
Line 461: $children = Pdb::q($q, [$parent_id], 'arr');
Line 469: $rel = Enc::html($_POST['dir'] . $child['id']);
Line 482: echo "&#43; <a href=\"SITE/admin/add/{$this->controller_name}?parent_id={$parent_id}\">Add Child</a>";
Line 484: echo "&#8597; <a href=\"SITE/{$this->controller_name}/reorder/{$parent_id}\" onclick=\"$.facebox({'ajax':this.href}); return false;\">Re-order</a>";

/sprout/Controllers/Admin/WorkerJobAdminController.php   Highlighted file source

Line 25: use Sprout\Helpers\RefineWidgetSelect;
Line 26: use Sprout\Helpers\RefineWidgetTextbox;
Line 61: $this->refine_bar->addWidget(new RefineWidgetTextbox('name', 'Name'));
Line 62: $this->refine_bar->addWidget(new RefineWidgetSelect('status', 'Status', Constants::$job_status));
Line 84: * Return the fields to show in the sidebar when adding or editing a record.
Line 98: public function _addSave(&$item_id) { return false; }
Line 99: public function _editSave($item_id) { return false; }
Line 118: * Extra args can be provided as required.
Line 126: Notification::error('You must provide a valid class name');
Line 140: // Instance class - this may throw an exception if class not found or invalid
Line 168: public function jsonStatus($job_id)
Line 171: $job_id = (int) $job_id;
Line 173: $q = "SELECT status, metric1val, metric2val, metric3val, log FROM ~worker_jobs WHERE id = ?";
Line 174: $row = Pdb::q($q, [$job_id], 'row');

/sprout/Controllers/AdminAjaxController.php   Highlighted file source

Line 40: use Sprout\Helpers\Widgets;
Line 44: * Handles processing of various admin AJAX methods including: widget settings; links; and categories.
Line 63: * Returns the HTML for the settings for an individual widget.
Line 65: * @param string $widget_name The name of the widget to get settings for.
Line 67: public function widgetSettings($widget_name)
Line 82: 'Error loading widget settings; '
Line 87: // Prep the widget
Line 89: $widget = Widgets::instantiate($widget_name);
Line 91: $settings = $widget->getDefaultSettings();
Line 93: $widget->importSettings($settings);
Line 98: $info_labels = $widget->getInfoLabels();
Line 105: Form::setData([$prefix => $widget->getSettings()]);
Line 106: Form::setFieldIdPrefix($prefix);
Line 113: $form = $widget->getSettingsForm();
Line 118: 'edit_url' => $widget->getEditUrl(),
Line 119: 'description' => Enc::html($widget->getFriendlyDesc()),
Line 129: * AJAX-loaded popup content for UI to manage widget display conditions
Line 131: * @return void Outputs HTML directly
Line 133: public function widgetDispConds()
Line 141: 'url' => 'admin_ajax/widget_disp_cond_params',
Line 144: $view = new View('sprout/admin/widget_disp_conds');
Line 151: * Callback url for {@see Fb::conditionsList} for the widget display conditions
Line 159: * @return void Outputs JSON and then terminates
Line 161: public function widgetDispCondParams()
Line 184: Json::error('Invalid param type "' . $type . '"');
Line 197: public function addAddon($area_id, $field_name)
Line 201: $area_id = (int) $area_id;
Line 204: $areas = Kohana::config('sprout.widget_areas');
Line 205: $area = $areas[$area_id];
Line 206: $avail_widgets = $area->getWidgets();
Line 209: $widgets = array();
Line 210: foreach ($avail_widgets as $name) {
Line 211: $inst = Widgets::instantiate($name);
Line 212: $widgets[$inst->getFriendlyName()] = array(
Line 219: ksort($widgets);
Line 224: $view->widgets = $widgets;
Line 252: Json::error('Invalid class; missing interface');
Line 277: if ($_POST['table'] == '') Json::error('Invalid arguments');
Line 287: $insert_id = Pdb::insert($_POST['table'], $data);
Line 291: $insert_id = Pdb::insert($_POST['table'], $data);
Line 299: 'id' => $insert_id,
Line 321: throw new Exception('Invalid field');
Line 326: // Check the class is valid
Line 329: throw new Exception('Invalid class for field');
Line 335: throw new Exception('Invalid class for field');
Line 370: // Ensures fields using the 'Form' class will have usable id attributes
Line 371: Form::setFieldIdPrefix('lnkspec-' . time() . rand(0, 999) . '-');
Line 376: throw new Exception('Invalid LinkSpec class');
Line 383: throw new Exception('Invalid class for field');
Line 410: * The editor id will br provided in $elemid
Line 412: public function richtextImport($elemid)
Line 417: $view->elemid = $elemid;
Line 438: if (PHP_VERSION_ID < 80000) {
Line 473: * @return void Outputs JSON and then terminates
Line 475: public function styleGuideDemoConditions()

/sprout/Controllers/AdminController.php   Highlighted file source

Line 17: use InvalidArgumentException;
Line 221: if (isset($_SESSION['admin']['tfa_id'])) {
Line 234: if (!isset($_SESSION['admin']['tfa_id'])) {
Line 239: $q = "SELECT tfa_method FROM ~operators WHERE id = ?";
Line 240: $tfa_method = Pdb::query($q, [$_SESSION['admin']['tfa_id']], 'val');
Line 272: if (!isset($_SESSION['admin']['tfa_id'])) {
Line 278: $q = "SELECT tfa_method, tfa_secret FROM ~operators WHERE id = ?";
Line 279: $operator = Pdb::query($q, [$_SESSION['admin']['tfa_id']], 'row');
Line 296: $_SESSION['admin']['login_id'] = $_SESSION['admin']['tfa_id'];
Line 297: unset($_SESSION['admin']['tfa_id']);
Line 320: $cats = Category::categoryList('operators', AdminAuth::getId());
Line 361: public function styleGuide($section)
Line 366: $buttons = new View('sprout/admin/style_guide/index');
Line 369: $inner_view = new View('sprout/admin/style_guide/' . $section);
Line 378: $view->controller_name = '_style_guide';
Line 379: $view->browser_title = 'Style guide';
Line 380: $view->main_title = 'SproutCMS Style Guide';
Line 420: * @return void Redirects to the admin dashboard
Line 429: ['id' => AdminAuth::getId()]
Line 506: * @param int $id The id of the record to edit
Line 543: * @param int $id The id of the record to edit
Line 577: * @param int $id The id of the record to save
Line 657: // validate upload
Line 660: $error = 'No file provided';
Line 661: } else if (! Upload::valid($_FILES['import'])) {
Line 779: $ctlr->_invalidateCaches('import');
Line 865: * Checks that an admin user has access to an individual record
Line 868: * @param int $item_id The id of the row to be edited/deleted
Line 871: function checkRecordAccess(ManagedAdminController $ctlr, $item_id)
Line 880: $params[] = $item_id;
Line 884: WHERE controller = ? AND item_id = ?";
Line 967: * @param int $item_id The ID of the record being edited (0 when adding a new record)
Line 970: protected function perRecordPermissionsFields(ManagedAdminController $ctlr, $item_id)
Line 977: if ($item_id > 0) {
Line 980: WHERE controller = ? AND item_id = ?";
Line 981: $access = Pdb::q($q, [$ctlr->getControllerName(), $item_id], 'arr');
Line 986: $cat_ids = array_filter(explode(',', trim($access['operator_categories'], ',')));
Line 987: Form::setFieldValue('_prm_categories', $cat_ids);
Line 997: $cat_ids = AdminAuth::getOperatorCategories();
Line 999: if (count($cat_ids) > 0) {
Line 1002: ['id', 'IN', $cat_ids],
Line 1006: $q = "SELECT id, name
Line 1015: $primary_cat_id = AdminAuth::getPrimaryCategoryId();
Line 1016: unset($cat_list[$primary_cat_id]);
Line 1023: if ($item_id == 0 and count($checked_cats) == 0) {
Line 1024: if (!AdminAuth::inCategory($primary_cat_id)) {
Line 1031: if ($item_id == 0 or AdminAuth::inCategory($primary_cat_id)) {
Line 1036: if (AdminAuth::inCategory($primary_cat_id)) {
Line 1038: $all .= '<div class="fieldset-input"><input type="checkbox" value="1" name="_prm_all_cats" id="_prm_all"';
Line 1039: if ($checked_cats == ['*'] or ($item_id == 0 and Form::getData('_prm_all_cats'))) {
Line 1077: throw new InvalidArgumentException('Return value from _getAddForm must be an array');
Line 1085: $class = 'admin-ajax action-add type-' . Enc::id($type);
Line 1108: $content = '<form action="admin/add_save/' . Enc::html($ctlr->getControllerName()) . '" method="post" id="edit-form" class="-clearfix">';
Line 1111: $content .= '<div class="mainbar-with-right-sidebar">';
Line 1116: $content .= '<div class="right-sidebar">';
Line 1117: $content .= '<div class="right-sidebar-inner">';
Line 1138: Form::setFieldValue('subsite_id', $_SESSION['admin']['active_subsite']);
Line 1139: $content .= Form::dropdown('subsite_id', ['-dropdown-top' => 'Show on all sites'], $subsites);
Line 1187: $id = 0;
Line 1188: $result = $ctlr->_addSave($id);
Line 1192: PerRecordPerms::save($ctlr, $id);
Line 1210: $tag_result = Tags::update($ctlr->getTableName(), $id, $new_tags);
Line 1217: $ctlr->_invalidateCaches('add', $id);
Line 1231: Url::redirect("admin/edit/{$type}/{$id}");
Line 1239: * @param int $id The id of the record to edit
Line 1241: public function edit($type, $id)
Line 1244: $id = (int) $id;
Line 1253: if (! $this->checkRecordAccess($ctlr, $id)) return;
Line 1257: $main = $ctlr->_getEditForm($id);
Line 1263: throw new InvalidArgumentException('Return value from _getEditForm must be an array');
Line 1267: if ($ctlr->_isEditSaved($id) and Text::containsFormTag($main['content'])) {
Line 1278: $tags->current_tags = implode(', ', Tags::byRecord($ctlr->getTableName(), $id));
Line 1285: if ($ctlr->_isEditSaved($id)) {
Line 1286: $content = '<form action="admin/edit_save/' . Enc::html($ctlr->getControllerName()) . '/' . $id;
Line 1287: $content .= '" method="post" id="edit-form" class="-clearfix" enctype="multipart/form-data">';
Line 1289: $content .= '<div class="mainbar-with-right-sidebar">';
Line 1295: $content .= '<div class="right-sidebar">';
Line 1296: $content .= '<div class="right-sidebar-inner">';
Line 1299: $html = $ctlr->_getCustomEditSaveHTML($id);
Line 1304: $sub_actions = $ctlr->_getEditSubActions($id);
Line 1312: $content .= $this->perRecordPermissionsFields($ctlr, $id);
Line 1317: $content .= Form::dropdown('subsite_id', ['-dropdown-top' => 'Show on all sites'], $subsites);
Line 1337: $this->lock($type, $id, $view);
Line 1345: $url = $ctlr->_getEditLiveUrl($id);
Line 1357: * @param int $id The id of the record to save
Line 1359: public function editSave($type, $id)
Line 1364: $id = (int) $id;
Line 1369: if (! $this->checkRecordAccess($ctlr, $id)) return;
Line 1371: $this->unlock($type, $id);
Line 1376: $result = $ctlr->_editSave($id);
Line 1386: Url::redirect("admin/edit/{$type}/{$id}");
Line 1391: PerRecordPerms::save($ctlr, $id);
Line 1395: $tag_result = Tags::update($ctlr->getTableName(), $id, $new_tags);
Line 1402: $ctlr->_invalidateCaches('edit', $id);
Line 1412: Url::redirect("admin/edit/{$type}/{$id}");
Line 1420: * @param int $id The id of the record to show
Line 1422: public function delete($type, $id)
Line 1429: if (!$this->checkRecordAccess($ctlr, $id)) return;
Line 1430: if (!$ctlr->_isDeleteSaved($id)) return;
Line 1432: $main = $ctlr->_getDeleteForm($id);
Line 1439: throw new InvalidArgumentException('Return value from _getDeleteForm must be an array');
Line 1442: if ($ctlr->_isDeleteSaved($id) and Text::containsFormTag($main['content'])) {
Line 1451: $content = '<form action="admin/delete_save/' . Enc::html($ctlr->getControllerName()) . '/' . $id . '" method="post" id="edit-form">';
Line 1455: $content .= '<div class="mainbar-with-right-sidebar">';
Line 1459: $content .= '<div class="right-sidebar">';
Line 1460: $content .= '<div class="right-sidebar-inner">';
Line 1464: $content .= $this->renderSubActions($ctlr->_getDeleteSubActions($id));
Line 1487: * @param int $id The id of the record to delete
Line 1489: public function deleteSave($type, $id)
Line 1497: if (! $this->checkRecordAccess($ctlr, $id)) return;
Line 1500: $ctlr->_deletePreSave($id);
Line 1503: Url::redirect("admin/delete/{$type}/{$id}");
Line 1508: $result = $ctlr->_deleteSave($id);
Line 1512: Url::redirect("admin/edit/{$type}/{$id}");
Line 1514: if ($result) $ctlr->_deletePostSave($id);
Line 1516: $tag_result = Tags::update($ctlr->getTableName(), $id, array());
Line 1527: Url::redirect("admin/delete/{$type}/{$id}");
Line 1530: $ctlr->_invalidateCaches('delete', $id);
Line 1547: * @param int $id The id of the record to duplicate
Line 1549: public function duplicate($type, $id)
Line 1552: $id = (int) $id;
Line 1561: if (! $this->checkRecordAccess($ctlr, $id)) return;
Line 1570: $main = $ctlr->_getDuplicateForm($id);
Line 1590: $tags->current_tags = implode(', ', Tags::byRecord($ctlr->getTableName(), $id));
Line 1600: if ($ctlr->_isEditSaved($id)) {
Line 1602: $content = '<form action="admin/duplicate_save/' . Enc::html($ctlr->getControllerName()) . '/' . $id . '" method="post" id="edit-form">';
Line 1605: $content .= '<div class="mainbar-with-right-sidebar">';
Line 1610: $content .= '<div class="right-sidebar">';
Line 1611: $content .= '<div class="right-sidebar-inner">';
Line 1614: $html = $ctlr->_getCustomDuplicateSaveHTML($id);
Line 1619: $sub_actions = $ctlr->_getDuplicateSubActions($id);
Line 1644: $this->lock($type, $id, $view);
Line 1659: * @param int $id The id of the record to save
Line 1661: public function duplicateSave($type, $orig_id)
Line 1666: $orig_id = (int) $orig_id;
Line 1671: if (! $this->checkRecordAccess($ctlr, $orig_id)) return;
Line 1680: // Create new id
Line 1684: $id = Pdb::insert($ctlr->getTableName(), array('date_added' => Pdb::now()));
Line 1686: // Set "id" columns from multiedit records to zero for force an insert
Line 1690: $multiedit_row['id'] = 0;
Line 1697: $result = $ctlr->_duplicateSave($id);
Line 1706: $perms = PerRecordPerms::fetchDetails($ctlr, $orig_id);
Line 1710: PerRecordPerms::save($ctlr, $id);
Line 1714: PerRecordPerms::save($ctlr, $id);
Line 1728: Url::redirect("admin/duplicate/{$type}/{$orig_id}");
Line 1732: $tag_result = Tags::update($ctlr->getTableName(), $id, $new_tags);
Line 1739: $ctlr->_invalidateCaches('duplicate', $id);
Line 1743: Url::redirect("admin/edit/{$type}/{$id}");
Line 1769: $idx = 0;
Line 1790: foreach ($list as $id => $html) {
Line 1791: $idx++;
Line 1794: $out .= "<td class=\"mod\"><input type=\"radio\" name=\"moderate[{$class}][{$id}]\" value=\"app\" checked></td>";
Line 1795: $out .= "<td class=\"mod\"><input type=\"radio\" name=\"moderate[{$class}][{$id}]\" value=\"del\"></td>";
Line 1796: $out .= "<td class=\"mod\"><input type=\"radio\" name=\"moderate[{$class}][{$id}]\" value=\"\"></td>";
Line 1834: foreach ($records as $id => $do) {
Line 1835: $id = (int) $id;
Line 1838: $inst->approve($id);
Line 1842: $inst->delete($id);
Line 1858: * Calls any 'extra' commands that might be provided by the controller
Line 1870: * // Call with url admin/extra/booking/send_email/:record_id
Line 1871: * public function _extraSendEmail($record_id) {
Line 1878: * @return void Outputs HTML
Line 1886: throw new InvalidArgumentException('Invalid method specified');
Line 1896: throw new InvalidArgumentException('Method "' . $method . '" does not exist');
Line 1899: throw new InvalidArgumentException('Method "' . $method . '" does not exist');
Line 1930: * Directly calls a method provided by an admin controller
Line 1935: * @return void Does whatever the called function does, e.g. echo or redirect
Line 1943: throw new InvalidArgumentException('Controller "' . $class . '" does not exist');
Line 1947: throw new InvalidArgumentException('Method "' . $method . '" does not exist');
Line 1952: throw new InvalidArgumentException('Method "' . $method . '" does not exist');
Line 1973: die('Invalid POST data');
Line 1990: * Sets up the sidebar navigation for a view to show the navigation for a specific controller.
Line 2044: * @param string $type A class name, or shorthand identifier
Line 2061: * @param int $id Record id which is being edited
Line 2062: * @param View $view Main layout view to provide lock details into
Line 2064: private function lock($type, $id, View $view)
Line 2069: $id = (int) $id;
Line 2071: $lock = Admin::getLock($type, $id);
Line 2075: $lock_id = Admin::lock($type, $id);
Line 2077: 'id' => (int)$lock_id,
Line 2079: 'record_id' => $id,
Line 2085: Admin::pingLock($lock['id']);
Line 2087: 'id' => (int)$lock['id'],
Line 2089: 'record_id' => $id,
Line 2103: private function unlock($type = null, $id = null)
Line 2105: Admin::unlock($type, $id);
Line 2121: Admin::unlock($_POST['ctlr'], $_POST['record_id']);
Line 2128: * @param int $log_id ID in the history_items table
Line 2129: * @return void
Line 2131: public function restore($log_id)
Line 2135: $log_id = (int) $log_id;
Line 2138: $q = "SELECT id, record_id, record_table, controller, data
Line 2140: WHERE id = ? AND type = 'Delete'";
Line 2141: $records = Pdb::q($q, [$log_id], 'map-arr');
Line 2150: $q = "SELECT id, record_table, data FROM ~history_items WHERE type = 'Delete' AND ";
Line 2151: $q .= Pdb::buildClause([['parent_id', 'IN', array_keys($new)]], $params);
Line 2153: foreach ($new as $id => $data) {
Line 2154: $records[$id] = $data;
Line 2161: Pdb::validateIdentifier($row['record_table']);
Line 2165: Pdb::validateIdentifier($field);
Line 2179: Url::redirect('admin/edit/action_log/' . $log_id);
Line 2184: Pdb::update('history_items', $data, ['id' => $log_id]);
Line 2191: Url::redirect('admin/edit/' . Enc::url($ctlr->getControllerName()) . '/' . $main_record['record_id']);
Line 2193: Url::redirect('admin/edit/action_log/' . $log_id);
Line 2200: * @return void Echos HTML
Line 2211: echo 'td { font-family: sans-serif; padding: 10px 15px; border: 1px #eee solid; }';
Line 2272: $q = "SELECT id
Line 2286: Cron::message("Activating record {$row['id']}");
Line 2287: Pdb::update($tbl_no_prefix, ['active' => 1], ['id' => $row['id']]);
Line 2292: $q = "SELECT id
Line 2301: Cron::message("Expiring record {$row['id']}");
Line 2302: Pdb::update($tbl_no_prefix, ['active' => 0], ['id' => $row['id']]);
Line 2323: if (isset($_GET['lock_id'])) {
Line 2324: Admin::pingLock($_GET['lock_id']);

/sprout/Controllers/AdvancedSearchController.php   Highlighted file source

Line 58: * Return an array of valid arguments to the entrance of this controller.
Line 60: * @return array The valid arguments, in key-value pairs
Line 105: if (! $ch instanceof SearchHandler) throw new Exception("Invalid SearchHandler registered");
Line 125: foreach ($_GET['type'] as $idx => $val) {
Line 126: if (!isset($avail_types[$val])) unset($_GET['type'][$idx]);
Line 164: $ch->addJoin("INNER JOIN ~tags AS tags ON tags.record_table = '{$ch->getMainTable()}' AND tags.record_id = main.id");
Line 219: $out .= $ctlr->frontEndSearch($row['record_id'], $row['relevancy'], $keywords);
Line 230: * Take the datespec on the key side of Constants::$relative_dates and turn into a WHERE clause
Line 247: * Provides data for the tag autocomplete

/sprout/Controllers/BaseController.php   Highlighted file source

Line 39: * @return void
Line 58: * @return void
Line 71: * @return void

/sprout/Controllers/CaptchaController.php   Highlighted file source

Line 31: * @return void Outputs image content after setting the appropriate content-type header
Line 44: $width = 200;
Line 47: $my_image = imagecreatetruecolor($width, $height);
Line 53: $x = mt_rand(-20, $width + 20);
Line 55: $x2 = mt_rand(-20, $width + 20);
Line 85: * @return void Outputs HTML directly

/sprout/Controllers/ContentSubscribeController.php   Highlighted file source

Line 17: use InvalidArgumentException;
Line 50: public function unsub($id, $code)
Line 52: $id = (int) $id;
Line 55: // Check the id and code match
Line 58: WHERE id = ? AND code = ?
Line 61: $email = Pdb::q($q, [$id, $code], 'val');
Line 63: Notification::error('Invalid id or unsubscription code');
Line 69: $q = "SELECT id, handler_class, handler_settings
Line 72: ORDER BY id";
Line 88: $subs[$row['id']] = $result;
Line 93: $view->id = $id;
Line 107: public function unsubAction($id, $code)
Line 109: $id = (int) $id;
Line 112: // Check the id and code match
Line 115: WHERE id = ? AND code = ?
Line 118: $email = Pdb::q($q, [$id, $code], 'row');
Line 120: Notification::error('Invalid id or unsubscription code');
Line 124: // Did they actually choose anything?
Line 126: Notification::error('You didn\'t select anything');
Line 127: Url::redirect("content_subscribe/unsub/{$id}/{$code}");
Line 130: // Fetch the IDs of all of the subscriptions for this email address.
Line 132: $q = "SELECT id
Line 135: $ids = Pdb::q($q, [$code, $email], 'col');
Line 138: foreach ($_POST['unsubscribe'] as $id) {
Line 139: if (! in_array($id, $ids)) continue;
Line 141: Pdb::delete('content_subscriptions', ['id' => $id]);
Line 158: $q = 'SELECT id, content_id, name, code, mobile FROM ~subsites';
Line 167: SubsiteSelector::$subsite_id = $subsite['id'];
Line 168: SubsiteSelector::$content_id = $subsite['content_id'] ?: $subsite['id'];
Line 173: $q = "SELECT id, code, handler_class, handler_settings, name, email, subsite_id
Line 175: WHERE subsite_id = ?
Line 176: ORDER BY id";
Line 177: $res = Pdb::q($q, [$subsite['id']], 'pdo');
Line 191: 'id' => $row['id'],
Line 208: } catch (InvalidArgumentException $ex) {
Line 269: $row['url'] = Subsites::getAbsRoot($subsite['id']) . ltrim($row['url'], '/');
Line 273: $subsite_title = Subsites::getConfig('site_title', $subsite['id']);
Line 276: $view->unsubscribe_url = Subsites::getAbsRoot($subsite['id']) . "content_subscribe/unsub/{$deets['id']}/{$deets['code']}";
Line 314: public function cleanupInvalidClasses()
Line 330: echo 'Deleting invalid subscriptions, if found.', PHP_EOL, PHP_EOL;

/sprout/Controllers/Controller.php   Highlighted file source

Line 19: use InvalidArgumentException;
Line 32: use Sprout\Helpers\Validator;
Line 54: * @param int $record_id The id of the added/edited/deleted record
Line 61: * 'Add category' should contain ['cat_id' => value]
Line 62: * 'Delete category' should contain ['cat_id' => value]
Line 64: * @param int $parent_log_id ID of a parent log entry in the history_items table.
Line 68: * @return int ID of the record inserted into the history_items table;
Line 72: protected function logAction($table, $record_id, $type, array $data = [], $parent_log_id = 0)
Line 80: $record_id = (int) $record_id;
Line 81: $parent_log_id = (int) $parent_log_id;
Line 85: throw new InvalidArgumentException('Invalid action type: ' . $type);
Line 90: $data = $this->loadRecord($table, $record_id);
Line 95: $row = $this->loadRecord($table, $record_id);
Line 123: (record_table, record_id, type, modified_editor, ip_address, user_agent, controller,
Line 124: data, date_added, date_modified, parent_id)
Line 126: (:record_table, :record_id, :type, :modified_editor, :ip_address, :user_agent, :controller,
Line 127: :data, :date_added, :date_modified, :parent_id)";
Line 133: $insert_data['record_id'] = $record_id;
Line 142: $insert_data['parent_id'] = $parent_log_id;
Line 146: return $pdo->lastInsertId();
Line 154: * @param int $record_id ID of record to load
Line 158: protected function loadRecord($table, $record_id)
Line 160: $record_id = (int) $record_id;
Line 161: Pdb::validateIdentifier($table);
Line 164: $q = "SELECT * FROM ~{$table} WHERE id = ?";
Line 165: return Pdb::query($q, [$record_id], 'row');
Line 172: * @param int $record_id The id of the added record
Line 173: * @return int ID of the record inserted into the history_items table
Line 176: protected function logAdd($table, $record_id)
Line 178: return $this->logAction($table, $record_id, 'Add');
Line 185: * @param int $record_id The ID of the record which was added to the category
Line 186: * @param int $cat_id The ID of the category which the record was added to
Line 187: * @return int ID of the record inserted into the history_items table
Line 190: protected function logAddCategory($table, $record_id, $cat_id)
Line 192: return $this->logAction($table, $record_id, 'Add category', ['cat_id' => $cat_id]);
Line 199: * @param int $record_id The id of the edited record
Line 201: * @return int ID of the record inserted into the history_items table
Line 204: protected function logEdit($table, $record_id, array $data)
Line 206: return $this->logAction($table, $record_id, 'Edit', $data);
Line 213: * @param int $record_id The id of the deleted record
Line 216: * @param int $parent_log_id ID of a parent log entry in the history_items table.
Line 219: * @return int ID of the record inserted into the history_items table
Line 222: protected function logDelete($table, $record_id, array $data, $parent_log_id = 0)
Line 224: return $this->logAction($table, $record_id, 'Delete', $data, $parent_log_id);
Line 231: * @param int $record_id The ID of the record which was removed from the category
Line 232: * @param int $cat_id The ID of the category which the record was removed from
Line 233: * @return int ID of the record inserted into the history_items table
Line 236: protected function logDeleteCategory($table, $record_id, $cat_id)
Line 238: return $this->logAction($table, $record_id, 'Delete category', ['cat_id' => $cat_id]);
Line 247: * @param int $record_id
Line 248: * @param int $parent_log_id ID of a parent entry in the history_items table.
Line 251: * @return int ID of the record inserted into the history_items table (0 if no logging)
Line 253: protected function deleteRecord($table, $record_id, $parent_log_id = 0)
Line 255: $record_id = (int) $record_id;
Line 263: $record = Pdb::get($table, $record_id);
Line 287: $data = [$table => [$record_id => $record]];
Line 289: $ids = @array_keys($data[$base_table]);
Line 290: if (empty($ids)) continue;
Line 296: $where = Pdb::buildClause([[$dep['column'], 'IN', $ids]], $params);
Line 300: // N.B. some tables (e.g. *_cat_join) don't have an id column
Line 302: // the id column), so it's fine to just use numeric array indexing on their records.
Line 303: // The restore/undelete function should ignore the value in the record_id column in
Line 305: if (isset($row['id'])) {
Line 306: $data[$dep['table']][$row['id']] = $row;
Line 315: Pdb::delete($table, ['id' => $record_id]);
Line 316: $log_id = $this->logDelete($table, $record_id, $record, $parent_log_id);
Line 318: if ($parent_log_id == 0) $parent_log_id = $log_id;
Line 323: $conds = ['controller' => $this->getControllerName(), 'item_id' => $record_id];
Line 330: Pdb::delete('per_record_permissions', ['id' => $perms['id']]);
Line 331: $this->logDelete('per_record_permissions', $perms['id'], $perms, $parent_log_id);
Line 339: foreach ($data_rows as $data_id => $data_row) {
Line 340: $this->logDelete($data_table, $data_id, $data_row, $parent_log_id);
Line 345: $log_id = 0;
Line 346: Pdb::delete($table, ['id' => $record_id]);
Line 349: $where = ['controller' => $this->getControllerName(), 'item_id' => $record_id];
Line 356: return $log_id;
Line 365: * @throws Exception If the file is invalid
Line 380: throw new Exception("Invalid JSON -- " . json_last_error_msg());
Line 389: * @throws Exception If the file is missing or invalid
Line 405: * @throws Exception If the file is missing or invalid
Line 417: * Do any additional validation prior to saving the record
Line 419: * @param int $id Record ID or 0 for adds
Line 420: * @param Validator $validator Validator instance to attach your errors to
Line 421: * @return void
Line 423: protected function jsonExtraValidate($id, Validator $validator)
Line 480: * @param int $item_id Database ID of record to store data in. If zero, a new record will be inserted, and as this
Line 481: * argument is a reference, it will be updated with the auto-increment ID generated by the insert.
Line 483: * 'add' or 'edit' will be automatically determined, based on $item_id
Line 486: protected function saveJsonData(array $conf, &$item_id, $mode = '')
Line 488: $item_id = (int) $item_id;
Line 495: $_SESSION[$session_key]['field_values'] = Validator::trim($_POST);
Line 497: if ($mode == '') $mode = ($item_id == 0 ? 'add' : 'edit');
Line 498: $validator = new Validator($_POST);
Line 500: list($data, $errs) = JsonForm::collateData($conf, $mode, $validator, $item_id);
Line 502: $this->jsonExtraValidate($item_id, $validator);
Line 503: $errs = array_merge($errs, $validator->getFieldErrors());
Line 507: $validator->createNotifications();
Line 511: $this->_preSave($item_id, $data);
Line 526: if ($item_id <= 0) {
Line 527: $item_id = Pdb::insert($this->table_name, $base_data);
Line 528: $this->logAdd($this->table_name, $item_id);
Line 530: $log_data = $this->loadRecord($this->table_name, $item_id);
Line 531: Pdb::update($this->table_name, $base_data, ['id' => $item_id]);
Line 532: $this->logEdit($this->table_name, $item_id, $log_data);
Line 537: $this->updateCategories($item_id, $data['categories']);
Line 541: $id_field = Inflector::singular($this->table_name) . '_id';
Line 549: $multi_data_key = 'multiedit_' . $multed['id'];
Line 550: $link_column = !empty($multed['link']) ? $multed['link'] : $id_field;
Line 554: $conditions[] = [$link_column, '=', $item_id];
Line 579: $new_rec[$link_column] = $item_id;
Line 599: Pdb::validateIdentifier($auto['joiner_local_col']);
Line 600: Pdb::validateIdentifier($auto['joiner_foreign_col']);
Line 601: Pdb::validateIdentifier($auto['joiner_table']);
Line 610: // It's safe to do a nuke-then-insert as there isn't IDs to keep stable
Line 613: $auto['joiner_local_col'] => $item_id
Line 618: $foreign_ids = [];
Line 620: if (in_array($postrow['id'], $foreign_ids)) {
Line 625: $data[$auto['joiner_local_col']] = $item_id;
Line 626: $data[$auto['joiner_foreign_col']] = $postrow['id'];
Line 631: $foreign_ids[] = $postrow['id'];
Line 650: * Matching is done on the 'id' field, as a result the $new_records arrays MUST contain an id field.
Line 656: * @return void
Line 661: Pdb::validateIdentifier($table);
Line 665: $q = "SELECT id FROM ~{$table} WHERE " . Pdb::buildClause($select_conditions, $values);
Line 672: foreach ($new_records as $new_idx => $new) {
Line 673: if ($old['id'] == @$new['id']) {
Line 675: unset($new_records[$new_idx]);
Line 681: $replace_conditions['id'] = $old['id'];
Line 683: unset($found['id']);
Line 692: $this->deleteRecord($table, $replace_conditions['id']);

/sprout/Controllers/CronJobController.php   Highlighted file source

Line 41: * Each individual job is run independently of the others using a php sub-process
Line 46: * @return void Terminates script with exit status of number of failed jobs (0 = no failures)
Line 75: // Output the PID, which may be useful to someone
Line 77: echo ' PID ', $status['pid'], PHP_EOL;

/sprout/Controllers/DbToolsController.php   Highlighted file source

Line 18: use InvalidArgumentException;
Line 30: use Sprout\Exceptions\ValidationException;
Line 69: use Sprout\Helpers\Validator;
Line 70: use Sprout\Helpers\Validity;
Line 75: * Provides tools for dealing with the database
Line 85: * List of tools to show in the sidebar and index view
Line 97: [ 'url' => 'admin/style_guide', 'name' => 'Admin style guide', 'desc' => 'View styles of various admin features - form fields, etc' ],
Line 165: // Validate
Line 186: * @return void Echos HTML directly
Line 259: $vals['Subsite ID'] = SubsiteSelector::$subsite_id;
Line 261: $q = "SELECT id, name, code, active FROM ~subsites ORDER BY id";
Line 389: echo '.update-log b { display: inline-block; width: 100px; }';
Line 395: echo '<input type="hidden" name="act" value="yes">';
Line 404: echo '<input type="hidden" name="act" value="yes">';
Line 491: * Splits a set of SQL queries into individual queries
Line 558: $idx = 0;
Line 569: $vars[$idx]['key'] = $key;
Line 570: $vars[$idx]['val'] = $val;
Line 571: ++$idx;
Line 672: $q = "SHOW PROFILE FOR QUERY {$row['Query_ID']}";
Line 675: $out .= "<h3>Query #{$row['Query_ID']}; total duration: {$row['Duration']}</h3>";
Line 733: Pdb::validateIdentifier($table);
Line 734: } catch (InvalidArgumentException $ex) {
Line 794: $valid_exts = ['sql'];
Line 796: $valid_exts[] = 'zip';
Line 799: if (!in_array($ext, $valid_exts)) {
Line 800: echo "Invalid file type, suported types: " . implode(', ', $valid_exts);
Line 845: echo ' <input type="hidden" name="tempname" value="', Enc::html($_GET['tempname']), '">';
Line 849: echo '<iframe name="process" style="border: 1px #999 dashed; margin: 30px 0; width: 700px; height: 300px; display: none;"></iframe>';
Line 899: $idx = 0;
Line 901: $idx++;
Line 902: echo '<p>Processing file # ', $idx, '.</p>';
Line 907: echo '<p>File # ', $idx, ' contains ', count($queries), ' queries.</p>';
Line 912: $qidx = 0;
Line 926: $qidx++;
Line 927: if ($qidx % 1000 == 0) {
Line 928: echo '<p>Done ', $qidx, ' queries.</p>';
Line 937: echo '<p>File # ', $idx, ' finished.</p>';
Line 1041: $('a.next-toggle').next().hide();
Line 1052: <p><a class="preview" id="select-all-none" href="#">Select all/none</a></p>
Line 1076: echo '<col width="1"><col width="230"><col width="40"><col width="40"><col width="200"><col width="200"><col width="1"><col width="1"><col width="75">';
Line 1077: echo '<thead><tr><th style="width: 1px;">&nbsp;</th>';
Line 1081: $idx = 0;
Line 1087: $where_options .= "<br><input type=\"text\" name=\"where[{$idx}]\"></p>";
Line 1089: $type_options = "<select name=\"data[{$idx}]\">";
Line 1101: echo "<td><input type=\"checkbox\" name=\"tables[{$idx}]\" value=\"{$table['Name']}\"{$checked}></td>";
Line 1107: echo "<td><input type=\"checkbox\" name=\"drop[{$idx}]\" value=\"1\" checked></td>";
Line 1108: echo "<td><input type=\"checkbox\" name=\"structure[{$idx}]\" value=\"1\" checked></td>";
Line 1112: $idx++;
Line 1122: echo '<p><b>DBMS:</b> &nbsp; <select name="dbms" style="width: 100px;"><option>MySQL<option>SQLite</select></p>';
Line 1162: * @return void Outputs HTML directly
Line 1169: throw new InvalidArgumentException('No tables specified');
Line 1197: foreach ($_POST['tables'] as $idx => $table_name) {
Line 1200: $table->drop = (bool)@$_POST['drop'][$idx];
Line 1201: $table->structure = (bool)@$_POST['structure'][$idx];
Line 1202: $table->data = $_POST['data'][$idx];
Line 1203: $table->where = $_POST['where'][$idx];
Line 1267: Notification::error('Invalid file type; only .zip files are supported.');
Line 1277: $invalid = [];
Line 1281: $invalid[] = $filename;
Line 1286: if (count($invalid)) {
Line 1290: echo "DISALLOWED FILES FOUND:\n - ", implode("\n - ", $invalid);
Line 1317: * @param string $orig Alternate name to use when providing file to browser
Line 1323: $validation_regexes = [
Line 1329: if (!isset($validation_regexes[$source])) {
Line 1330: throw new InvalidArgumentException('Invalid source specified');
Line 1332: if (!preg_match($validation_regexes[$source], $tempfile)) {
Line 1333: throw new InvalidArgumentException('Invalid tempfile specified');
Line 1488: echo '<input type="hidden" name="key[]" value="' . Enc::url($k) . '">';
Line 1597: * @return void
Line 1676: $view->bad_fields = array('id', 'name', 'active', 'date_added', 'date_modified', 'record_order');
Line 1687: throw new InvalidArgumentException('Module author not specified');
Line 1690: throw new InvalidArgumentException('Module name not specified');
Line 1694: throw new InvalidArgumentException('Invalid module name');
Line 1700: 'id' => 'INT UNSIGNED',
Line 1711: if ($_POST['module_type'] == 'tree') $fields[] = 'parent_id';
Line 1731: } else if (preg_match('!_id$!', $f)) {
Line 1745: if ($f == 'parent_id') {
Line 1747: $items = "{\"query\": \"SELECT id, name FROM ~{$_POST['pname']} WHERE parent_id = 0 ORDER BY record_order\"}";
Line 1760: "{$t}{$t}{$t}{$t}\"validate\": [\n";
Line 1762: // Use length as basic validation where possible, allowing an extra char for a decimal point if relevant
Line 1767: $json .= "{$t}{$t}{$t}{$t}{$t}{\"func\": \"Validity::length\", \"args\": [0, {$field_len}]}\n";
Line 1931: die('Invalid module');
Line 1956: if (!preg_match('/^mbe[0-9]+\.xml$/', $input_xml)) die('Invalid filename');
Line 2009: if (!preg_match('/^mbe[0-9]+\.xml$/', $input_xml)) $errs[] = 'Invalid filename';
Line 2019: $errs['module_name'] = 'Invalid value';
Line 2023: $_SESSION['module_builder_existing']['field_values'] = Validator::trim($_POST);
Line 2052: if (in_array($f, ['id', 'date_added', 'date_modified'])) continue;
Line 2074: // Foreign keys (ending in _id)
Line 2075: } else if (preg_match('/_id$/', $f)) {
Line 2109: $l = preg_replace('/\s+id$/', '', $l);
Line 2127: "{$tab}{$tab}{$tab}{$tab}\"validate\": [\n";
Line 2129: // Use length as basic validation where possible, allowing an extra char for a decimal point if relevant
Line 2134: $json .= "{$tab}{$tab}{$tab}{$tab}{$tab}{\"func\": \"Validity::length\", \"args\": [0, {$field_len}]}\n";
Line 2280: $q = "SELECT id, date_generated, class_name, message
Line 2283: ORDER BY id DESC
Line 2293: $itemlist->addAction('edit', 'dbtools/exceptionDetail?id=%%');
Line 2319: $_GET['id'] = preg_replace('/^SE/i', '', trim($_GET['id']));
Line 2322: $log = Pdb::get('exception_log', $_GET['id']);
Line 2323: $title = $log['id'];
Line 2372: echo "' =&gt; ['uid' => {$user['uid']}, 'hash' =&gt; '", Enc::html(Enc::js($user['hash']));
Line 2385: * @return void Echos HTML
Line 2402: * @return void Outputs HTML directly
Line 2437: * @return void Outputs HTML directly
Line 2449: $q = "SELECT id FROM ~subsites WHERE code = ?";
Line 2450: $subsite_id = Pdb::query($q, [$skin], 'val');
Line 2452: $subsite_id = SubsiteSelector::$subsite_id;
Line 2456: SubsiteSelector::$subsite_id = $subsite_id;
Line 2458: SubsiteSelector::$content_id = $subsite_id;
Line 2461: $root = Navigation::loadPageTree($subsite_id, false, true);
Line 2463: // Find a node for sidenav, breadcrumb, etc.
Line 2485: Navigation::setPageNodeMatcher(new TreenodeValueMatcher('id', $fake_node['id']));
Line 2539: $invalid_tables = array();
Line 2542: if (!isset($cols['id'])) continue;
Line 2546: // Look for a {something}_id column.
Line 2547: // A table without such a column is probably invalid, so put it
Line 2549: $valid = false;
Line 2551: if ($name == 'id') continue;
Line 2552: if ($name == 'subsite_id') continue;
Line 2553: if (preg_match('/_id$/', $name)) {
Line 2554: $valid = true;
Line 2559: if ($valid) {
Line 2562: $invalid_tables[$full_name] = "* $table";
Line 2565: $opts = array_merge($module_tables, $invalid_tables);
Line 2590: if ($name == 'id') continue;
Line 2595: if ($name == 'subsite_id') continue;
Line 2597: if (substr($name, -3) == '_id') $selected = $value;
Line 2613: Form::nextFieldDetails('Column which links to base table', true, 'e.g. user_id');
Line 2647: $template = str_replace('user_id', $linker, $template);
Line 2655: $template = str_replace('record_order', 'id', $template);
Line 2663: if ($name == 'id') continue;
Line 2667: $label = preg_replace('/_id$/', '', $label);
Line 2678: if ($name == 'id') continue;
Line 2683: $data .= "\$item_id;\n";
Line 2808: Validity::email($_POST['from']);
Line 2820: Validity::email($e);
Line 2821: } catch (ValidationException $ex) {
Line 2866: * @return void Echos HTML directly
Line 2881: * @return void Redirects
Line 2887: $_POST['subsite_id'] = (int) @$_POST['subsite_id'];
Line 2888: $_POST['page_id'] = (int) @$_POST['page_id'];
Line 2890: // Validate sub-site
Line 2891: if (empty($_POST['subsite_id'])) {
Line 2896: // Validate file type
Line 2899: Notification::error('Invalid file type');
Line 2919: // Render table of pages that need widgets replaced
Line 2922: 'Old ID' => 'old_id',
Line 2923: 'New ID' => 'new_id',
Line 2924: 'Widgets' => 'widgets',
Line 2937: * @param int $subsite_id
Line 2938: * @return void Echos HTML directly
Line 2940: public function ajaxPageIds($subsite_id)
Line 2942: $subsite_id = (int) $subsite_id;
Line 2946: echo Form::pageDropdown('page_id', [], ['subsite' => $subsite_id]);
Line 2955: * @return void Echos HTML directly
Line 2963: if (!method_exists($ctlr, $method)) throw new InvalidArgumentException(sprintf('Method "%s" does not exist', $method));
Line 2966: if (!$reflect->isPublic()) throw new InvalidArgumentException(sprintf('Method "%s" does not exist', $method));
Line 2989: * @return void Echos HTML directly
Line 3005: * @return void Echos PNG directly

/sprout/Controllers/EmailShareController.php   Highlighted file source

Line 30: use Sprout\Helpers\Validator;
Line 51: * Validate that a given URL is absolute and for this site
Line 57: * @return bool True if valid, false if not
Line 59: private static function validateUrl($url)
Line 87: if (self::validateUrl($_GET['url'])) {
Line 90: throw new Exception('Invalid URL');
Line 146: if (!self::validateUrl($_POST['url'])) {
Line 147: throw new Exception('Invalid URL');
Line 150: $_SESSION['email_share']['field_values'] = Validator::trim($_POST);
Line 152: $valid = new Validator($_POST);
Line 153: $valid->required(['url', 'their_name', 'their_email']);
Line 154: $valid->check('title', 'Validity::length', 0, 255);
Line 155: $valid->check('url', 'Validity::length', 0, 255);
Line 156: $valid->check('their_name', 'Validity::length', 0, 255);
Line 157: $valid->check('their_email', 'Validity::email');
Line 158: $valid->check('their_email', 'Validity::length', 0, 255);
Line 159: $valid->check('message', 'Validity::length', 0, 500);
Line 165: $valid->addGeneralError('Incorrect CAPTCHA response');
Line 169: if ($valid->hasErrors()) {
Line 171: $_SESSION['email_share']['field_errors'] = $valid->getFieldErrors();
Line 172: $valid->createNotifications();
Line 206: Notification::error('The URL you provided appears invalid');

/sprout/Controllers/EmbedVideoController.php   Highlighted file source

Line 20: use Sprout\Helpers\EmbedVideo;
Line 26: * Dynamic cropping for video thumbs
Line 28: class EmbedVideoController extends Controller
Line 32: * Downloads a thumbnail from the video provider
Line 36: public function thumb($size, $type, $videoid)
Line 38: if ($type == EmbedVideo::TYPE_YOUTUBE) {
Line 39: $url = 'http://youtu.be/' . $videoid;
Line 40: } else if ($type == EmbedVideo::TYPE_VIMEO) {
Line 41: $url = 'http://vimeo.com/' . $videoid;
Line 43: throw new Exception('Unsupported video type');
Line 46: $cache_filename = APPPATH . "cache/video-{$size}-{$type}-{$videoid}.jpg";
Line 50: list($type, $width, $height, $cropX, $cropY, $quality) = File::parseSizeString($size);
Line 53: $thumb_url = EmbedVideo::getThumbFilename($url, 2);
Line 56: $thumb_url = EmbedVideo::getThumbFilename($url, 1);
Line 63: $temp_filename = APPPATH . 'temp/video-' . time() . mt_rand(0, 999) . '.jpg';
Line 72: if ($width == 0) $width = PHP_INT_MAX;
Line 75: if ($file_size[0] > $width or $file_size[1] > $height) {
Line 76: $img->resize($width, $height);
Line 81: $img->resize($width, $height);
Line 85: if ($width / $img->width > $height / $img->height) {
Line 86: $master = Image::WIDTH;
Line 91: $img->resize($width, $height, $master);
Line 92: $img->crop($width, $height, $cropY, $cropX);

/sprout/Controllers/FileController.php   Highlighted file source

Line 35: * Provides access to file and image data
Line 46: * The width and height is specified width . 'x' . height (e.g. 200x100)
Line 109: throw new Exception('Invalid image resize parameters');
Line 112: list($type, $width, $height, $crop_x, $crop_y, $quality) = $parsed_size;
Line 116: if ($width > $size_limits['width'] or $height > $size_limits['height']) {
Line 125: if ($width == 0) $width = PHP_INT_MAX;
Line 128: if ($file_size[0] > $width or $file_size[1] > $height) {
Line 129: $img->resize($width, $height);
Line 137: $img->resize($width, $height);
Line 138: $resize_dims = $img->calcResizeDims($width, $height, Image::AUTO);
Line 143: if ($width / $img->width > $height / $img->height) {
Line 144: $master = Image::WIDTH;
Line 150: $ratio = $width / $height;
Line 177: if ($master == Image::WIDTH) {
Line 178: $scale = $width / $img->width;
Line 187: if ($master == Image::WIDTH) {
Line 195: $crop_x = $scaled_x - round($width / 2);
Line 198: if ($crop_x + $width > $img->width * $scale) {
Line 199: $crop_x = floor($img->width * $scale) - $width;
Line 204: $img->resize($width, $height, $master);
Line 205: $img->crop($width, $height, $crop_y, $crop_x);
Line 297: * @param int $id ID value from files table
Line 300: public function download($id, $size = '')
Line 302: $id = (int) $id;
Line 304: $q = "SELECT filename FROM ~files WHERE id = ?";
Line 305: $filename = Pdb::q($q, [$id], 'val');
Line 348: * Looks up filenames for a list of file IDs
Line 350: * @post string ids Comma-separated list of IDs
Line 351: * @return void Outputs JSON array [file id => file name]
Line 357: $ids = preg_split('/, */', @$_POST['ids']);
Line 358: foreach ($ids as $key => &$id) {
Line 359: $id = (int) $id;
Line 360: if ($id <= 0) unset($ids[$key]);
Line 363: if (count($ids) == 0) Json::out([]);
Line 366: $where = Pdb::buildClause([['id', 'IN', $ids]], $params);
Line 367: $q = "SELECT id, filename

/sprout/Controllers/FileUploadController.php   Highlighted file source

Line 42: * @return string The code itself, if it's valid
Line 44: protected function validateCode()
Line 47: Json::error('Invalid data');
Line 63: if (empty($_POST['form_id']) or !is_string($_POST['form_id'])) {
Line 64: Json::error('Invalid data');
Line 68: Json::error('Invalid data');
Line 71: $code = $this->validateCode();
Line 73: $uri = $_POST['form_id'];
Line 77: Json::error('Invalid data');
Line 101: if (empty($_POST['form_id']) or !is_string($_POST['form_id'])) {
Line 102: Json::error('Invalid data');
Line 106: Json::error('Invalid data');
Line 109: $code = $this->validateCode();
Line 110: $uri = $_POST['form_id'];
Line 114: Json::error('Invalid data');
Line 125: $code = $this->validateCode();
Line 155: * @return void
Line 165: * @return void
Line 205: * @return void Outputs JSON
Line 231: Json::error('Invalid data');
Line 277: * Other keys provided are passed to the ajaxDragdropForm method.
Line 281: * @return void Outputs JSON
Line 293: Json::error('Invalid number of chunks uploaded');
Line 302: Json::error('Final filesize didn\'t match upload size');
Line 320: * @return void Outputs HTML
Line 448: * @return void
Line 462: * May receive two different variations on the provided POST data:
Line 466: * @return void
Line 474: die('Invalid');
Line 483: die('Invalid');
Line 492: die('Invalid');

/sprout/Controllers/LocaleController.php   Highlighted file source

Line 27: * If the get param is invalid, it is ignored

/sprout/Controllers/MultiStepFormController.php   Highlighted file source

Line 25: use Sprout\Helpers\Validator;
Line 108: * @return void
Line 126: * @return void On the final step, the save() method is called. On earlier
Line 173: * @return void A redirect is performed if the user isn't ready for the step
Line 202: * @param array $rules Each element is an array which is passed to {@see Validator::check},
Line 203: * e.g. [['first_name', 'Validity::length', 0, 20], ['last_name', 'Validity::length', 0, 20]]
Line 204: * @param mixed $valid a {@see Validator}, or null to create one on the fly. Specifying a Validator
Line 206: * @return void A redirect will occur if validation fails
Line 208: protected function validate($step, array $reqd, array $rules, Validator $valid = null)
Line 212: if (!$valid) {
Line 213: Validator::trim($_POST);
Line 214: $valid = new Validator($_POST);
Line 217: $valid->required($reqd);
Line 222: call_user_func_array([$valid, 'check'], $rule);
Line 225: if ($valid->hasErrors()) {
Line 226: $session['field_errors'] = $valid->getFieldErrors();
Line 227: $valid->createNotifications();
Line 252: * This should generally be overridden.
Line 257: $id = $this->saveData($this->table);
Line 274: * Save the data, e.g. into a database, after successful validation at the
Line 282: * e.g. ['preferences' => ['member_prefs', 'member_id']]
Line 287: * @return int|null The insert id from the newly created record,
Line 328: $id = Pdb::insert($table, $insert_data);
Line 334: $insert_data = array($link_col => $id);
Line 349: return $id;

/sprout/Controllers/PageController.php   Highlighted file source

Line 48: use Sprout\Helpers\Widgets;
Line 85: $this->viewById($node['id']);
Line 91: * The page is specified by the page id
Line 93: * @param int $id The id of the page to display
Line 95: public function viewById($id)
Line 97: $id = (int) $id;
Line 102: $where[] = 'pages.id = :page_id';
Line 103: $params['page_id'] = $id;
Line 107: $where[] = 'pages.subsite_id = :subsite_id';
Line 108: $params['subsite_id'] = SubsiteSelector::$content_id;
Line 113: $q = "SELECT pages.id, pages.name, pages.meta_keywords, pages.meta_description,
Line 114: pages.alt_browser_title, revs.id AS rev_id, pages.alt_template, pages.subsite_id,
Line 121: ON revs.page_id = pages.id
Line 128: throw new Kohana_404_Exception("Page # {$id}");
Line 132: $node = $root->findNodeValue('id', $id);
Line 136: $this->trackVisit($id);
Line 150: $conds_env = $this->widgetCondsEnvironment($page);
Line 151: $this->loadWidgets($conds_env, $page);
Line 166: * @param int $page_id The ID of the page to display
Line 167: * @param int $rev_id The ID of the revision to display.
Line 169: * or the correct approval_code for the revision must be provided.
Line 171: * If not provided, the revision must be live, or the user must be logged in as an operator.
Line 173: public function viewSpecificRev($page_id, $rev_id, $approval_code = '')
Line 175: $page_id = (int) $page_id;
Line 176: $rev_id = (int) $rev_id;
Line 179: $params = ['page_id' => $page_id, 'rev_id' => $rev_id];
Line 185: $q = "SELECT page.id, page.name, page.meta_keywords, page.meta_description, page.alt_browser_title,
Line 186: page.alt_template, page.subsite_id,
Line 187: rev.status, rev.id AS rev_id, rev.status, rev.modified_editor, rev.date_modified
Line 189: INNER JOIN ~page_revisions AS rev ON page.id = rev.page_id
Line 190: AND rev.id = :rev_id {$code_clause}
Line 191: WHERE page.id = :page_id";
Line 195: throw new Kohana_404_Exception("Page # {$page_id}, rev # {$rev_id}");
Line 210: private function trackVisit($page_id)
Line 213: $sect_id = 0;
Line 216: $sect_id = $anc[0]['id'];
Line 220: SET page_id = ?, section_page_id = ?, date_hits = CURDATE(), num = 1
Line 222: Pdb::q($q, [$page_id, $sect_id], 'count');
Line 232: * see e.g. {@see PageController::viewById} or {@see PageController::viewSpecificRev}
Line 250: Navigation::setPageNodeMatcher(new TreenodeValueMatcher('id', $page['id']));
Line 252: $this->navigation_node = Navigation::getRootNode()->findNodeValue('id', $page['id']);
Line 271: if (! UserPerms::checkPermissionsTree('pages', $page['id'])) {
Line 277: // Get list of widgets and render their content
Line 278: $conds_env = $this->widgetCondsEnvironment($page);
Line 279: $this->loadWidgets($conds_env, $page);
Line 280: $page_view->main_content = Widgets::renderArea('embedded');
Line 285: $form_view->rev_id = (int) $page['rev_id'];
Line 300: Needs::addCssInclude('SITE/page/additional_css/' . $page['id'] . '/' . strtotime($page['date_modified']) . '.css');
Line 307: $page_view->page_attrs = Page::attrs($page['id']);
Line 308: $page_view->tags = Tags::byRecord('pages', $page['id']);
Line 310: $page_view->canonical_url = Page::url($page['id']);
Line 321: * @return void Sets values in the {@see SocialMeta} helper
Line 358: private function textTranslation($page_id, $text)
Line 361: $text = ContentReplace::embedWidgets($text, 'page', $page_id);
Line 368: * Return the environment which is provided to the widget display conditions logic
Line 371: * @return array Environment which gets passed to {@see Widgets::checkDisplayConditions}
Line 373: private function widgetCondsEnvironment(array $page)
Line 376: 'page_id' => $page['id'],
Line 382: * Loads the widgets from the database for this page.
Line 384: * @param array $page The page to load widgets from
Line 386: private function loadWidgets(array $conds_env, array $page)
Line 388: $q = "SELECT area_id, type, settings, conditions, heading, template
Line 389: FROM ~page_widgets
Line 390: WHERE page_revision_id = ? AND active = 1
Line 391: ORDER BY area_id, record_order";
Line 392: $wids = Pdb::q($q, [$page['rev_id']], 'arr');
Line 394: foreach ($wids as $widget) {
Line 395: $settings = json_decode($widget['settings'], true);
Line 397: $conditions = json_decode($widget['conditions'], true);
Line 399: $result = Widgets::checkDisplayConditions($conds_env, $conditions);
Line 405: Widgets::add($widget['area_id'], $widget['type'], $settings, $widget['heading'], $widget['template']);
Line 413: public function additionalCss($page_id, $junk = null)
Line 415: $page_id = (int) $page_id;
Line 417: $q = "SELECT additional_css FROM ~pages WHERE id = ?";
Line 418: $row = Pdb::q($q, [$page_id], 'row');
Line 431: public function frontEndSearch($item_id, $relevancy, $keywords)
Line 434: $node = $root->findNodeValue('id', $item_id);
Line 440: // Collate widgets to produce page text
Line 441: $text = Page::getText($item_id);
Line 489: function review($rev_id)
Line 493: $rev_id = (int) $rev_id;
Line 506: Notification::error('Invalid approval code');
Line 511: $q = "SELECT rev.id, rev.status, rev.page_id, page.name AS page_name, page.subsite_id,
Line 512: op.id AS op_id, op.email, op.name AS op_name
Line 514: INNER JOIN ~pages AS page ON rev.page_id = page.id
Line 515: LEFT JOIN ~operators AS op ON rev.operator_id = op.id
Line 516: WHERE rev.id = ? AND rev.approval_code = ?";
Line 517: $rev = Pdb::q($q, [$rev_id, $code], 'row');
Line 519: Notification::error('Invalid revision or approval code');
Line 525: Url::redirect(Page::url($rev['page_id']));
Line 533: Page::activateRevision($rev_id);
Line 537: $url = Subsites::getAbsRoot($rev['subsite_id']) . Page::url($rev['page_id']);
Line 540: if ($rev['op_id'] > 0) {
Line 558: Pdb::update('page_revisions', ['status' => 'rejected'], ['id' => $rev_id]);
Line 560: $url = Subsites::getAbsRoot($rev['subsite_id']) . Page::url($rev['page_id']);
Line 563: if ($rev['op_id'] > 0) {

/sprout/Controllers/ResultController.php   Highlighted file source

Line 28: * @return void Outputs HTML directly
Line 42: * @return void Outputs HTML directly

/sprout/Controllers/SearchController.php   Highlighted file source

Line 29: * Performs site-wide searches
Line 40: * Performs a site-wide search for the 'q' term specified via the query string.
Line 44: * @return void Outputs HTML directly, containing the search results
Line 63: throw new Exception("Invalid SearchHandler registered");
Line 76: // No valid keywords specified
Line 107: $resp = $ctlr->frontEndSearch($row['record_id'], $row['relevancy'], $keywords);

/sprout/Controllers/SeoController.php   Highlighted file source

Line 34: * @return void Outputs plain text after setting the appropriate content-type header
Line 45: // Include sidemap rule
Line 53: * @return void Outputs plain text after setting the appropriate content-type header
Line 65: * @return void Outputs XML directly
Line 82: * @return void Outputs XML after setting the appropriate content-type header
Line 97: * @return void Outputs XML directly

/sprout/Controllers/Tinymce4Controller.php   Highlighted file source

Line 53: if (!in_array($type, array('image', 'video', 'library'))) {
Line 54: throw new Exception("Must be 'image', 'video', or 'library'");
Line 67: } else if ($type == 'video') {
Line 68: $view->search_label = 'Search for a video';
Line 69: $view->upload_label = 'Upload a video';
Line 96: $q = "SELECT cat.id, cat.name, GROUP_CONCAT(file.filename ORDER BY RAND() SEPARATOR '|') AS filenames
Line 98: INNER JOIN ~{$joiner_table} AS joiner ON joiner.cat_id = cat.id
Line 99: INNER JOIN ~files AS file ON joiner.file_id = file.id
Line 101: GROUP BY cat.id
Line 124: public function imageList($category_id)
Line 127: $category_id = (int) $category_id;
Line 129: $cat_name = Category::name('files', $category_id);
Line 133: $q = "SELECT file.id, file.name, file.filename
Line 135: INNER JOIN ~{$joiner_table} AS joiner ON joiner.file_id = file.id
Line 136: WHERE joiner.cat_id = ? AND file.name != '' AND file.type = ?
Line 137: GROUP BY file.id
Line 140: $res = Pdb::q($q, [$category_id, FileConstants::TYPE_IMAGE], 'pdo');
Line 147: $view->link_attrs = array('category_id' => $category_id);
Line 168: $q = "SELECT id, name, filename
Line 196: public function imageSize($file_id)
Line 199: $file_id = (int) $file_id;
Line 200: $_GET['category_id'] = (int) @$_GET['category_id'];
Line 204: $q = "SELECT id, name, filename FROM ~files WHERE id = ?";
Line 205: $row = Pdb::q($q, [$file_id], 'row');
Line 222: if (!empty($_GET['category_id'])) {
Line 223: $up_url = 'SITE/tinymce4/image_list/' . $_GET['category_id'];
Line 333: throw new Exception('Invalid library class');
Line 378: * Show a gallery of video categories
Line 380: public function video()
Line 386: $q = "SELECT cat.id, cat.name, COUNT(file.id) AS num_files
Line 388: INNER JOIN ~{$joiner_table} AS joiner ON joiner.cat_id = cat.id
Line 389: INNER JOIN ~files AS file ON joiner.file_id = file.id
Line 391: GROUP BY cat.id
Line 394: $res = Pdb::q($q, [FileConstants::TYPE_VIDEO], 'pdo');
Line 396: $view = new View('sprout/tinymce4/video_cat');
Line 397: $view->toolbar = self::initToolbar('video');
Line 403: $outer->page_title = 'Insert video - choose category';
Line 412: * Show a gallery of videos for a given category
Line 414: public function videoList($category_id)
Line 417: $category_id = (int) $category_id;
Line 419: $cat_name = Category::name('files', $category_id);
Line 423: $q = "SELECT file.id, file.name, file.filename
Line 425: INNER JOIN ~files AS file ON joiner.file_id = file.id
Line 427: WHERE joiner.cat_id = ?
Line 428: GROUP BY file.id
Line 431: $res = Pdb::q($q, [FileConstants::TYPE_VIDEO, $category_id], 'pdo');
Line 433: $view = new View('sprout/tinymce4/video_list');
Line 434: $view->toolbar = self::initToolbar('video');
Line 435: $view->videos = $res;
Line 436: $view->up_url = 'SITE/tinymce4/video';
Line 438: $view->link_attrs = ['category_id' => $category_id];
Line 442: $outer->page_title = 'Insert video - ' . $cat_name;
Line 451: * Show video search results
Line 453: public function videoSearch()
Line 459: $q = "SELECT id, name, filename
Line 465: $res = Pdb::q($q, [FileConstants::TYPE_VIDEO, $safe_key, $safe_key], 'pdo');
Line 467: $view = new View('sprout/tinymce4/video_list');
Line 468: $view->toolbar = self::initToolbar('video');
Line 470: $view->videos = $res;
Line 476: $outer->page_title = 'Insert video';
Line 504: case 'video':
Line 505: $view->f_type = FileConstants::TYPE_VIDEO;
Line 534: cat.id,
Line 539: ON joiner.cat_id = cat.id
Line 541: ON joiner.file_id = file.id
Line 544: GROUP BY cat.id

/sprout/Controllers/WorkerJobController.php   Highlighted file source

Line 31: * @param int $job_id ID of the job to run
Line 34: public function run($job_id, $job_code)
Line 36: $job_id = (int) $job_id;
Line 38: $q = "SELECT class_name, args FROM ~worker_jobs WHERE id = ? AND code = ?";
Line 39: $job = Pdb::query($q, [$job_id, $job_code], 'row');
Line 41: Worker::start($job_id);

/sprout/core/Bootstrap.php   Highlighted file source

Line 17: * $Id: Bootstrap.php 4409 2009-06-06 00:48:26Z zombor $
Line 45: if (PHP_VERSION_ID < 80000) {
Line 59: // that avoids lots of code paths which use a database.

/sprout/core/Event.php   Highlighted file source

Line 19: * $Id: Event.php 4390 2009-06-04 03:05:36Z zombor $
Line 114: * @return void
Line 181: * @return void
Line 209: * @return void

/sprout/core/Kohana.php   Highlighted file source

Line 28: * Provides Kohana-specific helper functions. This is where the magic happens!
Line 30: * $Id: Kohana.php 4372 2009-05-28 17:00:34Z ixmatus $
Line 79: * @return void
Line 188: // Start validation of the controller
Line 235: // Do not allow access to hidden methods
Line 276: // Add a valid path
Line 387: // Invalid config file
Line 388: die('Your Kohana application configuration file is not valid.');
Line 427: * @return void
Line 483: // Cache is invalid, delete it
Line 543: * @return void
Line 566: * @return void
Line 584: * @return void
Line 644: * @return void
Line 659: * @return void
Line 673: * @return int Record ID
Line 696: // Extract private attributes from Exception which serialize() would provide
Line 719: $log_id = $conn->lastInsertId();
Line 725: return $log_id;
Line 732: * @return void
Line 737: throw new Exception('PHP7 - Exception handler was invoked with an invalid exception object type: ' . get_class($exception));
Line 741: $log_id = self::logException($exception);
Line 743: $log_id = 0;
Line 1127: * @return void if the key is not found
Line 1177: * @return void
Line 1350: // Invalid comparison
Line 1575: * @return void
Line 1635: * @return void

/sprout/core/utf8.php   Highlighted file source

Line 17: * provides multi-byte aware replacement string functions.
Line 33: * $Id: utf8.php 3769 2008-12-15 00:48:56Z zombor $

/sprout/Exceptions/SignatureInvalidException.php   Highlighted file source

Line 20: class SignatureInvalidException extends \Exception

/sprout/Exceptions/ValidationException.php   Highlighted file source

Line 19: * Exception thrown by Validity::* methods when validation fails
Line 21: class ValidationException extends Exception

/sprout/Helpers/Admin.php   Highlighted file source

Line 24: * Sorter for widgets
Line 26: function _widgetSort($a, $b) {
Line 27: $a = Widgets::instantiate($a);
Line 28: $b = Widgets::instantiate($b);
Line 44: 'email' => 'Email address is not valid',
Line 54: '.+' => 'Incorrect value provided',
Line 76: if (! $message) $message = 'Invalid value provided.';
Line 93: $class = Enc::id('field-error-' . $field_name);
Line 113: * Shows a UI for the list of widgets, for editing
Line 116: * @param WidgetArea $area The area that is being edited
Line 117: * @param array $curr_widgets A list of the widgets currently being used, in order, as db rows with keys:
Line 122: * heading string HTML H2 rendered front-end within widget
Line 123: * @param boolean $enable_all Toggle whether all the widgets are enabled by default (defaults to true)
Line 125: public static function widgetList($field_name, WidgetArea $area, $curr_widgets, $enable_all = true)
Line 127: Needs::fileGroup('widget_list');
Line 129: if ($curr_widgets == null) {
Line 130: $curr_widgets = [];
Line 133: $widget_list_id = 'wl-' . Enc::id($field_name);
Line 137: echo " var list = new widget_list('", Enc::js($field_name), "');\n";
Line 138: foreach ($curr_widgets as $widget) {
Line 139: $inst = Widgets::instantiate($widget['type']);
Line 142: if (!$enable_all) $widget['active'] = 0;
Line 145: 'type' => $widget['type'],
Line 147: 'settings' => $widget['settings'],
Line 148: 'conditions' => $widget['conditions'],
Line 149: 'active' => (bool)$widget['active'],
Line 150: 'heading' => @$widget['heading'],
Line 151: 'template' => @$widget['template'],
Line 154: echo " list.add_widget(", json_encode($add_opts), ");\n";
Line 157: echo " $('#{$widget_list_id}').bind('add-widget', function(e, widget_name, english_name) {\n";
Line 158: echo " list.add_widget({ type: widget_name, label: english_name, settings: '', active: true });\n";
Line 165: echo "<div id=\"{$widget_list_id}\" class=\"widget-list\">\n";
Line 167: echo "<div id=\"{$widget_list_id}\" class=\"widget-list all-collapsed\">\n";
Line 169: echo '<div class="widgets-sel"></div>';
Line 170: echo '<div class="widgets-empty">This area does not have any content blocks. Click the button below to add a content block:</div>';
Line 172: echo "<input type=\"checkbox\" id=\"{$widget_list_id}--add-btn\" class=\"giant-popup-checkbox -vis-hidden\">";
Line 178: } else if ($field_name == "sidebar") {
Line 179: $add_tooltip = 'Add a block of content to the sidebar.';
Line 183: echo "<label for=\"{$widget_list_id}--add-btn\" class=\"button button-green button-regular button-block add-content-block-button\">Add content block";
Line 200: echo "<label for=\"{$widget_list_id}--add-btn\" class=\"giant-popup-close-button icon-before icon-close\">Close</label>";
Line 204: $tiles = Register::getWidgetTiles($area->getName());
Line 236: foreach ($tile['widgets'] as $widg => $name) {
Line 238: $inst = Widgets::instantiate($widg);
Line 241: echo '<li><a class="widget-list-new-widget" href="javascript:;" data-name="', Enc::html($widg), '" title="' . Enc::html($desc) . '">', Enc::html($name), '</a></li>';
Line 266: * @param int $selected The id of the page to select
Line 267: * @param int $exclude The id of the page to exclude from the list
Line 268: * @param int $subsite_id The subsite of pages to show. Defaults to the current admin subsite
Line 269: * @param string $top_text Text for the top (id 0) item
Line 271: public static function pageDropdown($field_name, $selected = null, $exclude = null, $subsite_id = null, $top_text = 'None (top level page)')
Line 286: * @return void Outputs HTML directly
Line 290: $admin_perms = AdminPerms::checkPermissionsTree('pages', $node['id']);
Line 302: if (self::getRecordId() == $node['id']) {
Line 304: } else if ($node->findNodeValue('id', self::getRecordId())) {
Line 311: echo "<li class=\"{$class}\" data-id=\"{$node['id']}\">";
Line 315: $url = str_replace('%%', $node['id'], $action['url']);
Line 326: $url = str_replace('%%', $node['id'], $action['url']);
Line 373: foreach ($dataset[$primary] as $idx => $value) {
Line 376: $row[$name] = $dataset[$name][$idx];
Line 399: * If the $field parameter is provided, multiple checkboxes with the same field name will be rendered.
Line 401: * $selected should be an array of selected checkbox ids.
Line 403: * If the $field parameter is omitted (null), multiple checkboxes widh different field names will be rendered.
Line 425: foreach ($data as $id => $name) {
Line 427: $val = $id;
Line 428: $html_id = Enc::id($field . $val);
Line 429: $checked = @in_array($id, $selected);
Line 432: $field = $id;
Line 433: $html_id = Enc::id($field . $val);
Line 435: $checked = (bool) @$selected[$id];
Line 440: echo '<input type="checkbox" name="', Enc::html($field), '" value="', Enc::html($val), '" id="', $html_id, '" checked>';
Line 442: echo '<input type="checkbox" name="', Enc::html($field), '" value="', Enc::html($val), '" id="', $html_id, '">';
Line 444: echo "<label for=\"{$html_id}\">";
Line 473: * @param $data An array of key-value pairs, with the keys being the id of the category, and the value being the name.
Line 474: * @param $selected An array of selected category ids.
Line 503: foreach ($data as $id => $name) {
Line 504: $html_id = Enc::id($field . $id);
Line 505: $checked = @in_array($id, $selected);
Line 509: echo '<input type="', $type, '" name="', Enc::html($field), '" value="', Enc::html($id), '" id="', $html_id, '" checked>';
Line 511: echo '<input type="', $type, '" name="', Enc::html($field), '" value="', Enc::html($id), '" id="', $html_id, '">';
Line 513: echo "<label for=\"{$html_id}\">";
Line 535: echo '<div class="field-input"><input type="text" id="onthefly-catadd" spellcheck="true" class="textbox" placeholder="Category name"></div>';
Line 538: echo '<button id="onthefly-catadd-button" type="button" class="button button-green button-small onthefly-catadd icon-after icon-add">Add</button>';
Line 556: $field_id = Enc::id($field);
Line 567: foreach ($data as $id => $name) {
Line 569: if ($id == $selected) {
Line 570: echo '<input type="radio" name="', Enc::html($field), '" value="', Enc::html($id), '" id="', $field_id, $id, '" checked>';
Line 572: echo '<input type="radio" name="', Enc::html($field), '" value="', Enc::html($id), '" id="', $field_id, $id, '">';
Line 574: echo "<label for=\"{$field_id}{$id}\">";
Line 612: <div id="multiedit-attrs">
Line 615: <select name="m_name" id="custom-attribute" class="dropdown">
Line 628: <input type="hidden" name="m_value" value="">
Line 634: function attribute_editor($div, data, idx) {
Line 637: $div.find('.value').html('<input type="hidden" name="multiedit_attrs[' + idx + '][value]" value="">');
Line 645: $outer.find('[name=value]').attr('name', 'multiedit_attrs[' + idx + '][value]');
Line 726: echo '<input type="checkbox" id="open-sub-nav-1" class="giant-popup-checkbox -vis-hidden">';
Line 788: * When in the admin, return the record id being added or edited.
Line 790: * If used outside of the admin, behaviour is undefined
Line 792: public static function getRecordId()
Line 809: $op_id = AdminAuth::getLocalId();
Line 810: if ($op_id === 0) return true;
Line 812: $q = "SELECT completed_tours FROM ~operators WHERE id = ?";
Line 813: $op = Pdb::query($q, [$op_id], 'row');
Line 827: $op_id = AdminAuth::getLocalId();
Line 828: if ($op_id === 0) return;
Line 830: $q = "UPDATE ~operators SET completed_tours = TRIM(',' FROM CONCAT(completed_tours, ',', ?)) WHERE id = ?";
Line 831: Pdb::query($q, [$tour_name, $op_id], 'null');
Line 851: * @param int $record_id DB record ID
Line 852: * @return array If locked; has keys 'id', 'operator_name', 'lock_key', 'date_modified'
Line 855: public static function getLock($ctlr, $record_id)
Line 857: $record_id = (int) $record_id;
Line 859: $q = "SELECT id, operator_name, lock_key, date_modified
Line 861: WHERE ctlr = ? AND record_id = ?
Line 864: $row = Pdb::q($q, [$ctlr, $record_id], 'row');
Line 871: Admin::forceUnlock($row['id']);
Line 882: * @param int $record_id The record ID
Line 884: * @return int Lock id
Line 886: public static function lock($ctlr, $record_id)
Line 896: $update_data['record_id'] = (int) $record_id;
Line 905: $lock_id = Pdb::insert('admin_locks', $update_data);
Line 910: return $lock_id;
Line 916: * @param int $lock_id
Line 917: * @return void
Line 919: public static function pingLock($lock_id)
Line 921: $lock_id = (int) $lock_id;
Line 924: Pdb::update('admin_locks', $update_data, ['id' => $lock_id]);
Line 931: public static function forceUnlock($lock_id)
Line 933: Pdb::delete('admin_locks', ['id' => (int) $lock_id]);
Line 941: * @param int $record_id Will refine lock removal by record id
Line 943: public static function unlock($ctlr = null, $record_id = null)
Line 952: if ($record_id) $where['record_id'] = $record_id;
Line 960: * Return a unique key for identifying a session.
Line 961: * This will be constant even if the session id changes, although it's nuked if you log out.
Line 974: $q = "SELECT id, date_modified FROM ~admin_locks";
Line 979: Admin::forceUnlock($row['id']);
Line 990: * @param string $class_name A class name, or shorthand identifier

/sprout/Helpers/AdminAuth.php   Highlighted file source

Line 24: * Provides user authentication functions for the admin
Line 61: if (!empty($_SESSION[self::KEY]['login_id'])) {
Line 80: $q = "SELECT id, password, password_algorithm AS algorithm, password_salt AS salt, tfa_method
Line 93: INNER JOIN ~operators_cat_list AS cat ON joiner.cat_id = cat.id
Line 94: WHERE joiner.operator_id = ?";
Line 95: $ip_lists = Pdb::q($q, [$admin['id']], 'col');
Line 116: // If the operator has 2FA enabled then don't log them in yet, but the id is required
Line 118: $_SESSION[self::KEY]['tfa_id'] = $admin['id'];
Line 120: $_SESSION[self::KEY]['login_id'] = $admin['id'];
Line 130: self::changePassword($password, $admin['id']);
Line 138: * Checks the password on the database matches the one provided
Line 141: public static function checkPassword($password, $operator_id = null)
Line 143: $operator_id = (int) $operator_id;
Line 145: if (! $operator_id) {
Line 148: $operator_id = $_SESSION[self::KEY]['login_id'];
Line 153: WHERE id = ?";
Line 155: $op = Pdb::q($q, [$operator_id], 'row');
Line 169: * Stub function for future development using OpenID
Line 171: * @param string $openid The openid username url
Line 174: public static function processOpenid($openid)
Line 201: $uid = $details['uid'];
Line 205: $_SESSION[self::KEY]['login_id'] = $uid;
Line 236: // Determine user ID and add new user
Line 237: $uid = 99999;
Line 238: $q = "SELECT MAX(id) FROM ~operators";
Line 239: $max_op_id = (int) Pdb::q($q, [], 'val');
Line 240: $uid = max($uid, $max_op_id);
Line 243: $uid = max($uid, $user['uid']);
Line 245: ++$uid;
Line 247: $users[$username] = ['uid' => $uid, 'hash' => $pass_hash, 'salt' => $pass_salt];
Line 255: * Process a remote (developer) login, as provided by the external web service
Line 275: // $_SESSION[self::KEY]['login_id'] = $uid;
Line 282: * Sets the password for a operator, or the current operator if a operator-id is not specified.
Line 285: * @param int $operator_id The operator to update. If not specified, the currently logged in operator is used.
Line 287: public static function changePassword($new_password, $operator_id = null)
Line 289: $operator_id = (int) $operator_id;
Line 291: if (! $operator_id) {
Line 294: $operator_id = $_SESSION[self::KEY]['login_id'];
Line 306: Pdb::update('operators', $data, ['id' => $operator_id]);
Line 371: * Returns the id of the currently logged in operator
Line 373: public static function getId()
Line 376: return @$_SESSION[self::KEY]['login_id'];
Line 381: * Fetches the ID of current operator if and only if they're a local operator, otherwise 0.
Line 383: * @return int An ID if a local operator, 0 otherwise
Line 385: public static function getLocalId()
Line 388: return self::hasDatabaseRecord() ? @$_SESSION[self::KEY]['login_id'] : 0;
Line 393: * Gets the id, name, username and email of the currently logged in operator.
Line 394: * N.B. the id will be 0 for remote users
Line 395: * @return array Under normal circumstances, with keys 'id', 'name', 'username', 'email' and 'editor'
Line 403: $q = "SELECT id, name, username, email, '' AS editor
Line 405: WHERE id = ?";
Line 406: return Pdb::q($q, [$_SESSION[self::KEY]['login_id']], 'row');
Line 414: 'id' => $_SESSION[self::KEY]['login_id'],
Line 428: * @param int $category_id The category to check
Line 430: public static function inCategory($category_id)
Line 434: if ($_SESSION[self::KEY]['login_id'] == false) return false;
Line 437: $category_id = (int) $category_id;
Line 439: if (array_key_exists($category_id, static::$category_cache)) {
Line 440: return static::$category_cache[$category_id];
Line 445: WHERE operator_id = ? AND cat_id = ?";
Line 446: $hascat = Pdb::q($q, [$_SESSION[self::KEY]['login_id'], $category_id], 'arr');
Line 448: if (count($hascat) == 0) static::$category_cache[$category_id] = false;
Line 449: else static::$category_cache[$category_id] = true;
Line 451: return static::$category_cache[$category_id];
Line 462: if ($_SESSION[self::KEY]['login_id'] == false) return array();
Line 468: $q = "SELECT cat_id
Line 470: WHERE operator_id = ?";
Line 471: return Pdb::q($q, [$_SESSION[self::KEY]['login_id']], 'col');
Line 476: * Returned as an array of id => name
Line 480: $q = "SELECT id, name FROM ~operators_cat_list ORDER BY name";
Line 498: * Does the record-id for this login correspond to a local database record?
Line 510: * Get the ID of the 'Primary administrators' category
Line 517: public static function getPrimaryCategoryId()
Line 522: $q = Pdb::prepare("SELECT id FROM ~operators_cat_list WHERE access_operators = 1 ORDER BY id LIMIT 1");

/sprout/Helpers/AdminDashboard.php   Highlighted file source

Line 57: $q = "SELECT firstrun FROM ~operators WHERE id = ?";
Line 58: $firstrun = Pdb::query($q, [AdminAuth::getId()], 'val');
Line 86: SELECT CONCAT(?, t.id) AS id, t.name, '{$name}' AS type, DATE_FORMAT(t.date_added, '%W %D') AS d, t.date_added
Line 126: $q = "SELECT pages.id, pages.name, DATE_FORMAT(page_revisions.date_modified, '%d/%m/%Y') AS date_modified, page_revisions.modified_editor
Line 128: INNER JOIN ~pages AS pages ON page_revisions.page_id = pages.id
Line 129: WHERE page_revisions.status = ? AND subsite_id = ?
Line 130: GROUP BY pages.id

/sprout/Helpers/AdminPerms.php   Highlighted file source

Line 23: * Provides user permisison functions for the admin
Line 36: * @param int $id The id of the record to check
Line 39: public static function checkPermissionsTree($table, $id)
Line 44: if (! $_SESSION['admin']['login_id']) return false;
Line 50: $access_groups = self::getAccessableGroups($table, $id);
Line 55: $conditions = ['operator_id' => $_SESSION['admin']['login_id'], ['cat_id', 'IN', $access_groups]];
Line 74: * $cat_ids = AdminPerms::getAccessableGroups('pages', 10);
Line 77: * @param int $id The ID of the record to get permissions for
Line 81: public static function getAccessableGroups($table, $id)
Line 84: if ($id == 0) {
Line 90: $q = "SELECT tbl.parent_id, tbl.admin_perm_type, perms.category_id
Line 92: LEFT JOIN ~{$single}_admin_permissions AS perms ON perms.item_id = tbl.id
Line 93: WHERE tbl.id = ?";
Line 94: $res = Pdb::q($q, [$id], 'arr');
Line 104: return self::getAccessableGroups($table, $res[0]['parent_id']);
Line 108: // Grab the category IDs from the resultset fetched earlier
Line 111: if ($row['category_id']) {
Line 112: $items[] = $row['category_id'];
Line 140: if (empty($_SESSION['admin']['login_id'])) return;
Line 155: INNER JOIN ~operators_cat_join AS joiner ON cat.id = joiner.cat_id
Line 156: WHERE joiner.operator_id = ?";
Line 157: $res = Pdb::q($q, [$_SESSION['admin']['login_id']], 'pdo');
Line 180: * Gets all permitted subsite IDs for this user.
Line 182: * This function will return an array of subsite IDs.
Line 201: if (empty($_SESSION['admin']['login_id'])) return self::$subsites_permitted;
Line 220: $where = Pdb::buildClause([['id', 'IN', $cats]], $params);
Line 221: $admin_id = AdminAuth::getId();
Line 238: $where = Pdb::buildClause([['operatorcategory_id', 'IN', $cats]], $params);
Line 239: $q = "SELECT subsite_id
Line 245: foreach ($subs_ops as $subsite_id) {
Line 246: self::$subsites_permitted[$subsite_id] = true;
Line 256: public static function canAccessSubsite($subsite_id)
Line 259: return @self::$subsites_permitted[$subsite_id];
Line 271: Pdb::validateIdentifier($access_flag);
Line 275: INNER JOIN ~operators_cat_join AS joiner ON joiner.operator_id = op.id
Line 276: INNER JOIN ~operators_cat_list AS cat ON joiner.cat_id = cat.id
Line 278: GROUP BY op.id
Line 279: ORDER BY op.id";
Line 294: if (! $_SESSION['admin']['login_id']) return false;
Line 315: $q = "SELECT cats.id, cats.default_allow
Line 317: INNER JOIN ~operators_cat_join AS joiner ON cats.id = joiner.cat_id
Line 318: WHERE joiner.operator_id = ?";
Line 319: $res = Pdb::q($q, [AdminAuth::getId()], 'arr');
Line 326: // Grab the ids, and also find the highest value for the default field
Line 327: $cat_ids = array();
Line 330: $cat_ids[] = $row['id'];
Line 340: $conditions = [['operatorcategory_id', 'IN', $cat_ids], 'controller' => $controller];
Line 365: if (! $_SESSION['admin']['login_id']) return array();
Line 370: $q = "SELECT cats.id, cats.default_allow
Line 372: INNER JOIN ~operators_cat_join AS joiner ON joiner.cat_id = cats.id
Line 373: WHERE joiner.operator_id = ?";
Line 374: $res = Pdb::q($q, [AdminAuth::getId()], 'arr');
Line 381: // Grab the ids, and also find the highest value for the default field
Line 382: $cat_ids = array();
Line 385: $cat_ids[] = $row['id'];
Line 391: $conditions = [['operatorcategory_id', 'IN', $cat_ids], ['controller', 'IN', $controllers]];
Line 406: // If the default is "allow", add any controllers which didn't return a result
Line 466: * @return array Categories as id => name
Line 488: $q = "SELECT cat.id, cat.name
Line 490: INNER JOIN ~operatorcategory_manage_categories AS manage ON manage.manage_category_id = cat.id
Line 491: INNER JOIN ~{$joiner_table} AS joiner ON manage.operatorcategory_id = joiner.cat_id
Line 492: WHERE joiner.operator_id = ?
Line 494: return Pdb::q($q, [AdminAuth::getId()], 'map');
Line 501: public static function canEditOperator($operator_id)
Line 512: $record_cats = Category::categoryList('operators', $operator_id);
Line 520: foreach ($manage_cats as $id => $name) {
Line 521: if (in_array($id, $record_cats)) return true;

/sprout/Helpers/AdminSeo.php   Highlighted file source

Line 30: * Provide Search Engine Optimisation functionality
Line 41: public static $seo_considerations = [];
Line 49: * @return void
Line 61: * @return void
Line 73: * @return void
Line 87: * @return void
Line 128: * @return void Sets class var directly
Line 287: $view->seo_considerations = self::$seo_considerations;
Line 297: * @return void Updates result arrays directly
Line 324: * @return void Updates result arrays directly
Line 342: * @return void Updates result arrays directly
Line 352: self::$seo_considerations[] = sprintf('Your sentences contain an average of %u words. Aim for an average maximum of %u words.', $avg, $words);
Line 360: * @return void Updates result arrays directly
Line 387: self::$seo_considerations[] = sprintf('Your topic "%s" contains <a href="https://en.wikipedia.org/wiki/Stop_words" target="_blank">stop words</a>. This may or may not be wise depending on the circumstances.', self::$topic);
Line 395: * @return void Updates result arrays directly
Line 416: self::$seo_considerations[] = 'The URL slug contains <a href="https://en.wikipedia.org/wiki/Stop_words" target="_blank">stop words</a>. This may or may not be wise depending on the circumstances.';
Line 440: * @return void Updates result arrays directly
Line 447: self::$seo_considerations[] = 'Content contains no links. Try linking to other pages within your site of related content.';
Line 470: self::$seo_considerations[] = 'Try linking to pages of related topics within your site.';
Line 475: self::$seo_problems[] = 'Avoid generic "read more" link labels. Give labels that help users confidently predict what the next page will be.';
Line 483: * @return void Updates result arrays directly
Line 494: self::$seo_problems[] = 'Avoid using Bold styling as headings. Use heading styles: <strong>H</strong> buttons in the tool-bar.';
Line 502: self::$seo_considerations[] = 'Use headings to break your content into sections for easier reading.';

/sprout/Helpers/Archive.php   Highlighted file source

Line 40: * @return void
Line 55: // Validate the driver
Line 90: // Do not add hidden files or directories

/sprout/Helpers/Auth.php   Highlighted file source

Line 17: use InvalidArgumentException;
Line 21: * Provides user authentication functions for the admin
Line 79: throw new InvalidArgumentException('Read-only password algorithm specified');

/sprout/Helpers/BbCode.php   Highlighted file source

Line 26: * @param array $tags Optional array of tags names (e.g. 'b') to process. Provide NULL for defaults (b, i, code, url)
Line 54: * @param array $tags Optional array of tags names (e.g. 'b') to process. Provide NULL for defaults (b, i, code, url)
Line 60: $text = Text::widont($text);

/sprout/Helpers/Cache.php   Highlighted file source

Line 25: * Provides a driver-based interface for finding, creating, and deleting cached
Line 26: * resources. Caches are identified by a unique string. Tagging of caches is
Line 27: * also supported, and caches can be found and deleted by id or tag.
Line 61: * Loads the configured driver and validates it.
Line 64: * @return void
Line 101: // Validate the driver
Line 121: * Fetches a cache by id. NULL is returned when a cache item is not found.
Line 123: * @param string cache id
Line 126: public function get($id)
Line 128: // Sanitize the ID
Line 129: $id = $this->sanitizeId($id);
Line 131: return $this->driver->get($id);
Line 147: * Set a cache item by id. Tags may also be added and a custom lifetime
Line 150: * @param string unique cache id
Line 156: function set($id, $data, $tags = NULL, $lifetime = NULL)
Line 161: // Sanitize the ID
Line 162: $id = $this->sanitizeId($id);
Line 170: return $this->driver->set($id, $data, (array) $tags, $lifetime);
Line 174: * Delete a cache item by id.
Line 176: * @param string cache id
Line 179: public function delete($id)
Line 181: // Sanitize the ID
Line 182: $id = $this->sanitizeId($id);
Line 184: return $this->driver->delete($id);
Line 211: * @param string cache id
Line 214: protected function sanitizeId($id)
Line 217: return str_replace(array('/', '\\', ' '), '_', $id);

/sprout/Helpers/Captcha.php   Highlighted file source

Line 52: if (!class_exists($class_name)) throw new Exception('Invalid class');
Line 59: * @return void Calls echo directly

/sprout/Helpers/Category.php   Highlighted file source

Line 16: use InvalidArgumentException;
Line 27: * Returns the id or NULL on failure.
Line 44: * Returns the id, or NULL if not found.
Line 64: $q = "SELECT id FROM ~{$table_cat} WHERE {$where}";
Line 75: * Returns the id or NULL on failure.
Line 83: $id = self::lookup($table, $name, $case_sensitive);
Line 85: if (! $id) {
Line 86: $id = self::create($table, $name);
Line 89: return $id;
Line 94: * Get the name of a category based on the category id
Line 98: * @param string $id The ID of the category to get the name of
Line 101: public static function name($table, $id)
Line 103: $id = (int) $id;
Line 107: $q = "SELECT name FROM ~{$table_cat} WHERE id = ?";
Line 109: return Pdb::q($q, [$id], 'val');
Line 119: * @throws InvalidArgumentException If the table name is not a valid identifier
Line 125: Pdb::validateIdentifier($table); // if this is valid then return value will be
Line 133: * @throws InvalidArgumentException If the table name is not a valid identifier
Line 139: Pdb::validateIdentifier($table);
Line 147: * @throws InvalidArgumentException If the table name is not a valid identifier
Line 149: * @return string Joiner column name, e.g. 'article_id'
Line 153: Pdb::validateIdentifier($table);
Line 154: return Inflector::singular($table) . '_id';
Line 161: * @throws InvalidArgumentException If the table name is not a valid identifier
Line 167: if ($table == '') throw new InvalidArgumentException();
Line 169: Pdb::validateIdentifier($table);
Line 177: * @param int $record_id The id in the main table.
Line 178: * @param int $category_id The id in the category table.
Line 181: public static function insertInto($table, $record_id, $category_id)
Line 184: $record_col = Inflector::singular($table) . '_id';
Line 185: $category_col = 'cat_id';
Line 188: $update_data[$record_col] = $record_id;
Line 189: $update_data[$category_col] = $category_id;
Line 206: * @param int $record_id The id in the main table.
Line 207: * @param int $category_id The id in the category table.
Line 209: public static function removefrom($table, $record_id, $category_id)
Line 212: $record_col = Inflector::singular($table) . '_id';
Line 213: $category_col = 'cat_id';
Line 216: $conditions[$record_col] = $record_id;
Line 217: $conditions[$category_col] = $category_id;
Line 234: * @param int $record_id The id in the main table.
Line 235: * @param int $category_id The id in the category table.
Line 237: public static function contains($table, $record_id, $category_id)
Line 239: $record_id = (int) $record_id;
Line 240: $category_id = (int) $category_id;
Line 243: $record_col = Inflector::singular($table) . '_id';
Line 244: $category_col = 'cat_id';
Line 248: $res = Pdb::q($q, [$record_id, $category_id], 'arr');
Line 257: * Return an array of IDs of records in a given category.
Line 261: * @param int $category_id The id in the category table.
Line 263: public static function recordList($table, $category_id)
Line 265: $category_id = (int) $category_id;
Line 268: $record_col = Inflector::singular($table) . '_id';
Line 269: $category_col = 'cat_id';
Line 271: $q = "SELECT {$record_col} AS id FROM ~{$table_joiner} WHERE {$category_col} = ?";
Line 272: return Pdb::q($q, [$category_id], 'col');
Line 277: * Return an array of IDs of categories a record is in.
Line 281: * @param int $record_id The id in the main table.
Line 283: public static function categoryList($table, $record_id)
Line 285: $record_id = (int) $record_id;
Line 288: $record_col = Inflector::singular($table) . '_id';
Line 290: $q = "SELECT cat_id AS id FROM ~{$table_joiner} WHERE {$record_col} = ?";
Line 291: return Pdb::q($q, [$record_id], 'col');

/sprout/Helpers/ColModifierActionLogData.php   Highlighted file source

Line 17: * Tries to extract a name from an action log entry to display with an ID
Line 33: $q = "SELECT record_table, record_id, data FROM ~history_items WHERE id = ?";
Line 36: $out = $row['record_id'];

/sprout/Helpers/ColModifierContentSubscription.php   Highlighted file source

Line 4: use InvalidArgumentException;
Line 15: * @param int $record_id
Line 17: public function modify($subscription_id, $field_name)
Line 19: $subscription = Pdb::get('content_subscriptions', $subscription_id);
Line 23: } catch (InvalidArgumentException $ex) {

/sprout/Helpers/ColModifierImage.php   Highlighted file source

Line 30: return '<img src="' . Enc::html(File::resizeUrl($val, 'c80x80')) . '" width="80" height="80" alt="">';

/sprout/Helpers/ColModifierSubRecordCount.php   Highlighted file source

Line 33: * singular name followed by _id, e.g. if $table is 'galleries' then $column is usually 'gallery_id'
Line 37: Pdb::validateIdentifier($table);
Line 38: Pdb::validateIdentifier($column);

/sprout/Helpers/Constants.php   Highlighted file source

Line 156: 'avi' => 'video/vnd.avi',
Line 161: 'flv' => 'video/x-flv',
Line 166: 'mov' => 'video/quicktime',
Line 169: 'mpeg' => 'video/mpeg',
Line 170: 'mpg' => 'video/mpeg',
Line 175: 'ogv' => 'video/ogg',
Line 179: 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
Line 186: 'webm' => 'video/webm',
Line 202: 'event', 'extra_page', 'ext_video', 'email_share',

/sprout/Helpers/ContentReplace.php   Highlighted file source

Line 27: public static $preloaded_widgets = array();
Line 34: * $html = Blogs::getBlogPost($post_id);
Line 64: * Replace links to internal pages in the format page/view_by_id/... with the page's friendly url
Line 68: return preg_replace_callback('!<a ([^>]*?)href="page/view_by_id/([0-9]+)"!', array(__CLASS__, '_intlinks'), $text);
Line 76: $node = $root->findNodeValue('id', $matches[2]);
Line 79: return '<a ' . $matches[1] . 'href="page/view_by_id/' . $matches[2] . '"';
Line 87: * Add some preloaded widgets, e.g. generated by a preview
Line 88: * @param array $widgets Format to match $_POST['widgets'] on
Line 89: * admin/edit/page/{id}
Line 90: * @param array $settings Format to match $_POST['widget_settings']
Line 91: * on admin/edit/page/{id}
Line 93: public static function preloadWidgets(array $widgets, array $settings)
Line 95: foreach ($widgets as $area_name => $widget_list) {
Line 96: foreach ($widget_list as $widget) {
Line 97: list($record_order, $type, $widget_id) = explode(',', $widget);
Line 98: $widget_settings = array();
Line 100: $widget_settings = $settings[$area_name][$record_order];
Line 102: $area_id = WidgetArea::findAreaByName($area_name)->getIndex();
Line 103: Widgets::add($area_id, $type, $widget_settings);
Line 104: self::$preloaded_widgets[] = array(
Line 106: 'settings' => $widget_settings,
Line 107: 'embed_key' => $widget_id
Line 115: * Replace embed code with the actual widgets.
Line 117: * Embed code is in the format ((WIDGET code))
Line 119: * @param string $text The text which contains the widget embed codes
Line 120: * @param string $widget_table The host table of the widgets, e.g. 'page'
Line 121: * @param int $widget_record The record id
Line 124: public static function embedWidgets($text, $widget_table, $widget_record)
Line 126: $widgets = self::$preloaded_widgets;
Line 128: Pdb::validateIdentifier($widget_table);
Line 129: $widget_record = (int) $widget_record;
Line 131: $widget_table = addslashes($widget_table);
Line 133: // Find widget references in text
Line 136: '!<p>(?:\s|&nbsp;|<code>)*\(\(WIDGET [a-zA-Z]*? ?([0-9A-Za-z]+)\)\)(?:\s|&nbsp;|</code>)*</p>!',
Line 143: // Map embed codes => widget refs
Line 149: // Replace preloaded widgets first
Line 151: foreach ($widgets as $widget) {
Line 152: if ($embed_key == $widget['embed_key']) {
Line 153: $text = self::embedWidget($text, $pattern, $widget);
Line 162: $widgets = self::lookupWidgets($widget_table, $widget_record, $embeds);
Line 164: foreach ($widgets as $widget) {
Line 165: if ($embed_key == $widget['embed_key']) {
Line 166: $text = self::embedWidget($text, $pattern, $widget);
Line 177: * @param string $widget_table The host table of the widgets, e.g. 'page'
Line 178: * @param int $widget_record The record id
Line 180: * @return array Keys are the widget reference codes, values are arrays
Line 184: public static function lookupWidgets($widget_table, $widget_record, array $embed_keys)
Line 186: Pdb::validateIdentifier($widget_table);
Line 187: $widget_record = (int) $widget_record;
Line 190: $conditions = ["{$widget_table}_id" => $widget_record];
Line 196: FROM ~{$widget_table}_widgets
Line 200: $widgets = array();
Line 203: $widgets[$row['embed_key']] = $row;
Line 205: return $widgets;
Line 209: * Embeds a widget into some text
Line 210: * @param string $text The text containing the widget embed
Line 211: * @param string $pattern The widget embed to replace
Line 212: * @param array $widget as per {@link lookupWidgets()}, has keys and values
Line 215: * @return string The text with the rendered widget
Line 217: public static function embedWidget($text, $pattern, array $widget)
Line 219: $rendered = Widgets::render(
Line 220: WidgetArea::ORIENTATION_WIDE,
Line 221: $widget['type'],
Line 222: $widget['settings']
Line 229: * Remove widget embed code from the specified HTML
Line 230: * Embed code is in the format ((WIDGET code))
Line 232: public static function removeWidgets($text)
Line 235: '!<p>(?:\s|&nbsp;|<code>)*\(\(WIDGET [a-zA-Z]*? ?([0-9A-Za-z]+)\)\)(?:\s|&nbsp;|</code>)*</p>!',
Line 243: * Replace embed code with the actual widget. This is a tweaked version of embedWidgets, designed for email
Line 245: * Embed code is in the format ((WIDGET code))
Line 247: * @param string $widget_table The host table of the widgets, e.g. 'page'
Line 248: * @param string $widget_record The record id
Line 250: public static function emailWidgets($text, $widget_table, $widget_record, $pre_html, $post_html)
Line 252: Pdb::validateIdentifier($widget_table);
Line 253: $widget_record = (int) $widget_record;
Line 255: self::$temp = array($widget_table, $widget_record, $pre_html, $post_html);
Line 257: return preg_replace_callback('!<p>(?:<code>)?\(\(WIDGET [a-zA-Z]*? ?([0-9A-Za-z]+)\)\)(?:</code>)?</p>!', array('Sprout\Helpers\ContentReplace', '_email_widgets'), $text);
Line 260: private static function _emailWidgets($matches)
Line 262: list($widget_table, $widget_record, $pre_html, $post_html) = self::$temp;
Line 263: $widget_record = (int) $widget_record;
Line 266: FROM ~{$widget_table}_widgets
Line 267: WHERE {$widget_table}_id = ? AND embed_key = ?
Line 270: $widget = Pdb::query($q, [$widget_record, $matches[1]], 'row');
Line 275: return Widgets::render(
Line 276: WidgetArea::ORIENTATION_EMAIL,
Line 277: $widget['type'],
Line 278: json_decode($widget['settings'], true),
Line 324: * The lunk url is optional. If not provided, no link gets appended.
Line 397: * Replace file URLs that refer to IDs with URLs which refer to filenames
Line 404: $ids = [];
Line 413: $id = (int) $match;
Line 414: if ($id <= 0) continue;
Line 416: if (!in_array($id, $ids)) $ids[] = $id;
Line 419: if (count($ids) == 0) return $html;
Line 422: $where = Pdb::buildClause([['id', 'IN', $ids]], $params);
Line 423: $q = "SELECT id, filename FROM ~files WHERE {$where}";
Line 430: // [2] File ID
Line 432: $id_replace = function($matches) use ($filenames) {
Line 433: $id = $matches[2];
Line 434: $filename = $filenames[$id];
Line 442: return preg_replace_callback($pattern, $id_replace, $html);

/sprout/Helpers/ContentSubscribe.php   Highlighted file source

Line 37: $update_data['subsite_id'] = SubsiteSelector::$subsite_id;

/sprout/Helpers/Cors.php   Highlighted file source

Line 80: * @return void exits if invalid or pre-flight
Line 109: // Tidy up.
Line 115: // Clear out safe headers before validation.
Line 123: // TODO Validate origins here.
Line 126: // Validate permitted headers.
Line 131: // Validate permitted methods.

/sprout/Helpers/CountryConstants.php   Highlighted file source

Line 126: 'ID' => 'Indonesia',
Line 248: 'TT' => 'Trinidad and Tobago',
Line 378: 'IDN' => 'Indonesia',
Line 500: 'TTO' => 'Trinidad and Tobago',
Line 630: 'ID' => 'IDN',

/sprout/Helpers/Cron.php   Highlighted file source

Line 26: private static $job_id;
Line 65: self::$job_id = Pdb::insert('cron_jobs', $update_fields);
Line 75: id = " . self::$job_id;
Line 88: * @return void
Line 95: if (!self::$job_id) return;
Line 104: // Multiline messages are inserted multiple times as individual lines
Line 127: if (self::$job_id) {
Line 132: id = " . self::$job_id;
Line 136: echo 'Cron job failed. See log entry #' . self::$job_id . ' for more info';
Line 148: if (self::$job_id) {
Line 153: id = " . self::$job_id;
Line 166: $log_id = Kohana::logException($exception);
Line 168: self::message('Log ID: ' . $log_id);

/sprout/Helpers/CropImageTransform.php   Highlighted file source

Line 22: private $width;
Line 31: * @param int $width The width to crop the image at.
Line 36: public function __construct($width, $height, $vert_pos = 'center', $horiz_pos = 'center')
Line 38: $this->width = $width;
Line 52: $width_bad = $height_bad = false;
Line 54: if ($this->width == null or $img->width < $this->width) $width_bad = true;
Line 57: if ($width_bad and $height_bad) return false;
Line 59: $img->crop($this->width, $this->height, $this->vert_pos, $this->horiz_pos);
Line 71: return $this->width * $this->height * 4;

/sprout/Helpers/Csrf.php   Highlighted file source

Line 25: * @return void
Line 37: * Generates a CSRF hidden form field
Line 39: * @return string HTML: an <input type="hidden"> tag which contains the token
Line 45: return '<input type="hidden" name="edit_token" value="' . Enc::html($_SESSION['csrf_token']) . '">';
Line 51: * Checks that it is valid.
Line 58: // Clearly invalid request, avoid any exceptions being generated

/sprout/Helpers/DatabaseSync.php   Highlighted file source

Line 14: // kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 23: * Provides a system for syncing a database to a database definition.

/sprout/Helpers/Debug.php   Highlighted file source

Line 16: use InvalidArgumentException;
Line 102: throw new InvalidArgumentException('Must be array or PDOStatement');

/sprout/Helpers/DefaultCaptcha.php   Highlighted file source

Line 35: echo ' <img src="ROOT/media/images/icons-16x16/refresh.png" alt="Refresh" title="Refresh" width="16" height="16">';
Line 38: echo ' <img src="ROOT/media/images/icons-16x16/help.png" alt="Help" title="Help" width="16" height="16">';
Line 41: echo ' <img src="SITE/captcha/image/' . $num . '" alt="" width="200" height="50" class="captcha">';
Line 43: echo ' <input type="hidden" name="captcha_num" value="' . $num . '">';

/sprout/Helpers/DisplayConditions/Acquisition/Referrer.php   Highlighted file source

Line 29: * @param array $env Environment, such as page id etc

/sprout/Helpers/DisplayConditions/Acquisition/UtmCampaign.php   Highlighted file source

Line 29: * @param array $env Environment, such as page id etc

/sprout/Helpers/DisplayConditions/Acquisition/UtmMedium.php   Highlighted file source

Line 29: * @param array $env Environment, such as page id etc

/sprout/Helpers/DisplayConditions/Acquisition/UtmSource.php   Highlighted file source

Line 29: * @param array $env Environment, such as page id etc

/sprout/Helpers/DisplayConditions/DisplayCondition.php   Highlighted file source

Line 21: * which widgets (content blocks) are shown or hidden on the page
Line 58: * @param array $env Environment, such as page id etc

/sprout/Helpers/DisplayConditions/DisplayConditionEnum.php   Highlighted file source

Line 56: * @param array $env Environment, such as page id etc
Line 79: * @param array $env Environment, such as page id etc

/sprout/Helpers/DisplayConditions/DisplayConditionInteger.php   Highlighted file source

Line 60: * @param array $env Environment, such as page id etc
Line 92: * @param array $env Environment, such as page id etc

/sprout/Helpers/DisplayConditions/DisplayConditionString.php   Highlighted file source

Line 60: * @param array $env Environment, such as page id etc
Line 91: * @param array $env Environment, such as page id etc

/sprout/Helpers/DisplayConditions/Platform/BrowserName.php   Highlighted file source

Line 49: * @param array $env Environment, such as page id etc

/sprout/Helpers/DisplayConditions/Platform/BrowserVersion.php   Highlighted file source

Line 32: * @param array $env Environment, such as page id etc

/sprout/Helpers/DisplayConditions/Platform/DeviceCategory.php   Highlighted file source

Line 45: * @param array $env Environment, such as page id etc

/sprout/Helpers/DisplayConditions/Session/ThisPageviews.php   Highlighted file source

Line 30: * @param array $env Environment, such as page id etc

/sprout/Helpers/DisplayConditions/Session/TimeOnSite.php   Highlighted file source

Line 29: * @param array $env Environment, such as page id etc

/sprout/Helpers/DisplayConditions/Session/TotalPageviews.php   Highlighted file source

Line 29: * @param array $env Environment, such as page id etc

/sprout/Helpers/DisplayConditions/Session/UniquePageviews.php   Highlighted file source

Line 29: * @param array $env Environment, such as page id etc

/sprout/Helpers/DocImport/DocImport.php   Highlighted file source

Line 40: * @param string $filename The file. The file will exist, but may not be valid
Line 54: throw new Exception('Filename not valid');
Line 86: if ((string)$tag['width'] == 0) unset($tag['width']);
Line 90: $width = (string)$tag['width'];
Line 93: if (!$width or !$height) {
Line 94: $width = 300;
Line 98: $tag->addAttribute('src', 'http://placehold.it/' . $width . 'x' . $height . '&text=' . Enc::url((string)$tag['error']));

/sprout/Helpers/DocImport/DocImportCSV.php   Highlighted file source

Line 26: * @param string $filename The file. The file will exist, but may not be valid

/sprout/Helpers/DocImport/DocImportDOCX.php   Highlighted file source

Line 37: * @param string $filename The file. The file will exist, but may not be valid
Line 86: * Validates element as block display
Line 89: * @return bool True Valid block element
Line 90: * @return bool False Invalid block element
Line 92: private function isValidBlockElem($elem)
Line 153: while ($nextSibling and !$this->isValidBlockElem($nextSibling)) {
Line 288: $href = $this->relationships[$child->getAttribute('r:id')];
Line 453: // Move BRs outside B and I tags
Line 482: $id = $elem->getAttribute('w:abstractNumId');
Line 495: $tmp[$id] = $abstractnum;
Line 500: $id = $elem->getAttribute('w:numId');
Line 502: $e = $elem->getElementsByTagName('abstractNumId');
Line 506: $out[$id] = $tmp[$e];
Line 529: $id = $elem->getAttribute('w:styleId');
Line 531: $out[$id] = [
Line 536: $numid = $elem->getElementsByTagName('numId');
Line 537: if ($numid->length) {
Line 538: $out[$id]['numid'] = $numid->item(0)->getAttribute('w:val');
Line 544: $out[$id]['bold'] = true;
Line 550: $out[$id]['italic'] = true;
Line 556: $out[$id]['based_on_id'] = $base->item(0)->getAttribute('w:val');
Line 561: if (isset($row['based_on_id'])) {
Line 579: if (isset($heading['based_on_id'])) {
Line 580: if (isset($styles[$heading['based_on_id']])) {
Line 581: $parent = $styles[$heading['based_on_id']];
Line 596: * @return void
Line 600: foreach ($this->number_formats as $idx => &$num) {
Line 605: $numId = $style['numid'];
Line 606: if (! $numId) continue;
Line 608: $upstreamFormat = $this->number_formats[$numId];
Line 631: $id = $elem->getAttribute('Id');
Line 633: $out[$id] = $target;
Line 654: // Get style id and name
Line 666: if (isset($style['numid'])) {
Line 667: $out['number_format'] = $this->number_formats[$style['numid']]['numFmt'];
Line 674: $id = $num->item(0)->getElementsByTagName('numId');
Line 675: if ($id->length) {
Line 676: $numberId = $id->item(0)->getAttribute('w:val');
Line 677: if (isset($this->number_formats[$numberId]['numFmt'])) {
Line 678: $out['number_format'] = $this->number_formats[$numberId]['numFmt'];
Line 682: $id = $num->item(0)->getElementsByTagName('ilvl');
Line 683: if ($id->length) {
Line 684: $out['number_level'] = $id->item(0)->getAttribute('w:val');
Line 767: $id = $blip->item(0)->getAttribute('r:embed');
Line 770: $stat = $this->zip->statName('word/' . $this->relationships[$id]);
Line 779: $resname = basename($this->relationships[$id]);
Line 782: return '<img error="unsupported-type" res="' . $resname . '" width="' . round($sizeX) . '" height="' . round($sizeY) . '" />';
Line 787: $this->res[$resname] = $this->zip->getFromName('word/' . $this->relationships[$id]);
Line 790: return '<img rel="' . $resname . '" width="' . round($sizeX, 1) . '" height="' . round($sizeY, 1) . '" />';
Line 808: $id = $imagedata->item(0)->getAttribute('r:id');
Line 811: $stat = $this->zip->statName('word/' . $this->relationships[$id]);
Line 817: if (preg_match('/[0-9]+/', $css['width'], $matches)) $sizeX = $matches[0];
Line 821: $resname = basename($this->relationships[$id]);
Line 824: return '<img error="unsupported-type" res="' . $resname . '" width="' . round($sizeX) . '" height="' . round($sizeY) . '" />';
Line 829: $this->res[$resname] = $this->zip->getFromName('word/' . $this->relationships[$id]);
Line 832: return '<img rel="' . $resname . '" width="' . round($sizeX, 1) . '" height="' . round($sizeY, 1) . '" />';
Line 906: * Value - Widechar bytes

/sprout/Helpers/DocImport/DocImportPlaintext.php   Highlighted file source

Line 26: * @param string $filename The file. The file will exist, but may not be valid
Line 35: // The below is an XML file, so convert BRs to valid XML

/sprout/Helpers/Drivers/Archive/Tar.php   Highlighted file source

Line 37: // Add each path individually
Line 87: pack('a8', sprintf('%07o', $stat[4])). // Owner user ID
Line 88: pack('a8', sprintf('%07o', $stat[5])). // Owner group ID

/sprout/Helpers/Drivers/Archive/Zip.php   Highlighted file source

Line 60: // Add each path individually
Line 100: // What voodoo is this? I have no idea... Geert can explain it though,

/sprout/Helpers/Drivers/Cache/Eaccelerator.php   Highlighted file source

Line 36: public function get($id)
Line 38: return eaccelerator_get($id);
Line 48: public function set($id, $data, array $tags = NULL, $lifetime)
Line 55: return eaccelerator_put($id, $data, $lifetime);
Line 58: public function delete($id, $tag = FALSE)
Line 65: elseif ($id === TRUE)
Line 71: return eaccelerator_rm($id);

/sprout/Helpers/Drivers/Cache/File.php   Highlighted file source

Line 44: // Directory is valid
Line 49: * Finds an array of files matching the given id or tag.
Line 51: * @param string cache id or tag
Line 53: * @return array of filenames matching the id or tag
Line 55: public function exists($id, $tag = FALSE)
Line 57: if ($id === TRUE)
Line 65: $paths = glob($this->directory.'*~*'.$id.'*~*');
Line 74: // Find valid tags
Line 92: // Find the file matching the given id
Line 93: return glob($this->directory.$id.'~*');
Line 100: * @param string cache id to set
Line 106: public function set($id, $data, array $tags = NULL, $lifetime)
Line 109: $this->delete($id);
Line 124: return (bool) file_put_contents($this->directory.$id.'~'.$tags.'~'.$lifetime, json_encode($data));
Line 128: * Finds an array of ids for a given tag.
Line 131: * @return array of ids that match the tag
Line 146: // Get the id from the filename
Line 147: list($id, $junk) = explode('~', basename($path), 2);
Line 149: if (($data = $this->get($id)) !== FALSE)
Line 152: $result[$id] = $data;
Line 164: * @param string cache id
Line 167: public function get($id)
Line 169: if ($file = $this->exists($id))
Line 174: // Validate that the cache has not expired
Line 178: $this->delete($id);
Line 206: * Deletes a cache item by id or tag
Line 208: * @param string cache id or tag, or TRUE for "all items"
Line 212: public function delete($id, $tag = FALSE)
Line 214: $files = $this->exists($id, $tag);
Line 238: * @return void

/sprout/Helpers/Drivers/Cache/Memcache.php   Highlighted file source

Line 101: public function get($id)
Line 103: return (($return = $this->backend->get($id)) === FALSE) ? NULL : $return;
Line 106: public function set($id, $data, array $tags = NULL, $lifetime)
Line 115: // Add the id to each tag
Line 116: self::$tags[$tag][$id] = $id;
Line 127: return $this->backend->set($id, $data, $this->flags, $lifetime);
Line 130: public function delete($id, $tag = FALSE)
Line 135: if ($id === TRUE)
Line 151: if (isset(self::$tags[$id]))
Line 153: foreach (self::$tags[$id] as $_id)
Line 155: // Delete each id in the tag
Line 156: $this->backend->delete($_id);
Line 160: unset(self::$tags[$id]);
Line 167: foreach (self::$tags as $tag => $_ids)
Line 169: if (isset(self::$tags[$tag][$id]))
Line 171: // Remove the id from the tags
Line 172: unset(self::$tags[$tag][$id]);
Line 176: return $this->backend->delete($id);
Line 185: foreach (self::$tags as $tag => $_ids)
Line 187: foreach ($_ids as $id)
Line 189: if ( ! $this->backend->get($id))
Line 191: // This id has disappeared, delete it from the tags
Line 192: unset(self::$tags[$tag][$id]);
Line 198: // The tag no longer has any valid ids

/sprout/Helpers/Drivers/Cache/Xcache.php   Highlighted file source

Line 36: public function get($id)
Line 38: if (xcache_isset($id))
Line 39: return xcache_get($id);
Line 44: public function set($id, $data, array $tags = NULL, $lifetime)
Line 51: return xcache_set($id, $data, $lifetime);
Line 60: public function delete($id, $tag = FALSE)
Line 67: elseif ($id !== TRUE)
Line 69: if (xcache_isset($id))
Line 70: return xcache_unset($id);

/sprout/Helpers/Drivers/CacheDriver.php   Highlighted file source

Line 27: public function set($id, $data, array $tags = NULL, $lifetime);
Line 30: * Find all of the cache ids for a given tag.
Line 38: public function get($id);
Line 41: * Delete cache items by id or tag.
Line 43: public function delete($id, $tag = FALSE);

/sprout/Helpers/Drivers/Image/GD.php   Highlighted file source

Line 33: protected static $blank_png_width;
Line 159: // Get the current width and height
Line 160: $width = imagesx($this->tmp_image);
Line 164: $flipped = $this->imagecreatetransparent($width, $height);
Line 168: for ($x = 0; $x < $width; $x++)
Line 170: $status = imagecopy($flipped, $this->tmp_image, $x, 0, $width - $x - 1, 0, 1, $height);
Line 177: $status = imagecopy($flipped, $this->tmp_image, 0, $y, 0, $height - $y - 1, $width, 1);
Line 201: // Get the current width and height
Line 202: $width = imagesx($this->tmp_image);
Line 206: $img = $this->imagecreatetransparent($properties['width'], $properties['height']);
Line 209: if ($status = imagecopyresampled($img, $this->tmp_image, 0, 0, $properties['left'], $properties['top'], $width, $height, $width, $height))
Line 221: // Get the current width and height
Line 222: $width = imagesx($this->tmp_image);
Line 225: if (substr($properties['width'], -1) === '%')
Line 228: $properties['width'] = round($width * (substr($properties['width'], 0, -1) / 100));
Line 237: // Recalculate the width and height, if they are missing
Line 238: empty($properties['width']) and $properties['width'] = round($width * $properties['height'] / $height);
Line 239: empty($properties['height']) and $properties['height'] = round($height * $properties['width'] / $width);
Line 244: $properties['master'] = (($width / $properties['width']) > ($height / $properties['height'])) ? Image::WIDTH : Image::HEIGHT;
Line 247: if (empty($properties['height']) OR $properties['master'] === Image::WIDTH)
Line 249: // Recalculate the height based on the width
Line 250: $properties['height'] = round($height * $properties['width'] / $width);
Line 253: if (empty($properties['width']) OR $properties['master'] === Image::HEIGHT)
Line 255: // Recalculate the width based on the height
Line 256: $properties['width'] = round($width * $properties['height'] / $height);
Line 260: if ($properties['width'] > $width / 2 AND $properties['height'] > $height / 2)
Line 262: // Presize width and height
Line 263: $pre_width = $width;
Line 267: $max_reduction_width = round($properties['width'] * 1.1);
Line 271: while ($pre_width / 2 > $max_reduction_width AND $pre_height / 2 > $max_reduction_height)
Line 273: $pre_width /= 2;
Line 278: $img = $this->imagecreatetransparent($pre_width, $pre_height);
Line 280: if ($status = imagecopyresized($img, $this->tmp_image, 0, 0, 0, 0, $pre_width, $pre_height, $width, $height))
Line 287: // Set the width and height to the presize
Line 288: $width = $pre_width;
Line 293: $img = $this->imagecreatetransparent($properties['width'], $properties['height']);
Line 296: if ($status = imagecopyresampled($img, $this->tmp_image, 0, 0, 0, 0, $properties['width'], $properties['height'], $width, $height))
Line 365: * @param integer image width
Line 369: protected function imagecreatetransparent($width, $height)
Line 384: // Set the blank PNG width and height
Line 385: self::$blank_png_width = imagesx(self::$blank_png);
Line 389: $img = imagecreatetruecolor($width, $height);
Line 392: imagecopyresized($img, self::$blank_png, 0, 0, 0, 0, $width, $height, self::$blank_png_width, self::$blank_png_height);
Line 410: /** Width of image which will have text added */
Line 435: * Y-point at which text should be rendered inside image.
Line 443: // Calculate the width and height of a box to contain the rendered text
Line 464: // Add the text inside the transparent rectangle

/sprout/Helpers/Drivers/Image/GraphicsMagick.php   Highlighted file source

Line 44: * @return void
Line 60: // Check to make sure the provided path is correct
Line 141: $geometry = escapeshellarg($prop['width'].'x'.$prop['height'].'+'.$prop['left'].'+'.$prop['top']);
Line 170: case Image::WIDTH: // Wx
Line 171: $dim = escapeshellarg($prop['width'].'x');
Line 177: $dim = escapeshellarg($prop['width'].'x'.$prop['height']);
Line 180: $dim = escapeshellarg($prop['width'].'x'.$prop['height'].'!');
Line 184: // Use "convert" to change the width and height

/sprout/Helpers/Drivers/Image/ImageMagick.php   Highlighted file source

Line 44: * @return void
Line 60: // Check to make sure the provided path is correct
Line 140: $geometry = escapeshellarg($prop['width'].'x'.$prop['height'].'+'.$prop['left'].'+'.$prop['top']);
Line 169: case Image::WIDTH: // Wx
Line 170: $dim = escapeshellarg($prop['width'].'x');
Line 176: $dim = escapeshellarg($prop['width'].'x'.$prop['height']);
Line 179: $dim = escapeshellarg($prop['width'].'x'.$prop['height'].'!');
Line 183: // Use "convert" to change the width and height

/sprout/Helpers/Drivers/ImageDriver.php   Highlighted file source

Line 52: * width and height. Valid properties are: width, height, top, left.
Line 55: * @return void
Line 59: list($width, $height) = $this->properties();
Line 64: // Width and height cannot exceed current image size
Line 65: $geometry['width'] = min($geometry['width'], $width);
Line 85: $geometry['left'] = floor(($width / 2) - ($geometry['width'] / 2));
Line 93: $geometry['left'] = $width - $geometry['width'];
Line 101: * Return the current width and height of the temporary image. This is mainly
Line 104: * @return array width, height
Line 120: * Flip an image. Valid directions are horizontal and vertical.
Line 128: * Crop an image. Valid properties are: width, height, top, left.
Line 136: * Resize an image. Valid properties are: width, height, and master.
Line 144: * Rotate an image. Valid amounts are -180 to 180.
Line 152: * Sharpen and image. Valid amounts are 1 to 100.

/sprout/Helpers/Drivers/Session/Cache.php   Highlighted file source

Line 35: * overridden by the session expiration setting.
Line 83: public function read($id)
Line 85: $id = 'session_'.$id;
Line 86: if ($data = $this->cache->get($id))
Line 95: public function write($id, $data)
Line 97: $id = 'session_'.$id;
Line 100: return $this->cache->set($id, $data);
Line 103: public function destroy($id)
Line 105: $id = 'session_'.$id;
Line 106: return $this->cache->delete($id);
Line 111: session_regenerate_id(TRUE);
Line 113: // Return new session id
Line 114: return session_id();

/sprout/Helpers/Drivers/Session/Database.php   Highlighted file source

Line 38: protected $session_id;
Line 55: Pdb::validateIdentifier($config['storage']['table']);
Line 73: public function read($id)
Line 77: $q = "SELECT data FROM ~{$this->table} WHERE session_id = ? LIMIT 1";
Line 78: $data = Pdb::q($q, [$id], 'val');
Line 82: $this->session_id = NULL;
Line 86: // Set the current session id
Line 87: $this->session_id = $id;
Line 92: public function write($id, $data)
Line 96: 'session_id' => $id,
Line 101: if ($this->session_id === NULL)
Line 106: elseif ($id === $this->session_id)
Line 108: // Do not update the session_id
Line 109: unset($data['session_id']);
Line 112: $count = Pdb::update($this->table, $data, array('session_id' => $id));
Line 116: // Update the session and id
Line 117: $count = Pdb::update($this->table, $data, array('session_id' => $this->session_id));
Line 119: // Set the new session id
Line 120: $this->session_id = $id;
Line 126: public function destroy($id)
Line 129: Pdb::delete($this->table, array('session_id' => $id));
Line 131: // Session id is no longer valid
Line 132: $this->session_id = NULL;
Line 139: // Generate a new session id
Line 140: session_regenerate_id();
Line 142: // Return new session id
Line 143: return session_id();

/sprout/Helpers/Drivers/SessionDriver.php   Highlighted file source

Line 43: * @param string session id
Line 46: public function read($id);
Line 51: * @param string session id
Line 55: public function write($id, $data);
Line 60: * @param string session id
Line 63: public function destroy($id);
Line 66: * Regenerates the session id.

/sprout/Helpers/EmailText.php   Highlighted file source

Line 39: throw new Exception('Did not find registration for emailText with code of "' . $code . '"');
Line 96: throw new Exception('Did not find registration for emailText with code of "' . $code . '"');
Line 100: $q = "SELECT id FROM ~email_texts WHERE name = ?";
Line 102: $item_id = Pdb::q($q, [$code], 'val');
Line 110: $item_id = Pdb::insert('email_texts', $update_fields);
Line 113: return 'admin/edit/email_text/' . $item_id;

/sprout/Helpers/EmbedVideo.php   Highlighted file source

Line 22: class EmbedVideo
Line 30: * Return HTML for embedding a video, based on the URL.
Line 34: * bool autoplay Begin playing the video straight away
Line 38: * @param int $width
Line 42: public static function renderEmbed($url, $width = 400, $height = 300, array $options = array()) {
Line 44: $width = (int) $width;
Line 47: $idtype = self::getVideoIdType($url);
Line 48: if ($idtype == null) return null;
Line 51: list($type, $video_id) = $idtype;
Line 54: $embed_url = '//www.youtube.com/embed/' . $video_id . '?rel=0&wmode=transparent';
Line 58: $embed_url = '//player.vimeo.com/video/' . $video_id . '?title=0&byline=0&portrait=0&color=00ADEF&fullscreen=0';
Line 69: $options['title'] = 'Embedded video';
Line 73: . 'width="' . $width . '" height="' . $height. '" '
Line 77: . '<a href="' . Enc::html($url) . '">Watch video</a>'
Line 91: $idtype = self::getVideoIdType($url);
Line 92: if ($idtype == null) return null;
Line 94: list($type, $video_id) = $idtype;
Line 98: return "//i1.ytimg.com/vi/{$video_id}/maxresdefault.jpg";
Line 100: return "//i1.ytimg.com/vi/{$video_id}/hqdefault.jpg";
Line 106: $vimeo_html = @file_get_contents("http://vimeo.com/{$video_id}");
Line 123: * Return the URL for our dynamic thumbnail resizer for a given video url
Line 132: $idtype = self::getVideoIdType($url);
Line 133: if ($idtype == null) return null;
Line 135: list($type, $video_id) = $idtype;
Line 137: return 'embed_video/thumb/' . $sizespec . '/' . $type. '/' . $video_id;
Line 142: * Parse the URL into a video-id and type
Line 144: public static function getVideoIdType($url)

/sprout/Helpers/Enc.php   Highlighted file source

Line 84: * Encoding for ID or CLASS attributes
Line 88: public static function id($value)
Line 102: * Encoding for going inside a JS string
Line 135: * This provides the backend for {@see Slug::create}
Line 169: * @return string|null JavaScript snippet for the given date or NULL if the input value is invalid

/sprout/Helpers/Encrypt.php   Highlighted file source

Line 23: * The Encrypt library provides two-way encryption of text and binary strings
Line 52: * Loads encryption configuration and validates the data.

/sprout/Helpers/Event_Observer.php   Highlighted file source

Line 33: * @return void
Line 51: throw new Kohana_Exception('event.invalid_subject', get_class($caller), get_class($this));
Line 78: * @return void

/sprout/Helpers/Event_Subject.php   Highlighted file source

Line 39: throw new Kohana_Exception('eventable.invalid_observer', get_class($obj), get_class($this));

/sprout/Helpers/Export.php   Highlighted file source

Line 23: private $file_idx = 0;
Line 67: $this->file_idx = 1;
Line 81: $this->file_idx = 1;
Line 166: return ($this->split_table ? $table_name : 'all') . '-' . $this->file_idx . $ext;
Line 201: $this->file_idx++;

/sprout/Helpers/Fb.php   Highlighted file source

Line 17: use InvalidArgumentException;
Line 28: /** ID for use on the field label and input/select/etc. element */
Line 29: public static $field_id = '';
Line 40: * @var string A prefix for generated IDs
Line 42: public static $id_prefix = '';
Line 51: * @return void
Line 64: * @return void
Line 78: * @return void
Line 129: * Generate a unique id
Line 132: private static function genId()
Line 136: return static::$id_prefix . 'fb' . $inc++;
Line 141: * Injects the current auto-generated id into an array of attributes.
Line 142: * Only applies if an auto-generated id exists and an id isn't already set in the attributes.
Line 143: * The auto-generated id is then cleared.
Line 145: * @return void
Line 147: protected static function injectId(array &$attrs)
Line 149: if (isset($attrs['id'])) return;
Line 150: if (!self::$field_id) return;
Line 151: $attrs['id'] = self::$field_id;
Line 152: self::$field_id = '';
Line 163: * @return void
Line 222: * @param string $type The type of input, e.g. 'text', 'hidden', ...
Line 226: * @throws InvalidArgumentException if $name is empty
Line 231: throw new InvalidArgumentException('An INPUT without a name is invalid');
Line 266: self::injectId($attrs);
Line 281: self::injectId($attrs);
Line 296: self::injectId($attrs);
Line 312: $out = '<div class="money-symbol money-symbol--' . Enc::id(strtolower($locale->getCurrencyName())) . '">';
Line 332: self::injectId($attrs);
Line 343: $id = Enc::id($attrs['id']);
Line 345: $div = "<div id=\"{$id}-count\">{$value}</div>";
Line 348: $(\"#{$id}\").after('{$div}');
Line 349: $(\"#{$id}-count\").text($(\"#{$id}\").val());
Line 350: $(\"#{$id}\").bind('change click', function() {
Line 351: $(\"#{$id}-count\").text($(this).val());
Line 368: self::injectId($attrs);
Line 382: self::injectId($attrs);
Line 405: * - form_id (string)
Line 416: self::injectId($attrs);
Line 428: 'form_id' => $params['sess_key'],
Line 434: // Override default opts with any specified via $params
Line 448: $upload_params = ['class' => 'file-upload__input', 'id' => $attrs['id']];
Line 492: $out .= '<input class="js-delete-notify" type="hidden" name="' . Enc::html($name) . '_deleted">';
Line 537: $out .= '<input type="hidden" name="' . Enc::html($name) . '[]" class="original" value="' . Enc::html($file['original']) . '" data-code="' . Enc::html($file['code']) . '">';
Line 538: $out .= '<input type="hidden" name="' . Enc::html($name) . '_temp[]" class="temp" value="' . Enc::html($file['temp']) . '" data-code="' . Enc::html($file['code']) . '">';
Line 556: self::injectId($attrs);
Line 571: self::injectId($attrs);
Line 626: $filename = Pdb::q("SELECT filename FROM ~files WHERE id = ?", [$value], 'val');
Line 634: $out .= '<input class="fs-hidden" type="hidden" name="' . Enc::html($name) . '" value="' . Enc::html($value) . '">';
Line 651: $out .= '<button class="fs-remove" type="button"><span class="-vis-hidden">Remove</span></button>';
Line 666: * @param array $attrs Including 'height' and 'width' in pixels
Line 675: $width = (int) @$attrs['width'];
Line 676: if ($width <= 0) $width = 600;
Line 681: return RichText::draw($name, $value, $width, $height, @$items['type']);
Line 692: self::injectId($attrs);
Line 729: self::injectId($attrs);
Line 793: * Expects to be provided AJAX data in a format defined by jQuery UI (see 'url' option below).
Line 794: * By default, this expects to stores an ID value for a foreign key. If this isn't the desired
Line 795: * behaviour, a plain text value can be stored by setting the 'save_id' option to false.
Line 798: * If 'save_id' is true, then it also needs to accept the 'id' GET param to fetch the label for the relevant id.
Line 803: * - 'id': id value to save. This should only be specified if 'save_id' is true; see below.
Line 807: * 'data-callback' Function name to call once a selection has been made, which should accept a param of {int} item_id
Line 810: * 'save_id' (bool, defaults to true) Save the data as an ID value or similar unique key, and look up the
Line 811: * label for display upon page by calling the URL with the 'id' GET param set
Line 822: throw new InvalidArgumentException("\$options['url'] must be specified");
Line 831: self::injectId($attrs);
Line 837: // Automatically add a hidden field with the 'id' value if available. This is probably the most
Line 839: if (!array_key_exists('save_id', $options)) $options['save_id'] = true;
Line 840: $attrs['data-save-id'] = (int) (bool) $options['save_id'];
Line 865: * $_GET['ids'] (string) CSV of record IDs to poplate on page-load
Line 867: * 'id' (int) Record ID
Line 884: self::injectId($attrs);
Line 894: $view->id = $attrs['id'];
Line 915: $id = self::genId();
Line 920: 'id' => $id,
Line 929: $content .= "<label for=\"{$id}\">";
Line 987: $id = Enc::id($name);
Line 1016: 'id' => self::genId(),
Line 1028: $out .= self::tag('label', ['for' => $input_attrs['id']]);
Line 1044: * 'subsite' int Subsite ID to load; default is current subsite
Line 1045: * 'exclude' array Node IDs to exclude from rendering
Line 1067: * 'exclude' array Node IDs to exclude from rendering
Line 1080: throw new InvalidArgumentException('Option "root" is required and must be a Treenode');
Line 1112: * @param int $selected The id of the page to select
Line 1113: * @param array $exclude Node IDs of the to exclude from the list
Line 1121: if (in_array($node['id'], $exclude)) return '';
Line 1123: if ($node['id'] == $selected) {
Line 1124: $out = "<option value=\"{$node['id']}\" selected>{$space}{$name}</option>";
Line 1126: $out = "<option value=\"{$node['id']}\">{$space}{$name}</option>";
Line 1141: * @throws ValidationException If 'min', 'max' or 'incr' options are invalid
Line 1143: * @param array $attrs Attributes for the input element, e.g. ['id' => 'my-timepicker', class' => 'super-input', 'style' => 'font-style: italic']
Line 1159: if (isset($options['min'])) Validity::dateMySQL($options['min']);
Line 1160: if (isset($options['max'])) Validity::dateMySQL($options['max']);
Line 1163: self::injectId($attrs);
Line 1172: 'name' => $name, 'value' => $value, 'type' => 'hidden', 'class' => 'fb-hidden'
Line 1210: throw new InvalidArgumentException("daterangepicker expects name ({$name}) to be in the form of two comma-separated identifiers; e.g. 'date_start,date_end'");
Line 1217: if (isset($options['min'])) Validity::dateMySQL($options['min']);
Line 1218: if (isset($options['max'])) Validity::dateMySQL($options['max']);
Line 1221: self::injectId($attrs);
Line 1228: $out = self::input('hidden', $name_start, ['class' => 'fb-hidden fb-daterangepicker--start']);
Line 1229: $out .= self::input('hidden', $name_end, ['class' => 'fb-hidden fb-daterangepicker--end']);
Line 1260: throw new InvalidArgumentException("simpledaterangepicker expects name ({$name}) to be in the form of two comma-separated identifiers; e.g. 'date_start,date_end'");
Line 1265: if (isset($options['min'])) Validity::dateMySQL($options['min']);
Line 1266: if (isset($options['max'])) Validity::dateMySQL($options['max']);
Line 1270: self::injectId($attrs);
Line 1281: $out = self::input('hidden', $name_start, ['class' => 'fb-hidden fb-daterangepicker--start']);
Line 1282: $out .= self::input('hidden', $name_end, ['class' => 'fb-hidden fb-daterangepicker--end']);
Line 1314: throw new InvalidArgumentException("datetimerangepicker expects name ({$name}) to be in the form of
Line 1315: two comma-separated identifiers; e.g. 'datetime_start,datetime_end'");
Line 1322: if (isset($options['min'])) Validity::dateTimeMySQL($options['min']);
Line 1323: if (isset($options['max'])) Validity::dateTimeMySQL($options['max']);
Line 1326: self::injectId($attrs);
Line 1333: $out = self::input('hidden', $name_start, ['class' => 'fb-hidden fb-datetimerangepicker--start']);
Line 1334: $out .= self::input('hidden', $name_end, ['class' => 'fb-hidden fb-datetimerangepicker--end']);
Line 1342: * Renders a timepicker field inside a SPAN, which displays a dropdown date selection box when clicked
Line 1345: * @param array $attrs Attributes for the input element, e.g. ['id' => 'my-timepicker', class' => 'super-input', 'style' => 'font-style: italic']
Line 1362: self::injectId($attrs);
Line 1363: $id = Enc::id($attrs['id']);
Line 1369: $out = "<span id=\"{$id}_wrap\" class=\"fb-timepicker\" data-config=\"" . Enc::html(json_encode($params)) . "\">";
Line 1371: self::addAttr($attrs, 'name', $name . '_widget');
Line 1377: $out .= "<input type=\"hidden\" name=\"{$name}\" value=\"" . Enc::html($value) . "\" class=\"hid\">";
Line 1388: * @throws ValidationException If 'min', 'max' or 'incr' options are invalid
Line 1390: * @param array $attrs Attributes for the input element, e.g. ['id' => 'my-timepicker', class' => 'super-input', 'style' => 'font-style: italic']
Line 1404: if (isset($options['min'])) Validity::datetimeMySQL($options['min']);
Line 1405: if (isset($options['max'])) Validity::datetimeMySQL($options['max']);
Line 1406: if (isset($options['incr'])) Validity::range($options['incr'], 1, 59);
Line 1409: self::injectId($attrs);
Line 1416: $out = self::input('hidden', $name, ['class' => 'fb-hidden']);
Line 1424: * a hidden field. The specific counts for each are also available
Line 1426: * @todo Does this need validation exceptions? I.e. min/max attributes invalid?
Line 1429: * e.g. ['id' => 'my-totalselector', class' => 'super-input', 'style' => 'font-style: italic']
Line 1445: self::injectId($attrs);
Line 1467: $sub_attrs['id'] = $attrs['id'] . '-' . strtolower($val['name']);
Line 1477: $out .= '<label for="' . Enc::html($sub_attrs['id']) .'">' . Enc::html($val['label']) . '</label>' . PHP_EOL;
Line 1510: self::injectId($attrs);
Line 1539: // Remove zero values to avoid a pin in the middle of the ocean
Line 1562: * The lookup url is provided GET params 'field', 'op', 'val' and
Line 1612: self::injectId($attrs);
Line 1652: self::injectId($attrs);
Line 1669: * @return void
Line 1673: self::injectId($attrs);
Line 1689: $view->form_id = $attrs['id'];
Line 1723: $ids = [];
Line 1724: foreach ($data as $id) {
Line 1725: if (preg_match('/^[0-9]+$/', $id)) $ids[] = (int) $id;
Line 1729: if (count($ids) > 0) {
Line 1731: $where = Pdb::buildClause([['id', 'IN', $ids]], $params);
Line 1732: $filenames = Pdb::q("SELECT id, filename FROM ~files", $params, 'map');
Line 1757: * Generates the title for a field, possibly enclosing it in a label, possibly with a generated ID
Line 1763: * @param string|null $id The id to use. Empty string to auto-generate an id; false to disable the enclosing label,
Line 1764: * e.g. for a field which needs multiple inputs (such as a datepicker). The id will be used on the next
Line 1768: public static function title($title, $id = '')
Line 1770: if ($id === false) return Enc::html($title);
Line 1772: if ($id) {
Line 1773: self::$field_id = $id;
Line 1775: self::$field_id = $id = self::genId();
Line 1777: return '<label for="' . Enc::html(self::$field_id) . '">' . Enc::html($title) . '</label>';
Line 1782: * Renders a set of hidden fields
Line 1784: * @return string Several INPUT fields of type hidden
Line 1786: public static function hiddenFields(array $fields)
Line 1792: $out .= "<input type=\"hidden\" name=\"{$key}\" value=\"{$val}\">\n";

/sprout/Helpers/File.php   Highlighted file source

Line 17: use InvalidArgumentException;
Line 30: * Gets the details of a file using its id.
Line 36: * @param int $id The ID in the files table
Line 39: public static function getDetails($id)
Line 44: $q = "SELECT filename, date_file_modified FROM ~files WHERE id = ?";
Line 49: return Pdb::execute($prepared_q, [$id], 'row');
Line 229: * @param int $id ID or filename from record in files table
Line 233: public static function resizeUrl($id, $size)
Line 235: return self::backend()->resizeUrl($id, $size);
Line 242: * @param int $id ID or filename from record in files table
Line 250: public static function sizeUrl($id, $size_name, $force_ext = null, $create_if_missing = false)
Line 252: if (preg_match('/^[0-9]+$/', $id)) {
Line 254: return "file/download/{$id}/{$size_name}";
Line 256: $file_details = File::getDetails($id);
Line 259: $filename = $id;
Line 283: * @param string $filename The name of the file in the repository. Deprecated: an ID value is also accepted in order
Line 284: * to support older modules; such modules need to be updated to avoid an extra database lookup.
Line 290: $id = $filename;
Line 292: $filename = Pdb::q('SELECT filename FROM ~files WHERE id = ?', [$id], 'val');
Line 347: * [0] => width, [1] => height, [2] => type
Line 395: * I have a feeling this returns other sizes (e.g. .small) as well - which may not be ideal.
Line 515: * [1] => record id
Line 532: Pdb::validateIdentifier($size_name);
Line 545: $pf . 'page_widgets',
Line 567: if ($col['Field'] === 'id') $cols[] = 'id';
Line 597: $where[] = "widget.settings LIKE CONCAT('%', :like_filename, '%')";
Line 600: $where[] = "widget.settings LIKE CONCAT('%', :{$param_name}, '%')";
Line 603: $q = "SELECT DISTINCT page.id, page.name
Line 605: INNER JOIN ~page_widgets AS widget ON rev.id = widget.page_revision_id
Line 606: AND widget.area_id = 1 AND widget.type = 'RichText'
Line 607: INNER JOIN ~pages AS page ON rev.page_id = page.id
Line 624: $q = "SELECT g.id, g.name
Line 626: INNER JOIN ~gallery_sources AS src ON src.gallery_id = g.id AND src.type = :type_image
Line 627: INNER JOIN ~files_cat_join AS joiner ON joiner.cat_id = src.category
Line 628: INNER JOIN ~files AS f ON joiner.file_id = f.id
Line 645: $row['id'],
Line 646: (isset($row['name']) ? $row['name'] : 'Record #' . $row['id']),
Line 755: * @param string $download_name An optional alternate name to provide to the user
Line 781: * Type Width Height Crop X Y Quality
Line 786: * c = crop, resulting file will always be the width and height requested
Line 788: * [1] width
Line 853: list($type, $width, $height, $crop_x, $crop_y, $quality) = File::parseSizeString($size);
Line 859: if ($width == 0) $width = PHP_INT_MAX;
Line 862: if ($file_size[0] > $width or $file_size[1] > $height) {
Line 863: $img->resize($width, $height);
Line 868: $img->resize($width, $height);
Line 872: if ($width / $img->width > $height / $img->height) {
Line 873: $master = Image::WIDTH;
Line 878: $img->resize($width, $height, $master);
Line 879: $img->crop($width, $height, $crop_y, $crop_x);
Line 912: * @param array $dimensions Dimensions of the original image; 0 = width, 1 => height
Line 913: * @return void
Line 951: * @return void
Line 963: throw new Exception('Invalid param $specific_size; size doesn\'t exist.');
Line 991: $width = $height = 0;
Line 997: $width = $dims['width'];
Line 1001: // If an individual transform fails,
Line 1033: * @param int $file_id The ID of the new file
Line 1036: public static function postUploadProcessing($filename, $file_id, $file_type)
Line 1038: $file_id = (int) $file_id;
Line 1042: Pdb::update('files', $update_data, ['id' => $file_id]);
Line 1050: Pdb::update('files', $update_data, ['id' => $file_id]);
Line 1064: * @param int $width Width to use for thumbnail
Line 1068: * 'original_width': width of the original image
Line 1073: public static function base64Thumb($file_path, $width, $height)
Line 1080: $resize = new ResizeImageTransform($width, $height);
Line 1088: 'original_width' => $w,
Line 1100: * @throws InvalidArgumentException If linkspec in DB invalid
Line 1110: throw new InvalidArgumentException("Link spec doesn't match expected value");
Line 1124: * @throws InvalidArgumentException If linkspec in DB invalid
Line 1131: $id = substr($replacement, strlen('file/download/'));
Line 1132: $file_details = self::getDetails($id);
Line 1135: throw new InvalidArgumentException("Redirect target doesn't match expected value");

/sprout/Helpers/FileConstants.php   Highlighted file source

Line 28: const TYPE_VIDEO = 4;
Line 35: self::TYPE_VIDEO => 'Video',
Line 44: self::TYPE_VIDEO => array('flv','mp4','mpeg','mpg','webm','ogv','avi','mov','wmv'),

/sprout/Helpers/FileConvert.php   Highlighted file source

Line 17: use InvalidArgumentException;
Line 31: * Validates that an output file extension is of a valid format
Line 34: * @throws InvalidArgumentException IF the extension is invalid
Line 36: private static function validateExtension($ext)
Line 39: throw new InvalidArgumentException('Output extension must be 3-4 alphabetic characters');
Line 51: * @throws InvalidArgumentException The $out_ext argument has an invalid format
Line 57: static::validateExtension($out_ext);
Line 92: * @throws InvalidArgumentException The $out_ext argument has an invalid format
Line 100: static::validateExtension($out_ext);

/sprout/Helpers/FilesBackend.php   Highlighted file source

Line 36: * Size should be 'rWIDTHxHEIGHT' or 'cWIDTHxHEIGHT'.
Line 69: * [0] => width, [1] => height, [2] => type
Line 82: * I have a feeling this returns other sizes (e.g. .small) as well - which may not be ideal.

/sprout/Helpers/FilesBackendDirectory.php   Highlighted file source

Line 32: * @param int $id ID of entry in files table, or (deprecated) string: filename
Line 35: public function relUrl($id)
Line 37: if (preg_match('/^[0-9]+$/', $id)) {
Line 38: return 'file/download/' . $id;
Line 41: $filename = $id;
Line 54: * Returns the absolute URL for a given file id, including domain.
Line 56: * @param int $id ID of entry in files table, or (deprecated) string: filename
Line 59: public function absUrl($id)
Line 61: return Sprout::absRoot() . $this->relUrl($id);
Line 70: * @param int $id ID or filename from record in files table
Line 74: public function resizeUrl($id, $size)
Line 76: if (preg_match('/^[0-9]+$/', $id)) {
Line 78: $file_details = File::getDetails($id);
Line 87: $filename = $id;
Line 98: $id = substr($replacement, strlen('file/download/'));
Line 99: $file_details = File::getDetails($id);
Line 151: * [0] => width, [1] => height, [2] => type
Line 170: * I have a feeling this returns other sizes (e.g. .small) as well - which may not be ideal.

/sprout/Helpers/FileUpload.php   Highlighted file source

Line 18: use InvalidArgumentException;
Line 31: * Verify that the temporary file specified by the user exists and has valid content,
Line 50: * @throws DomainException If the $_POST upload state is invalid.
Line 68: throw new DomainException('Invalid temp file name');
Line 83: // Validate original file name
Line 90: throw new FileUploadException("Invalid file extension");
Line 134: * @throws InvalidArgumentException if the filename is invalid
Line 139: throw new InvalidArgumentException('Invalid filename');
Line 148: throw new InvalidArgumentException('Failed to create symlink');

/sprout/Helpers/Form.php   Highlighted file source

Line 36: * - The method and class name, in the format 'field-element--id-<name>'
Line 37: * - If an "id" attribute is set, in the format 'field-element--id-<id>'
Line 64: static $id_prefix = '';
Line 102: * @return void
Line 114: * The output from the {@see Validator::getFieldErrors} method can be used directly as input to this method
Line 127: * Load data and errors from the session, with optional record id validation
Line 130: * record_id Checked against $verify_record_id, session data is thrown away in case of mismatch
Line 142: * @param mixed $verify_record_id For edit record verification
Line 146: public static function loadFromSession($key, $verify_record_id = null)
Line 150: if (!empty($verify_record_id) and !empty($_SESSION[$key]['record_id'])) {
Line 151: if ($_SESSION[$key]['record_id'] != $verify_record_id) {
Line 174: * A single parameter is provided to the sprintf() call, the field name
Line 191: * Sets the prefix for generated IDs
Line 195: public static function setFieldIdPrefix($prefix)
Line 197: static::$id_prefix = $prefix;
Line 198: Fb::$id_prefix = $prefix;
Line 203: * Generate a unique id which should be stable across calls to this URL
Line 208: protected static function genId()
Line 211: return static::$id_prefix . 'field' . $inc++;
Line 259: return Enc::id(strtolower($method));
Line 329: * If the field has an explicit ID set, that will be added as a class on the wrapper too.
Line 339: * // Adds the class "field-element--id-first-name" to the wrapper
Line 340: * echo Form::fieldPlain('Sprout\Helpers\Fb::text', 'first_name', ['id' => 'first-name'], []);
Line 359: if (isset($attrs['id'])) {
Line 360: $classes[] = 'field-element--id-' . Enc::id($attrs['id']);
Line 383: if (!isset($attrs['id'])) {
Line 384: $attrs['id'] = self::genId();
Line 389: // It is invalid to output a LABEL without a corresponding element
Line 390: // check if the ID exists in the field
Line 391: $has_id_attr = (strpos($field_html, 'id="' . $attrs['id'] . '"') !== false);
Line 396: if ($has_id_attr) {
Line 397: $out .= '<label for="' . Enc::html($attrs['id']) . '">';
Line 403: if ($has_id_attr) {
Line 442: * If the field has an explicit ID set, that will be added as a class on the wrapper too.
Line 461: if (isset($attrs['id'])) {
Line 462: $classes[] = 'field-element--id-' . Enc::id($attrs['id']);
Line 485: if (!isset($attrs['id'])) {
Line 486: $attrs['id'] = self::genId();
Line 710: * 'id' => record ID,
Line 732: $search_field_id = Enc::id("autofill-{$name}-search");
Line 756: $out .= '<div class="autofill-heading"><label for="' . $search_field_id . '">' . Enc::html($search_label) . '</label></div>';
Line 760: ['-wrapper-class' => 'white', 'id' => $search_field_id]

/sprout/Helpers/Fpdi.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/Helpers/FrontEndEntrance.php   Highlighted file source

Line 26: * @return array The keys are the valid arguments, and the values are their human-friendly labels
Line 38: * @return void The underlying method should either output HTML or redirect

/sprout/Helpers/FrontEndSearch.php   Highlighted file source

Line 21: * @param array $item_id The id of the record to output
Line 26: public function frontEndSearch($item_id, $relevancy, $keywords);

/sprout/Helpers/Html.php   Highlighted file source

Line 46: // This is an id target link, not a URL

/sprout/Helpers/HttpReq.php   Highlighted file source

Line 17: use InvalidArgumentException;
Line 164: if (count($header) < 2) // ignore invalid headers
Line 244: * @param array $curl_options Any options for cURL; these will override any default.
Line 267: if (count($header) < 2) // ignore invalid headers
Line 306: // Override any of the defaults with those specified
Line 389: throw new InvalidArgumentException('Invalid header key or value');

/sprout/Helpers/Image.php   Highlighted file source

Line 18: use InvalidArgumentException;
Line 37: const WIDTH = 4;
Line 79: * @return void
Line 104: // Make sure that the image is readable and valid
Line 112: // Image has been validated, load it
Line 116: 'width' => $image_info[0],
Line 136: // Validate the driver
Line 155: throw new Kohana_Exception('core.invalid_property', $property, get_class($this));
Line 160: * Resize an image to a specific width and height. By default, Kohana will
Line 161: * maintain the aspect ratio using the width as the master dimension. If you
Line 166: * @param integer width
Line 168: * @param integer one of: Image::NONE, Image::AUTO, Image::WIDTH, Image::HEIGHT
Line 171: public function resize($width, $height, $master = NULL)
Line 173: if ( ! $this->validSize('width', $width))
Line 174: throw new Kohana_Exception('image.invalid_width', $width);
Line 176: if ( ! $this->validSize('height', $height))
Line 177: throw new Kohana_Exception('image.invalid_height', $height);
Line 179: if (empty($width) AND empty($height))
Line 180: throw new Kohana_Exception('image.invalid_dimensions', __FUNCTION__);
Line 187: elseif ( ! $this->validSize('master', $master))
Line 188: throw new Kohana_Exception('image.invalid_master');
Line 192: 'width' => $width,
Line 201: * Crop an image to a specific width and height. You may also set the top
Line 206: * @param integer width
Line 212: public function crop($width, $height, $top = 'center', $left = 'center')
Line 214: if ( ! $this->validSize('width', $width))
Line 215: throw new Kohana_Exception('image.invalid_width', $width);
Line 217: if ( ! $this->validSize('height', $height))
Line 218: throw new Kohana_Exception('image.invalid_height', $height);
Line 220: if ( ! $this->validSize('top', $top))
Line 221: throw new Kohana_Exception('image.invalid_top', $top);
Line 223: if ( ! $this->validSize('left', $left))
Line 224: throw new Kohana_Exception('image.invalid_left', $left);
Line 226: if (empty($width) AND empty($height))
Line 227: throw new Kohana_Exception('image.invalid_dimensions', __FUNCTION__);
Line 231: 'width' => $width,
Line 285: throw new Kohana_Exception('image.invalid_flip');
Line 308: * @param integer amount to sharpen, usually ~20 is ideal
Line 392: protected function validSize($type, & $value)
Line 402: case 'width':
Line 440: $value !== Image::WIDTH AND
Line 464: * @param int $width Width in pixels
Line 468: * @return array [0 => width, 1 => height]
Line 470: public function calcResizeDims($width, $height, $master)
Line 472: if ($master == Image::NONE) return [$width, $height];
Line 474: $img_width = $this->image['width'];
Line 477: if ($width == 0) $master = Image::HEIGHT;
Line 478: if ($height == 0) $master = Image::WIDTH;
Line 482: if ($img_width / $width > $img_height / $height) {
Line 483: $master = Image::WIDTH;
Line 489: // Calculate appropriate width or height for resize
Line 490: if ($master == Image::WIDTH) {
Line 491: $height = round($height * $width / $img_width);
Line 493: $width = round($width * $height / $img_height);
Line 495: $err = 'Invalid master dimension; see Image constants';
Line 496: throw new InvalidArgumentException($err);
Line 499: return [$width, $height];

/sprout/Helpers/ImportCMS.php   Highlighted file source

Line 12: use Sprout\Helpers\WidgetArea;
Line 17: private static $page_ids = [];
Line 18: private static $revision_ids = [];
Line 19: private static $old_widets = [];
Line 38: 'subsite_id' => $_POST['subsite_id'],
Line 39: 'parent_id' => $_POST['page_id']
Line 48: page.parent_id = ?";
Line 50: $record_order = Pdb::query($q, [$_POST['page_id']], 'val');
Line 53: // Create pages and content widgets
Line 55: self::processXmlPage($page, $record_order ++, $_POST['page_id'], $_POST['subsite_id']);
Line 63: foreach (self::$page_ids as $old_id => $new_id) {
Line 65: 'old_id' => $old_id,
Line 66: 'new_id' => $new_id,
Line 67: 'widgets' => @self::$old_widets[$old_id],
Line 80: * @param int $parent_id
Line 81: * @param int $subsite_id
Line 83: * @return void
Line 85: private static function processXmlPage($page, $record_order, $parent_id, $subsite_id)
Line 89: $fields['parent_id'] = $parent_id;
Line 90: $fields['subsite_id'] = $subsite_id;
Line 106: $page_id = Pdb::insert('pages', $fields);
Line 108: // Map old page ID to new page ID
Line 109: self::$page_ids[(int) $page['id']] = $page_id;
Line 113: $fields['page_id'] = $page_id;
Line 121: $revision_id = Pdb::insert('page_revisions', $fields);
Line 123: // Map old page ID to new page ID
Line 124: self::$revision_ids[(int) $page['id']] = $revision_id;
Line 129: // Widget area
Line 130: $area = WidgetArea::findAreaByName('embedded');
Line 132: // RichText widget
Line 134: $fields['page_revision_id'] = $revision_id;
Line 135: $fields['area_id'] = $area->getIndex();
Line 141: Pdb::insert('page_widgets', $fields);
Line 147: self::processXmlPage($child_page, $record_order++, $page_id, $subsite_id);
Line 155: * @return void
Line 162: $conditions[] = ['widget.page_revision_id', 'IN', self::$revision_ids];
Line 166: widget.id,
Line 167: widget.page_revision_id,
Line 168: widget.settings
Line 170: ~page_widgets AS widget
Line 174: $widgets = Pdb::query($q, $params, 'arr');
Line 176: foreach ($widgets as $widget) {
Line 177: $settings = json_decode($widget['settings']);
Line 179: $settings->text = self::replacePageIds($settings->text);
Line 182: self::findOldWidgets($widget['page_revision_id'], $settings->text);
Line 184: Pdb::update('page_widgets', ['settings' => json_encode(['text' => $settings->text])], [['id', '=', $widget['id']]]);
Line 190: * Replace page IDs within page URLS
Line 195: private static function replacePageIds($html)
Line 197: return preg_replace_callback('!href="page/view_by_id/([0-9]+)"!', function ($matches)
Line 199: if (isset(self::$page_ids[$matches[1]])) return 'href="page/view_by_id/' . self::$page_ids[$matches[1]] . '"';
Line 206: * Report pages that contain old widgets
Line 209: * @return void
Line 211: private static function findOldWidgets($rev_id, $html)
Line 215: '/\(\(WIDGET [a-zA-Z]*? ?([0-9A-Za-z]+)\)\)/',
Line 222: self::$old_widets[array_search($rev_id, self::$revision_ids)] = implode(' ~ ', $matches[0]);

/sprout/Helpers/ImportCSV.php   Highlighted file source

Line 35: * If not provided, they will be extracted from the first row of the CSV
Line 44: throw new Exception('Invalid argument');
Line 91: foreach ($out as $key => $idx) {
Line 92: $out[$key] = $line[$idx];

/sprout/Helpers/Itemlist.php   Highlighted file source

Line 16: use InvalidArgumentException;
Line 23: * This is usually used for the admin/contents/* route which provides the main
Line 50: throw new InvalidArgumentException('No main columns defined');
Line 86: $val .= '<input id="itemList-select-all" type="checkbox">';
Line 87: $val .= '<label for="itemList-select-all"><span class="-vis-hidden">Select all</span></label>';
Line 169: $val .= "<input type=\"checkbox\" id=\"itemList-checkbox-{$item['id']}\" name=\"ids[]\" value=\"{$item['id']}\">";
Line 170: $val .= "<label for=\"itemList-checkbox-{$item['id']}\"><span class=\"-vis-hidden\">Select row</span></label>";
Line 180: throw new InvalidArgumentException('Main column must either be a string, or an array with 0: ColModifier, 1: string');
Line 280: * if ($row['id'] == 42) return 'ultimate';
Line 300: * @param callable $show_func Function called for each row to show or hide this action for that row
Line 340: * @throws InvalidArgumentException Unknown operation
Line 354: throw new InvalidArgumentException("Unknown operation '{$operation}'");
Line 362: * @throws InvalidArgumentException Unknown operation
Line 415: * Replaces %% with the id of the record.
Line 419: $url = str_replace('%%', Enc::url($item['id']), $url);
Line 420: $url = str_replace('%ne%', $item['id'], $url);

/sprout/Helpers/Jquery.php   Highlighted file source

Line 33: throw new \Exception('Invalid $loc');
Line 38: throw new \Exception('Invalid $lib');

/sprout/Helpers/Json.php   Highlighted file source

Line 59: * If no data is provided, the returned JSON will only contain the 'success' key.
Line 80: * @return void This function calls echo

/sprout/Helpers/JsonForm.php   Highlighted file source

Line 17: use InvalidArgumentException;
Line 22: * and validation rules.
Line 33: * @param int $record_id The base record ID
Line 35: * see {@see Pdb::buildClause}. A clause of 'link_column' => $record_id will be appended to any provided
Line 39: public static function loadMultiEditData(array $conf, $default_link, $record_id, array $conditions)
Line 49: $id = 'multiedit_' . $multed['id'];
Line 52: Pdb::validateIdentifier($table);
Line 59: $table_conditions[] = [$link_column, '=', $record_id];
Line 68: $data[$id] = Pdb::q($q, $values, 'arr');
Line 79: * joiner_local_col Singular of local table name + '_id'
Line 80: * joiner_foreign_col Singular of the foreign_table option + '_id'
Line 91: $auto['joiner_local_col'] = Inflector::singular($local_table_name) . '_id';
Line 94: $auto['joiner_local_col'] = Inflector::singular($auto['foreign_table']) . '_id';
Line 110: * @param int $local_record_id The local record id
Line 112: * see {@see Pdb::buildClause}. A clause of 'link_column' => $record_id will be appended to any provided
Line 116: public static function loadAutofillListData(array $conf, $local_table_name, $local_record_id, array $conditions)
Line 134: Pdb::validateIdentifier($col);
Line 138: Pdb::validateIdentifier($auto['foreign_label_col']);
Line 142: Pdb::validateIdentifier($auto['joiner_local_col']);
Line 143: Pdb::validateIdentifier($auto['joiner_foreign_col']);
Line 144: Pdb::validateIdentifier($auto['joiner_table']);
Line 145: Pdb::validateIdentifier($auto['foreign_table']);
Line 147: // Need ID for saving, value for display, and orderkey for ordering
Line 149: $fields[] = 'item.id';
Line 164: INNER JOIN ~{$auto['foreign_table']} AS item ON item.id = joiner.{$auto['joiner_foreign_col']}
Line 167: $data[$auto['name']] = Pdb::query($q, [$local_record_id], 'arr');
Line 178: * @return void
Line 258: * @param int $id Record ID; for pass-through to function calls
Line 264: public static function renderTabItem(array $item, $for, $id, array $data, array $errors, $name_prepend = '')
Line 266: // Metadata which is passed into argReplace for display/validator argument replacement
Line 268: 'id' => $id,
Line 315: $out .= self::renderTabItem($group_item, $for, $id, $data, $errors, $name_prepend);
Line 332: $args = [$id, $data, $errors];
Line 344: if (!isset($data['multiedit_' . $multed['id']])) {
Line 345: $data['multiedit_' . $multed['id']] = [];
Line 347: if (!isset($errors['multiedit_' . $multed['id']])) {
Line 348: $errors['multiedit_' . $multed['id']] = [];
Line 356: $out = '<script type="text/x-template" id="' . Enc::html('multiedit-' . $multed['id']) . '">';
Line 357: $out .= '<input type="hidden" name="m_id">';
Line 360: $out .= self::renderTabItem($multi_item, $for, $id, $data, $errors, 'm_');
Line 379: $multed['id'],
Line 380: $data['multiedit_' . $multed['id']],
Line 381: $errors['multiedit_' . $multed['id']]
Line 393: throw new InvalidArgumentException(
Line 419: throw new InvalidArgumentException("Field display method '{$func}' does not exist");
Line 477: * @param Validator $validator To validate the data; must be created externally so it can be used for other
Line 478: * validation before and/or after collating the JsonForm data
Line 479: * @param int $item_id The record being edited or 0 for record adding
Line 482: public static function collateData($conf, $mode, Validator $validator, $item_id)
Line 484: $item_id = (int) $item_id;
Line 491: foreach ($_POST['categories'] as $cat_id) {
Line 492: $cat_id = (int) $cat_id;
Line 493: if ($cat_id > 0) $data['categories'][] = $cat_id;
Line 500: // Metadata which is passed into argReplace for display/validator argument replacement
Line 502: 'id' => $item_id,
Line 509: $validator->setFieldLabel($field_defn['name'], @$field_defn['label']);
Line 511: self::collateFieldData($field_defn, @$_POST[$field_defn['name']], $metadata, $validator, $data);
Line 515: // Prevent errors from going into main validation until they have been grouped
Line 516: $segment_validator = new Validator($_POST);
Line 520: self::collateFieldData($temp_defn, @$_POST[$name], $metadata, $segment_validator, $data);
Line 521: $field_errors = $segment_validator->getFieldErrors();
Line 527: $validator->addFieldError($field_defn['name'], $err);
Line 531: $errs = array_merge($errs, $validator->getFieldErrors());
Line 534: $valid = [];
Line 539: $src = 'multiedit_' . $multed['id'];
Line 545: $valid[$src] = [];
Line 559: if (!isset($valid[$src][$item_num])) $valid[$src][$item_num] = new Validator([]);
Line 561: if (!isset($data[$src][$item_num]['id']) and isset($val['id'])) {
Line 562: $data[$src][$item_num]['id'] = (int) $val['id'];
Line 565: $valid[$src][$item_num]->setFieldValue($field_defn['name'], $val[$field]);
Line 570: $valid[$src][$item_num],
Line 577: foreach ($valid[$src] as $item_num => $v) {
Line 598: * Collates a single field's $_POST data for INSERT/UPDATE queries, and performs validation
Line 602: * @param Validator $valid The validator instance to do validation with
Line 605: protected static function collateFieldData(array $field_defn, $input, array $metadata, Validator $valid, array &$data)
Line 618: if (Validator::isEmpty($input)) {
Line 624: $valid->setFieldValue($field, $data[$field]);
Line 628: $valid->required([$field]);
Line 631: if (isset($field_defn['validate'])) {
Line 632: foreach ($field_defn['validate'] as $call) {
Line 640: $valid->check($field, $call['func']);
Line 643: $valid->check($field, $call['func'], $call['args'][0]);
Line 646: $valid->check($field, $call['func'], $call['args'][0], $call['args'][1]);
Line 649: $valid->check($field, $call['func'], $call['args'][0], $call['args'][1], $call['args'][2]);
Line 653: call_user_func_array(array($valid, 'check'), $args);
Line 665: * %% The current record id
Line 675: $arg = $metadata['id'];

/sprout/Helpers/LaunchChecks.php   Highlighted file source

Line 31: // Get list of unique subsite codes actually in use, to avoid noise
Line 67: public static function testCliDomain()
Line 134: if (empty($subsite_config['google_analytics_id'])) {
Line 137: self::addResult('Google Analytics', 'okay', $subsite_config['google_analytics_id']);
Line 147: $templates = array('home', 'inner', 'wide');

/sprout/Helpers/LightweightForm.php   Highlighted file source

Line 32: * If the field has an explicit ID set, that will be added as a class on the wrapper too.
Line 44: if (isset($attrs['id'])) {
Line 45: $classes[] = 'field-element--id-' . Enc::id($attrs['id']);
Line 68: if (!isset($attrs['id'])) {
Line 69: $attrs['id'] = self::genId();
Line 93: * If the field has an explicit ID set, that will be added as a class on the wrapper too.
Line 105: if (isset($attrs['id'])) {
Line 106: $classes[] = 'field-element--id-' . Enc::id($attrs['id']);
Line 127: if (!isset($attrs['id'])) {
Line 128: $attrs['id'] = self::genId();

/sprout/Helpers/LinkSpec.php   Highlighted file source

Line 46: * be provided in $curr_specdata
Line 52: * Validate the submission, for instances where certain constraints apply
Line 54: abstract public function isValid($specdata);

/sprout/Helpers/LinkSpecDocument.php   Highlighted file source

Line 56: * be provided in $curr_specdata
Line 67: * Validate the submission, for instances where certain constraints apply
Line 69: public function isValid($specdata)

/sprout/Helpers/LinkSpecExternal.php   Highlighted file source

Line 45: * be provided in $curr_specdata
Line 56: * Validate the submission, for instances where certain constraints apply
Line 58: public function isValid($specdata)

/sprout/Helpers/LinkSpecInternal.php   Highlighted file source

Line 47: * be provided in $curr_specdata
Line 58: * Validate the submission, for instances where certain constraints apply
Line 60: public function isValid($specdata)

/sprout/Helpers/LinkSpecPage.php   Highlighted file source

Line 31: $node = $root->findNodeValue('id', $specdata);
Line 53: * be provided in $curr_specdata
Line 64: * Validate the submission, for instances where certain constraints apply
Line 66: public function isValid($specdata)

/sprout/Helpers/Lnk.php   Highlighted file source

Line 16: use InvalidArgumentException;
Line 70: * @throw InvalidArgumentException If the link specification is invalid
Line 71: * @throw InvalidArgumentException If the class is not found
Line 79: throw new InvalidArgumentException('Invalid link specification - parse error');
Line 83: throw new InvalidArgumentException('Invalid link specification - missing fields');
Line 87: throw new InvalidArgumentException('Link specification refers to non-existant class');
Line 92: throw new InvalidArgumentException('Link specification refers to non-registered class');
Line 118: * empty, but *not* malformed; it still throws an InvalidArgumentException in that case.
Line 122: * Helpful when you wish to avoid breaking pages when someone deletes the linked record, e.g. a blog post,
Line 128: * @throws InvalidArgumentException If the link specification is malformed
Line 183: * Check if the data supplied for a spec is valid.
Line 186: * @return bool True if valid, false if invalid
Line 188: public static function valid($spec)
Line 191: return $inst->isValid($data);

/sprout/Helpers/Locales/LocaleInfo.php   Highlighted file source

Line 16: use InvalidArgumentException;
Line 23: use Sprout\Helpers\Validator;
Line 133: * This should be used for validation.
Line 187: * @param bool $required True if the address as a whole is required, irrespective of individual fields
Line 205: * @param bool $required True if the address as a whole is required, irrespective of the individual field
Line 249: throw new InvalidArgumentException('Unrecognised address field');
Line 255: * Returns a string which is a formatted version of the address specified using the provided data.
Line 287: * Validate address fields
Line 289: * @param Validator $valid Validator for the form being processed
Line 291: * @return void
Line 293: public function validateAddress(Validator $valid, $required = false)
Line 303: $valid->setFieldLabel($field, $label);
Line 306: if ($required) $valid->required(['street']);
Line 307: $valid->check('street', 'Validity::length', 0, 200);
Line 308: $valid->check('street2', 'Validity::length', 0, 200);
Line 310: if ($required) $valid->required(['town']);
Line 311: $valid->check('town', 'Validity::length', 0, 100);
Line 314: if ($required) $valid->required(['state']);
Line 315: $valid->check('state', 'Validity::length', 0, 100);
Line 319: $valid->check('state', 'Validity::inArray', $states);
Line 324: if ($required) $valid->required(['postcode']);
Line 325: $valid->check('postcode', 'Validity::length', 0, 10);

/sprout/Helpers/Locales/LocaleInfoATA.php   Highlighted file source

Line 29: 'Base Presidente Eduardo Frei Montalva and Villa Las Estrellas',
Line 49: 'González Videla Antarctic Base',
Line 90: 'St. Kliment Ohridski Base',
Line 97: 'WAIS Divide Camp',

/sprout/Helpers/Locales/LocaleInfoAUS.php   Highlighted file source

Line 16: use Sprout\Helpers\Validator;
Line 42: * Validate address fields
Line 44: * @param Validator $valid The validation object to add rules to
Line 47: public function validateAddress(Validator $valid, $required = false)
Line 49: parent::validateAddress($valid, $required);
Line 51: $valid->check('postcode', 'Validity::positiveInt');
Line 52: $valid->check('postcode', 'Validity::length', 4, 4);

/sprout/Helpers/Locales/LocaleInfoCAN.php   Highlighted file source

Line 16: use Sprout\Exceptions\ValidationException;
Line 17: use Sprout\Helpers\Validator;
Line 49: * Validate a Canadian postcode, which must match the format 'A1A 1A1'
Line 51: * @param string $code The postcode to validate
Line 52: * @throws ValidationException If the format isn't correct
Line 54: public static function validatePostcode($code)
Line 71: throw new ValidationException($err);
Line 77: * Validate address fields
Line 79: * @param Validator $valid The validation object to add rules to
Line 82: public function validateAddress(Validator $valid, $required = false)
Line 84: parent::validateAddress($valid, $required);
Line 86: $valid->check('postcode', __CLASS__ . '::validatePostcode');
Line 87: $valid->check('postcode', 'Validity::length', 7, 7);

/sprout/Helpers/Locales/LocaleInfoCHN.php   Highlighted file source

Line 16: use Sprout\Exceptions\ValidationException;
Line 17: use Sprout\Helpers\Validator;
Line 64: * Validate a Chinese postcode, which is a 6-digit number
Line 66: * @param string $code The postcode to validate
Line 67: * @throws ValidationException If the format isn't correct
Line 69: public static function validatePostcode($code)
Line 72: throw new ValidationException('Incorrect format');
Line 78: * Validate address fields
Line 80: * @param Validator $valid The validation object to add rules to
Line 83: public function validateAddress(Validator $valid, $required = false)
Line 85: parent::validateAddress($valid, $required);
Line 87: $valid->check('postcode', __CLASS__ . '::validatePostcode');
Line 88: $valid->check('postcode', 'Validity::length', 6, 6);

/sprout/Helpers/Locales/LocaleInfoCOL.php   Highlighted file source

Line 50: 'SAP' => 'San Andrés, Providencia y Santa Catalina',
Line 55: 'VID' => 'Vichada',

/sprout/Helpers/Locales/LocaleInfoDZA.php   Highlighted file source

Line 31: 'Blida',
Line 44: 'Sidi Bel Abbès',
Line 56: 'Bordj Bou Arréridj',

/sprout/Helpers/Locales/LocaleInfoESP.php   Highlighted file source

Line 46: 'Lérida',
Line 50: 'Madrid',
Line 71: 'Valladolid',

/sprout/Helpers/Locales/LocaleInfoGBR.php   Highlighted file source

Line 16: use Sprout\Exceptions\ValidationException;
Line 17: use Sprout\Helpers\Validator;
Line 43: 'Cambridgeshire',
Line 80: 'Middlesex',
Line 81: 'Midlothian',
Line 129: * Validate a UK postcode
Line 139: * @param string $code The postcode to validate
Line 140: * @throws ValidationException If the format isn't correct
Line 142: public static function validatePostcode($code)
Line 167: throw new ValidationException($err);
Line 172: * Validate address fields
Line 174: * @param Validator $valid The validation object to add rules to
Line 177: public function validateAddress(Validator $valid, $required = false)
Line 179: parent::validateAddress($valid, $required);
Line 181: $valid->check('postcode', __CLASS__ . '::validatePostcode');
Line 182: $valid->check('postcode', 'Validity::length', 6, 8);

/sprout/Helpers/Locales/LocaleInfoGRC.php   Highlighted file source

Line 27: 'Fthiotida',
Line 28: 'Fokida',
Line 29: 'Argolida',
Line 60: 'Chalkidiki',

/sprout/Helpers/Locales/LocaleInfoJPN.php   Highlighted file source

Line 24: 'Hokkaidō' => array(
Line 25: 'Hokkaidō' => 'Hokkaidō',

/sprout/Helpers/Locales/LocaleInfoKOR.php   Highlighted file source

Line 30: 'Gyeonggido',
Line 38: 'Jeju-teukbyeoljachido',

/sprout/Helpers/Locales/LocaleInfoMAR.php   Highlighted file source

Line 39: 'Agadir‐Ida‐Outanane',
Line 52: 'Errachidia',
Line 64: 'El Jadida',
Line 89: 'Sidi Kacem',
Line 91: 'Sidi Youssef Ben Ali',

/sprout/Helpers/Locales/LocaleInfoNZL.php   Highlighted file source

Line 16: use Sprout\Helpers\Validator;
Line 32: * Validate address fields
Line 34: * @param Validator $valid Validator for the form being processed
Line 36: * @return void
Line 38: public function validateAddress(Validator $valid, $required = false)
Line 40: parent::validateAddress($valid, $required);
Line 42: $valid->check('postcode', 'Validity::positiveInt');
Line 43: $valid->check('postcode', 'Validity::length', 4, 4);

/sprout/Helpers/Locales/LocaleInfoPHL.php   Highlighted file source

Line 39: 'Bukidnon',
Line 70: 'Mindoro Occidental',
Line 73: 'Misamis Occidental',
Line 76: 'Negros occidental',

/sprout/Helpers/Locales/LocaleInfoSVN.php   Highlighted file source

Line 58: 'Idrija',
Line 67: 'Kidričevo',
Line 68: 'Kobarid',
Line 157: 'Videm',

/sprout/Helpers/Locales/LocaleInfoTTO.php   Highlighted file source

Line 18: * Locale info for Trinidad and Tobago; see {@see LocaleInfo}

/sprout/Helpers/Locales/LocaleInfoURY.php   Highlighted file source

Line 28: 'FD' => 'Florida',
Line 32: 'MO' => 'Montevideo',

/sprout/Helpers/Locales/LocaleInfoUSA.php   Highlighted file source

Line 16: use Sprout\Exceptions\ValidationException;
Line 17: use Sprout\Helpers\Validator;
Line 36: 'FL'=>"Florida",
Line 39: 'ID'=>"Idaho",
Line 86: * Validate a ZIP Code, as a 5-digit number with an optional appended hyphen with 4 additional digits
Line 89: * @param string $code The postcode to validate
Line 90: * @throws ValidationException If the format isn't correct
Line 92: public static function validatePostcode($code)
Line 95: throw new ValidationException('Incorrect format');
Line 101: * Validate address fields
Line 103: * @param Validator $valid The validation object to add rules to
Line 106: public function validateAddress(Validator $valid, $required = false)
Line 108: parent::validateAddress($valid, $required);
Line 110: $valid->check('postcode', __CLASS__ . '::validatePostcode');
Line 112: // Parent validation checks for postcode length <= 10, so don't double up the max length error message
Line 113: $valid->check('postcode', 'Validity::length', 5, PHP_INT_MAX);

/sprout/Helpers/Model.php   Highlighted file source

Line 17: use karmabunny\kb\RulesValidatorTrait;
Line 18: use karmabunny\kb\Uuid;
Line 19: use karmabunny\kb\Validates;
Line 28: * @property int $id
Line 29: * @property string $uid
Line 37: abstract class Model extends Collection implements PdbModelInterface, Validates
Line 39: use RulesValidatorTrait;
Line 44: public $id = 0;
Line 55: public function save($validate = true): bool
Line 57: if ($validate) $this->validate();
Line 64: if ($this->id > 0) {
Line 67: if (property_exists($this, 'uid')) {
Line 68: if ($data['uid'] === Uuid::nil()) $data['uid'] = $this->getUid();
Line 69: $this->uid = $data['uid'];
Line 72: $pdb->update($table, $data, ['id' => $this->id]);
Line 78: $this->id = $pdb->insert($table, $data);
Line 80: if (property_exists($this, 'uid')) {
Line 81: $this->uid = $this->getUid();
Line 85: ['uid' => $this->uid],
Line 86: ['id' => $this->id]
Line 91: return (bool) $this->id;
Line 103: * Generate an appropriate UUID.
Line 105: * Beware - new records are created with a UUIDv4 while the save() method
Line 106: * generates a UUIDv5. Theoretically this shouldn't be externally apparent
Line 112: protected function getUid()
Line 115: if ($this->id == 0) return Uuid::uuid4();
Line 119: return $pdb->generateUid(static::getTableName(), $this->id);

/sprout/Helpers/Moderate.php   Highlighted file source

Line 39: * [] = array('id' => 'html')
Line 40: * id record identifier
Line 55: public abstract function approve($id);
Line 63: public abstract function delete($id);

/sprout/Helpers/MultiEdit.php   Highlighted file source

Line 18: * UI system for rapid adding/editing of any number of (sub-)records
Line 21: * $images = MultiEdit::load('gallery_images', ['gallery_id' => $gallery_id], 'record_order');
Line 41: public static function load($table, array $where = [], $order = 'id')
Line 43: Pdb::validateIdentifier($table);
Line 48: Pdb::validateIdentifier($col);
Line 68: * idx The record index
Line 78: * MultiEdit::setPostAddJavaScriptFunc('(function($div,data,idx){ console.log($div); })')
Line 129: foreach ($errors as $idx => $errs) {
Line 131: $data[$idx]['error'][$field] = $error;
Line 162: * isn't counted as non-empty; i.e. if all fields are left as their default values, the record is considered

/sprout/Helpers/Navigation.php   Highlighted file source

Line 22: * Provides navigation functions
Line 33: static private $pmm2_nav_id = 0;
Line 60: * @param int $subsite_id The subsite to load pages from. If not provided, the current subsite is assumed.
Line 66: static public function loadPageTree($subsite_id = null, $is_admin = false, $set_root = true)
Line 68: if ($subsite_id == null) {
Line 69: $subsite_id = SubsiteSelector::$content_id;
Line 74: $from_cache = $cache->get("nav:{$subsite_id}");
Line 81: $where = "pages.subsite_id = ?";
Line 86: $q = "SELECT pages.id, pages.parent_id, pages.slug, pages.name, pages.menu_group, pages.show_in_nav,
Line 91: LEFT JOIN ~files AS banners ON pages.banner = banners.id
Line 92: LEFT JOIN ~files AS gallery_thumbs ON pages.gallery_thumb = gallery_thumbs.id
Line 93: INNER JOIN ~page_revisions AS revs ON revs.page_id = pages.id
Line 95: GROUP BY pages.id
Line 96: ORDER BY pages.parent_id, pages.record_order";
Line 98: $result = Pdb::q($q, [$subsite_id], 'arr');
Line 105: 'id' => 0,
Line 106: 'parent_id' => 0,
Line 117: $needprocess[(int)$row['id']] = new Pagenode($row);
Line 128: foreach ($needprocess as $id => $node) {
Line 129: $parent = @$nodecache[(int)$node['parent_id']];
Line 134: unset($needprocess[$id]);
Line 145: $cache->set("nav:{$subsite_id}", $root_node);
Line 179: $subsite_id = $_SESSION['admin']['active_subsite'];
Line 183: $cache->delete("nav:{$subsite_id}");
Line 210: $nav_id = ++self::$pmm2_nav_id;
Line 213: echo "<li id=\"nav{$nav_id}\" class=\"on\"><a href=\"{$home_url}\" class=\"main\">Home</a></li>";
Line 215: echo "<li id=\"nav{$nav_id}\"><a href=\"{$home_url}\" class=\"main\">Home</a></li>";
Line 248: $nav_id = ++self::$pmm2_nav_id;
Line 249: if ($nav_id > $pmm_nav_limit) return;
Line 251: echo "<li id=\"nav{$nav_id}\" class=\"on\">";
Line 253: echo "<li id=\"nav{$nav_id}\">";
Line 287: self::$pmm2_nav_id = 0;
Line 296: echo '<ul id="frankenmenu-list" class="-clearfix">';
Line 361: * classes and ids, and I already had the code for that menu :)
Line 382: $nav_id = ++self::$pmm2_nav_id;
Line 385: echo "<li id=\"nav{$nav_id}\" class=\"on\"><a href=\"{$home_url}\" class=\"main\">Home</a></li>";
Line 387: echo "<li id=\"nav{$nav_id}\"><a href=\"{$home_url}\" class=\"main\">Home</a></li>";
Line 419: $nav_id = ++self::$pmm2_nav_id;
Line 420: if ($nav_id > Kohana::config('sprout.nav_limit')) return;
Line 422: echo "<li id=\"nav{$nav_id}\" class=\"on\">";
Line 424: echo "<li id=\"nav{$nav_id}\">";
Line 528: while ($node['id'] != 0) {
Line 679: // [0] => id, [1] => name, [2] = url
Line 681: $page['id'],
Line 752: * @return array [id, friendly-url, menu-name, childs array]
Line 759: self::$pmm2_nav_id = 0;
Line 768: echo '<ul id="frankenmenu-list" class="-clearfix">';

/sprout/Helpers/NavigationGroups.php   Highlighted file source

Line 29: private static function &loadGroupNames($subsite_id = null) {
Line 30: if (! $subsite_id) {
Line 31: $subsite_id = SubsiteSelector::$subsite_id;
Line 34: if (!isset(self::$names[$subsite_id])) {
Line 35: $q = "SELECT id, page_id, position, name
Line 37: WHERE subsite_id = ?";
Line 38: $res = Pdb::q($q, [$subsite_id], 'pdo');
Line 40: self::$names[$subsite_id] = array();
Line 42: self::$names[$subsite_id][$row['page_id'] . '_' . $row['position']] = $row;
Line 47: if (!isset(self::$extras[$subsite_id])) {
Line 48: $q = "SELECT extra.page_id, extra.text, image.filename AS image
Line 50: LEFT JOIN ~files AS image ON extra.image = image.id
Line 51: WHERE extra.subsite_id = ?";
Line 52: $res = Pdb::q($q, [$subsite_id], 'pdo');
Line 54: self::$extras[$subsite_id] = array();
Line 56: self::$extras[$subsite_id][$row['page_id']] = $row;
Line 60: return self::$names[$subsite_id];
Line 68: * @param TreeNode $page_id The top-parent page id
Line 69: * @return array Group IDs and names
Line 71: public static function getGroupsAdmin($page_id)
Line 81: $num = $groups[$page_id];
Line 88: $key = $page_id . '_' . $position;
Line 93: $update_data['subsite_id'] = (int)$_SESSION['admin']['active_subsite'];
Line 94: $update_data['page_id'] = (int)$page_id;
Line 100: $menu_group_id = Pdb::insert('menu_groups', $update_data);
Line 102: 'id' => $menu_group_id,
Line 107: $out[$names[$key]['id']] = $names[$key];
Line 115: * Get all group details, grouped by top parent page id
Line 123: foreach ($groups as $page_id => $num) {
Line 124: $all_groups[$page_id] = self::getGroupsAdmin($page_id);
Line 132: * Get all group names, grouped by top parent page id
Line 140: foreach ($groups as $page_id => $num) {
Line 141: $groups = self::getGroupsAdmin($page_id);
Line 144: foreach ($groups as $id => $row) {
Line 145: $names[$id] = $row['name'];
Line 148: $all_names[$page_id] = $names;
Line 158: public static function getAllNames($page_id)
Line 165: if ($matches[1] == $page_id) {
Line 174: * Return the group id for a given page and position
Line 176: public static function getId($page_id, $position)
Line 179: return $names[$page_id . '_' . $position]['id'];
Line 185: public static function getName($page_id, $position)
Line 188: return $names[$page_id . '_' . $position]['name'];
Line 194: public static function getItems($page_id, $position, $limit = null)
Line 198: $menu_group = $names[$page_id . '_' . $position]['id'];
Line 217: * Get all extras, grouped by top parent page id
Line 233: * @param int $page_id Top-level page ID
Line 236: public static function getExtras($page_id) {
Line 238: return self::$extras[SubsiteSelector::$subsite_id][$page_id];

/sprout/Helpers/NavigationMenu.php   Highlighted file source

Line 23: * and override the various methods
Line 31: protected static $open_html = '<ul id="frankenmenu-list" class="-clearfix">';
Line 40: * Note that if a sub-class overrides the {@see navigation::sub_menu} method
Line 88: $group_names = NavigationGroups::getAllNames($node['id']);
Line 90: $group_id = NavigationGroups::getId($node['id'], $position);
Line 91: $items = $root->findAllNodes(new TreenodeValueMatcher('menu_group', $group_id));
Line 103: if (isset($custom_dropdown[$node['id']])) {
Line 106: $custom_dropdown[$node['id']], $node, $groups, $selected_node, $selected_ancestors
Line 189: $view->extra = NavigationGroups::getExtras($parent_node['id']);

/sprout/Helpers/Needs.php   Highlighted file source

Line 23: * Provides a system for injecting CSS and Javascript includes into the head of a document even after the head has been outputted.
Line 118: * @return void
Line 176: * @return void
Line 204: * @return void
Line 307: * @return void
Line 368: // Page links to use slugs instead of IDs
Line 374: * Do the path replacements for a provided string

/sprout/Helpers/Notification.php   Highlighted file source

Line 18: * Provides user event notification functions
Line 50: foreach ($_SESSION['notify'][$scope] as $idx => $message) {
Line 66: foreach ($_SESSION['notify'][$scope] as $idx => $message) {
Line 79: unset ($_SESSION['notify'][$scope][$idx]);
Line 90: foreach ($_SESSION['notify'][$scope] as $idx => $message) {
Line 91: $popup = '<div id="notification-box">';
Line 92: $popup .= '<div id="notification-box-content">';
Line 95: $popup .= '<div id="notification-box-links">';

/sprout/Helpers/Page.php   Highlighted file source

Line 17: use InvalidArgumentException;
Line 30: * Get the page id for a given URL
Line 41: return $node['id'];
Line 46: * Return the URL for a page, when given the page id
Line 49: * @param int $id The page id to return the URL for
Line 52: public static function url($id)
Line 54: $id = (int) $id;
Line 55: if (! $id) return null;
Line 59: $node = $root->findNodeValue('id', $id);
Line 61: return 'page/view_by_id/' . $id;
Line 96: $page = Pdb::get('pages', $node['id']);
Line 165: * Gets the embedded widgets (i.e. content blocks) for a page
Line 166: * @param int $rev_id Page revision ID from database (page_revisions.id)
Line 167: * @param string $include 'active' to only include active widgets,
Line 168: * 'all' to include disabled widgets as well
Line 171: public static function getContentWidgets($rev_id, $include)
Line 173: $rev_id = (int) $rev_id;
Line 175: throw new InvalidArgumentException("\$include must be 'active' or 'all'");
Line 180: $q = "SELECT id, type, settings, active, heading, template
Line 181: FROM ~page_widgets
Line 182: WHERE page_revision_id = ? AND area_id = 1 {$active}
Line 184: return Pdb::q($q, [$rev_id], 'map-arr');
Line 189: * Get the page text for a page id, in HTML format, with widgets and everything, ready to go
Line 191: * @param int $page_id Page ID from database
Line 192: * @param int $rev_id If specified, that revision will be used.
Line 194: * N.B. if specified, it must be a valid revision for the specified page
Line 195: * @param int $subsite_id Optional subsite ID - this is required for admins editing a sub-site
Line 200: public static function getText($page_id, $rev_id = 0, $subsite_id = null)
Line 202: $page_id = (int) $page_id;
Line 203: $rev_id = (int) $rev_id;
Line 204: $subsite_id = (int) $subsite_id;
Line 206: if ($subsite_id < 1) $subsite_id = SubsiteSelector::$content_id;
Line 209: 'id' => $page_id,
Line 210: 'subsite_id' => $subsite_id,
Line 212: if ($rev_id > 0) {
Line 213: $clause = "rev.id = :rev_id";
Line 214: $params['rev_id'] = $rev_id;
Line 219: $q = "SELECT rev.id
Line 221: INNER JOIN ~page_revisions AS rev ON page.id = rev.page_id AND {$clause}
Line 222: WHERE page.id = :id AND page.subsite_id = :subsite_id
Line 225: $rev_id = Pdb::query($q, $params, 'val');
Line 233: $widgets = self::getContentWidgets($rev_id, 'active');
Line 234: foreach ($widgets as $widget) {
Line 235: $inst = Widgets::instantiate($widget['type']);
Line 236: $inst->importSettings(json_decode($widget['settings'], true));
Line 237: $inst->setTitle($widget['heading']);
Line 238: $widget_text = $inst->render(WidgetArea::ORIENTATION_WIDE);
Line 239: if (!$widget_text) continue;
Line 244: $text .= $widget_text;
Line 254: public static function attrs($id)
Line 256: $id = (int) $id;
Line 261: $q = "SELECT name, value FROM ~page_attributes WHERE page_id = ?";
Line 262: $attrs = Pdb::q($q, [$id], 'map');
Line 274: * @return array Page IDs
Line 286: $q = "SELECT page_id FROM ~page_attributes WHERE {$where} ORDER BY page_id";
Line 292: * Find pages with a given widget, and optionally the specified settings.
Line 293: * Only widgets on live revisions of active pages are checked.
Line 294: * @param string $class The class of the desired widget.
Line 296: * @return array Page IDs
Line 299: public static function pagesWithWidget($widget_name, array $settings = [])
Line 301: $q = "SELECT page.id, widget.settings
Line 302: FROM ~page_widgets AS widget
Line 303: INNER JOIN ~page_revisions AS rev ON widget.page_revision_id = rev.id AND rev.status = 'live'
Line 304: INNER JOIN ~pages AS page ON rev.page_id = page.id AND page.active = 1
Line 305: WHERE widget.type = ?";
Line 307: return Pdb::query($q, [$widget_name], 'col');
Line 310: $res = Pdb::query($q, [$widget_name], 'pdo');
Line 313: $widget_settings = json_decode($row['settings'], true);
Line 314: $diff = array_diff_assoc($settings, $widget_settings);
Line 316: $pages[] = $row['id'];
Line 329: * If you don't provide a page-id, uses the id of the
Line 335: * @param int $page_id The page to get the last-modified date of
Line 340: public static function lastModified($page_id = null, $date_format = 'd/m/Y')
Line 342: if ($page_id === null) {
Line 345: $page_id = $node['id'];
Line 351: WHERE id = ?
Line 354: $date = Pdb::query($q, [$page_id], 'val');
Line 365: * Should be run inside a transaction.
Line 366: * @param $rev_id ID of revision to make live
Line 367: * @return void
Line 369: public static function activateRevision($rev_id) {
Line 370: $rev_id = (int) $rev_id;
Line 372: $q = "SELECT page_id FROM ~page_revisions WHERE id = ?";
Line 373: $page_id = Pdb::q($q, [$rev_id], 'val');
Line 375: $old_clause = ['page_id' => $page_id, 'status' => 'live'];
Line 378: Pdb::update('page_revisions', ['status' => 'live'], ['id' => $rev_id]);
Line 385: * @param int $page_id
Line 388: public static function determineRelatedLinks($page_id)
Line 395: $matcher = new TreenodeIdsMatcher([$page_id]);

/sprout/Helpers/PageRouting.php   Highlighted file source

Line 39: 'subsite_id' => SubsiteSelector::$subsite_id,
Line 52: (subsite_id = 0 OR subsite_id = :subsite_id)
Line 55: ORDER BY id
Line 88: // Look for a valid page
Line 93: Router::$method = 'viewById';
Line 94: Router::$arguments = array($node['id']);

/sprout/Helpers/PerRecordPerms.php   Highlighted file source

Line 50: $q = "SELECT id FROM ~per_record_permissions WHERE controller = ? LIMIT 1";
Line 66: foreach ($operator_cats as $cat_id) {
Line 67: $cat_id = (int) $cat_id;
Line 68: $clauses[] = "operator_categories LIKE CONCAT('%,{$cat_id},%')";
Line 79: * @param int $item_id ID of the record
Line 81: * int id
Line 82: * array[int]|string categories (ids as int, or the string '*' for all)
Line 85: public static function fetchDetails(ManagedAdminController $ctlr, $item_id)
Line 87: $q = "SELECT id, operator_categories AS categories
Line 89: WHERE controller = ? AND item_id = ?";
Line 90: $row = Pdb::q($q, [$ctlr->getControllerName(), $item_id], 'row');
Line 103: * @post array[int] _prm_categories IDs of operator categories which can edit the record
Line 104: * @post bool _prm_all_cats If true, override _prm_categories; allow all operator categories to edit the record
Line 106: * @param int $item_id ID of the record
Line 107: * @return void
Line 109: public static function save(ManagedAdminController $ctlr, $item_id)
Line 117: 'item_id' => $item_id,
Line 121: $all_cat_ids = array_keys(AdminAuth::getAllCategories());
Line 123: $all_cat_ids = AdminAuth::getOperatorCategories();
Line 126: $cat_ids = @$_POST['_prm_categories'];
Line 127: if (!is_array($cat_ids)) $cat_ids = [];
Line 129: $cat_ids = array_intersect($cat_ids, $all_cat_ids);
Line 133: $cat_ids[] = AdminAuth::getPrimaryCategoryId();
Line 137: $perms['operator_categories'] = ',' . implode(',', $cat_ids) . ',';
Line 146: 'item_id' => $item_id,
Line 149: $q = "SELECT id FROM ~per_record_permissions WHERE {$where}";
Line 151: $perm_id = Pdb::q($q, $params, 'val');
Line 152: Pdb::update('per_record_permissions', $perms, ['id' => $perm_id]);

/sprout/Helpers/phpqrcode/qrconfig.php   Highlighted file source

Line 13: define('QR_FIND_FROM_RANDOM', false); // if false, checks all masks available, otherwise value tells count of masks need to be checked, mask id are got randomly
Line 16: define('QR_PNG_MAXIMUM_SIZE', 1024); // maximum allowed png image width (in pixels), tune to make sure GD and PHP can handle such big images

/sprout/Helpers/phpqrcode/qrencode.php   Highlighted file source

Line 159: public $width;
Line 177: $width = QRspec::getWidth($version);
Line 180: $filler = new FrameFiller($width, $frame);
Line 216: $masked = $maskObj->mask($width, $frame, $input->getErrorCorrectionLevel());
Line 218: $masked = $maskObj->makeMask($width, $frame, (intval(QR_DEFAULT_MASK) % 8), $input->getErrorCorrectionLevel());
Line 221: $masked = $maskObj->makeMask($width, $frame, $mask, $input->getErrorCorrectionLevel());
Line 231: $this->width = $width;
Line 322: public $width;
Line 330: public function __construct($width, &$frame)
Line 332: $this->width = $width;
Line 334: $this->x = $width - 1;
Line 335: $this->y = $width - 1;
Line 364: $w = $this->width;

/sprout/Helpers/phpqrcode/qrinput.php   Highlighted file source

Line 284: throw new Exception('Invalid version no');
Line 301: throw new Exception('Invalid version no');
Line 320: throw new Exception('Invalid ECLEVEL');
Line 492: * Validation

/sprout/Helpers/phpqrcode/qrmask.php   Highlighted file source

Line 40: $this->runLength = array_fill(0, QRSPEC_WIDTH_MAX + 1, 0);
Line 44: public function writeFormatInformation($width, &$frame, $mask, $level)
Line 57: $frame[8][$width - 1 - $i] = chr($v);
Line 74: $frame[$width - 7 + $i][8] = chr($v);
Line 98: private function generateMaskNo($maskNo, $width, $frame)
Line 100: $bitMask = array_fill(0, $width, array_fill(0, $width, 0));
Line 102: for($y=0; $y<$width; $y++) {
Line 103: for($x=0; $x<$width; $x++) {
Line 141: public function makeMaskNo($maskNo, $width, $s, &$d, $maskGenOnly = false)
Line 146: $fileName = QR_CACHE_DIR.'mask_'.$maskNo.DIRECTORY_SEPARATOR.'mask_'.$width.'_'.$maskNo.'.dat';
Line 152: $bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
Line 158: $bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
Line 166: for($y=0; $y<$width; $y++) {
Line 167: for($x=0; $x<$width; $x++) {
Line 179: public function makeMask($width, $frame, $maskNo, $level)
Line 181: $masked = array_fill(0, $width, str_repeat("\0", $width));
Line 182: $this->makeMaskNo($maskNo, $width, $frame, $masked);
Line 183: $this->writeFormatInformation($width, $masked, $maskNo, $level);
Line 218: public function evaluateSymbol($width, $frame)
Line 223: for($y=0; $y<$width; $y++) {
Line 232: for($x=0; $x<$width; $x++) {
Line 258: for($x=0; $x<$width; $x++) {
Line 262: for($y=0; $y<$width; $y++) {
Line 285: public function mask($width, $frame, $level)
Line 307: $mask = array_fill(0, $width, str_repeat("\0", $width));
Line 311: $blacks = $this->makeMaskNo($i, $width, $frame, $mask);
Line 312: $blacks += $this->writeFormatInformation($width, $mask, $i, $level);
Line 313: $blacks = (int)(100 * $blacks / ($width * $width));
Line 315: $demerit += $this->evaluateSymbol($width, $mask);

/sprout/Helpers/phpqrcode/qrspec.php   Highlighted file source

Line 16: * "Automatic identification and data capture techniques --
Line 35: define('QRSPEC_WIDTH_MAX', 177);
Line 37: define('QRCAP_WIDTH', 0);
Line 101: public static function getWidth($version)
Line 103: return self::$capacity[$version][QRCAP_WIDTH];
Line 277: * @param width
Line 299: public static function putAlignmentPattern($version, &$frame, $width)
Line 308: $w = (int)(($width - self::$alignmentPattern[$version][0]) / $d + 2);
Line 389: * @param width
Line 412: $width = self::$capacity[$version][QRCAP_WIDTH];
Line 413: $frameLine = str_repeat ("\0", $width);
Line 414: $frame = array_fill(0, $width, $frameLine);
Line 418: self::putFinderPattern($frame, $width - 7, 0);
Line 419: self::putFinderPattern($frame, 0, $width - 7);
Line 422: $yOffset = $width - 7;
Line 426: $frame[$y][$width - 8] = "\xc0";
Line 434: QRstr::set($frame, $width-8, 7, $setPattern);
Line 435: QRstr::set($frame, 0, $width - 8, $setPattern);
Line 440: QRstr::set($frame, $width - 8, 8, $setPattern, 8);
Line 442: $yOffset = $width - 8;
Line 451: for($i=1; $i<$width-15; $i++) {
Line 457: self::putAlignmentPattern($version, $frame, $width);
Line 467: $frame[($width - 11)+$y][$x] = chr(0x88 | ($v & 1));
Line 475: $frame[$y][$x+($width - 11)] = chr(0x88 | ($v & 1));
Line 482: $frame[$width - 8][8] = "\x81";

/sprout/Helpers/phpqrcode/qrsplit.php   Highlighted file source

Line 16: * "Automatic identification and data capture techniques --
Line 66: public function identifyMode($pos)
Line 103: $mode = $this->identifyMode($p);
Line 181: while($this->identifyMode($p) == QR_MODE_KANJI) {
Line 203: $mode = $this->identifyMode($p);
Line 255: $mode = $this->identifyMode(0);
Line 283: $mode = self::identifyMode(substr($this->dataStr, $p));

/sprout/Helpers/phpqrcode/qrtools.php   Highlighted file source

Line 91: $width = count($frame);
Line 92: $bitMask = array_fill(0, $width, array_fill(0, $width, 0));
Line 94: $mask->makeMaskNo($maskNo, $width, $frame, $bitMask, true);
Line 117: $width = count($frame);
Line 118: for($y=0;$y<$width;$y++) {
Line 119: for($x=0;$x<$width;$x++) {
Line 126: public static function markTime($markerId)
Line 134: $GLOBALS['qr_time_bench'][$markerId] = $time;
Line 147: <thead><tr style="border-bottom:1px solid silver"><td colspan="2" style="text-align:center">BENCHMARK</td></tr></thead>
Line 150: foreach($GLOBALS['qr_time_bench'] as $markerId=>$thisTime) {
Line 152: echo '<tr><th style="text-align:right">till '.$markerId.': </th><td>'.number_format($thisTime-$lastTime, 6).'s</td></tr>';
Line 162: <tr style="border-top:2px solid black"><th style="text-align:right">TOTAL: </th><td>'.number_format($lastTime-$startTime, 6).'s</td></tr>

/sprout/Helpers/phpqrcode/qrvect.php   Highlighted file source

Line 173: '<svg version="1.1" baseProfile="full" width="'.$imgW * $pixelPerPoint.'" height="'.$imgH * $pixelPerPoint.'" viewBox="0 0 '.$imgW * $pixelPerPoint.' '.$imgH * $pixelPerPoint.'"
Line 180: '<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" xmlns:xlink="http://www.w3.org/1999/xlink" width="'.$imgW * $pixelPerPoint.'" height="'.$imgH * $pixelPerPoint.'" viewBox="0 0 '.$imgW * $pixelPerPoint.' '.$imgH * $pixelPerPoint.'">'."\n".
Line 185: $output .= '<rect width="'.$imgW * $pixelPerPoint.'" height="'.$imgH * $pixelPerPoint.'" fill="#'.$backgroundcolor.'" cx="0" cy="0" />'."\n";
Line 190: '<rect id="p" width="'.$pixelPerPoint.'" height="'.$pixelPerPoint.'" />'."\n".

/sprout/Helpers/Preview.php   Highlighted file source

Line 16: use InvalidArgumentException;
Line 42: * @param int $record_id ID of the main record, if it exists; 0 to insert a new record
Line 43: * @return int The ID of the record (whether existing or newly inserted)
Line 45: public static function load(ManagedAdminController $ctlr, array $tables, $record_id = 0)
Line 50: 'pages' => 'parent_id = 0 AND subsite_id = ' . $subsite,
Line 52: 'menu_groups' => 'subsite_id = ' . $subsite,
Line 64: Pdb::validateIdentifier($table);
Line 70: throw new InvalidArgumentException('Conditions must be 1, 0, or an array');
Line 79: // Ideally this should be CREATE TEMPORARY TABLE ... LIKE ...
Line 81: // https://bugs.mysql.com/bug.php?id=60574
Line 85: Pdb::setTablePrefixOverride($table, $new_pf);
Line 91: // The CREATE TEMPORARY TABLE ... SELECT above means there's no AUTO_INCREMENT on the id column,
Line 93: if ($record_id <= 0) {
Line 94: $q = "ALTER TABLE ~{$core_table} MODIFY COLUMN id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY";
Line 96: $record_id = Pdb::insert($core_table, ['id' => 0]);
Line 99: $ctlr->_editSave($record_id);
Line 101: // Edit save has likely set these during validation
Line 102: // Remove them to avoid weird behaviour
Line 106: return $record_id;
Line 117: * @return void This calls echo

/sprout/Helpers/QrCode.php   Highlighted file source

Line 14: * @return void Echos PNG directly

/sprout/Helpers/QueryTo.php   Highlighted file source

Line 16: use InvalidArgumentException;
Line 40: throw new InvalidArgumentException('$result must be a PDOStatement or an array');
Line 110: throw new InvalidArgumentException('$result must be a PDOStatement or an array');
Line 128: if ($row['id']) {
Line 129: $row['id'] = Enc::xml($row['id']);
Line 130: $out .= " id=\"{$row['id']}\"";
Line 131: unset($row['id']);

/sprout/Helpers/RateLimit.php   Highlighted file source

Line 80: $q = "SELECT COUNT(id) AS C

/sprout/Helpers/Recaptcha.php   Highlighted file source

Line 46: // Obviously not a valid request if there's no captcha response.
Line 65: if (! is_bool($res['success'])) throw new Exception('Invalid captcha return data');

/sprout/Helpers/RefineBar.php   Highlighted file source

Line 18: * Provides the search refinement options in the admin UI
Line 22: private $widgets = array();
Line 31: * Add a refine widget
Line 33: * @param RefineWidget $widget Refinement widget to add
Line 37: * @return void
Line 39: public function addWidget(RefineWidget $widget, $operator = null)
Line 41: $this->widgets[] = $widget;
Line 42: $this->groups[$this->curr_group][] = $widget;
Line 44: $this->field_ops[$widget->getName()] = $operator;
Line 63: foreach ($this->widgets as $widget) {
Line 64: unset ($get_fields[$widget->getName()]);
Line 70: $out .= "<input type=\"hidden\" name=\"{$name}\" value=\"{$val}\">";
Line 79: foreach ($this->widgets as $widget) {
Line 80: $html = $widget->render();
Line 81: $label = Enc::html($widget->getLabel());
Line 121: * Returns true if any of the refine bar widgets refer to the specified field
Line 125: foreach ($this->widgets as $w) {
Line 147: * Return a list of search widgets, in groups

/sprout/Helpers/RefineWidget.php   Highlighted file source

Line 18: * Base class for widgets included in a {@see RefineBar}
Line 20: abstract class RefineWidget {
Line 50: * Returns the current value for this refine widget
Line 57: * Draws the widget.
Line 58: * @return string The HTML for the widget.

/sprout/Helpers/RefineWidgetAutocomplete.php   Highlighted file source

Line 17: * An autocomplete widget for the refine bar
Line 19: class RefineWidgetAutocomplete extends RefineWidget
Line 38: * Draws the widget.
Line 39: * @return string The HTML for the widget.

/sprout/Helpers/RefineWidgetDatepicker.php   Highlighted file source

Line 17: * A datepicker widget for the refine bar
Line 19: class RefineWidgetDatepicker extends RefineWidget
Line 38: * Draws the widget.
Line 39: * @return string The HTML for the widget.

/sprout/Helpers/RefineWidgetSelect.php   Highlighted file source

Line 17: * A textbox widget
Line 19: class RefineWidgetSelect extends RefineWidget
Line 30: * Draws the widget.
Line 31: * @return string The HTML for the widget.

/sprout/Helpers/RefineWidgetTextbox.php   Highlighted file source

Line 17: * A textbox widget
Line 19: class RefineWidgetTextbox extends RefineWidget
Line 23: * Draws the widget.
Line 24: * @return string The HTML for the widget.

/sprout/Helpers/Register.php   Highlighted file source

Line 18: use InvalidArgumentException;
Line 24: * incl. widgets, search handlers, tabs, etc.
Line 40: private static $widget_tiles = [];
Line 113: * @return void
Line 114: * @throws InvalidArgumentException If controller doesn't implement FrontEndEntrance
Line 120: throw new InvalidArgumentException($name . " doesn't implement FrontEndEntrance");
Line 239: * @return void
Line 251: * @return void
Line 256: throw new Exception('Invalid module name');
Line 286: * Register the various "content" controllers which are provided by the SproutCMS core
Line 310: throw new Exception('Invalid namespace');
Line 352: * @param string $icon The icon class, sans the 'icon-' part. Examples: 'list', 'grid', 'home', etc.
Line 359: $hidden = \Kohana::config('sprout.admin_tile_hidden');
Line 361: foreach ($hidden as $shorthand) {
Line 362: if (isset($controllers[$shorthand])) $controllers[$shorthand] .= ' [hidden]';
Line 365: foreach ($hidden as $shorthand) {
Line 394: * Register a widget "tile", which is shown when adding widgets (content blocks) to a page
Line 396: * If a tile already exists with that name, the widgets will be added to that tile
Line 402: * @param string $icon The icon class, sans the 'icon-' part. Examples: 'list', 'grid', 'home', etc.
Line 404: * @param array $widgets Widgets to show as links, in format 'name' => 'label'
Line 406: public static function widgetTile($area_name, $name, $icon, $text, array $widgets)
Line 408: $area = WidgetArea::findAreaByName($area_name);
Line 411: if (!isset(self::$widget_tiles[$area_name])) {
Line 412: self::$widget_tiles[$area_name] = [];
Line 415: if (isset(self::$widget_tiles[$area_name][$name])) {
Line 416: self::$widget_tiles[$area_name][$name]['widgets'] = array_merge(
Line 417: self::$widget_tiles[$area_name][$name]['widgets'],
Line 418: $widgets
Line 421: self::$widget_tiles[$area_name][$name] = [
Line 425: 'widgets' => $widgets,
Line 429: foreach ($widgets as $name => $label) {
Line 430: $area->addWidget($name);
Line 436: * Return an array of widget tiles for a given widget area
Line 437: * Each tile has four keys, 'name', 'icon', 'text', and 'widgets'.
Line 441: public static function getWidgetTiles($area_name)
Line 443: if (!isset(self::$widget_tiles[$area_name])) {
Line 444: self::$widget_tiles[$area_name] = [];
Line 447: return self::$widget_tiles[$area_name];
Line 454: * Features allow the Sprout core to access code provided by modules without needing
Line 500: * inner_html The "inside" HTML of widgets (richtext, blog content, etc)
Line 501: * main_content The main content of inner and wide templates
Line 586: * @return void
Line 595: * Register a display condition (this is part of the Context Engine on widgets)
Line 631: * @return void
Line 674: * @return void

/sprout/Helpers/Request.php   Highlighted file source

Line 231: * @return void
Line 259: // Skip invalid content types

/sprout/Helpers/ResizeImageTransform.php   Highlighted file source

Line 22: private $width;
Line 30: * @param int $width The width to resize the image to.
Line 32: * @param int $master Optional master dimension. Image::WIDTH or Image::HEIGHT
Line 34: public function __construct($width, $height, $master = null)
Line 36: $this->width = $width;
Line 50: ($this->width == null or $img->width < $this->width)
Line 57: $img->resize($this->width, $this->height, $this->master);
Line 69: return $this->width * $this->height * 4;
Line 75: * @return array Keys are width, height, and master; these match the constructor args
Line 79: return ['width' => $this->width, 'height' => $this->height, 'master' => $this->master];

/sprout/Helpers/RichText.php   Highlighted file source

Line 34: * @param $width The width of the field, in pixels. Default = 600
Line 36: * @param $type Override the field type. Default as per configuration and $_GET/$_SESSION overrides
Line 38: static public function draw($field_name, $content, $width = 600, $height = 300, $type = null)
Line 62: return $rich->drawInternal($field_name, $content, $width, $height, $config_group);
Line 71: * @param int $width The width of the field, in pixels
Line 75: abstract protected function drawInternal($field_name, $content, $width = 600, $height = 300, $config_group = null);

/sprout/Helpers/RichTextSanitiser.php   Highlighted file source

Line 20: * Helper that strictly validates and sanitises user submitted HTML
Line 108: * @param array $permitted_tags An optional array of permitted tags to override the defaults
Line 113: if (PHP_VERSION_ID < 80000) {
Line 174: * @return void
Line 219: $this->errors[] = "Invalid attribute '{$attr->name}' for '{$node->nodeName}' element.";
Line 307: // Unfortunately HTTP_HOST is the best option that isn't stupidly complicated or

/sprout/Helpers/Router.php   Highlighted file source

Line 65: * @return void
Line 125: * @return void
Line 131: $e = array(400 => '400 Bad Request', 401 => '401 Unauthorized', 403 => '403 Forbidden', 500 => '500 Internal Server Error');
Line 136: $e = '403 Forbidden';
Line 218: // Remove all dot-paths from the URI, they are not valid
Line 232: * @return void Redirects (301) if protocol and/or hostname should change
Line 261: * @return void Terminates script execution

/sprout/Helpers/Rs.php   Highlighted file source

Line 16: use InvalidArgumentException;
Line 30: * @param array|PDOStatement $rs Resultset, which MUST have an id column
Line 31: * @param string $group_id The column with the field to group by,
Line 32: * e.g. cat_id
Line 37: * @return array Grouped rows. The key is the group id, and the value is
Line 41: public static function groupByField($rs, $group_id, array $group_fields = array()) {
Line 43: throw new InvalidArgumentException('$rs must be array or PDOStatement');
Line 48: if (!isset($row['id'])) {
Line 49: throw new InvalidArgumentException('$rs must have an id column');
Line 51: $key = $row[$group_id];
Line 62: $grouped[$key]['rows'][$row['id']] = $row;

/sprout/Helpers/RteLibraryDocuments.php   Highlighted file source

Line 41: $q = "SELECT cat.id, cat.name
Line 43: INNER JOIN ~files_cat_join AS joiner ON joiner.cat_id = cat.id
Line 44: INNER JOIN ~files AS files ON joiner.file_id = files.id
Line 47: GROUP BY cat.id
Line 54: $out[] = new RteLibContainer($row['id'], $row['name']);
Line 62: $cat_id = (int) $path_parts[0];
Line 65: INNER JOIN ~files_cat_join AS joiner ON joiner.file_id = files.id
Line 66: WHERE joiner.cat_id = ? AND files.type = ?
Line 68: $res = Pdb::query($q, [$cat_id, FileConstants::TYPE_DOCUMENT], 'pdo');
Line 109: INNER JOIN ~files_cat_join AS joiner ON joiner.file_id = files.id

/sprout/Helpers/RteLibraryHasCategories.php   Highlighted file source

Line 32: protected $main_columns = ['id', 'name'];
Line 46: * For a given database row, return the display identifier of the record
Line 48: protected function getIdentifier(array $row)
Line 64: * Validates configuration
Line 68: Pdb::validateIdentifier($this->main_table);
Line 71: Pdb::validateIdentifier($col);
Line 74: Pdb::validateIdentifier($col);
Line 77: Pdb::validateIdentifier($col);
Line 80: if (!in_array('id', $this->main_columns)) {
Line 81: $this->main_columns[] = 'id';
Line 102: $q = "SELECT cat.id, cat.name
Line 104: INNER JOIN ~{$joiner_table} AS joiner ON joiner.cat_id = cat.id
Line 105: INNER JOIN ~{$this->main_table} AS main ON joiner.{$joiner_col} = main.id
Line 106: GROUP BY cat.id
Line 112: $out[] = new RteLibContainer($row['id'], $row['name']);
Line 124: INNER JOIN ~{$joiner_table} AS joiner ON joiner.{$joiner_col} = main.id
Line 125: WHERE joiner.cat_id = ?
Line 132: $row['id'],
Line 133: $this->getIdentifier($row),
Line 173: $row['id'],
Line 174: $this->getIdentifier($row),

/sprout/Helpers/RteLibraryImages.php   Highlighted file source

Line 44: $q = "SELECT cat.id, cat.name
Line 46: INNER JOIN ~files_cat_join AS joiner ON joiner.cat_id = cat.id
Line 47: INNER JOIN ~files AS files ON joiner.file_id = files.id
Line 50: GROUP BY cat.id
Line 57: $out[] = new RteLibContainer($row['id'], $row['name']);
Line 65: $cat_id = (int) $path_parts[0];
Line 68: INNER JOIN ~files_cat_join AS joiner ON joiner.file_id = files.id
Line 69: WHERE joiner.cat_id = ? AND files.type = ?
Line 71: $res = Pdb::query($q, [$cat_id, FileConstants::TYPE_IMAGE], 'pdo');
Line 115: INNER JOIN ~files_cat_join AS joiner ON joiner.file_id = files.id

/sprout/Helpers/RteLibraryPages.php   Highlighted file source

Line 40: $parent_id = array_pop($path_parts);
Line 42: $parent_id = 0;
Line 46: $node = $root->findNodeValue('id', $parent_id);
Line 51: if ($parent_id != 0) {
Line 53: $node['id'],
Line 56: 'href' => 'page/view_by_id/' . $node['id'],
Line 69: $row['id'],
Line 75: $row['id'],
Line 78: 'href' => 'page/view_by_id/' . $row['id'],
Line 105: $q = "SELECT pages.id, pages.name, pages.date_modified
Line 115: $row['id'],
Line 118: 'href' => Page::url($row['id']),

/sprout/Helpers/RteLibrarySounds.php   Highlighted file source

Line 41: $q = "SELECT cat.id, cat.name
Line 43: INNER JOIN ~files_cat_join AS joiner ON joiner.cat_id = cat.id
Line 44: INNER JOIN ~files AS files ON joiner.file_id = files.id
Line 47: GROUP BY cat.id
Line 54: $out[] = new RteLibContainer($row['id'], $row['name']);
Line 62: $cat_id = (int) $path_parts[0];
Line 65: INNER JOIN ~files_cat_join AS joiner ON joiner.file_id = files.id
Line 66: WHERE joiner.cat_id = ? AND files.type = ?
Line 68: $res = Pdb::query($q, [$cat_id, FileConstants::TYPE_SOUND], 'pdo');
Line 109: INNER JOIN ~files_cat_join AS joiner ON joiner.file_id = files.id

/sprout/Helpers/Search.php   Highlighted file source

Line 29: private static $record_id;
Line 38: * @param int $record_id Record ID
Line 39: * @return void
Line 41: public static function selectIndex($table, $record_id)
Line 43: Pdb::validateIdentifier($table);
Line 46: self::$record_id = (int) $record_id;
Line 55: Pdb::delete(self::$table, ['record_id' => self::$record_id]);
Line 127: // Build a reverse index of name => id
Line 130: $q = "SELECT name, id FROM ~search_keywords WHERE " . $where;
Line 138: if (empty($word_ids[$word])) {
Line 139: $word_ids[$word] = Pdb::insert('search_keywords', ['name' => $word]);
Line 143: (keyword_id, record_id, relevancy)
Line 145: (:word_id, :rec_id, :rel)
Line 149: 'word_id' => $word_ids[$word],
Line 150: 'rec_id' => self::$record_id,
Line 166: Pdb::validateIdentifier($reference_table);
Line 171: $q = "SELECT DISTINCT keywords.record_id
Line 173: LEFT JOIN ~{$reference_table} AS ref ON keywords.record_id = ref.id
Line 174: WHERE ref.id IS NULL";
Line 175: $ids = Pdb::q($q, [], 'col');
Line 176: if (count($ids) == 0) return true;
Line 179: Pdb::delete($table, [['record_id', 'IN', $ids]]);
Line 202: * [0] PDOStatement, with three columns: record_id; controller_class; relevancy.
Line 219: if (count($search_handlers) == 0) throw new Exception("No search handlers provided");
Line 220: if ($page < 0) throw new Exception("Invalid page specified");
Line 232: foreach ($keywords as $idx => $word) {
Line 233: if (strlen($word) <= 2) unset ($keywords[$idx]);
Line 254: $joins[] = "INNER JOIN ~{$handler->getTable()} AS records ON records.record_id = main.id";
Line 256: $joins[] = "INNER JOIN ~search_keywords AS keywords ON keywords.id = records.keyword_id";
Line 276: $q = '(SELECT ' . ($i == 1 ? 'SQL_CALC_FOUND_ROWS' : '') . " main.id AS record_id, " . $conn->quote($handler->getCtlrName()) . " AS controller_class, ";
Line 282: GROUP BY main.id
Line 313: * $div_class If provided, a wrapper div will be generated, with this class name.

/sprout/Helpers/SearchHandler.php   Highlighted file source

Line 39: throw new \InvalidArgumentException('Controller name must be fully namespaced');
Line 124: * e.g. $handler->addJoin("INNER JOIN categories ON categories.item_id = main.id")

/sprout/Helpers/Security.php   Highlighted file source

Line 17: use InvalidArgumentException;
Line 21: use Sprout\Exceptions\SignatureInvalidException;
Line 40: throw new InvalidArgumentException('Insufficient length; min is 8 bytes');
Line 124: * @throws InvalidArgumentException Config option is not set
Line 125: * @throws InvalidArgumentException Test-server only value used in production
Line 132: throw new InvalidArgumentException('Config "database.server_key" not set');
Line 135: throw new InvalidArgumentException('Config "database.server_key" set to test-server only value');
Line 149: * $sig = Security::serverKeySign(['id' => $id]);
Line 150: * $file_url = "resource/download?id={$id}&sig={$sig}";
Line 172: * Security::serverKeyVerify(['id' => $id], $_GET['sig']);
Line 176: * @throws SignatureInvalidException A non-string value was specified for the signature
Line 177: * @throws SignatureInvalidException If the signature is not valid
Line 178: * @return void
Line 183: throw new SignatureInvalidException('Signature not valid');
Line 186: $sig_valid = self::compareStrings($expected, $signature);
Line 187: if (!$sig_valid) {
Line 188: throw new SignatureInvalidException('Signature not valid');

/sprout/Helpers/Session.php   Highlighted file source

Line 34: protected static $protect = array('session_id', 'user_agent', 'last_activity', 'ip_address', 'total_hits', '_kf_flash_');
Line 86: // Regenerate session id and update session cookie
Line 100: * Get the session id.
Line 104: public static function id()
Line 106: return $_SESSION['session_id'];
Line 113: * @return void
Line 132: // Validate the driver
Line 148: // Validate the session name
Line 149: if ( ! preg_match('~^(?=.*[a-z])[a-z0-9_]++$~iD', Session::$config['name']))
Line 150: throw new Kohana_Exception('session.invalid_session_name', Session::$config['name']);
Line 168: // Put session_id in the session variable
Line 169: $_SESSION['session_id'] = session_id();
Line 187: // Validate data only on hits after one
Line 190: // Validate the session
Line 191: foreach (Session::$config['validate'] as $valid)
Line 193: switch ($valid)
Line 197: if ($_SESSION[$valid] !== Kohana::$user_agent)
Line 203: if ($_SESSION[$valid] !== Request::userIp())
Line 227: * Regenerates the global session id.
Line 229: * @return void
Line 235: // Generate a new session id
Line 236: // Note: also sets a new session cookie with the updated id
Line 237: session_regenerate_id(TRUE);
Line 239: // Update session with new id
Line 240: $_SESSION['session_id'] = session_id();
Line 245: $_SESSION['session_id'] = Session::$driver->regenerate();
Line 253: // Change the cookie value to match the new session id to prevent "lag"
Line 256: $_SESSION['session_id'],
Line 269: * @return void
Line 273: if (session_id() !== '')
Line 292: * @return void
Line 318: * @return void
Line 345: * @return void
Line 371: * @return void
Line 389: * @return void
Line 468: * @return void

/sprout/Helpers/SessionStats.php   Highlighted file source

Line 36: 'embed_video',
Line 91: // Store any provided UTM parameters

/sprout/Helpers/SitemapGen.php   Highlighted file source

Line 34: * @return void Outputs XML directly
Line 62: * @return void Outputs XML directly

/sprout/Helpers/SitemapGenPages.php   Highlighted file source

Line 26: * @return void Outputs XML directly
Line 40: * @return void Outputs XML directly

/sprout/Helpers/Skin.php   Highlighted file source

Line 85: * Optionally provide an array to specify attributes, like so:
Line 151: * Optionally provide an array to specify attributes, like so:

/sprout/Helpers/Slug.php   Highlighted file source

Line 17: use Sprout\Exceptions\ValidationException;
Line 21: * Generate and validate slugs - i.e. unique, SEO-friendly URL segments.
Line 66: Pdb::validateIdentifier($table);
Line 78: * Verify that a slug contains only valid characters
Line 81: * $valid->check('slug', 'Slug::valid');
Line 84: * @throws ValidationException
Line 86: public static function valid($value)
Line 89: throw new ValidationException('contains invalid characters. Slugs may only contain a to z (lower-case), 0 to 9 and hyphens (-)');
Line 98: * $valid->check('slug', 'Slug::unique', 'pages', [['id', '!=', $page_id]]);
Line 101: * @param string $table The table to check, which must contain columns 'id', 'name', and 'slug'
Line 103: * @return void
Line 104: * @throws ValidationException If the slug isn't unique in the table under the specified conditions
Line 105: * @throws InvalidArgumentException If the $table argument is not a valid table name
Line 109: Pdb::validateIdentifier($table);
Line 116: $q = "SELECT id, name FROM ~{$table} WHERE {$where}";
Line 124: throw new ValidationException($err);

/sprout/Helpers/SocialMeta.php   Highlighted file source

Line 106: * music.radio_station, video.movie, video.episode, video.tv_show, video.other

/sprout/Helpers/SocialNetworking.php   Highlighted file source

Line 81: return "<a href=\"{$share_url}\" onclick=\"window.open(this.href, 'Share', 'width=800,height=500'); return false;\" class=\"{$class}\">";
Line 128: return "<a href=\"{$share_url}\" onclick=\"window.open(this.href, 'Share', 'width=800,height=500'); return false;\" class=\"{$class}\">";
Line 159: return "<a href=\"{$share_url}\" onclick=\"window.open(this.href, 'Share', 'width=800,height=500'); return false;\" class=\"{$class}\">";
Line 178: echo "<a href=\"{$share_url}\" onclick=\"window.open(this.href, 'Share', 'width=800,height=500'); return false;\">";

/sprout/Helpers/Spam.php   Highlighted file source

Line 37: $out .= ' <p><b><label for="' . $code . '">Email address:</label></b><br><input name="_email" id="' . $code . '" value=""></p>';
Line 58: * @return void If the check succeeded.
Line 109: * @note Do not rely on this to provide rigorous protection against spam.

/sprout/Helpers/Sprout.php   Highlighted file source

Line 17: use InvalidArgumentException;
Line 175: * $inst = Sprout::instance($widget_class, 'Sprout\\Widgets\\Widget');
Line 181: * @throws InvalidArgumentException If the class does not exist
Line 187: throw new InvalidArgumentException("Class <{$class_name}> does not exist");
Line 193: throw new InvalidArgumentException("Class <{$class_name}> is abstract");
Line 203: throw new InvalidArgumentException("Class <{$class_name}> is not a sub-class of <{$chk}>");
Line 356: * Checks a URL that is to be used for redirection is valid.
Line 425: * Very small times (0, 1 seconds) are considered 'Just now'.
Line 466: $subsite_id = SubsiteSelector::$content_id;
Line 470: WHERE subsite_id = ? AND type = ?
Line 471: ORDER BY id
Line 474: $row = Pdb::q($q, [$subsite_id, $type], 'row');
Line 489: * @param string $limit The number of inserts allowed in the provided time
Line 496: Pdb::validateIdentifier($table);
Line 497: Pdb::validateIdentifier($column);
Line 503: $q = "SELECT COUNT(id) AS C
Line 538: $diff = shell_exec("diff -yat --left-column --width=3004 {$tmp_name1} {$tmp_name2}");
Line 547: $out .= '<th style="width: 420px;" bgcolor="#CECECE">Old revision (paragraph-by-paragraph)</th>';
Line 548: $out .= '<th style="width: 420px;" bgcolor="#CECECE">New revision (paragraph-by-paragraph)</th>';
Line 601: header('Cache-Control: store, cache, must-revalidate, max-age=' . $expires);
Line 615: * Translate an array which may contain a page_id, filename or url into the final URL to use
Line 619: if ($row['page_id']) {
Line 621: $page = $root->findNodeValue('id', $row['page_id']);
Line 655: WHERE subsite_id = ?
Line 658: $date = Pdb::query($q, [SubsiteSelector::$content_id], 'val');
Line 695: $url_base = Subsites::getAbsRoot(SubsiteSelector::$subsite_id);
Line 790: * Check an IP against a list of IP addresses, with logic for CIDR ranges
Line 804: // CIDR

/sprout/Helpers/SproutVariable.php   Highlighted file source

Line 41: public $widgets;
Line 58: $this->widgets = new Widgets();

/sprout/Helpers/Subscribe.php   Highlighted file source

Line 22: * Return a list of records for the provided settings
Line 24: * @param array $handler_settings The settings provided when the user subscribed
Line 31: * url The URL to provide to the user. Can be absolute (http://...) or relative (/...)
Line 41: * @param array $handler_settings The settings provided when the user subscribed

/sprout/Helpers/Subsites.php   Highlighted file source

Line 17: use InvalidArgumentException;
Line 25: * Provides functions for getting information about subsites
Line 40: $q = "SELECT id, cond_directory, cond_domain, content_id, name, code
Line 49: 'id' => 1,
Line 52: 'content_id' => '',
Line 62: $subsites[$sub['id']] = $sub;
Line 82: if (AdminPerms::canAccessSubsite($sub['id'])) $count++;
Line 92: * @param int $selected_id The currently selected subsite, if any
Line 94: public static function listSelector($selected_id = null)
Line 102: echo "<div class=\"field-label -vis-hidden\">";
Line 106: echo "<select id=\"subsite-selector\" name=\"subsite\">";
Line 109: if (AdminPerms::canAccessSubsite($site['id'])) {
Line 113: if ($site['content_id'] != 0) {
Line 116: if ($ss['id'] == $site['content_id']) { $shared_name_html = Enc::html($ss['name']); break; }
Line 124: if ($site['id'] == $selected_id) {
Line 127: echo "<option value=\"{$site['id']}\">{$site_name_html}</option>\n";
Line 140: * Returns the id of the first subsite in the list (alphabetical) that the user is able to access.
Line 148: if (AdminPerms::canAccessSubsite($sub['id'])) return $sub['id'];
Line 158: public static function getName($id)
Line 162: if (!isset(self::$subsites[$id])) {
Line 163: throw new InvalidArgumentException("Subsite #{$id} not found");
Line 166: return self::$subsites[$id]['name'];
Line 172: public static function getCode($id)
Line 176: if (!isset(self::$subsites[$id])) {
Line 177: throw new InvalidArgumentException("Subsite #{$id} not found");
Line 180: return self::$subsites[$id]['code'];
Line 210: * @param int $id The subsite ID, e.g. SubsiteSelector::$subsite_id
Line 215: public static function getAbsRoot($id, $protocol = null)
Line 219: if (!isset(self::$subsites[$id])) {
Line 220: throw new InvalidArgumentException('Subsite not found');
Line 223: if (count(self::$subsites[$id]['cond_domains'])) {
Line 224: $domain = self::determineBestDomain(self::$subsites[$id]['cond_domains']);
Line 237: if (!empty(self::$subsites[$id]['cond_directory'])) {
Line 238: $path = rtrim(self::$subsites[$id]['cond_directory'], '/') . '/';
Line 264: * @param int $subsite_id Subsite to get config value for
Line 267: public static function getConfig($key, $subsite_id)
Line 269: $code = self::getCode($subsite_id);
Line 272: throw new Exception('Subsite #'. $subsite_id . ' does not have a valid code specified');
Line 304: throw new Exception('Invalid subsite "' . $subsite_code . '"; skin directory not found.');

/sprout/Helpers/SubsiteSelector.php   Highlighted file source

Line 23: static public $subsite_id = 0;
Line 24: static public $content_id = 0;
Line 31: * Selects a single subsite by looking up the provided subsite code
Line 32: * Subsite code is provided by the .htaccess file
Line 39: $q = "SELECT id, content_id, code, mobile, cond_domain, cond_directory, require_admin, require_user
Line 42: ORDER BY id";
Line 45: self::$subsite_id = 1;
Line 46: self::$content_id = 1;
Line 142: self::$subsite_id = $selected['id'];
Line 143: self::$content_id = $selected['content_id'] ? $selected['content_id'] : $selected['id'];

/sprout/Helpers/Tags.php   Highlighted file source

Line 29: * @param int $record_id
Line 33: public static function byRecord($table, $record_id)
Line 37: WHERE record_table = ? AND record_id = ?
Line 40: return Pdb::q($q, [$table, $record_id], 'col');
Line 66: * @return array Record IDs
Line 71: $q = "SELECT DISTINCT record_id
Line 94: Pdb::validateIdentifier($table);
Line 96: $q = "SELECT tag.name, COUNT(item.id) AS num
Line 99: ON tag.record_table = ? AND tag.record_id = item.id
Line 101: ORDER BY COUNT(item.id) DESC, tag.name
Line 109: * Results are filtered by subsite, including records with subsite_id of NULL which is all sites
Line 112: * $tags = Tags::recordCountsPerSubsite('blog_posts', 50, SubsiteSelector::$subsite_id);
Line 119: * @param int $subsite_id Subsite to return record counts for; NULL for current subsite
Line 122: public static function recordCountsPerSubsite($table, $limit, $subsite_id = null)
Line 124: Pdb::validateIdentifier($table);
Line 126: if ($subsite_id === null) {
Line 127: $subsite_id = SubsiteSelector::$subsite_id;
Line 130: $q = "SELECT tag.name, COUNT(item.id) AS num
Line 133: ON tag.record_table = ? AND tag.record_id = item.id
Line 134: WHERE item.subsite_id = ? OR item.subsite_id IS NULL
Line 136: ORDER BY COUNT(item.id) DESC, tag.name
Line 138: return Pdb::query($q, [$table, $subsite_id], 'map');
Line 160: * Returns common tags. Typically tags are returned from the provided table, but not necessarily.
Line 188: ORDER BY COUNT(record_id) DESC, name
Line 201: ORDER BY COUNT(record_id) DESC, name
Line 217: * @param int $record_id The record to update
Line 223: public static function update($table, $record_id, array $new_tags, $remove = true)
Line 226: if ($record_id == 0) return false;
Line 232: $current_tags = Tags::byRecord($table, $record_id);
Line 238: Pdb::insert('tags', ['record_table' => $table, 'record_id' => $record_id, 'name' => $tag]);
Line 243: Pdb::delete('tags', ['record_table' => $table, 'record_id' => $record_id, ['name', 'IN', $del_tags]]);

/sprout/Helpers/Text.php   Highlighted file source

Line 325: * Automatically applies <p> and <br /> markup to text. Basically nl2br() on steroids.
Line 375: * @see Aidan Lister: http://aidanlister.com/repos/v/function.size_readable.php
Line 412: * Prevents widow words by inserting a non-breaking space between the last two words.
Line 413: * @see http://www.shauninman.com/archive/2006/08/22/widont_wordpress_plugin
Line 415: * @param string string to remove widows from
Line 418: public static function widont($str)
Line 455: * Make a chunk of valid HTML into plain text, and (optionally) limit the number of words.
Line 494: // Tidy up nbsp characters that break iconv.

/sprout/Helpers/TextareaRichText.php   Highlighted file source

Line 31: * @param int $width The width of the field, in pixels
Line 35: protected function drawInternal($field_name, $content, $width = 600, $height = 300, $config_group = null)
Line 41: echo "<textarea name=\"{$field_name}\" style=\"width: {$width}px; height: {$height}px;\">{$content}</textarea>\n";

/sprout/Helpers/TinyMCE4RichText.php   Highlighted file source

Line 28: * @return void
Line 46: * @param int $width The width of the field, in pixels
Line 50: protected function drawInternal($field_name, $content, $width = 600, $height = 300, $config_group = null)
Line 54: $subsite = SubsiteSelector::$subsite_id;
Line 57: $field_name_class = 'mce4-' . Enc::id($field_name);
Line 79: //$options['paste_word_valid_elements'] = 'b,strong,i,em,h1,h2,h3,h4';
Line 107: throw new Exception('Invalid config group "' . $config_group . '"');
Line 115: if (empty($options['extended_valid_elements'])) {
Line 116: $options['extended_valid_elements'] = 'span[!class]';
Line 118: $options['extended_valid_elements'] .= ',span[!class]';

/sprout/Helpers/Treenode.php   Highlighted file source

Line 65: * Requires the table to have an id, parent_id and record_order field.
Line 74: Pdb::validateIdentifier($table);
Line 75: Pdb::validateIdentifier($order);
Line 83: ORDER BY parent_id, {$order}";
Line 93: $root_node = new Treenode(array('id' => 0));
Line 100: $parent = $root_node->findNodeValue('id', $node['parent_id']);
Line 106: unset ($orphans[$node['id']]);
Line 110: $orphans[$node['id']] = $node;
Line 226: while ($node->data['id'] != 0) {
Line 276: * The array will be id => name.
Line 279: * If specified, the exclude_id argument will be used to
Line 280: * exclude nodes (and their children) according to id.
Line 282: public function getAllChildren($exclude_id = null, $indent_str = ' ', $indent = 0)
Line 286: if ($exclude_id == $node->data['id']) continue;
Line 288: $output[$node->data['id']] = str_repeat($indent_str, $indent) . $node->data['name'];
Line 290: $children = $node->getAllChildren($exclude_id, $indent_str, $indent + 1);
Line 291: foreach ($children as $id => $name) {
Line 292: $output[$id] = $name;
Line 344: throw new Exception("Invalid usage of \$node->__get() for field '{$field}'; use array methods (\$node['{$field}']) instead.");
Line 360: throw new Exception("Invalid usage of \$node->__set() for field '{$field}'; use array methods (\$node['{$field}']) instead.");

/sprout/Helpers/TreenodeHasWidgetMatcher.php   Highlighted file source

Line 23: class TreenodeHasWidgetMatcher implements TreenodeMatcher
Line 25: private $ids = array();
Line 31: * @param string $type The type of widget to search
Line 35: $q = "SELECT rev.page_id
Line 37: INNER JOIN ~page_widgets AS widget ON widget.page_revision_id = rev.id AND widget.active = 1
Line 38: WHERE widget.type = ?
Line 40: ORDER BY rev.page_id";
Line 42: $this->ids = Pdb::query($q, [$type], 'col');
Line 54: if (in_array($node['id'], $this->ids)) return true;

/sprout/Helpers/TreenodeIdsMatcher.php   Highlighted file source

Line 21: * Matches a node which which has an id of one of the ids in the list
Line 23: class TreenodeIdsMatcher implements TreenodeMatcher
Line 25: private $ids = array();
Line 31: public function __construct(array $ids)
Line 33: $this->ids = $ids;
Line 45: if (in_array($node['id'], $this->ids)) return true;

/sprout/Helpers/TreenodeInMenuMatcher.php   Highlighted file source

Line 34: if (! UserPerms::checkPermissionsTree('pages', $node['id'])) return false;

/sprout/Helpers/TreenodePageAttrMatcher.php   Highlighted file source

Line 25: private $page_ids;
Line 37: $this->page_ids = Page::pagesWithAttr($attr_name, $attr_value);
Line 49: if (in_array($node['id'], $this->page_ids)) return true;

/sprout/Helpers/TwoFactor/FixedBitNotation.php   Highlighted file source

Line 15: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Line 60: // Ensure validity of $chars
Line 67: // Ensure validity of $bitsPerCharacter
Line 144: // $bitsPerCharacter and 8, divided by 8

/sprout/Helpers/Upload.php   Highlighted file source

Line 23: * Upload helper class for working with the global $_FILES array and Validation library.
Line 89: /* Validation Rules */
Line 92: * Tests if input data is valid file type, even if no upload is present.
Line 97: public static function valid($file)
Line 108: * Tests if input data has valid upload data.
Line 122: * Validation rule to test if an uploaded file is allowed by extension.
Line 144: * Validation rule to test if an uploaded file is allowed by file size.

/sprout/Helpers/Url.php   Highlighted file source

Line 167: * @return void
Line 192: // Validate the method and default to 302
Line 282: * Checks the provided argument is a valid redirect URL to the local site
Line 326: * Add a domain to provided social link, if it doesn't have one

/sprout/Helpers/UserAgent.php   Highlighted file source

Line 77: * @throws Exception if JSON file missing or invalid
Line 85: if (!$json) throw new Exception('Rules file not valid JSON');
Line 161: foreach ($matches as $idx => $str) {
Line 162: $text = str_replace('$' . $idx , $str, $text);

/sprout/Helpers/UserAuth.php   Highlighted file source

Line 75: * Gets id of logged-in user
Line 76: * See {@see SproutModules\Karmabunny\Users\Helpers\UserAuth::getId}
Line 79: public static function getId()
Line 83: return $inst->getId();

/sprout/Helpers/UserPerms.php   Highlighted file source

Line 63: public static function checkPermissionsTree($table, $id)
Line 67: return $inst->checkPermissionsTree($table, $id);
Line 76: * @return array Each element is a category id
Line 78: public static function getAccessableGroups($table, $id)
Line 82: return $inst->getAccessableGroups($table, $id);
Line 106: * @return array id => name

/sprout/Helpers/Validator.php   Highlighted file source

Line 15: use InvalidArgumentException;
Line 17: use Sprout\Exceptions\ValidationException;
Line 21: * New validation class for Sprout 3.
Line 22: * Used with the {@see Validity} class.
Line 27: * $valid = new Validator($_POST);
Line 29: * $valid->required(['name', 'email']);
Line 31: * $valid->check('name', 'Validity::length', 1, 100);
Line 32: * $valid->check('email', 'Validity::email');
Line 34: * if ($valid->hasErrors()) {
Line 35: * $_SESSION['register']['field_errors'] = $valid->getFieldErrors();
Line 36: * $valid->createNotifications();
Line 44: * $valid = new Validator($_POST);
Line 45: * $valid->required(['name']);
Line 46: * $valid->check('name', 'Validity::length', 1, 100);
Line 48: * if ($valid->hasErrors()) {
Line 49: * $_SESSION['course_edit']['field_errors'] = $valid->getFieldErrors();
Line 50: * $valid->createNotifications();
Line 59: * foreach ($_POST['multiedit_students'] as $idx => $data) {
Line 64: * $multi_valid = new Validator($data);
Line 65: * $multi_valid->setLabels([
Line 70: * $multi_valid->required(['name', 'email']);
Line 71: * $multi_valid->check('name', 'Validity::length', 1, 100);
Line 72: * $multi_valid->check('email', 'Validity::email');
Line 74: * if ($multi_valid->hasErrors()) {
Line 75: * $_SESSION['course_edit']['field_errors']['multiedit_students'][$idx] = $multi_valid->getFieldErrors();
Line 76: * $multi_valid->createNotifications();
Line 85: class Validator
Line 99: * $_SESSION['register']['field_values'] = Validator::trim($_POST);
Line 122: * @param array $data Data to validate
Line 145: * Update the data to validate
Line 147: * @param array $data Data to validate
Line 198: * Check the value of a field against a validation method, storing any error messages received
Line 204: * If a field has already been checked with {@see Validator::required} and the field was empty,
Line 207: * If a empty value is provided, it is not validated - returns true
Line 211: * @return bool True if validation was successful, false if it failed
Line 230: } catch (ValidationException $ex) {
Line 238: * Run a validation check against each value in an array.
Line 239: * Behaviour is very similar to the {@see Validator::check} method.
Line 245: * Return value is an array of key => boolean with the validation result for each key
Line 249: * $validator = new Validator($data);
Line 250: * $result = $validator->arrayCheck('vals', 'Validity::positiveInt');
Line 252: * $errs = $validator->getFieldErrors();
Line 257: * @return array Key => Boolean True if validation was successful, false if it failed
Line 265: throw new InvalidArgumentException("Field <{$field_name}> is not an array");
Line 282: } catch (ValidationException $ex) {
Line 293: * Check multiple fields against a validation method
Line 295: * This is similar to {@see Validator::check} but it's designed for different validation
Line 296: * methods, which work on a set of fields instead of a single field (e.g. Validity::oneRequired)
Line 304: * @return bool True if validation was successful, false if it failed
Line 324: } catch (ValidationException $ex) {
Line 332: * Sadly, the PHP builtin empty() considers '0' to be empty, but it actually isn't
Line 350: * If a field is required and no value is provided, no other validation will be proessed for that field.
Line 384: * This variation is for array validation, e.g. an array of integers
Line 404: * Add an error message from a multiple-field validation (e.g. checking at least one is set)
Line 452: * @return bool True if there were any validation errors, false if there wasn't

/sprout/Helpers/Validity.php   Highlighted file source

Line 15: use InvalidArgumentException;
Line 20: use Sprout\Exceptions\ValidationException;
Line 24: * New validation class for Sprout 3.
Line 25: * All of its methods should give useful errors by throwing a {@see ValidationException}.
Line 26: * Used with the {@see Validator} class.
Line 28: class Validity
Line 35: * $valid->check('name', 'Validity::length', 1, 100)
Line 40: * @throws ValidationException If item is too short or too long
Line 46: throw new ValidationException("Shorter than minimum allowed length of {$min} characters");
Line 49: throw new ValidationException("Longer than maximum allowed length of {$max} characters");
Line 55: * Validate email, commonly used characters only
Line 58: * $valid->check('email', 'Validity::email')
Line 61: * @throws ValidationException
Line 65: $regex = '/^[-_a-z0-9\'+*$^&%=~!?{}]++(?:\.[-_a-z0-9\'+*$^&%=~!?{}]+)*+@(?:(?![-.])[-a-z0-9.]+(?<![-.])\.[a-z]{2,6}|\d{1,3}(?:\.\d{1,3}){3})(?::\d++)?$/iD';
Line 68: throw new ValidationException('Invalid email address');
Line 74: * Validate password by length, type of characters, and list of common passwords
Line 77: * $valid->check('password', 'Validity::password')
Line 79: * @param string $val Password to validate
Line 80: * @throws ValidationException
Line 96: throw new ValidationException(
Line 104: * Checks if a phone number is valid.
Line 107: * $valid->check('mobile', 'Validity::phone', 10)
Line 112: * @throws ValidationException
Line 129: throw new ValidationException("Invalid format");
Line 131: throw new ValidationException("Contains invalid characters");
Line 137: throw new ValidationException("Must contain at least {$min_digits} digits");
Line 140: throw new ValidationException("Cannot contain more than 15 digits");
Line 149: * $valid->check('region_id', 'Validity::positiveInt')
Line 152: * @throws ValidationException
Line 157: throw new ValidationException("Value must be a whole number that is greater than zero");
Line 162: throw new ValidationException("Value must be greater than zero");
Line 175: * $valid->check('name', 'Validity::proseText')
Line 178: * @throws ValidationException
Line 184: throw new ValidationException('Non prose characters found');
Line 193: * $valid->check('date_published', 'Validity::dateMySQL')
Line 196: * @throws ValidationException
Line 202: throw new ValidationException('Invalid date format');
Line 206: throw new ValidationException('Year is outside of range of 1900 to 2100');
Line 210: throw new ValidationException('Month is outside of range of 1 to 12');
Line 214: throw new ValidationException('Day is outside of range of 1 to 31');
Line 223: * $valid->check('event_time', 'Validity::timeMySQL')
Line 226: * @throws ValidationException
Line 232: throw new ValidationException('Invalid time format');
Line 236: throw new ValidationException('Hour is outside of range of 0 to 23');
Line 240: throw new ValidationException('Minute is outside of range of 0 to 59');
Line 244: throw new ValidationException('Second is outside of range of 0 to 59');
Line 253: * $valid->check('start_date', 'Validity::datetimeMySQL')
Line 256: * @throws ValidationException
Line 262: throw new ValidationException('Invalid datedate format');
Line 276: * $valid->check('code', 'Validity::uniqueValue', 'events', 'code')
Line 279: * $valid->check('email', 'Validity::uniqueValue', 'users', 'email', UserAuth::get_id())
Line 284: * @param int $id The ID of the record being edited (0 if adding a new record). This prevents an exception being
Line 287: * @throws ValidationException
Line 288: * @throws InvalidArgumentException If $table or $column is invalid
Line 290: public static function uniqueValue($val, $table, $column, $id = 0, $error_msg = '')
Line 292: Pdb::validateIdentifier($table);
Line 293: Pdb::validateIdentifier($column);
Line 294: $id = (int) $id;
Line 296: $q = "SELECT id FROM ~{$table} WHERE {$column} LIKE ? AND id != ?";
Line 297: $res = Pdb::q($q, [Pdb::likeEscape($val), $id], 'arr');
Line 300: throw new ValidationException($error_msg);
Line 309: * $valid->check('days', 'Validity::allInSet', 'events', 'days')
Line 315: * @throws ValidationException If item is too short or too long
Line 321: throw new ValidationException("Invalid value: {$choice}");
Line 331: * $valid->multipleCheck(['email', 'phone'], 'Validity::oneRequired')
Line 334: * @throws ValidationException
Line 346: throw new ValidationException("At least one of these must be provided");
Line 354: * $valid->multipleCheck(['password1', 'password2'], 'Validity::allMatch')
Line 357: * @throws ValidationException
Line 363: throw new ValidationException("Provided values do not match");
Line 373: * $valid->multipleCheck(['home_phone', 'work_phone'], 'Validity::allUnique')
Line 376: * @throws ValidationException
Line 382: throw new ValidationException("Provided values must not be the same");
Line 391: * $valid->check('vowel', 'Validity::inArray', ['a', 'e', 'i', 'o', 'u'])
Line 395: * @throws ValidationException
Line 400: throw new ValidationException('Invalid value');
Line 410: * $valid->check('vowel', 'Validity::allInArray', ['a', 'e', 'i', 'o', 'u'])
Line 414: * @throws ValidationException
Line 419: throw new ValidationException('Invalid value');
Line 425: * Checks a value matches an ID in a corresponding table
Line 428: * $valid->check('user_id', 'Validity::inTable', 'users')
Line 432: * @return void
Line 433: * @throws ValidationException
Line 441: Pdb::validateIdentifier($table);
Line 442: $q = "SELECT id FROM ~{$table} WHERE id = ?";
Line 445: throw new ValidationException('Invalid value');
Line 451: * Checks all selected values match IDs in a corresponding table
Line 455: * $valid->check('favourite_cities', 'Validity::allInTable', 'cities')
Line 459: * @return void
Line 460: * @throws ValidationException
Line 467: // Extract IDs from autofill list submissions
Line 468: // This is a stop-gap measure until autofill list is reworked to only submit ID values
Line 471: if (!isset($el['id'])) {
Line 472: throw new ValidationException('Invalid value');
Line 474: $el = $el['id'];
Line 480: $found_ids = [];
Line 482: Pdb::validateIdentifier($table);
Line 484: $where = Pdb::buildClause([['id', 'IN', $val]], $params);
Line 486: $q = "SELECT id FROM ~{$table} WHERE {$where}";
Line 487: $found_ids = Pdb::query($q, $params, 'col');
Line 491: if (count($val) != count($found_ids)) {
Line 492: throw new ValidationException('Invalid value');
Line 501: * $valid->check('cost', 'Validity::numeric')
Line 504: * @throws ValidationException
Line 509: throw new ValidationException('Value must be a number');
Line 518: * $valid->check('active', 'Validity::binary')
Line 521: * @throws ValidationException
Line 526: throw new ValidationException('Value must be a "1" or "0"');
Line 535: * $valid->check('cost', 'Validity::range', 0, 5000)
Line 540: * @throws ValidationException
Line 547: throw new ValidationException("Value must be no less than {$min} and no greater than {$max}");
Line 554: * Validates a value meant for an ENUM field
Line 565: throw new ValidationException("Invalid value");
Line 569: * Checks that a date range is valid.
Line 572: * $valid->multipleCheck(['date_start', 'date_end'], 'Validity::dateRange', '1999-01-01', '2099-01-01')
Line 582: throw new InvalidArgumentException('Incorrect number of fields. A date range must only contain two dates: a start and an end date.');
Line 593: // Ideally we'd just switch the values around but that isn't possible
Line 595: throw new ValidationException("The start date, {$date_start}, cannot be later than the end date {$date_end}");
Line 602: throw new ValidationException("The start of this date range is outside the minimum of {$min}");
Line 610: throw new ValidationException("The end of this date range is outside the maximum of {$max}");
Line 619: * @param string $pattern Regex pattern for preg_match. Consider starting with /^ and ending with $/
Line 620: * @return void
Line 621: * @throws ValidationException If the value doesn't match the pattern
Line 626: throw new ValidationException('Incorrect format');
Line 632: * Checks that a value is a valid IPv4 address
Line 634: * @return void
Line 635: * @throws ValidationException If the value isn't a valid IPv4 address
Line 640: throw new ValidationException('Invalid IP address');
Line 646: if ($part > 255) throw new ValidationException('Invalid IP address');
Line 652: * Checks that a value is a valid IPv4 CIDR block
Line 654: * @return void
Line 655: * @throws ValidationException If the value isn't a valid IPv4 CIDR block
Line 657: public static function ipv4Cidr($val)
Line 660: throw new ValidationException('Invalid CIDR block');
Line 667: throw new ValidationException('Invalid network mask');
Line 671: throw new ValidationException('Invalid network mask');
Line 677: * Checks that a value is a valid IPv4 address or CIDR block
Line 679: * @return void
Line 680: * @throws ValidationException If the value isn't a valid IPv4 address or CIDR block
Line 682: public static function ipv4AddrOrCidr($val)
Line 687: self::ipv4Cidr($val);

/sprout/Helpers/View.php   Highlighted file source

Line 160: * @return void
Line 182: * @return void
Line 194: * @return void if the key is not found
Line 235: * @return void if print is TRUE
Line 242: // Merge global and local data, local overrides global with the same name

/sprout/Helpers/WidgetArea.php   Highlighted file source

Line 19: * Stores information about an individual widget area, including the names of all widgets
Line 22: class WidgetArea
Line 27: private $widgets;
Line 33: const ORIENTATION_WIDE = 2;
Line 41: self::ORIENTATION_WIDE => 'wide',
Line 49: * @param string $name The name of the widget area
Line 50: * @param int $index The numerical index of the widget area in the config file
Line 57: $this->widgets = array();
Line 62: * Returns the name of this widget area
Line 70: * Returns the nice name of this widget area
Line 79: * Sets the nice name of this widget area
Line 81: * @param string $name The nice name of the widget
Line 89: * Sets the orientation of the widget area
Line 99: * If true, the widget area is an 'embedding' area.
Line 107: * If the widget area is an embedding area
Line 115: * Gets the orientation of the widget area
Line 123: * Returns the index of this widget area
Line 131: * Adds a widget to the list of widgets allowed for this area
Line 133: * @param string $widget_name The name of the widget to add
Line 135: public function addWidget($widget_name)
Line 137: if (! in_array($widget_name, $this->widgets)) {
Line 138: $this->widgets[] = $widget_name;
Line 143: * Gets the list of allowed widgets
Line 145: public function getWidgets()
Line 147: return $this->widgets;
Line 152: * Adds a widget to the list of widgets allowed for this area
Line 154: * @param string $widget_name The name of the widget to add
Line 156: public function addDefault($widget_name, $settings)
Line 158: Widgets::add($this->index, $widget_name, $settings);
Line 163: * Returns the widget area which has the specified name.
Line 164: * Uses the widget areas defined in the sprout config.
Line 166: * @param string $name The name of the widget area to use.
Line 170: $areas = Kohana::config('sprout.widget_areas');

/sprout/Helpers/Widgets.php   Highlighted file source

Line 23: * Provided functions for the display of widgets
Line 25: class Widgets
Line 27: private static $widget_areas = array();
Line 30: * Add a widget to the list of widgets for a specific area
Line 32: * @param int $area_id The widget area to add the widget to
Line 33: * @param string $name The name of the widget to add
Line 34: * @param array $settings The widget settings to use
Line 35: * @param string $heading HTML H2 rendered front-end within widget
Line 38: public static function add($area_id, $name, $settings, $heading = '', $template = '')
Line 40: if (! preg_match('/^[0-9]+$/', $area_id)) {
Line 41: $area = WidgetArea::findAreaByName($area_id);
Line 43: $area_id = $area->getIndex();
Line 46: self::$widget_areas[$area_id][] = array($name, $settings, $heading, $template);
Line 50: * Remove a widget to the list of widgets for a specific area
Line 52: * @param int $area_id The widget area to add the widget to
Line 53: * @param string $name The name of the widget to remove
Line 55: public static function remove($area_id, $name)
Line 57: if (! preg_match('/^[0-9]+$/', $area_id)) {
Line 58: $area = WidgetArea::findAreaByName($area_id);
Line 60: $area_id = $area->getIndex();
Line 63: foreach (self::$widget_areas[$area_id] as $idx => $def) {
Line 64: if ($def[0] === $name) unset (self::$widget_areas[$area_id][$idx]);
Line 69: * Create an instance of a specific widget in memory
Line 71: * @param string $name The name of the widget to instantiate.
Line 72: * @return Widget The instance
Line 77: if (substr($class, -6) != 'Widget') $class .= 'Widget';
Line 79: $class = 'Sprout\\Widgets\\' . $class;
Line 82: throw new Exception("Unknown widget {$name}");
Line 90: * @param int $orientation See ORIENTATION_* constants in {@see WidgetArea}
Line 91: * @param string $name Class name of the widget
Line 92: * @param array $settings Widget settings (keys and values vary with widget subclass)
Line 93: * @param string $pre_html HTML to go before the rendered widget
Line 94: * @param string $post_html HTML to go after the rendered widget
Line 95: * @param string $heading String Optional HTML H2 rendered on front-end of given widget
Line 97: * @return string Front-end HTML of widget
Line 109: if ($orientation != WidgetArea::ORIENTATION_EMAIL and AdminAuth::isLoggedIn()) {
Line 114: $class = 'widget widget-' . Enc::id(str_replace('\\', '-', (isset($inst->classname) ? $inst->classname : $name)));
Line 115: if (!empty($infobox)) $class .= ' widget-hasinfobox';
Line 116: $class .= ' orientation-' . WidgetArea::$orientation_classes[$orientation];
Line 128: $heading_html = '<h2 class="widget-title">TITLE</h2>';
Line 130: if (!empty(Kohana::config('sprout.widget_title'))) {
Line 131: $heading_html = Kohana::config('sprout.widget_title');
Line 145: // Wrap widget HTML within template snippet
Line 148: $ret = str_replace('{{widget}}', $ret, $view->render());
Line 155: * Render extra widget info for admins
Line 159: $ret = '<div class="widget-infobox">';
Line 181: * Draw the widgets for a specific area
Line 183: * The available widget areas are defined in the {@link /config/sprout.php} file.
Line 184: * Typically there are two areas defined, 'sidebar' and 'embedded'.
Line 186: * @param string $area_name The name of the widget area to draw.
Line 187: * @return string HTML representing the rendered widgets
Line 191: $area = WidgetArea::findAreaByName($area_name);
Line 196: $area_id = $area->getIndex();
Line 197: if (empty(self::$widget_areas[$area_id])) {
Line 202: foreach (self::$widget_areas[$area_id] as $widget_details) {
Line 203: list($name, $settings, $heading, $template) = $widget_details;
Line 212: * Render a widget area, and output directly
Line 214: * @deprecated Use {@see Widgets::renderArea} instead
Line 223: * Does the specified widget area have widgets?
Line 225: * @param string $area_name The name of the widget area to query.
Line 230: public static function hasWidgets($area_name)
Line 232: $area = WidgetArea::findAreaByName($area_name);
Line 234: $area_id = $area->getIndex();
Line 236: if (!empty(self::$widget_areas[$area_id])) return true;
Line 243: * Check whether the widget is allowed to be displayed
Line 245: * @param array $env Calling environment, e.g. page id

/sprout/Helpers/Worker.php   Highlighted file source

Line 27: public static $job_id;
Line 34: public static function start($job_id)
Line 36: self::$job_id = $job_id;
Line 51: $update_fields['pid'] = getmypid();
Line 56: Pdb::update('worker_jobs', $update_fields, array('id' => $job_id));
Line 66: id = " . self::$job_id;
Line 75: id = " . self::$job_id;
Line 89: * @return void
Line 96: if (!self::$job_id) return;
Line 106: // Multiline messages are inserted multiple times as individual lines
Line 125: * @return void
Line 129: if (!self::$job_id) return;
Line 142: * @return void Terminates script
Line 150: if (self::$job_id) {
Line 153: status = 'Failed', date_failure = NOW(), date_modified = NOW(), pid = 0
Line 155: id = " . self::$job_id;
Line 168: * @return void Terminates script
Line 181: if (self::$job_id) {
Line 184: status = 'Success', date_success = NOW(), date_modified = NOW(), pid = 0
Line 186: id = " . self::$job_id;

/sprout/Helpers/WorkerBase.php   Highlighted file source

Line 40: // Whatever is provided as arguments to WorkerCtrl::start will be provided in the function call

/sprout/Helpers/WorkerCtrl.php   Highlighted file source

Line 16: use InvalidArgumentException;
Line 34: * Additional arguments can be provided directly in the function call
Line 37: * job_id The ID of the new job
Line 40: * @throws InvalidArgumentException The class is not valid
Line 52: throw new InvalidArgumentException('Provided class is not a subclass of "Worker".');
Line 78: $job_id = Pdb::insert('worker_jobs', $update_fields);
Line 82: Cron::message("Starting worker job # {$job_id}, class '{$class_name}'.");
Line 95: Pdb::update('worker_jobs', ['php_bin' => 'NOT FOUND'], ['id' => $job_id]);
Line 101: Pdb::update('worker_jobs', ['php_bin' => 'Unuseable (CGI): ' . $php], ['id' => $job_id]);
Line 105: Pdb::update('worker_jobs', ['php_bin' => $php], ['id' => $job_id]);
Line 108: $arg = escapeshellarg("worker_job/run/{$job_id}/{$job_code}");
Line 110: $pid = exec($cmd);
Line 112: if ($pid == 0) {
Line 124: $q = "SELECT status FROM ~worker_jobs WHERE id = ?";
Line 125: $status = Pdb::query($q, [$job_id], 'val');
Line 141: 'job_id' => $job_id,
Line 142: 'log_url' => 'admin/edit/worker_job/' . $job_id
Line 181: public static function getStatus($job_id)
Line 183: $q = "SELECT status, metric1val, metric2val, metric3val FROM ~worker_jobs WHERE id = ?";
Line 184: return Pdb::query($q, [$job_id], 'row');

/sprout/Helpers/WorkerLinkChecker.php   Highlighted file source

Line 38: $q = "SELECT page.id, page.subsite_id, page.name, MAX(rev.id) AS rev_id
Line 40: INNER JOIN ~page_revisions AS rev ON rev.page_id = page.id
Line 43: GROUP BY page.id
Line 44: ORDER BY page.id";
Line 47: // Fetch and collate rich text widgets to produce page text
Line 49: $rev_ids = [];
Line 52: $rev_ids[] = (int) $row['rev_id'];
Line 55: $rev_ids = implode(', ', $rev_ids);
Line 57: $q = "SELECT rev.id AS rev_id, widget.settings
Line 59: INNER JOIN ~page_widgets AS widget ON rev.id = widget.page_revision_id
Line 60: AND widget.area_id = 1 AND widget.type = 'RichText'
Line 61: WHERE rev.id IN ({$rev_ids})
Line 62: ORDER BY widget.record_order";
Line 63: $widgets = Pdb::q($q, [], 'pdo');
Line 64: foreach ($widgets as $widget) {
Line 65: $settings = json_decode($widget['settings'], true);
Line 67: if ($row['rev_id'] == $widget['rev_id']) {
Line 75: $widgets->closeCursor();
Line 87: Worker::message("Checking page # {$row['id']}; '{$row['name']}'");
Line 159: $resultname = $row['id'] . ':' . $row['subsite_id'] . ':' . $row['name'];
Line 168: $found = $this->checkUrl($href, $row['subsite_id']);
Line 171: $errs[$resultname][] = array('page_id' => $row['id'], 'page_name' => $row['name'], 'link_href' => $href, 'link_text' => $elem->textContent, 'err' => $found);
Line 185: public function checkUrl($href, $subsite_id = 1)
Line 194: $href = Subsites::getAbsRoot($subsite_id) . trim($href, '/');
Line 237: return '599 Invalid response';

/sprout/i18n/en_US/core.php   Highlighted file source

Line 19: 'invalid_method' => 'Invalid method %s called in %s',
Line 20: 'invalid_property' => 'The %s property does not exist in the %s class.',
Line 23: 'invalid_filetype' => 'The requested filetype, .%s, is not allowed in your view configuration file',

/sprout/i18n/en_US/database.php   Highlighted file source

Line 20: 'invalid_dsn' => 'The DSN you supplied is not valid: %s',

/sprout/i18n/en_US/event.php   Highlighted file source

Line 17: 'invalid_subject' => 'Attempt to attach invalid subject %s to %s failed: Subjects must extend the Event_Subject class',
Line 18: 'invalid_observer' => 'Attempt to attach invalid observer %s to %s failed: Observers must extend the Event_Observer class',

/sprout/i18n/en_US/image.php   Highlighted file source

Line 21: 'invalid_width' => 'The width you specified, %s, is not valid.',
Line 22: 'invalid_height' => 'The height you specified, %s, is not valid.',
Line 23: 'invalid_dimensions' => 'The dimensions specified for %s are not valid.',
Line 24: 'invalid_master' => 'The master dimension specified is not valid.',
Line 25: 'invalid_flip' => 'The flip direction specified is not valid.',

/sprout/i18n/en_US/session.php   Highlighted file source

Line 17: 'invalid_session_name' => 'The session_name, %s, is invalid. It must contain only alphanumeric characters and underscores. Also at least one letter must be present.',

/sprout/Models/CategoryModel.php   Highlighted file source

Line 14: public $id = 0;
Line 66: ->join($join_table, ['cat_id = id'])
Line 104: * @throws InvalidArgumentException
Line 118: $conditions = [ 'id' => $this->id ];
Line 121: if ($this->id > 0) {
Line 131: $ts_id = 0;
Line 133: $ts_id = 1;
Line 137: $this->id = $pdb->insert($cat_table, $data);
Line 139: if ($ts_id === 1) {
Line 147: return (bool) $this->id;
Line 156: * @throws InvalidArgumentException
Line 164: return (bool) $pdb->delete($cat_table, ['id' => $this->id]);

/sprout/Models/MenuExtraModel.php   Highlighted file source

Line 10: public $subsite_id;
Line 13: public $page_id;

/sprout/Models/MenuGroupModel.php   Highlighted file source

Line 10: public $subsite_id;
Line 13: public $page_id;

/sprout/Models/PageModel.php   Highlighted file source

Line 10: public $parent_id;
Line 13: public $subsite_id;

/sprout/Models/PageRevisionModel.php   Highlighted file source

Line 10: public $page_id;
Line 34: public $operator_id;
Line 37: public $approval_operator_id;

/sprout/Models/PageWidgetModel.php   Highlighted file source

Line 7: class PageWidgetModel extends Model
Line 13: public $page_revision_id;
Line 16: public $area_id;
Line 42: return 'page_widgets';

/sprout/module_template/has_categories/Controllers/Admin/CNAMEAdminController.php   Highlighted file source

Line 16: use InvalidArgumentException;
Line 73: * Saves the provided POST data into a new record in the database
Line 75: * @param int $item_id After saving, the new record id will be returned in this parameter
Line 78: public function _addSave(&$item_id)
Line 80: return parent::_addSave($item_id);
Line 87: protected function _editPreRender($view, $item_id)
Line 89: parent::_editPreRender($view, $item_id);
Line 97: public function _getEditSubActions($item_id)
Line 99: $actions = parent::_getEditSubActions($item_id);
Line 106: * Saves the provided POST data into the specified record
Line 108: * @param int $item_id The record to update
Line 111: public function _editSave($item_id)
Line 113: $item_id = (int) $item_id;
Line 114: if ($item_id <= 0) throw new InvalidArgumentException('$item_id must be greater than 0');
Line 116: return parent::_editSave($item_id);

/sprout/module_template/list/Controllers/Admin/CNAMEAdminController.php   Highlighted file source

Line 16: use InvalidArgumentException;
Line 74: * Saves the provided POST data into a new record in the database
Line 76: * @param int $item_id After saving, the new record id will be returned in this parameter
Line 79: public function _addSave(&$item_id)
Line 82: if (!parent::_addSave($item_id)) return false;
Line 84: $this->fixRecordOrder($item_id);
Line 93: protected function _editPreRender($view, $item_id)
Line 95: parent::_editPreRender($view, $item_id);
Line 103: public function _getEditSubActions($item_id)
Line 105: $actions = parent::_getEditSubActions($item_id);
Line 112: * Saves the provided POST data into the specified record
Line 114: * @param int $item_id The record to update
Line 117: public function _editSave($item_id)
Line 119: $item_id = (int) $item_id;
Line 120: if ($item_id <= 0) throw new InvalidArgumentException('$item_id must be greater than 0');
Line 122: return parent::_editSave($item_id);

/sprout/module_template/tree/Controllers/Admin/CNAMEAdminController.php   Highlighted file source

Line 16: use InvalidArgumentException;
Line 74: * Saves the provided POST data into a new record in the database
Line 76: * @param int $item_id After saving, the new record id will be returned in this parameter
Line 79: public function _addSave(&$item_id)
Line 82: if (!parent::_addSave($item_id)) return false;
Line 84: $this->fixRecordOrder($item_id);
Line 93: protected function _editPreRender($view, $item_id)
Line 95: parent::_editPreRender($view, $item_id);
Line 103: public function _getEditSubActions($item_id)
Line 105: $actions = parent::_getEditSubActions($item_id);
Line 112: * Saves the provided POST data into the specified record
Line 114: * @param int $item_id The record to update
Line 117: public function _editSave($item_id)
Line 119: $item_id = (int) $item_id;
Line 120: if ($item_id <= 0) throw new InvalidArgumentException('$item_id must be greater than 0');
Line 122: $q = "SELECT parent_id FROM ~{$this->table_name} WHERE id = ?";
Line 123: $parent_id = Pdb::query($q, [$item_id], 'val');
Line 126: if (!parent::_editSave($item_id)) return false;
Line 128: if ($parent_id != $_POST['parent_id']) $this->fixRecordOrder($item_id);

/sprout/phpunit_bootstrap.php   Highlighted file source

Line 25: date_default_timezone_set('Australia/Adelaide');

/sprout/sprout_load.php   Highlighted file source

Line 17: use Sprout\Helpers\WidgetArea;
Line 53: Register::contentReplace('main_content', ['Sprout\\Widgets\\ImageGalleryWidget', 'contentReplace']);
Line 59: Register::cronJob('daily', 'Sprout\\Controllers\\Admin\\FileAdminController', 'cronCleanupInvalid');
Line 75: Register::widgetTile(
Line 86: Register::widgetTile(
Line 97: 'VideoPlaylist' => 'Video play-list gallery'
Line 101: Register::widgetTile(
Line 112: Register::widgetTile(
Line 122: Register::widgetTile(
Line 128: 'RssFeedWidget' => 'RSS Feed',
Line 132: Register::widgetTile(
Line 133: 'sidebar',
Line 143: Register::widgetTile(
Line 144: 'sidebar',
Line 155: $area = WidgetArea::findAreaByName('email');
Line 157: $area->addWidget('HtmlCode');

/sprout/tests/adminPermsTest.php   Highlighted file source

Line 30: ['id' => 1, 'parent_id' => 0, 'admin_perm_type' => Constants::PERM_INHERIT], // top-level, all
Line 31: ['id' => 2, 'parent_id' => 1, 'admin_perm_type' => Constants::PERM_INHERIT], // inherit, all
Line 32: ['id' => 3, 'parent_id' => 1, 'admin_perm_type' => Constants::PERM_SPECIFIC], // no perms
Line 33: ['id' => 4, 'parent_id' => 1, 'admin_perm_type' => Constants::PERM_SPECIFIC], // group 1
Line 34: ['id' => 5, 'parent_id' => 1, 'admin_perm_type' => Constants::PERM_SPECIFIC], // group 2
Line 36: ['id' => 6, 'parent_id' => 0, 'admin_perm_type' => Constants::PERM_SPECIFIC], // top-level, none
Line 37: ['id' => 7, 'parent_id' => 6, 'admin_perm_type' => Constants::PERM_INHERIT], // inherit, none
Line 38: ['id' => 8, 'parent_id' => 6, 'admin_perm_type' => Constants::PERM_SPECIFIC], // specific, group 1
Line 40: ['id' => 9, 'parent_id' => 0, 'admin_perm_type' => Constants::PERM_SPECIFIC], // top-level, group 1
Line 41: ['id' => 10,'parent_id' => 9, 'admin_perm_type' => Constants::PERM_INHERIT], // inherit, group 1
Line 42: ['id' => 11,'parent_id' => 9, 'admin_perm_type' => Constants::PERM_SPECIFIC], // specific, group 2
Line 45: ['id' => 1, 'name' => 'Group one'],
Line 46: ['id' => 2, 'name' => 'Group two'],
Line 49: ['item_id' => 4, 'category_id' => 1],
Line 50: ['item_id' => 5, 'category_id' => 2],
Line 51: ['item_id' => 8, 'category_id' => 1],
Line 52: ['item_id' => 9, 'category_id' => 1],
Line 53: ['item_id' => 11,'category_id' => 2],
Line 57: Pdb::setOverrideConnection($sqlite);
Line 59: Pdb::query('CREATE TABLE ~pages (id INT, parent_id INT, admin_perm_type INT)', [], 'null');
Line 64: Pdb::query('CREATE TABLE ~operators_cat_list (id INT, name VARCHAR(100))', [], 'null');
Line 69: Pdb::query('CREATE TABLE ~page_admin_permissions (item_id INT, category_id INT)', [], 'null');
Line 77: Pdb::clearOverrideConnection();
Line 102: * @dataProvider dataGetAccessableGroups
Line 104: public function testGetAccessableGroups($page_id, $expected)
Line 106: $this->assertEquals($expected, AdminPerms::getAccessableGroups('pages', $page_id));

/sprout/tests/admin_authTest.php   Highlighted file source

Line 33: * @dataProvider dataAlgorithms
Line 53: * @dataProvider dataAlgorithms

/sprout/tests/categoryTest.php   Highlighted file source

Line 24: public function dataInvalidTableValidation()
Line 39: * @dataProvider dataInvalidTableValidation
Line 40: * @expectedException InvalidArgumentException
Line 42: public function testTableMain2catValidationInvalid($val)
Line 48: * @dataProvider dataInvalidTableValidation
Line 49: * @expectedException InvalidArgumentException
Line 51: public function testTableMain2joinerValidationInvalid($val)
Line 57: * @dataProvider dataInvalidTableValidation
Line 58: * @expectedException InvalidArgumentException
Line 60: public function testTableCat2mainValidationInvalid($val)
Line 67: public function dataValidTableValidation()
Line 76: * @dataProvider dataValidTableValidation
Line 78: public function testTableMain2catValidationValid($val)
Line 84: * @dataProvider dataValidTableValidation
Line 86: public function testTableMain2joinerValidationValid($val)
Line 92: * @dataProvider dataValidTableValidation
Line 94: public function testTableCat2mainValidationValid($val)

/sprout/tests/content_replaceTest.php   Highlighted file source

Line 34: '<p>Before</p><div class="expando">Inside expando</div>',
Line 39: '<p>Before</p><div class="expando">Inside expando</div>',
Line 44: '<p>Before</p><div class="expando">Inside expando</div><p>After</p>',
Line 49: '<p>Before</p><div align="center" class="expando">Inside expando</div><p>After</p>',
Line 54: '<p>Before</p><div class="expando" align="center">Inside expando</div><p>After</p>',
Line 59: '<p>Before</p><div class = "expando" >Inside expando</div><p>After</p>',
Line 64: '<p>Before</p><div class="expando smalltext">Inside expando</div><p>After</p>',
Line 69: '<p>Before</p><div class="smalltext expando">Inside expando</div><p>After</p>',
Line 74: '<p>Before</p><div class="exp ando">Inside expando</div><p>After</p>',
Line 76: '<p>Before</p><div class="exp ando">Inside expando</div><p>After</p>'
Line 79: '<p>Before</p><div class="expando">Inside expando</div><p>Middle</p><div class="expando">Inside expando</div>',
Line 81: '<p>Before</p><p>Middle</p><p><a href="TEST_LINK">More information</a></p>'
Line 84: '<div class="expando">Inside expando</div><p>Middle</p><div class="expando">Inside expando</div>',
Line 86: '<p>Middle</p><p><a href="TEST_LINK">More information</a></p>'
Line 89: '<p>Before</p><div class="expando">Inside expando</div><p>Middle</p><div class="expando">Inside expando</div><p>After</p>',
Line 91: '<p>Before</p><p>Middle</p><p>After</p><p><a href="TEST_LINK">More information</a></p>'
Line 94: '<p>Before</p><div class="expando">Inside <div>Another div</div> expando</div>',
Line 103: * @dataProvider expandoData

/sprout/tests/DocImport/docImportTest.php   Highlighted file source

Line 41: * @dataProvider htmlBasicData
Line 66: array('<img rel="aaa" width="100" height="150"/>', '<img width="100" height="150" src="image_aaa.jpg">'),
Line 67: array('<img rel="aaa" width="" height=""/>', '<img src="image_aaa.jpg">'),
Line 68: array('<img rel="aaa" width="0" height="0"/>', '<img src="image_aaa.jpg">'),
Line 70: array('<img rel="aaa" error="invalid" width="100" height="150"/>', '<img width="100" height="150" src="http://placehold.it/100x150&amp;text=invalid">'),
Line 71: array('<img rel="aaa" error="invalid" width="0" height="0"/>', '<img src="http://placehold.it/300x50&amp;text=invalid">'),
Line 72: array('<img rel="aaa" error="invalid" width="" height=""/>', '<img src="http://placehold.it/300x50&amp;text=invalid">'),
Line 73: array('<img rel="aaa" error="invalid"/>', '<img src="http://placehold.it/300x50&amp;text=invalid">'),
Line 81: * @dataProvider htmlImagesData
Line 112: * @dataProvider htmlHeadingsData
Line 212: * @dataProvider getHeadingsTreeThreeLevelsData
Line 224: $idx1 = 0;
Line 226: $node1 = $node0->children[$idx1];
Line 231: $idx2 = 0;
Line 233: $node2 = $node1->children[$idx2];
Line 237: $idx2++;
Line 240: $idx1++;

/sprout/tests/embed_videoTest.php   Highlighted file source

Line 14: use Sprout\Helpers\EmbedVideo;
Line 17: class embed_videoTest extends PHPUnit_Framework_TestCase
Line 20: public function testGetVideoIdType()
Line 23: $out = EmbedVideo::getVideoIdType('http://www.youtube.com/watch?v=YP31r70_QNM&feature=grec_index');
Line 24: $this->assertTrue($out[0] == EmbedVideo::TYPE_YOUTUBE);
Line 27: $out = EmbedVideo::getVideoIdType('http://youtu.be/YP31r70_QNM');
Line 28: $this->assertTrue($out[0] == EmbedVideo::TYPE_YOUTUBE);
Line 31: $out = EmbedVideo::getVideoIdType('https://youtu.be/YP31r70_QNM');
Line 32: $this->assertTrue($out[0] == EmbedVideo::TYPE_YOUTUBE);
Line 35: $out = EmbedVideo::getVideoIdType('http://www.youtube.com/watch?v=c6jWWfQJt78&feature=grec_index');
Line 36: $this->assertTrue($out[0] == EmbedVideo::TYPE_YOUTUBE);
Line 39: $out = EmbedVideo::getVideoIdType('http://www.youtube.com/watch?feature=grec_index&v=c6jWWfQJt78');
Line 40: $this->assertTrue($out[0] == EmbedVideo::TYPE_YOUTUBE);
Line 43: $out = EmbedVideo::getVideoIdType('http://youtube.com/watch?v=c6jWWfQJt78');
Line 44: $this->assertTrue($out[0] == EmbedVideo::TYPE_YOUTUBE);
Line 47: $out = EmbedVideo::getVideoIdType('http://youtube.com/watch?v=c6jWWfQJt78');
Line 48: $this->assertTrue($out[0] == EmbedVideo::TYPE_YOUTUBE);
Line 51: $out = EmbedVideo::getVideoIdType('http://youtu.be/c6jWWfQJt78');
Line 52: $this->assertTrue($out[0] == EmbedVideo::TYPE_YOUTUBE);
Line 55: $out = EmbedVideo::getVideoIdType('https://youtu.be/c6jWWfQJt78');
Line 56: $this->assertTrue($out[0] == EmbedVideo::TYPE_YOUTUBE);
Line 59: $out = EmbedVideo::getVideoIdType('http://youtu.be/dK-Wy2NhO8o');
Line 60: $this->assertTrue($out[0] == EmbedVideo::TYPE_YOUTUBE);
Line 63: $out = EmbedVideo::getVideoIdType('http://www.youtube.com/v/4_gMar4_Jhg?version=3&f=videos&app=youtube_gdata&rel=0');
Line 64: $this->assertTrue($out[0] == EmbedVideo::TYPE_YOUTUBE);
Line 67: $out = EmbedVideo::getVideoIdType('https://www.youtube.com/v/4_gMar4_Jhg?version=3&f=videos&app=youtube_gdata&rel=0');
Line 68: $this->assertTrue($out[0] == EmbedVideo::TYPE_YOUTUBE);
Line 71: $out = EmbedVideo::getVideoIdType('http://www.youtube.com/user/inyaka');
Line 74: $out = EmbedVideo::getVideoIdType('http://youtube.com/user/inyaka');
Line 79: $out = EmbedVideo::getVideoIdType('http://vimeo.com/6745866');
Line 80: $this->assertTrue($out[0] == EmbedVideo::TYPE_VIMEO);
Line 83: $out = EmbedVideo::getVideoIdType('https://vimeo.com/6745866');
Line 84: $this->assertTrue($out[0] == EmbedVideo::TYPE_VIMEO);
Line 87: $out = EmbedVideo::getVideoIdType('http://vimeo.com/');
Line 90: $out = EmbedVideo::getVideoIdType('http://vimeo.com/channels/staffpicks#13906628');
Line 95: $out = EmbedVideo::getVideoIdType('http://thejosh.info');
Line 98: $out = EmbedVideo::getVideoIdType('abcde');
Line 101: $out = EmbedVideo::getVideoIdType(array());
Line 108: // Three video urls
Line 109: $out = EmbedVideo::renderEmbed('http://www.youtube.com/watch?v=YP31r70_QNM&feature=grec_index');
Line 115: $out = EmbedVideo::renderEmbed('http://youtu.be/YP31r70_QNM');
Line 121: $out = EmbedVideo::renderEmbed('http://vimeo.com/6745866');
Line 127: $out = EmbedVideo::renderEmbed('https://vimeo.com/6745866');
Line 134: // Invalid urls
Line 135: $out = EmbedVideo::renderEmbed('http://thejosh.info');
Line 138: $out = EmbedVideo::renderEmbed(array());
Line 143: $out = EmbedVideo::renderEmbed('http://youtu.be/YP31r70_QNM', 500, 1000);
Line 151: $out = EmbedVideo::renderEmbed('https://vimeo.com/6745866', 500, 1000);
Line 154: $out = EmbedVideo::renderEmbed('https://vimeo.com/6745866', 500, 1000, array());
Line 157: $out = EmbedVideo::renderEmbed('https://vimeo.com/6745866', 500, 1000, array('autoplay' => false));
Line 160: $out = EmbedVideo::renderEmbed('https://vimeo.com/6745866', 500, 1000, array('autoplay' => true));
Line 167: $out = EmbedVideo::renderEmbed('https://vimeo.com/6745866', 500, 1000);
Line 168: $this->assertContains('title="Embedded video"', $out);
Line 170: $out = EmbedVideo::renderEmbed('https://vimeo.com/6745866', 500, 1000, array('title' => 'test'));
Line 173: $out = EmbedVideo::renderEmbed('https://vimeo.com/6745866', 500, 1000, array('title' => null));
Line 174: $this->assertContains('title="Embedded video"', $out);
Line 176: $out = EmbedVideo::renderEmbed('https://vimeo.com/6745866', 500, 1000, array('title' => ''));
Line 177: $this->assertContains('title="Embedded video"', $out);
Line 186: $out = EmbedVideo::getThumbFilename('http://www.youtube.com/watch?v=YP31r70_QNM&feature=grec_index');
Line 194: $out = EmbedVideo::getThumbFilename('http://youtu.be/YP31r70_QNM');
Line 202: $out = EmbedVideo::getThumbFilename('http://vimeo.com/6745866');
Line 210: $out = EmbedVideo::getThumbFilename('dsfsjfsfbnsfbshjfb');

/sprout/tests/encHelperTest.php   Highlighted file source

Line 122: public function testId()
Line 124: $this->assertEquals(Enc::id('a'), 'a');
Line 125: $this->assertEquals(Enc::id('&'), '');
Line 126: $this->assertEquals(Enc::id('"'), '');
Line 127: $this->assertEquals(Enc::id('hey ya'), 'hey_ya');
Line 128: $this->assertEquals(Enc::id('ê'), '');
Line 129: $this->assertEquals(Enc::id('lowercase_id'), 'lowercase_id');
Line 130: $this->assertEquals(Enc::id('UPPERCASE_ID'), 'UPPERCASE_ID');
Line 131: $this->assertEquals(Enc::id('MIXED_case_ID'), 'MIXED_case_ID');
Line 132: $this->assertEquals(Enc::id('test--dashes'), 'test--dashes');
Line 133: $this->assertEquals(Enc::id('underscore_test'), 'underscore_test');
Line 134: $this->assertEquals(Enc::id('double__underscore__test'), 'double_underscore_test');
Line 135: $this->assertEquals(Enc::id('trailing_underscore_test_'), 'trailing_underscore_test');
Line 136: $this->assertEquals(Enc::id('no_symbols~!@#$%^&*()<>.,?/\'":;|\\]}[{`_no_symbols'), 'no_symbols_no_symbols');
Line 137: $this->assertEquals(Enc::id("\0"), '');
Line 138: $this->assertEquals(Enc::id("\x1A"), '');
Line 139: $this->assertEquals(Enc::id(array()), '');

/sprout/tests/formTest.php   Highlighted file source

Line 35: <input type="text" value="" name="bob" class="textbox" id="field0"/>
Line 49: public function testWrapperID()
Line 52: $field = Form::text('bob', ['id' => 'first-name']);
Line 53: $this->assertContains('field-element--id-first-name', $field);

/sprout/tests/httpreqTest.php   Highlighted file source

Line 69: * @dataProvider dataBuildHeadersString
Line 78: public function dataBuildHeadersStringInvalid()
Line 104: * @dataProvider dataBuildHeadersStringInvalid
Line 105: * @expectedException InvalidArgumentException
Line 107: public function testBuildHeadersStringInvalid($input)

/sprout/tests/i18nTest.php   Highlighted file source

Line 70: * @dataProvider dataNumber
Line 80: * @dataProvider dataMoney

/sprout/tests/itemlistTest.php   Highlighted file source

Line 71: 'ID' => 'id',
Line 73: $itemlist->items = [['id' => 1]];
Line 84: 'ID' => 'id',
Line 86: $itemlist->items = [['id' => 1]];
Line 98: 'ID' => 'id',
Line 100: $itemlist->items = [['id' => 1]];
Line 102: $itemlist->addAction('*hidden*', 'Hidden', '', function($row){ return false; });
Line 106: $this->assertNotContains('*hidden*', $result);

/sprout/tests/lnkTest.php   Highlighted file source

Line 81: * @dataProvider dataAtag

/sprout/tests/LocaleInfoTest.php   Highlighted file source

Line 36: * @dataProvider dataGetStateName

/sprout/tests/navigationTest.php   Highlighted file source

Line 21: // pages.id, pages.parent_id, pages.active, pages.name, page_revisions.type, page_revisions.status
Line 47: $q = "INSERT INTO unit_test_{$rand}_pages SET id = ?, subsite_id = 1, parent_id = ?, active = ?, name = ?, slug = ?";
Line 51: $q = "INSERT INTO unit_test_{$rand}_page_revisions SET page_id = ?, type = ?, status = ?";
Line 56: Pdb::setTablePrefixOverride('pages', "unit_test_{$rand}_");
Line 57: Pdb::setTablePrefixOverride('page_revisions', "unit_test_{$rand}_");
Line 65: $q = "SELECT * FROM ~pages WHERE parent_id = 0";
Line 79: Pdb::setTablePrefixOverride('pages', Pdb::prefix());
Line 80: Pdb::setTablePrefixOverride('page_revisions', Pdb::prefix());
Line 130: * @dataProvider dataCustomBreadcrumb

/sprout/tests/pageTest.php   Highlighted file source

Line 38: $this->assertTrue($url == 'page/view_by_id/2362728');
Line 41: $this->assertTrue($url == 'page/view_by_id/2362728');

/sprout/tests/securityHelperTest.php   Highlighted file source

Line 71: * @dataProvider dataRandDistribution
Line 153: foreach ($matches as $idx => $val) {
Line 174: * @dataProvider dataPasswordComplexityLength
Line 206: * @dataProvider dataPasswordComplexityClasses
Line 224: * @dataProvider dataPasswordComplexityBadlist

/sprout/tests/SlugTest.php   Highlighted file source

Line 4: use Sprout\Exceptions\ValidationException;
Line 8: public function dataValid()
Line 27: * @dataProvider dataValid
Line 29: public function testValid($value)
Line 32: Slug::valid($value);
Line 34: } catch (ValidationException $exp) {
Line 35: $this->assertEquals($value, 'Slug is valid but failed the validation test');
Line 39: public function dataInvalid()
Line 46: ['INVALID'],
Line 88: * @dataProvider dataInvalid
Line 89: * @expectedException Sprout\Exceptions\ValidationException
Line 91: public function testInvalid($value)
Line 93: Slug::valid($value);

/sprout/tests/spamHelperTest.php   Highlighted file source

Line 30: $this->assertContains('id="f_', $html);
Line 33: // Label for= and input id= should match

/sprout/tests/sproutTest.php   Highlighted file source

Line 120: * @dataProvider dataSpecialFileLinksWorking
Line 191: * @dataProvider dataSpecialFileLinksNotWorking
Line 209: public function testIpaddressCIDR()
Line 231: * @expectedException InvalidArgumentException
Line 239: * @expectedException InvalidArgumentException
Line 259: * @dataProvider dataInstanceNotImplements
Line 260: * @expectedException InvalidArgumentException

/sprout/tests/subsitesTest.php   Highlighted file source

Line 20: * @expectedException InvalidArgumentException

/sprout/tests/tagsTest.php   Highlighted file source

Line 40: * @dataProvider dataSplitupTags

/sprout/tests/textTest.php   Highlighted file source

Line 73: "<ul>\n<li>4 star accommodation</li>\n<li>3 Bedroom</li>\n<li>Queen Bed/Singles/Bunk Bed</li>\n<li>All linen provided</li></ul>",
Line 82: * @dataProvider dataLimitWordsHtml
Line 100: ['Hate leads to the dark side', '***e leads to the dark side', false],
Line 101: ['Hate leads to the dark side', '**** leads to the dark side', true],
Line 116: * @dataProvider dataCensor
Line 203: * @dataProvider dataPlain
Line 233: * @dataProvider dataRichtext
Line 262: * @dataProvider dataRichtextBlockTag
Line 287: * @dataProvider dataLcToCamelCaps
Line 310: * @dataProvider dataLcToCamelCase
Line 334: * @dataProvider dataCamelToLc
Line 361: * @dataProvider dataLimitedSubsetHtml
Line 385: * @dataProvider dataContainsFormTag

/sprout/tests/urlTest.php   Highlighted file source

Line 35: $this->assertTrue(Url::checkRedirect('/hello/world?id=123', true));
Line 36: $this->assertTrue(Url::checkRedirect('hello/world?id=123', true));
Line 37: $this->assertTrue(Url::checkRedirect('hello/wor_ld?id=123', true));
Line 38: $this->assertTrue(Url::checkRedirect('hello/wor-ld?id=123', true));
Line 39: $this->assertTrue(Url::checkRedirect('hello/wor_ld?id=12-3', true));
Line 40: $this->assertTrue(Url::checkRedirect('hello/wor-ld?id=12_3', true));
Line 41: $this->assertTrue(Url::checkRedirect('hello/world?id=12_3', true));
Line 42: $this->assertTrue(Url::checkRedirect('hello/world?id=123%204', true));
Line 43: $this->assertTrue(Url::checkRedirect('hello/world?id=%20', true));
Line 44: $this->assertTrue(Url::checkRedirect('hello/world?id=aa_%20-bb', true));
Line 47: $this->assertFalse(Url::checkRedirect('/hello/world?id=123', false));
Line 48: $this->assertFalse(Url::checkRedirect('hello/world?id=123', false));
Line 49: $this->assertFalse(Url::checkRedirect('hello/wo_rld?id=123', false));
Line 50: $this->assertFalse(Url::checkRedirect('hello/wo-rld?id=123', false));
Line 53: $this->assertFalse(Url::checkRedirect('?id=123', false));
Line 54: $this->assertFalse(Url::checkRedirect('?id=123', true));
Line 96: * @dataProvider dataAddSocialDomain
Line 118: * @dataProvider dataAddUrlScheme

/sprout/tests/validiatorTest.php   Highlighted file source

Line 14: use Sprout\Helpers\Validator;
Line 17: class validatorTest extends PHPUnit_Framework_TestCase
Line 22: ['aa', 'Validity::email'],
Line 23: ['@example.com', 'Validity::email'],
Line 24: ['test@', 'Validity::email'],
Line 25: ['A', 'Validity::length', 2],
Line 26: ['A', 'Validity::length', 2, 3],
Line 27: ['A', 'Validity::positiveInt'],
Line 32: * @dataProvider dataCheckFailures
Line 36: $validator = new Validator(['field' => $value]);
Line 38: // Awful hack to pass through varargs to the Validator::check method
Line 41: call_user_func_array([$validator, 'check'], $args);
Line 43: $this->assertTrue($validator->hasErrors());
Line 44: $this->assertCount(1, $validator->getFieldErrors());
Line 45: $this->assertArrayHasKey('field', $validator->getFieldErrors());
Line 46: $errs = $validator->getFieldErrors();
Line 53: $validator = new Validator($data);
Line 55: $results = $validator->arrayCheck('vals', 'Validity::positiveInt');
Line 64: $this->assertTrue($validator->hasErrors());
Line 65: $this->assertCount(1, $validator->getFieldErrors());
Line 66: $this->assertArrayHasKey('vals', $validator->getFieldErrors());
Line 68: $errs = $validator->getFieldErrors();

/sprout/tests/validityTest.php   Highlighted file source

Line 14: use Sprout\Helpers\Validity;
Line 15: use Sprout\Exceptions\ValidationException;
Line 18: class validityTest extends PHPUnit_Framework_TestCase
Line 31: * @dataProvider dataEmail
Line 36: Validity::email($value);
Line 38: } catch (ValidationException $ex) {
Line 56: * @dataProvider dataPositiveInt
Line 61: Validity::positiveInt($value);
Line 63: } catch (ValidationException $ex) {
Line 76: // Anything else is invalid
Line 91: * @dataProvider dataBinary
Line 96: Validity::binary($value);
Line 98: } catch (ValidationException $ex) {
Line 123: * @dataProvider dataDateMySQL
Line 128: Validity::dateMySQL($value);
Line 130: } catch (ValidationException $ex) {

/sprout/tests/WorkerLinkCheckerTest.php   Highlighted file source

Line 40: * @dataProvider dataCheckOkay
Line 65: * @dataProvider dataCheckBad

/sprout/views/404_error.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/access_denied.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/action_log_edit.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 44: <b>Record ID:</b>
Line 46: <?= Enc::html($data['record_id']); ?>
Line 78: <form action="admin/restore/<?php echo $id; ?>" method="post">
Line 88: <a href="SITE/admin/edit/<?php echo Enc::html($controller); ?>/<?php echo $data['record_id']; ?>" class="button">View record</a>

/sprout/views/admin/categories_add.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/categories_delete.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/categories_edit.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/categories_import_options.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/categories_itemlist_outer.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/categories_multi_categorise.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 30: <form action="SITE/admin/call/<?php echo $controller_name; ?>/postMultiCategorise" method="post" id="main-form">
Line 32: <?php foreach ($ids as $id): ?>
Line 33: <input type="hidden" name="ids[]" value="<?php echo (int)$id; ?>">

/sprout/views/admin/categories_multi_delete.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 19: <form action="SITE/admin/call/<?php echo $controller_name; ?>/postMultiDelete" method="post" id="main-form">
Line 22: <?php foreach ($ids as $id): ?>
Line 23: <input type="hidden" name="ids[]" value="<?php echo (int)$id; ?>">
Line 31: <h3><?php echo count($ids); ?> record<?php
Line 32: if(count($ids) > 1) {

/sprout/views/admin/categories_navigation.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 24: <div class="inline-buttons sidebar-action-buttons -clearfix">
Line 33: $class = (@$_GET['_category_id'] === null ? 'all active-node' : 'all');
Line 46: $class = (@$_GET['_category_id'] === $cat['id'] ? 'category active-node' : 'category');
Line 51: <a class="node-link" href="admin/contents/<?php echo $controller_name; ?>?_category_id=<?php echo $cat['id']; ?>" rel="<?php echo $cat['id']; ?>"><?php echo $name; ?> <span class="tree-list-count"><?php echo $cat['num_items']; ?></span></a>
Line 57: <a href="admin/contents/<?php echo $controller_name; ?>?_category_id=<?php echo $cat['id']; ?>">View <?php echo Inflector::plural('item', $cat['num_items']); ?></a>
Line 59: <?php if ($category_archive and $cat['id']): ?>
Line 62: <a href="admin/call/<?php echo $controller_name; ?>_category/ajaxArchiveAction/<?php echo $cat['id']; ?>">Archive Category</a>
Line 66: <a href="admin/call/<?php echo $controller_name; ?>_category/ajaxUnarchiveAction/<?php echo $cat['id']; ?>">Unarchive Category</a>
Line 71: <a href="admin/add/<?php echo $controller_name; ?>?category_id=<?php echo $cat['id']; ?>">Add item</a>
Line 73: <?php if ($cat['id']): ?>
Line 75: <a href="admin/edit/<?php echo $controller_name; ?>_category/<?php echo $cat['id']; ?>">Edit</a>
Line 79: <a href="admin/extra/<?php echo $controller_name; ?>_category/reorder/<?php echo $cat['id']; ?>">Reorder</a>
Line 83: <a href="admin/delete/<?php echo $controller_name; ?>_category/<?php echo $cat['id']; ?>">Delete category</a>
Line 93: <form class="sidebar-form category-archive-selection" method="get">

/sprout/views/admin/categories_reorder.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 23: if (isset($id)) $action .= '/' . $id;
Line 39: <form action="SITE/<?php echo $action; ?>" method="post" id="main-form">
Line 44: <div id="page-reorder">
Line 51: <input type="hidden" name="items[]" value="<?php echo $item['id']; ?>">

/sprout/views/admin/cron_job_edit.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/dashboard/first_run.php   Highlighted file source

Line 2: <a href="SITE/admin/close_firstrun" class="highlight__close-button icon-before icon-close" title="Close"><span class="-vis-hidden">Close</span></a>

/sprout/views/admin/document_type_delete.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/email_text_edit.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/error.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/extra_page_add.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/extra_page_delete.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/extra_page_edit.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 34: <input type="hidden" name="type" value="<?php echo Enc::html($data['type']); ?>">

/sprout/views/admin/extra_page_sidebar.php   Highlighted file source

Line 8: <div class="inline-buttons sidebar-action-buttons -clearfix">
Line 13: <div class="sidebar-box">
Line 15: <?php foreach($snippets as $id => $label): ?>
Line 16: <li class="ext_txt"><a href="SITE/admin/edit/extra_page/<?php echo Enc::html($id); ?>">Edit <?php echo Enc::html($label); ?></a></li>

/sprout/views/admin/file_add.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 45: <!-- Don't hide the "drop files here" message on this specific view.
Line 46: It's a on-page important style because most other calls to drag_drop_upload.js do want the message hidden -->
Line 48: .file-upload__helptext--hidden { display: block !important; }
Line 57: echo Form::dropdown('category_id', ['-dropdown-top' => 'Choose per file'], Pdb::lookup('files_cat_list'));
Line 67: <input class="file-upload__input upload" id="field5" type="file" name="uploader_upload" value="" multiple>

/sprout/views/admin/file_add_dragdrop_form.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 48: <input type="hidden" name="tmp_file" value="<?php echo Enc::html($tmp_file); ?>">
Line 49: <input type="hidden" name="orig_name" value="<?php echo Enc::html($orig_file['name']); ?>">
Line 66: echo Form::dropdown('category_id', [], $categories);
Line 84: echo Form::autocomplete('author', [], ['url' => 'admin/call/file/ajaxAuthorLookup', 'save_id' => false]);
Line 132: echo Enc::html($shrunk_img['original_width']), ' &times; ', Enc::html($shrunk_img['original_height']);
Line 148: style="width: 100%;" controls
Line 152: <?php if ($data['type'] == FileConstants::TYPE_VIDEO): ?>
Line 153: <video class="file-upload__preview-video" src="admin/call/file/downloadTemp/<?= Enc::html($tmp_file); ?>"
Line 154: style="width: 100%;" controls
Line 155: ></video>

/sprout/views/admin/file_cleanup_invalid.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 29: <form action="SITE/admin/call/file/cleanupInvalidAction" method="post">
Line 33: <p>This will remove file references from the database that are invalid.</p>
Line 40: <button type="submit" class="button">Cleanup invalid files</button>

/sprout/views/admin/file_contents_thumbs.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 38: echo '<a class="image-link" href="SITE/admin/edit/file/', $row['id'], '" title="', Enc::html($row['name']), '">';
Line 47: } elseif($row['type'] == FileConstants::TYPE_VIDEO) {
Line 48: $placeholderIcon = 'icon-videocam';
Line 60: echo '<a href="SITE/admin/edit/file/', $row['id'], '" title="', Enc::html($row['name']), '">', Enc::html($row['name']), '</a>';
Line 66: echo '<input type="checkbox" id="file-list-', $row['id'], '" name="ids[]" value="', $row['id'], '">';
Line 67: echo '<label for="file-list-', $row['id'], '"><span class="-vis-hidden">Select file</span></label>';
Line 73: echo '<div class="delete"><a title="Delete" class="icon-before icon-close" href="SITE/admin/delete/file/', $row['id'], '"><span class="-vis-hidden">Delete</span></a></div>';
Line 110: <a href="SITE/admin/extra/<?php echo $category_ctlr; ?>/reorder/<?php echo $category['id']; ?>">Reorder items</a>
Line 112: <a href="SITE/admin/edit/<?php echo $category_ctlr; ?>/<?php echo $category['id']; ?>">Edit</a>
Line 114: <a href="SITE/admin/delete/<?php echo $category_ctlr; ?>/<?php echo $category['id']; ?>">Delete</a>

/sprout/views/admin/file_delete.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/file_edit.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 48: <div id="main-tabs-details">
Line 58: <?= Form::autocomplete('author', [], ['url' => 'admin/call/file/ajaxAuthorLookup', 'save_id' => false]); ?>
Line 145: <div id="main-tabs-manipulate">
Line 149: <div class="field-label -vis-hidden">
Line 153: <select id="manipulate" name="manipulate" data-src="<?= Enc::html($data['filename']); ?>">
Line 177: <img src="SITE/admin/call/file/previewTransform/none/<?php echo Enc::html($data['filename']); ?>" alt="" id="manipulate-preview">
Line 184: <div id="main-tabs-focus">
Line 194: <ul id="focal-point-type-selector">
Line 202: <div id="focal-point-wrapper"><img id="focal-point-setter" src="<?php echo File::url($data['filename']); ?>"><div id="focal-point-dot"></div></div>
Line 204: <input type="hidden" id="image-focal-points" name="focal_points" value="<?= Enc::html(@$data['focal_points']); ?>">
Line 206: <div id="focal-point-preview" style="display: none;">
Line 211: <p><span id="focal-point-preview-image"></span></p>
Line 216: <div id="main-tabs-replace">
Line 224: <div id="main-tabs-cats">

/sprout/views/admin/file_selector_popup.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 39: <div class="tab" id="tab-select-file">
Line 44: <form action="SITE/admin/call/file/selectorPopupSearch" method="get" id="file-selector-search">
Line 45: <input type="hidden" name="f_type" value="<?php echo $f_type; ?>">
Line 46: <input type="hidden" name="page" value="0" id="file-selector-page">
Line 53: echo Form::dropdown('category_id', ['-dropdown-top' => 'All', '-wrapper-class' => 'white'], $cats);
Line 71: <div id="file-selector-preview"><p class="preview-title">Preview image</p><div class="preview-box"></div></div>
Line 72: <div id="file-selector-stats"></div>
Line 73: <div id="file-selector-result-wrap">
Line 74: <div id="file-selector-results"></div>
Line 76: <div id="file-selector-paginate" class="-clearfix"></div>
Line 80: <div class="tab" id="tab-upload-file">
Line 86: <form action="SITE/admin/call/file/quickUpload" method="post" target="quick-upload" id="file-selector-upload" data-type="<?php echo $f_type; ?>">
Line 102: echo Form::dropdown('category_id', ['-dropdown-top' => 'Select a file category', '-wrapper-class' => 'white select-category'], $cats);
Line 122: <iframe name="quick-upload" id="quick-upload" style="display: none;"></iframe>

/sprout/views/admin/footer_compat.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/generic_delete.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/generic_export.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 33: <?= Fb::hiddenFields($refine_fields); ?>

/sprout/views/admin/generic_import.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 29: <input type="hidden" name="timestamp" value="<?php echo (int)$_GET['timestamp']; ?>">
Line 44: $params = ['style' => 'width: 225px;'];

/sprout/views/admin/generic_intro.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/generic_itemlist_outer.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/generic_search.php   Highlighted file source

Line 19: <div class="mainbar-with-right-sidebar">
Line 20: <?php foreach ($refine->getGroups() as $group => $widgets): ?>
Line 24: foreach ($widgets as $widget):
Line 25: echo $widget->render();
Line 32: <div class="right-sidebar">
Line 33: <div class="right-sidebar-anchor"></div>
Line 34: <div class="right-sidebar-inner">

/sprout/views/admin/import_upload.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/link_checker.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 28: $('#main-form .group').hide();
Line 35: <form action="SITE/admin/call/page/linkCheckerAction" method="post" id="main-form">

/sprout/views/admin/list_navigation.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 23: var item_id = $(elem).attr('rel').replace(/\/$/, '').replace(/^.*[\/\\]/g, '');
Line 25: var html = '<p><a href="admin/delete/<?php echo $controller_name; ?>/' + item_id + '">Delete</a></p>';
Line 30: var t = $('.sidebar-box-content ul');
Line 48: <div class="inline-buttons sidebar-action-buttons -clearfix">
Line 59: if ($item['id'] == $record_id) {
Line 64: echo "<li class=\"{$class}\"><a href=\"SITE/admin/edit/{$controller_name}/{$item['id']}\" rel=\"{$item['id']}\">{$name}</a></li>";

/sprout/views/admin/login_form.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 32: <input type="hidden" name="redirect" value="<?php echo Enc::html(@$_GET['redirect']); ?>">
Line 35: <div class="field-label -vis-hidden">
Line 39: <input id="field0" class="textbox" type="text" name="Username" <?php if ($autofocus == 'u') echo 'autofocus'; ?> value="<?= Enc::html(@$_GET['username']); ?>" placeholder="Username">
Line 44: <div class="field-label -vis-hidden">
Line 48: <input id="field1" class="textbox" type="password" name="Password" <?php if ($autofocus == 'p') echo 'autofocus'; ?> placeholder="Password">

/sprout/views/admin/login_layout.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 32: <meta name="viewport" content="width=device-width, initial-scale=1">
Line 83: <div id="wrapper">
Line 104: <h1 class="h2 -vis-hidden"><?= Enc::html($main_title); ?></h1>

/sprout/views/admin/login_message.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 20: <input type="hidden" name="redirect" value="<?php echo Enc::html(@$_GET['redirect']); ?>">
Line 21: <input type="hidden" name="nomsg" value="1">

/sprout/views/admin/main_layout.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 36: $body_classes[] = 'no-sidebar';
Line 46: <meta name="viewport" content="width=device-width, initial-scale=1">
Line 56: // Provide lock details to JavaScript to allow for unlocking on page unload
Line 106: <div id="wrapper">
Line 108: <div id="top-bar" class="-clearfix">
Line 110: <ul id="top-bar-nav" class="-clearfix">
Line 144: <div class="dropdown-box__text dropdown-box__text--mid">
Line 204: <header id="header" class="-clearfix">
Line 207: <div class="logo sidebar -clearfix"><span class="logo-sprout">Sprout</span> <span class="logo-cms">CMS</span> <span class="logo-version"><?= Enc::html(Sprout::getVersion()); ?></span></div>
Line 209: <div id="navigation" class="mainbar">
Line 216: <div class="sidebar sub-header-side">
Line 226: <div id="select-site">
Line 237: <div id="content" class="-clearfix">
Line 239: <div id="main" class="mainbar mainbar-reverse <?= empty($main_class) ? '' : Enc::html($main_class); ?>">
Line 242: <div id="main-heading">
Line 244: <div id="main-heading-options">
Line 270: <div id="main-content" class="-clearfix">
Line 278: <div id="sidebar" class="sidebar sidebar-reverse">
Line 280: <button type="button" class="sidebar-collapse-button icon-before icon-keyboard_arrow_left" title="Toggle sidebar"><span class="-vis-hidden">Close sidebar</span></button>
Line 282: <div class="sidebar-inner">
Line 285: <div class="sidebar-box">
Line 288: <div class="sidebar-box-content">
Line 296: <div id="search" class="sidebar-box">
Line 298: <div class="sidebar-box-content">

/sprout/views/admin/main_seo.php   Highlighted file source

Line 5: <div id="seo-wrapper" class="page-edit-tab">
Line 52: <?php if (!empty($seo_considerations) and count($seo_considerations) > 0): ?>
Line 53: <h4>Considerations (<?php echo Enc::html(count($seo_considerations)) ?>)</h4>
Line 55: <?php foreach ($seo_considerations as $item): ?>

/sprout/views/admin/main_tags.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 28: <div id="tags-wrapper" class="page-edit-tab">
Line 43: <input type="text" name="tags" class="textbox" value="<?php echo Enc::html($current_tags); ?>" id="tags-text" autocomplete="off">

/sprout/views/admin/my_settings/details.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/operator_add.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/operator_category_edit.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 38: Form::nextFieldDetails('Restrict access to specific IPs', false, 'Enter a comma-separated list of IP addresses or CIDR blocks that are allowed access.<br>Leave blank to have no restriction.');
Line 63: <div id="multiedit-permissions">
Line 64: <input type="hidden" name="m_id">

/sprout/views/admin/operator_delete.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/operator_edit.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 33: <div id="main-tabs-settings">
Line 52: <div id="main-tabs-change">
Line 71: <div id="main-tabs-cats">

/sprout/views/admin/operator_navigation.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 25: $actions['admin/add/' . $controller_name . '?category_id=%%'] = 'Add ' . Inflector::singular($friendly_name);
Line 42: var cat_id = $(this).attr('rel');
Line 46: html += '<p><a href="' + url.replace('%%', cat_id) + '">' + label + '</a></p>';
Line 62: <div class="inline-buttons sidebar-action-buttons -clearfix">
Line 78: foreach ($categories as $id => $name) {
Line 80: $class = (@$_GET['_category_id'] == $id ? 'category current-edit' : 'category'); ?>
Line 85: <a class="node-link" href="admin/contents/<?php echo $controller_name; ?>?_category_id=<?php echo $id; ?>"><?php echo $name; ?></a>

/sprout/views/admin/page_add.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 34: <input type="hidden" name="type" value="<?= Enc::html($data['type']); ?>">
Line 43: echo Form::pageDropdown('parent_id', ['-wrapper-class' => 'white']);

/sprout/views/admin/page_delete.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/page_edit.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 30: use Sprout\Helpers\WidgetArea;
Line 55: $node = $root->findNodeValue('id', $id);
Line 62: $share_url = $base . 'page/view_by_id/' . $id;
Line 72: <input type="hidden" name="rev_id" value="<?= $sel_rev_id; ?>">
Line 73: <input type="hidden" name="type" value="<?= Enc::html($data['type']); ?>">
Line 76: <div id="page-settings-wrapper" class="page-edit-tab">
Line 83: Form::nextFieldDetails('Template', true, 'Overrides the default page container template; e.g. utilise a wide page rather than a column view.');
Line 96: Form::nextFieldDetails('Banner', false, 'Overrides the default banner image when the page is viewed.');
Line 110: Form::nextFieldDetails('Auto deactivate', false, 'Automatically hide the page from users after this date.');
Line 159: Form::nextFieldDetails('Alternate navigation title', false, 'Override the default title that appears in links and navigation breadcrumbs for this page.');
Line 205: <div id="page-revisions-wrapper" class="page-edit-tab">
Line 212: <table class="main-list main-list--small main-list-no-js" id="rev-list">
Line 215: <th style="width: 20px;">&nbsp;</th>
Line 216: <th style="width: 165px;">Date modified</th>
Line 218: <th style="width: 200px">Editor</th>
Line 219: <th style="width: 200px">Status</th>
Line 220: <th style="width: 200px">Action</th>
Line 226: $rev_edit_url = "admin/edit/page/{$id}?revision={$rev['id']}";
Line 227: $rev_view_url = "page/view_specific_rev/{$id}/{$rev['id']}";
Line 236: <?php if ($sel_rev_id == $rev['id']): ?>
Line 270: <th style="width: 195px">Date</th>
Line 272: <th style="width: 200px">Editor</th>
Line 306: <div id="tour-page-title">
Line 313: <div id="tour-page-parent">
Line 316: echo Form::pageDropdown('parent_id', ['-wrapper-class' => 'white']);
Line 333: <div id="tour-content-area">
Line 345: $areas = Kohana::config('sprout.widget_areas');
Line 346: foreach ($areas as $area_id => $area) {
Line 348: Admin::widgetList($area->getName(), $area, @$widgets[$area_id], empty($page['redirect']));
Line 357: <!-- Widgets-->
Line 358: <div class="sidebar-widgets">
Line 360: $areas = Kohana::config('sprout.widget_areas');
Line 361: foreach ($areas as $area_id => $area) {
Line 363: if ($area->getOrientation() == WidgetArea::ORIENTATION_EMAIL) continue;
Line 365: if ($area_id == 2) {
Line 366: $heading_class = 'h2 icon-before icon-sidebar';
Line 373: echo '<button class="button button-small button-grey icon-keyboard_arrow_up icon-after content-block-collapse-button" type="button" data-target="wl-sidebar">Collapse all</button>';
Line 378: if ($area_id == 2) {
Line 379: echo '<p>These content blocks will be displayed in the sidebar of the page.</p>';
Line 382: Admin::widgetList($area->getName(), $area, @$widgets[$area_id], empty($page['redirect']));

/sprout/views/admin/page_edit_save.php   Highlighted file source

Line 13: echo Form::dropdown('status', ['-dropdown-top' => '', '-wrapper-class' => 'white', 'id' => "publish-options"], [
Line 21: <div class="save-option" id="opts-autolaunch">
Line 28: <div class="save-option" id="opts-need-check">
Line 31: echo Form::dropdown('approval_operator_id', ['-dropdown-top' => 'Select a user', '-wrapper-class' => 'small white'], $approval_admins);
Line 49: <p><a class="save-changes-delete icon-link-button icon-before icon-delete" href="admin/delete/page/<?= $id; ?>">Delete page</a></p>
Line 53: <p><a href="admin/edit/page/<?= $id; ?>?type=standard" class="icon-link-button icon-before icon-settings">Change to standard page</a></p>
Line 56: <p><a href="admin/edit/page/<?= $id; ?>?type=tool" class="icon-link-button icon-before icon-settings">Change to tool page</a></p>
Line 59: <p><a href="admin/edit/page/<?= $id; ?>?type=redirect" class="icon-link-button icon-before icon-settings">Change to a redirect</a></p>

/sprout/views/admin/page_import_options.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 30: <form action="SITE/admin/import_action/page" method="post" id="main-form">
Line 32: <input type="hidden" name="timestamp" value="<?php echo (int)$_GET['timestamp']; ?>">
Line 33: <input type="hidden" name="ext" value="<?php echo Enc::html($_GET['ext']); ?>">
Line 46: echo Form::pageDropdown('parent_id');

/sprout/views/admin/page_import_upload.php   Highlighted file source

Line 21: <div class="mainbar-with-right-sidebar">
Line 28: <input type="file" class="upload" name="import" id="fb1">
Line 44: <div class="right-sidebar">
Line 45: <div class="right-sidebar-anchor"></div>
Line 46: <div class="right-sidebar-inner">

/sprout/views/admin/page_intro.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/page_linklist.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/page_menu_groups.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 32: <li>Use a leading dash to hide the heading; e.g. <span class="mono">-One</span></li>
Line 41: foreach ($all_groups as $page_id => $groups) {
Line 43: $page = Pdb::get('pages', $page_id);
Line 45: echo '<h3 style="color: red;">Page ' . (int)$page_id . ' does not exist</h3>';
Line 56: echo Form::multiline("extras[{$page_id}][text]", ['rows' => 3, 'cols' => 30], []);
Line 61: echo Form::fileselector("extras[{$page_id}][image]", [], ['type' => FileConstants::TYPE_IMAGE]);
Line 69: foreach ($groups as $id => $name) {
Line 71: echo Form::text("groups[{$id}][name]");

/sprout/views/admin/page_navigation.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 27: <div class="inline-buttons sidebar-action-buttons -clearfix">
Line 39: <li class="node depth1 allow-access <?= $class; ?>" data-id="0">
Line 41: <a class="node-link" href="SITE/admin/edit/home_page/<?= (int) $home_page_id; ?>">Home</a>
Line 46: <a href="SITE/admin/edit/home_page/<?= (int) $home_page_id; ?>">Edit home page</a>
Line 65: 'url' => 'admin/add/page?parent_id=%%',
Line 85: 'url' => 'admin/add/page?parent_id=%%',

/sprout/views/admin/per_record_perms.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/redirect_delete.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/style_guide/conditions_list.php   Highlighted file source

Line 37: 'url' => 'admin_ajax/style_guide_demo_conditions',

/sprout/views/admin/style_guide/forms.php   Highlighted file source

Line 20: $child = new Treenode(['id' => 10, 'name' => 'A']);
Line 109: 'name' => 'kids',
Line 110: 'label' => 'Kids',

/sprout/views/admin/style_guide/index.php   Highlighted file source

Line 2: <a href="admin/style_guide/general" class="button">General</a>
Line 3: <a href="admin/style_guide/forms" class="button">Forms</a>
Line 4: <a href="admin/style_guide/multiedit" class="button">Multiedit</a>
Line 5: <a href="admin/style_guide/conditions_list" class="button">Conditions list</a>
Line 6: <a href="admin/style_guide/richtext" class="button">Richtext</a>

/sprout/views/admin/subsite_add.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 48: echo Form::dropdown('content_id', [], $subsites);

/sprout/views/admin/subsite_delete.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/subsite_edit.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 49: echo Form::dropdown('content_id', [], $subsites);

/sprout/views/admin/tree_delete.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/admin/tree_navigation.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 22: var item_id = $(elem).attr('rel').replace(/\/$/, '').replace(/^.*[\/\\]/g, '');
Line 25: html += '<p><a href="admin/add/<?php echo $controller_name; ?>?parent_id=' + item_id + '">Add child</a></p>';
Line 26: html += '<p><a href="<?php echo $controller_name; ?>/reorder/' + item_id + '" onclick="$.facebox({\"ajax\":this.href}); return false;">Re-order children</a></p>';
Line 27: html += '<p><a href="admin/delete/<?php echo $controller_name; ?>/' + item_id + '">Delete</a></p>';
Line 45: var item_id = file.replace(/^.*[\/\\]/g, '');
Line 46: window.location = 'SITE/admin/edit/<?php echo $controller_name; ?>/' + item_id;
Line 57: <div id="nav">

/sprout/views/admin/tree_organise.php   Highlighted file source

Line 25: <form id="main-form" action="SITE/admin/call/<?= Enc::html($controller_name); ?>/organiseAction" method="post" class="-clearfix">
Line 28: <input type="hidden" name="data" value="" id="hidden-data">
Line 30: <div class="mainbar-with-right-sidebar">
Line 32: <div id="jstree_demo_div" class="white-box">
Line 37: echo '<li id="', $nd['id'], '">', $nd['name'];
Line 60: <div class="right-sidebar">
Line 61: <div class="right-sidebar-anchor"></div>
Line 62: <div class="right-sidebar-inner">

/sprout/views/admin/widget_disp_conds.php   Highlighted file source

Line 8: .widget-conds-wrap { width: 900px; }
Line 9: .widget-conds-wrap h2 { margin-top: 0; }
Line 13: <div class="widget-conds-wrap">
Line 14: <form action="javascript:;" method="post" class="js--widget-conds-form">

/sprout/views/admin/worker_job_edit.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 51: <!-- If running, PID and mem use -->
Line 52: <?php if (!empty($data['pid'])): ?>
Line 53: <p><b>PID:</b>
Line 54: <br><?= Enc::html($data['pid']); ?></p>
Line 83: var intervalID;
Line 87: $.getJSON(SITE + 'admin/call/worker_job/jsonStatus/' + <?= Enc::js($id); ?>, function(data) {
Line 94: if (data.status != 'Running') window.clearInterval(intervalID);
Line 98: intervalID = window.setInterval(updateStatus, 1000);

/sprout/views/admin/worker_job_manual_run.php   Highlighted file source

Line 22: Form::nextFieldDetails('Arguments', false, 'Provide this as a JSON array');

/sprout/views/advanced_search_form.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 45: <?= Form::text('tag', ['id' => 'tags-text', 'autocomplete' => 'off']); ?>

/sprout/views/ajax/add_addon.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 20: .add-widget-list {
Line 24: .add-widget-list .widget {
Line 30: .add-widget-list .button {
Line 34: .add-widget-list .na-msg {
Line 42: $('.add-widget-list .button').click(function() {
Line 43: var $widget = $(this).closest('.widget');
Line 44: $('#wl-<?php echo Enc::js($field_name); ?>').trigger('add-widget', [$widget.attr('data-name'), $widget.find('b').text()]);
Line 54: <div class="add-widget-list">
Line 56: foreach ($widgets as $row) {
Line 59: echo '<div data-name="', Enc::html($name), '" class="widget">';

/sprout/views/ajax/document_import.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 19: var docImport = {'selector' : '#<?php echo $elemid; ?>'};
Line 25: <form action="SITE/admin_ajax/richtext_import_iframe" method="post" enctype="multipart/form-data" id="doc-import-form" target="doc-import-iframe">
Line 26: <input type="file" name="import" id="doc-import-upload">
Line 28: <iframe id="doc-import-iframe" name="doc-import-iframe" width="1" height="1" style="border-style: none;"></iframe>
Line 35: width: 400px;

/sprout/views/audio_player.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/auto_edit.php   Highlighted file source

Line 14: $for = ($id == 0 ? 'add' : 'edit');
Line 23: <li><a href="#main-tabs-<?= Enc::id($tab); ?>"><?= Enc::html($tab); ?></a></li>
Line 29: <div class="tab" id="main-tabs-<?= Enc::id($tab); ?>">
Line 33: echo JsonForm::renderTabItem($item, $for, $id, $data, $errors);

/sprout/views/children_page_gallery.php   Highlighted file source

Line 9: if ($hide_blanks) {
Line 13: $mod = $idx++ % 4;

/sprout/views/components/calendar.php   Highlighted file source

Line 16: <?php foreach ($day_names as $idx => $day): ?>
Line 17: <li class="calendar-weekdays-list__item" data-day="<?php echo Enc::html($idx); ?>"><?php echo Enc::html($day); ?></li>

/sprout/views/components/fb_autocomplete_address.php   Highlighted file source

Line 11: Fb.initAutoCompleteAddress($('.js-autocomplete-address').attr('id'),

/sprout/views/components/fb_autocomplete_list.php   Highlighted file source

Line 7: <div class="autocomplete-template -vis-hidden">
Line 9: <input type="hidden" name="" value="">

/sprout/views/components/fb_conditions_list.php   Highlighted file source

Line 7: <input type="hidden" class="fb-conditions--data" name="<?php echo Enc::html($name); ?>" value="<?php echo Enc::html($data); ?>">
Line 9: <button class="fb-conditions--add button button-grey button-icon icon-before icon-add" type="button"><span class="-vis-hidden">Add condition</span></button>

/sprout/views/components/fb_geocode_address.php   Highlighted file source

Line 12: Fb.initGeocodeAddress($('.js-geocode-address').attr('id'),

/sprout/views/components/fb_google_map.php   Highlighted file source

Line 8: Needs::fileGroup('sprout/map_widget');
Line 12: <input type="hidden" data-field="lat" name="<?php echo Enc::html($names[0]); ?>" value="<?php echo Enc::html($values[0]); ?>">
Line 13: <input type="hidden" data-field="lng" name="<?php echo Enc::html($names[1]); ?>" value="<?php echo Enc::html($values[1]); ?>">
Line 17: <input type="hidden" data-field="zoom" name="<?php echo Enc::html($names[2]); ?>" value="<?php echo Enc::html($values[2]); ?>">
Line 19: <input type="hidden" data-field="zoom" name="<?php echo Enc::html($names[2]); ?>" value="9">
Line 29: echo Form::text('fb-google-map--search-name', ['-wrapper-class' => 'white', 'placeholder' => 'Search...', 'id' => 'fb-google-map--search-name', 'class' => 'fb-google-map--search-name']);
Line 39: <div id="map_<?php echo Enc::html($unique); ?>" class="fb-google-map--inner"></div>

/sprout/views/components/lnk_editform.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 25: <?php echo Fb::hiddenFields([$field_name => $curr_spec]); ?>

/sprout/views/components/multiple_file_select.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 41: foreach ($data as $id) {
Line 42: $filename = isset($filenames[$id]) ? $filenames[$id] : $id;
Line 44: echo '<input type="hidden" name="', Enc::html($name), '" value="', Enc::html($id), '">';

/sprout/views/content_unsubscribe_form.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 23: <form action="SITE/content_subscribe/unsub_action/<?php echo (int) $id; ?>/<?php echo Enc::html($code); ?>" method="post">

/sprout/views/dbtools/exception_details.php   Highlighted file source

Line 6: 'id' => 'SE' . $log['id'],
Line 19: <div class="mainbar-with-right-sidebar">
Line 62: <div class="right-sidebar">
Line 63: <div class="right-sidebar-anchor"></div>
Line 64: <div class="right-sidebar-inner">
Line 70: echo Form::text('id', ['placeholder' => 'SE2400']);

/sprout/views/dbtools/exception_log.php   Highlighted file source

Line 10: <div class="mainbar-with-right-sidebar">
Line 69: <div class="right-sidebar">
Line 70: <div class="right-sidebar-anchor"></div>
Line 71: <div class="right-sidebar-inner">
Line 77: echo Form::text('id', ['placeholder' => 'SE2400']);

/sprout/views/dbtools/import_xml.php   Highlighted file source

Line 7: <div class="mainbar-with-right-sidebar">
Line 14: echo Form::dropdown('subsite_id', [], $subsites);
Line 18: <input type="hidden" name="page_id" value="0">
Line 28: <div class="right-sidebar">
Line 29: <div class="right-sidebar-anchor"></div>
Line 30: <div class="right-sidebar-inner">
Line 45: $('select[name="subsite_id"]').on('change', function()
Line 47: var id = parseInt($(this).val());
Line 48: if (isNaN(id)) id = 0;
Line 50: url: 'dbtools/ajaxPageIds/' + id,
Line 56: $('.js-page-dropdown').html('<input type="hidden" value="0" name="page_id">');

/sprout/views/dbtools/module_builder.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 82: <div class="mainbar-with-right-sidebar">
Line 89: <?php echo Form::dropdown('module-choice', ['id' => 'module-choice', '-wrapper-class' => 'white'], $modules); ?>
Line 161: <div class="right-sidebar">
Line 162: <div class="right-sidebar-anchor"></div>
Line 163: <div class="right-sidebar-inner">

/sprout/views/dbtools/module_builder_db.php   Highlighted file source

Line 17: <div class="mainbar-with-right-sidebar">
Line 36: <div class="right-sidebar">
Line 37: <div class="right-sidebar-anchor"></div>
Line 38: <div class="right-sidebar-inner">

/sprout/views/dbtools/module_builder_existing_form.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 29: <div class="mainbar-with-right-sidebar">
Line 68: <div class="right-sidebar">
Line 69: <div class="right-sidebar-anchor"></div>
Line 70: <div class="right-sidebar-inner">

/sprout/views/dbtools/module_builder_existing_upload.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/dbtools/multimake_template.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 27: <div id="multiedit-people">
Line 28: <input type="hidden" name="m_id">
Line 43: $view->data['multiedit_people'] = MultiEdit::load('user_people', ['user_id' => $item_id], 'record_order');
Line 54: foreach ($_POST['multiedit_people'] as $idx => $data) {
Line 58: $update_fields['id'] = (int) $data['id'];
Line 63: $this->replaceSet('user_people', $new_set, ['user_id' => $item_id]);
Line 67: $this->deleteRecord('user_people', $id);

/sprout/views/dbtools/navigation.php   Highlighted file source

Line 12: <div class="sidebar-box">
Line 14: <div class="sidebar-box-content">

/sprout/views/dbtools/php_info.php   Highlighted file source

Line 12: border: 1px #B8B7B7 solid;
Line 13: width: 100%;
Line 30: max-width: 500px;
Line 31: overflow: hidden;
Line 62: <th>ID</th>
Line 71: <td><?= Enc::html($subsite['id']); ?></td>
Line 74: <td><?= Enc::html(Subsites::getAbsRoot($subsite['id'])); ?></td>
Line 87: echo "<div id='phpinfo'>{$phpinfo}</div>";

/sprout/views/dbtools/skin_test_content.php   Highlighted file source

Line 10: volutpat tempus magna, a convallis massa tincidunt eu.
Line 19: <small>Small text. Usus legentis in iis qui facit, eorum claritatem Investigationes demonstraverunt. Facilisi nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id. Quod ii legunt saepius claritas est etiam processus dynamicus qui sequitur mutationem. Lobortis nisl ut aliquip ex ea commodo consequat duis autem vel eum iriure dolor in hendrerit.</small>
Line 24: leo. Cras ut mattis ex, sed gravida velit. Vestibulum vehicula eu ex sed
Line 31: facilisis pulvinar id vitae diam. Pellentesque facilisis nisl quis volutpat
Line 35: <li>Nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat ut wisi enim ad minim.</li>
Line 38: <li>Illum dolore eu feugiat nulla facilisis at vero eros et accumsan et! Sed diam nonummy nibh euismod tincidunt ut laoreet.</li>
Line 41: <li>Nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat ut wisi enim ad minim.</li>
Line 44: <li>Illum dolore eu feugiat nulla facilisis at vero eros et accumsan et! Sed diam nonummy nibh euismod tincidunt ut laoreet.</ol>
Line 64: <td>Duis sed tincidunt orci.</td>
Line 132: Duis sed tincidunt orci. Phasellus id dui tempus, congue ex id, gravida ligula.
Line 139: <p>Tempor cum soluta nobis eleifend option congue nihil: imperdiet doming id quod mazim. Eodem modo typi qui nunc, nobis videntur parum clari fiant sollemnes in.</p>
Line 143: Duis sed tincidunt orci. Phasellus id dui tempus, congue ex id, gravida ligula.
Line 149: <h2>A h2 large expando heading, etiam consequat leo a mollis pretium. Aenean pharetra gravida mi.</h2>
Line 173: <p>Vivamus eu lacinia risus. Etiam consequat leo a mollis pretium. Aenean pharetra gravida mi, non fringilla urna bibendum eu. Interdum et malesuada fames ac ante ipsum primis in faucibus. Sed tristique consectetur risus, sit amet dictum turpis egestas sed. Pellentesque sed mauris mollis risus sodales hendrerit. Sed ornare velit vitae ante pellentesque bibendum. Fusce molestie consectetur fermentum. Proin a ultricies est.</p>
Line 178: <p>Maecenas mauris nulla, luctus dapibus ante sit amet, iaculis imperdiet dolor. In ac eros et sapien venenatis tincidunt blandit suscipit nulla. Aenean lobortis augue nisl, bibendum volutpat nulla imperdiet eu. Proin sed tempor diam. Aenean malesuada velit nec tincidunt tempus.</p>
Line 179: <p>Morbi libero dui, euismod ac mattis id, volutpat a urna. Vivamus aliquam ex id arcu efficitur, et tristique est commodo. Suspendisse euismod bibendum lacus, vitae ultricies est vestibulum in. Curabitur et purus nisl. Phasellus a quam egestas, congue sem quis, fringilla leo. Donec eu massa urna.</p>
Line 181: <p>Pellentesque ipsum diam, condimentum sit amet ipsum non, porta ultrices metus. Vivamus mollis odio sed libero tincidunt, ac efficitur dui accumsan. Curabitur euismod cursus convallis. Maecenas mollis pharetra iaculis. Sed gravida felis sit amet aliquet hendrerit.</p>
Line 184: <p>Fusce tempor libero quam, et semper sapien scelerisque efficitur. Quisque imperdiet nisl at urna facilisis consectetur. Sed at ullamcorper eros. Nulla luctus, risus id lobortis pellentesque, dui turpis pellentesque dui, in posuere leo leo in nibh. Aliquam ex tortor, fringilla in erat a, pretium malesuada justo.</p>
Line 186: <p>Sed ultricies ex eget scelerisque varius. Sed vel eros cursus felis suscipit viverra. Vestibulum sed aliquam enim. Etiam urna risus, interdum ut mattis ac, feugiat vel lacus. Morbi tempus vitae lectus nec pellentesque. Sed pulvinar rutrum erat. Etiam augue dui, tincidunt ac posuere vitae, consectetur in orci.</p>
Line 191: <p>Sed ultricies ex eget scelerisque varius. Sed vel eros cursus felis suscipit viverra. Vestibulum sed aliquam enim. Etiam urna risus, interdum ut mattis ac, feugiat vel lacus. Morbi tempus vitae lectus nec pellentesque. Sed pulvinar rutrum erat. Etiam augue dui, tincidunt ac posuere vitae, consectetur in orci.</p>
Line 192: <p>In augue ipsum, malesuada quis ipsum at, dictum sollicitudin felis. Maecenas consequat in nisi vel pretium. Sed pulvinar ipsum nunc, at suscipit felis feugiat id. Quisque sit amet dui at dolor tincidunt lacinia eleifend quis magna. Quisque condimentum leo lorem, non aliquet est sollicitudin sed.</p>
Line 199: <p>In augue ipsum, malesuada quis ipsum at, dictum sollicitudin felis. Maecenas consequat in nisi vel pretium. Sed pulvinar ipsum nunc, at suscipit felis feugiat id. Quisque sit amet dui at dolor tincidunt lacinia eleifend quis magna. Quisque condimentum leo lorem, non aliquet est sollicitudin sed.</p>
Line 204: <p>Laoreet dolore magna aliquam erat volutpat ut wisi enim ad. Luptatum zzril delenit augue duis dolore te feugait nulla facilisi nam liber tempor cum soluta nobis. Qui blandit praesent eleifend option congue nihil imperdiet doming id quod mazim placerat facer! Ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat duis autem vel eum iriure dolor.</p>
Line 205: <p>Et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore. Laoreet dolore magna aliquam erat volutpat ut wisi enim ad. Luptatum zzril delenit augue duis dolore te feugait nulla facilisi nam liber tempor cum soluta nobis. Qui blandit praesent eleifend option congue nihil imperdiet doming id quod mazim placerat facer!</p>
Line 206: <p>Eodem modo typi qui nunc nobis: videntur parum clari fiant sollemnes. Laoreet dolore magna aliquam erat volutpat ut wisi enim ad minim veniam.</p>
Line 211: <p>In augue ipsum, malesuada quis ipsum at, dictum sollicitudin felis. Maecenas consequat in nisi vel pretium. Sed pulvinar ipsum nunc, at suscipit felis feugiat id. Quisque sit amet dui at dolor tincidunt lacinia eleifend quis magna. Quisque condimentum leo lorem, non aliquet est sollicitudin sed.</p>
Line 215: <iframe src="//www.youtube.com/embed/dQw4w9WgXcQ" width="560" height="314" allowfullscreen="allowfullscreen"></iframe>
Line 218: <p>Laoreet dolore magna aliquam erat volutpat ut wisi enim ad. Luptatum zzril delenit augue duis dolore te feugait nulla facilisi nam liber tempor cum soluta nobis. Qui blandit praesent eleifend option congue nihil imperdiet doming id quod mazim placerat facer! Ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat duis autem vel eum iriure dolor.</p>
Line 219: <p>Et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore. Laoreet dolore magna aliquam erat volutpat ut wisi enim ad. Luptatum zzril delenit augue duis dolore te feugait nulla facilisi nam liber tempor cum soluta nobis. Qui blandit praesent eleifend option congue nihil imperdiet doming id quod mazim placerat facer!</p>
Line 220: <p>Eodem modo typi qui nunc nobis: videntur parum clari fiant sollemnes. Laoreet dolore magna aliquam erat volutpat ut wisi enim ad minim veniam.</p>
Line 225: <div class="widget widget-Form widget-hasinfobox orientation-wide">
Line 242: $child = new Treenode(['id' => 10, 'name' => 'A']);
Line 332: 'name' => 'kids',
Line 333: 'label' => 'Kids & Infants',

/sprout/views/dbtools/sql.php   Highlighted file source

Line 16: <div class="field-label -vis-hidden">
Line 20: <textarea id="query-box" placeholder="Enter query" name="sql" spellcheck="false" class="sql textbox" rows="20"><?= Enc::html(@$_POST['sql']); ?></textarea>
Line 29: $hidden_class = '';
Line 31: if ($row_num) $hidden_class = ' field-element--hidden-label';
Line 36: <div class="field-element field-element--text<?= $hidden_class; ?>">
Line 42: <input type="text" name="vars[<?= $row_num; ?>][key]" class="textbox" placeholder="e.g. name" id="variable-<?= $row_num; ?>" value="<?= Enc::html(@$var['key']); ?>">
Line 48: <div class="field-element field-element--text<?= $hidden_class; ?>">
Line 54: <input type="text" name="vars[<?= $row_num; ?>][val]" class="textbox" placeholder="e.g. John" id="replacement-<?= $row_num; ?>" value="<?= Enc::html(@$var['val']); ?>">
Line 66: <button type="button" class="button button-grey button-icon icon-before icon-add variable-replacement-button-add-row"><span class="-vis-hidden">Add</span></button>
Line 73: <input type="checkbox" id="do-explain" name="explain" <?= (!empty($_POST['explain']) ? 'checked' : ''); ?> value="1">
Line 82: <input type="checkbox" id="enable-profiling" name="profile" <?= (!empty($_POST['profile']) ? 'checked' : ''); ?> value="1">
Line 93: <div id="table-list-wrap" class="column column-4">
Line 95: <div class="field-element field-element--text field-element--icon-after field-element--icon-after--search field-element--hidden-label">
Line 100: <input type="text" name="refine" class="textbox" placeholder="Refine" id="refine-queries" autocomplete="off">
Line 104: <div class="field-element field-element--select field-element--select--multiple field-element--hidden-label">
Line 109: <select class="table-list" size="2" id="quick-query">
Line 123: <div id="table-details"><div class="text-align-right"><button type="button" class="button button-icon icon-before icon-close button-grey button-hide-table-preview"><span class="-vis-hidden">Hide</span></button></div></div>

/sprout/views/dbtools/sql_result.php   Highlighted file source

Line 30: <input type="hidden" name="sql" value="<?= Enc::html($results->queryString); ?>">

/sprout/views/email/content_subscribe.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/email/email_share.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/email/link_checker.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 24: <?php foreach ($errs as $idx => $links): ?>
Line 25: <?php list($id, $subsite_id, $name) = explode(':', $idx); ?>
Line 31: <a href="<?php echo Subsites::getAbsRoot($subsite_id) . 'page/view_by_id/' . $id; ?>">View Page</a>
Line 33: <a href="<?php echo Subsites::getAbsRoot($subsite_id) . 'admin/edit/page/' . $id; ?>">Edit page</a>
Line 37: <table class="main-list" width="100%">
Line 40: <th align="left" width="34%">Link text</th>
Line 41: <th align="left" width="33%">URL</th>
Line 42: <th align="left" width="33%">Error</th>

/sprout/views/email/pages_stale.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 38: <a href="<?= Enc::html($base); ?>admin/edit/page/<?= $page['id']; ?>">edit</a>

/sprout/views/email/page_approved.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/email/page_need_check.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/email/page_notify.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/email/page_rejected.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/email/testing_long.php   Highlighted file source

Line 3: <p>Nunc nobis videntur parum, clari fiant sollemnes in. Iriure dolor in hendrerit in vulputate velit esse molestie consequat vel illum dolore.</p>
Line 38: <p>Sit amet consectetuer adipiscing elit sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna. Lorem ipsum dolor aliquam erat, volutpat ut wisi enim ad minim?</p>
Line 62: Yo diggidy dig dawg
Line 65: Hello, content tables in emails should probably have a width of 100% unless you don't want them to or something.

/sprout/views/email_share_form.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 32: <input type="hidden" name="title" value="<?php echo Enc::html($data['title']); ?>">
Line 33: <input type="hidden" name="url" value="<?php echo Enc::html($data['url']); ?>">

/sprout/views/email_share_thanks.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/filelist_tall.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/filelist_wide.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/file_confirm.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 47: <p class="file-upload__item__feedback__hover__dimensions"><?= Enc::html($shrunk_img['original_height']); ?> &times; <?= Enc::html($shrunk_img['original_width']); ?></p>

/sprout/views/gallery_compact.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/gallery_widget_settings.php   Highlighted file source

Line 54: <div class="js--settings-grid">
Line 63: <div class="js--settings-slider">
Line 67: Form::nextFieldDetails('Slider options', false);
Line 68: echo Form::checkboxList(['slider_dots' => 'Dots', 'slider_arrows' => 'Arrows', 'slider_autoplay' => 'Auto-scroll'], []);
Line 74: echo Form::number('slider_speed', []);
Line 78: Form::nextFieldDetails('Images per slide', false);
Line 91: if ($(this).val() == 'grid') {
Line 92: $('.js--' + unique + ' .js--settings-grid').show();
Line 93: $('.js--' + unique + ' .js--settings-slider').hide();
Line 94: } else if ($(this).val() == 'slider') {
Line 95: $('.js--' + unique + ' .js--settings-grid').hide();
Line 96: $('.js--' + unique + ' .js--settings-slider').show();
Line 98: $('.js--' + unique + ' .js--settings-grid').hide();
Line 99: $('.js--' + unique + ' .js--settings-slider').hide();

/sprout/views/image_gallery_tall_grid.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 24: // Create unique identifier to allow multiple on a page
Line 29: <div class="-clearfix image-gallery-side-wrap <?php if ($captions): ?>image-gallery-side-wrap--has-captions<?php endif; ?>">
Line 32: <div class="image-gallery-side-thumb" <?php if ($idx++ > $num_thumbs): ?> style="display: none;" <?php endif; ?>>
Line 35: class="image-gallery-side-thumb__link gallery-<?php echo Enc::html($unique); ?>">

/sprout/views/image_gallery_tall_slider.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 24: Needs::fileGroup('image_gallery_slider');
Line 26: // Create unique identifier to allow multiple on a page
Line 31: <ul class="image-gallery-slider js--<?php echo Enc::html($unique); if ($captions): ?> image-gallery-has-captions<?php endif; ?>">
Line 34: <li class="image-gallery-slider__item">
Line 37: class="image-gallery-slider__link gallery-<?php echo Enc::html($unique); ?>">
Line 38: <img src="<?php echo Enc::html(File::resizeUrl($image['filename'], $config['slider_size'] . '-' . $cropping)) ?>" alt="<?php echo Enc::html($image['name']); ?>">
Line 61: $('.image-gallery-slider.js--' + unique).slick({
Line 62: dots: <?php echo Enc::js(!empty($slider_dots)?'true':'false'); ?>,
Line 63: arrows: <?php echo Enc::js(!empty($slider_arrows)?'true':'false'); ?>,
Line 64: autoplay: <?php echo Enc::js(!empty($slider_autoplay)?'true':'false'); ?>,
Line 65: autoplaySpeed: <?php echo Enc::js($slider_speed * 1000); ?>,

/sprout/views/image_gallery_wide.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 23: Needs::fileGroup('image_gallery_wide');
Line 25: // Create unique identifier to allow multiple on a page
Line 33: <div class="image-gallery-thumb" <?php if ($idx++ > $num_thumbs): ?> style="display: none;" <?php endif; ?>>

/sprout/views/image_gallery_wide_grid.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 23: Needs::fileGroup('image_gallery_wide');
Line 25: // Create unique identifier to allow multiple on a page
Line 33: <div class="image-gallery-thumb" <?php if ($idx++ > $num_thumbs): ?> style="display: none;" <?php endif; ?>>

/sprout/views/image_gallery_wide_slider.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 24: Needs::fileGroup('image_gallery_slider');
Line 26: // Create unique identifier to allow multiple on a page
Line 31: <ul class="image-gallery-slider js--<?php echo Enc::html($unique); if ($captions): ?> image-gallery-has-captions<?php endif; ?>">
Line 34: <li class="image-gallery-slider__item">
Line 37: class="image-gallery-slider__link gallery-<?php echo Enc::html($unique); ?>">
Line 38: <img src="<?php echo Enc::html(File::resizeUrl($image['filename'], $config['slider_size'] . '-' . $cropping)) ?>" alt="<?php echo Enc::html($image['name']); ?>">
Line 61: $('.image-gallery-slider.js--' + unique).slick({
Line 62: dots: <?php echo Enc::js(!empty($slider_dots)?'true':'false'); ?>,
Line 63: arrows: <?php echo Enc::js(!empty($slider_arrows)?'true':'false'); ?>,
Line 64: autoplay: <?php echo Enc::js(!empty($slider_autoplay)?'true':'false'); ?>,
Line 65: autoplaySpeed: <?php echo Enc::js($slider_speed * 1000); ?>,
Line 66: slidesToShow: <?php echo Enc::js($slider_images); ?>,
Line 67: slidesToScroll: <?php echo Enc::js($slider_images); ?>,
Line 69: <?php if ($slider_images == 4): ?>
Line 73: slidesToShow: 4,
Line 74: slidesToScroll: 4
Line 81: slidesToShow: <?php echo ($slider_images - 1) > 0 ? $slider_images - 1 : 1; ?>,
Line 82: slidesToScroll: <?php echo ($slider_images - 1) > 0 ? $slider_images - 1 : 1; ?>
Line 88: slidesToShow: <?php echo ($slider_images - 2) > 0 ? $slider_images - 2 : 1; ?>,
Line 89: slidesToScroll: <?php echo ($slider_images - 2) > 0 ? $slider_images - 2 : 1; ?>
Line 95: slidesToShow: 1,
Line 96: slidesToScroll: 1

/sprout/views/map_directions.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 37: echo Form::text('start-address', ['-wrapper-class' => 'white hidden-label', 'placeholder' => 'Street name and/or suburb', 'id' => 'start-address', 'class' => 'directions-txt']);

/sprout/views/map_widget.php   Highlighted file source

Line 7: <div id="map_<?php echo Enc::html($unique); ?>" style="width: <?php echo Enc::html($width); ?>px; height: <?php echo Enc::html($height); ?>px;"></div>
Line 12: initMapWidget(map_<?php echo Enc::js($unique); ?>,

/sprout/views/page_approval_form.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 30: border: 1px solid #CED2DC;
Line 37: <div id="page-rev-approval-form">
Line 40: <form method="post" action="page/review/<?= (int)$rev_id; ?>">
Line 43: <input type="hidden" name="code" value="<?= Enc::html($code); ?>">
Line 48: echo Form::text('message', ['-wrapper-class' => 'white new-category large', 'placeholder' => 'Enter a message', 'id' => 'approval-form-message']);

/sprout/views/preview_box.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/rss_feed.php   Highlighted file source

Line 11: <img src="<?php echo Enc::html($item['image']); ?>" width="200" class="right">

/sprout/views/search_form.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 22: <div class="field-element field-element--text field-element--hidden-label">
Line 27: <input id="fm-site-search" class="textbox" type="text" name="q" value="<?php echo Enc::html(@$_GET['q']); ?>" placeholder="Enter your search here">
Line 31: <span class="-vis-hidden">Search</span>

/sprout/views/search_results_page.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/system/error_cli.php   Highlighted file source

Line 13: <?php echo "Log ID {$log_id}\n"; ?>

/sprout/views/system/error_development.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 33: <div id="framework_error">
Line 46: <p class="stats"><?php echo 'Log ID ', $log_id; ?></p>

/sprout/views/system/error_production.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 27: #main {width: 600px; margin: 0 auto; padding: 0;}
Line 29: img {margin: 0; width: 227px; height: 300px; margin: 0 auto; display:block;background:url(data:image/gif;base64,R0lGODlhBQAEAKEBAAAAAP%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FyH5BAEKAAIALAAAAAAFAAQAAAIHDBypBncJCgA7) 50% 50% no-repeat;}
Line 35: <div id="main">
Line 37: <img src="<?php echo Sprout::absRoot(); ?>media/images/system_error3.jpg" width="227" height="300">
Line 38: <div id="nice">
Line 40: <p>When reporting this error, quote the code <?php echo 'SE' . str_pad($log_id, 5, '0', STR_PAD_LEFT); ?>.</p>
Line 42: <div id="tech">

/sprout/views/tag_list.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/tfa/totp_login.php   Highlighted file source

Line 12: <input type="hidden" name="redirect" value="<?= Enc::html(@$_GET['redirect']); ?>">

/sprout/views/tfa/totp_setup.php   Highlighted file source

Line 17: <img src="<?= Enc::html($qr_img); ?>" width="200" height="200">

/sprout/views/tinymce4/image_cat.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 40: echo '<a href="SITE/tinymce4/image_list/', $row['id'], '">';
Line 46: echo '<img src="', File::resizeUrl($filename, 'c102x102'), '" class="idx' . $index . '">';

/sprout/views/tinymce4/image_gallery.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 30: $data['slider_dots'] = (int) @$_GET['slider_dots'];
Line 31: $data['slider_arrows'] = (int) @$_GET['slider_arrows'];
Line 32: $data['slider_autoplay'] = (int) @$_GET['slider_autoplay'];
Line 33: $data['slider_speed'] = (int) @$_GET['slider_speed'];
Line 39: if ($data['cat'] == $category['id']) {
Line 59: 'lc' => 'Middle left',
Line 60: 'cc' => 'Middle center',
Line 61: 'rc' => 'Middle right',
Line 73: 'grid' => 'Grid gallery',
Line 74: 'slider' => 'Slider gallery',
Line 124: <div class="field-group-wrap -clearfix js-gallery-grid">
Line 133: <div class="field-group-wrap -clearfix js-gallery-slider">
Line 137: Form::nextFieldDetails('Slider options', false);
Line 138: echo Form::checkboxList(['slider_dots' => 'Dots', 'slider_arrows' => 'Arrows', 'slider_autoplay' => 'Auto-scroll'], []);
Line 144: echo Form::number('slider_speed', []);
Line 169: <a href="javascript:;" data-id="<?php echo Enc::html($category['id']); ?>" data-title="<?php echo Enc::html($category['name']); ?>" class="js-gallery-cat <?php if ($category['id'] == $data['cat']): echo 'active'; endif; ?>">
Line 174: <img src="<?php echo File::resizeUrl($filename, 'c102x102'); ?>" class="idx <?php echo Enc::html($index); ?>">
Line 212: if ($(this).val() == 'grid') {
Line 213: $('.js-gallery-grid').show();
Line 214: $('.js-gallery-slider').hide();
Line 215: } else if ($(this).val() == 'slider') {
Line 216: $('.js-gallery-grid').hide();
Line 217: $('.js-gallery-slider').show();
Line 219: $('.js-gallery-grid').hide();
Line 220: $('.js-gallery-slider').hide();
Line 233: var cat = parseInt($('.gallery-wrap a.active').attr('data-id'));
Line 236: var slider_dots = parseInt($('input[name="slider_dots"]').val());
Line 237: var slider_arrows = parseInt($('input[name="slider_arrows"]').val());
Line 238: var slider_autoplay = parseInt($('input[name="slider_autoplay"]').val());
Line 239: var slider_speed = parseInt($('input[name="slider_speed"]').val());
Line 246: if (display_opts == '') display_opts = 'grid';
Line 248: if (isNaN(slider_dots) || slider_dots < 0) slider_dots = 0;
Line 249: if (isNaN(slider_arrows) || slider_arrows < 0) slider_arrows = 0;
Line 250: if (isNaN(slider_autoplay) || slider_autoplay < 0) slider_autoplay = 0;
Line 251: if (isNaN(slider_speed) || slider_speed <= 0) slider_speed = 3;
Line 253: // Use form values as data-attributes for Widget's settings
Line 254: var content = '<div class="sprout-editor--widget sprout-editor--gallery" data-id="' + cat + '"';
Line 261: content += ' data-slider-dots="' + slider_dots + '"';
Line 262: content += ' data-slider-arrows="' + slider_arrows + '"';
Line 263: content += ' data-slider-autoplay="' + slider_autoplay + '"';
Line 264: content += ' data-slider-speed="' + slider_speed + '"';

/sprout/views/tinymce4/image_list.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 45: <a href="SITE/tinymce4/image_size/<?php echo $row['id'], '?', http_build_query($link_attrs); ?>">

/sprout/views/tinymce4/image_size.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 37: echo '<a href="javascript:;" data-src="', Enc::html(File::sizeUrl($image['id'], $size)), '" data-alt="', Enc::html($image['name']), '">', ucwords(str_replace('_', ' ', $size)), '</a>';
Line 41: echo '<a href="javascript:;" data-src="', Enc::html(File::relUrl($image['id'])), '" data-alt="', Enc::html($image['name']), '">Original</a>';

/sprout/views/tinymce4/library_browse.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/tinymce4/library_list.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/tinymce4/library_search.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;

/sprout/views/tinymce4/outer.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 50: typeof a?a:!0;b._groups.push({elements:this,byRow:a});b._apply(this,a);return this};b._groups=[];b._throttle=80;b._maintainScroll=!1;b._beforeUpdate=null;b._afterUpdate=null;b._apply=function(a,f){var c=d(a),e=[c],k=d(window).scrollTop(),l=d("html").outerHeight(!0),g=c.parents().filter(":hidden");g.css("display","block");f&&(c.each(function(){var a=d(this),b="inline-block"===a.css("display")?"inline-block":"block";a.data("style-cache",a.attr("style"));a.css({display:b,"padding-top":"0","padding-bottom":"0",
Line 51: "margin-top":"0","margin-bottom":"0","border-top-width":"0","border-bottom-width":"0",height:"100px"})}),e=n(c),c.each(function(){var a=d(this);a.attr("style",a.data("style-cache")||"").css("height","")}));d.each(e,function(a,b){var c=d(b),e=0;f&&1>=c.length||(c.each(function(){var a=d(this),b="inline-block"===a.css("display")?"inline-block":"block";a.css({display:b,height:""});a.outerHeight(!1)>e&&(e=a.outerHeight(!1));a.css("display","")}),c.each(function(){var a=d(this),b=0;"border-box"!==a.css("box-sizing")&&
Line 52: (b+=h(a.css("border-top-width"))+h(a.css("border-bottom-width")),b+=h(a.css("padding-top"))+h(a.css("padding-bottom")));a.css("height",e-b)}))});g.css("display","");b._maintainScroll&&d(window).scrollTop(k/l*d("html").outerHeight(!0));return this};b._applyDataApi=function(){var a={};d("[data-match-height], [data-mh]").each(function(){var b=d(this),c=b.attr("data-match-height")||b.attr("data-mh");a[c]=c in a?a[c].add(b):b});d.each(a,function(){this.matchHeight(!0)})};var m=function(a){b._beforeUpdate&&
Line 53: b._beforeUpdate(a,b._groups);d.each(b._groups,function(){b._apply(this.elements,this.byRow)});b._afterUpdate&&b._afterUpdate(a,b._groups)};b._update=function(a,f){if(f&&"resize"===f.type){var c=d(window).width();if(c===g)return;g=c}a?-1===e&&(e=setTimeout(function(){m(f);e=-1},b._throttle)):m(f)};d(b._applyDataApi);d(window).bind("load",function(a){b._update(!1,a)});d(window).bind("resize orientationchange",function(a){b._update(!0,a)})})(jQuery);

/sprout/views/tinymce4/toolbar.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 38: <?php if (isset($search_params)) echo Fb::hiddenFields($search_params); ?>
Line 41: <div class="field-element field-element--text field-element--white" style="width: 170px; margin: 0 9px 0 0; vertical-align: top; display: inline-block;">
Line 43: <input id="mceu_img_search_input" class="textbox" type="text" name="search" value="<?php echo Enc::html($search_query); ?>">

/sprout/views/tinymce4/upload.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 31: <form action="SITE/admin/call/file/quickUpload" method="post" target="quick-upload" enctype="multipart/form-data" id="mce-upload">
Line 43: <?= Form::dropdown('category_id', [], $cats); ?>
Line 46: <input type="hidden" name="type" value="<?= Enc::html(@$_GET['type']); ?>">
Line 50: <iframe name="quick-upload" id="quick-upload" style="display: none;"></iframe>
Line 73: window.location = ROOT + 'tinymce4/image_size/' + nfo.id;
Line 93: $('#mce-upload select[name="category_id"]').change(function() {

/sprout/views/tinymce4/video_cat.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 24: Choose a category of videos from below.
Line 29: <li class="container"><a href="SITE/tinymce4/video_list/<?= $row['id']; ?>"><?= Enc::html($row['name']); ?>
Line 30: (<?= Inflector::numPlural($row['num_files'], 'video'); ?>)</a>

/sprout/views/tinymce4/video_list.php   Highlighted file source

Line 3: * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
Line 26: Choose a video from the list below.
Line 34: <?php foreach ($videos as $row): ?>

/sprout/views/video_playlist.php   Highlighted file source

Line 8: Needs::fileGroup('video_gallery');
Line 11: <?php if (!empty($videos) and count($videos) > 0): ?>
Line 12: <ul class="video-gallery -clearfix video-gallery--cols-<?php echo Enc::html($thumb_rows); ?>">
Line 13: <?php foreach ($videos as $video): ?>
Line 14: <li class="video-gallery__item">
Line 15: <a href="<?php echo Enc::html(Url::addUrlScheme('www.youtube.com/watch?v=' . $video['id'])); ?>">
Line 16: <img src="<?php echo Enc::html($video['thumb_url']); ?>" alt="<?php echo Enc::html($video['title']); ?>">
Line 19: <p class="video-gallery__item__caption"><?php echo Enc::html($video['title']); ?></p>

/sprout/Widgets/AdvancedSearchFormWidget.php   Highlighted file source

Line 14: namespace Sprout\Widgets;
Line 23: class AdvancedSearchFormWidget extends Widget
Line 30: * Return the front-end view of this widget
Line 32: * @param int $orientation The orientation of the widget.
Line 51: foreach (Constants::$relative_dates as $idx => $name) {
Line 53: $sel = ($idx == $_GET['date'] ? ' selected' : '');
Line 54: $out .= "<option value=\"{$idx}\"{$sel}>{$name}</option>";

/sprout/Widgets/AudioWidget.php   Highlighted file source

Line 14: namespace Sprout\Widgets;
Line 23: * Basically just a test widget
Line 25: class AudioWidget extends Widget
Line 32: * Return the front-end view of this widget
Line 34: * @param int $orientation The orientation of the widget.
Line 49: * Return the settings form for this widget

/sprout/Widgets/ChildrenGalleryWidget.php   Highlighted file source

Line 14: namespace Sprout\Widgets;
Line 27: class ChildrenGalleryWidget extends Widget
Line 34: * Does the front-end rendering of this widget
Line 36: * @param int $orientation The orientation of the widget
Line 46: $this->settings['hide_blanks'] = (int) @$this->settings['hide_blanks'];
Line 57: $matcher = new TreenodeValueMatcher('id', $this->settings['parent']);
Line 91: $view->hide_blanks = $this->settings['hide_blanks'];
Line 92: $view->idx = 0;
Line 106: * Returns the settings for the article list widget
Line 107: * See {@link Widget::getSettingsForm} for full documentation
Line 113: $q = "SELECT id, name FROM ~subsites ORDER BY record_order";
Line 119: $root = Navigation::loadPageTree($row['id'], true, false);
Line 138: $out .= Form::checkboxList(['hide_blanks' => 'Hide pages with no gallery image']);

/sprout/Widgets/ChildrenPagesWidget.php   Highlighted file source

Line 14: namespace Sprout\Widgets;
Line 23: class ChildrenPagesWidget extends Widget
Line 30: * Does the front-end rendering of this widget
Line 32: * @param int $orientation The orientation of the widget

/sprout/Widgets/FileListWidget.php   Highlighted file source

Line 14: namespace Sprout\Widgets;
Line 20: use Sprout\Helpers\WidgetArea;
Line 24: * doc list widget
Line 26: class FileListWidget extends Widget
Line 34: * Returns the output of the doc list widget
Line 35: * See {@link Widget::render} for full documentation
Line 37: * @param int $orientation The orientation of the widget.
Line 47: INNER JOIN ~files_cat_join AS joiner ON joiner.file_id = files.id
Line 48: WHERE joiner.cat_id = ?
Line 53: if ($orientation == WidgetArea::ORIENTATION_TALL) {
Line 55: } else if ($orientation == WidgetArea::ORIENTATION_WIDE) {
Line 56: $view = new View('sprout/filelist_wide');
Line 65: * Returns the settings for the doc list widget
Line 66: * See {@link Widget::getSettingsForm} for full documentation
Line 72: $q = "SELECT cat.id, CONCAT(cat.name, ' (', COUNT(file.id), ')')
Line 74: LEFT JOIN ~files_cat_join AS joiner ON cat.id = joiner.cat_id
Line 75: LEFT JOIN ~files AS file ON joiner.file_id = file.id
Line 76: GROUP BY cat.id
Line 91: * Returns a URL for editing the contents of this widget
Line 92: * See {@link Widget::getEditUrl} for full documentation
Line 98: return 'admin/contents/file?_category_id=' . $this->settings['category'];
Line 103: * Returns a label which describes the contents of this widget
Line 104: * See {@link Widget::get_info_label} for full documentation
Line 138: return 'id ASC';

/sprout/Widgets/HelloWorldWidget.php   Highlighted file source

Line 14: namespace Sprout\Widgets;
Line 18: use Sprout\Helpers\WidgetArea;
Line 22: * Basically just a test widget
Line 24: class HelloWorldWidget extends Widget
Line 27: protected $friendly_desc = "This is a test widget";
Line 31: * Return the front-end view of this widget
Line 33: * @param int $orientation The orientation of the widget.
Line 39: if ($orientation == WidgetArea::ORIENTATION_TALL) {
Line 42: } else if ($orientation == WidgetArea::ORIENTATION_WIDE) {
Line 43: $out .= '<br>Orientation: Wide</p>';
Line 51: * Return the settings form for this widget

/sprout/Widgets/HtmlCodeWidget.php   Highlighted file source

Line 14: namespace Sprout\Widgets;
Line 22: class HtmlCodeWidget extends Widget
Line 29: * Return the front-end view of this widget
Line 31: * @param int $orientation The orientation of the widget.
Line 40: * Return the settings form for this widget

/sprout/Widgets/ImageGalleryWidget.php   Highlighted file source

Line 14: namespace Sprout\Widgets;
Line 21: use Sprout\Helpers\WidgetArea;
Line 22: use Sprout\Helpers\Widgets;
Line 28: class ImageGalleryWidget extends Widget
Line 54: 'lc' => 'Middle left',
Line 55: 'cc' => 'Middle center',
Line 56: 'rc' => 'Middle right',
Line 62: // Whether this widget displays as grid or slider
Line 64: 'grid' => 'Gallery',
Line 65: 'slider' => 'Slider',
Line 70: * Validate and cleanup the settings fields
Line 73: private function validateSettings()
Line 97: $this->settings['display_opts'] = 'grid';
Line 100: $this->settings['slider_dots'] = (int) @$this->settings['slider_dots'];
Line 101: $this->settings['slider_arrows'] = (int) @$this->settings['slider_arrows'];
Line 102: $this->settings['slider_autoplay'] = (int) @$this->settings['slider_autoplay'];
Line 103: $this->settings['slider_speed'] = (int) @$this->settings['slider_speed'];
Line 105: if ($this->settings['slider_speed'] <= 0) {
Line 106: $this->settings['slider_speed'] = 3;
Line 114: * Does the front-end rendering of this widget
Line 116: * @param int $orientation The orientation of the widget
Line 120: if (!$this->validateSettings()) return null;
Line 136: ON joiner.file_id = files.id
Line 137: WHERE joiner.cat_id = ?
Line 159: 'slider_size' => 'c800x450',
Line 163: if ($orientation == WidgetArea::ORIENTATION_TALL) {
Line 166: $view = new View('sprout/image_gallery_wide_' . $this->settings['display_opts']);
Line 191: $view->idx = 1;
Line 194: $view->slider_dots = $this->settings['slider_dots'];
Line 195: $view->slider_arrows = $this->settings['slider_arrows'];
Line 196: $view->slider_autoplay = $this->settings['slider_autoplay'];
Line 197: $view->slider_speed = $this->settings['slider_speed'];
Line 198: $view->slider_images = $this->settings['num_images'];
Line 210: $q = "SELECT cat.id, CONCAT(cat.name, ' (', COUNT(file.id), ')')
Line 212: LEFT JOIN ~files_cat_join AS joiner ON cat.id = joiner.cat_id
Line 213: LEFT JOIN ~files AS file ON joiner.file_id = file.id AND file.type = ?
Line 215: GROUP BY cat.id
Line 219: $view = new View('sprout/gallery_widget_settings');
Line 259: return 'files.id ASC';
Line 266: * Returns a URL for editing the contents of this widget
Line 267: * See {@link Widget::getEditUrl} for full documentation
Line 272: return 'admin/contents/file?_category_id=' . $this->settings['category'];
Line 277: * Returns a label which describes the contents of this widget
Line 278: * See {@link Widget::get_info_label} for full documentation
Line 293: * If this widget is not available, a string message should be returned
Line 294: * If this widget *is* available, NULL should be returned.
Line 314: $pattern = '<div class="sprout-editor--widget sprout-editor--gallery"';
Line 315: $pattern .= ' data-id="([0-9]+)"';
Line 322: $pattern .= ' data-slider-dots="([0-9]+)"';
Line 323: $pattern .= ' data-slider-arrows="([0-9]+)"';
Line 324: $pattern .= ' data-slider-autoplay="([0-9]+)"';
Line 325: $pattern .= ' data-slider-speed="([0-9]+)"';
Line 329: list($title, $id, $max, $captions, $crop, $thumbs, $type, $ordering, $slider_dots, $slider_arrows, $slider_autoplay, $slider_speed) = $matches;
Line 331: if (!empty($id)) {
Line 332: for ($i = 0; $i < count($id); $i++) {
Line 333: $widget = Widgets::render(WidgetArea::ORIENTATION_EMAIL, 'Sprout\Widgets\ImageGalleryWidget', [
Line 334: 'category' => (int) $id[$i],
Line 341: 'slider_dots' => $slider_dots[$i],
Line 342: 'slider_arrows' => $slider_arrows[$i],
Line 343: 'slider_autoplay' => $slider_autoplay[$i],
Line 344: 'slider_speed' => $slider_speed[$i],
Line 347: $html = preg_replace('/<div class="sprout-editor--widget sprout-editor--gallery" (.*?)<\/div>/s', $widget, $html, 1);

/sprout/Widgets/MapDirectionsWidget.php   Highlighted file source

Line 14: namespace Sprout\Widgets;
Line 23: class MapDirectionsWidget extends Widget
Line 30: * Return the front-end view of this widget
Line 32: * @param int $orientation The orientation of the widget.
Line 56: * Return the settings form for this widget
Line 70: * Returns a label which describes the contents of this widget
Line 71: * See {@link Widget::get_info_label} for full documentation

/sprout/Widgets/MapWidget.php   Highlighted file source

Line 14: namespace Sprout\Widgets;
Line 27: class MapWidget extends Widget
Line 32: 'width' => 800,
Line 42: if (empty($this->settings['width'])) $this->settings['width'] = 500;
Line 47: $this->settings['width'] = (int) $this->settings['width'];
Line 54: * Return the front-end view of this widget
Line 56: * @param int $orientation The orientation of the widget.
Line 74: Needs::fileGroup('sprout/map_widget');
Line 76: $view = new View('sprout/map_widget');
Line 77: $view->width = $this->settings['width'];
Line 89: * Return the settings form for this widget
Line 100: Form::nextFieldDetails('Width', false);
Line 101: $out .= Form::text('width');
Line 117: * Returns a label which describes the contents of this widget
Line 118: * See {@link Widget::get_info_label} for full documentation

/sprout/Widgets/RelatedLinksWidget.php   Highlighted file source

Line 14: namespace Sprout\Widgets;
Line 28: class RelatedLinksWidget extends Widget
Line 34: * Does the front-end rendering of this widget
Line 36: * @param int $orientation The orientation of the widget
Line 81: if (! UserPerms::checkPermissionsTree('pages', $page['id'])) continue;
Line 125: if (! UserPerms::checkPermissionsTree('pages', $node['id'])) continue;

/sprout/Widgets/RichTextWidget.php   Highlighted file source

Line 14: namespace Sprout\Widgets;
Line 25: class RichTextWidget extends Widget
Line 32: * Return the front-end view of this widget
Line 34: * @param int $orientation The orientation of the widget; see e.g. {@see WidgetArea::ORIENTATION_WIDE}
Line 44: * Return the settings form for this widget
Line 50: $richtext_width = Kohana::config('sprout.admin_richtext_width');
Line 53: return Form::richtext('text', ['width' => $richtext_width, 'height' => $richtext_height]);

/sprout/Widgets/RssFeedWidget.php   Highlighted file source

Line 14: namespace Sprout\Widgets;
Line 27: class RssFeedWidget extends Widget
Line 34: * Return the front-end view of this widget
Line 36: * @param int $orientation The orientation of the widget.
Line 60: * Return the settings form for this widget

/sprout/Widgets/SitemapWidget.php   Highlighted file source

Line 14: namespace Sprout\Widgets;
Line 24: class SitemapWidget extends Widget
Line 31: * Does the front-end rendering of this widget
Line 33: * @param int $orientation The orientation of the widget

/sprout/Widgets/VideoPlaylistWidget.php   Highlighted file source

Line 14: namespace Sprout\Widgets;
Line 18: use Sprout\Exceptions\ValidationException;
Line 27: * Renders a gallery of videos
Line 29: class VideoPlaylistWidget extends Widget
Line 31: protected $friendly_name = "Video gallery";
Line 33: public $classname = "VideoPlaylist";
Line 37: * Renders the front-end view of this widget
Line 39: * @param int $orientation The orientation of the widget.
Line 44: if (empty($this->settings['playlist_id'])) return;
Line 47: $videos = $this->requestYoutubePlaylist($this->settings['playlist_id']);
Line 53: $view = new View('sprout/video_playlist');
Line 54: $view->videos = $videos;
Line 63: * Renders the admin settings form for this widget
Line 76: $view = new View('sprout/video_playlist_settings');
Line 87: * @param string $video_url Playlist URL
Line 88: * @return array List of key-value pairs of [id, thumb_url, description, title]
Line 91: private static function requestYoutubePlaylist($video_url)
Line 93: $url_query = parse_url($video_url, PHP_URL_QUERY);
Line 97: // Validate given URL
Line 103: // Validate API key
Line 105: Notification::error('Please configure your Google API key for YouTube videos');
Line 113: $params['playlistId'] = $url_params['list'];
Line 137: // Validate API request
Line 144: $videos = [];
Line 145: foreach ($playlist->items as $video) {
Line 146: $snippet = $video->snippet;
Line 158: $video = [];
Line 159: $video['id'] = $snippet->resourceId->videoId;
Line 160: $video['thumb_url'] = $thumb->url;
Line 161: $video['description'] = $snippet->description;
Line 162: $video['title'] = $snippet->title;
Line 164: $videos[] = $video;
Line 167: return $videos;

/sprout/Widgets/VideoWidget.php   Highlighted file source

Line 14: namespace Sprout\Widgets;
Line 16: use Sprout\Helpers\EmbedVideo;
Line 21: * Basically just a test widget
Line 23: class VideoWidget extends Widget
Line 25: protected $friendly_name = "Video player";
Line 26: protected $friendly_desc = 'A video player for videos hosted on YouTube or Vimeo';
Line 28: 'width' => 600,
Line 38: if (!isset($this->settings['video_id'])) $this->settings['video_id'] = '';
Line 40: if (!isset($this->settings['width'])) $this->settings['width'] = 600;
Line 46: * Return the front-end view of this widget
Line 48: * @param int $orientation The orientation of the widget.
Line 56: return EmbedVideo::renderEmbed(
Line 57: $this->settings['video_id'],
Line 58: $this->settings['width'],
Line 66: * Return the settings form for this widget
Line 72: Form::nextFieldDetails('Video URL', true);
Line 73: $out .= Form::text('video_id');
Line 75: Form::nextFieldDetails('Video title', true);
Line 78: Form::nextFieldDetails('Width', true);
Line 79: $out .= Form::text('width');

/sprout/Widgets/Widget.php   Highlighted file source

Line 14: namespace Sprout\Widgets;
Line 19: * Base class for widgets
Line 21: abstract class Widget {
Line 32: protected $friendly_name = 'Widget';
Line 42: * Array of default settings for new widgets
Line 56: * @param array $settings The widget settings
Line 71: * Return the currently loaded settings for the widget
Line 73: * @return array The widget settings
Line 82: * Gets the english name of this widget
Line 90: * Gets the english name of this widget
Line 99: * Set widget title
Line 101: * @param string $str Widget title (heading)
Line 102: * @return void
Line 111: * Returns the title to use for the widget - should not contain HTML
Line 122: * Returns the default settings for the widget
Line 131: * Run after import of settings, allows extending widgets to clean up settings which may
Line 134: * @return void
Line 142: * This function should return the content of the widget that is used on the front-end of the website.
Line 145: * which has the class 'widget', and the class 'widget-[WIDGETNAME]' applied to it.
Line 149: * @param int $orientation The orientation of the widget.
Line 150: * Will be one of the constants defined in the {@see WidgetArea} class.
Line 151: * ORIENTATION_TALL - used for sidebars, and other mainly tall areas
Line 152: * ORIENTATION_WIDE - used for wide areas, like the main content area
Line 157: * @tag widget-api
Line 163: * This function should return the content of the widget settings form.
Line 165: * The content will be contained within a DIV element, which is inside a FORM element.
Line 183: * displayed by this widget.
Line 185: * Most widgets show content using a category selection box; the URL should in that
Line 197: * This function should return a summary of what this widget's *content* is.
Line 198: * Don't specify the widget name; we already know that!
Line 200: * Most widgets show content using a category selection box; in that case
Line 214: * If this widget is not available, a string message should be returned
Line 215: * If this widget *is* available, NULL should be returned.

A total of 7091 lines in 568 files were found