function uhpadmin_addallusers($option)
{
global $database, $my, $mosConfig_absolute_path, $mosConfig_live_site;
//require_once("components/com_uhp/uhp_config.php"«»);
$lists = array();
$where = array();
$where[] = "u.id is NULL ";
$database -> setQuery("SELECT h.* FROM #__users as h" . "\nLEFT JOIN #__uhp as u ON u.user_id = h.id"
. (count($where) ? "\nWHERE "
. implode(' AND ', $where) : ""«») );
if (!($users = $database -> loadObjectList()))
{
mosRedirect("index2.php?option=$option", 'Access granted to all users.');
}
for ( $i = 0, $n = count( $users ); $i < $n; $i++ )
{
$userrow = &$users[$i];
$row = new mosuhp($database);
$row->user_id = $userrow->id;
$row->nick = $userrow->username;
$row->email = $userrow->email;
$row->website = "";
$row->published = 1;
$row->shownick = 1;
$row->showemail = 0;
$row->showwebsite = 1;
$row->mypage = UHP_NOUHP;
$row->_tbl_key = "id";
if (!$row -> check())
{
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit();
}
if (!$row -> store())
{
echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
exit();
}
$row -> checkin();
}
mosRedirect("index2.php?option=$option","All users granted access"«»);
}
|