コード例 #1
0
ファイル: user_extended.html.php プロジェクト: cwcw/cms
    function userEdit($row, $option, $submitvalue)
    {
        ?>
  <script language="javascript" type="text/javascript">
  function submitbutton() {
    var form = document.EditUser;
    var r = new RegExp("[^0-9A-Za-z]", "i");

    if (form.name.value == "") {
      alert( "<?php 
        echo _REGWARN_NAME;
        ?>
" );

    <?php 
        // form validation for required fields
        global $database, $mainframe;
        $sql = "select * from #__user_extended_config WHERE id='1'";
        $database->SetQuery($sql);
        $rows22 = $database->LoadObjectList();
        $row11 = $rows22[0];
        // field validation
        if ($row11->user1_must && $row11->user1_show) {
            ?>
      } else if (form.user1.value == "") {
        alert( "<?php 
            echo $row11->user1_name . ' ' . _UEXT_ISREQUIRED;
            ?>
." );
    <?php 
        }
        if ($row11->user2_must && $row11->user2_show) {
            ?>
      } else if (form.user2.value == "") {
        alert( "<?php 
            echo $row11->user2_name . ' ' . _UEXT_ISREQUIRED;
            ?>
." );
    <?php 
        }
        if ($row11->user3_must && $row11->user3_show) {
            ?>
      } else if (form.user3.value == "") {
        alert( "<?php 
            echo $row11->user3_name . ' ' . _UEXT_ISREQUIRED;
            ?>
." );
    <?php 
        }
        if ($row11->user4_must && $row11->user4_show) {
            ?>
      } else if (form.user4.value == "") {
        alert( "<?php 
            echo $row11->user4_name . ' ' . _UEXT_ISREQUIRED;
            ?>
." );
    <?php 
        }
        if ($row11->user5_must && $row11->user5_show) {
            ?>
      } else if (form.user5.value == "") {
        alert( "<?php 
            echo $row11->user5_name . ' ' . _UEXT_ISREQUIRED;
            ?>
." );
    <?php 
        }
        if ($row11->user6_must && $row11->user6_show) {
            ?>
      } else if (form.user6.value == "") {
        alert( "<?php 
            echo $row11->user6_name . ' ' . _UEXT_ISREQUIRED;
            ?>
." );
    <?php 
        }
        if ($row11->user7_must && $row11->user7_show) {
            ?>
      } else if (form.user7.value == "") {
        alert( "<?php 
            echo $row11->user7_name . ' ' . _UEXT_ISREQUIRED;
            ?>
." );
    <?php 
        }
        if ($row11->user8_must && $row11->user8_show) {
            ?>
      } else if (form.user8.value == "") {
        alert( "<?php 
            echo $row11->user8_name . ' ' . _UEXT_ISREQUIRED;
            ?>
." );
    <?php 
        }
        if ($row11->user9_must && $row11->user9_show) {
            ?>
      } else if (form.user9.value == "") {
        alert( "<?php 
            echo $row11->user9_name . ' ' . _UEXT_ISREQUIRED;
            ?>
." );
    <?php 
        }
        if ($row11->user10_must && $row11->user10_show) {
            ?>
      } else if (form.user10.value == "") {
        alert( "<?php 
            echo $row11->user10_name . ' ' . _UEXT_ISREQUIRED;
            ?>
." );
    <?php 
        }
        if ($row11->user11_must && $row11->user11_show) {
            ?>
      } else if (form.user11.value == "") {
        alert( "<?php 
            echo $row11->user11_name . ' ' . _UEXT_ISREQUIRED;
            ?>
." );
    <?php 
        }
        if ($row11->user12_must && $row11->user12_show) {
            ?>
      } else if (form.user12.value == "") {
        alert( "<?php 
            echo $row11->user12_name . ' ' . _UEXT_ISREQUIRED;
            ?>
." );
    <?php 
        }
        if ($row11->user13_must && $row11->user13_show) {
            ?>
      } else if (form.user13.value == "") {
        alert( "<?php 
            echo $row11->user13_name . ' ' . _UEXT_ISREQUIRED;
            ?>
." );
    <?php 
        }
        if ($row11->user14_must && $row11->user14_show) {
            ?>
      } else if (form.user14.value == "") {
        alert( "<?php 
            echo $row11->user14_name . ' ' . _UEXT_ISREQUIRED;
            ?>
." );
    <?php 
        }
        if ($row11->user15_must && $row11->user15_show) {
            ?>
      } else if (form.user15.value == "") {
        alert( "<?php 
            echo $row11->user15_name . ' ' . _UEXT_ISREQUIRED;
            ?>
." );
    <?php 
        }
        ?>
    } else {
      form.submit();
    }
  }
  </script>

  <form action="index.php" method="post" name="EditUser">
  <table cellpadding="5" cellspacing="0" border="0" width="100%">
    <tr>
      <td class="componentheading" colspan="5"><?php 
        echo _EDIT_TITLE;
        ?>
</td>
    </tr>
    <tr>
      <td width=85><?php 
        echo _YOUR_NAME;
        ?>
</td>
      <td><input class="inputbox" type="text" name="name" value="<?php 
        echo $row->name;
        ?>
" /></td>
    </tr>
    <tr>
      <td><?php 
        echo _EMAIL;
        ?>
</td>
      <td><input class="inputbox" type="text" name="email" value="<?php 
        echo $row->email;
        ?>
" size="30" /></td>
    <tr>
      <td><?php 
        echo _UNAME;
        ?>
</td>
      <td><input class="inputbox" type="text" name="username" value="<?php 
        echo $row->username;
        ?>
" /></td>
    </tr>
    <tr>
      <td><?php 
        echo _PASS;
        ?>
</td>
      <td><input class="inputbox" type="password" name="password" value="" /></td>
    </tr>
    <tr>
      <td><?php 
        echo _VPASS;
        ?>
</td>
      <td><input class="inputbox" type="password" name="verifyPass" /></td>
    </tr>
    <tr>
      <td colspan="2" class="componentheading"><?php 
        echo _UEXT_DETAILS;
        ?>
</td>
    </tr>

    <?php 
        //Extended User details form.
        global $database;
        global $mosConfig_lang, $mosConfig_mbf_content;
        // neu mambelfish
        include_once "administrator/components/com_user_extended/user_extended.class.php";
        $rowExtended = new mosUser_Extended_Config($database);
        $rowExtended->load('1');
        $rowExUser = new mosUser_Extended($database);
        $rowExUser->load($row->id);
        ?>
    <?php 
        if ($rowExtended->user1_show == "1") {
            ?>
    <tr>
       <td>
       <?php 
            echo $rowExtended->user1_name;
            // original
            /*
            $rowExtended->user1_name;
            // $category->load( $id ); // muster
            $rowExtended = MambelFish::translate( $rowExtended, 'categories', $mosConfig_lang);
            echo $rowExtended.' testmic';
            */
            ?>
 </td>
       <td><input name="user1" type="text" class="inputbox" size="<?php 
            echo $rowExtended->user1_size;
            ?>
" maxlength="<?php 
            echo $rowExtended->user1_size;
            ?>
" value="<?php 
            echo $rowExUser->user1;
            ?>
">
       &nbsp;&nbsp;<span class="error"><?php 
            if ($rowExtended->user1_must == "1") {
                echo _UEXT_REQUIRED;
            }
            ?>
</span></td>
    </tr>
    <?php 
        }
        if ($rowExtended->user2_show == "1") {
            ?>
    <tr>
       <td><?php 
            echo $rowExtended->user2_name;
            ?>
</td>
       <td><input name="user2" type="text" class="inputbox" size="<?php 
            echo $rowExtended->user2_size;
            ?>
" maxlength="<?php 
            echo $rowExtended->user2_size;
            ?>
" value="<?php 
            echo $rowExUser->user2;
            ?>
">
       &nbsp;&nbsp;<span class="error"><?php 
            if ($rowExtended->user2_must == "1") {
                echo _UEXT_REQUIRED;
            }
            ?>
</span></td>
    </tr>
    <?php 
        }
        if ($rowExtended->user3_show == "1") {
            ?>
    <tr>
       <td><?php 
            echo $rowExtended->user3_name;
            ?>
</td>
       <td><input name="user3" type="text" class="inputbox" size="<?php 
            echo $rowExtended->user3_size;
            ?>
" maxlength="<?php 
            echo $rowExtended->user3_size;
            ?>
" value="<?php 
            echo $rowExUser->user3;
            ?>
">
       &nbsp;&nbsp;<span class="error"><?php 
            if ($rowExtended->user3_must == "1") {
                echo _UEXT_REQUIRED;
            }
            ?>
</span></td>
    </tr>
    <?php 
        }
        ?>
    <?php 
        if ($rowExtended->user4_show == "1") {
            ?>
    <tr>
       <td><?php 
            echo $rowExtended->user4_name;
            ?>
 </td>
       <td><input name="user4" type="text" class="inputbox" size="<?php 
            echo $rowExtended->user4_size;
            ?>
" maxlength="<?php 
            echo $rowExtended->user4_size;
            ?>
" value="<?php 
            echo $rowExUser->user4;
            ?>
">
       &nbsp;&nbsp;<span class="error"><?php 
            if ($rowExtended->user4_must == "1") {
                echo _UEXT_REQUIRED;
            }
            ?>
</span></td>
    </tr>
    <?php 
        }
        ?>
    <?php 
        if ($rowExtended->user5_show == "1") {
            ?>
    <tr>
       <td><?php 
            echo $rowExtended->user5_name;
            ?>
 </td>
       <td><input name="user5" type="text" class="inputbox" size="<?php 
            echo $rowExtended->user5_size;
            ?>
" maxlength="<?php 
            echo $rowExtended->user5_size;
            ?>
" value="<?php 
            echo $rowExUser->user5;
            ?>
">
       &nbsp;&nbsp;<span class="error"><?php 
            if ($rowExtended->user5_must == "1") {
                echo _UEXT_REQUIRED;
            }
            ?>
</span></td>
    </tr>
    <?php 
        }
        ?>
    <?php 
        if ($rowExtended->user6_show == "1") {
            ?>
    <tr>
       <td><?php 
            echo $rowExtended->user6_name;
            ?>
 </td>
       <td><input name="user6" type="text" class="inputbox" size="<?php 
            echo $rowExtended->user6_size;
            ?>
" maxlength="<?php 
            echo $rowExtended->user6_size;
            ?>
" value="<?php 
            echo $rowExUser->user6;
            ?>
">
       &nbsp;&nbsp;<span class="error"><?php 
            if ($rowExtended->user6_must == "1") {
                echo _UEXT_REQUIRED;
            }
            ?>
</span></td>
    </tr>
    <?php 
        }
        ?>
    <?php 
        if ($rowExtended->user7_show == "1") {
            ?>
    <tr>
       <td><?php 
            echo $rowExtended->user7_name;
            ?>
 </td>
       <td><input name="user7" type="text" class="inputbox" size="<?php 
            echo $rowExtended->user7_size;
            ?>
" maxlength="<?php 
            echo $rowExtended->user7_size;
            ?>
" value="<?php 
            echo $rowExUser->user7;
            ?>
">
       &nbsp;&nbsp;<span class="error"><?php 
            if ($rowExtended->user7_must == "1") {
                echo _UEXT_REQUIRED;
            }
            ?>
</span></td>
    </tr>
    <?php 
        }
        ?>
    <?php 
        if ($rowExtended->user8_show == "1") {
            ?>
    <tr>
       <td><?php 
            echo $rowExtended->user8_name;
            ?>
 </td>
       <td><input name="user8" type="text" class="inputbox" size="<?php 
            echo $rowExtended->user8_size;
            ?>
" maxlength="<?php 
            echo $rowExtended->user8_size;
            ?>
" value="<?php 
            echo $rowExUser->user8;
            ?>
">
       &nbsp;&nbsp;<span class="error"><?php 
            if ($rowExtended->user8_must == "1") {
                echo _UEXT_REQUIRED;
            }
            ?>
</span></td>
    </tr>
    <?php 
        }
        ?>
    <?php 
        if ($rowExtended->user9_show == "1") {
            ?>
    <tr>
       <td><?php 
            echo $rowExtended->user9_name;
            ?>
 </td>
       <td><input name="user9" type="text" class="inputbox" size="<?php 
            echo $rowExtended->user9_size;
            ?>
" maxlength="<?php 
            echo $rowExtended->user9_size;
            ?>
" value="<?php 
            echo $rowExUser->user9;
            ?>
">
       &nbsp;&nbsp;<span class="error"><?php 
            if ($rowExtended->user9_must == "1") {
                echo _UEXT_REQUIRED;
            }
            ?>
</span></td>
    </tr>
    <?php 
        }
        ?>
    <?php 
        if ($rowExtended->user10_show == "1") {
            ?>
    <tr>
       <td><?php 
            echo $rowExtended->user10_name;
            ?>
 </td>
       <td><input name="user10" type="text" class="inputbox" size="<?php 
            echo $rowExtended->user10_size;
            ?>
" maxlength="<?php 
            echo $rowExtended->user10_size;
            ?>
" value="<?php 
            echo $rowExUser->user10;
            ?>
">
       &nbsp;&nbsp;<span class="error"><?php 
            if ($rowExtended->user10_must == "1") {
                echo _UEXT_REQUIRED;
            }
            ?>
</span></td>
    </tr>
    <?php 
        }
        ?>

    <?php 
        if ($rowExtended->user11_show == "1") {
            ?>
    <tr>
       <td><?php 
            echo $rowExtended->user11_name;
            ?>
 </td>
       <td><input name="user11" type="text" class="inputbox" size="<?php 
            echo $rowExtended->user11_size;
            ?>
" maxlength="<?php 
            echo $rowExtended->user11_size;
            ?>
" value="<?php 
            echo $rowExUser->user11;
            ?>
">
       &nbsp;&nbsp;<span class="error"><?php 
            if ($rowExtended->user11_must == "1") {
                echo _UEXT_REQUIRED;
            }
            ?>
</span></td>
    </tr>
    <?php 
        }
        ?>
    <?php 
        if ($rowExtended->user12_show == "1") {
            ?>
    <tr>
       <td><?php 
            echo $rowExtended->user12_name;
            ?>
 </td>
       <td><input name="user12" type="text" class="inputbox" size="<?php 
            echo $rowExtended->user12_size;
            ?>
" maxlength="<?php 
            echo $rowExtended->user12_size;
            ?>
" value="<?php 
            echo $rowExUser->user12;
            ?>
">
       &nbsp;&nbsp;<span class="error"><?php 
            if ($rowExtended->user12_must == "1") {
                echo _UEXT_REQUIRED;
            }
            ?>
</span></td>
    </tr>
    <?php 
        }
        ?>
    <?php 
        if ($rowExtended->user13_show == "1") {
            ?>
    <tr>
       <td><?php 
            echo $rowExtended->user13_name;
            ?>
 </td>
       <td><input name="user13" type="text" class="inputbox" size="<?php 
            echo $rowExtended->user13_size;
            ?>
" maxlength="<?php 
            echo $rowExtended->user13_size;
            ?>
" value="<?php 
            echo $rowExUser->user13;
            ?>
">
       &nbsp;&nbsp;<span class="error"><?php 
            if ($rowExtended->user13_must == "1") {
                echo _UEXT_REQUIRED;
            }
            ?>
</span></td>
    </tr>
    <?php 
        }
        ?>
    <?php 
        if ($rowExtended->user14_show == "1") {
            ?>
    <tr>
       <td><?php 
            echo $rowExtended->user14_name;
            ?>
 </td>
       <td><input name="user14" type="text" class="inputbox" size="<?php 
            echo $rowExtended->user14_size;
            ?>
" maxlength="<?php 
            echo $rowExtended->user14_size;
            ?>
" value="<?php 
            echo $rowExUser->user14;
            ?>
">
       &nbsp;&nbsp;<span class="error"><?php 
            if ($rowExtended->user14_must == "1") {
                echo _UEXT_REQUIRED;
            }
            ?>
</span></td>
    </tr>
    <?php 
        }
        ?>
    <?php 
        if ($rowExtended->user15_show == "1") {
            ?>
    <tr>
       <td><?php 
            echo $rowExtended->user15_name;
            ?>
 </td>
       <td><input name="user15" type="text" class="inputbox" size="<?php 
            echo $rowExtended->user15_size;
            ?>
" maxlength="<?php 
            echo $rowExtended->user15_size;
            ?>
" value="<?php 
            echo $rowExUser->user15;
            ?>
">
       &nbsp;&nbsp;<span class="error"><?php 
            if ($rowExtended->user15_must == "1") {
                echo _UEXT_REQUIRED;
            }
            ?>
</span></td>
    </tr>
    <?php 
        }
        ?>
    <tr>
      <td colspan="2">
        <input class="button" type="button" value="<?php 
        echo $submitvalue;
        ?>
" onclick="submitbutton()"/>
      </td>
    </tr>
  </table>
  <input type="hidden" name="id" value="<?php 
        echo $row->id;
        ?>
" />
  <input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
">
  <input type="hidden" name="task" value="saveUserEdit" />
  </form>
  <?php 
    }
コード例 #2
0
ファイル: user_extended.php プロジェクト: cwcw/cms
function UserView($option, $uid)
{
    global $database;
    if ($uid == 0) {
        mosNotAuth();
        return;
    }
    $user_id = intval(mosGetParam($_REQUEST, 'userid', 0));
    if ($user_id == 0) {
        $user_id = $uid;
    }
    //  echo "<script>alert('$user_id');</script>";
    include_once "administrator/components/com_user_extended/user_extended.class.php";
    $row = new mosUser_Extended($database);
    $row->load($user_id);
    $urow = new mosUser($database);
    $urow->load($user_id);
    $u_name = $urow->name;
    $u_username = $urow->username;
    $u_email = $urow->email;
    UserExtended_content::UserView($option, $row, $u_name, $u_username, $u_email);
}
コード例 #3
0
ファイル: admin.user_extended.php プロジェクト: cwcw/cms
function saveUser($option)
{
    global $database, $my;
    global $mosConfig_live_site;
    $row = new mosUser($database);
    if (!$row->bind($_POST)) {
        echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
        exit;
    }
    $isNew = !$row->id;
    $pwd = '';
    if ($isNew) {
        //extended user stuff
        $row->user_id = $row->id;
        // new user stuff
        if ($row->password == '') {
            $pwd = mosMakePassword();
            $row->password = md5($pwd);
        } else {
            $pwd = $row->password;
            $row->password = md5($row->password);
        }
    } else {
        // existing user stuff
        if ($row->password == '') {
            // password set to null if empty
            $row->password = null;
        } else {
            $row->password = md5($row->password);
        }
    }
    $row->registerDate = date("Y-m-d H:i:s");
    if (!$row->check()) {
        echo "<script> alert('" . $row->getError() . "'); window.history.go(-2); </script>\n";
        exit;
    }
    if (!$row->store()) {
        echo "<script> alert('" . $row->getError() . "'); window.history.go(-2); </script>\n";
        exit;
    }
    // update the ACL
    if ($isNew) {
    } else {
        $database->setQuery("SELECT aro_id FROM #__core_acl_aro WHERE value='{$row->id}'");
        $aro_id = $database->loadResult();
        $database->setQuery("UPDATE #__core_acl_groups_aro_map" . "\nSET group_id = '{$row->gid}'" . "\nWHERE aro_id = '{$aro_id}'");
        $database->query() or die($database->stderr());
    }
    $row->checkin();
    if ($isNew) {
        $database->setQuery("SELECT email FROM #__users WHERE id={$my->id}");
        $adminEmail = $database->loadResult();
        $subject = "New User Details";
        $message = "Hello {$row->name},\r \n \r \n";
        $message .= "You have been added as a user to {$mosConfig_live_site} by an Administrator.\r \n";
        $message .= "This email contains your username and password to log into the {$mosConfig_live_site} site:\r \n \r \n";
        $message .= "Username - {$row->username}\r \n";
        $message .= "Password - {$pwd}\r \n \r \n \r \n";
        $message .= "Please do not respond to this message as it is automatically generated and is for information purposes only\r \n";
        $headers .= "From: {$adminEmail}\r\n";
        $headers .= "Reply-To: {$adminEmail}\r\n";
        $headers .= "X-Priority: 3\r\n";
        $headers .= "X-MSMail-Priority: Low\r\n";
        $headers .= "X-Mailer: Mambo Open Source 4.5\r\n";
        mail($row->email, $subject, $message, $headers);
    }
    $limit = intval(mosGetParam($_REQUEST, 'limit', 10));
    $limitstart = intval(mosGetParam($_REQUEST, 'limitstart', 0));
    $row = null;
    $row = new mosUser_Extended($database);
    if (!$row->bind($_POST)) {
        echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
        exit;
    }
    if (!$row->check()) {
        echo "<script> alert('" . $row->getError() . "'); window.history.go(-2); </script>\n";
        exit;
    }
    if (!$row->storeExtended(0)) {
        echo "<script> alert('" . $row->getError() . "'); window.history.go(-2); </script>\n";
        exit;
    }
    mosRedirect("index2.php?option={$option}");
}