示例#1
0
 function checkOne($item)
 {
     $item['action_ip'] = $item['action_ip'] ? get_client_ip(1) : null;
     foreach ($item as $k => $v) {
         if (empty($v)) {
             unset($item[$k]);
         }
     }
     unset($k, $v);
     $time = time();
     $map['action_list'] = array(array('like', '%[' . $item['action'] . ']%'), '', 'or');
     $map['status'] = 1;
     $limitList = D('ActionLimit')->getList($map);
     !empty($item['action']) && ($item['action_id'] = M('action')->where(array('name' => $item['action']))->getField('id'));
     foreach ($limitList as &$val) {
         $ago = get_time_ago($val['time_unit'], $val['time_number'], $time);
         $item['create_time'] = array('egt', $ago);
         $log = M('action_log')->where($item)->order('create_time desc')->select();
         if (count($log) >= $val['frequency']) {
             $punishes = explode(',', $val['punish']);
             foreach ($punishes as $punish) {
                 //执行惩罚
                 if (method_exists($this, $punish)) {
                     $this->{$punish}($item, $val);
                 }
             }
             unset($punish);
             if ($val['if_message']) {
                 D('Message')->sendMessageWithoutCheckSelf($item['user_id'], L('_SYSTEM_MESSAGE_'), $val['message_content'], $_SERVER['HTTP_REFERER']);
             }
         }
     }
     unset($val);
 }
 public function waitAnswer($page = 1, $r = 20)
 {
     $map['status'] = 1;
     $map['update_time'] = array('gt', get_time_ago('month', 1));
     $map['best_answer'] = 0;
     list($list, $totalCount) = $this->questionModel->getListPageByMap($map, $page, 'create_time desc', $r, '*');
     foreach ($list as &$val) {
         $val['info'] = msubstr(op_t($val['description']), 0, 200);
         $val['img'] = get_pic($val['description']);
         $val['user'] = query_user(array('uid', 'space_url', 'nickname'), $val['uid']);
     }
     unset($val);
     $this->assign('list', $list);
     $this->assign('totalCount', $totalCount);
     $this->assign('current', 'waitAnswer');
     $this->display();
 }
示例#3
0
            /* determine row color */
            $color = @$number++ % 2 == 0 ? "#d3dce3" : "#dddddd";
            /* start row */
            print "<tr>\n";
            /* do number/author */
            print "<td bgcolor=\"{$color}\">\n";
            print "<strong>{$number}</strong> : \n";
            $row["author"] = preg_replace('/\\"/', '', $row["author"]);
            $row["author"] = htmlspecialchars($row["author"]);
            print $row["author"] . "\n";
            print "</td>\n";
            /* do type */
            print "<td bgcolor=\"{$color}\"><a href=\"index.php?m=ticketsmith&a=view&ticket=" . $row["ticket"] . "\">" . $AppUI->_($row["type"]) . "</a></td>\n";
            /* do timestamp */
            print "<td bgcolor=\"{$color}\">\n";
            print get_time_ago($row["timestamp"]);
            print "</td>\n";
            /* end row */
            print "</tr>\n";
        }
        print "</table>\n";
    } else {
        print "<em>" . $AppUI->_('none') . "</em>\n";
    }
    print "</td>\n</tr>\n";
} else {
    /* get peer followups */
    $results = do_query("SELECT ticket, type FROM tickets WHERE parent = '{$ticket_parent}' ORDER BY ticket " . $CONFIG["followup_order"]);
    /* parse followups */
    while ($row = result2hash($results)) {
        $peer_tickets[] = $row["ticket"];
示例#4
0
function format_field($value, $type, $ticket = NULL)
{
    global $CONFIG;
    global $AppUI;
    global $canEdit;
    switch ($type) {
        case "user":
            if ($value) {
                $output = query2result("SELECT CONCAT_WS(' ',contact_first_name,contact_last_name) as name FROM users u LEFT JOIN contacts ON u.user_contact = contact_id WHERE user_id = '{$value}'");
            } else {
                $output = "-";
            }
            break;
        case "status":
            if ($canEdit) {
                $output = create_selectbox("type_toggle", array("Open" => $AppUI->_("Open"), "Processing" => $AppUI->_("Processing"), "Closed" => $AppUI->_("Closed"), "Deleted" => $AppUI->_("Deleted")), $value);
            } else {
                $output = chooseSelectedValue("type_toggle", array("Open" => $AppUI->_("Open"), "Processing" => $AppUI->_("Processing"), "Closed" => $AppUI->_("Closed"), "Deleted" => $AppUI->_("Deleted")), $value);
            }
            break;
        case "priority_view":
            $priority = $CONFIG["priority_names"][$value];
            $color = $CONFIG["priority_colors"][$value];
            if ($value == 3) {
                $priority = "<strong>{$priority}</strong>";
            }
            if ($value == 4) {
                $priority = "<blink><strong>{$priority}</strong></blink>";
            }
            $output = "<font color=\"{$color}\">{$priority}</font>";
            break;
        case "priority_select":
            if ($canEdit) {
                $output = create_selectbox("priority_toggle", $CONFIG["priority_names"], $value);
            } else {
                $output = chooseSelectedValue("priority_toggle", $CONFIG["priority_names"], $value);
            }
            break;
        case "assignment":
            $options[0] = "-";
            $query = "SELECT user_id as id, CONCAT_WS(' ',contact_first_name,contact_last_name) as name FROM users u LEFT JOIN contacts ON u.user_contact = contact_id ORDER BY name";
            $result = do_query($query);
            while ($row = result2hash($result)) {
                $options[$row["id"]] = $row["name"];
            }
            if ($canEdit) {
                $output = create_selectbox("assignment_toggle", $options, $value);
            } else {
                $output = chooseSelectedValue("assignment_toggle", $options, $value);
            }
            break;
        case "view":
            if ($CONFIG["index_link"] == "latest") {
                $latest_value = query2result("SELECT ticket FROM tickets WHERE parent = '{$value}' ORDER BY ticket DESC LIMIT 1");
                if ($latest_value) {
                    $value = $latest_value;
                }
            }
            $output = "<a href=index.php?m=ticketsmith&a=view&ticket={$value}>{$value}&nbsp;";
            $output .= "<img src=images/icons/pencil.gif border=0></a>";
            break;
        case "attach":
            $output = "<A href=index.php?m=ticketsmith&a=attach&ticket={$value}>";
            $output .= "Link</a>";
            break;
        case "doattach":
            $output = "<A href=index.php?m=ticketsmith&a=attach&newparent={$value}&dosql=reattachticket&ticket={$ticket}>";
            $output .= "Link</a>";
            break;
        case "open_date":
            $output = get_time_ago($value);
            if ($CONFIG["warning_active"]) {
                if (time() - $value > $CONFIG["warning_age"] * 3600) {
                    $output = "<font color=\"" . $CONFIG["warning_color"] . "\"><xb>" . $output . "</strong></font>";
                }
            }
            break;
        case "activity_date":
            if (!$value) {
                $output = "<em>" . $AppUI->_('none') . "</em>";
            } else {
                $output = get_time_ago($value);
            }
            $latest_followup_type = query2result("SELECT type FROM tickets WHERE parent = '{$ticket}' ORDER BY timestamp DESC LIMIT 1");
            if ($latest_followup_type) {
                $latest_followup_type = preg_replace("/(\\w+)\\s.*/", "\\1", $latest_followup_type);
                $output .= " [{$latest_followup_type}]";
            }
            break;
        case "elapsed_date":
            $output = date($CONFIG["date_format"], $value);
            $time_ago = get_time_ago($value);
            $output .= " <em>({$time_ago})</em>";
            break;
        case "body":
            if ($CONFIG["wordwrap"]) {
                $value = word_wrap($value, 78);
            }
            $value = htmlspecialchars($value);
            $output = "<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"10\">\n";
            $output .= "<tr><td bgcolor=\"" . $CONFIG["ticket_color"] . "\">\n<tt><pre>\n";
            $url_find = "/(http|https|ftp|news|telnet|finger)(:\\/\\/[^ \">\\t\\r\\n]*)/";
            $url_replace = "<a href=\"\\1\\2\" target=\"new\">";
            $url_replace .= "<span style=\"font-size: 10pt;\">\\1\\2</span></a>";
            $value = preg_replace($url_find, $url_replace, $value);
            $output .= stripslashes($value);
            $output .= "\n</pre></tt>\n</td></tr>\n</table>\n";
            break;
        case "followup":
            $output = "\n<tt>\n";
            $output .= "<textarea style='font-family: monospace;' name=\"followup\" wrap=\"hard\" cols=\"72\" rows=\"20\">\n";
            $signature = query2result("SELECT user_signature FROM users WHERE user_id = '{$AppUI->user_id}'");
            if ($signature) {
                $output .= "\n";
                $output .= "-- \n";
                $output .= $signature;
            }
            $output .= "\n\n";
            $output .= "---- " . $AppUI->_('Original message') . " ----\n\n";
            if ($CONFIG["wordwrap"]) {
                $value = word_wrap($value, 70, true);
            }
            $value = htmlspecialchars($value);
            $output .= $value;
            $output .= "\n</textarea>\n";
            $output .= "</tt>\n";
            break;
        case "subject":
            $value = preg_replace("/\\s*Re:\\s*/i", "", $value);
            $value = preg_replace("/(\\[\\#\\d+\\])(\\w+)/", "\\2", $value);
            $value = "Re: " . $value;
            $value = htmlspecialchars($value);
            @($output .= "<input type=\"text\" name=\"subject\" value=\"{$value}\" size=\"70\">\n");
            break;
        case "cc":
            $value = htmlspecialchars($value);
            $output = "<input type=\"text\" name=\"cc\" value=\"{$value}\" size=\"70\">";
            break;
        case "recipient":
            $value = htmlspecialchars($value);
            $output = "<input type=\"text\" name=\"recipient\" value=\"{$value}\" size=\"70\">";
            break;
        case "original_author":
            if ($value) {
                $value = preg_replace('/\\"/', '', $value);
                $output = htmlspecialchars($value);
            } else {
                $output = "<em>(" . $AppUI->_('original ticket author') . ")</em>";
            }
            break;
        case "email":
            if ($value) {
                $value = preg_replace('/\\"/', '', $value);
                $output = htmlspecialchars($value);
            } else {
                $output = "<em>" . $AppUI->_('none') . "</em>";
            }
            break;
        case 'ticket_company':
            $q = new DBQuery();
            $q->addTable('companies');
            $q->addQuery('companies.*');
            $q->addWhere('companies.company_id = ' . $value);
            $sql = $q->prepare();
            if (!db_loadObject($sql, $obj)) {
                // it all dies!
            }
            $output = '<a href="index.php?m=companies&a=view&company_id=' . $value . '">' . $obj->company_name . '</a>';
            break;
        case 'ticket_project':
            $q = new DBQuery();
            $q->addTable('projects');
            $q->addQuery('projects.*');
            $q->addWhere('projects.project_id = ' . $value);
            $sql = $q->prepare();
            if (!db_loadObject($sql, $obj)) {
                // it all dies!
            }
            $output = '<a href="index.php?m=projects&a=view&project_id=' . $value . '">' . $obj->project_name . '</a>';
            break;
        default:
            $output = $value ? htmlspecialchars($value) : "<em>" . $AppUI->_('none') . "</em>";
    }
    return $output;
}
示例#5
0
		<?php 
if ($comment->comment_approved == '0') {
    ?>
			<div class="moderation notice">
				<?php 
    _e('Awaiting Moderation.', 'groundup');
    ?>
			</div>
		<?php 
}
echo get_comment_text();
?>
	</section>
	<footer>
		<time datetime="<?php 
echo comment_date('c');
?>
"><a href="<?php 
echo htmlspecialchars(get_comment_link($comment->comment_ID));
?>
"><?php 
echo get_time_ago(get_comment_time('U'));
?>
</a></time>
		<?php 
edit_comment_link('<i class="icon-pencil"></i> ' . __('edit', 'groundup'), '', '');
comment_reply_link(array_merge($args, array('reply_text' => 'reply', 'depth' => $depth, 'max_depth' => $args['max_depth'])), $comment->comment_ID);
?>
	</footer>
<?php 
// </li> is automatically added by the walker
示例#6
0
<?php

/**
 * @package groundup
 * @filters:
 *	groundup_image_count
 *	groundup_exif
 */
?>
<time class="updated" datetime="<?php 
echo get_the_time('c');
?>
"><?php 
echo get_time_ago(get_the_time('U'));
?>
</time>
<?php 
// Comments
$comment_count = get_comment_count($post->ID);
if (comments_open() && $comment_count['approved'] > 0) {
    comments_popup_link('', __('1 Comment', 'groundup'), __('% Comments', 'groundup'), 'meta comments');
}
// Image Count
$image_count = get_image_count($post->ID);
if ($image_count > 0) {
    ?>
	<span class="meta image-count"><?php 
    echo apply_filters('groundup_image_count', $image_count . ' images');
    ?>
</span>
<?php 
示例#7
0
文件: view.php 项目: n2i/xvnkb
    echo '<td align="left" valign="top">';
    /* grab followups */
    $query = "SELECT ticket, type, timestamp, author FROM tickets WHERE parent = '{$ticket}' ORDER BY ticket " . $CONFIG["followup_order"];
    $result = do_query($query);
    echo '<table id="idFollowups" width="100%" border="0" cellspacing="0" cellpadding="5" class="list">';
    if (number_rows($result)) {
        /* print followups */
        while ($row = result2hash($result)) {
            $action = "location.href='index.php?m=ticketsmith&a=view&ticket={$row['ticket']}'";
            echo '<tr class="' . (@$number++ % 2 == 0 ? 'first' : 'second') . '" onclick="' . $action . '" style="cursor: pointer">';
            echo '<td width="16" align="center">' . $number . '</td>';
            $row['author'] = ereg_replace('"', "", $row['author']);
            $row['author'] = htmlspecialchars($row['author']);
            echo '<td>' . $row['author'] . '</td>';
            echo '<td>' . $AppUI->_($row['type']) . '</td>';
            echo '<td>' . get_time_ago($row["timestamp"]) . '</td>';
            echo '</tr>';
        }
    } else {
        echo '<tr><td><em>' . $AppUI->_('none') . '</em></td></tr>';
    }
    echo '</table>';
    if ($number > 0) {
        echo '<script>Table("idFollowups").setNormalHover();</script>';
    }
    echo '</td></tr>';
} else {
    /* get peer followups */
    $results = do_query("SELECT ticket, type FROM tickets WHERE parent = '{$ticket_parent}' ORDER BY ticket " . $CONFIG["followup_order"]);
    /* parse followups */
    while ($row = result2hash($results)) {