public function __construct() { if (!function_exists('gd_info')) { if (!$this->_isInternal()) { page_not_found(); } else { // TODO: improve this Flash::set('error', 'Image - ' . __('GD Library is either not installed or not enabled, check your phpinfo().')); } exit; } parent::__construct(); if ($this->_isInternal()) { $this->setLayout('backend'); $this->assignToLayout('sidebar', new View('../../plugins/image/views/sidebar')); } // get setting from db $src = Plugin::getSetting('path', 'image'); if ($src !== '/') { $src = '/' . $src; } if (substr($src, strlen($src) - 1) !== '/') { $src = $src . '/'; } $this->_image_root = CMS_ROOT . $src; }
public function index($page = 0) { $totalTags = Tagger::findAll(); $CurPage = isset($page) ? $page : 0; $rowspage = Plugin::getSetting('rowspage', 'tagger'); // New functions added in to make sorting tags easier on the backend. $sort_field = Plugin::getSetting('sort_field', 'tagger'); $sort_order = Plugin::getSetting('sort_order', 'tagger'); $order_by = Tagger::sortField($sort_field) . ' ' . $sort_order; $start = $CurPage * $rowspage; $totalrecords = count($totalTags); $lastpage = ceil($totalrecords / $rowspage); $lastpage = $totalrecords <= $rowspage ? 0 : abs($lastpage - 1); /* Get data. */ $tags = Tagger::findAll(array('offset' => $start, 'limit' => $rowspage, 'order' => $order_by)); $this->display('tagger/views/index', array('tags' => $tags, 'currentpage' => $CurPage, 'lastpage' => $lastpage)); }
function downloads_catch_click($args) { // check for download if (preg_match('#^/download-file/(\d+)#i',$args,$matches)) { // update the click count of the banner $id = (int)$matches[1]; if (!$download = Download::findById($id)) return $args; $download->downloads++; $download->save(); // redirect to the requested url header ('HTTP/1.1 301 Moved Permanently', true); header ('Location: /'.Plugin::getSetting('download_uri','downloads').'/'.$download->filename); exit; } // check for download by name if (preg_match('#^/download-file/(.*)$#i',$args,$matches)) { // update the click count of the banner $filename = $matches[1]; if (!$download = Download::findByFilename($filename)) return $args; $download->downloads++; $download->save(); // redirect to the requested url header ('HTTP/1.1 301 Moved Permanently', true); header ('Location: /'.Plugin::getSetting('download_uri','downloads').'/'.$download->filename); exit; } // no click so keep going return $args; }
function index() { self::__checkPermission('redirector_view'); // cleanup old redirects $expireafter = Plugin::getSetting('expireafter', 'redirector'); if ( $expireafter > 0 ) { Record::deleteWhere('RedirectorRedirects',"updated < DATE_SUB(NOW(), INTERVAL {$expireafter} DAY) AND perm='0'"); Record::deleteWhere('Redirector404s',"updated < DATE_SUB(NOW(), INTERVAL {$expireafter} DAY)"); } $data['redirects'] = RedirectorRedirects::findAll( array( 'order'=>'redirects.dest, redirects.url' ) ); $threshold = Plugin::getSetting('threshold', 'redirector'); $data['errors'] = Redirector404s::findAll( array( 'where'=>'error404s.hits >= ' . $threshold, 'order'=>'error404s.hits DESC' ) ); $this->display( 'redirector/views/index', $data ); }
private function _upload_file($origin, $dest, $tmp_name, $overwrite = false) { FileManagerController::_checkPermission(); AuthUser::load(); if (!AuthUser::hasPermission('file_manager_upload')) { return false; } $origin = basename($origin); $full_dest = $dest . $origin; $file_name = $origin; for ($i = 1; file_exists($full_dest); $i++) { if ($overwrite) { unlink($full_dest); continue; } $file_ext = strpos($origin, '.') === false ? '' : '.' . substr(strrchr($origin, '.'), 1); $file_name = substr($origin, 0, strlen($origin) - strlen($file_ext)) . '_' . $i . $file_ext; $full_dest = $dest . $file_name; } if (move_uploaded_file($tmp_name, $full_dest)) { // change mode of the uploaded file $mode = Plugin::getSetting('filemode', 'file_manager'); chmod($full_dest, octdec($mode)); return $file_name; } return false; }
/** * Display tags on a page * * @since 1.4.0 * @param string booleon booleon */ public static function render($option = array()) { // Tag settings from database $tag_setting_type = Plugin::getSetting('tag_type', 'tagger'); $tag_setting_case = Plugin::getSetting('case', 'tagger'); // Tag display $tag_type = array_key_exists('type', $option) ? $option['type'] : $tag_setting_type; $tag_case = array_key_exists('case', $option) ? $option['case'] : $tag_setting_case; // Setting Sort order, Limit, Parent and Tagger page if selected $limit_set = array_key_exists('limit', $option) ? " LIMIT 0, {$option['limit']}" : NULL; $parent = array_key_exists('parent', $option) ? " AND page.parent_id = {$option['parent']}" : NULL; $tagger_page = array_key_exists('tagger_page', $option) ? $option['tagger_page'] : NULL; $tpl = array_key_exists('tagger_tpl', $option) ? $option['tagger_tpl'] : NULL; $order_by = array_key_exists('order_by', $option) && $option['order_by'] == 'count' ? ' ORDER BY count DESC' : NULL; $sql = 'SELECT name, count FROM ' . TABLE_PREFIX . 'tag AS tag, ' . TABLE_PREFIX . 'page AS page, ' . TABLE_PREFIX . 'page_tag AS page_tag' . ' WHERE tag.id = page_tag.tag_id AND page_tag.page_id = page.id AND page.status_id != ' . Page::STATUS_HIDDEN . ' AND' . ' page.status_id != ' . Page::STATUS_DRAFT . $parent . ' GROUP BY tag.id' . $order_by . $limit_set; $stmt = Record::getConnection()->prepare($sql); $stmt->execute(); // Putting Tags into a array while ($tag = $stmt->fetchObject()) { $tags[$tag->name] = $tag->count; } if (isset($tags)) { // Sort array uksort($tags, 'cmpVals'); switch ($tag_type) { case "cloud": $max_size = 28; // max font size in pixels $min_size = 10; // min font size in pixels // largest and smallest array values $max_qty = max(array_values($tags)); $min_qty = min(array_values($tags)); // find the range of values $spread = $max_qty - $min_qty; if ($spread == 0) { $spread = 1; } // set the font-size increment $step = ($max_size - $min_size) / $spread; if ($tpl) { eval('?>' . self::tpl($tpl)); } else { echo '<ul class="tagger">'; foreach ($tags as $key => $value) { // calculate font-size, find the $value in excess of $min_qty, multiply by the font-size increment ($size) and add the $min_size set above $size = round($min_size + ($value - $min_qty) * $step); $key_case = $tag_case == "1" ? ucfirst($key) : strtolower($key); $url = self::tag_url($tagger_page) . slugify($key) . URL_SUFFIX; echo sprintf('<li style="display: inline; border: none;"><a href="%s" style="display: inline; border: none; font-size: %spx; padding: 2px" title="%s things tagged with %s">%s</a></li>' . "\r\n", $url, $size, $value, $key, htmlspecialchars_decode($key_case)); } echo '</ul>'; } break; case "count": if ($tpl) { eval('?>' . self::tpl($tpl)); } else { echo '<ul class="tagger">'; foreach ($tags as $key => $value) { $key_case = $tag_case == "1" ? ucfirst($key) : strtolower($key); $url = self::tag_url($tagger_page) . slugify($key) . URL_SUFFIX; echo sprintf('<li><a href="%s" title="%s things tagged with %s">%s (%s)</a></li>', $url, $value, $key, htmlspecialchars_decode($key_case), $value); } echo '</ul>'; } break; default: if ($tpl) { eval('?>' . self::tpl($tpl)); } else { echo '<ul class="tagger">'; foreach ($tags as $key => $value) { $key_case = $tag_case == 1 ? ucfirst($key) : strtolower($key); $url = self::tag_url($tagger_page) . slugify($key) . URL_SUFFIX; echo sprintf('<li><a href="%s" title="%s things tagged with %s">%s</a></li>', $url, $value, $key, htmlspecialchars_decode($key_case)); } echo '</ul>'; } break; } } }
* Downloads Plugin for WolfCMS <http://www.wolfcms.org> * Copyright (C) 2011 Shannon Brooks <*****@*****.**> * * This file is part of Downloads Plugin. Downloads Plugin is licensed under the GNU GPLv3 license. * Please see license.txt for the full license text. */ // Security Measure if (!defined('IN_CMS')) { exit(); } ?> <p class="button"><a href="<?php echo get_url('plugin/downloads'); ?>"><img src="<?php echo PLUGINS_URI;?>/downloads/images/list.png" align="middle" /><?php echo __('List'); ?></a></p> <p class="button"><a href="<?php echo get_url('plugin/downloads/add'); ?>"><img src="<?php echo PLUGINS_URI;?>/downloads/images/new.png" align="middle" /><?php echo __('Add New'); ?></a></p> <p class="button"><a href="<?php echo get_url('plugin/downloads/documentation'); ?>"><img src="<?php echo PLUGINS_URI;?>/downloads/images/documentation.png" align="middle" /><?php echo __('Documentation'); ?></a></p> <div class="box"> <h2><?php echo __('Download Manager Plugin');?></h2> <p> <?php echo __('Plugin Version').': '.Plugin::getSetting('version', 'downloads'); ?> </p> <br /> <h2><?php echo __('Usage');?></h2> <p><strong>Single Download</strong><br /> <code><?php echo downloadLinkById($id,$linktext); ?><br /> <?php echo downloadBoxById($id); ?><br /> <?php echo downloadPlayerById($id,$text); ?></code></p> <p><strong>Multiple Downloads</strong><br /> <code><?php echo downloadListByTag($tags); ?><br /> <?php echo downloadBoxesByTag($tags); ?> <?php echo downloadBoxesAll(); ?></code></p> </div>
function registered_users_page_found($page) { $PDO = Record::getConnection(); // If login is required for the page if ($page->getLoginNeeded() == Page::LOGIN_REQUIRED) { AuthUser::load(); // Not Logged In if (!AuthUser::isLoggedIn()) { // Get the current page id $requested_page_id = $page->id(); // Let's get the page that is set as the login page to prevent any loopbacks $getloginpage = 'SELECT * FROM ' . TABLE_PREFIX . "page WHERE behavior_id='login_page'"; $getloginpage = $PDO->prepare($getloginpage); $getloginpage->execute(); while ($loginpage = $getloginpage->fetchObject()) { $slug = $loginpage->slug; print_r($loginpage); } if ($requested_page_id != $loginpage_id) { header('Location: ' . BASE_URL . $slug); } } else { // We need to check if the user has permission to access the page // Get requested page id $requested_page_id = $page->id(); // Get permissions that are required for this page $permissions_check = "SELECT * FROM " . TABLE_PREFIX . "permission_page WHERE page_id='{$requested_page_id}'"; $permissions_check = $PDO->prepare($permissions_check); $permissions_check->execute(); $permission_array = array(); while ($permission = $permissions_check->fetchObject()) { $page_permission = $permission->permission_id; array_push($permission_array, $page_permission); } $permissions_count = count($permission_array); AuthUser::load(); $userid = AuthUser::getRecord()->id; // Get permissions that this user has /* $user_permissions_check = "SELECT * FROM ".TABLE_PREFIX."user_permission WHERE user_id='$userid'"; $user_permissions_check = $__CMS_CONN__->prepare($user_permissions_check); $user_permissions_check->execute(); $user_permissions_array = array(); while ($user_permissions = $user_permissions_check->fetchObject()) { $user_permission = $user_permissions->permission_id; array_push($user_permissions_array, $user_permission); }*/ $roles = AuthUser::getRecord()->roles(); foreach ($roles as $role) { $user_permissions_array[] = $role->id; } $permission_result = array_intersect($permission_array, $user_permissions_array); $permission_result_count = count($permission_result); if ($permission_result_count < 1 && AuthUser::getId() != 1) { // Let's get the authorisation required page $auth_required_page = Plugin::getSetting("auth_required_page", "registered_users"); header('Location: ' . URL_PUBLIC . '' . $auth_required_page . ''); } } } }
?> </a></p> <div class="box"> <h2><?php echo __('Backup/Restore plugin'); ?> </h2> <p> <?php echo __('The Backup/Restore plugin allows you to create complete backups of the Wolf CMS core database.'); ?> <br /> </p> <p> <?php echo __('Version'); ?> - <?php echo BR_VERSION; ?> <br /> <?php echo __('Designed for Wolf version') . ' ' . Plugin::getSetting('wolfversion', 'backup_restore'); ?> <?php echo __('and upwards.') . '<br />'; ?> </p> </div>
* Project home * http://www.github.com/realslacker/Redirector-Plugin */ // security measure if (!defined('IN_CMS')) { exit(); } // include the Installer helper use_helper('Installer'); // only support MySQL $driver = Installer::getDriver(); if ( $driver != 'mysql' && $driver != 'sqlite' ) Installer::failInstall( 'redirector', __('Only MySQL and SQLite are supported!') ); // get plugin version $version = Plugin::getSetting('version', 'redirector'); switch ($version) { // no version found so we do a clean install default: // sanity check to make sure we are really dealing with a clean install if ($version !== false) Installer::failInstall( 'redirector', __('Unknown Version!') ); // make sure we aren't upgrading from a legacy version, if we are store legacy version for upgrade and fail install if ( Installer::$__CONN__->query('SELECT COUNT(*) FROM ' . TABLE_PREFIX . 'redirector_redirects') ) { $settings = array( 'version' => '0.2.1' ); if ( ! Plugin::setAllSettings($settings, 'redirector') ) Installer::failInstall( 'redirector', __('Unable to store legacy version!') );
<?php $version = Plugin::getSetting('version', 'ckeditor'); if (!$version || $version == null) { $upgrade = checkOld(); if ($upgrade) { $PDO = Record::getConnection(); $tablename = TABLE_PREFIX . 'ckeditor'; $sql_check = "SELECT COUNT(*) FROM {$tablename}"; $sql = "SELECT * FROM {$tablename}"; $result = $PDO->query($sql_check); if ($result && $result->fetchColumn() != 1) { $result->closeCursor(); Flash::set('error', __('ckeditor - upgrade needed, but invalid upgrade scenario detected!')); return; } if (!$result) { Flash::set('error', __('ckeditor - upgrade need detected earlier, but unable to retrieve table information!')); return; } $result = $PDO->query($sql); if ($result && ($row = $result->fetchObject())) { $settings = array('version' => '1.1', 'fileBrowserEnable' => $row->fileBrowserEnable, 'fileBrowserRootDir' => $row->fileBrowserRootDir, 'fileBrowserRootUri' => $row->fileBrowserRootUri, 'urlBrowserEnable' => $row->urlBrowserEnable, 'urlBrowserListHidden' => $row->urlBrowserListHidden, 'editorContentsCss' => $row->editorContentsCss, 'editorToolbarSet' => $row->editorToolbarSet); $result->closeCursor(); } else { Flash::set('error', __('ckeditor - upgrade needed, but unable to retrieve old settings!')); return; } } else { $defaultFileBrowserImagesdir = dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'images'; $settings = array('version' => '1.1', 'fileBrowserEnable' => 1, 'fileBrowserRootDir' => $defaultFileBrowserImagesdir, 'fileBrowserRootUri' => '/public/images', 'urlBrowserEnable' => 1, 'urlBrowserListHidden' => 0, 'editorContentsCss' => '', 'editorToolbarSet' => 'Full');
<?php /* * Banner Plugin for WolfCMS <http://www.wolfcms.org> * Copyright (C) 2011 Shannon Brooks <*****@*****.**> * * This file is part of Banner Plugin. Banner Plugin is licensed under the GNU GPLv3 license. * Please see license.txt for the full license text. */ // Security Measure if (!defined('IN_CMS')) { exit(); } ?> <p class="button"><a href="<?=get_url('plugin/banner'); ?>"><img src="<?php echo URL_PUBLIC; ?>wolf/plugins/banner/images/list.png" align="middle" /><?php echo __('List Banners'); ?></a></p> <p class="button"><a href="<?=get_url('plugin/banner/banner_add'); ?>"><img src="<?php echo URL_PUBLIC; ?>wolf/plugins/banner/images/new.png" align="middle" /><?php echo __('Add Banner'); ?></a></p> <p class="button"><a href="<?=get_url('plugin/banner/documentation'); ?>"><img src="<?php echo URL_PUBLIC; ?>wolf/plugins/banner/images/documentation.png" align="middle" /><?php echo __('Documentation'); ?></a></p> <div class="box"> <h2><?php echo __('Banners Plugin');?></h2> <p> <?php echo __('Plugin Version').': '.Plugin::getSetting('version', 'banner'); ?> </p> </div>
/** * Returns the current PageArchive object's url. * * Note: overrides the Page::url() method. * * @return string A fully qualified url. */ public function url($suffix = false) { $use_date = Plugin::getSetting('use_dates', 'archive'); if ($use_date === '1') { return BASE_URL . trim($this->parent()->path() . date('/Y/m/d/', strtotime($this->created_on)) . $this->slug, '/') . ($this->path() != '' ? URL_SUFFIX : ''); } elseif ($use_date === '0') { return BASE_URL . trim($this->parent()->path() . '/' . $this->slug, '/') . ($this->path() != '' ? URL_SUFFIX : ''); } }
<?php /* * Wolf CMS - Content Management Simplified. <http://www.wolfcms.org> * Copyright (C) 2009-2011 Martijn van der Kleijn <*****@*****.**> * * This file is part of Wolf CMS. Wolf CMS is licensed under the GNU GPLv3 license. * Please see license.txt for the full license text. */ /* Security measure */ if (!defined('IN_CMS')) { exit; } /** * The BackupRestore plugin provides administrators with the option of backing * up their pages and settings to an XML file. * * @package Plugins * @subpackage backup_restore * * @author Martijn van der Kleijn <*****@*****.**> * @copyright Martijn van der Kleijn, 2009-2011 * @license http://www.gnu.org/licenses/gpl.html GPLv3 license */ // Check if the plugin's settings already exist and create them if not. if (Plugin::getSetting('zip', 'backup_restore') === false) { // Store settings new style $settings = array('zip' => '1', 'pwd' => '1', 'default_pwd' => 'pswpsw123', 'stamp' => 'Ymd', 'extension' => 'xml', 'wolfversion' => '0.6.0'); Plugin::setAllSettings($settings, 'backup_restore'); }
function page_snippetslist_tab($page) { $view = Plugin::getSetting('ui', 'easysnippet'); echo new View(PLUGINS_ROOT . DS . 'easysnippet' . DS . 'views' . DS . $view, array('snippets' => grouped_snippets())); }
private function __upload($tagname,$filename,$overwrite=false) { // if there is no uploaded file return false if (!is_uploaded_file($_FILES[$tagname]['tmp_name'])) { $this->__log(__('error encountered uploading file').'; '.__('no file was uploaded'),self::LOG_ERROR); Flash::set('error',__('No file was uploaded!')); return false; } // if the uploaded file is not unique return false if (!$hash = $this->__unique($_FILES[$tagname]['tmp_name'])) { $this->__log(__('error encountered uploading file').'; '.__('the file was not unique; the file already exists'),self::LOG_ERROR ); Flash::set('error',__('the file was not unique; the file already exists') . print_r($_FILES,1) ); return false; } // determine the uploaded file extension $ext = strtolower(pathinfo($_FILES[$tagname]['name'],PATHINFO_EXTENSION)); // check to make sure uploaded filetype is ok $valid_exts = explode(',',Plugin::getSetting('filetypes','downloads')); if (!in_array($ext,$valid_exts)) { $this->__log(__('error encountered uploading file').'; '.__('file was not an allowed type'),self::LOG_ERROR); Flash::set('error',__('Uploaded file not an allowed file type.')); return false; } // setup the filename $filename = $this->__filename($filename,$ext); // determine the destination directory $dstdir = CMS_ROOT."/{$this->settings['download_path']}/"; // if overwrite isn't allowed check to see if file exists if (!$overwrite && file_exists($dstdir.$filename)) { $this->__log(__('error encountered uploading file').'; '.__('file already exists'),self::LOG_ERROR); Flash::set('error',__('file already exists')); return false; } // set the umask and move the uploaded file // if there is a problem set the error, put the old file back and set an error umask(octdec($this->settings['umask'])); if (!@move_uploaded_file($_FILES[$tagname]['tmp_name'],$dstdir.$filename)) { $this->__log(__('error encountered uploading file').'; '.__('could not move uploaded file'),self::LOG_ERROR); Flash::set('error',__('Could not move uploaded file!')); return false; } // check to see if the file was uploaded and try to chmod the file // if there is a problem with chmod output an error but don't stop since the // file was already uploaded if (@!chmod($dstdir.$filename, octdec($this->settings['filemode']))) { $this->__log(__('error encountered uploading file').'; '.__('unable to change permissions'),self::LOG_WARNING); flash::set('error', __('File uploaded, however file permissions could not be changed.')); } // return the image name $this->__log(__('uploaded file').' - '.$filename); return array('filename'=>$filename,'hash'=>$hash); }//*/
* You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * The TinyMCE plugin provides the TinyMCE editor to Wolf CMS users. * * @package wolf * @subpackage plugin.tinymce * * @author Martijn van der Kleijn <*****@*****.**> * @version 3.0.0 * @since Wolf version 0.5.5 * @license http://www.gnu.org/licenses/gpl.html GPL License * @copyright Martijn van der Kleijn, 2008,2009 */ $version = Plugin::getSetting('version', 'tinymce'); // Check if settings were found for tinymce if (!$version || $version == null) { // Check if we're upgrading from a previous version. $upgrade = checkForOldInstall(); // Upgrading from previous installation if ($upgrade) { // Retrieve the old settings. $PDO = Record::getConnection(); $tablename = TABLE_PREFIX . 'tinymce'; $sql_check = "SELECT COUNT(*) FROM {$tablename}"; $sql = "SELECT * FROM {$tablename}"; $result = $PDO->query($sql_check); // Checking if old tinymce table is OK if ($result && $result->fetchColumn() != 1) { $result->closeCursor();
<?php /* * Downloads Plugin for WolfCMS <http://www.wolfcms.org> * Copyright (C) 2011 Shannon Brooks <*****@*****.**> * * This file is part of Downloads Plugin. Downloads Plugin is licensed under the GNU GPLv3 license. * Please see license.txt for the full license text. */ // Security Measure if (!defined('IN_CMS')) { exit(); } $allowed_filetypes = str_replace(',',', ',Plugin::getSetting('filetypes','downloads')); ?> <h1><?php echo isset($id) ? __('Edit Download') . " (#$id): $name" : __('New Download');?></h1> <form method="post" enctype="multipart/form-data" action="<?php echo isset($id) ? get_url('plugin/downloads/update/'.$id) : get_url('plugin/downloads/create'); ?>"> <fieldset style="padding: 0.5em;"> <legend style="padding: 0em 0.5em 0em 0.5em; font-weight: bold;"><?php echo __('File'); ?></legend> <?php if (isset($id)) echo "<a href=\"/download-file/{$id}/{$filename}\" target=\"_blank\">{$filename}</a>"; ?><br /> <table class="fieldset" cellpadding="0" cellspacing="0" border="0"> <tr> <td class="label"><label for="download"><?php echo __('Download:');?> </label></td> <td class="field"><input name="download" id="download" type="file" /></td> <td class="help"><?php echo __('Allowed filetypes').': '.$allowed_filetypes; ?></td> </tr> </table> </fieldset> <br /> <fieldset style="padding: 0.5em;"> <legend style="padding: 0em 0.5em 0em 0.5em; font-weight: bold;"><?php echo __('Information'); ?></legend>
/** * Displays a captcha when required by the settings. * * @return none Nothing. */ function captcha() { // Initialize proper defaults $data = null; $captcha = 1; $approve = 0; // Check if comment is available if (isset($_POST['comment'])) { $data = $_POST['comment']; if (is_null($data)) { return; } } // Get settings $captcha = Plugin::getSetting('use_captcha', 'comment'); $approve = Plugin::getSetting('auto_approve_comment', 'comment'); // Display captcha if required if ($captcha && $captcha == '1') { if ($data && ($data['secure'] != $_SESSION['security_number'] && !empty($data['secure']))) { echo '<p class="comment-captcha-error">' . __('Incorrect result value. Please try again:') . '</p>'; } else { echo '<p>' . __('Please insert the result of the arithmetical operation from the following image:') . '</p>'; } echo '<img id="comment-captcha" src="' . URL_PUBLIC . 'wolf/plugins/comment/image.php" alt="' . __('Please insert the result of the arithmetical operation from this image.') . '" />'; echo ' = <input id="comment-captcha-answer" class="input" type="text" name="comment[secure]" />'; } // Add a field with user's IP address. $ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; echo '<input type="hidden" value="' . $ip . '" name="comment[author_ip]" />'; // Display results if (isset($_POST['commit-comment'])) { if ($captcha && $captcha != '1' || $data['secure'] == $_SESSION['security_number']) { if ($approve && $approve == '1') { echo '<p class="comment-captcha-success">' . __('Thank you for your comment. It has been added.') . '</p>'; } else { echo '<p class="comment-captcha-success">' . __('Thank you for your comment. It is waiting for approval.') . '</p>'; } } } }
function banner_catch_json_request($args) { // check for banner json request if (preg_match('#^/banner-json-request/(\d+)x(\d+)$#i',$args,$matches)) { $width = (int)$matches[1]; $height = (int)$matches[2]; $imguri = Plugin::getSetting('imguri','banner'); $cssclass = Plugin::getSetting('cssclass','banner'); if (!$banner = Banner::findBySize($width,$height)) { echo json_encode(array('error'=>'could not find banner')); exit; } $banner->dcount++; $banner->updated = date('Y-m-d H:i:s'); $banner->save(); $banner->image = "/{$imguri}/{$banner->image}"; echo json_encode((array)$banner); exit; } // no click so keep going return $args; }
?> "><img src="<?php echo URL_PUBLIC . CORE_FOLDER; ?> /plugins/tinymce/images/settings.png" align="middle" /><?php echo __('Settings'); ?> </a></p> <div class="box"> <h2><?php echo __('TinyMCE Editor plugin'); ?> </h2> <p> <?php echo __('Plugin') . ': ' . Plugin::getSetting('version', 'tinymce'); ?> <br/> TinyMCE: v3.3.4 (2010-04-27) </p> <p> The TinyMCE editor plugin consists of a stock (unchanged) version of TinyMCE, except for the addition of the codeprotect plugin, packaged with a number of supporting files. </p> <p> This allows TinyMCE to be used or updated quickly in an easy manner for Fresh CMS users without needing to change TinyMCE itself. </p> <p> <a href="http://freshcms.jules.it/plugins/tinymce.html">Fresh CMS TinyMCE plugin</a><br/> <a href="http://tinymce.moxiecode.com/">TinyMCE Homepage</a> </p>
echo __('Modify'); ?> </div> </div> <?php global $__CMS_CONN__; $sql = "SELECT COUNT(*) FROM " . TABLE_PREFIX . "comment WHERE is_approved = 1"; $stmt = $__CMS_CONN__->query($sql); $comments_count = $stmt->fetchColumn(); $stmt->closeCursor(); if (isset($page)) { $CurPage = $page; } else { $CurPage = 0; } $rowspage = Plugin::getSetting('rowspage', 'comment'); $start = $CurPage * $rowspage; $totalrecords = $comments_count; $sql = "SELECT comment.is_approved, comment.id, comment.page_id, comment.author_name, comment.author_email, comment.author_link, comment.body, comment.created_on, page.title FROM " . TABLE_PREFIX . "comment AS comment, " . TABLE_PREFIX . "page AS page WHERE comment.is_approved = 1 AND comment.page_id = page.id ORDER BY comment.created_on DESC LIMIT " . $rowspage . " OFFSET " . $start; $stmt = $__CMS_CONN__->prepare($sql); $stmt->execute(); $lastpage = ceil($totalrecords / $rowspage); if ($comments_count <= $rowspage) { $lastpage = 0; } else { $lastpage = abs($lastpage - 1); } if ($comments_count > 0) { ?> <ol id="comments"> <?php
* Copyright (C) 2011 Shannon Brooks <*****@*****.**> * * This file is part of Banner Plugin. Banner Plugin is licensed under the GNU GPLv3 license. * Please see license.txt for the full license text. */ // Security Measure if (!defined('IN_CMS')) { exit(); } ?> <h1><?=isset($id) ? __('Edit Banner') . " #{$id}: {$name} ({$width}x{$height})" : __('New Banner');?></h1> <form method="post" enctype="multipart/form-data" action="<?=isset($id) ? get_url('plugin/banner/banner_update/'.$id) : get_url('plugin/banner/banner_new'); ?>"> <fieldset style="padding: 0.5em;"> <legend style="padding: 0em 0.5em 0em 0.5em; font-weight: bold;"><?php echo __('Banner Image'); ?></legend> <? if (isset($id)) : ?> <img src="<?=URI_PUBLIC.Plugin::getSetting('imguri','banner').'/'.$image;?>" alt="<?=$alttext;?>" width="<?=$width;?>" height="<?=$height;?>" /><br /> <? else : ?> <table class="fieldset" cellpadding="0" cellspacing="0" border="0"> <tr> <td class="label"><label for="banner"><?php echo __('Banner Image:');?> </label></td> <td class="field"><input name="banner" id="banner" type="file" /></td> <td class="help"><?php echo __('Only jpg, png and gif files are accepted'); ?></td> </tr> </table> <? endif; ?> </fieldset> <br /> <fieldset style="padding: 0.5em;"> <legend style="padding: 0em 0.5em 0em 0.5em; font-weight: bold;"><?php echo __('Banner Information'); ?></legend> <table class="fieldset" cellpadding="0" cellspacing="0" border="0"> <tr>
function password_reset() { if ($_SERVER['REQUEST_METHOD'] == 'POST') { $email = trim($_POST['email']); $reset_no_email = Plugin::getSetting('reset_no_email', "registered_users"); if (empty($_POST['email'])) { echo $reset_no_email; } else { $common = new RUCommon(); $common->resetpassword($email); } } else { $reset_form = new View('../../plugins/registered_users/views/reset'); $reset_page = Plugin::getSetting('reset_page', "registered_users"); $reset_text = Plugin::getSetting('reset_text', "registered_users"); echo $reset_text; echo '<form action="' . URL_PUBLIC . '' . $reset_page . '' . URL_SUFFIX . '" method="post">'; echo $reset_form; echo '</form>'; } }
function funky_cache_folder() { $folder = '/' . Plugin::getSetting('funky_cache_folder', 'funky_cache') . '/'; $folder = preg_replace('#//*#', '/', $folder); return $folder; }
?> /images/settings.png" align="middle" alt="settings icon" /> <?php echo __('Settings'); ?> </a></p> <div class="box"> <h2><?php echo __('Backup/Restore plugin'); ?> </h2> <p> <?php echo __('The Backup/Restore plugin allows you to create complete backups of the Fresh CMS core database.'); ?> <br /> </p> <p> <?php echo __('Version'); ?> - <?php echo BR_VERSION; ?> <br /> <?php echo __('Designed for Fresh CMS version') . ' ' . Plugin::getSetting('cmsversion', 'backup_restore'); ?> <br /> </p> </div>
protected function setUrl() { $use_date = Plugin::getSetting('use_dates', 'archive'); if ($use_date === '1') { $this->url = trim($this->parent->url . date('/Y/m/d/', strtotime($this->created_on)) . $this->slug, '/'); } elseif ($use_date === '0') { $this->url = trim($this->parent->url . '/' . $this->slug, '/'); } }
* Facts Plugin for WolfCMS <http://www.wolfcms.org> * Copyright (C) 2011 Shannon Brooks <*****@*****.**> */ // security measure if (!defined('IN_CMS')) { exit(); } // include the Installer helper use_helper('Installer'); // only support MySQL $driver = Installer::getDriver(); if ( $driver != 'mysql' ) Installer::failInstall( 'facts', __('Only MySQL is supported!') ); // get plugin version $version = Plugin::getSetting('version', 'facts'); switch ($version) { // no version found so we do a clean install default: // sanity check to make sure we are really dealing with a clean install if ($version !== false) Installer::failInstall( 'facts', __('Unknown Version!') ); // create tables $facts_table = TABLE_PREFIX . 'facts'; $facts_table_sql =<<<SQL CREATE TABLE IF NOT EXISTS {$facts_table} ( `id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
function validateaccount($email, $rand_key_confirm) { $rand_key = $rand_key_confirm; $PDO = Record::getConnection(); $check_validated = "SELECT * FROM " . TABLE_PREFIX . "user WHERE email='{$email}'"; $result = $PDO->prepare($check_validated); $result->execute(); $count = $result->rowCount(); if ($count > 0) { $settings = Plugin::getAllSettings("registered_users"); $met = $settings["message_error_technical"]; $message_empty_name = $settings["message_empty_name"]; $message_empty_email = $settings["message_empty_email"]; $message_empty_username = $settings["message_empty_username"]; $message_empty_password = $settings["message_empty_password"]; $message_empty_password_confirm = $settings["message_empty_password_confirm"]; $message_notvalid_password = $settings["message_notvalid_password"]; $message_notvalid_username = $settings["message_notvalid_username"]; $message_notvalid_email = $settings["message_notvalid_email"]; $message_error_already_validated = $settings["message_error_already_validated"]; echo $message_error_already_validated; } else { $today = date('Y-m-d G:i:s'); $registration_temp = "SELECT * FROM " . TABLE_PREFIX . "registered_users_temp WHERE email='{$email}'"; foreach ($PDO->query($registration_temp) as $row) { $name = $row['name']; $email = $row['email']; $username = $row['username']; $password = $row['password']; $rand_key = $row['rand_key']; $reg_date = $row['reg_date']; $welcome_message = $row['welcome_message']; $message_notvalid_password = $row['message_notvalid_password']; } if ($rand_key_confirm == $rand_key) { // Let's transfer the user from the temp table to the user table //$update_user_table = "INSERT INTO ".TABLE_PREFIX."user (`id`,`name`,`email`,`username`,`password`,`created_on`,`updated_on`,`created_by_id`,`updated_by_id`) VALUES ('','$name','$email','$username','$password','$reg_date','$today','','');"; //$stmt = $__CMS_CONN__->prepare($update_user_table); //$stmt->execute(); $user = new User(); $user->name = $name; $user->email = $email; $user->username = $username; $user->salt = AuthUser::generateSalt(); $user->password = AuthUser::generateHashedPassword($password, $user->salt); $user->created_on = $reg_date; $user->updated_on = $today; $user->save(); // We don't need them in the temp table anymore $delete_temp_user = "******" . TABLE_PREFIX . "registered_users_temp WHERE email='{$email}'"; $stmt = $PDO->prepare($delete_temp_user); $stmt->execute(); // And let's make sure we have some permissions set so that user can then do something! // First we need the default permssion ID $def_permission = Plugin::getSetting("default_permissions", "registered_users"); // Then we need the correct user ID /*$user = "******".TABLE_PREFIX."user WHERE email='$email'"; foreach ($__CMS_CONN__->query($user) as $row) { $id = $row['id']; }*/ $id = $user->id; $set_permissions = "INSERT INTO " . TABLE_PREFIX . "user_role (`user_id`,`role_id`) VALUES ('{$id}','{$permission_id}');"; $stmt = $PDO->prepare($set_permissions); $stmt->execute(); // We also need to add the profile settings into DB $addprofile = "INSERT INTO " . TABLE_PREFIX . "user_profile (`id`,`firstlogin`,`subscribe`,`sysnotifications`,`haspic`,`profile_blurb`) VALUES ({$id},'1','1','1','0','your public profile...');"; $addprofile = $PDO->prepare($addprofile); $addprofile->execute(); echo $welcome_message; $loadloginclass = new RegisteredUser(); $loadloginclass->login_page(); } else { echo $message_notvalid_password; } } }
function replaceContentByUri($page) { $source = Plugin::getSetting('langsource', 'multi_lang'); if (!$source) { return; } global $urilang; if ($source == 'uri' && $urilang !== false) { if (isset($page->part->{$urilang}) && !empty($page->part->{$urilang}->content_html) && $page->part->{$urilang}->content_html != '') { $page->part->body->content_html = $page->part->{$urilang}->content_html; } } }