Skip to content
Permalink
Browse files

Extra checks to prevent directory duplication in Commandr

  • Loading branch information...
chrisgraham committed Jul 2, 2019
1 parent 58835a7 commit db585a1fd3538a8f459d3b288271f54934b2d144
Showing with 8 additions and 0 deletions.
  1. +4 −0 sources/hooks/systems/commandr_fs/database.php
  2. +4 −0 sources/hooks/systems/commandr_fs/members.php
@@ -156,6 +156,10 @@ public function make_directory($meta_dir, $meta_root_node, $new_dir_name, &$comm
$where[$field['m_name']] = $this->unescape_name($value);
}
}
$test = $GLOBALS['SITE_DB']->query_select_value_if_there($meta_dir[0], $where);
if ($test !== null) {
return false; // Directory exists
}
$GLOBALS['SITE_DB']->query_insert($meta_dir[0], $where);
} else {
return false; // Directories aren't allowed to be added anywhere else
@@ -193,6 +193,10 @@ public function make_directory($meta_dir, $meta_root_node, $new_dir_name, &$comm
}
if (count($meta_dir) < 1) {
if ($GLOBALS['FORUM_DB']->query_select_value_if_there('f_members', 'id', array('m_username' => $new_dir_name)) !== null) {
return false; // Directory exists
}
// We're at the top level, and adding a new member
require_code('cns_members_action');
require_code('cns_members_action2');

0 comments on commit db585a1

Please sign in to comment.
You can’t perform that action at this time.