/** * Join dir name and file name and return full path * * @param string $dir * @param string $name * @return string * @author Dmitry (dio) Levashov **/ protected function _joinPath($dir, $name) { $sql = 'SELECT `file_id` FROM ' . $this->tbf . ' WHERE parent_id="' . $dir . '" AND name=' . $this->db->quoteString($name); if (($res = $this->query($sql)) && $this->db->getRowsNum($res) > 0) { $r = $this->db->fetchRow($res); return $r[0]; } return -1; }
protected function checkHomeDir() { if ($this->x_isAdmin) { if ($this->options['use_group_dir']) { $group_parent = $this->root; if ($this->options['group_dir_parent']) { $sql = 'SELECT file_id FROM '.$this->tbf.' WHERE home_of = ' . $this->groupHomeId . ' LIMIT 1'; if (($res = $this->query($sql)) && $this->db->getRowsNum($res)) { list($group_parent) = $this->db->fetchRow($res); } else { $this->make($this->root, $this->options['group_dir_parent'], 'directory', $this->groupHomeId); $group_parent = $this->db->getInsertId(); } } if ($group_parent) { $xoopsMenber =& xoops_gethandler('member'); $groups = $xoopsMenber->getGroupList(new Criteria('group_type' , 'Anonymous', '!=')); $sql = 'SELECT gid FROM '.$this->tbf.' WHERE home_of < 0'; if (($res = $this->query($sql)) && $this->db->getRowsNum($res)) { while ($row = $this->db->fetchRow($res)) { unset($groups[$row[0]]); } } if ($groups) { foreach($groups as $gid => $gname) { $gid *= -1; $this->makeUmask = $this->options['group_dir_umask']; $this->makePerm = $this->options['group_dir_perm']; $this->make($group_parent, $gname, 'directory', $gid); } } } } if ($this->options['use_guest_dir']) { $sql = 'SELECT file_id FROM '.$this->tbf.' WHERE home_of = 0 LIMIT 1'; if (($res = $this->query($sql)) && $this->db->getRowsNum($res) < 1) { $config_handler =& xoops_gethandler('config'); $xoopsConfig =& $config_handler->getConfigsByCat(XOOPS_CONF); $this->makeUmask = $this->options['guest_dir_umask']; $this->makePerm = $this->options['guest_dir_perm']; $this->make(1, $this->strToUTF8($xoopsConfig['anonymous']), 'directory', 0); } } } if ($this->x_uid && $this->options['use_users_dir']) { $sql = 'SELECT file_id FROM '.$this->tbf.' WHERE home_of = '.$this->x_uid .' LIMIT 1'; if (($res = $this->query($sql)) && $this->db->getRowsNum($res) < 1) { $this->makeUmask = $this->options['users_dir_umask']; $this->makePerm = $this->options['users_dir_perm']; $this->make(1, $this->x_uname, 'directory', $this->x_uid); } } }