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


PHP person::find_by_name方法代码示例

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


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

示例1: fix_this_comment

function fix_this_comment($r, $num, $from, $messageid)
{
    global $db;
    global $alloc_from_addresses2;
    if ($r["commentEmailUIDORIG"] != $num) {
        unset($projectID);
        if ($r["commentMaster"] == "task" && $r["commentMasterID"]) {
            $q = prepare("select projectID from task where taskID = %d", $r["commentMasterID"]);
            $db->query($q);
            $task_row = $db->row();
            $projectID = $task_row["projectID"];
        }
        // Try figure out and populate the commentCreatedUser/commentCreatedUserClientContactID fields
        list($from_address, $from_name) = parse_email_address($from);
        $person = new person();
        $personID = $person->find_by_email($from_address);
        $personID or $personID = $person->find_by_name($from_name);
        $sql = array();
        $sql[] = prepare("commentEmailUID = '%s'", trim($num));
        if ($personID) {
            $sql[] = prepare("commentCreatedUser = %d", $personID);
            $sql[] = "commentCreatedUserClientContactID = NULL";
        } else {
            $sql[] = "commentCreatedUser = NULL";
            $cc = new clientContact();
            $clientContactID = $cc->find_by_email($from_address, $projectID);
            $clientContactID or $clientContactID = $cc->find_by_name($from_name, $projectID);
            $clientContactID and $sql[] = prepare("commentCreatedUserClientContactID = %d", $clientContactID);
        }
        $sql[] = prepare("commentCreatedUserText = '%s'", trim($from));
        $sql[] = prepare("commentEmailMessageID = '%s'", trim($messageid));
        if (!in_array($from_address, $alloc_from_addresses2)) {
            // don't update items that are from alloc
            $q = prepare("UPDATE comment SET " . implode(",", $sql) . " WHERE commentID = %d", $r["commentID"]);
            $db->query($q);
            printorlog("FIXED: " . $q . " (old uid: " . $r["commentEmailUIDORIG"] . ")", "blue");
        }
    } else {
        // Try figure out and populate the commentCreatedUser/commentCreatedUserClientContactID fields
        list($from_address, $from_name) = parse_email_address($from);
        if (!in_array($from_address, $alloc_from_addresses2)) {
            // don't update items that are from alloc
            $sql = array();
            $sql[] = prepare("commentEmailUID = '%s'", trim($num));
            $sql[] = prepare("commentEmailMessageID = '%s'", trim($messageid));
            $q = prepare("UPDATE comment SET " . implode(",", $sql) . " WHERE commentID = %d", $r["commentID"]);
            $db->query($q);
            printorlog("GOOD: " . $q, "green");
        }
    }
}
开发者ID:cjbayliss,项目名称:alloc,代码行数:51,代码来源:patch-00179-alla.php

示例2: singleton

 function get_person_and_client($from_address, $from_name, $projectID = null)
 {
     $current_user =& singleton("current_user");
     $person = new person();
     $personID = $person->find_by_email($from_address);
     $personID or $personID = $person->find_by_name($from_name);
     if (!$personID) {
         $cc = new clientContact();
         $clientContactID = $cc->find_by_email($from_address);
         $clientContactID or $clientContactID = $cc->find_by_name($from_name, $projectID);
     }
     // If we don't have a $from_name, but we do have a personID or clientContactID, get proper $from_name
     if (!$from_name) {
         if ($personID) {
             $from_name = person::get_fullname($personID);
         } else {
             if ($clientContactID) {
                 $cc = new clientContact();
                 $cc->set_id($clientContactID);
                 $cc->select();
                 $from_name = $cc->get_value("clientContactName");
             } else {
                 $from_name = $from_address;
             }
         }
     }
     return array($personID, $clientContactID, $from_name);
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:28,代码来源:comment.inc.php

示例3: expand_ip

 function expand_ip($ip, $projectID = null)
 {
     // jon               alloc username
     // jon@jon.com       alloc username or client or stranger
     // Jon <jon@jon.com> alloc username or client or stranger
     // Jon Smith         alloc fullname or client fullname
     // username
     $people or $people = person::get_people_by_username();
     if (preg_match("/^\\w+\$/i", $ip)) {
         return array($people[$ip]["personID"], $people[$ip]["name"], $people[$ip]["emailAddress"]);
     }
     // email address
     $people = person::get_people_by_username("emailAddress");
     list($email, $name) = parse_email_address($ip);
     if ($people[$email]) {
         return array($people[$email]["personID"], $people[$email]["name"], $people[$email]["emailAddress"]);
     }
     // Jon smith
     if (preg_match("/^[\\w\\s]+\$/i", $ip)) {
         $personID = person::find_by_name($ip, 100);
         if ($personID) {
             $people = person::get_people_by_username("personID");
             return array($personID, $people[$personID]["name"], $people[$personID]["emailAddress"]);
         }
         $ccid = clientContact::find_by_name($ip, $projectID, 100);
         if ($ccid) {
             $cc = new clientContact();
             $cc->set_id($ccid);
             $cc->select();
             $name = $cc->get_value("clientContactName");
             $email = $cc->get_value("clientContactEmail");
         }
     }
     return array(null, $name, $email);
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:35,代码来源:interestedParty.inc.php

示例4: array

 function attach_email_to_existing_task($req = array())
 {
     global $TPL;
     $info = inbox::get_mail_info();
     $current_user =& singleton("current_user");
     $orig_current_user =& $current_user;
     $req["taskID"] = sprintf("%d", $req["taskID"]);
     $task = new task();
     $task->set_id($req["taskID"]);
     if ($task->select()) {
         $email_receive = new email_receive($info);
         $email_receive->open_mailbox($info["folder"]);
         $email_receive->set_msg($req["id"]);
         $email_receive->get_msg_header();
         $email_receive->save_email();
         $c = comment::add_comment_from_email($email_receive, $task);
         $commentID = $c->get_id();
         $commentID and $TPL["message_good_no_esc"][] = "Created comment " . $commentID . " on task " . $task->get_task_link(array("prefixTaskID" => true));
         // Possibly change the identity of current_user
         list($from_address, $from_name) = parse_email_address($email_receive->mail_headers["from"]);
         $person = new person();
         $personID = $person->find_by_email($from_address);
         $personID or $personID = $person->find_by_name($from_name);
         if ($personID) {
             $current_user = new person();
             $current_user->load_current_user($personID);
             singleton("current_user", $current_user);
         }
         // swap back to normal user
         $current_user =& $orig_current_user;
         singleton("current_user", $current_user);
         // manually add task manager and assignee to ip list
         $extraips = array();
         if ($task->get_value("personID")) {
             $p = new person($task->get_value("personID"));
             if ($p->get_value("emailAddress")) {
                 $extraips[$p->get_value("emailAddress")]["name"] = $p->get_name();
                 $extraips[$p->get_value("emailAddress")]["role"] = "assignee";
                 $extraips[$p->get_value("emailAddress")]["personID"] = $task->get_value("personID");
                 $extraips[$p->get_value("emailAddress")]["selected"] = 1;
             }
         }
         if ($task->get_value("managerID")) {
             $p = new person($task->get_value("managerID"));
             if ($p->get_value("emailAddress")) {
                 $extraips[$p->get_value("emailAddress")]["name"] = $p->get_name();
                 $extraips[$p->get_value("emailAddress")]["role"] = "manager";
                 $extraips[$p->get_value("emailAddress")]["personID"] = $task->get_value("managerID");
                 $extraips[$p->get_value("emailAddress")]["selected"] = 1;
             }
         }
         // add all the other interested parties
         $ips = interestedParty::get_interested_parties("task", $req["taskID"], $extraips);
         foreach ((array) $ips as $k => $inf) {
             $inf["entity"] = "comment";
             $inf["entityID"] = $commentID;
             $inf["email"] and $inf["emailAddress"] = $inf["email"];
             if ($req["emailto"] == "internal" && !$inf["external"] && !$inf["clientContactID"]) {
                 $id = interestedParty::add_interested_party($inf);
                 $recipients[] = $inf["name"] . " " . add_brackets($k);
             } else {
                 if ($req["emailto"] == "default") {
                     $id = interestedParty::add_interested_party($inf);
                     $recipients[] = $inf["name"] . " " . add_brackets($k);
                 }
             }
         }
         $recipients and $recipients = implode(", ", (array) $recipients);
         $recipients and $TPL["message_good"][] = "Sent email to " . $recipients;
         // Re-email the comment out
         comment::send_comment($commentID, array("interested"), $email_receive);
         // File email away in the task's mail folder
         $mailbox = "INBOX/task" . $task->get_id();
         $email_receive->create_mailbox($mailbox) and $TPL["message_good"][] = "Created mailbox: " . $mailbox;
         $email_receive->move_mail($req["id"], $mailbox) and $TPL["message_good"][] = "Moved email " . $req["id"] . " to " . $mailbox;
         $email_receive->close();
     }
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:78,代码来源:inbox.inc.php


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