本文整理汇总了PHP中page::htmlentities方法的典型用法代码示例。如果您正苦于以下问题:PHP page::htmlentities方法的具体用法?PHP page::htmlentities怎么用?PHP page::htmlentities使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类page
的用法示例。
在下文中一共展示了page::htmlentities方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_link
function get_link($row = array())
{
global $TPL;
if (is_object($this)) {
return "<a href=\"" . $TPL["url_alloc_product"] . "productID=" . $this->get_id() . "\">" . $this->get_value("productName", DST_HTML_DISPLAY) . "</a>";
} else {
return "<a href=\"" . $TPL["url_alloc_product"] . "productID=" . $row["productID"] . "\">" . page::htmlentities($row["productName"]) . "</a>";
}
}
示例2: show_productSale_list
function show_productSale_list($productSaleID, $template)
{
global $TPL;
global $productSaleItemsDoExist;
$productSale = new productSale();
$productSale->set_id($productSaleID);
$productSale->select();
$productSale->set_tpl_values();
$taxName = config::get_config_item("taxName");
$product = new product();
$ops = $product->get_assoc_array("productID", "productName");
$query = prepare("SELECT *\n FROM productSaleItem \n WHERE productSaleID = %d", $productSaleID);
$db = new db_alloc();
$db->query($query);
while ($db->next_record()) {
$productSaleItemsDoExist = true;
$productSaleItem = new productSaleItem();
$productSaleItem->read_db_record($db);
$productSaleItem->set_tpl_values();
$TPL["itemSellPrice"] = $productSaleItem->get_value("sellPrice");
$TPL["itemMargin"] = $productSaleItem->get_amount_margin();
$TPL["itemSpent"] = $productSaleItem->get_amount_spent();
$TPL["itemEarnt"] = $productSaleItem->get_amount_earnt();
$TPL["itemOther"] = $productSaleItem->get_amount_other();
$TPL["itemCosts"] = page::money(config::get_config_item("currency"), product::get_buy_cost($productSaleItem->get_value("productID")) * $productSaleItem->get_value("quantity"), "%s%mo %c");
$TPL["itemTotalUnallocated"] = $productSaleItem->get_amount_unallocated();
$TPL["productList_dropdown"] = page::select_options($ops, $productSaleItem->get_value("productID"));
$TPL["productLink"] = "<a href=\"" . $TPL["url_alloc_product"] . "productID=" . $productSaleItem->get_value("productID") . "\">" . page::htmlentities($ops[$productSaleItem->get_value("productID")]) . "</a>";
$TPL["transactions"] = $productSale->get_transactions($productSaleItem->get_id());
if ($taxName) {
$TPL["sellPriceTax_check"] = sprintf(" <input type='checkbox' name='sellPriceIncTax[]' value='%d'%s> inc %s", $productSaleItem->get_id(), $productSaleItem->get_value("sellPriceIncTax") ? ' checked' : '', $taxName);
$TPL["sellPriceTax_label"] = $productSaleItem->get_value("sellPriceIncTax") ? " inc " . $taxName : " ex " . $taxName;
}
include_template($template);
}
}
示例3: get_list
public static function get_list($_FORM)
{
$current_user =& singleton("current_user");
global $TPL;
/*
* This is the definitive method of getting a list of transactions that need a sophisticated level of filtering
*
*/
$_FORM["tfIDs"] = transaction::reduce_tfs($_FORM);
// Non-admin users must specify a valid TF
if (!$current_user->have_role("admin") && !$_FORM["tfIDs"]) {
return;
}
$filter = transaction::get_list_filter($_FORM);
$debug = $_FORM["debug"];
$debug and print "\n<pre>_FORM: " . print_r($_FORM, 1) . "</pre>";
$debug and print "\n<pre>filter: " . print_r($filter, 1) . "</pre>";
$_FORM["return"] or $_FORM["return"] = "html";
$filter["prevBalance"] and $filter2[] = $filter["prevBalance"];
$filter["tfIDs"] and $filter2[] = $filter["tfIDs"];
$filter2 and $filter2[] = " (status = 'approved') ";
unset($filter["prevBalance"]);
if (is_array($filter2) && count($filter2)) {
$filter2 = " WHERE " . implode(" AND ", $filter2);
}
if (is_array($filter) && count($filter)) {
$filter = " WHERE " . implode(" AND ", $filter);
}
$_FORM["sortTransactions"] or $_FORM["sortTransactions"] = "transactionDate";
$order_by = "ORDER BY " . $_FORM["sortTransactions"];
// Determine opening balance
if (is_array($_FORM['tfIDs']) && count($_FORM['tfIDs'])) {
$q = prepare("SELECT SUM( IF(fromTfID IN (%s),-amount,amount) * pow(10,-currencyType.numberToBasic) * exchangeRate) AS balance\n FROM transaction \n LEFT JOIN currencyType ON currencyType.currencyTypeID = transaction.currencyTypeID\n " . $filter2, $_FORM['tfIDs']);
$debug and print "\n<br>QUERY: " . $q;
$db = new db_alloc();
$db->query($q);
$db->row();
$_FORM["opening_balance"] = $db->f("balance");
$running_balance = $db->f("balance");
}
$q = "SELECT *, \n (amount * pow(10,-currencyType.numberToBasic)) as amount1,\n (amount * pow(10,-currencyType.numberToBasic) * exchangeRate) as amount2,\n if(transactionModifiedTime,transactionModifiedTime,transactionCreatedTime) AS transactionSortDate,\n tf1.tfName as fromTfName,\n tf2.tfName as tfName\n FROM transaction \n LEFT JOIN currencyType ON currencyType.currencyTypeID = transaction.currencyTypeID\n LEFT JOIN tf tf1 ON transaction.fromTfID = tf1.tfID\n LEFT JOIN tf tf2 ON transaction.tfID = tf2.tfID\n " . $filter . " \n " . $order_by;
$debug and print "\n<br>QUERY2: " . $q;
$db = new db_alloc();
$db->query($q);
$for_cyber = config::for_cyber();
while ($row = $db->next_record()) {
#echo "<pre>".print_r($row,1)."</pre>";
$i++;
$t = new transaction();
if (!$t->read_db_record($db)) {
continue;
}
$print = true;
// If the destination of this TF is not the current TfID, then invert the $amount
$amount = $row["amount2"];
if (!in_array($row["tfID"], (array) $_FORM["tfIDs"])) {
$amount = -$amount;
$row["amount1"] = -$row["amount1"];
}
$row["amount"] = $amount;
$row["transactionURL"] = $t->get_url();
$row["transactionName"] = $t->get_name($_FORM);
$row["transactionLink"] = $t->get_transaction_link($_FORM);
$row["transactionTypeLink"] = $t->get_transaction_type_link() or $row["transactionTypeLink"] = $row["transactionType"];
$row["transactionSortDate"] = format_date("Y-m-d", $row["transactionSortDate"]);
$row["fromTfIDLink"] = "<a href=\"" . $TPL["url_alloc_transactionList"] . "tfID=" . $row["fromTfID"] . "\">" . page::htmlentities($row["fromTfName"]) . "</a>";
$row["tfIDLink"] = "<a href=\"" . $TPL["url_alloc_transactionList"] . "tfID=" . $row["tfID"] . "\">" . page::htmlentities($row["tfName"]) . "</a>";
if ($t->get_value("status") == "approved") {
$running_balance += $amount;
$row["running_balance"] = page::money(config::get_config_item("currency"), $running_balance, "%m %c");
}
if ($amount > 0) {
$row["amount_positive"] = page::money($row["currencyTypeID"], $row["amount1"], "%m %c");
$total_amount_positive += $amount;
} else {
$row["amount_negative"] = page::money($row["currencyTypeID"], $row["amount1"], "%m %c");
$total_amount_negative += $amount;
}
// Cyber only hackery for ext ref field on product sales
if ($for_cyber && $row["productSaleID"]) {
$ps = new productSale();
$ps->set_id($row["productSaleID"]);
if ($ps->select()) {
$ps->get_value("extRef") and $row["product"] .= " (Ext ref: " . $ps->get_value("extRef") . ")";
}
}
$transactions[$row["transactionID"]] = $row;
}
$_FORM["total_amount_positive"] = page::money(config::get_config_item("currency"), $total_amount_positive, "%s%m %c");
$_FORM["total_amount_negative"] = page::money(config::get_config_item("currency"), $total_amount_negative, "%s%m %c");
$_FORM["running_balance"] = page::money(config::get_config_item("currency"), $running_balance, "%s%m %c");
return array("totals" => $_FORM, "rows" => (array) $transactions);
}
示例4: find_email
function find_email($debug = false, $get_blobs = false, $ignore_date = false)
{
$info = inbox::get_mail_info();
$mailbox = $this->get_value("commentMaster") . $this->get_value("commentMasterID");
$mail = new email_receive($info);
$mail->open_mailbox(config::get_config_item("allocEmailFolder") . "/" . $mailbox, OP_HALFOPEN + OP_READONLY);
$mail->check_mail();
$msg_nums = $mail->get_all_email_msg_uids();
$debug and print "<hr><br><b>find_email(): " . date("Y-m-d H:i:s") . " found " . count($msg_nums) . " emails for mailbox: " . $mailbox . "</b>";
// fetch and parse email
foreach ((array) $msg_nums as $num) {
$debug and print "<hr><br>Examining message number: " . $num;
unset($mimebits);
// this will stream output
$mail->set_msg($num);
$mail->get_msg_header();
$text = $mail->fetch_mail_text();
list($from1, $e1n) = parse_email_address($mail->mail_headers["from"]);
list($from2, $e2n) = parse_email_address($this->get_value("commentCreatedUserText"));
if (!$from2 && $this->get_value("commentCreatedUser")) {
$p = new person();
$p->set_id($this->get_value("commentCreatedUser"));
$p->select();
$from2 = $p->get_value("emailAddress");
}
if (!$from2 && $this->get_value("commentCreatedUserClientContactID")) {
$p = new clientContact();
$p->set_id($this->get_value("commentCreatedUserClientContactID"));
$p->select();
$from2 = $p->get_value("clientContactEmail");
}
$text1 = str_replace(array("\\s", "\n", "\r"), "", trim($text));
$text2 = str_replace(array("\\s", "\n", "\r"), "", trim($this->get_value("comment")));
$date = format_date("U", $this->get_value("commentCreatedTime"));
$date1 = strtotime($mail->mail_headers["date"]) - 300;
$date3 = strtotime($mail->mail_headers["date"]) + 300;
similar_text($text1, $text2, $percent);
if ($percent >= 99 && ($from1 == $from2 || !$from2 || same_email_address($from1, config::get_config_item("AllocFromEmailAddress"))) && ($date > $date1 && $date < $date3 || $ignore_date)) {
$debug and print "<br><b style='color:green'>Found you! Msg no: " . $num . " in mailbox: " . $mailbox . " for commentID: " . $this->get_id() . "</b>";
foreach ((array) $mail->mail_parts as $v) {
$s = $v["part_object"];
// structure
$raw_data = imap_fetchbody($mail->connection, $mail->msg_uid, $v["part_number"], FT_UID | FT_PEEK);
$thing = $mail->decode_part($s->encoding, $raw_data);
$filename = $mail->get_parameter_attribute_value($s->parameters, "name");
$filename or $filename = $mail->get_parameter_attribute_value($s->parameters, "filename");
$filename or $filename = $mail->get_parameter_attribute_value($s->dparameters, "name");
$filename or $filename = $mail->get_parameter_attribute_value($s->dparameters, "filename");
$bits = array();
$bits["part"] = $v["part_number"];
$bits["name"] = $filename;
$bits["size"] = strlen($thing);
$get_blobs and $bits["blob"] = $thing;
$filename and $mimebits[] = $bits;
}
$mail->close();
return array($mail, $text, $mimebits);
} else {
similar_text($text1, $text2, $percent);
$debug and print "<br>TEXT: " . sprintf("%d", $text1 == $text2) . " (" . sprintf("%d", $percent) . "%)";
#$debug and print "<br>Text1:<br>".$text1."<br>* * *<br>";
#$debug and print "Text2:<br>".$text2."<br>+ + +</br>";
$debug and print "<br>FROM: " . sprintf("%d", $from1 == $from2 || !$from2 || same_email_address($from1, config::get_config_item("AllocFromEmailAddress")));
$debug and print " From1: " . page::htmlentities($from1);
$debug and print " From2: " . page::htmlentities($from2);
$debug and print "<br>DATE: " . sprintf("%d", $date > $date1 && $date < $date3) . " (" . date("Y-m-d H:i:s", $date) . " | " . date("Y-m-d H:i:s", $date1) . " | " . date("Y-m-d H:i:s", $date3) . ")";
$debug and print "<br>";
}
}
$mail->close();
return array(false, false, false);
}
示例5: client
}
$TPL["paymentMethodOptions"] = $expenseForm->get_value("paymentMethod");
$TPL["reimbursementRequiredOption"] = $rr_label;
$scr_label = "No";
if ($expenseForm->get_value("seekClientReimbursement")) {
$scr_sel = " checked";
$scr_label = "Yes";
}
$TPL["seekClientReimbursementLabel"] = $scr_label;
$seekClientReimbursementOption = "<input type=\"checkbox\" value=\"1\" name=\"seekClientReimbursement\"" . $scr_sel . ">";
$scr_hidden = "<input type=\"hidden\" name=\"seekClientReimbursement\" value=\"" . $expenseForm->get_value("seekClientReimbursement") . "\">";
$TPL["seekClientReimbursementOption"] = $scr_label . $scr_hidden;
$c = new client();
$c->set_id($expenseForm->get_value("clientID"));
$c->select();
$clientName = page::htmlentities($c->get_name());
$clientName and $TPL["printer_clientID"] = $clientName;
$TPL["field_expenseFormComment"] = $expenseForm->get_value("expenseFormComment", DST_HTML_DISPLAY);
if (is_object($expenseForm) && $expenseForm->get_id() && check_optional_allow_edit()) {
$TPL["expenseFormButtons"] .= '
<button type="submit" name="cancel" value="1" class="delete_button">Delete<i class="icon-trash"></i></button>
<button type="submit" name="save" value="1" class="save_button">Save<i class="icon-ok-sign"></i></button>
<button type="submit" name="finalise" value="1" class="save_button">To Admin<i class="icon-arrow-right"></i></button>
';
$TPL["paymentMethodOptions"] = "<select name=\"paymentMethod\">" . $paymentOptions . "</select>";
$TPL["reimbursementRequiredOption"] = $reimbursementRequiredRadios;
$TPL["seekClientReimbursementOption"] = $seekClientReimbursementOption;
$options["clientStatus"] = "Current";
$ops = client::get_list($options);
$ops = array_kv($ops, "clientID", "clientName");
$TPL["field_clientID"] = "<select name=\"clientID\"><option value=\"\">" . page::select_options($ops, $expenseForm->get_value("clientID")) . "</select>";
示例6: get_attachments
function get_attachments($entity, $id, $ops = array())
{
global $TPL;
$rows = array();
$dir = ATTACHMENTS_DIR . $entity . DIRECTORY_SEPARATOR . $id;
if (isset($id)) {
#if (!is_dir($dir)) {
#mkdir($dir, 0777);
#}
if (is_dir($dir)) {
$handle = opendir($dir);
// TODO add icons to files attachaments in general
while (false !== ($file = readdir($handle))) {
clearstatcache();
if ($file != "." && $file != "..") {
$image = get_file_type_image($dir . DIRECTORY_SEPARATOR . $file);
$row["size"] = get_filesize_label($dir . DIRECTORY_SEPARATOR . $file);
$row["path"] = $dir . DIRECTORY_SEPARATOR . $file;
$row["file"] = "<a href=\"" . $TPL["url_alloc_getDoc"] . "id=" . $id . "&entity=" . $entity . "&file=" . urlencode($file) . "\">" . $image . $ops["sep"] . page::htmlentities($file) . "</a>";
$row["text"] = page::htmlentities($file);
#$row["delete"] = "<a href=\"".$TPL["url_alloc_delDoc"]."id=".$id."&entity=".$entity."&file=".urlencode($file)."\">Delete</a>";
$row["delete"] = "<form action=\"" . $TPL["url_alloc_delDoc"] . "\" method=\"post\">\n <input type=\"hidden\" name=\"id\" value=\"" . $id . "\">\n <input type=\"hidden\" name=\"file\" value=\"" . $file . "\">\n <input type=\"hidden\" name=\"entity\" value=\"" . $entity . "\">\n <input type=\"hidden\" name=\"sbs_link\" value=\"attachments\">\n <input type=\"hidden\" name=\"sessID\" value=\"{$sessID}\">" . '<button type="submit" name="delete_file_attachment" value="1" class="delete_button">Delete<i class="icon-trash"></i></button>' . "</form>";
$row["mtime"] = date("Y-m-d H:i:s", filemtime($dir . DIRECTORY_SEPARATOR . $file));
$row["restore_name"] = $file;
$rows[] = $row;
}
}
closedir($handle);
}
is_array($rows) && usort($rows, "sort_by_mtime");
}
return $rows;
}
示例7: get_changes_list
//.........这里部分代码省略.........
$newValue = $audit['value'];
switch ($audit['field']) {
case 'created':
$changeDescription = $newValue;
break;
case 'dip':
$changeDescription = "Default parties set to " . interestedParty::abbreviate($newValue);
break;
case 'taskName':
$changeDescription = "Task name set to '{$newValue}'.";
break;
case 'taskDescription':
$changeDescription = "Task description set to <a class=\"magic\" href=\"#x\" onclick=\"\$('#audit" . $audit["auditID"] . "').slideToggle('fast');\">Show</a> <div class=\"hidden\" id=\"audit" . $audit["auditID"] . "\"><div>" . $newValue . "</div></div>";
break;
case 'priority':
$priorities = config::get_config_item("taskPriorities");
$changeDescription = sprintf('Task priority set to <span style="color: %s;">%s</span>.', $priorities[$newValue]["colour"], $priorities[$newValue]["label"]);
break;
case 'projectID':
task::load_entity("project", $newValue, $newProject);
is_object($newProject) and $newProjectLink = $newProject->get_project_link();
$newProjectLink or $newProjectLink = "<empty>";
$changeDescription = "Project changed set to " . $newProjectLink . ".";
break;
case 'parentTaskID':
task::load_entity("task", $newValue, $newTask);
if ($newValue) {
$changeDescription = sprintf("Task set to a child of %d %s.", $newTask->get_id(), $newTask->get_task_link());
} else {
$changeDescription = "Task no longer a child task.";
}
break;
case 'duplicateTaskID':
task::load_entity("task", $newValue, $newTask);
if ($newValue) {
$changeDescription = "Task set to a duplicate of " . $newTask->get_task_link();
} else {
$changeDescription = "Task is no longer a duplicate.";
}
break;
case 'personID':
$changeDescription = "Task assigned to " . $people_cache[$newValue]["name"] . ".";
break;
case 'managerID':
$changeDescription = "Task manager set to " . $people_cache[$newValue]["name"] . ".";
break;
case 'estimatorID':
$changeDescription = "Task estimator set to " . $people_cache[$newValue]["name"] . ".";
break;
case 'taskTypeID':
$changeDescription = "Task type set to " . $newValue . ".";
break;
case 'taskStatus':
$changeDescription = sprintf('Task status set to <span style="background-color:%s">%s</span>.', task::get_task_status_thing("colour", $newValue), task::get_task_status_thing("label", $newValue));
break;
case 'dateActualCompletion':
case 'dateActualStart':
case 'dateTargetStart':
case 'dateTargetCompletion':
case 'timeLimit':
case 'timeBest':
case 'timeWorst':
case 'timeExpected':
// these cases are more or less identical
switch ($audit['field']) {
case 'dateActualCompletion':
$fieldDesc = "actual completion date";
break;
case 'dateActualStart':
$fieldDesc = "actual start date";
break;
case 'dateTargetStart':
$fieldDesc = "estimate/target start date";
break;
case 'dateTargetCompletion':
$fieldDesc = "estimate/target completion date";
break;
case 'timeLimit':
$fieldDesc = "hours worked limit";
break;
case 'timeBest':
$fieldDesc = "best estimate";
break;
case 'timeWorst':
$fieldDesc = "worst estimate";
break;
case 'timeExpected':
$fieldDesc = "expected estimate";
}
if ($newValue) {
$changeDescription = "The {$fieldDesc} was set to {$newValue}.";
} else {
$changeDescription = "The {$fieldDesc} was removed.";
}
break;
}
$rows[] = "<tr><td class=\"nobr\">" . $audit["dateChanged"] . "</td><td>{$changeDescription}</td><td>" . page::htmlentities($people_cache[$audit["personID"]]["name"]) . "</td></tr>";
}
return implode("\n", $rows);
}
示例8: get_value
function get_value($dest = DST_VARIABLE, $parent = null)
{
if ($dest == DST_DATABASE) {
if (isset($this->value) && imp($this->value) || $this->empty_to_null == false) {
return "'" . db_esc($this->value) . "'";
} else {
return "NULL";
}
} else {
if ($dest == DST_HTML_DISPLAY) {
if ($this->type == "money" && imp($this->value)) {
$c = $parent->currency;
if ($this->currency && isset($parent->data_fields[$this->currency])) {
$c = $parent->get_value($this->currency);
}
if (!$c) {
alloc_error("db_field::get_value(): No currency specified for " . $parent->classname . "." . $this->name . " (currency:" . $c . ")");
} else {
if ($this->value == $parent->all_row_fields[$this->name]) {
return page::money($c, $this->value, "%mo");
}
}
}
return page::htmlentities($this->value);
} else {
return $this->value;
}
}
}
示例9: alloc_error
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* allocPSA is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with allocPSA. If not, see <http://www.gnu.org/licenses/>.
*/
require_once "../alloc.php";
$info["host"] = config::get_config_item("allocEmailHost");
$info["port"] = config::get_config_item("allocEmailPort");
$info["username"] = config::get_config_item("allocEmailUsername");
$info["password"] = config::get_config_item("allocEmailPassword");
$info["protocol"] = config::get_config_item("allocEmailProtocol");
if (!$info["host"]) {
alloc_error("Email mailbox host not defined, assuming email function is inactive.", true);
}
$email_receive = new email_receive($info);
$email_receive->open_mailbox(config::get_config_item("allocEmailFolder"), OP_HALFOPEN | OP_READONLY);
$email_receive->set_msg($_REQUEST["id"]);
$new_nums = $email_receive->get_new_email_msg_uids();
in_array($_REQUEST["id"], (array) $new_nums) and $new = true;
$mail_text = $email_receive->fetch_mail_text();
$new and $email_receive->set_unread();
// might have to "unread" the email, if it was new, i.e. set it back to new
$email_receive->close();
echo nl2br(trim(page::htmlentities($mail_text)));
示例10: array
$dont_print_these_dirs = array(".", "..", "CVS", ".hg", ".bzr", "_darcs", ".git");
// relative path
$DIR = urldecode($_POST['dir']);
// full path
$PATH = realpath(wiki_module::get_wiki_path() . $DIR) . DIRECTORY_SEPARATOR;
if (path_under_path($PATH, wiki_module::get_wiki_path()) && is_dir($PATH)) {
$files = scandir($PATH);
natcasesort($files);
$str .= "\n<ul class=\"jqueryFileTree\" style=\"display: none;\">";
// All dirs
foreach ($files as $file) {
if (!in_array($file, $dont_print_these_dirs) && is_dir($PATH . $file)) {
$str .= "\n <li class=\"directory collapsed\"><a class=\"file\" href=\"#\" rel=\"" . page::htmlentities($DIR . $file . DIRECTORY_SEPARATOR) . "\">" . page::htmlentities($file) . "</a></li>";
}
}
// All files
foreach ($files as $file) {
if (file_exists($PATH . $file) && $file != '.' && $file != '..' && !is_dir($PATH . $file) && is_readable($PATH . $file)) {
unset($extra);
!is_writable($PATH . $file) and $extra = "(ro) ";
$ext = strtolower(preg_replace('/^.*\\./', '', $file));
$str .= "\n <li class=\"file ext_{$ext} nobr\">";
$str .= "\n <a style=\"position:relative;\" class=\"file nobr\" href=\"#x\" rel=\"" . page::htmlentities($DIR . $file) . "\">" . page::htmlentities($file);
$str .= "<div class='faint nobr' style='top:0px; position:absolute;'>" . $extra . get_filesize_label($PATH . $file) . "</div></a>";
$str .= "\n </li>";
}
}
$str .= "\n</ul>";
#echo "<pre>".page::htmlentities($str)."</pre>";
echo $str;
}
示例11: format_log
function format_log($logs = array())
{
/*
We're expecting each log entry to look like this:
Hash: r2432432
Author: Alex Lance
Date: 43242432
Msg: This is the commit message
*/
$logs or $logs = array();
$rtn or $rtn = array();
foreach ($logs as $line) {
if (preg_match("/^Hash: (\\w+)/", $line, $matches)) {
$id = $matches[1];
} else {
if (preg_match("/^Author: (.*\$)/", $line, $matches)) {
$rtn[$id]["author"] = page::htmlentities(trim($matches[1]));
} else {
if (preg_match("/^Date: (.*\$)/", $line, $matches)) {
$rtn[$id]["date"] = date("Y-m-d H:i:s", page::htmlentities(trim($matches[1])));
} else {
if (preg_match("/^Msg: (.+\$)/", $line, $matches)) {
$rtn[$id]["msg"] = page::htmlentities(trim($matches[1]));
}
}
}
}
}
return $rtn;
}
示例12: draw
function draw()
{
global $TPL;
$this->draw_canvas();
$this->draw_row_header();
$this->draw_body();
$i = -7;
while (date("D", mktime(0, 0, 0, date("m"), date("d") + $i, date("Y"))) != $this->first_day_of_week) {
$i++;
}
$i = $i - $this->week_start * 7;
$sunday_day = date("d", mktime(0, 0, 0, date("m"), date("d") + $i, date("Y")));
$sunday_month = date("m", mktime(0, 0, 0, date("m"), date("d") + $i, date("Y")));
$sunday_year = date("Y", mktime(0, 0, 0, date("m"), date("d") + $i, date("Y")));
$i = 0;
$absences = $this->get_cal_absences();
$reminders = $this->get_cal_reminders();
$tasks_to_start = $this->get_cal_tasks_to_start();
$tasks_to_complete = $this->get_cal_tasks_to_complete();
// For each single week...
while ($i < $this->weeks_to_display) {
$this->draw_row();
$a = 0;
while ($a < 7) {
$dates_of_week[$this->days_of_week[$a]] = date("Y-m-d", mktime(0, 0, 0, $sunday_month, $sunday_day + 7 * $i + $a, $sunday_year));
$a++;
}
foreach ($dates_of_week as $day => $date) {
$d = new calendar_day();
#$d->set_date(date("Y-m-d", mktime(0, 0, 0, $sunday_month, $sunday_day + (7 * $i + $k), $sunday_year));
$d->set_date($date);
$d->set_links($this->get_link_new_task($date) . $this->get_link_new_reminder($date) . $this->get_link_new_absence($date));
// Tasks to be Started
$tasks_to_start[$date] or $tasks_to_start[$date] = array();
foreach ($tasks_to_start[$date] as $t) {
unset($extra);
$t["timeLimit"] and $extra = " (" . sprintf("Limit %0.1fhrs", $t["timeLimit"]) . ")";
$d->start_tasks[] = '<a href="' . $TPL["url_alloc_task"] . 'taskID=' . $t["taskID"] . '">' . page::htmlentities($t["taskName"] . $extra) . "</a>";
}
// Tasks to be Completed
$tasks_to_complete[$date] or $tasks_to_complete[$date] = array();
foreach ($tasks_to_complete[$date] as $t) {
unset($extra);
$t["timeLimit"] and $extra = " (" . sprintf("Limit %0.1fhrs", $t["timeLimit"]) . ")";
$d->complete_tasks[] = '<a href="' . $TPL["url_alloc_task"] . 'taskID=' . $t["taskID"] . '">' . page::htmlentities($t["taskName"] . $extra) . "</a>";
}
// Reminders
$reminders[$date] or $reminders[$date] = array();
foreach ($reminders[$date] as $r) {
#if (date("Y-m-d",$r["reminderTime"]) == $date) {
unset($wrap_start, $wrap_end);
if (!$r["reminderActive"]) {
$wrap_start = "<strike>";
$wrap_end = "</strike>";
}
$text = page::htmlentities($r["reminderSubject"]);
$r["reminderTime"] and $text = date("g:ia", $r["reminderTime"]) . " " . $text;
$d->reminders[] = '<a href="' . $TPL["url_alloc_reminder"] . '&step=3&reminderID=' . $r["reminderID"] . '&returnToParent=' . $this->rtp . '&personID=' . $r["personID"] . '">' . $wrap_start . $text . $wrap_end . '</a>';
#}
}
// Absences
$absences[$date] or $absences[$date] = array();
foreach ($absences[$date] as $a) {
$d->absences[] = '<a href="' . $TPL["url_alloc_absence"] . 'absenceID=' . $a["absenceID"] . '&returnToParent=' . $this->rtp . '">' . person::get_fullname($a["personID"]) . ': ' . page::htmlentities($a["absenceType"]) . '</a>';
}
$d->draw_day_html();
$k++;
}
$i++;
$this->draw_row_end();
}
$this->draw_body_end();
$this->draw_canvas_end();
}
示例13: define
<?php
/*
* Copyright (C) 2006-2011 Alex Lance, Clancy Malcolm, Cyber IT Solutions
* Pty. Ltd.
*
* This file is part of the allocPSA application <info@cyber.com.au>.
*
* allocPSA is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* allocPSA is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with allocPSA. If not, see <http://www.gnu.org/licenses/>.
*/
define("NO_REDIRECT", 1);
require_once "../alloc.php";
if ($_REQUEST["taskID"]) {
$q = prepare("SELECT taskID, taskName FROM task WHERE taskID = %d", $_REQUEST["taskID"]);
$db = new db_alloc();
$row = $db->qr($q);
echo page::htmlentities($row["taskID"] . " " . $row["taskName"]);
}
示例14: get_list
public static function get_list($_FORM = array())
{
global $TPL;
$current_user =& singleton("current_user");
list($filter, $filter2) = person::get_list_filter($_FORM);
$debug = $_FORM["debug"];
$debug and print "<pre>_FORM: " . print_r($_FORM, 1) . "</pre>";
$debug and print "<pre>filter: " . print_r($filter, 1) . "</pre>";
$_FORM["return"] or $_FORM["return"] = "html";
// Get averages for hours worked over the past fortnight and year
if ($current_user->have_perm(PERM_PERSON_READ_MANAGEMENT) && $_FORM["showHours"]) {
$t = new timeSheetItem();
list($ts_hrs_col_1, $ts_dollars_col_1) = $t->get_averages(date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 14, date("Y"))));
list($ts_hrs_col_2, $ts_dollars_col_2) = $t->get_fortnightly_average();
} else {
unset($_FORM["showHours"]);
}
// A header row
$summary .= person::get_list_tr_header($_FORM);
if (is_array($filter) && count($filter)) {
$filter = " WHERE " . implode(" AND ", $filter);
}
if (is_array($filter2) && count($filter2)) {
unset($filter["skill"]);
$filter .= " AND " . implode(" OR ", $filter2);
}
$q = "SELECT person.*\n FROM person\n LEFT JOIN proficiency ON person.personID = proficiency.personID\n " . $filter . "\n GROUP BY username\n ORDER BY firstName,surname,username";
$debug and print "Query: " . $q;
$db = new db_alloc();
$db->query($q);
while ($row = $db->next_record()) {
$p = new person();
if (!$p->read_db_record($db)) {
continue;
}
$row = $p->perm_cleanup($row);
// this is not the right way to do this - alla
$print = true;
$_FORM["showHours"] and $row["hoursSum"] = $ts_hrs_col_1[$row["personID"]];
$_FORM["showHours"] and $row["hoursAvg"] = $ts_hrs_col_2[$row["personID"]];
$row["name"] = $p->get_name();
$row["name_link"] = $p->get_link($_FORM);
$row["personActive_label"] = $p->get_value("personActive") == 1 ? "Y" : "";
if ($_FORM["showSkills"]) {
$senior_skills = $p->get_skills('Senior');
$advanced_skills = $p->get_skills('Advanced');
$intermediate_skills = $p->get_skills('Intermediate');
$junior_skills = $p->get_skills('Junior');
$novice_skills = $p->get_skills('Novice');
$skills = array();
$senior_skills and $skills[] = "<img src=\"../images/skill_senior.png\" alt=\"Senior=\"> " . page::htmlentities($senior_skills);
$advanced_skills and $skills[] = "<img src=\"../images/skill_advanced.png\" alt=\"Advanced=\"> " . page::htmlentities($advanced_skills);
$intermediate_skills and $skills[] = "<img src=\"../images/skill_intermediate.png\" alt=\"Intermediate=\"> " . page::htmlentities($intermediate_skills);
$junior_skills and $skills[] = "<img src=\"../images/skill_junior.png\" alt=\"Junior=\"> " . page::htmlentities($junior_skills);
$novice_skills and $skills[] = "<img src=\"../images/skill_novice.png\" alt=\"Novice\"> " . page::htmlentities($novice_skills);
$row["skills_list"] = implode("<br>", $skills);
}
if ($_FORM["showLinks"]) {
$row["navLinks"] = '<a href="' . $TPL["url_alloc_taskList"] . 'personID=' . $row["personID"] . '&taskView=byProject&applyFilter=1';
$row["navLinks"] .= '&dontSave=1&taskStatus=open&projectType=Current">Tasks</a> ';
has("project") and $row["navLinks"] .= '<a href="' . $TPL["url_alloc_personGraph"] . 'personID=' . $row["personID"] . '">Graph</a> ';
$row["navLinks"] .= '<a href="' . $TPL["url_alloc_taskCalendar"] . 'personID=' . $row["personID"] . '">Calendar</a> ';
$dateFrom = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 28, date("Y")));
$dateTo = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") + 1, date("Y")));
$row["navLinks"] .= '<a href="' . $TPL["url_alloc_timeSheetGraph"] . 'personID=' . $row["personID"] . '&dateFrom=' . $dateFrom . '&dateTo=' . $dateTo . '&applyFilter=1&dontSave=1">Hours</a>';
}
$summary .= person::get_list_tr($row, $_FORM);
$rows[$row["personID"]] = $row;
}
$rows or $rows = array();
if ($print && $_FORM["return"] == "array") {
return $rows;
} else {
if ($print && $_FORM["return"] == "html") {
return "<table class=\"list sortable\">" . $summary . "</table>";
} else {
if (!$print && $_FORM["return"] == "html") {
return "<table style=\"width:100%\"><tr><td colspan=\"10\" style=\"text-align:center\"><b>No People Found</b></td></tr></table>";
}
}
}
}
示例15: is_object
$TPL["statusOptions"] = page::select_options(array("pending" => "Pending", "rejected" => "Rejected", "approved" => "Approved"), $transaction->get_value("status"));
$transactionTypes = transaction::get_transactionTypes();
$TPL["transactionTypeOptions"] = page::select_options($transactionTypes, $transaction->get_value("transactionType"));
is_object($transaction) and $TPL["transactionTypeLink"] = $transaction->get_transaction_type_link();
$db = new db_alloc();
$tf = new tf();
$options = $tf->get_assoc_array("tfID", "tfName");
// Special cases for the current tfID and fromTfID
$options = add_tf($transaction->get_value("tfID"), $options, "tfIDWarning", " (warning: the TF <b>%s</b> is currently inactive)");
$options = add_tf($transaction->get_value("fromTfID"), $options, "fromTfIDWarning", " (warning: the TF <b>%s</b> is currently inactive)");
$TPL["tfIDOptions"] = page::select_options($options, $transaction->get_value("tfID"));
$TPL["fromTfIDOptions"] = page::select_options($options, $transaction->get_value("fromTfID"));
$q = "SELECT projectID as value, projectName as label FROM project WHERE projectStatus = 'Current' ORDER BY projectName";
$TPL["projectIDOptions"] = page::select_options($q, $transaction->get_value("projectID"));
$TPL["transactionModifiedUser"] = page::htmlentities(person::get_fullname($TPL["transactionModifiedUser"]));
$TPL["transactionCreatedUser"] = page::htmlentities(person::get_fullname($TPL["transactionCreatedUser"]));
$tf1 = new tf();
$tf1->set_id($TPL["tfID"]);
$tf1->select();
$TPL["tf_link"] = $tf1->get_link();
$tf2 = new tf();
$tf2->set_id($TPL["fromTfID"]);
$tf2->select();
$TPL["from_tf_link"] = $tf2->get_link();
$p = $transaction->get_foreign_object("project");
$TPL["project_link"] = $p->get_link();
$TPL["taxName"] = config::get_config_item("taxName");
if (is_object($current_user) && !$current_user->have_role("admin") && is_object($transaction) && in_array($transaction->get_value("status"), array("approved", "rejected"))) {
$TPL["main_alloc_title"] = "View Transaction - " . APPLICATION_NAME;
include_template("templates/viewTransactionM.tpl");
} else {