Example #1
0
 static function getInstance($front_call = null)
 {
     if (!self::$instance) {
         self::$instance = new fusers_module_common($front_call);
     }
     return self::$instance;
 }
Example #2
0
 function fusers_module_front()
 {
     $this->_module_name = 'fusers';
     $this->_common_obj = fusers_module_common::getInstance(true);
     $this->_tree =& $this->_common_obj->obj_tree;
     $this->_tree->enable_cache(true);
     parent::__construct();
     $this->context = null;
 }
Example #3
0
 function get_author($id, $type)
 {
     if (!$id) {
         return;
     }
     if ($type == 'fusers') {
         Common::call_common_instance('fusers');
         $ci = fusers_module_common::getInstance();
     } elseif ($type == 'users') {
         Common::call_common_instance('users');
         $ci = users_module_common::getInstance();
     }
     return $ci->obj_tree->getNodeInfo($id);
 }
Example #4
0
 function set_access($params)
 {
     Common::call_common_instance('fusers');
     $fusers = fusers_module_common::getInstance();
     if ($params['access']) {
         unset($params['access']['Name']);
         $params['access']['AuthRedirId'] = $params['access']['LinkId'];
         $this->reinit_page($params['id'], '%SAME%', $params['access']);
     }
     if ($params['groups']) {
         if ($results = $fusers->get_node_rights($params['id'], $this->_module_name)) {
             foreach ($results as $k => $v) {
                 $fusers->obj_tree->DelNode($k);
             }
         }
         foreach ($params['groups'] as $gr_key => $gr_) {
             if ($gr_) {
                 $fusers->init_scheme_item(str_replace('_', '', $gr_key), array('Module' => 'pages', 'Node' => $params['id'], 'Rights' => 1));
             }
         }
     }
 }
Example #5
0
 function price_objects_render($cat_id, $level = 0, $hashed_links = 0, $show_counters = 0, $max_level = 0)
 {
     global $TMS, $_PATH, $TPA;
     $buff = '';
     $category = $this->_tree->getNodeInfo($cat_id);
     $items = $this->_tree->GetChildsParam($cat_id, array('file_name', 'basic', 'LastModified', 'description', 'image', 'hashed_link', 'hash', 'hidden', 'DisableAccess', 'counter'), true);
     Common::is_module_exists("fusers") ? $fusers_exists = true : ($fusers_exists = false);
     $session = ENHANCE::get_session('');
     $fusers = false;
     if ($category["params"]["DisableAccess"] && $fusers_exists) {
         Common::call_common_instance('fusers');
         $fusers = fusers_module_common::getInstance();
         $found = false;
         if ($session["siteuser"]["usergroup"]) {
             $found = $fusers->get_node_rights($cat_id, $this->_module_name, $session["siteuser"]["usergroup"]);
         }
         if (!$found) {
             return $TMS->parseSection('_doc_list_no_access');
         }
     }
     $TMS->AddReplace('_doc_list_level_' . $level, 'cat_name', $category["basic"]);
     if ($items != false) {
         foreach ($items as $item) {
             if ($item["params"]["hidden"]) {
                 continue;
             }
             if ($item["obj_type"] == '_PRICEGROUP') {
                 if ($level < $max_level - 1 || !$max_level) {
                     if ($hashed_links || $category["params"]["hashed_link"]) {
                         $buff .= $this->price_objects_render($item['id'], $level + 1, 1, $show_counters);
                     } else {
                         $buff .= $this->price_objects_render($item['id'], $level + 1, 0, $show_counters);
                     }
                 }
                 continue;
             }
             if (!file_exists($f = PATH_ . $item['params']['file_name'])) {
                 $buff .= $TMS->parseSection('_file_not_found');
                 continue;
             }
             if ($item['params']['DisableAccess'] && $fusers_exists) {
                 if (!$fusers) {
                     Common::call_common_instance('fusers');
                     $fusers = fusers_module_common::getInstance();
                 }
                 $found = false;
                 if ($session["siteuser"]["usergroup"]) {
                     $found = $fusers->get_node_rights($item['id'], $this->_module_name, $session["siteuser"]["usergroup"]);
                 }
                 if (!$found) {
                     $buff .= $TMS->parseSection('_file_no_access');
                 }
             }
             $stat = stat($f);
             if ($hashed_links || $item["params"]["hashed_link"] || $category["params"]["hashed_link"]) {
                 $alink = $TPA->page_link . '/~download/link/' . $item["params"]["hash"];
                 $item['params']['counter'] ? $acounter = $item['params']['counter'] : ($acounter = 0);
             } else {
                 $alink = $_PATH['WEBPATH_MEDIA'] . $item['params']['file_name'];
                 $acounter = '';
             }
             $TMS->AddMassReplace('_doc_list_item_level_' . $level, array("link" => $alink, "counter" => $acounter, "type" => pathinfo($item['params']['file_name'], PATHINFO_EXTENSION), "caption" => $item['params']['basic'], "image" => $a['image'] = $item['params']['image'], "description" => $item['params']['description'], "time" => date('d.m.Y', $item['params']['LastModified']), "show_counters" => $show_counters, "size" => XFILES::format_size($stat['size'])));
             $buff .= $TMS->parseSection('_doc_list_item_level_' . $level);
         }
     }
     $TMS->AddReplace("_doc_list_level_" . $level, "buff", $buff);
     $TMS->AddReplace("_doc_list_level_" . $level, "show_counters", $show_counters);
     $TMS->AddMassReplace('_doc_list_level_' . $level, $category['params']);
     $menu = $TMS->parseSection('_doc_list_level_' . $level);
     return $menu;
 }
Example #6
0
 function common_call()
 {
     $this->_common_obj =& fusers_module_common::getInstance();
     $_module_name = 'fusers';
     $this->_tree =& $this->_common_obj->obj_tree;
 }
Example #7
0
 function load_xlist_fuser($parameters)
 {
     Common::call_common_instance('fusers');
     $fusers =& fusers_module_common::getInstance(true);
     $TD = Common::inc_module_factory('TTreeSource');
     $options['startNode'] = $parameters['anc_id'];
     $options['shownodesWithObjType'] = array('_FUSER', '_FUSERSGROUP', '_ROOT');
     $options['columnsAsParameters'] = array('name' => 'Name');
     $options['columnsAsStructs'] = array('image' => 'obj_type');
     $options['transformResults']['image'] = array('_FUSERSGROUP' => 'group', '_FUSER' => 'page', '_ROOT' => 'group');
     $options['selectable'] = array('image' => array('_FUSER'));
     $this->result['data_set'] = null;
     $TD->init_from_source($fusers->obj_tree);
     $TD->setOptions($options);
     $TD->CreateView($parameters['anc_id']);
     $this->result = array_merge_recursive($TD->result, $this->result);
 }