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


PHP Post::val方法代码示例

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


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

示例1: save_search

 /**
  * save_search
  *
  * @param string $do
  * @access public
  * @return void
  * @notes FIXME: must return something, should not merge _GET and _REQUEST with other stuff.
  */
 public function save_search($do = 'index')
 {
     global $db;
     if ($this->isAnon()) {
         return;
     }
     // Only logged in users get to use the 'last search' functionality
     if ($do == 'index') {
         if (Post::val('search_name')) {
             $arr = array();
             foreach ($this->search_keys as $key) {
                 $arr[$key] = Post::val($key, $key == 'status' ? 'open' : null);
             }
             foreach (array('order', 'sort', 'order2', 'sort2') as $key) {
                 if (Post::val($key)) {
                     $arr[$key] = Post::val($key);
                 }
             }
             $fields = array('search_string' => serialize($arr), 'time' => time(), 'user_id' => $this->id, 'name' => Post::val('search_name'));
             $keys = array('name', 'user_id');
             $db->Replace('{searches}', $fields, $keys);
         }
     }
     $sql = $db->Query('SELECT * FROM {searches} WHERE user_id = ? ORDER BY name ASC', array($this->id));
     $this->searches = $db->FetchAllArray($sql);
 }
开发者ID:canneverbe,项目名称:flyspray,代码行数:34,代码来源:class.user.php

示例2: action_edit

 function action_edit()
 {
     foreach (Get::val('ids') as $task_id) {
         // Edit or close? If we have a resolution_reason, then close! otherwise, edit.
         if (Post::val('resolution_reason')) {
             Backend::close_task($task_id, Post::val('resolution_reason'), Post::val('closure_comment'), Post::val('mark100'));
         } elseif (count(Post::val('changes'))) {
             $task = Flyspray::GetTaskDetails($task_id);
             $args = $task;
             // import previous values
             foreach (Post::val('changes') as $change) {
                 $args[$change] = Post::val($change);
             }
             if (is_array($args['assigned_to'])) {
                 $args['assigned_to'] = implode(';', $task['assigned_to_uname']);
             }
             Backend::edit_task($task, $args);
         }
     }
     return array(SUBMIT_OK, L('masseditsuccessful'));
 }
开发者ID:heptalium,项目名称:flyspray,代码行数:21,代码来源:edit.php

示例3: dirname

require_once '../../scripts/index.php';
$baseurl = dirname(dirname($baseurl)) . '/';
// first, find out about the field we are going to edit
$classnames = explode(' ', Post::val('classname'));
$field = '';
foreach ($classnames as $name) {
    if (substr($name, 0, 5) == 'task_') {
        $field = Filters::noXSS(substr($name, 5));
    }
}
// spare unnecessary queries
if (!$field) {
    header('HTTP/1.1 400 Bad Request');
    exit;
}
$task = Flyspray::GetTaskDetails(Post::val('task_id'));
// we better not forget this one ;)
if (!$user->can_edit_task($task)) {
    header('HTTP/1.1 400 Bad Request');
    exit;
}
// pre build some HTML
$task['num_assigned'] = count($task['assigned_to']);
$task['assigned_to_name'] = reset($task['assigned_to_name']);
$prev = Filters::noXSS(str_replace("'", "\\'", tpl_draw_cell($task, $field, '<span class="%s %s">%s</span>')));
$id = sprintf('id="task%d_%s" name="task%d_%s"', $task['task_id'], $field, $task['task_id'], $field);
switch ($field) {
    case 'summary':
        echo '<input type="text" class="text" ' . $id . ' value="' . Filters::noXSS($task['item_summary']) . '" />';
        break;
    case 'project':
开发者ID:negram,项目名称:flyspray,代码行数:31,代码来源:editfield.php

示例4: CNewMessagePanel

    /**
     * @param PageBuilder $pageBuilder
     * @return ContactsPanel
     */
    function CNewMessagePanel(&$pagebuilder)
    {
        $this->Type = Post::val('mtype', 'mes');
        $this->To = '';
        $this->_pagebuilder =& $pagebuilder;
        $this->_proc =& $pagebuilder->_proc;
        $this->From = $this->_getFromEmail();
        $this->_pagebuilder->_top->AddOnResize('ResizeElements(\'all\');');
        if ($this->_proc->account->AllowDhtmlEditor) {
            $editorResize = 'HTMLEditor.Resize(width - 1, height - 2);';
            $editorReplace = 'HTMLEditor.Replace();';
        } else {
            $editorResize = '
						plainEditor.style.height = (height - 1) + "px";
						plainEditor.style.width = (width - 2) + "px";
					';
            $editorReplace = '';
        }
        $this->inputs = '';
        $contacts = null;
        if (Post::has('contacts') && is_array(Post::val('contacts'))) {
            $contactsArray = array_keys(Post::val('contacts'));
            $contacts =& $this->_proc->db->LoadContactsById($contactsArray);
        }
        if (Post::has('groupid')) {
            $group =& $this->_proc->db->SelectGroupById(Post::val('groupid', -1));
            $contacts =& $this->_proc->db->SelectAddressGroupContacts(Post::val('groupid', -1));
        }
        if ($contacts) {
            foreach ($contacts->Instance() as $contact) {
                if (!$contact->Email) {
                    continue;
                }
                $this->To .= $contact->Name ? '"' . $contact->Name . '" <' . $contact->Email . '>, ' : $contact->Email . ',';
            }
            $this->To = trim(trim($this->To), ',');
        }
        if (Post::has('mailto')) {
            $this->To = Post::val('mailto', '');
        }
        if (Get::has('to')) {
            $this->To = (string) trim(Get::val('to', ''));
        }
        $message = null;
        $isHtml = $this->_proc->account->AllowDhtmlEditor;
        $this->attacmentsHtml = '';
        $this->_pagebuilder->AddJSText('
			
var bcc, bcc_mode, bcc_mode_switcher;

var plainCont = null;
var plainEditor = null;
var HTMLEditor = null;
var EditAreaUrl = "edit-area.php";
var prevWidth = 0;
var prevHeight = 0;
var rowIndex = 0;

function ResizeElements(mode) 
{
	var width = GetWidth();
	if (width < 684)
		width = 684;
	width = width - 40;
	var height = Math.ceil(width/3);
	
	if (prevWidth != width && prevHeight != height) {
		prevWidth = width;
		prevHeight = height;
		if (plainCont != null) {
			plainCont.style.height = height + "px";
			plainCont.style.width = width + "px";
			' . $editorResize . '
		}
	}
}

function WriteEmails(str, field)
{
	var mailInput;
	if (field == 2) {
		mailInput = document.getElementById("toCC");
	} else if (field == 3) {
		mailInput = document.getElementById("toBCC");
	} else {
		mailInput = document.getElementById("toemail");
	}
	if (mailInput) {
		mailInput.value = (mailInput.value == "") ? str : mailInput.value + ", " + str;
		mailInput.focus();
	}
}

function LoadAttachmentHandler(attachObj)
{
	var attachtable = document.getElementById("attachmentTable");
//.........这里部分代码省略.........
开发者ID:diedsmiling,项目名称:busenika,代码行数:101,代码来源:class_newmessage.php

示例5: Post_to0

function Post_to0($key)
{
    return Post::val($key, 0);
}
开发者ID:kandran,项目名称:flyspray,代码行数:4,代码来源:modify.inc.php

示例6: ToHTML

    function ToHTML()
    {
        return '
	<table id="iftare_table" width="100%">
		<tr>
			<td>
				<iframe name="iframe_container" width="100%" frameborder="0" id="iframe_container"></iframe>
			</td>
		</tr>
	</table>
<form name="messform" id="messform" action="base-iframe.php?mode=full" target="iframe_container" method="POST">
<input type="hidden" name="m_id" id="m_id" value="' . ConvertUtils::AttributeQuote(Post::val('m_id', '')) . '" />
<input type="hidden" name="m_uid" id="m_uid" value="' . ConvertUtils::AttributeQuote(Post::val('m_uid', '')) . '" />
<input type="hidden" name="f_id" id="f_id" value="' . ConvertUtils::AttributeQuote(Post::val('f_id', '')) . '" />
<input type="hidden" name="f_name" id="f_name" value="' . ConvertUtils::AttributeQuote(Post::val('f_name', '')) . '" />
<input type="hidden" name="charset" id="charset" value="' . ConvertUtils::AttributeQuote(Post::val('charset', '')) . '" />
<input type="hidden" name="plain" id="plain" value="' . ConvertUtils::AttributeQuote(Post::val('plain', '-1')) . '" />
<input type="hidden" name="mtype" id="mtype" value="msg" />
</form>

			';
    }
开发者ID:diedsmiling,项目名称:busenika,代码行数:22,代码来源:class_fullscreen.php

示例7: count

<?php

/**********************************************************\
   | This script adds/deletes data what can't be added to      |
   | the XML schema files.                                     |
   \***********************************************************/
// New status list, make sure data is only inserted if we have an empty table
$sql = $db->x->GetOne('SELECT count(*) FROM {list_status}');
if ($sql < 1) {
    $db->query("INSERT INTO {list_status} (`status_name`, `list_position`, `show_in_list`, `project_id`) VALUES ('Unconfirmed', 1, 1, 0)");
    $db->query("INSERT INTO {list_status} (`status_name`, `list_position`, `show_in_list`, `project_id`) VALUES ('New', 2, 1, 0)");
    $db->query("INSERT INTO {list_status} (`status_name`, `list_position`, `show_in_list`, `project_id`) VALUES ('Assigned', 3, 1, 0)");
    $db->query("INSERT INTO {list_status} (`status_name`, `list_position`, `show_in_list`, `project_id`) VALUES ('Researching', 4, 1, 0)");
    $db->query("INSERT INTO {list_status} (`status_name`, `list_position`, `show_in_list`, `project_id`) VALUES ('Waiting on Customer', 5, 1, 0)");
    $db->query("INSERT INTO {list_status} (`status_name`, `list_position`, `show_in_list`, `project_id`) VALUES ('Requires testing', 6, 1, 0)");
}
if (Post::val('replace_resolution')) {
    $db->x->execParam('UPDATE {list_resolution} SET resolution_name = ? WHERE resolution_id = ?', array('Duplicate (the real one)', 6));
}
$db->query("DELETE FROM {list_status} WHERE status_id = 7");
$db->query("DELETE FROM {notifications} WHERE user_id = 0 OR task_id = 0");
$db->query("UPDATE {tasks} SET closure_comment='' WHERE closure_comment='0'");
$db->query("UPDATE {groups} SET `add_to_assignees` = '1' WHERE `assign_others_to_self` =1 ");
$db->query("UPDATE {groups} SET add_votes = 1 WHERE group_id = 2 OR group_id = 3 OR group_id = 6");
$db->query("UPDATE {groups} SET `edit_assignments` = '1' WHERE `group_id` =2");
$db->query("UPDATE {history} SET event_type = 3 WHERE event_type = 0");
$db->query("UPDATE {history} SET event_type = 11 WHERE event_type = 15");
$db->query("UPDATE {history} SET event_type = 12 WHERE event_type = 16");
$db->query("UPDATE {history} SET field_changed = 'project_id' WHERE field_changed = 'attached_to_project'");
开发者ID:negram,项目名称:flyspray,代码行数:29,代码来源:add_data.php

示例8: header

        if ($db->countRows($res) < 1) {
            header(':', true, 403);
            die(L('invalidvalue'));
        }
        break;
    case 'closedby_version':
        $res = $db->Query('SELECT * FROM {list_version} WHERE (project_id=0 OR project_id=?) AND show_in_list=1 AND version_id=? AND version_tense=3', array($task['project_id'], $value));
        if ($db->countRows($res) < 1) {
            header(':', true, 403);
            die(L('invalidvalue'));
        }
        break;
    default:
        header(':', true, 403);
        die(L('invalidField'));
        break;
}
$oldvalue = $task[Post::val('name')];
$time = time();
$sql = $db->Query("UPDATE {tasks} SET " . Post::val('name') . " = ?,last_edited_time = ? WHERE task_id = ?", array($value, $time, Post::val('task_id')));
# load $proj again of task with correct project_id for getting active notification types in notification class
$proj = new Project($task['project_id']);
// Log the changed field in task history
Flyspray::logEvent($task['task_id'], 3, $value, $oldvalue, Post::val('name'), $time);
// Get the details of the task we just updated to generate the changed-task message
$new_details_full = Flyspray::GetTaskDetails($task['task_id']);
$changes = Flyspray::compare_tasks($task, $new_details_full);
if (count($changes) > 0) {
    $notify = new Notifications();
    $notify->Create(NOTIFY_TASK_CHANGED, $task['task_id'], $changes, null, NOTIFY_BOTH, $proj->prefs['lang_code']);
}
开发者ID:canneverbe,项目名称:flyspray,代码行数:31,代码来源:quickedit.php

示例9: foreach

            ?>
</td>
					</tr>
					<tr<?php 
            echo $isHideCharset;
            ?>
>
						<td class="wm_view_message_title"><?php 
            echo JS_LANG_Charset;
            ?>
:</td>
						<td>
							<select name="str_charset" id="strCharset" onchange="DoPost();" class="wm_view_message_select">
											<?php 
            foreach ($CHARSETS as $value) {
                echo Post::val('charset', '-1') == $value[0] ? '<option value="' . $value[0] . '" selected="selected" > ' . $value[1] . '</option>' . "\r\n" : '<option value="' . $value[0] . '" > ' . $value[1] . '</option>' . "\r\n";
            }
            ?>
							</select>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td id="td_attachments">
		<?php 
            $JSfilenameTrim = '';
            if ($message->msg->Attachments != null && $message->msg->Attachments->Count() > 0) {
                echo '<div id="attachments" class="wm_message_attachments">';
                $attachments =& $message->msg->Attachments;
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:base-iframe.php

示例10: WriteContactEdit

/**
 * @param PageBuilder $pagebuilder
 * @param int $contact_id
 * @param bool $isNew
 * @return string
 */
function WriteContactEdit(&$pagebuilder, $contact_id, $isNew = false)
{
    $out = '';
    $isCorrect = false;
    $jsIsNew = $isNew ? 'true' : 'false';
    $pagebuilder->AddJSText('

function dolocation(idurl) 
{
	var url = document.getElementById(idurl);
	if (url && url.value.length > 2) {
		OpenURL(url.value);
	}
}

function MessageToMail(email)
{
	if (!email) {
		return false;
	}
	var form = CreateChildWithAttrs(document.body, "form", [["action", "' . BASEFILE . '?' . SCREEN . '=' . SCREEN_NEWOREDIT . '"], ["method", "POST"]]);
	CreateChildWithAttrs(form, "input", [["type", "hidden"], ["name", "mailto"], ["value", email]]);
	form.submit();
}

function submitContactForm()
{
	var result = false;
	if (newContact) { 
		result = newContact.SubmitContact();
	}
	if (!result) {
		alert(Lang.WarningContactNotComplete);
	}
	return result;
} 

function DoCancle()
{
	if (' . $jsIsNew . ') {
		document.location = "' . BASEFILE . '?' . SCREEN . '=' . SCREEN_CONTACTS . '";
	} else {
		document.location = "' . BASEFILE . '?' . SCREEN . '=' . SCREEN_CONTACTS . '&' . CONTACT_MODE . '=' . C_VIEW . '&' . CONTACT_ID . '=' . $contact_id . '";
	}
}
	');
    if ($isNew) {
        $contact = new AddressBookRecord();
        $contact->PrimaryEmail = 0;
        $groupsArray = array();
        if (Post::val('cdata') == 1) {
            $contact->FullName = Post::val('cfullname', '');
            $contact->HomeEmail = Post::val('cemail', '');
        }
    } else {
        $contact =& $pagebuilder->_proc->db->SelectAddressBookRecord($contact_id);
        $groupsArray =& $pagebuilder->_proc->db->SelectAddressGroupContact($contact_id);
    }
    $allGroups =& $pagebuilder->_proc->db->SelectUserAddressGroupNames();
    $skinName = $pagebuilder->SkinName();
    if ($contact && is_object($contact)) {
        $isCorrect = true;
    }
    if ($isCorrect) {
        $pagebuilder->AddInitText($contact->isOpen() ? 'var isOpenContact = true;' : 'var isOpenContact = false;');
        $data = array();
        $data = @get_object_vars($contact);
        foreach ($data as $key => $value) {
            $data[$key] = $value && strlen($value) > 0 ? array('', $value) : array(' class="wm_hide"', '');
        }
        $Birthday[0] = $data['BirthdayDay'][1] || $data['BirthdayMonth'][1] || $data['BirthdayYear'][1] ? '' : ' class="wm_hide"';
        $Birthday[1] = GetBirthDay($data['BirthdayDay'][1], $data['BirthdayMonth'][1], $data['BirthdayYear'][1]);
        $Email = array('', '');
        switch ($contact->PrimaryEmail) {
            case PRIMARYEMAIL_Home:
                $Email[1] = $contact->HomeEmail;
                break;
            case PRIMARYEMAIL_Business:
                $Email[1] = $contact->BusinessEmail;
                break;
            case PRIMARYEMAIL_Other:
                $Email[1] = $contact->OtherEmail;
                break;
        }
        $Email[0] = $Email[1] ? '' : ' class="wm_hide"';
        $class_00 = $data['HomeEmail'][1] || $data['HomeStreet'][1] || $data['HomeCity'][1] || $data['HomeFax'][1] || $data['HomeState'][1] || $data['HomePhone'][1] || $data['HomeZip'][1] || $data['HomeMobile'][1] || $data['HomeCountry'][1] || $data['HomeWeb'][1];
        $class_00 = $class_00 ? ' class="wm_contacts_view"' : ' class="wm_hide"';
        $class_01 = $data['HomeCity'][1] || $data['HomeFax'][1] ? '' : ' class="wm_hide"';
        $data['HomeCity'][0] = $data['HomeCity'][1] != '' ? ' class="wm_contacts_view_title"' : ' class="wm_hide"';
        $data['HomeCity'][2] = $data['HomeCity'][1] != '' ? '' : ' class="wm_hide"';
        $data['HomeFax'][0] = $data['HomeFax'][1] != '' ? ' class="wm_contacts_view_title"' : ' class="wm_hide"';
        $data['HomeFax'][2] = $data['HomeFax'][1] != '' ? '' : ' class="wm_hide"';
        $class_02 = $data['HomeState'][1] || $data['HomePhone'][1] ? '' : ' class="wm_hide"';
        $data['HomeState'][0] = $data['HomeState'][1] != '' ? ' class="wm_contacts_view_title"' : ' class="wm_hide"';
//.........这里部分代码省略.........
开发者ID:diedsmiling,项目名称:busenika,代码行数:101,代码来源:base_contactedit.php

示例11: define

<?php

define('IN_FS', true);
header('Content-type: text/html; charset=utf-8');
$webdir = dirname(dirname(dirname(htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'utf-8'))));
require_once '../../header.php';
if (Cookie::has('flyspray_userid') && Cookie::has('flyspray_passhash')) {
    $user = new User(Cookie::val('flyspray_userid'));
    $user->check_account_ok();
} else {
    $user = new User(0, $proj);
}
# TODO csrftoken checking
echo TextFormatter::render(Post::val('text'));
开发者ID:canneverbe,项目名称:flyspray,代码行数:14,代码来源:getpreview.php

示例12: _onsubmit

 function _onsubmit()
 {
     global $fs, $db, $proj, $user;
     $proj = new Project(0);
     $proj->setCookie();
     $action = Post::val('action');
     list($type, $msg, $url) = $this->handle('action', $action);
     if ($type != NO_SUBMIT) {
         $fs = new Flyspray();
         $user->get_perms();
     }
     return array($type, $msg, $url);
 }
开发者ID:negram,项目名称:flyspray,代码行数:13,代码来源:admin.php

示例13: show

 function show()
 {
     global $db, $page, $fs, $proj, $do;
     $page = new FSTpl();
     $page->setTheme($proj->prefs['theme_style']);
     $page->assign('do', $do);
     $page->pushTpl('baseheader.tpl');
     $assignees = '';
     if (Get::val('onlyassignees')) {
         $assignees = 'AND (g.show_as_assignees = 1 OR g.is_admin = 1)';
     }
     $query = 'SELECT g.group_id, g.group_name, g.group_desc,
                      g.group_open, count(u.user_id) AS num_users
                 FROM {groups} g
            LEFT JOIN {users_in_groups} uig ON uig.group_id = g.group_id
            LEFT JOIN {users} u ON (uig.user_id = u.user_id ' . $assignees . ')
                WHERE g.project_id = ?
             GROUP BY g.group_id';
     $page->assign('groups', $db->x->getAll($query, null, $proj->id));
     $page->assign('globalgroups', $db->x->getAll($query, null, 0));
     // Search conditions
     $where = array();
     $params = array();
     foreach (array('user_name', 'real_name') as $key) {
         if (Post::val($key)) {
             $where[] = ' ' . $key . ' LIKE ? ';
             $params[] = '%' . Post::val($key) . '%';
         }
     }
     $where = count($where) ? implode(' OR ', $where) : '1=1';
     // fill the table with users
     if (Get::val('group_id', -1) > 0) {
         $order_keys = array('username' => 'user_name', 'realname' => 'real_name');
         $order_column = $order_keys[Filters::enum(Get::val('order', 'username'), array_keys($order_keys))];
         $sortorder = sprintf('ORDER BY %s %s, u.user_id ASC', $order_column, Filters::enum(Get::val('sort', 'desc'), array('asc', 'desc')));
         $users = $db->x->getAll('SELECT u.user_id, user_name, real_name, email_address
                                    FROM {users} u
                               LEFT JOIN {users_in_groups} uig ON uig.user_id = u.user_id
                               LEFT JOIN {groups} g ON uig.group_id = g.group_id
                                   WHERE uig.group_id = ? ' . $assignees . ' AND ( ' . $where . ' )' . $sortorder, null, array_merge(array(Get::val('group_id')), $params));
         // Offset and limit
         $user_list = array();
         $offset = max(Get::num('pagenum') - 1, 0) * 20;
         for ($i = $offset; $i < $offset + 20 && $i < count($users); $i++) {
             $user_list[] = $users[$i];
         }
         $page->assign('users', $user_list);
     } else {
         // be tricky ^^: show most assigned users
         $db->setLimit(20);
         $users = $db->x->getAll('SELECT a.user_id, u.user_name, u.real_name, email_address,
                                         count(a.user_id) AS a_count, CASE WHEN t.project_id = ? THEN 1 ELSE 0 END AS my_project
                                    FROM {assigned} a
                               LEFT JOIN {users} u ON a.user_id = u.user_id
                               LEFT JOIN {tasks} t ON a.task_id = t.task_id
                                   WHERE ( ' . $where . ' )' . ' AND u.account_enabled = 1
                                GROUP BY a.user_id
                                ORDER BY my_project DESC, a_count DESC', null, array_merge(array($proj->id), $params));
         $page->assign('users', $users);
     }
     $page->assign('usercount', count($users));
     $page->setTitle($fs->prefs['page_title'] . L('userselect'));
     $page->pushTpl('userselect.tpl');
     $page->finish();
 }
开发者ID:negram,项目名称:flyspray,代码行数:65,代码来源:userselect.php

示例14: WebMailMessage

/**
 * @param Account $account
 * @return WebMailMessage
 */
function &CreateMessageFromPost(&$account)
{
    $message =& new WebMailMessage();
    $GLOBALS[MailDefaultCharset] = $account->GetUserCharset();
    $GLOBALS[MailInputCharset] = $account->GetUserCharset();
    $GLOBALS[MailOutputCharset] = $account->GetDefaultOutCharset();
    $message->Headers->SetHeaderByName(MIMEConst_MimeVersion, '1.0');
    $message->Headers->SetHeaderByName(MIMEConst_XMailer, 'MailBee WebMail Pro PHP');
    $message->Headers->SetHeaderByName(MIMEConst_XOriginatingIp, isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0');
    $message->IdMsg = Post::val('m_id', -1);
    $message->SetPriority(Post::val('priority_input', 3));
    $message->DbPriority = Post::val('priority_input', 3);
    $message->Uid = Post::val('m_uid', '');
    $message->Headers->SetHeaderByName(MIMEConst_MessageID, '<' . substr(session_id(), 0, 7) . '.' . md5(time()) . '@' . $_SERVER['SERVER_NAME'] . '>');
    $temp = Post::val('from', '');
    if ($temp) {
        $message->SetFromAsString($temp);
    }
    $temp = Post::val('toemail', '');
    if ($temp) {
        $message->SetToAsString($temp);
    }
    $temp = Post::val('toCC', '');
    if ($temp) {
        $message->SetCcAsString($temp);
    }
    $temp = Post::val('toBCC', '');
    if ($temp) {
        $message->SetBccAsString($temp);
    }
    $temp = Post::val('subject', '');
    if ($temp) {
        $message->SetSubject($temp);
    }
    $message->SetDate(new CDateTime(time()));
    if (Post::val('ishtml', 0)) {
        $message->TextBodies->HtmlTextBodyPart = ConvertUtils::BackImagesToHtmlBody(Post::val('message', ''));
    } else {
        $message->TextBodies->PlainTextBodyPart = ConvertUtils::BackImagesToHtmlBody(Post::val('message', ''));
    }
    $attachments = Post::val('attachments');
    if ($attachments && is_array($attachments)) {
        $fs =& new FileSystem(INI_DIR . '/temp', $account->Email, $account->Id);
        $attfolder =& new Folder($account->Id, -1, Session::val('attachtempdir'));
        foreach ($attachments as $key => $value) {
            if (Session::val('attachtempdir')) {
                $attachCid = 'attach.php?tn=' . $key;
                $replaceCid = md5(time() . $value);
                $mime_type = ConvertUtils::GetContentTypeFromFileName($value);
                $message->Attachments->AddFromFile($fs->GetFolderFullPath($attfolder) . '/' . $key, $value, $mime_type, false);
                if (Post::val('ishtml', 0)) {
                    if (strpos($message->TextBodies->HtmlTextBodyPart, $attachCid) !== false) {
                        $attachment =& $message->Attachments->GetLast();
                        $attachment->MimePart->Headers->SetHeaderByName(MIMEConst_ContentID, '<' . $replaceCid . '>');
                        $message->TextBodies->HtmlTextBodyPart = str_replace($attachCid, 'cid:' . $replaceCid, $message->TextBodies->HtmlTextBodyPart);
                        $attachname = ConvertUtils::EncodeHeaderString($value, $account->GetUserCharset(), $GLOBALS[MailOutputCharset]);
                        $attachment->MimePart->Headers->SetHeaderByName(MIMEConst_ContentDisposition, MIMEConst_InlineLower . ';' . CRLF . "\t" . MIMEConst_FilenameLower . '="' . $attachname . '"', false);
                    }
                }
            }
        }
    }
    return $message;
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:68,代码来源:actions.php

示例15: BaseProcessor

 /**
  * @return BaseProcessor
  */
 function BaseProcessor()
 {
     if (!Session::has(ACCOUNT_ID)) {
         $this->SetError(1);
     }
     $accountId = Session::val(ACCOUNT_ID);
     $this->sArray = Session::val(SARRAY, array());
     $this->settings =& Settings::CreateInstance();
     if (!$this->settings || !$this->settings->isLoad) {
         $this->SetError(3);
     }
     if ($accountId) {
         if (Get::has(CHANGE_ACCID)) {
             $oldaccount =& Account::LoadFromDb(Session::val(ACCOUNT_ID, -1));
             $accountId = Get::val(CHANGE_ACCID);
             if (!isset($_SESSION['attachtempdir'])) {
                 $_SESSION['attachtempdir'] = md5(session_id());
             }
             $fs =& new FileSystem(INI_DIR . '/temp', $oldaccount->Email, $oldaccount->Id);
             $attfolder =& new Folder($oldaccount->Id, -1, $_SESSION['attachtempdir']);
             $fs->DeleteDir($attfolder);
             unset($fs, $attfolder);
             $this->sArray[ACCOUNT_ID] = $accountId;
             $this->account =& Account::LoadFromDb($accountId);
             if (!$this->account || $this->account->IdUser != $oldaccount->IdUser) {
                 $this->account = null;
             } else {
                 $_SESSION[ACCOUNT_ID] = $accountId;
                 unset($_SESSION[SARRAY]);
                 $this->sArray = array();
             }
         } else {
             $this->sArray[ACCOUNT_ID] = $accountId;
             $this->account =& Account::LoadFromDb($accountId);
         }
         if (!$this->account) {
             $this->SetError(2);
         }
     } else {
         $this->SetError(1);
     }
     if (!isset($this->sArray[ACCOUNT_ID]) || $this->sArray[ACCOUNT_ID] != $accountId) {
         $this->sArray[EDIT_ACCOUNT_ID] = $accountId;
     }
     $this->processor =& new MailProcessor($this->account);
     if (!$this->processor->DbStorage || !$this->processor->DbStorage->Connect()) {
         $this->SetError(5);
     }
     $this->db =& $this->processor->DbStorage;
     $this->accounts =& $this->GetAccounts();
     $skins =& FileSystem::GetSkinsList();
     $hasDefSettingsSkin = false;
     $normalSkin = false;
     foreach ($skins as $skinName) {
         if ($skinName == $this->settings->DefaultSkin) {
             $hasDefSettingsSkin = true;
         }
         if ($skinName == $this->account->DefaultSkin) {
             $normalSkin = true;
             break;
         }
     }
     if (!$normalSkin) {
         $this->account->DefaultSkin = $hasDefSettingsSkin ? $this->settings->DefaultSkin : ($this->account->DefaultSkin = $skins[0]);
     }
     $_SESSION[ATTACH_DIR] = Session::val(ATTACH_DIR, md5(session_id()));
     if (isset($this->sArray[SCREEN])) {
         $screen = Get::val(SCREEN, $this->sArray[SCREEN]);
         $this->sArray[SCREEN] = $screen;
         if ($this->account->AllowChangeSettings == false && ($screen == SET_ACCOUNT_PROF || $screen == SET_ACCOUNT_ADDACC)) {
             $this->sArray[SCREEN] = SCREEN_MAILBOX;
         }
         if (!$this->settings->AllowContacts && $screen == SCREEN_CONTACTS) {
             $this->sArray[SCREEN] = SCREEN_MAILBOX;
         }
     } else {
         $this->sArray[SCREEN] = Get::val(SCREEN, SCREEN_MAILBOX);
     }
     if (isset($this->sArray[FOLDER_ID])) {
         $this->sArray[FOLDER_ID] = Get::val(FOLDER_ID, $this->sArray[FOLDER_ID]);
     } else {
         $this->sArray[FOLDER_ID] = Get::val(FOLDER_ID, -1);
     }
     if (Get::has(FOLDER_ID) || Get::has(SCREEN)) {
         if (isset($this->sArray[SEARCH_ARRAY])) {
             unset($this->sArray[SEARCH_ARRAY]);
         }
     }
     if (Session::has(GOTOFOLDER)) {
         $this->sArray[GOTOFOLDER] = Session::val(GOTOFOLDER, '');
         unset($_SESSION[GOTOFOLDER]);
     }
     if (isset($this->sArray[PAGE])) {
         $this->sArray[PAGE] = Get::val(PAGE, $this->sArray[PAGE]);
     } else {
         $this->sArray[PAGE] = 1;
     }
//.........这里部分代码省略.........
开发者ID:diedsmiling,项目名称:busenika,代码行数:101,代码来源:processor.php


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