public function getContent()
 {
     $content = '';
     foreach ($this->blocks as $block) {
         $content .= $this->blockProvider->get($block->getProviderName())->getBlockDisplayContent($block);
     }
     return $content;
 }
示例#2
0
 /**
  * Get source object class
  * @staticvar className $sources
  * @param type $params
  * @return \className
  */
 public static function getSource($params)
 {
     static $sources;
     if (!isset($sources[$params->get('source')])) {
         $className = 'ZtNewsSource' . ucfirst($params->get('source'));
         $sources[$params->get('source')] = new $className($params);
     }
     return $sources[$params->get('source')];
 }
示例#3
0
 /**
  * Get cached values
  * @param type $key
  * @param type $default allows for a default value to be supplied
  * @return type returned in the event no cached value is found at the corresponding key
  * @throws Exception\Service
  */
 public function get($key, $default = null)
 {
     if (!$this->_isValidService()) {
         throw new Exception\Service("Not connected to a valid service");
     }
     $value = $this->_service->get($key, MEMCACHE_COMPRESSED);
     if ($value) {
         return $value;
     }
     return $default;
 }
 /**
  * Validates the requested refund
  * 
  * @param array $notification
  * @return boolean
  */
 private function isNotificationValid($notification)
 {
     if ($this->isStructureValid($notification) && $notification['event']['event_type'] == 'refund.succeeded') {
         $id = $notification['event']['event_resource']['transaction']['id'];
         $privateKey = trim($this->config->get('privateKey'));
         $transactionObject = new Services_Paymill_Transactions($privateKey, 'https://api.paymill.com/v2/');
         $result = $transactionObject->getOne($id);
         $this->logging->log('validate transaction-id for refund', var_export($result['id'] === $id, true));
         return $result['id'] === $id;
     }
     return false;
 }
示例#5
0
文件: Map.php 项目: nvh3010/quancrm
 /**
  * get the location for the record based on the module type
  * @param type $request
  * @return type
  */
 static function getLocation($request) {
     $recordId = $request->get('recordid');
     $module = $request->get('source_module');
     $locationFields = self::getLocationFields($module);
     $address = array();
     if (!empty($locationFields)) {
         $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $module);
         foreach ($locationFields as $key => $value) {
             $address[$key] = Vtiger_Util_Helper::getDecodedValue($recordModel->get($value));
         }
     }
     return $address;
 }
示例#6
0
 /**
  * Function adds Products/Services-PriceBooks Relation
  * @param type $request
  */
 function addListPrice($request)
 {
     $sourceModule = $request->getModule();
     $sourceRecordId = $request->get('src_record');
     $relatedModule = $request->get('related_module');
     $relInfos = $request->get('relinfo');
     $sourceModuleModel = Vtiger_Module_Model::getInstance($sourceModule);
     $relatedModuleModel = Vtiger_Module_Model::getInstance($relatedModule);
     $relationModel = Vtiger_Relation_Model::getInstance($sourceModuleModel, $relatedModuleModel);
     foreach ($relInfos as $relInfo) {
         $price = CurrencyField::convertToDBFormat($relInfo['price'], null, true);
         $relationModel->addListPrice($sourceRecordId, $relInfo['id'], $price);
     }
 }
 /**
  * Determine if this is an edit form for content and set the return value
  * 
  */
 public function onAfterRoute()
 {
     // don't run in admin
     if ($this->app->isAdmin()) {
         return;
     }
     // check that this is an edit form
     if (!('com_content' == $this->input->get('option') && 'form' == $this->input->get('view'))) {
         return;
     }
     // check if id is empty
     $isNew = !(bool) (int) $this->input->get('a_id');
     // set the return
     return $this->processReturn($this->input->get('Itemid', 0), $isNew);
 }
示例#8
0
/**
 * Render default html
 * @param type $module
 * @param type $params
 * @param type $width
 */
function renderModuleHtml($module, $params, $width = '')
{
    // html values
    $tag = $params->get('module_tag', 'div');
    $class = htmlspecialchars($params->get('moduleclass_sfx'));
    $header = $params->get('header_tag', 'h3');
    $header_class = htmlspecialchars($params->get('header_class', ''));
    // render html
    echo "<{$tag} class=\"{$width} {$class}\">\n";
    if ($module->showtitle != 0) {
        echo "<{$header} class=\"{$header_class}\">{$module->title}</{$header}>\n";
    }
    echo $module->content . "\n";
    echo "</{$tag}>\n";
}
 /**
  * Process a single validator
  * Only used if a given inputFilter was from an xmlFile or array
  * @param type $v
  */
 protected function processValidator($key, $v)
 {
     if (!isset($v['name'])) {
         $v['name'] = $key;
     }
     switch ($key) {
         case 'record_exists':
             $mapper = $v['options']['mapper'];
             if (FALSE !== strpos($mapper, 'getServiceManager')) {
                 $smOptions = explode('|', $mapper);
                 $mapper = $this->serviceManager->get('dxService')->get(trim($smOptions[1]));
                 $v['options']['mapper'] = $mapper;
                 return new \ZfcUser\Validator\RecordExists(array('mapper' => $mapper, 'key' => $v['options']['key']));
             }
             break;
         case 'no_record_exists':
             $mapper = $v['options']['mapper'];
             if (FALSE !== strpos($mapper, 'getServiceManager')) {
                 $smOptions = explode('|', $mapper);
                 $mapper = $this->serviceManager->get('dxService')->get(trim($smOptions[1]));
                 $v['options']['mapper'] = $mapper;
                 return new \ZfcUser\Validator\NoRecordExists(array('mapper' => $mapper, 'key' => $v['options']['key']));
             }
             break;
         default:
     }
     return $v;
 }
示例#10
0
/**
 * render module
 * @param object $module
 * @param type $params
 * @param type $attribs 
 */
function modChrome_missishop($module, &$params, &$attribs)
{
    ?>
		
    <div class="nissi_module module<?php 
    echo $params->get('moduleclass_sfx');
    ?>
" id="module_<?php 
    echo $module->id;
    ?>
">
        <div class="module_header">
            <?php 
    if ($module->showtitle != 0) {
        ?>
            <h3 class="module_title"><span><?php 
        echo $module->title;
        ?>
</span></h3>
            <?php 
    }
    ?>
        </div>
        <div class="module_content clearfix">
            <?php 
    echo $module->content;
    ?>
        </div>
        <div class="module_footer"><span></span></div>
    </div>       
	<?php 
}
示例#11
0
/**
 * Sortable taxonomy columns
 * Credit: http://scribu.net/wordpress/sortable-taxonomy-columns.html
 * Modified to suit our purpose
 * Allows us to sort the gallery listing by 
 * Slightly modified to fit our purpose
 * 
 * @global type $wpdb
 * @param type $clauses
 * @param type $wp_query
 * @return type
 */
function mpp_taxonomy_filter_clauses($clauses, $wp_query)
{
    //only apply if we are on the mpp gallery list screen
    if (!mpp_admin_is_gallery_list()) {
        return $clauses;
    }
    if (!isset($wp_query->query['orderby'])) {
        return $clauses;
    }
    $order_by = $wp_query->query['orderby'];
    $order_by_tax = mpp_translate_to_taxonomy($order_by);
    if (!$order_by_tax || !in_array($order_by, array('component', 'status', 'type'))) {
        return $clauses;
    }
    global $wpdb;
    //if we are here, It is for one of our taxonomy
    $clauses['join'] .= <<<SQL
LEFT OUTER JOIN {$wpdb->term_relationships} ON {$wpdb->posts}.ID={$wpdb->term_relationships}.object_id
LEFT OUTER JOIN {$wpdb->term_taxonomy} USING (term_taxonomy_id)
LEFT OUTER JOIN {$wpdb->terms} USING (term_id)
SQL;
    $clauses['where'] .= $wpdb->prepare(" AND (taxonomy = %s OR taxonomy IS NULL)", $order_by_tax);
    $clauses['groupby'] = "object_id";
    $clauses['orderby'] = "GROUP_CONCAT({$wpdb->terms}.name ORDER BY name ASC) ";
    $clauses['orderby'] .= 'ASC' == strtoupper($wp_query->get('order')) ? 'ASC' : 'DESC';
    return $clauses;
}
示例#12
0
 /**
  *
  * @param type $application
  */
 protected function initRouters($application)
 {
     $router = $this->_di->get('router');
     $router->add('/', ['namespace' => 'Intranet\\Controllers', 'module' => 'intranet', 'controller' => 'index', 'action' => 'index']);
     $router->notFound(['namespace' => 'Nucleo\\Controllers', 'module' => 'nucleo', 'controller' => 'errors', 'action' => 'show404']);
     $router->add('/forbidden', ['namespace' => 'Nucleo\\Controllers', 'module' => 'nucleo', 'controller' => 'errors', 'action' => 'show401']);
     $router->add('/not-found', ['namespace' => 'Nucleo\\Controllers', 'module' => 'nucleo', 'controller' => 'errors', 'action' => 'show404']);
     $router->add('/internal-error', ['namespace' => 'Nucleo\\Controllers', 'module' => 'nucleo', 'controller' => 'errors', 'action' => 'show500']);
     $router->add('/confirm/{code}/{email}', ['namespace' => 'Nucleo\\Controllers', 'module' => 'nucleo', 'controller' => 'users', 'action' => 'confirmEmail']);
     $router->add('/reset-password/{code}/{email}', ['namespace' => 'Nucleo\\Controllers', 'module' => 'nucleo', 'controller' => 'session', 'action' => 'resetPassword']);
     $router->add('/change-password', ['namespace' => 'Nucleo\\Controllers', 'module' => 'nucleo', 'controller' => 'session', 'action' => 'changePassword']);
     $router->add('/login', ['namespace' => 'Nucleo\\Controllers', 'module' => 'nucleo', 'controller' => 'session', 'action' => 'index']);
     $router->add('/login/:action', ['namespace' => 'Nucleo\\Controllers', 'module' => 'nucleo', 'controller' => 'session', 'action' => 1]);
     $router->add('/produtos', ['namespace' => 'Intranet\\Controllers', 'module' => 'intranet', 'controller' => 'consultas', 'action' => 'produtosServicos']);
     $router->add('/fornecedores', ['namespace' => 'Intranet\\Controllers', 'module' => 'intranet', 'controller' => 'consultas', 'action' => 'fornecedores']);
     $router->add('/profile', ['namespace' => 'Nucleo\\Controllers', 'module' => 'nucleo', 'controller' => 'users', 'action' => 'profile']);
     foreach ($application->getModules() as $key => $module) {
         $namespace = str_replace('Module', 'Controllers', $module['className']);
         $router->add('/' . $key . '/:params', ['namespace' => $namespace, 'module' => $key, 'controller' => 'index', 'action' => 'index', 'params' => 1])->setName($key);
         $router->add('/' . $key . '/:controller/:params', ['namespace' => $namespace, 'module' => $key, 'controller' => 1, 'action' => 'index', 'params' => 2]);
         $router->add('/' . $key . '/:controller/:action/:params', ['namespace' => $namespace, 'module' => $key, 'controller' => 1, 'action' => 2, 'params' => 3]);
     }
     $router->handle();
     $this->_di->setShared("router", $router);
 }
 /**
  * 重繞外部路徑
  * @param type $f3
  * @return \PFH_Ext_app_route
  */
 public function route($f3)
 {
     $uri = $f3->get("URI");
     $uri = substr($uri, strrpos($uri, "/") + 1);
     $uri = "/ext_apps/" . $uri;
     $f3->reroute($uri);
     return $this;
 }
示例#14
0
 public function setGetVar($var)
 {
     $this->getVar = $var;
     $this->currentSite = type::get($this->getVar, 'int', 1);
     $this->start = $this->currentSite * $this->proSite - $this->proSite;
     $this->maxSites = ceil($this->maxEntrys / $this->proSite);
     return $this;
 }
示例#15
0
 /**
  *
  * @param type $class
  * @param type $params
  * @return object
  */
 public static function createObject($class, $params = [])
 {
     if (is_string($class)) {
         $object = Application::$container->get($class, $params);
     } elseif (is_array($class)) {
         $object = call_user_func([self::createObject($class[0]), $class[1]], $params);
     }
     return $object;
 }
示例#16
0
 public function __construct()
 {
     if (!is_null(type::get('logout', 'string'))) {
         self::logout();
     } elseif (self::checkLogin()) {
         self::loginSession();
     } elseif (!is_null(type::post('login', 'string'))) {
         self::loginPost();
     }
 }
示例#17
0
/**
 * Change columns get_posts() query
 * 
 * @param type $query
 * @return void
 */
function mashsb_sort_shares_by($query)
{
    if (!is_admin()) {
        return false;
    }
    $orderby = $query->get('orderby');
    if ('Share Count' == $orderby) {
        $query->set('meta_key', 'mashsb_shares');
        $query->set('orderby', 'meta_value_num');
    }
}
示例#18
0
 /**
  *
  * @access public
  * @since unknown
  * @param type $value
  * @return type 
  */
 public function findByPrimaryKey($value)
 {
     $this->daoMetadata->select($this->getFields());
     $this->daoMetadata->from($this->getTableName());
     $this->daoMetadata->like('s_site', $value, 'both');
     $result = $this->daoMetadata->get();
     if ($result == false) {
         return array();
     }
     return $result->row();
 }
示例#19
0
 /**
  *
  * @param type $params
  * @return type
  */
 public static function getList(&$params)
 {
     $user = CFactory::getUser();
     $db = JFactory::getDBO();
     $extraQuery = '';
     switch ($params->get('album_type', 0)) {
         case 1:
             //profile albums
             $extraQuery = " AND c." . $db->quoteName('type') . " LIKE '%profile%'";
             break;
         case 2:
             //group albums
             $extraQuery = ' AND c.' . $db->quoteName('type') . ' LIKE ' . $db->quote('%group%');
             break;
         case 3:
             //event albums
             $extraQuery = ' AND c.' . $db->quoteName('type') . ' LIKE ' . $db->quote('%event%');
             break;
         default:
             //all albums
     }
     /* Do query */
     $query = 'SELECT a.*,b.*,c.' . $db->quoteName('type') . ' as phototype,c.' . $db->quoteName('groupid') . ' FROM ' . $db->quoteName('#__community_wall') . ' AS a ' . ' INNER JOIN ' . $db->quoteName('#__community_photos') . ' AS b ' . ' ON a.' . $db->quoteName('contentid') . '=b.' . $db->quoteName('id') . ' INNER JOIN ' . $db->quoteName('#__community_photos_albums') . ' AS c ' . ' ON b.' . $db->quoteName('albumid') . '=c.' . $db->quoteName('id') . ' WHERE a.' . $db->quoteName('type') . ' =' . $db->Quote('photos') . $extraQuery . ' ORDER BY a.' . $db->quoteName('date') . ' DESC ';
     $db->setQuery($query);
     $comments = $db->loadObjectList();
     //Once results are loaded, filter the count and the user premission level
     $counter = $params->get('limit', 10);
     $data = array();
     foreach ($comments as $comment) {
         /* permission checking */
         $permission = CPrivacy::getAccessLevel($user->id, $comment->creator);
         if ($permission >= $comment->permissions) {
             $data[] = $comment;
             if (--$counter == 0) {
                 break;
             }
         }
     }
     return $data;
 }
示例#20
0
 /**
  *
  * @param type $params
  * @return type
  */
 public static function getList(&$params)
 {
     $my = CFactory::getUser();
     $db = JFactory::getDBO();
     $type = $params->get('video_type', 0);
     $extraQuery = '';
     switch ($type) {
         case 1:
             $extraQuery = ' AND b.' . $db->quoteName('creator_type') . '=' . $db->Quote('user');
             break;
         case 2:
             $extraQuery = ' AND b.' . $db->quoteName('creator_type') . '=' . $db->Quote('group');
             break;
         case 3:
             $extraQuery = ' AND b.' . $db->quoteName('creator_type') . '=' . $db->Quote('event');
             break;
         default:
     }
     /* Do query */
     $query = 'SELECT * FROM ' . $db->quoteName('#__community_wall') . ' AS a ' . ' INNER JOIN ' . $db->quoteName('#__community_videos') . ' AS b ' . ' ON a.' . $db->quoteName('contentid') . '=b.' . $db->quoteName('id') . ' WHERE a.' . $db->quoteName('type') . ' =' . $db->Quote('videos') . ' AND b.' . $db->quoteName('status') . ' =' . $db->Quote('ready') . $extraQuery . ' ORDER BY a.' . $db->quoteName('date') . ' DESC ';
     $db->setQuery($query);
     $comments = $db->loadObjectList();
     //Once results are loaded, filter the count and the user premission level
     $counter = $params->get('limit', 10);
     $data = array();
     foreach ($comments as $key => $comment) {
         /* permission checking */
         $permission = CPrivacy::getAccessLevel($my->id, $comment->creator);
         if ($permission >= $comment->permissions) {
             $data[] = $comment;
             if (--$counter == 0) {
                 break;
             }
         }
     }
     return $data;
 }
示例#21
0
 /**
  * 
  * @param string $module
  */
 public function __construct($module = 'centreon')
 {
     $this->module = $module;
     $this->di = Di::getDefault();
     $this->appConfig = $this->di->get('config');
     $this->propelConfiguration['datasources'] = array('centreon' => array('adapter' => 'mysql', 'connection' => array('dsn' => $this->appConfig->get($this->targetDb, 'dsn'), 'user' => $this->appConfig->get($this->targetDb, 'username'), 'password' => $this->appConfig->get($this->targetDb, 'password'))));
     $this->appPath = rtrim(Di::getDefault()->get('config')->get('global', 'centreon_path'), '/');
     $this->tmpDir = rtrim($this->appConfig->get('global', 'centreon_generate_tmp_dir'), '/') . '/' . $this->module . '/propel';
     if (file_exists($this->tmpDir)) {
         Directory::delete($this->tmpDir, true);
     }
     mkdir($this->tmpDir, 0700, true);
     mkdir($this->tmpDir . '/schema/', 0700, true);
     $this->propelPath = $this->appPath . '/vendor/propel/propel1/';
     $this->outputDir = $this->tmpDir . '/output/';
     $this->mySchemaBuilder = new SchemaBuilder('centreon', $this->tmpDir . '/schema/', $module);
 }
 /**
  * Strip elements from the array that are considered empty
  *
  * Empty is NULL or empty string, values of 0 are NOT empty unless they are a checkbox
  *
  * @param type $inputArray
  * @param type $model
  * @return boolean
  */
 public function array_filter($inputArray, $model)
 {
     $outputArray = array();
     foreach ($inputArray as $key => $value) {
         // Null and empty string are skipped
         if (is_null($value) || $value === '') {
             continue;
         }
         // Maybe do a check on multiOptions for checkboxes etc. to disable some 0 values $model->get($key, 'multiOptions');
         if ($value == '0' && ($options = $model->get($key, 'multiOptions'))) {
             if (count($options) == 2) {
                 // Probably a checkbox (multi flexi in limesurvey)
                 continue;
             }
         }
         $outputArray[$key] = $value;
     }
     return $outputArray;
 }
示例#23
0
文件: helper.php 项目: Jougito/DynWeb
 /**
  *
  * @param type $params
  * @return type
  */
 public static function getList(&$params)
 {
     $my = CFactory::getUser();
     /* Do query */
     $db = JFactory::getDBO();
     $query = 'SELECT a.*,b.*,c.' . $db->quoteName('type') . ' as phototype,c.' . $db->quoteName('groupid') . ' FROM ' . $db->quoteName('#__community_wall') . ' AS a ' . ' INNER JOIN ' . $db->quoteName('#__community_photos') . ' AS b ' . ' ON a.' . $db->quoteName('contentid') . '=b.' . $db->quoteName('id') . ' INNER JOIN ' . $db->quoteName('#__community_photos_albums') . ' AS c ' . ' ON b.' . $db->quoteName('albumid') . '=c.' . $db->quoteName('id') . ' WHERE a.' . $db->quoteName('type') . ' =' . $db->Quote('photos') . ' ORDER BY a.' . $db->quoteName('date') . ' DESC ';
     $db->setQuery($query);
     $comments = $db->loadObjectList();
     //Once results are loaded, filter the count and the user premission level
     $counter = $params->get('count', 5);
     $data = array();
     foreach ($comments as $comment) {
         /* permission checking */
         $permission = CPrivacy::getAccessLevel($my->id, $comment->creator);
         if ($permission >= $comment->permissions) {
             $data[] = $comment;
             if (--$counter == 0) {
                 break;
             }
         }
     }
     return $data;
 }
示例#24
0
 /**
  * Write HTML to file
  * 
  * @param type $a_target_directory
  * @param type $a_file
  * @param type $a_tpl
  * @param type $a_content
  * @param type $a_right_content
  * @return string 
  */
 protected function writeExportFile($a_target_directory, $a_file, $a_tpl, $a_content, $a_right_content = null)
 {
     $file = $a_target_directory . "/" . $a_file;
     // return if file is already existing
     if (@is_file($file)) {
         return;
     }
     // export template: page content
     $ep_tpl = new ilTemplate("tpl.export_page.html", true, true, "Modules/Blog");
     $ep_tpl->setVariable("PAGE_CONTENT", $a_content);
     // export template: right content
     if ($a_right_content) {
         $ep_tpl->setVariable("RIGHT_CONTENT", $a_right_content);
     }
     $a_tpl->setContent($ep_tpl->get());
     $content = $a_tpl->get("DEFAULT", false, false, false, true, true, true);
     // open file
     if (!file_put_contents($file, $content)) {
         die("<b>Error</b>: Could not open \"" . $file . "\" for writing" . " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
     }
     // set file permissions
     chmod($file, 0770);
     return $file;
 }
示例#25
0
<?php

if (type::get('checkversion', 'int', 0) == 1) {
    $cacheFile = cache::getFileName(0, 'dynaoVersion');
    cache::exist($cacheFile, 0);
    echo message::success(lang::get('connection_again'), true);
}
if (ajax::is()) {
    if (type::super('text')) {
        $mail = mail('*****@*****.**', 'Neue Idee', type::super('text'), 'From: ' . dyn::get('user')->get('firstname') . ' ' . dyn::get('user')->get('name') . '<' . dyn::get('user')->get('email') . '>');
        if ($mail) {
            ajax::addReturn(message::success(lang::get('idea_send')));
        } else {
            ajax::addReturn(message::danger(lang::get('idea_error')));
        }
    } else {
        ajax::addReturn(message::danger(lang::get('idea_empty')));
    }
}
$versionCheck = dyn::checkDynVersion();
if ($versionCheck === lang::get('version_fail_connect')) {
    $message = lang::get('version_fail_connect');
    $message .= '<br /><a href="' . url::backend('dashboard', ['subpage' => 'overview', 'checkversion' => 1]) . '">' . lang::get('try_again') . '</a>';
    echo message::danger($message, true);
} elseif ($versionCheck) {
    echo message::danger($versionCheck, true);
}
$stats = [];
$sql = sql::factory();
$numPages = $sql->num('SELECT * FROM ' . sql::table('structure'));
$sql = sql::factory();
示例#26
0
 /**
  * 
  * Application Table Object 
  * Listener Oblect
  * @param type $sm Service Manager
  */
 public function __construct($sm)
 {
     $sm->get('Zend\\Db\\Adapter\\Adapter');
     $this->application = new ApplicationTable();
     $this->listenerObject = new Listener();
 }
 /**
  * Adds post_name to the where clause
  * @param type $where
  * @param type $wp_query
  */
 function add_post_name_where_clauses(&$where, &$wp_query)
 {
     global $wpdb;
     if ($name = $wp_query->get('page_name__like')) {
         $where .= " AND {$wpdb->posts}.post_name LIKE '{$name}'";
     } elseif ($names = $wp_query->get('page_name__in')) {
         $names = $this->format_where_in_value($names);
         $where .= " AND {$wpdb->posts}.post_name IN ({$names})";
     }
 }
示例#28
0
文件: index.php 项目: kyroskoh/rokket
lang::setLang(rp::get('lang'));
$DB = rp::get('DB');
sql::connect($DB['host'], $DB['user'], $DB['password'], $DB['database']);
unset($DB);
date_default_timezone_set(rp::get('timezone', 'Europe/Berlin'));
new userLogin();
rp::add('user', new user(userLogin::getUser()));
cache::setCache(rp::get('cache'));
addonConfig::loadAllConfig();
addonConfig::includeAllLangFiles();
addonConfig::includeAllLibs();
$page = type::super('page', 'string', 'dashboard');
$action = type::super('action', 'string');
$id = type::super('id', 'int');
$success = type::get('success', 'string');
$error = type::get('error', 'string');
if (!is_null($error)) {
    echo message::danger($error);
} elseif (!is_null($success)) {
    echo message::success($success);
}
layout::addNav(lang::get('dashboard'), 'dashboard', 'home', ['refresh'], true);
layout::addNav(lang::get('settings'), 'settings', 'settings', [], false);
layout::addNav(lang::get('server'), 'server', 'list', ['add'], true);
layout::addNav(lang::get('addons'), 'addons', 'alt', [], true);
layout::addNav(lang::get('user'), 'user', 'users', ['add'], true);
foreach (addonConfig::includeAllConfig() as $file) {
    include $file;
}
if (userLogin::isLogged()) {
    $path = 'pages/' . $page . '.php';
示例#29
0
文件: lib.php 项目: vohung96/mahara
 /**
  * eventlistener to respond to saveartefact, deleteartefact and
  * deleteartefacts.
  * Check if the user just passed the critical amount of his quota with a new
  * artefact or just deleted an artefact and now is below the critical percentage
  *
  * @param type $event
  * @param type $eventdata
  */
 public static function eventlistener_savedeleteartefact($event, $eventdata)
 {
     $userid = $group = null;
     $owner = null;
     $addsize = 0;
     safe_require('notification', 'internal');
     $filesize = 0;
     $quotatypes = array('file', 'audio', 'video', 'image', 'archive', 'profileicon');
     if ('saveartefact' === $event && in_array($eventdata->get('artefacttype'), $quotatypes)) {
         $owner = array($eventdata->get('owner'));
         $group = $eventdata->get('group');
         $filesize = $eventdata->get('size');
     } else {
         if ('deleteartefact' === $event && in_array($eventdata->get('artefacttype'), $quotatypes)) {
             $owner = array($eventdata->get('owner'));
             $group = $eventdata->get('group');
             // we want to remove the size of the file from the quota check so we make it a negative integer
             $filesize = intval('-' . $eventdata->get('size'));
         } else {
             if ('updateuser' === $event) {
                 $userid = $eventdata;
                 if (is_array($userid)) {
                     $userid = reset($userid);
                 }
             } else {
                 if (is_array($eventdata)) {
                     foreach ($eventdata as $artefactid) {
                         if (!is_int($artefactid)) {
                             continue;
                         }
                         $artefact = artefact_instance_from_id($artefactid);
                         $owner = $artefact->get('owner');
                         break;
                     }
                 }
             }
         }
     }
     if (is_array($owner)) {
         $userid = reset($owner);
     }
     $quotanotifylimit = get_config_plugin('artefact', 'file', 'quotanotifylimit');
     if ($quotanotifylimit <= 0 || $quotanotifylimit >= 100) {
         $quotanotifylimit = 100;
     }
     if ($userid !== null) {
         $userdata = get_user($userid);
         $userdata->quotausedpercent = empty($userdata->quota) ? 0 : ($userdata->quotaused + $filesize) / $userdata->quota * 100;
         $overlimit = false;
         if ($quotanotifylimit <= $userdata->quotausedpercent) {
             $overlimit = true;
         }
         $notified = get_field('usr_account_preference', 'value', 'field', 'quota_exceeded_notified', 'usr', $userid);
         if ($overlimit && '1' !== $notified) {
             $notifyadmin = get_config_plugin('artefact', 'file', 'quotanotifyadmin');
             ArtefactTypeFile::notify_users_threshold_exceeded(array($userdata), $notifyadmin);
         } else {
             if ($notified && !$overlimit) {
                 set_account_preference($userid, 'quota_exceeded_notified', false);
             }
         }
     } else {
         if ($group !== null) {
             $groupdata = get_record('group', 'id', $group);
             $groupdata->quotausedpercent = empty($groupdata->quota) ? 0 : ($groupdata->quotaused + $filesize) / $groupdata->quota * 100;
             $overlimit = false;
             if ($quotanotifylimit <= $groupdata->quotausedpercent) {
                 $overlimit = true;
             }
             if ($overlimit) {
                 require_once get_config('docroot') . 'artefact/file/lib.php';
                 ArtefactTypeFile::notify_groups_threshold_exceeded(array($groupdata));
             }
         }
     }
 }
示例#30
0
 /**
  * 
  */
 public function __construct()
 {
     $this->di = Di::getDefault();
     $this->db = $this->di->get('db_centreon');
 }