当前位置: 首页>>代码示例>>PHP>>正文


PHP DataAccess::UsernameExists方法代码示例

本文整理汇总了PHP中DataAccess::UsernameExists方法的典型用法代码示例。如果您正苦于以下问题:PHP DataAccess::UsernameExists方法的具体用法?PHP DataAccess::UsernameExists怎么用?PHP DataAccess::UsernameExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataAccess的用法示例。


在下文中一共展示了DataAccess::UsernameExists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Execute


//.........这里部分代码省略.........
             $categories = $user->GetCategories();
             $defaultCategory = $user->DefaultCategoryID;
         }
         $customizableSettings = Helper::GetCustomizableStrings();
         foreach ($customizableSettings["settings"] as $key => $value) {
             $_POST["CV_{$key}"] = __($key);
         }
     }
     // create category data for output and make sure that there is a default category
     $categoryData = array();
     $defaultCategoryIndex = -1;
     foreach ($categories as $key => $c) {
         $d = array();
         $d["category"] = $c;
         if ($c->ID) {
             $d["nameId"] = "categoryName_" . $c->ID;
             $d["defaultValue"] = $c->ID;
             $d["deleteId"] = "deleteCategory_" . $c->ID;
         } else {
             $id = (int) substr($key, 2);
             $d["nameId"] = "categoryName_new_{$id}";
             $d["defaultValue"] = "new_{$id}";
             $d["deleteId"] = "deleteCategory_new_{$id}";
         }
         $d["defaultId"] = "categoryDefault_" . $d["defaultValue"];
         if ($defaultCategory == $d["defaultValue"]) {
             $defaultCategoryIndex = count($categoryData);
         }
         $categoryData[] = $d;
     }
     $defaultCategory = $defaultCategoryIndex == -1 ? 0 : $categoryData[$defaultCategoryIndex]["defaultValue"];
     if (isset($_POST["save"])) {
         // validate
         if (DataAccess::UsernameExists($user->Username, $user->ID)) {
             $errors[] = __("USERNAME_EXISTS");
         }
         if (trim($user->Username) == "") {
             $errors[] = __("NO_USERNAME_ENTERED");
         }
         if (!$user->ID && trim($password) == "") {
             $errors[] = __("NO_PASSWORD_ENTERED");
         }
         if (trim($user->FirstName) == "") {
             $errors[] = __("NO_FIRST_NAME_ENTERED");
         }
         if (trim($user->LastName) == "") {
             $errors[] = __("NO_LAST_NAME_ENTERED");
         }
         if ($user->Email == "") {
             $errors[] = __("NO_EMAIL_ENTERED");
         }
         if ($user->Email != "" && !Helper::IsValidEmailAddress($user->Email)) {
             $errors[] = __("INVALID_EMAIL");
         }
         foreach ($categories as $c) {
             if (trim($c->Name) == "") {
                 $emptyCategoryNameFound = true;
             }
         }
         if (isset($emptyCategoryNameFound)) {
             $errors[] = __("CATEGORY_NAME_CANNOT_BE_EMPTY");
         }
         if (count($errors) == 0) {
             $userSettings = array();
             foreach ($_POST as $key => $value) {
                 if (substr($key, 0, 3) == "CV_") {
开发者ID:andopor,项目名称:doma-project,代码行数:67,代码来源:edit_user.controller.php


注:本文中的DataAccess::UsernameExists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。