本文整理匯總了PHP中COM::AddChildElem方法的典型用法代碼示例。如果您正苦於以下問題:PHP COM::AddChildElem方法的具體用法?PHP COM::AddChildElem怎麽用?PHP COM::AddChildElem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類COM
的用法示例。
在下文中一共展示了COM::AddChildElem方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: modifyGroupInfo
function modifyGroupInfo($groupinfo)
{
global $mailgroup_config_file;
global $xml_database_comname;
if (!file_exists($mailgroup_config_file)) {
return false;
}
$filename = encode_utf8($mailgroup_config_file);
$xml = new COM($xml_database_comname, NULL, CP_UTF8) or die("create com instance error");
$xml->ReadDB($filename);
$xml->ResetPos();
$xml->FindElem("database");
$xml->IntoElem();
if ($xml->FindElem("group")) {
$xml->IntoElem();
while ($xml->FindElem("item")) {
$strGroup = "";
$strDomain = "";
$xml->ResetChildPos();
if ($xml->FindChildElem("name")) {
$strGroup = $xml->GetChildData();
}
$xml->ResetChildPos();
if ($xml->FindChildElem("domain")) {
$strDomain = $xml->GetChildData();
}
if (!empty($strDomain)) {
$strGroup = $strGroup . '@' . $strDomain;
}
if (strcasecmp($strGroup, $groupinfo['uid']) == 0) {
$xml->ResetChildPos();
while ($xml->FindChildElem("")) {
$strTagName = strtolower($xml->GetChildTagName());
if (strcmp($strTagName, "description") == 0) {
$xml->SetChildData($groupinfo['description']);
} else {
if (strcmp($strTagName, "memberlist") == 0) {
$xml->SetChildData($groupinfo['memberlist']);
} else {
if (strcmp($strTagName, "sendmailright") == 0) {
$xml->SetChildData($groupinfo['sendmailright']);
} else {
if (strcmp($strTagName, "sendmailmember") == 0) {
$xml->SetChildData($groupinfo['sendmailmember']);
} else {
if (strcmp($strTagName, "managerlist") == 0) {
$xml->SetChildData($groupinfo['managerlist']);
} else {
if (strcmp($strTagName, "visibleright") == 0) {
$xml->SetChildData($groupinfo['visibleright']);
}
}
}
}
}
}
}
$xml->ResetChildPos();
if (!$xml->FindChildElem("managerlist")) {
$xml->AddChildElem("managerlist", $groupinfo['managerlist']);
}
$xml->ResetChildPos();
if (!$xml->FindChildElem("visibleright")) {
$xml->AddChildElem("visibleright", $groupinfo['visibleright']);
}
return $xml->WriteDB($filename);
}
}
}
return false;
}
示例2: updateLastVisit
function updateLastVisit($userid, $action, &$lastvisit)
{
if ($userid == '') {
return;
}
global $xml_database_comname;
global $mailstore_directory;
global $lastvisit_config_file;
global $_SERVER;
$userfolder = $mailstore_directory . strtolower($userid) . "/";
$lastvisitfile = $userfolder . $lastvisit_config_file;
$lastvisitfile = encode_utf8($lastvisitfile);
$xml = new COM($xml_database_comname, NULL, CP_UTF8) or die("create com instance error");
$xml->ReadDB($lastvisitfile);
$xml->ResetPos();
if (!$xml->FindElem("database")) {
$xml->AddElem("database", "");
$xml->IntoElem();
$xml->AddElem("lastvisit", "");
} else {
$xml->IntoElem();
if (!$xml->FindElem("lastvisit")) {
$xml->AddElem("lastvisit", "");
}
}
$timestamp = time();
$visitip = $_SERVER['REMOTE_ADDR'];
$lastvisit = array();
$pop3 = 0;
$imap = 0;
$webmail = 0;
$xml->IntoElem();
while ($xml->FindElem("item")) {
$xml->ResetChildPos();
if ($xml->FindChildElem("timestamp")) {
$value = $xml->GetChildData();
if ($timestamp - $value > 7 * 24 * 3600) {
//> 7 days
$xml->RemoveElem();
}
}
$info = array();
$xml->ResetChildPos();
while ($xml->FindChildElem("")) {
$name = $xml->GetChildTagName();
$value = $xml->GetChildData();
$info[strtolower($name)] = $value;
}
if (strcasecmp($info['type'], 'pop3') == 0) {
$pop3++;
} else {
if (strcasecmp($info['type'], 'imap') == 0) {
$imap++;
} else {
if (strcasecmp($info['type'], 'webmail') == 0) {
$webmail++;
if ($info['timestamp'] > $result['timestamp']) {
$lastvisit = $info;
}
}
}
}
}
$lastvisit['pop3'] = $pop3;
$lastvisit['imap'] = $imap;
$lastvisit['webmail'] = $webmail;
$xml->AddElem("item", "");
$xml->AddChildElem("timestamp", $timestamp);
$xml->AddChildElem("visitip", $visitip);
$xml->AddChildElem("action", $action);
$xml->AddChildElem("type", "webmail");
return $xml->WriteDB($lastvisitfile);
}