Exemple #1
0
                }
            }
            if (strnatcmp($waka['posts'][$p]['dateUsersTouched'], $_REQUEST['d']) > 0) {
                $c = count($out);
                $out[$c]['html'] = renderAvatar($waka['posts'][$p]);
                $out[$c]['location'] = 'post_' . $waka['posts'][$p]['id'] . '_avatar';
                $out[$c]['type'] = 'changed';
                if ($user['type'] == 'editor' && userMayEdit($user['email'], $waka['posts'][$p]['users'])) {
                    $c = count($out);
                    $out[$c]['html'] = renderItemUsersForm($waka['posts'][$p], $waka['users'], 'post_' . $waka['posts'][$p]['id']);
                    $out[$c]['location'] = 'post_' . $waka['posts'][$p]['id'] . '_users_form';
                    $out[$c]['type'] = 'changed';
                }
            }
            if (strnatcmp($waka['posts'][$p]['dateCommentsTouched'], $_REQUEST['d']) > 0) {
                $c = count($out);
                $out[$c]['html'] = renderItemComments($waka['posts'][$p], $user, 'post_' . $waka['posts'][$p]['id']);
                $out[$c]['location'] = 'post_' . $waka['posts'][$p]['id'] . '_comments';
                $out[$c]['type'] = 'changed';
            }
        }
    }
    for ($p2 = 0; $p2 < count($oldplist); $p2++) {
        $out[$p2]['location'] = 'post_' . $oldplist[$p2];
        $out[$p2]['type'] = 'deleted';
    }
    //writeWaka($waka,$_REQUEST['w']);
    $data['out'] = $out;
    $data['dateNow'] = $dateNow;
    echo json_encode($data);
}
Exemple #2
0
function renderPost($post, $users, $user)
{
    $permitted = false;
    if ($user['type'] == 'editor' && userMayEdit($user['email'], $post['users'])) {
        $permitted = true;
    }
    $email = $user['email'];
    $str = '';
    $str .= '<div class="post_avatar" id="post_' . $post['id'] . '_avatar">';
    $str .= renderAvatar($post);
    $str .= '</div>';
    $str .= '<div class="post_wrapper" id="post_wrapper_' . $post['id'] . '"><div class="post_small_gradient" style="display:none" id="post_small_gradient_' . $post['id'] . '" onclick="minmaxPost(\'' . $post['id'] . '\');"></div><div class="post_meta"><a href="javascript:minmaxPost(\'' . $post['id'] . '\')" style="text-decoration:none;">[' . $post['id'] . '] <small><b><span class="time" utctime="' . convert_datetime($post['dateCreated']) . '">' . $post['dateCreated'] . ' (UTC)</span></b>';
    $str .= '</small></a>';
    if ($permitted) {
        $str .= '<div class="postEditSwitch" id="postEditSwitch_' . $post['id'] . '_on"><a href="javascript:switchPostEdit(\'' . $post['id'] . '\')"><img src="img/Actions-document-edit-icon-1.png"></a></div>';
    }
    if ($permitted) {
        $str .= '<div class="postEditSwitch" id="postEditSwitch_' . $post['id'] . '_off" style="display:none;"><a href="javascript:switchPostEdit(\'' . $post['id'] . '\')"><img src="img/Actions-application-exit-icon-1.png"></a></div>';
    }
    $str .= '</div>';
    $str .= '<div class="post_display" id="post_' . $post['id'] . '_display">';
    $str .= '<div class="post_content" id="post_' . $post['id'] . '_content">';
    $str .= renderItemContent($post, 'post_' . $post['id']);
    $str .= '</div><div class="post_images" id="post_' . $post['id'] . '_images">';
    $str .= renderItemImages($post, 'post_' . $post['id']);
    $str .= '</div><div class="post_files" id="post_' . $post['id'] . '_files">';
    $str .= renderItemFiles($post, 'post_' . $post['id']);
    $str .= '</div>';
    $str .= '</div>';
    if ($permitted) {
        $str .= '<div class="post_form" id="post_' . $post['id'] . '_form" style="display:none;">';
        $str .= '<div class="post_content_form" id="post_' . $post['id'] . '_content_form">';
        $str .= renderItemContentForm($post, 'post_' . $post['id']);
        $str .= '</div><div class="post_images_form" id="post_' . $post['id'] . '_images_form">';
        $str .= renderItemImagesForm($post, 'post_' . $post['id']);
        $str .= '</div><div class="post_files_form" id="post_' . $post['id'] . '_files_form">';
        $str .= renderItemFilesForm($post, 'post_' . $post['id']);
        $str .= '</div><div class="post_users_form" id="post_' . $post['id'] . '_users_form">';
        $str .= renderItemUsersForm($post, $users, 'post_' . $post['id']);
        $str .= '</div>';
        $str .= '</div>';
    }
    if ($user['type'] != 'public') {
        $str .= '<div class="post_comments" id="post_' . $post['id'] . '_comments">';
        $str .= renderItemComments($post, $user, 'post_' . $post['id']);
        $str .= '</div>';
    }
    //$str.= '</div>';
    $str .= '</div>';
    $str .= '<div style="clear: both;"></div>';
    return $str;
}