コード例 #1
0
ファイル: npc.php プロジェクト: Cassioblu55/aesop_php
function createNpc()
{
    $trait_table = "npc_traits";
    $table = "npc";
    $columns = getColumnNames($table);
    if (empty($_POST["sex"])) {
        $_POST["sex"] = getGender();
    }
    if (empty($_POST["weight"])) {
        $_POST["weight"] = getWeight();
    }
    if (empty($_POST["feet"]) || empty($_POST["inches"])) {
        $_POST["height"] = getHeight();
    } else {
        $_POST["height"] = $_POST["feet"] * 12 + $_POST["inches"];
    }
    if (empty($_POST["age"])) {
        $_POST["age"] = getAge();
    }
    if (empty($_POST["first_name"])) {
        $_POST["first_name"] = getName();
    }
    // will add the remaining traits not already added
    foreach ($columns as $column) {
        if (empty($_POST[$column])) {
            $_POST[$column] = getTrait($trait_table, $column);
        }
    }
}
コード例 #2
0
ファイル: Vcard4.php プロジェクト: Nyco/movim
 function prepareForm($me)
 {
     $vcardform = $this->tpl();
     $vcardform->assign('me', $me);
     $vcardform->assign('desc', trim($me->description));
     $vcardform->assign('gender', getGender());
     $vcardform->assign('marital', getMarital());
     $vcardform->assign('countries', getCountries());
     $vcardform->assign('submit', $this->call('ajaxVcardSubmit', "movim_form_to_json('vcard4')"));
     $vcardform->assign('privacy', $this->call('ajaxChangePrivacy', "this.checked"));
     // The datepicker arrays
     $days = $months = $years = array();
     for ($i = 1; $i <= 31; $i++) {
         if ($i < 10) {
             $j = '0' . $i;
         } else {
             $j = (string) $i;
         }
         $days[$i] = $j;
     }
     for ($i = 1; $i <= 12; $i++) {
         if ($i < 10) {
             $j = '0' . $i;
         } else {
             $j = (string) $i;
         }
         $m = getMonths();
         $months[$j] = $m[$i];
     }
     for ($i = date('o'); $i >= 1920; $i--) {
         array_push($years, $i);
     }
     $vcardform->assign('days', $days);
     $vcardform->assign('months', $months);
     $vcardform->assign('years', $years);
     return $vcardform->draw('_vcard4_form', true);
 }
コード例 #3
0
ファイル: Vcard4.php プロジェクト: vijo/movim
 function ajaxVcardSubmit($vcard)
 {
     # Format it ISO 8601:
     if ($vcard->year->value != -1 && $vcard->month->value != -1 && $vcard->day->value != -1) {
         $vcard->date->value = $vcard->year->value . '-' . $vcard->month->value . '-' . $vcard->day->value;
     }
     unset($vcard->year->value);
     unset($vcard->month->value);
     unset($vcard->day->value);
     $cd = new \Modl\ContactDAO();
     $c = $cd->get($this->user->getLogin());
     if ($c == null) {
         $c = new \Modl\Contact();
     }
     $c->jid = $this->user->getLogin();
     if (isset($vcard->date->value)) {
         $c->date = $vcard->date->value;
     }
     if (Validator::string()->length(0, 40)->validate($vcard->name->value)) {
         $c->name = $vcard->name->value;
     }
     if (Validator::string()->length(0, 40)->validate($vcard->fn->value)) {
         $c->fn = $vcard->fn->value;
     }
     if (Validator::url()->validate($vcard->url->value)) {
         $c->url = $vcard->url->value;
     }
     if (Validator::in(array_keys(getGender()))->validate($vcard->gender->value)) {
         $c->gender = $vcard->gender->value;
     }
     if (Validator::in(array_keys(getMarital()))->validate($vcard->marital->value)) {
         $c->marital = $vcard->marital->value;
     }
     $c->adrlocality = $vcard->locality->value;
     $c->adrcountry = $vcard->country->value;
     if (Validator::email()->validate($vcard->email->value)) {
         $c->email = $vcard->email->value;
     }
     $c->twitter = $vcard->twitter->value;
     $c->skype = $vcard->skype->value;
     $c->yahoo = $vcard->yahoo->value;
     if (Validator::string()->validate($vcard->desc->value)) {
         $c->description = trim($vcard->desc->value);
     }
     $cd = new \Modl\ContactDAO();
     $cd->set($c);
     $r = new Set();
     $r->setData($c)->request();
     $r = new Moxl\Xec\Action\Vcard\Set();
     $r->setData($vcard)->request();
 }
コード例 #4
0
    echo $row['guid'];
    ?>
" method="post" action="<?php 
    echo $_SERVER['PHP_SELF'] . "?searchName=" . $_GET['searchName'];
    ?>
">
<td><?php 
    echo $row['name'];
    ?>
</td>
<td><?php 
    getRace($row['race']);
    ?>
</td>
<td><?php 
    getGender($row['gender']);
    ?>
</td>
<td><input type="hidden" name="id" value="<?php 
    echo $row['guid'];
    ?>
" /><input type="submit" name="changeSubmit" value="Set Race" /></td>
</form>
</tr>
<?php 
}
?>
</table></center>


<?php 
コード例 #5
0
ファイル: Contact.php プロジェクト: sugaryog/movim
 function getGender()
 {
     $gender = getGender();
     if ($this->gender != null && $this->gender != 'N') {
         return $gender[$this->gender];
     }
 }
コード例 #6
0
ファイル: getUserBasics.php プロジェクト: tomgsmith99/j-rug
function getUserBasics($typeOfUser = "******")
{
    global $lastNames;
    global $middleNames;
    global $emailProviders;
    global $states;
    global $ages;
    // global $subscribed;
    global $logFileHandle;
    /********************************************/
    // password - only if trad user
    if ($typeOfUser == "trad") {
        $thisUser["password"] = rand(100, 999) . rand(100, 999) . rand(100, 999) . rand(100, 999);
    }
    /********************************************/
    // birthday
    $age = getRandomValue($ages, max(array_keys($ages)));
    $yob = date("Y") - $age;
    $thisUser["birthday"] = getBirthday($yob);
    fwrite($logFileHandle, "<p>The yob is: " . $yob);
    /*******************************************/
    // gender
    // $thisUser["gender"] = "female";
    $thisUser["gender"] = getGender($age);
    // if (rand(1,100) > 56) { $thisUser["gender"] = "male"; }
    /*******************************************/
    // givenName
    $thisUser["givenName"] = getFirstName($thisUser["gender"], $yob);
    /*******************************************/
    // middleName
    // just a middle initial
    $thisUser["middleName"] = $middleNames[rand(0, sizeof($middleNames) - 1)];
    /*******************************************/
    // familyName
    $thisUser["familyName"] = $lastNames[rand(0, sizeof($lastNames) - 1)];
    // $fullname is used in creating the email address
    // tom.g.smith
    $fullName = strtolower($thisUser["givenName"] . "." . $thisUser["middleName"] . "." . $thisUser["familyName"]);
    // Get rid of apostrophe in O'Connor, for example
    $fullName = str_replace("'", "", $fullName);
    fwrite($logFileHandle, "<p>The full name is: " . $fullName);
    /*******************************************/
    // email
    $emailProvider = $emailProviders[rand(0, sizeof($emailProviders) - 1)];
    $thisUser["email"] = strtolower($fullName . "@" . $emailProvider);
    /*******************************************/
    // primaryAddress/country
    $thisUser["primaryAddress"]["country"] = getCountry();
    /*******************************************/
    // primaryAddress>stateAbbreviation
    if ($thisUser["primaryAddress"]["country"] == "United States") {
        $thisUser["primaryAddress"]["stateAbbreviation"] = getRandomValue($states, max(array_keys($states)));
    }
    /******************************************/
    // subscribed
    // Newsletter subscription status
    // $thisUser["subscribed"] = getRandomValue($subscribed);
    /******************************************/
    // Account created
    $thisUser["createdFake"] = getAccountCreationDate($thisUser["gender"]);
    fwrite($logFileHandle, "<p>The account creation date is: " . $thisUser["createdFake"]);
    /******************************************/
    // emailVerified
    $thisEmail = getEmailVerifiedDate();
    if (!empty($thisEmail)) {
        $thisUser["emailVerified"] = $thisEmail;
    }
    /******************************************/
    $thisUser["isAutogeneratedUser"] = "******";
    /******************************************/
    // Done!
    return $thisUser;
}
コード例 #7
0
ファイル: showu.php プロジェクト: sherlockhouse/aliyun
$userdb['signature'] = str_replace("\n", "<br>", $userdb['signature']);
$db_union[7] && (list($customdata, $custominfo) = getCustom($userdb['customdata']));
$userdb['rvrc'] = floor($userdb['rvrc'] / 10);
if ($db_ifonlinetime && $userdb['onlinetime']) {
    $userdb['onlinetime'] = floor($userdb['onlinetime'] / 3600);
} else {
    $userdb['onlinetime'] = 0;
}
if (!$userdb['todaypost'] || $userdb['lastpost'] < $tdtime) {
    $userdb['todaypost'] = 0;
}
$averagepost = floor($userdb['postnum'] / ceil(($timestamp - $userdb['regdate']) / (3600 * 24)));
$userdb['regdate'] = get_date($userdb['regdate'], 'Y-m-d');
$userdb['lastvisit'] = get_date($userdb['lastvisit'], 'Y-m-d');
$userdb['onlineip'] = explode('|', $userdb['onlineip']);
$userdb[gender] = getGender($userdb[gender]);
require_once PrintWAP('showu');
function getGender($gender)
{
    if ($gender == 1) {
        return '男';
    } elseif ($gender == 2) {
        return '女';
    } else {
        return '保密';
    }
}
function getCustom($data, $unserialize = true, $strips = null)
{
    global $db_union;
    $customdata = array();
コード例 #8
0
// 会員情報がすべてPOSTされているか確認します
$strings = array("last_name", "first_name", "last_kana", "first_kana", "gender_id", "year", "month", "day", "prefecture_code", "email", "password", "re_password");
// POSTされていない項目があれば登録フォームに移動します
foreach ($strings as $string) {
    if (empty($_POST[$string])) {
        header("location: register.php");
        exit;
    }
}
// 会員登録できるか確認します
// できなければ登録フォームに移動します
if (false == checkRegister($_POST["email"], $_POST["password"], $_POST["re_password"])) {
    $_SESSION["message"] = "";
    header("location: register.php");
    exit;
}
// 入力された会員情報をセッションに保存します
foreach ($strings as $string) {
    $_SESSION[$string] = $_POST[$string];
}
$_SESSION["birthday"] = $_POST["year"] . "-" . $_POST["month"] . "-" . $_POST["day"];
// 確認ページの表示用に文字列を置換します
$replaces = array();
foreach ($strings as $string) {
    $replaces[$string] = $_POST[$string];
}
$replaces["gender"] = getGender($_POST["gender_id"]);
$replaces["prefecture_name"] = getPrefecture($_POST["prefecture_code"]);
$replaces["password_msk"] = str_pad("", strlen($_POST["password"]), "*");
// register_check.htmlを表示します
displayFile("register_check.html", $replaces);