Esempio n. 1
0
function format_targets($targets, $conf_keywords)
{
    if (empty($targets)) {
        return [];
    }
    foreach ($targets as &$item) {
        $item['账户名'] = get_user_selected($conf_keywords, $item['账户名']);
        $item['网页标题关键字'] = get_user_selected($conf_keywords, $item['网页标题关键字']);
        $item['提交框关键字'] = get_user_selected($conf_keywords, $item['提交框关键字']);
        $item['购物车关键字'] = get_user_selected($conf_keywords, $item['购物车关键字']);
        $item['收藏夹关键字'] = get_user_selected($conf_keywords, $item['收藏夹关键字']);
        $item['来访停留秒数区间'] = get_ranges($item['来访停留秒数区间']);
        $item['来访次数区间'] = get_ranges($item['来访次数区间']);
        $item['总页面浏览数区间'] = get_ranges($item['总页面浏览数区间']);
        $item['页面浏览数区间'] = get_ranges($item['页面浏览数区间']);
        $item['便携设备'] = get_bool(@$item['便携设备'], '移动设备');
        $item['首访用户'] = get_bool(@$item['首访用户'], '首次访问');
        $item['首日用户'] = get_bool(@$item['首日用户'], '首日来访');
        $item['首访第一页'] = get_bool(@$item['首访第一页'], '第一页');
        $item['已注册'] = get_bool(@$item['已注册'], '已注册');
    }
    return $targets;
}
Esempio n. 2
0
 public function watch($id)
 {
     $topic = Topic::findOrFail($id);
     $state = get_bool(Request::input('watch'));
     $privName = 'ForumTopicWatch' . ($state ? 'Add' : 'Remove');
     $type = 'watch';
     priv_check($privName, $topic)->ensureCan();
     TopicWatch::toggle($topic, Auth::user(), $state);
     switch (Request::input('page')) {
         case 'manage':
             $topics = Topic::watchedByUser(Auth::user())->get();
             $topicReadStatus = TopicTrack::readStatus(Auth::user(), $topics);
             // there's currently only destroy action from watch index
             return js_view('forum.topic_watches.destroy', compact('topic', 'topics', 'topicReadStatus'));
         default:
             return js_view('forum.topics.replace_button', compact('topic', 'type', 'state'));
     }
 }
Esempio n. 3
0
function get_param_value($input, $type)
{
    switch ($type) {
        case 'bool':
            return get_bool($input);
            break;
        case 'int':
            return get_int($input);
            break;
        case 'file':
            return get_file($input);
            break;
        case 'string_split':
            return get_arr(explode("\r\n", $input), 'presence');
            break;
        case 'string[]':
            return get_arr($input, 'presence');
            break;
        case 'int[]':
            return get_arr($input, 'get_int');
            break;
        default:
            return presence((string) $input);
    }
}