Example #1
0
 public function run()
 {
     $contact_id = $this->request->get('contact_id', 0) or cmsCore::error404();
     $last_date = $this->request->get('last_date', '');
     $contact = $this->model->getContact($this->cms_user->id, $contact_id);
     if (!$contact) {
         $this->cms_template->renderJSON(array('error' => true));
     }
     $messages = $this->model->filterEqual('is_new', 1)->getMessagesFromContact($this->cms_user->id, $contact_id);
     if ($messages) {
         $messages_html = $this->cms_template->render('message', array('messages' => $messages, 'last_date' => $last_date, 'is_notify' => true, 'user' => $this->cms_user), new cmsRequest(array(), cmsRequest::CTX_INTERNAL));
         $this->model->setMessagesReaded($this->cms_user->id, $contact_id);
     }
     $this->cms_template->renderJSON(array('error' => false, 'contact_id' => $contact['contact_id'], 'is_online' => (int) $contact['is_online'], 'date_log' => mb_strtolower(string_date_age_max($contact['date_log'], true)), 'html' => $messages ? $messages_html : false));
 }
Example #2
0
function grid_users($controller)
{
    $options = array('is_auto_init' => false, 'is_sortable' => true, 'is_filter' => true, 'is_pagination' => true, 'is_draggable' => false, 'order_by' => 'id', 'order_to' => 'asc', 'show_id' => true);
    $columns = array('id' => array('title' => 'id', 'width' => 30, 'filter' => 'exact'), 'nickname' => array('title' => LANG_NICKNAME, 'href' => href_to($controller->name, 'users', array('edit', '{id}')), 'filter' => 'like', 'handler' => function ($nickname, $user) {
        if ($user['is_admin']) {
            $nickname = '<b class="tooltip" title="' . LANG_USER_IS_ADMIN . '">' . $nickname . '</b>';
        }
        return $nickname;
    }), 'email' => array('title' => LANG_EMAIL, 'width' => 200, 'filter' => 'like'), 'ip' => array('title' => LANG_USERS_PROFILE_LAST_IP, 'width' => 120, 'filter' => 'like', 'handler' => function ($value) {
        return '<a href="#" class="ajaxlink filter_ip tooltip" title="' . LANG_CP_USER_FIND_BYIP . '">' . $value . '</a> <a class="view_target tooltip" href="https://apps.db.ripe.net/search/query.html?searchtext=' . $value . '#resultsAnchor" target="_blank" title="' . LANG_CP_USER_RIPE_SEARCH . '"></a>';
    }), 'date_reg' => array('title' => LANG_REGISTRATION, 'width' => 80, 'filter' => 'like', 'handler' => function ($date, $user) {
        $ld = $user['is_online'] ? LANG_ONLINE : LANG_USERS_PROFILE_LOGDATE . ' ' . string_date_age_max($user['date_log'], true);
        return '<span class="tooltip" title="' . $ld . '">' . html_date($date) . '</span>';
    }), 'karma' => array('title' => LANG_KARMA, 'width' => 60, 'filter' => 'exact', 'handler' => function ($value) {
        return '<span class="' . html_signed_class($value) . '">' . html_signed_num($value) . '</span>';
    }), 'rating' => array('title' => LANG_RATING, 'width' => 60, 'filter' => 'exact'), 'is_locked' => array('title' => LANG_CP_USER_LOCKED, 'flag' => 'flag_lock', 'width' => 24, 'handler' => function ($value, $user) {
        $title = $user['is_locked'] ? $user['lock_reason'] ? $user['lock_reason'] : LANG_TO . ' ' . strip_tags(html_date($user['lock_until'])) : '';
        return '<div class="tooltip" title="' . $title . '">' . $value . '</div>';
    }));
    $actions = array(array('title' => LANG_PROFILE, 'class' => 'view tooltip', 'href' => href_to('users', '{id}')), array('title' => LANG_EDIT, 'class' => 'edit tooltip', 'href' => href_to($controller->name, 'users', array('edit', '{id}'))), array('title' => LANG_DELETE, 'class' => 'delete tooltip', 'href' => href_to($controller->name, 'users', array('delete', '{id}')), 'confirm' => LANG_CP_USER_DELETE_CONFIRM));
    return array('options' => $options, 'columns' => $columns, 'actions' => $actions);
}
Example #3
0
    echo $contact['nickname'];
    ?>
</span>
        </a>
        <?php 
    if (!$contact['is_online']) {
        ?>
            <div title="<?php 
        echo LANG_USERS_PROFILE_LOGDATE;
        ?>
" class="user_date_log">
                <?php 
        echo mb_strtolower(LANG_USERS_PROFILE_LOGDATE);
        ?>
 <span><?php 
        echo mb_strtolower(string_date_age_max($contact['date_log'], true));
        ?>
</span>
            </div>
        <?php 
    }
    ?>
        <div class="actions">
            <?php 
    echo html_button(LANG_DELETE, 'delete_msgs', 'icms.messages.deleteMsgs()', array('class' => 'button-small button_hide', 'id' => 'delete_msgs'));
    ?>
            <?php 
    if (!$contact['is_admin'] && !$contact['is_ignored']) {
        ?>
                <?php 
        echo html_button(LANG_PM_ACTION_IGNORE, 'ignore', 'icms.messages.ignoreContact(' . $contact['id'] . ')', array('class' => 'button-small'));
Example #4
0
                    <strong><?php 
echo LANG_USERS_PROFILE_REGDATE;
?>
:</strong>
                    <?php 
echo string_date_age_max($profile['date_reg'], true);
?>
                </li>

                <li>
                    <strong><?php 
echo LANG_USERS_PROFILE_LOGDATE;
?>
:</strong>
                    <?php 
echo $profile['is_online'] ? '<span class="online">' . LANG_ONLINE . '</span>' : string_date_age_max($profile['date_log'], true);
?>
                </li>

            </ul>

        </div>

    </div>

    <div id="right_column" class="column">

        <p><?php 
echo LANG_USERS_PROFILE_IS_HIDDEN;
?>
</p>
foreach ($items as $item) {
    ?>
        <li>
            <a href="<?php 
    echo href_to($item['target_url']) . "#comment_{$item['id']}";
    ?>
"><?php 
    echo html_strip($item['target_title'], 50);
    ?>
</a>
            <div><?php 
    echo html_clean($item['content_html'], 100);
    ?>
</div>
            <div class="date"><?php 
    echo string_date_age_max($item['date_pub'], true);
    ?>
</div>
        </li>
    <?php 
}
?>
</ul>
<?php 
if ($show_count < $total) {
    ?>
<a class="view_all_link" href="<?php 
    echo href_to('admin', 'controllers', array('edit', 'comments', 'comments_list'));
    ?>
?filter=is_approved=0"><?php 
    echo LANG_COMMENTS_ALL_LIST;
Example #6
0
                echo LANG_WROTE_IN_GROUP;
                ?>
                                    <a href="<?php 
                echo rel_to_href($item['parent_url']);
                ?>
"><?php 
                html($item['parent_title']);
                ?>
</a>
                                <?php 
            }
            ?>
                            </span>
                            <span class="date">
                                <?php 
            html(string_date_age_max($item['date_pub'], true));
            ?>
                            </span>
                            <?php 
            if ($ctype['is_comments']) {
                ?>
                                <span class="comments">
                                    <?php 
                if ($url) {
                    ?>
                                        <a href="<?php 
                    echo $url . '#comments';
                    ?>
" title="<?php 
                    echo LANG_COMMENTS;
                    ?>
Example #7
0
        if ($entry['comment']) {
            ?>
-multiline<?php 
        }
        ?>
">

                        <a href="<?php 
        echo $this->href_to($entry['user']['id']);
        ?>
"><?php 
        html($entry['user']['nickname']);
        ?>
</a>
                        <span class="date"><?php 
        echo string_date_age_max($entry['date_pub'], true);
        ?>
</span>

                        <?php 
        if ($entry['comment']) {
            ?>
                            <div class="comment">
                                <?php 
            html($entry['comment']);
            ?>
                            </div>
                        <?php 
        }
        ?>
                    </div>
Example #8
0
                    <strong><?php 
echo LANG_USERS_PROFILE_LOGDATE;
?>
:</strong>
                    <?php 
echo $profile['is_online'] ? '<span class="online">' . LANG_ONLINE . '</span>' : string_date_age_max($profile['date_log'], true);
?>
                </li>

                <li>
                    <strong><?php 
echo LANG_USERS_PROFILE_REGDATE;
?>
:</strong>
                    <?php 
echo string_date_age_max($profile['date_reg'], true);
?>
                </li>

                <?php 
if ($profile['inviter_id']) {
    ?>
                <li>
                    <strong><?php 
    echo LANG_USERS_PROFILE_INVITED_BY;
    ?>
:</strong>
                    <a href="<?php 
    echo href_to('users', $profile['inviter_id']);
    ?>
"><?php 
        <?php 
if ($sessions) {
    ?>
            <?php 
    foreach ($sessions as $session) {
        ?>

                <tr>
                    <td>
                        <?php 
        echo string_lang('LANG_SESS_' . $session['access_type']['type']);
        ?>
                    </td>
                    <td>
                        <?php 
        echo string_date_age_max($session['date_log'], true);
        ?>
                    </td>
                    <td>
                        <a target="_blank" href="https://apps.db.ripe.net/search/query.html?searchtext=<?php 
        echo $session['ip'];
        ?>
#resultsAnchor">
                            <?php 
        echo $session['ip'];
        ?>
                        </a>
                    </td>
                    <td>
                        <a href="<?php 
        echo $this->href_to($id, array('edit', 'sessions_delete', $session['id']));
Example #10
0
><?php 
        echo html_avatar_image($contact['avatar'], 'micro');
        ?>
</span>
                                <span class="contact_nickname"><?php 
        echo $nickname;
        ?>
</span>
                                <?php 
        if (!$contact['is_online']) {
            ?>
                                    <strong title="<?php 
            echo LANG_USERS_PROFILE_LOGDATE;
            ?>
"><?php 
            echo string_date_age_max($contact['date_log'], true);
            ?>
</strong>
                                <?php 
        }
        ?>
                                <?php 
        if ($contact['new_messages']) {
            ?>
                                    <span class="counter"><?php 
            echo $contact['new_messages'];
            ?>
</span>
                                <?php 
        }
        ?>
Example #11
0
            </a>
        </div>
        <div class="content">
            <div class="info">
                <div class="name">
                    <a class="user" href="<?php 
    echo href_to('users', $entry['user']['id']);
    ?>
"><?php 
    echo $entry['user']['nickname'];
    ?>
</a>
                </div>
                <div class="date">
                    <?php 
    echo html(string_date_age_max($entry['date_pub'], true));
    ?>
                </div>
                <div class="anchor">
                    <a href="?wid=<?php 
    echo $entry['id'];
    ?>
" title="<?php 
    echo LANG_WALL_ENTRY_ANCHOR;
    ?>
">#</a>
                </div>
            </div>
            <div class="text">
                <?php 
    echo $entry['content_html'];
Example #12
0
 public function getEntries()
 {
     $this->select('u.nickname', 'user_nickname');
     $this->select('u.avatar', 'user_avatar');
     $this->join('{users}', 'u', 'u.id = i.user_id');
     $this->select('t.description', 'description');
     $this->join('activity_types', 't', 't.id = i.type_id');
     if (!$this->order_by) {
         $this->orderBy('date_pub', 'desc');
     }
     $this->useCache("activity.entries");
     return $this->get('activity', function ($item, $model) {
         $item['user'] = array('id' => $item['user_id'], 'nickname' => $item['user_nickname'], 'avatar' => $item['user_avatar']);
         if (!empty($item['subject_url'])) {
             $max_title_len = 50;
             $item['subject_title'] = mb_strlen($item['subject_title']) > $max_title_len ? mb_substr($item['subject_title'], 0, $max_title_len) . '...' : $item['subject_title'];
             $link = '<a href="' . $item['subject_url'] . '">' . $item['subject_title'] . '</a>';
         } else {
             $link = $item['subject_title'];
         }
         $item['images'] = cmsModel::yamlToArray($item['images']);
         if ($item['images']) {
             $config = cmsConfig::getInstance();
             $images_exist = array();
             foreach ($item['images'] as $idx => $image) {
                 if (mb_substr($image['src'], 0, 7) != 'http://') {
                     if (!file_exists($config->upload_path . '/' . $image['src'])) {
                         continue;
                     }
                     $image['src'] = $config->upload_host . '/' . $image['src'];
                 }
                 $images_exist[] = $image;
             }
             $item['images'] = $images_exist;
         }
         $item['description'] = sprintf($item['description'], $link);
         $item['date_diff'] = string_date_age_max($item['date_pub'], true);
         return $item;
     });
 }
Example #13
0
                    <span class="<?php 
echo html_signed_class($group['rating']);
?>
"><?php 
echo $group['rating'];
?>
</span>
                </li>

                <li>
                    <strong><?php 
echo LANG_GROUP_INFO_CREATED_DATE;
?>
:</strong>
                    <?php 
echo string_date_age_max($group['date_pub'], true);
?>
                </li>
                <li>
                    <strong><?php 
echo LANG_GROUP_INFO_OWNER;
?>
:</strong>
                    <a href="<?php 
echo href_to('users', $group['owner_id']);
?>
"><?php 
html($group['owner_nickname']);
?>
</a>
                </li>