public function output(Pagemill_Data $data, Pagemill_Stream $stream) { Typeframe::Timestamp('Starting debug output'); $debug = new Pagemill_Data(); $timestamps = Typeframe::GetTimestamps(); $tdata = array(); if ($timestamps) { $begin = $timestamps[0]->time(); foreach ($timestamps as $t) { //$dump .= "{$t->action()}: " . ($t->time() - $begin) . "<br/>"; $tdata[] = array('action' => $t->action(), 'time' => $t->time() - $begin); } } $debug['timestamps'] = $tdata; $debug['memory_used'] = memory_get_usage(); $debug['memory_used_real'] = memory_get_usage(true); $debug['includes'] = get_included_files(); $debug['querycount'] = Dbi_Source::QueryCount(); $debug['templates'] = Pagemill::ProcessedTemplates(); // TODO: Get template files $debug['data'] = $data; $this->_recurseTines($debug); $include = new Typeframe_Tag_Include('include', array('template' => '/pagemill/tag/debug.html')); $include->process($debug, $stream); }
public function load() { $this->_data = array(); $host = 'http://' . $_SERVER['SERVER_NAME']; // This will retrieve all the content pages. if (Typeframe::Registry()->application('Content')) { $query = "SELECT uri, nickname,\tapplication FROM #__page"; $rs = Typeframe::Database()->prepare($query); $rs->execute(); while ($data = $rs->fetch_array()) { $this->_data[] = array('page' => $host . TYPEF_WEB_DIR . $data['uri'], 'uri' => $data['uri'], 'name' => $data['nickname'] != '' ? $data['nickname'] : $data['uri'], 'application' => $data['application']); } } // And the news pages. if (Typeframe::Registry()->application('News')) { $select = new BuildSql_Select(); $select->table('#__news n'); $select->leftJoin('#__news_category ncat', 'ncat.categoryid = n.categoryid'); $select->field('n.*'); $select->field('ncat.categoryname'); $select->group('n.newsid'); $select->order('n.pubdate DESC'); $select->where('n.pubdate <= ?', Typeframe::Now()); $rs = $this->db()->prepare($select->query()); $rs->execute(); while ($row = $rs->fetch_array()) { $uri = News::GetCategoryUri($row['categoryid']) . '/' . ($row['encodedtitle'] ? $row['encodedtitle'] : $row['newsid']); $this->_data[] = array('page' => $host . TYPEF_WEB_DIR . $uri, 'uri' => $uri, 'name' => $row['title'], 'application' => $row['categoryname']); } } }
public function output(PMDataNode $data) { $pm = new Pagemill($data->fork()); //$pm->setVariableArray($this->settings); $db = Typeframe::Database(); if (!isset($this->settings['driver'])) { //return '<div class="error"><p>Please provide a "driver" attribute on the pm:driver plugin.</p></div>'; return ''; } // Blank driver attributes count as nothing too. if (!$this->settings['driver']) { return ''; } // I need to lookup this driver as a page and ensure it's a valid driver. $driver = (int) $this->settings['driver']; $rs = $db->prepare('SELECT uri, nickname, driver FROM #__page WHERE driver != "" AND pageid = ?'); $rs->execute($driver); if (!$rs->recordcount()) { // No records found... just silently fail. return ''; } $data = $rs->fetch_array(); $pm->setVariable('link', TYPEF_WEB_DIR . $data['uri']); $pm->setVariable('title', $data['nickname']); $pm->setVariable('driver', $data['driver']); return $pm->writeText('<pm:include template="/plugins/driver.html" />'); }
public function output(Pagemill_Data $data, Pagemill_Stream $stream) { $data = $data->fork(); $apps = array(); foreach (Typeframe::Registry()->pages() as $page) { if ($page->siteid() == Typeframe::CurrentPage()->siteid()) { if (strpos($page->uri(), '/admin/') !== false) { if ($page->allow()) { $apps[] = array('title' => $page->title(), 'icon' => $page->icon(), 'uri' => $page->uri()); } } } } $data['applications'] = $apps; if (class_exists('Model_Site')) { $sites = new Model_Site(); if (Typeframe::User()->get('usergroupid') != TYPEF_ADMIN_USERGROUPID) { $sites->innerJoin('perm', 'Model_User_Site', 'id = perm.siteid'); $sites->where('perm.userid = ?', Typeframe::User()->get('userid')); $primary = new Model_User_Site(); $primary->where('userid = ?', Typeframe::User()->get('userid')); $primary->where('siteid = ?', 0); $data['admin_primary'] = $primary->count() > 0; } else { $data['admin_primary'] = 1; } $data['sites'] = $sites; } $data->sortNodes(array('applications', 'title')); if (defined('TYPEF_HOST')) { $data['primary_host'] = TYPEF_HOST; } parent::output($data, $stream); }
public static function FailureOrRedirect($message, $redirect = null, $data = null) { if (requestIsAjax()) { die(self::Failure($message, self::_addRedirectToData($data, $redirect))); } Typeframe::Redirect($message, $redirect); }
public function output(\Pagemill_Data $data, \Pagemill_Stream $stream) { $this->pluginTemplate = "/downloads/downloads.plug.html"; $data = $data->fork(); $downloads = new Model_Download_File(); $downloads->where('siteid = ?', Typeframe::CurrentPage()->siteid()); $data['downloads'] = $downloads; parent::output($data, $stream); }
public function process() { // TODO: There might be a cleaner way to handle honeypot errors // instead of exiting, but it's good enough for now. if ((string) $this->value != '') { Typeframe::Log('Mailform submission blocked due to value in honeypot field'); exit; } }
public function output(Pagemill_Data $data, Pagemill_Stream $stream) { $db = Typeframe::Database(); if ($this->hasAttribute('rules') && !Typeframe_Tag_Socket::ProcessRules($this->getAttribute('rules'))) { return ''; } /* * Rules for loading the plugin: * 1. The plugid overrides other load settings. * 2. Load a plugin from the table if the name attribute matches an * an admin-specified name. * 3. Create a generic plugin from a signature. * 4. If the plugin was loaded from the database, attribute settings * override database settings. */ $p = null; if ($this->getAttribute('plugid')) { $plugin = Model_Plug::Get($data->parseVariables($this->getAttribute('plugid'))); if ($plugin->exists()) { $p = Typeframe::Registry()->getPluginSignature($plugin['plug']); } } else { if ($this->getAttribute('name')) { $plugins = new Model_Plug(); $plugins->where('name = ?', $data->parseVariables($this->getAttribute('name'))); $plugin = $plugins->getFirst(); if ($plugin->exists()) { $p = Typeframe::Registry()->getPluginSignature($plugin['plug']); } else { $p = Typeframe::Registry()->getPluginSignature($this->getAttribute('name')); } } } if ($p) { $cls = $p->className(); if (class_exists($cls)) { $settings = $this->settings; foreach ($this->attributes() as $k => $v) { $settings[$k] = $data->parseVariables($v); } //$obj = new $cls($settings); $obj = new $cls('plugin', $settings, null); foreach ($this->children() as $child) { $obj->appendChild($child); } $obj->process($data, $stream); foreach ($obj->children() as $child) { $this->appendChild($child); } $obj->detach(); } else { throw new Exception("Class '{$cls}' does not exist"); } } else { throw new Exception("Plugin does not have a signature"); } }
public function admin(Pagemill_Data $data, Pagemill_Stream $stream) { $this->adminTemplate = '/admin/mailform/settings.plug.html'; $data = $data->fork(); $data->setArray($this->attributes()); $mailforms = new Model_Mailform(); $mailforms->where('siteid = ?', Typeframe::CurrentPage()->siteid()); $data->set('mailforms', $mailforms); parent::admin($data, $stream); }
/** * Get the cached page content. * @return array */ public static function Cache() { static $cached_content = null; if (is_null($cached_content)) { if (Typeframe::CurrentPage()->page()->pageid()) { $page = Model_Content_Page::Get(Typeframe::CurrentPage()->page()->pageid()); $cached_content = $page['content']; } } return $cached_content; }
public function testContentPages() { /* Assertions: * All content pages return a 200 or 403 response code */ $contentPages = Typeframe::Registry()->applicationUrls('Content'); $this->assertTrue($contentPages, "No content pages to test."); foreach ($contentPages as $page) { $this->get($page); $this->assertTrue(in_array($this->responseCode(), array(200, 403)), "{$this->currentUrl()} returned response code {$this->responseCode()}"); } }
public function process(\Pagemill_Tag $tag, \Pagemill_Data $data, \Pagemill_Stream $stream) { //if (!$this->_runOnce) { $this->_runOnce = true; if (defined('TYPEF_DEBUG')) { if (TYPEF_DEBUG == 'all' || TYPEF_DEBUG == 'admin' && Typeframe::User()->get('usergroupid') == TYPEF_ADMIN_USERGROUPID) { // Don't include debug info in AJAX requests if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') { $debug = new Typeframe_Tag_Debug('debug', array(), $tag); } } } //} }
public function allow() { // Users in the admin group always pass permission tests. if (Typeframe::User()->get('usergroupid') == TYPEF_ADMIN_USERGROUPID) { return true; } if ($this->_page->pageid()) { $pageperm = new Model_PagePerm(); $pageperm->where('pageid = ?', $this->_page->pageid()); $pageperm->where('usergroupid = ? OR usergroupid = 0', Typeframe::User()->get('usergroupid')); return $pageperm->count() > 0; } return true; }
public function output(Pagemill_Data $data, Pagemill_Stream $stream) { $data = $data->fork(); if (!empty($this->attributes['menuplugid'])) { $menuplugid = $this->attributes['menuplugid']; $db = Typeframe::Database(); $base = substr(Typeframe::CurrentPage()->uri(), STRLEN(TYPEF_WEB_DIR)); if ($base == '') { $base = '/'; } $search = new Model_Nav(); $search->where('plugid = ?', $menuplugid); $search->where('url = ? OR url = ? OR url = ? OR url = ? OR url = ? OR url = ? OR pageid = ?', "~{$base}", "~{$base}/", "/{$base}", "/{$base}/", TYPEF_WEB_DIR . $base, TYPEF_WEB_DIR . $base . '/', Typeframe::CurrentPage()->pageid()); foreach ($search->select() as $current) { $current['url'] = $this->_convertUrl($current['url']); $data->set('current', $current); $parentid = $current['parent']; $siblings = new Model_Nav(); $siblings->where('plugid = ?', $menuplugid); $siblings->where('parent = ?', $parentid); $siblings->order('sortnum'); $data['siblings'] = $siblings; /*$sibArray = array(); foreach ($siblings->select() as $sib) { $sib['url'] = $this->_convertUrl($sib['url']); $sibArray[] = $sib; } $data['siblings'] = $sibArray;*/ if (!empty($this->attributes['showparent'])) { $parent = $db->execute('SELECT * FROM #__nav WHERE itemid = ' . $parentid); foreach ($parent as $par) { $par['url'] = $this->_convertUrl($par['url']); $data->set('parent', $par); } } if (!empty($this->attributes['showchildren'])) { $childArray = array(); $children = $db->execute('SELECT * FROM #__nav WHERE plugid = ' . $menuplugid . ' AND parent = ' . $current['itemid'] . ' ORDER BY sortnum'); foreach ($children as $chi) { $chi['url'] = $this->_convertUrl($chi['url']); $childArray[] = $chi; } $data['children'] = $childArray; } } } $this->pluginTemplate = "navigation/submenu.plug.html"; parent::output($data, $stream); }
public function allow() { if (!Typeframe::User()->loggedIn()) { return false; } if (Typeframe::User()->get('usergroupid') == TYPEF_ADMIN_USERGROUPID) { return true; } $relativeUri = substr($this->page()->uri(), strlen(TYPEF_WEB_DIR)); if ($relativeUri == '/admin' || $relativeUri == '/admin/') { // Main admin page. Just check to see if the user has access to any other applications. $rs = Typeframe::Database()->execute('SELECT * FROM #__usergroup_admin WHERE usergroupid = ' . Typeframe::User()->get('usergroupid')); return count($rs) > 0; } $rs = Typeframe::Database()->execute('SELECT * FROM #__usergroup_admin WHERE usergroupid = ' . Typeframe::User()->get('usergroupid') . ' AND application = \'' . $this->page()->application()->name() . '\''); return $rs->count() > 0; }
function _pageMeta($record) { // Do not try to load the admin path from the registry until the registry // has been loaded. This is necessary to avoid causing infinite loops when // the registry uses Model_Page to load page data. if (Typeframe::RegistryLoaded()) { $response = Typeframe::Registry()->applicationAt(TYPEF_WEB_DIR . $record['uri']); if ($response) { $record['fullpath'] = $response->uri(); if ($response->application()->admin()) { $record['admin'] = TYPEF_WEB_DIR . ($record['site']['directory'] ? '/' . $record['site']['directory'] : '') . $response->application()->admin(); } else { $record['admin'] = ''; } } } }
public function output(\Pagemill_Data $data, \Pagemill_Stream $stream) { $data = $data->fork(); $url = Typeframe::CurrentPage()->uri(); if (substr($url, -1) == '/') { $url = substr($url, 0, -1); } $dirs = explode('/', substr($url, strlen(TYPEF_WEB_DIR))); $this->pluginTemplate = '/breadcrumbs/breadcrumbs.plug.html'; $data['breadcrumbs'] = array(); $currentUrl = TYPEF_WEB_DIR; $start = $data->parseVariables(Typeframe_Attribute_Url::ConvertShortUrlToExpression($this->getAttribute('start'))); while (count($dirs) > 0) { $currentUrl .= '/' . array_shift($dirs); $currentUrl = preg_replace('/\\/+/', '/', $currentUrl); if ($start && strpos($currentUrl, $start) === false) { continue; } if (isset($_SESSION['breadcrumbs'][$currentUrl])) { $bc = $_SESSION['breadcrumbs'][$currentUrl]; $bc['url'] = $currentUrl . ($bc['query'] ? '?' . $bc['query'] : ''); $data['breadcrumbs'][] = $bc; } else { $response = Typeframe::Registry()->responseAt($currentUrl); if ($currentUrl == $response->page()->uri()) { if ($response->application()->name() != '403' && $response->application()->name() != '404') { $settings = $response->page()->settings(); if (!empty($settings['nickname'])) { $title = $settings['nickname']; } else { $title = $response->page()->title(); } $bc = array('title' => $title, 'query' => ''); $_SESSION['breadcrumbs'][$currentUrl] = $bc; $bc['url'] = $currentUrl; $data['breadcrumbs'][] = $bc; } } } } parent::output($data, $stream); return; }
public function output(\Pagemill_Data $data, \Pagemill_Stream $stream) { $plugid = $data->parseVariables($this->getAttribute('plugid')); $plug = Model_Plug::Get($plugid); if ($plug->exists()) { $name = $plug['plug']; $sig = Typeframe::Registry()->getPluginSignature($name); $cls = $sig->className(); if (is_subclass_of($cls, 'Plugin')) { $plug['settings']['plugid'] = $plugid; $plug = new $cls('', $plug['settings'], $this); $plug->admin($data, $stream); } else { throw new Exception("Invalid plugin type specified"); } } else { throw new Exception("Invalid plugin specified"); } }
/** * Create an Auth object based on a user's auth setting or the default authentication method. * @param string $usernameOrEmail The user name or email address of the user. * @param string $field Which field to use (username, email, or either) * @param string $method Default authentication method for nonexistent users (e.g., so users can authenticate through LDAP even if they don't have a user record yet) * @return Auth */ public static function ForUser($usernameOrEmail, $field = 'either', $method = TYPEF_AUTH_DEFAULT) { switch ($field) { case 'username': $field = 'username'; break; case 'email': $field = 'email'; break; default: $field = 'username'; if (preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$/i', $usernameOrEmail)) { $field = 'email'; } break; } $users = new Model_User(); $users->where("{$field} = ?", $usernameOrEmail); $obj = null; if ($users->getTotal() == 0) { $user = Model_User::Create(); $user[$field] = $usernameOrEmail; $cls = 'Auth_' . $method; } else { if ($users->getTotal() > 1) { Typeframe::Log("WARNING: {$usernameOrEmail} matches more than one {$field} in the user table."); } $user = $users->getFirst(); $userAuth = $user['auth']; if (!$userAuth) { $userAuth = 'Hash'; } // Older users might have a blank auth field. Assume Hash $cls = 'Auth_' . $userAuth; } if (!is_subclass_of($cls, 'Auth')) { throw new Exception("{$cls} is not a subclass of Auth"); } $obj = new $cls($user); return $obj; }
public static function GetCategoryId($from_settings = false) { // get categoryid from request, if any $categoryid = $from_settings ? '' : trim(@$_REQUEST['categoryid']); if (0 == strlen($categoryid)) { // none give; try loading from settings $settings = Typeframe::CurrentPage()->settings(); $categoryid = @$settings['categoryid']; // if none set, display all by default if (is_null($categoryid)) { return array(0); } // if it's an array if (is_array($categoryid)) { // and contains all case, return all if (in_array(0, $categoryid)) { return array(0); } // if has more than one value, convert all to ints if (count($categoryid) > 0) { $result = array(); foreach ($categoryid as $value) { if (ctype_digit($value)) { $result[] = intval($value); } } return $result; } // otherwise, convert single value to int return intval($categoryid[0]); } // otherwise, convert single value to int return intval($categoryid); } // integer category id given if (ctype_digit($categoryid)) { return intval($categoryid); } // none of the above return null; }
public function testNewsIndex() { /* Assertions: * Site has at least one news page (required for tests). * All pages return 200 (public) or 403 (login required). * At least one news page is public (required for tests). */ $newsPages = Typeframe::Registry()->applicationUrls('News'); $this->assertTrue(count($newsPages), "No news pages to test."); foreach ($newsPages as $page) { $this->get($page); if (Typeframe::Allow($page)) { $validResponse = 200; $this->availablePage = $page; } else { $validResponse = 403; } $this->assertTrue($this->responseCode() == $validResponse, "{$page} returned {$this->responseCode()} (expected {$validResponse})"); } $this->assertTrue(count($newsPages) == 0 || $this->availablePage, "No public news pages available for tests."); }
public function output(\Pagemill_Data $data, \Pagemill_Stream $stream) { $this->pluginTemplate = '/admin/admintree.plug.html'; $data = $data->fork(); $apps = array(); foreach (Typeframe::Registry()->pages() as $page) { if (strpos($page->uri(), TYPEF_WEB_DIR . '/admin/') === 0) { $category = $page->application()->category() ? $page->application()->category() : 'Other'; if (!isset($apps[$category])) { $apps[$category] = array(); } $apps[$category][] = array('title' => $page->title(), 'icon' => $page->icon(), 'uri' => $page->uri()); } } ksort($apps); $categories = array(); foreach ($apps as $category => $applications) { $categories[] = array('name' => $category, 'applications' => $applications); } $data['categories'] = $categories; parent::output($data, $stream); }
public function output(Pagemill_Data $data, Pagemill_Stream $stream) { $this->pluginTemplate = '/news/feed.plug.html'; $default = array('limit' => 5, 'categoryid' => null); $settings = array_merge($default, $this->attributes()); $articles = new Model_News_Article(); if (!is_null($settings['categoryid'])) { if (!is_array($settings['categoryid'])) { $settings['categoryid'] = array($settings['categoryid']); } if (!in_array(0, $settings['categoryid'])) { $articles->where('categoryid IN ?', $settings['categoryid']); } } $articles->where('pubdate <= ?', Typeframe::Now()); $articles->where('expdate >= ? OR expdate = ? OR expdate IS NULL', Typeframe::Now(), '0000-00-00 00:00:00'); $articles->where('status = ?', 'published'); $articles->limit($settings['limit']); $data = $data->fork(); $data['header'] = $settings['header']; $data['articles'] = $articles; parent::output($data, $stream); }
public function __construct($nsPrefix) { $this->nsUri = 'http://typeframe.com/pagemill'; parent::__construct($nsPrefix); $this->registerTag('socket', 'Typeframe_Tag_Socket'); $this->registerTag('plugin', 'Typeframe_Tag_Plugin'); $this->registerTag('pluginadmin', 'Typeframe_Tag_PluginAdmin'); $this->registerTag('html', 'Typeframe_Tag_Html'); $this->registerTag('head', 'Typeframe_Tag_Head'); $this->registerTag('body', 'Typeframe_Tag_Body'); $this->registerTag('import', 'Typeframe_Tag_Import'); $this->registerTag('include', 'Typeframe_Tag_Include'); $this->registerTag('editor', 'Typeframe_Tag_Editor'); $this->registerTag('calendar', 'Typeframe_Tag_Calendar'); $this->registerTag('select', 'Typeframe_Tag_Select'); // TODO: Deprecate $this->registerTag('insert', 'Typeframe_Tag_Insert'); $this->registerTag('group', 'Typeframe_Tag_Group'); $this->registerTag('scriptonce', 'Typeframe_Tag_Scriptonce'); $this->registerTag('codeblock', 'Typeframe_Tag_Codeblock'); $this->registerTag('debug', 'Typeframe_Tag_Debug'); $this->registerTag('timg', 'Typeframe_Tag_Timg'); // TODO: Deprecate $this->registerTag('/body', 'Typeframe_Tag_Html_Body'); $this->registerTag('fileupload', 'Typeframe_Tag_FileUpload'); $this->registerTag('imageupload', 'Typeframe_Tag_ImageUpload'); $this->registerTag('postlink', 'Typeframe_Tag_Postlink'); $this->registerTag('checkbox', 'Typeframe_Tag_Checkbox'); foreach (Typeframe::Registry()->tags() as $tag) { $this->registerTag($tag['name'], $tag['class']); } $this->registerAttribute('/href', 'Typeframe_Attribute_Url'); $this->registerAttribute('/src', 'Typeframe_Attribute_Url'); $this->registerAttribute('/action', 'Typeframe_Attribute_Url'); $this->registerAttribute('method', 'Typeframe_Attribute_Method'); $this->registerAttribute('confirm', 'Typeframe_Attribute_Confirm'); }
} $pm->addLoop('usergroups', array('usergroupid' => '0', 'usergroupname' => 'Everyone', 'selected' => in_array(0, $selected) ? true : false)); foreach ($usergroups->getAll() as $usergroup) { if (in_array($usergroup['usergroupid'], $selected)) { $usergroup['selected'] = true; } $pm->addLoop('usergroups', $usergroup); } foreach (Typeframe::Registry()->applications() as $app) { //if ('soft' == $app->map()) $pm->addLoop('applications', array('application' => $app->name())); } $pm->sortLoop('applications', 'application'); if (PAGES_DEFAULT_APPLICATION) { $app = Typeframe::Registry()->application(PAGES_DEFAULT_APPLICATION); //if ($app && ('soft' == $app->map())) if ($app) { $pm->setVariable('application', PAGES_DEFAULT_APPLICATION); } } // add skins to template foreach (Typeframe::GetSkins() as $skin) { $pm->addLoop('skins', array('skin' => $skin)); } $pm->setVariable('typef_site_skin', TYPEF_SITE_SKIN); $application = Typeframe::Registry()->application($page['application']); if ($application && $application->admin()) { if (file_exists(TYPEF_SOURCE_DIR . '/scripts' . $application->admin() . '/settings.php')) { Typeframe::IncludeScript($application->admin() . '/settings.php'); } }
<?php if ($_SERVER['REQUEST_METHOD'] == 'POST') { Model_Redirect::Delete($_POST['id']); Typeframe::Redirect('Redirect deleted.', Typeframe::CurrentPage()->applicationUri()); }
<?php $site = Model_Site::Get($_REQUEST['id']); if ($site->exists()) { require_once 'options.inc.php'; $pm->setVariable('site', $site); if ($_SERVER['REQUEST_METHOD'] == 'POST') { include 'update.inc.php'; Typeframe::Redirect('Site updated.', Plugin_Breadcrumbs::SavedState(Typeframe::CurrentPage()->applicationUri())); } } else { Typeframe::Redirect('Invalid site specified.', Plugin_Breadcrumbs::SavedState(Typeframe::CurrentPage()->applicationUri())); }
<?php /* 29 december 2010: cleanup while trying to add status field to typef_news table; rewrote to use news categories class 3 january 2011: DAOFactory, not DAO_Factory; setCategoryId now static 28 march 2011: merged in HL code 29 march 2011: added page title, header */ // define some handy shortcuts to save typing $settings = Typeframe::CurrentPage()->settings(); if (Typeframe::CurrentPage()->pathInfo()) { Typeframe::IncludeScript('/news/categories/view.php'); return; } if (is_array($settings['categoryid']) && !in_array(0, $settings['categoryid']) && 1 == count($settings['categoryid'])) { Typeframe::Redirect('Redirecting to category listing...', Typeframe::CurrentPage()->applicationUri() . 'categories/' . $settings['categoryid'][0]); return; } // create news category object $categories = News_Category::DAOFactory(); // limit to a particular category id News::SetCategoryId($categories, @$settings['categoryid']); // add categories to template $pm->setVariable('categories', $categories); // add page title and header to template $title = News::GetTitle(); $pm->setVariable('page_title', $title); $pm->setVariable('page_header', $title);
*/ define('TYPEF_ALLOW_LOGIN_COOKIE', Typeframe::Registry()->getConfigValue('TYPEF_ALLOW_LOGIN_COOKIE')); /** * # days to store login cookies (default: '90') */ define('TYPEF_LOGIN_COOKIE_EXPIRE', Typeframe::Registry()->getConfigValue('TYPEF_LOGIN_COOKIE_EXPIRE')); /** * Require email confirmation (default: '1') */ define('TYPEF_REQUIRE_CONFIRMATION', Typeframe::Registry()->getConfigValue('TYPEF_REQUIRE_CONFIRMATION')); /** * Allow temp login without confirmation (default: '0') */ define('TYPEF_TEMP_AFTER_REG', Typeframe::Registry()->getConfigValue('TYPEF_TEMP_AFTER_REG')); /** * Require admin approval to activate accounts (default: '0') */ define('TYPEF_REQUIRE_APPROVAL', Typeframe::Registry()->getConfigValue('TYPEF_REQUIRE_APPROVAL')); /** * Email users when admin approval is required (default: '0') */ define('TYPEF_REQUIRE_APPROVAL_NOTIFICATION', Typeframe::Registry()->getConfigValue('TYPEF_REQUIRE_APPROVAL_NOTIFICATION')); /** * Email these addresses when a user registers (default: '') */ define('TYPEF_REGISTRATION_NOTIFICATION', Typeframe::Registry()->getConfigValue('TYPEF_REGISTRATION_NOTIFICATION')); /** * Authentication mechanism to use by default (default: 'Hash') */ define('TYPEF_AUTH_DEFAULT', Typeframe::Registry()->getConfigValue('TYPEF_AUTH_DEFAULT'));
<?php $mailform['mailformname'] = $_POST['mailformname']; $mailform['message'] = $_POST['message']; $mailform['response'] = $_POST['response']; $mailform['subject'] = $_POST['subject']; $mailform['replyto'] = $_POST['replyto']; $mailform['redirect'] = $_POST['redirect']; $mailform['template'] = $_POST['template']; $recipients = array(); for ($i = 0; $i < count($_POST['recipients']['email']); $i++) { if (!empty($_POST['recipients']['email'][$i])) { $recipients[] = array('email' => $_POST['recipients']['email'][$i], 'name' => $_POST['recipients']['name'][$i], 'when' => $_POST['recipients']['when'][$i], 'fieldname' => $_POST['recipients']['fieldname'][$i], 'fieldvalue' => $_POST['recipients']['fieldvalue'][$i]); } } $mailform['recipients'] = $recipients; $formfields = array(); for ($i = 0; $i < count($_POST['fields']['name']); $i++) { if (!empty($_POST['fields']['name'][$i])) { $formfields[] = array('name' => $_POST['fields']['name'][$i], 'class' => $_POST['fields']['class'][$i], 'type' => $_POST['fields']['type'][$i], 'values' => $_POST['fields']['values'][$i], 'required' => $_POST['fields']['required'][$i]); } } $mailform['captcha'] = !empty($_POST['captcha']) ? 1 : 0; $mailform['formfields'] = $formfields; $mailform->save(); Typeframe::Redirect('Mailform saved.', Typeframe::CurrentPage()->applicationUri());