/** * Execute function * * @return void */ public function execute() { // Is component on? if (!$this->config->get('component_on', 0)) { App::redirect('/'); return; } // Publishing enabled? $this->_publishing = Plugin::isEnabled('projects', 'publications') ? 1 : 0; // Setup complete? $this->_setupComplete = $this->config->get('confirm_step', 0) ? 3 : 2; // Include scripts $this->_includeScripts(); // Incoming project identifier $id = Request::getInt('id', 0); $alias = Request::getVar('alias', ''); $this->_identifier = $id ? $id : $alias; // Incoming $this->_task = strtolower(Request::getWord('task', '')); $this->_gid = Request::getVar('gid', 0); // Model $this->model = new Models\Project($this->_identifier); // Execute the task parent::execute(); }
public function browse() { $this->_checkPermission(); $params = func_get_args(); $this->path = join('/', $params); // make sure there's a / at the end if (substr($this->path, -1, 1) != '/') { $this->path .= '/'; } //security // we dont allow back link if (strpos($this->path, '..') !== false) { if (Plugin::isEnabled('statistics_api')) { $user = null; if (AuthUser::isLoggedIn()) { $user = AuthUser::getUserName(); } $ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; $event = array('event_type' => 'hack_attempt', 'description' => __('A possible hack attempt was detected.'), 'ipaddress' => $ip, 'username' => $user); Observer::notify('stats_file_manager_hack_attempt', $event); } } $this->fullpath = FILES_DIR . '/sidebarlink/images/'; // clean up nicely $this->fullpath = preg_replace('/\\/\\//', '/', $this->fullpath); $this->display('sidebarlink/index', array('dir' => $this->path, 'files' => $this->_getListFiles(), 'sidebarlinks' => Record::findAllFrom('SidebarLink', '1=1 ORDER BY id desc'), 'pages' => Record::findAllFrom('Page', 'parent_id=1 OR parent_id=0 order by parent_id,position'))); }
/** * Executes a task * * @return void */ public function execute() { // Publishing enabled? $this->_publishing = Plugin::isEnabled('projects', 'publications') ? 1 : 0; // Include scripts $this->_includeScripts(); parent::execute(); }
/** * Checks if a plugin is enabled. * * @param string $type The plugin type, relates to the sub-directory in the plugins directory. * @param string $plugin The plugin name. * * @return boolean * * @since 11.1 */ public static function isEnabled($type, $plugin = null) { // [!] Hubzero if (class_exists('\\Plugin')) { return \Plugin::isEnabled($type, $plugin); } $result = self::getPlugin($type, $plugin); return !empty($result); }
/** * Compute and log overall projects usage stats * * @param object $job \Components\Cron\Models\Job * @return boolean */ public function computeStats(\Components\Cron\Models\Job $job) { $database = App::get('db'); $publishing = Plugin::isEnabled('projects', 'publications') ? 1 : 0; require_once PATH_CORE . DS . 'components' . DS . 'com_projects' . DS . 'models' . DS . 'project.php'; require_once PATH_CORE . DS . 'components' . DS . 'com_projects' . DS . 'tables' . DS . 'stats.php'; if ($publishing) { require_once PATH_CORE . DS . 'components' . DS . 'com_publications' . DS . 'tables' . DS . 'publication.php'; require_once PATH_CORE . DS . 'components' . DS . 'com_publications' . DS . 'tables' . DS . 'version.php'; } $tblStats = new \Components\Projects\Tables\Stats($database); $model = new \Components\Projects\Models\Project(); // Compute and store stats $stats = $tblStats->getStats($model, true, $publishing); return true; }
public function browse() { $this->_checkPermission(); $params = func_get_args(); $this->path = join('/', $params); // make sure there's a / at the end if (substr($this->path, -1, 1) != '/') { $this->path .= '/'; } //security // we dont allow back link if (strpos($this->path, '..') !== false) { if (Plugin::isEnabled('statistics_api')) { $user = null; if (AuthUser::isLoggedIn()) { $user = AuthUser::getUserName(); } $ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; $event = array('event_type' => 'hack_attempt', 'description' => __('A possible hack attempt was detected.'), 'ipaddress' => $ip, 'username' => $user); Observer::notify('stats_file_manager_hack_attempt', $event); } } $this->display('testimonial/index', array('testimonials' => Record::query('select * from ' . TABLE_PREFIX . 'testimonial ORDER BY ' . TABLE_PREFIX . 'testimonial.sequence, ' . TABLE_PREFIX . 'testimonial.id desc'), 'pages' => Record::findAllFrom('Page', 'parent_id=1 order by parent_id,position'))); }
public function browse() { $this->_checkPermission(); $params = func_get_args(); $this->path = join('/', $params); // make sure there's a / at the end if (substr($this->path, -1, 1) != '/') { $this->path .= '/'; } //security // we dont allow back link if (strpos($this->path, '..') !== false) { if (Plugin::isEnabled('statistics_api')) { $user = null; if (AuthUser::isLoggedIn()) { $user = AuthUser::getUserName(); } $ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; $event = array('event_type' => 'hack_attempt', 'description' => __('A possible hack attempt was detected.'), 'ipaddress' => $ip, 'username' => $user); Observer::notify('stats_file_manager_hack_attempt', $event); } } $this->fullpath = FILES_DIR . '/themes/promo/images/'; // clean up nicely $this->fullpath = preg_replace('/\\/\\//', '/', $this->fullpath); $newss = Record::query('select * from ' . TABLE_PREFIX . 'news ORDER BY type, sequence asc, id desc'); $this->display('news/index', array('dir' => $this->path, 'files' => $this->_getListFiles(), 'newss' => $newss)); }
* @package Plugins * @subpackage shopping-cart * * @author Stefan Miller <*****@*****.**> * Copyright (C) 2014 Stefan Miller <*****@*****.**> * @license http://www.gnu.org/licenses/gpl.html GPLv3 license * */ /* Security measure */ if (!defined('IN_CMS')) { exit; } /** * Root location where Files plugin lives. */ define('SC_FILES_ROOT', PATH_PUBLIC . 'wolf/plugins/shopping_cart'); /** * Root location where files get uploaded to as an absolute path. */ define('SC_FILES_DIR', CMS_ROOT . DS . 'public'); /** * Root location where files get uploaded to as a URL. */ define('BASE_SC_FILES_DIR', URL_PUBLIC . 'public'); // DO NOT EDIT AFTER THIS LINE ----------------------------------------------- Plugin::setInfos(array('id' => 'shopping_cart', 'title' => 'Shopping Cart', 'description' => 'A shopping cart inventory administration module', 'version' => '0.0.1', 'author' => 'Stefan Miller', 'website' => 'http://www.artisticdigital.com', 'require_wolf_version' => '0.7.0')); Plugin::addController('shopping_cart', __('Shopping Cart'), 'admin_view', true); // Make sure possible hack attempts get registered if the statistics API is available. if (Plugin::isEnabled('statistics_api')) { Observer::observe('stats_shopping_cart_hack_attempt', 'StatisticsEvent::registerEvent'); }
?> <button value="<?php echo $snippet[$sel_inc]->id; ?> "><?php echo sprintf('%s', $snippet[$sel_inc]->name); ?> </button> <?php } } } else { ?> <p><?php echo __('There are no snippets found'); ?> </p> <?php } ?> </div> </div> <script type="text/javascript" charset="utf-8"> $(Easysnippet('buttons', <?php echo Plugin::isEnabled('shortcut') ? '["[!", "!]"]' : 'null'; ?> )); </script>
/** Get a list of available modules with the given base class @param $base_class string class name @param $include_base whether base class should be included in the return value @return an array of class names */ public static function listModules($base_class, $include_base = False) { $ret = array(); // lookup plugin modules, then standard modules $map = Plugin::pluginMap(); switch ($base_class) { case 'DiscountType': $path = realpath(dirname(__FILE__) . '/Scanning/DiscountTypes'); $map = Plugin::pluginMap($path, $map); break; case 'FooterBox': $path = realpath(dirname(__FILE__) . '/FooterBoxes'); $map = Plugin::pluginMap($path, $map); break; case 'Kicker': $path = realpath(dirname(__FILE__) . '/Kickers'); $map = Plugin::pluginMap($path, $map); break; case 'Parser': $path = realpath(dirname(__FILE__) . '/../parser-class-lib/parse'); $map = Plugin::pluginMap($path, $map); break; case 'PreParser': $path = realpath(dirname(__FILE__) . '/../parser-class-lib/preparse'); $map = Plugin::pluginMap($path, $map); break; case 'PriceMethod': $path = realpath(dirname(__FILE__) . '/Scanning/PriceMethods'); $map = Plugin::pluginMap($path, $map); break; case 'SpecialUPC': $path = realpath(dirname(__FILE__) . '/Scanning/SpecialUPCs'); $map = Plugin::pluginMap($path, $map); break; case 'SpecialDept': $path = realpath(dirname(__FILE__) . '/Scanning/SpecialDepts'); $map = Plugin::pluginMap($path, $map); break; case 'TenderModule': $path = realpath(dirname(__FILE__) . '/Tenders'); $map = Plugin::pluginMap($path, $map); break; case 'TenderReport': $path = realpath(dirname(__FILE__) . '/ReceiptBuilding/TenderReports'); $map = Plugin::pluginMap($path, $map); break; case 'DefaultReceiptDataFetch': $path = realpath(dirname(__FILE__) . '/ReceiptBuilding/ReceiptDataFetch'); $map = Plugin::pluginMap($path, $map); break; case 'DefaultReceiptFilter': $path = realpath(dirname(__FILE__) . '/ReceiptBuilding/ReceiptFilter'); $map = Plugin::pluginMap($path, $map); break; case 'DefaultReceiptSort': $path = realpath(dirname(__FILE__) . '/ReceiptBuilding/ReceiptSort'); $map = Plugin::pluginMap($path, $map); break; case 'DefaultReceiptTag': $path = realpath(dirname(__FILE__) . '/ReceiptBuilding/ReceiptTag'); $map = Plugin::pluginMap($path, $map); break; case 'DefaultReceiptSavings': $path = realpath(dirname(__FILE__) . '/ReceiptBuilding/ReceiptSavings'); $map = Plugin::pluginMap($path, $map); break; case 'ReceiptMessage': $path = realpath(dirname(__FILE__) . '/ReceiptBuilding/Messages'); $map = Plugin::pluginMap($path, $map); break; case 'CustomerReceiptMessage': $path = realpath(dirname(__FILE__) . '/ReceiptBuilding/custMessages'); $map = Plugin::pluginMap($path, $map); break; case 'ProductSearch': $path = realpath(dirname(__FILE__) . '/Search/Products'); $map = Plugin::pluginMap($path, $map); break; case 'DiscountModule': $map['DiscountModule'] = realpath(dirname(__FILE__) . '/DiscountModule.php'); break; case 'MemberLookup': $map['MemberLookup'] = realpath(dirname(__FILE__) . '/MemberLookup.php'); break; case 'PrintHandler': $path = realpath(dirname(__FILE__) . '/PrintHandlers'); $map = Plugin::pluginMap($path, $map); break; case 'BasicModel': $path = realpath(dirname(__FILE__) . '/models'); $map = Plugin::pluginMap($path, $map); break; case 'TotalAction': $path = realpath(dirname(__FILE__) . '/TotalActions'); $map = Plugin::pluginMap($path, $map); break; case 'VariableWeightReWrite': $path = realpath(dirname(__FILE__) . '/Scanning/VariableWeightReWrites'); $map = Plugin::pluginMap($path, $map); break; case 'ItemNotFound': $map['ItemNotFound'] = realpath(dirname(__FILE__) . '/ItemNotFound.php'); break; } foreach ($map as $name => $file) { // matched base class if ($name === $base_class) { if ($include_base) { $ret[] = $name; } continue; } ob_start(); if (!class_exists($name)) { ob_end_clean(); continue; } if (strstr($file, 'plugins')) { $parent = Plugin::memberOf($file); if ($parent && Plugin::isEnabled($parent) && is_subclass_of($name, $base_class)) { $ret[] = $name; } else { if ($base_class == "Plugin" && is_subclass_of($name, $base_class)) { $ret[] = $name; } } } else { if (is_subclass_of($name, $base_class)) { $ret[] = $name; } } ob_end_clean(); } return $ret; }
<span style="color:#c00;"><?php echo Lang::txt('COM_MEMBERS_FIELD_EMAIL_NONE_ON_FILE'); ?> </span><br /> <input type="checkbox" name="activation" id="activation" value="1" /> <label for="activation"><?php echo Lang::txt('COM_MEMBERS_FIELD_EMAIL_CONFIRM'); ?> </label> <?php } ?> </div> <?php if ($this->profile->get('id') && Plugin::isEnabled('system', 'spamjail')) { ?> <div class="input-wrap" data-hint="<?php echo Lang::txt('COM_MEMBERS_SPAM_COUNT_HINT'); ?> "> <label id="field_approved-lbl" for="field-reputation"><?php echo Lang::txt('COM_MEMBERS_SPAM_COUNT'); ?> </label> <div class="input-modal"> <span class="input-cell"> <input type="text" name="spam_count" id="field-reputation" value="<?php echo $this->escape($this->profile->reputation->get('spam_count', 0)); ?> " />
public function view() { $params = func_get_args(); $content = ''; $filename = urldecode(join('/', $params)); // Sanitize filename for securtiy // We don't allow backlinks if (strpos($filename, '..') !== false) { if (Plugin::isEnabled('statistics_api')) { $user = null; if (AuthUser::isLoggedIn()) { $user = AuthUser::getUserName(); } $ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; $event = array('event_type' => 'hack_attempt', 'description' => __('A possible hack attempt was detected.'), 'ipaddress' => $ip, 'username' => $user); Observer::notify('stats_file_manager_hack_attempt', $event); } } $filename = str_replace('..', '', $filename); // Clean up nicely $filename = str_replace('//', '', $filename); // We don't allow leading slashes $filename = preg_replace('/^\\//', '', $filename); $file = FILES_DIR . '/' . $filename; if (!$this->_isImage($file) && file_exists($file)) { $content = file_get_contents($file); } $this->display('file_manager/views/view', array('is_image' => $this->_isImage($file), 'filename' => $filename, 'content' => $content)); }
/** * Determines if the plugin for Redirect to work is enabled. * * @return boolean */ public static function isEnabled() { return \Plugin::isEnabled('system', 'redirect'); }
/* | pawFramework | @file ./index.php | @author svanlaere | @version 1.0.0 [1.0.0] - Stable | | @license X11 / MIT License | @copyright Copyright © 2015 pytesNET */ if (!defined("IN_CMS")) { exit; } // SET PLUGIN INFOS Plugin::setInfos(array("id" => "themer", "title" => "Themer", "description" => __("A WordPress AdminTheme configuration plugin."), "version" => "1.0.0", "license" => "GPL", "author" => "svanlaere", "website" => "http://www.wolfcms.org/forum/", "require_wolf_version" => "0.7.5", "type" => "backend")); Plugin::addController("themer", __("Wordpress admin theme"), "admin_view", false); if (Plugin::isEnabled("themer")) { if (!defined("THEMER")) { define("THEMER", PLUGINS_ROOT . "/themer"); } if (!defined("THEMER_VIEW")) { define("THEMER_VIEW", "themer/views/"); } function themer_customize_admin_theme($path) { $admin_theme = Setting::get("theme"); $settings = Plugin::getAllSettings("themer"); if ($admin_theme == "wordpress-3.8") { echo new View(THEMER . DS . "views" . DS . "head", array("color" => $settings["color"], "sidebar_width" => $settings["sidebar_width"])); } return $path; }
Plugin::setInfos(array( 'id' => 'redirector', 'title' => 'Redirector', 'description' => 'Provides an interface to manage redirects.', 'version' => '0.2.5', 'website' => 'http://www.github.com/realslacker/Redirector-Plugin', 'update_url' => 'http://www.brooksworks.com/plugin-versions.xml' )); // setup observers Behavior::add('page_not_found', ''); Observer::observe('page_requested', 'redirector_catch_redirect'); // allow Redirector to observe the "page_not_found" event before the "page_not_found" plugin if (Plugin::isEnabled('page_not_found')) { Observer::stopObserving('page_not_found', 'behavior_page_not_found'); Observer::observe('page_not_found', 'redirector_log_404'); Observer::observe('page_not_found', 'behavior_page_not_found'); } else { Observer::observe('page_not_found', 'redirector_log_404'); } // load plugin classes into the system AutoLoader::addFolder(dirname(__FILE__) . '/models'); // add the plugin's tab and controller Plugin::addController('redirector', __('Redirector'),'redirector_view,redirector_new,redirector_edit,redirector_delete,redirector_settings'); // redirect urls already configured
/** * Executed through the Observer system each time a page is found. * * @global <type> $__CMS_CONN__ * @param Page $page The object instance for the page that was found. * @return <type> Nothing. */ function comment_save(&$page) { // Check if we need to save a comment if (!isset($_POST['comment'])) { return; } $data = $_POST['comment']; if (is_null($data)) { return; } $captcha = Plugin::getSetting('use_captcha', 'comment'); if ($captcha && $captcha == '1') { if (isset($data['secure'])) { if ($data['secure'] == "" or empty($data['secure']) or $data['secure'] != $_SESSION['security_number']) { return; } } else { return; } } if ($page->comment_status != Comment::OPEN) { return; } if (!isset($data['author_name']) or trim($data['author_name']) == '') { return; } if (!isset($data['author_email']) or trim($data['author_email']) == '') { return; } if (!preg_match('/[^\\x00-\\x20()<>@,;:\\".[\\]\\x7f-\\xff]+(?:\\.[^\\x00-\\x20()<>@,;:\\".[\\]\\x7f-\\xff]+)*\\@[^\\x00-\\x20()<>@,;:\\".[\\]\\x7f-\\xff]+(?:\\.[^\\x00-\\x20()<>@,;:\\".[\\]\\x7f-\\xff]+)+/i', $data['author_email'])) { return; } if (!isset($data['body']) or trim($data['body']) == '') { return; } use_helper('Kses'); $allowed_tags = array('a' => array('href' => array(), 'title' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'b' => array(), 'blockquote' => array('cite' => array()), 'br' => array(), 'code' => array(), 'em' => array(), 'i' => array(), 'p' => array(), 'strike' => array(), 'strong' => array()); $auto_approve_comment = Plugin::getSetting('auto_approve_comment', 'comment'); // Check for and correct problems with website link if (isset($data['author_link']) && $data['author_link'] !== '') { if (strpos($data['author_link'], 'http://') !== 0 && strpos($data['author_link'], 'https://') !== 0) { $data['author_link'] = 'http://' . $data['author_link']; } } global $__CMS_CONN__; $sql = 'INSERT INTO ' . TABLE_PREFIX . 'comment (page_id, author_name, author_email, author_link, ip, body, is_approved, created_on) VALUES (' . '\'' . $page->id . '\', ' . $__CMS_CONN__->quote(strip_tags($data['author_name'])) . ', ' . $__CMS_CONN__->quote(strip_tags($data['author_email'])) . ', ' . $__CMS_CONN__->quote(strip_tags($data['author_link'])) . ', ' . $__CMS_CONN__->quote($data['author_ip']) . ', ' . $__CMS_CONN__->quote(kses($data['body'], $allowed_tags)) . ', ' . $__CMS_CONN__->quote($auto_approve_comment) . ', ' . $__CMS_CONN__->quote(date('Y-m-d H:i:s')) . ')'; $__CMS_CONN__->exec($sql); // @todo FIXME - If code above used Comment object for saving data there would be // no need to reload it from database. Using lastInsertId() is unrealiable anyway. $comment_id = Record::lastInsertId(); $comment = Comment::findById($comment_id); Observer::notify('comment_after_add', $comment); if (Plugin::isEnabled('statistics_api')) { $event = array('event_type' => 'comment_added', 'description' => __('A comment was added.'), 'ipaddress' => $comment->ip, 'username' => $comment->author_name); Observer::notify('stats_comment_after_add', $event); } }
/** * Parse component params and set configs * * @return void */ protected function _setConfigs() { // Is component enabled? if ($this->config->get('enabled', 0) == 0) { App::redirect(Route::url('index.php?option=com_resources')); return; } // Logging $this->_logging = $this->config->get('enable_logs', 1); // Are we allowing contributions $this->_contributable = Plugin::isEnabled('projects', 'publications') ? true : false; }
?> "> <tbody> <tr> <td width="25"></td> <td width="620"> <div style="font-size: 12px; line-height: 24px; color: #666666; font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif; background-color: <?php echo $boxBgColor; ?> ; padding: 10px; border-radius:6px 6px 6px 6px; -moz-border-radius: 6px 6px 6px 6px; -webkit-border-radius:6px 6px 6px 6px; -webkit-font-smoothing: antialiased; text-align: center;"> <p style="margin: 0;">Publishing your data on <?php echo Config::get('sitename'); ?> increases access to and impact of your research!</p> <div style=""><a href="<?php echo Plugin::isEnabled('members', 'impact') ? $profileLink . '/impact' . $append : $base . '/publications/submit' . $append; ?> " style="color: #ffffff; background-color: #000000; padding: 5px 10px; border-radius:6px 6px 6px 6px; -moz-border-radius: 6px 6px 6px 6px; text-decoration: none;">View all publications and publish more data</a></div> </div> </td> <td width="25"></td> </tr> </tbody> </table> <!-- ====== Start Spacer ====== --> <table width="670" cellpadding="0" cellspacing="0" border="0" style="background-color: <?php echo $backgroundColor; ?> ; border-right: 1px solid <?php echo $borderColor;
function upcscanned($entered) { $my_url = MiscLib::base_url(); $ret = $this->default_json(); /* force cashiers to enter a comment on refunds */ if (CoreLocal::get("refund") == 1 && CoreLocal::get("refundComment") == "") { $ret['udpmsg'] = 'twoPairs'; if (CoreLocal::get("SecurityRefund") > 20) { $ret['main_frame'] = $my_url . "gui-modules/adminlogin.php?class=RefundAdminLogin"; } else { $ret['main_frame'] = $my_url . 'gui-modules/refundComment.php'; } CoreLocal::set("refundComment", CoreLocal::get("strEntered")); return $ret; } if (CoreLocal::get('itemPD') > 0 && CoreLocal::get('SecurityLineItemDiscount') == 30 && CoreLocal::get('msgrepeat') == 0) { $ret['main_frame'] = $my_url . "gui-modules/adminlogin.php?class=LineItemDiscountAdminLogin"; return $ret; } /** 11Sep14 Andy Disabled until keypress double form submission is fixed on paycard confirmation screen. Depending on sequence can case flag to be raised, cleared, and re-raised leading to spurrious error notifications */ if (false && CoreLocal::get('paycardTendered')) { if (CoreLocal::get('msgrepeat') == 0 || CoreLocal::get('lastRepeat') != 'paycardAlreadyApplied') { CoreLocal::set('boxMsg', 'Card already tendered<br /> Confirm adding more items'); CoreLocal::set('lastRepeat', 'paycardAlreadyApplied'); $ret['main_frame'] = $my_url . 'gui-modules/boxMsg2.php'; return $ret; } else { if (CoreLocal::get('lastRepeat') == 'paycardAlreadyApplied') { CoreLocal::set('lastRepeat', ''); CoreLocal::set('paycardTendered', false); } } } $upc = $this->sanitizeUPC($entered); $quantity = CoreLocal::get("quantity"); if (CoreLocal::get("quantity") == 0 && CoreLocal::get("multiple") == 0) { $quantity = 1; } list($scaleStickerItem, $scalepriceUPC, $scalepricEAN) = $this->rewriteScaleSticker($upc); $db = Database::pDataConnect(); $table = $db->table_definition('products'); $query = "SELECT inUse,upc,description,normal_price,scale,deposit,\n qttyEnforced,department,local,cost,tax,foodstamp,discount,\n discounttype,specialpricemethod,special_price,groupprice,\n pricemethod,quantity,specialgroupprice,specialquantity,\n mixmatchcode,idEnforced,tareweight,scaleprice"; // New column 16Apr14 if (isset($table['line_item_discountable'])) { $query .= ', line_item_discountable'; } else { $query .= ', 1 AS line_item_discountable'; } // New column 16Apr14 if (isset($table['formatted_name'])) { $query .= ', formatted_name'; } else { $query .= ', \'\' AS formatted_name'; } // New column 25Nov14 if (isset($table['special_limit'])) { $query .= ', special_limit'; } else { $query .= ', 0 AS special_limit'; } $query .= " FROM products WHERE upc = '" . $upc . "'"; $result = $db->query($query); $num_rows = $db->num_rows($result); /* check for special upcs that aren't really products */ if ($num_rows == 0) { $objs = CoreLocal::get("SpecialUpcClasses"); foreach ($objs as $class_name) { $instance = new $class_name(); if ($instance->isSpecial($upc)) { return $instance->handle($upc, $ret); } } // no match; not a product, not special if ($db->table_exists('IgnoredBarcodes')) { // lookup UPC in tabe of ignored barcodes // this just suppresses any error message from // coming back $query = 'SELECT upc FROM IgnoredBarcodes WHERE upc=\'' . $upc . "'"; $result = $db->query($query); if ($result && $db->num_rows($result)) { return $this->default_json(); } } $handler = CoreLocal::get('ItemNotFound'); if ($handler === '' || !class_exists($handler)) { $handler = 'ItemNotFound'; } $obj = new $handler(); $ret = $obj->handle($upc, $ret); return $ret; } /* product exists BEGIN error checking round #1 */ $row = $db->fetch_array($result); /** If formatted_name is present, copy it directly over products.description. This way nothing further down the process has to worry about the distinction between two potential naming fields. */ if ($row['formatted_name'] != '') { $row['description'] = $row['formatted_name']; } /* Implementation of inUse flag * if the flag is not set, display a warning dialog noting this * and allowing the sale to be confirmed or canceled */ if ($row["inUse"] == 0) { TransRecord::addLogRecord(array('upc' => $row['upc'], 'description' => $row['description'], 'department' => $row['department'], 'charflag' => 'IU')); } /** Apply special department handlers based on item's department */ $deptmods = CoreLocal::get('SpecialDeptMap'); if (!is_array($deptmods) && $db->table_exists('SpecialDeptMap')) { $model = new \COREPOS\pos\lib\models\op\SpecialDeptMapModel($db); $deptmods = $model->buildMap(); CoreLocal::set('SpecialDeptMap', $deptmods); } if (is_array($deptmods) && isset($deptmods[$row['department']])) { foreach ($deptmods[$row['department']] as $mod) { $obj = new $mod(); $ret = $obj->handle($row['department'], $row['normal_price'], $ret); if ($ret['main_frame']) { return $ret; } } } /** Detect if a by-weight item has the same weight as the last by-weight item. This can indicate a stuck scale. The giant if determines whether the item is scalable, that we know the weight, and that we know the previous weight (lastWeight) Pre-weighed items (upc starts with 002) are ignored because they're not weighed here. Scalable items that cost one cent are ignored as a special case; they're normally entered by keying a quantity multiplier */ if ($num_rows > 0 && $row['scale'] == 1 && CoreLocal::get("lastWeight") > 0 && CoreLocal::get("weight") > 0 && abs(CoreLocal::get("weight") - CoreLocal::get("lastWeight")) < 0.0005 && !$scaleStickerItem && abs($row['normal_price']) > 0.01) { if (CoreLocal::get('msgrepeat') == 0) { CoreLocal::set("strEntered", $row["upc"]); CoreLocal::set("boxMsg", "<b>Same weight as last item</b>"); CoreLocal::set('boxMsgButtons', array('Confirm Weight [enter]' => '$(\'#reginput\').val(\'\');submitWrapper();', 'Cancel [clear]' => '$(\'#reginput\').val(\'CL\');submitWrapper();')); $ret['main_frame'] = $my_url . "gui-modules/boxMsg2.php?quiet=1"; return $ret; } } if ($row["idEnforced"] > 0) { $restrictQ = "SELECT upc,dept_ID FROM dateRestrict WHERE\n ( upc='{$row['upc']}' AND\n ( " . $db->datediff($db->now(), 'restrict_date') . "=0 OR\n " . $db->dayofweek($db->now()) . "=restrict_dow\n ) AND\n ( (restrict_start IS NULL AND restrict_end IS NULL) OR\n " . $db->curtime() . " BETWEEN restrict_start AND restrict_end\n )\n ) OR \n ( dept_ID='{$row['department']}' AND\n ( " . $db->datediff($db->now(), 'restrict_date') . "=0 OR\n " . $db->dayofweek($db->now()) . "=restrict_dow\n ) AND\n ( (restrict_start IS NULL AND restrict_end IS NULL) OR\n " . $db->curtime() . " BETWEEN restrict_start AND restrict_end\n )\n )"; $restrictR = $db->query($restrictQ); if ($db->num_rows($restrictR) > 0) { $ret['output'] = DisplayLib::boxMsg(_('product cannot be sold right now'), _('Date Restriction'), false, DisplayLib::standardClearButton()); return $ret; } list($bad_age, $ret) = PrehLib::ageCheck($row['idEnforced'], $ret); if ($bad_age === true) { return $ret; } } /** Apply automatic tare weight */ if ($row['tareweight'] > 0) { $peek = PrehLib::peekItem(); if (strstr($peek, "** Tare Weight") === False) { TransRecord::addTare($row['tareweight'] * 100); } } elseif ($row['scale'] != 0 && !CoreLocal::get("tare") && Plugin::isEnabled('PromptForTare') && !CoreLocal::get("tarezero")) { $ret['main_frame'] = $my_url . 'plugins/PromptForTare/TarePromptInputPage.php?class=UPC&item=' . $entered; return $ret; } else { CoreLocal::set('tarezero', False); } /* sanity check - ridiculous price (can break db column if it doesn't fit */ if (strlen($row["normal_price"]) > 8) { $ret['output'] = DisplayLib::boxMsg($upc . '<br />' . _("Claims to be more than \$100,000"), _('Invalid Item'), false, DisplayLib::standardClearButton()); return $ret; } $scale = $row["scale"] == 0 ? 0 : 1; $qttyEnforced = $row["qttyEnforced"]; /* use scaleprice bit column to indicate whether values should be interpretted as UPC or EAN */ $scaleprice = $row['scaleprice'] == 0 ? $scalepriceUPC : $scalepriceEAN; /* need a weight with this item retry the UPC in a few milliseconds and see */ if ($scale != 0 && CoreLocal::get("weight") == 0 && $qttyEnforced == 0 && CoreLocal::get("quantity") == 0 && !$scaleStickerItem) { CoreLocal::set("SNR", CoreLocal::get('strEntered')); $ret['output'] = DisplayLib::boxMsg(_("please put item on scale"), 'Weighed Item', true, DisplayLib::standardClearButton()); return $ret; } /* quantity required for this item. Send to entry page if one wasn't provided */ if ($qttyEnforced == 1 && CoreLocal::get("multiple") == 0 && (CoreLocal::get("msgrepeat" == 0) || CoreLocal::get('qttyvalid') == 0)) { $ret['main_frame'] = $my_url . 'gui-modules/QuantityEntryPage.php' . '?entered-item=' . CoreLocal::get('strEntered') . '&qty-mode=' . $scale; return $ret; } /* got a scale weight, make sure the tare is valid */ if ($scale != 0 && !$scaleStickerItem) { $quantity = CoreLocal::get("weight") - CoreLocal::get("tare"); if (CoreLocal::get("quantity") != 0) { $quantity = CoreLocal::get("quantity") - CoreLocal::get("tare"); } if ($quantity <= 0) { $ret['output'] = DisplayLib::boxMsg(_("item weight must be greater than tare weight"), _('Invalid Weight'), false, DisplayLib::standardClearButton()); return $ret; } CoreLocal::set("tare", 0); } /* non-scale items need integer quantities */ if ($row["scale"] == 0 && (int) CoreLocal::get("quantity") != CoreLocal::get("quantity")) { $ret['output'] = DisplayLib::boxMsg(_("fractional quantity cannot be accepted for this item"), _('Invalid Quantity'), false, DisplayLib::standardClearButton()); return $ret; } /* wedge I assume I don't like this being hard-coded, but since these UPCs are entries in products they can't go in a SpecialUPC object (unless SpecialUPC checks take place on every scan, but that's more overhead than I want on such a common operation */ if ($upc == "0000000008010" && CoreLocal::get("msgrepeat") == 0) { CoreLocal::set("boxMsg", "<b>" . $total . " gift certificate</b><br />\n " . _("insert document")); CoreLocal::set('boxMsgButtons', array('Endorse [enter]' => '$(\'#reginput\').val(\'\');submitWrapper();', 'Cancel [clear]' => '$(\'#reginput\').val(\'CL\');submitWrapper();')); $ret["main_frame"] = $my_url . "gui-modules/boxMsg2.php?endorse=giftcert&endorseAmt=" . $total; return $ret; } /* wedge I assume see 0000000008010 above */ if ($upc == "0000000008011" && CoreLocal::get("msgrepeat") == 0) { CoreLocal::set("boxMsg", "<b>" . $total . " class registration</b><br />\n " . _("insert form")); CoreLocal::set('boxMsgButtons', array('Endorse [enter]' => '$(\'#reginput\').val(\'\');submitWrapper();', 'Cancel [clear]' => '$(\'#reginput\').val(\'CL\');submitWrapper();')); $ret["main_frame"] = $my_url . "gui-modules/boxMsg2.php?endorse=classreg&endorseAmt=" . $total; return $ret; } /* END error checking round #1 */ // wfc uses deposit field to link another upc if (isset($row["deposit"]) && $row["deposit"] > 0) { $dupc = (int) $row["deposit"]; $this->addDeposit($dupc); } $upc = $row["upc"]; $row['numflag'] = isset($row["local"]) ? $row["local"] : 0; $row['description'] = str_replace("'", "", $row['description']); list($tax, $foodstamp, $discountable) = PrehLib::applyToggles($row['tax'], $row['foodstamp'], $row['discount']); $row['tax'] = $tax; $row['foodstamp'] = $foodstamp; $row['discount'] = $discountable; /** Enforce per-transaction sale limits */ if ($row['special_limit'] > 0) { $appliedQ = "\n SELECT SUM(quantity) AS saleQty\n FROM " . CoreLocal::get('tDatabase') . $db->sep() . "localtemptrans\n WHERE discounttype <> 0\n AND (\n upc='{$row['upc']}'\n OR (mixMatch='{$row['mixmatchcode']}' AND mixMatch<>''\n AND mixMatch<>'0' AND mixMatch IS NOT NULL)\n )"; $appliedR = $db->query($appliedQ); if ($appliedR && $db->num_rows($appliedR)) { $appliedW = $db->fetch_row($appliedR); if ($appliedW['saleQty'] + $quantity > $row['special_limit']) { $row['discounttype'] = 0; $row['special_price'] = 0; $row['specialpricemethod'] = 0; $row['specialquantity'] = 0; $row['specialgroupprice'] = 0; } } } /* BEGIN: figure out discounts by type */ /* get discount object CORE reserves values 0 through 63 in DiscountType::$MAP for default options. Additional discounts provided by plugins can use values 64 through 127. Because the DiscountTypeClasses array is zero-indexed, subtract 64 as an offset */ $discounttype = MiscLib::nullwrap($row["discounttype"]); $DiscountObject = null; $DTClasses = CoreLocal::get("DiscountTypeClasses"); if ($row['discounttype'] < 64 && isset(DiscountType::$MAP[$row['discounttype']])) { $class = DiscountType::$MAP[$row['discounttype']]; $DiscountObject = new $class(); } else { if ($row['discounttype'] >= 64 && isset($DTClasses[$row['discounttype'] - 64])) { $class = $DTClasses[$row['discounttype'] - 64]; $DiscountObject = new $class(); } else { // If the requested discounttype isn't available, // fallback to normal pricing. Debatable whether // this should be a hard error. $DiscountObject = new NormalPricing(); } } /* add in sticker price and calculate a quantity if the item is stickered, scaled, and on sale. otherwise, if the item is sticked, scaled, and not on sale but has a non-zero price attempt to calculate a quantity. this makes the quantity field more consistent for reporting purposes. however, if the calculated quantity somehow introduces a rounding error fall back to the sticker's price. for non-sale items, the price the customer pays needs to match the sticker price exactly. items that are not scaled do not need a fractional quantity and items that do not have a normal_price assigned cannot calculate a proper quantity. */ if ($scaleStickerItem) { if ($DiscountObject->isSale() && $scale == 1 && $row['normal_price'] != 0) { $quantity = MiscLib::truncate2($scaleprice / $row["normal_price"]); } else { if ($scale == 1 && $row['normal_price'] != 0) { $quantity = MiscLib::truncate2($scaleprice / $row["normal_price"]); if (round($scaleprice, 2) != round($quantity * $row['normal_price'], 2)) { $quantity = 1.0; $row['normal_price'] = $scaleprice; } } else { $row['normal_price'] = $scaleprice; } } } /* END: figure out discounts by type */ /* get price method object & add item CORE reserves values 0 through 99 in PriceMethod::$MAP for default methods. Additional methods provided by plugins can use values 100 and up. Because the PriceMethodClasses array is zero-indexed, subtract 100 as an offset */ $pricemethod = MiscLib::nullwrap($row["pricemethod"]); if ($DiscountObject->isSale()) { $pricemethod = MiscLib::nullwrap($row["specialpricemethod"]); } $PMClasses = CoreLocal::get("PriceMethodClasses"); $PriceMethodObject = null; $row['trans_subtype'] = $this->status; if ($pricemethod < 100 && isset(PriceMethod::$MAP[$pricemethod])) { $class = PriceMethod::$MAP[$pricemethod]; $PriceMethodObject = new $class(); } else { if ($pricemethod >= 100 && isset($PMClasses[$pricemethod - 100])) { $class = $PMClasses[$pricemethod - 100]; $PriceMethodObject = new $class(); } else { $PriceMethodObject = new BasicPM(); } } // prefetch: otherwise object members // pass out of scope in addItem() $prefetch = $DiscountObject->priceInfo($row, $quantity); $added = $PriceMethodObject->addItem($row, $quantity, $DiscountObject); if (!$added) { $ret['output'] = DisplayLib::boxMsg($PriceMethodObject->errorInfo(), '', false, DisplayLib::standardClearButton()); return $ret; } /* add discount notifications lines, if applicable */ $DiscountObject->addDiscountLine(); // cleanup, reset flags and beep if ($quantity != 0) { CoreLocal::set("msgrepeat", 0); CoreLocal::set("qttyvalid", 0); $ret['udpmsg'] = 'goodBeep'; } /* reset various flags and variables */ if (CoreLocal::get("tare") != 0) { CoreLocal::set("tare", 0); } CoreLocal::set("ttlflag", 0); CoreLocal::set("fntlflag", 0); CoreLocal::set("quantity", 0); CoreLocal::set("itemPD", 0); Database::setglobalflags(0); /* output item list, update totals footer */ $ret['redraw_footer'] = True; $ret['output'] = DisplayLib::lastpage(); if ($prefetch['unitPrice'] == 0 && $discounttype == 0) { $ret['main_frame'] = $my_url . 'gui-modules/priceOverride.php'; } return $ret; }
><?php echo __('Users'); ?> </option> <option value="setting"<?php if ($current_default_tab == 'setting') { echo ' selected="selected"'; } ?> ><?php echo __('Administration'); ?> </option> <?php foreach (Plugin::$controllers as $key => $controller) { if (Plugin::isEnabled($key) && $controller->show_tab === true) { ?> <option value="plugin/<?php echo $key; ?> "<?php if ('plugin/' . $key == $current_default_tab) { echo ' selected="selected"'; } ?> ><?php echo $controller->label; ?> </option> <?php }
/** * Return data on a resource view (this will be some form of HTML) * * @param object $publication Current publication * @param string $option Name of the component * @param array $areas Active area(s) * @param string $rtrn Data to be returned * @param string $version Version name * @param boolean $extended Whether or not to show panel * @param boolean $authorized * @return array */ public function onPublication($publication, $option, $areas, $rtrn = 'all', $version = 'default', $extended = true, $authorized = false) { $arr = array('html' => '', 'metadata' => ''); // Check if our area is in the array of areas we want to return results for if (is_array($areas)) { if (!array_intersect($areas, $this->onPublicationAreas($publication)) && !array_intersect($areas, array_keys($this->onPublicationAreas($publication)))) { $rtrn = 'metadata'; } } if ($rtrn == 'all' || $rtrn == 'html') { // Get pub configs $config = Component::params($option); $database = App::get('db'); $objV = new \Components\Publications\Tables\Version($database); $versions = $objV->getVersions($publication->id, $filters = array('public' => 1)); // Are we allowing contributions $contributable = Plugin::isEnabled('projects', 'publications') ? 1 : 0; // Instantiate a view $view = $this->view('default', 'browse')->set('option', $option)->set('publication', $publication)->set('versions', $versions)->set('config', $config)->set('authorized', $authorized)->set('contributable', $contributable); // Return the output $arr['html'] = $view->setErrors($this->getErrors())->loadTemplate(); } return $arr; }
if (!empty($xgroups)) { foreach ($xgroups as $group) { if ($group->regconfirmed) { $usersgroups[] = $group->cn; } } } break; case 2: case 0: default: break; } $messaging = true; } if (!Plugin::isEnabled('members', 'messages')) { $messaging = false; } foreach ($this->rows as $row) { //$cls = ($cls == 'odd') ? 'even' : 'odd'; $cls = ''; if ($row->public != 1) { $cls = 'private'; } if ($row->uidNumber < 0) { $id = 'n' . -$row->uidNumber; } else { $id = $row->uidNumber; } if ($row->uidNumber == User::get('id')) { $cls .= $cls ? ' me' : 'me';
<?php } ?> </div> <?php if (Plugin::isEnabled('projects', 'tools') or $this->publishing) { ?> <div class="input-wrap"> <?php echo Lang::txt('COM_PROJECTS_TYPE'); ?> <select name="type"> <?php foreach ($this->types as $type) { if ($type->id == 3 && !$this->publishing || $type->id == 2 && !Plugin::isEnabled('projects', 'tools')) { continue; } $selected = $type->id == $this->model->get('type') ? ' selected="selected"' : ''; ?> <option value="<?php echo $type->id; ?> " <?php echo $selected; ?> ><?php echo $type->type; ?> </option> <?php
:</label> <input tabindex="2" type="password" name="passwd" id="password" class="passwd" placeholder="<?php echo Lang::txt('password'); ?> " /> <div class="loading"></div> </div> <div class="input-error"></div> </div> <div class="submission"> <input type="submit" value="<?php echo Lang::txt('Sign in'); ?> " class="login-submit btn btn-primary" /> <?php if (Plugin::isEnabled('system', 'remember')) { ?> <div class="remember-wrap"> <input type="checkbox" class="remember option" name="remember" id="remember" value="yes" title="<?php echo Lang::txt('Remember Me'); ?> " <?php echo $remember_me_default ? 'checked="checked"' : ''; ?> /> <label for="remember" class="remember-me-label"><?php echo Lang::txt('Keep me logged in?'); ?> </label> </div> <?php
// No direct access defined('_HZEXEC_') or die; $this->css()->js('curation.js'); $canDo = \Components\Publications\Helpers\Permissions::getActions('type'); $text = $this->task == 'edit' ? Lang::txt('JACTION_EDIT') : Lang::txt('JACTION_CREATE'); Toolbar::title(Lang::txt('COM_PUBLICATIONS_PUBLICATION') . ' ' . Lang::txt('COM_PUBLICATIONS_MASTER_TYPE') . ': ' . $text, 'addedit.png'); if ($canDo->get('core.edit')) { Toolbar::apply(); Toolbar::save(); } Toolbar::cancel(); // Determine whether master type is supported in current version of hub code $aClass = 'item_off'; $active = Lang::txt('COM_PUBLICATIONS_MTYPE_OFF'); // If we got a plugin - type is supported if (Plugin::isEnabled('projects', $this->row->alias)) { $aClass = 'item_on'; $active = Lang::txt('COM_PUBLICATIONS_MTYPE_ON'); } $params = new \Hubzero\Config\Registry($this->row->params); // Available panels and default config $panels = array('content' => 2, 'description' => 2, 'authors' => 2, 'audience' => 0, 'gallery' => 1, 'tags' => 1, 'access' => 0, 'license' => 2, 'citations' => 1, 'notes' => 1); // Sections that cannot be hidden, ever $required = array('content', 'description', 'authors'); ?> <script type="text/javascript"> function submitbutton(pressbutton) { submitform( pressbutton ); return; }
echo Lang::txt('PLG_MEMBERS_PROFILE_USERNAME'); ?> </div> <div class="value"><?php echo $this->escape($this->profile->get('username')); ?> </div> <br class="clear" /> </div> </li> <?php } ?> <?php if (!Plugin::isEnabled('members', 'account')) { ?> <?php if ($isUser) { ?> <li class="profile-password section hidden"> <div class="section-content"> <div class="key"><?php echo Lang::txt('PLG_MEMBERS_PROFILE_PASSWORD'); ?> </div> <div class="value">***************</div> <br class="clear" /> <div class="section-edit-container"> <!-- <div class="edit-profile-title"><h2>Change Password</h2></div>
* @copyright Andrew Waters, 2009 * */ /* * Contains the following functions for the Front End : * * ru_register_page() Use this on the page you want to have for registrations eg mysite.com/register * ru_login_page() Use this on the page you want to have for logging in eg mysite.com/login * ru_confirm_page() This is the page a user clicks through to validate their account * ru_auth_required_page() Users who are not authorised to view the requested page will be redirected here * ru_reset_page() Will allow a user to have an email sent to them with a lnk to reset their password * ru_logout() A page to logout a user and return them to the hompage */ Plugin::setInfos(array('id' => 'registered_users', 'title' => 'Registered Users', 'description' => 'Allows you to manage new user registrations on your site.', 'version' => '1.0-dev', 'author' => 'Martijn van der Kleijn', 'require_wolf_version' => '0.7.7')); // Only when the plugin is enabled if (Plugin::isEnabled('registered_users')) { Plugin::addController('registered_users', 'Registered Users', 'admin_edit', true); Observer::observe('view_page_edit_plugins', 'registered_users_access_page_checkbox'); Observer::observe('page_add_after_save', 'registered_users_add_page_permissions'); Observer::observe('page_edit_after_save', 'registered_users_edit_page_permissions'); Observer::observe('page_delete', 'registered_users_delete_page_permissions'); Observer::observe('page_found', 'registered_users_page_found'); Behavior::add('login_page', ''); include 'classes/RegisteredUser.php'; include 'classes/RUCommon.php'; include 'observers/RUObservers.php'; // @todo Switch this stupid stuff to use routes function ru_login_page() { $registered_users_class = new RegisteredUser(); $loginpage = $registered_users_class->login_page();
/** * Reruns the aspect installation to upgrade the plugin if needed * * @param Plugin $plugin The plugin to upgrade * * @return void */ public function autoupgradePlugin(Plugin $plugin) { if (empty($plugin) || !$plugin->isInstalled() || !$plugin->isEnabled()) { return; } $xml = $this->loadXML($plugin->Path); if (empty($xml)) { return; } if ($plugin->Version != ($newversion = strval($xml->info->version))) { $plugin->NewVersion = $newversion; return; } if (!$this->TransactionManager->isTransactionInProgress()) { $this->TransactionManager->begin(); } $xmlFile = $plugin->Path . '/plugin.xml'; $ts = $this->DateFactory->newLocalDate(filemtime($xmlFile)); $md5 = md5_file($xmlFile); $changed = $this->processAspects($plugin, $log); if ($plugin->Md5 !== $md5) { $plugin->Md5 = $md5; $this->processCMSNavItems($plugin, $log, $xml); $this->processElements($plugin, $log, $xml); $changed = true; } // rerun element schemas if ($changed) { $plugin->AutoUpgraded = true; if (!$this->TransactionManager->isTransactionInProgress()) { $this->TransactionManager->begin(); } // foreach($this->ElementService->findAll()->getResults() as $element) // $this->NodeService->createDBSchema($element); $plugin = $this->PluginService->edit($plugin); } }
/** * Show disk usage * * @param object $model Project model * @param string $repoName * @param integer $by * @return string */ public function diskspace($model, $repoName = 'local', $by = '') { // Output HTML $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'files', 'name' => 'diskspace')); if (!isset($this->repo)) { $this->repo = new \Components\Projects\Models\Repo($model, $repoName); } $url = Route::url('index.php?option=' . $this->_option . '&alias=' . $model->get('alias') . '&active=files&action=diskspace'); // Report usage with all history? if ($this->params->get('disk_usage') == true || $by == 'admin') { $view->dirsize = $this->repo->call('getDiskUsage', $params = array('working' => true, 'history' => true)); $view->totalspace = $this->repo->call('getDiskUsage', $params = array('working' => false, 'history' => false)); } else { $view->totalspace = $this->repo->call('getDiskUsage', $params = array('working' => false, 'history' => true)); $view->dirsize = $view->totalspace; } // Get publication usage if (Plugin::isEnabled('projects', 'publications') && $by == 'admin') { require_once Component::path('com_publications') . DS . 'helpers' . DS . 'html.php'; $filters = array(); $filters['project'] = $model->get('id'); $filters['ignore_access'] = 1; $filters['dev'] = 1; $database = \App::get('db'); $objP = new \Components\Publications\Tables\Publication($database); $pubs = $objP->getRecords($filters); $view->pubDiskUsage = \Components\Publications\Helpers\Html::getDiskUsage($pubs); $view->pubQuota = $model->params->get('pubQuota') ? $model->params->get('pubQuota') : \Components\Projects\Helpers\Html::convertSize(floatval($model->config()->get('pubQuota', '1')), 'GB', 'b'); } $view->total = $this->repo->count(); $view->quota = $model->params->get('quota', \Components\Projects\Helpers\Html::convertSize(floatval($model->config()->get('defaultQuota', '1')), 'GB', 'b')); $view->by = $by; $view->model = $model; $view->option = $this->_option; $view->config = $model->config(); $view->title = isset($this->_area['title']) ? $this->_area['title'] : ''; $view->params = $this->params; return $view->loadTemplate(); }
public function browse_cat($cat_id) { $this->_checkPermission(); $params = func_get_args(); $this->path = join('/', $params); // make sure there's a / at the end if (substr($this->path, -1, 1) != '/') { $this->path .= '/'; } //security // we dont allow back link if (strpos($this->path, '..') !== false) { if (Plugin::isEnabled('statistics_api')) { $user = null; if (AuthUser::isLoggedIn()) { $user = AuthUser::getUserName(); } $ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; $event = array('event_type' => 'hack_attempt', 'description' => __('A possible hack attempt was detected.'), 'ipaddress' => $ip, 'username' => $user); Observer::notify('stats_file_manager_hack_attempt', $event); } } $this->fullpath = FILES_DIR . '/themes/news/images/'; // clean up nicely $this->fullpath = preg_replace('/\\/\\//', '/', $this->fullpath); $news_arr = News::findByCatId($cat_id); $category_name = News::getCategoryName($cat_id); $this->display('news/view_news', array('dir' => $this->path, 'files' => $this->_getListFiles(), 'news_arr' => $news_arr, 'category_name' => $category_name, 'cat_id' => $cat_id)); }