Ejemplo n.º 1
0
function status_story_submit($vars)
{
    global $db, $main_smarty;
    if (get_misc_data('status_switch') != '1') {
        return;
    }
    $linkres = $vars['linkres'];
    if (!$linkres->id) {
        return;
    }
    $user = new User();
    $user->id = $linkres->author;
    if ($user->read()) {
        if (!status_is_allowed($user) || !$user->extra_field['status_switch'] || !$user->extra_field['status_story']) {
            return;
        }
        $main_smarty->config_load(status_lang_conf);
        $text = $main_smarty->get_config_vars('PLIGG_Status_Story_Update');
        $limit = get_misc_data('status_max_chars');
        if ($limit > 0 && strlen($text) + strlen($user->username) + strlen($linkres->title) - 4 > $limit) {
            $linkres->title = substr($linkres->title, 0, max($limit + 4 - strlen($text) - strlen($user->username) - 3, 10)) . '...';
        }
        $text = sprintf($text, $user->username, '<a href="' . $linkres->get_internal_url() . '">' . $linkres->title . '</a>');
        $db->query($sql = "INSERT INTO " . table_prefix . "updates SET update_time=UNIX_TIMESTAMP(), \r\n\t\t\t\t\t\t\t    update_type='s',\r\n\t\t\t\t\t\t\t    update_user_id='{$linkres->author}',\r\n\t\t\t\t\t\t\t    update_link_id='{$linkres->id}',\r\n\t\t\t\t\t\t\t    update_text='{$text}'\r\n\t\t\t\t\t\t\t    ");
    }
}
Ejemplo n.º 2
0
$isgod = checklevel('god');
$isadmin = checklevel('admin');
if (is_numeric($_GET['lid']) && $_GET['action'] == 'likes') {
    $results = $db->get_results("SELECT * FROM " . table_prefix . "likes WHERE like_update_id='{$_GET['lid']}'");
    $user = new User();
    foreach ($results as $row) {
        $user->id = $row->like_user_id;
        if ($user->read()) {
            print $user->username . "<br>\n";
        }
    }
    exit;
}
$user = new User();
$user->id = $current_user->user_id;
if (get_misc_data('status_switch') == '1' && $user->read() && status_is_allowed($user) && $user->extra_field['status_switch']) {
    // Post an update (reply)
    if ($_POST['status']) {
        unset($_SESSION['status_error']);
        $_SESSION['status_text'] = $_POST['status'];
        if (!$isgod) {
            $text = sanitize($_POST['status'], 3);
        } else {
            $text = mysql_real_escape_string(close_tags($_POST['status']));
        }
        // Post to a group
        if (enable_group && ($groupname = strstr($text, '!'))) {
            $groupname = substr($groupname, 1);
            // Check if user is allowed to post to the group
            $groups = $db->get_results("SELECT * FROM " . table_groups . " WHERE group_status='Enable' ORDER BY group_name DESC");
            foreach ($groups as $group) {