Ejemplo n.º 1
0
/**
 * feed_get_actions
 */
function feed_get_actions($pListHash)
{
    global $gBitDb;
    $whereSql = '';
    $bindVars = array();
    BitBase::prepGetList($pListHash);
    if (!empty($pListHash['user_id'])) {
        $whereSql = " WHERE lal.user_id = ? ";
        $bindVars[] = $pListHash['user_id'];
    } else {
        $whereSql = "WHERE 1=1 ";
    }
    $query = "SELECT lal.content_id, lal.user_id, lal.log_message, MAX(lal.last_modified) AS last_modified, uu.login, uu.real_name, uu.email\n\t\t\t  FROM liberty_action_log lal\n\t\t\t  INNER JOIN liberty_content lc ON (lc.content_id=lal.content_id)\n\t\t\t  INNER JOIN users_users uu ON (uu.user_id=lal.user_id)\n\t\t\t  {$whereSql} AND lc.content_type_guid != 'feedstatus'\n\t\t\t  GROUP BY lal.content_id, lal.user_id, uu.login, uu.real_name, uu.email, lal.log_message\n\t\t\t  ORDER BY MAX(lal.last_modified) DESC";
    $res = $gBitDb->query($query, $bindVars, $pListHash['max_records']);
    $conjugationQuery = "SELECT * FROM feed_conjugation";
    $overrides = $gBitDb->getAssoc($conjugationQuery);
    $actions = array();
    //loop through directed actions
    while ($action = $res->fetchRow()) {
        if (!empty($action['content_id'])) {
            //indicates that this isn't a direct action, more of a "status update" ex. "Ronald is pleased with his artwork"
            if ($content = LibertyContent::getLibertyObject($action['content_id'])) {
                $contentType = $content->getContentType();
                $action['real_log'] = BitUser::getDisplayNameFromHash(empty($pListHash['no_link_user']), $action) . ' ';
                if (!empty($overrides[strtolower($contentType)])) {
                    $action['real_log'] .= $overrides[$contentType]['conjugation_phrase'];
                    if ($overrides[$contentType]['is_target_linked'] == 'y') {
                        $action['real_log'] .= ' <a href="' . $content->getDisplayUrl() . '">' . $content->getTitle() . '</a>';
                    }
                    if (!empty($overrides[$contentType]['feed_icon_url'])) {
                        $action['feed_icon_url'] = $overrides[$contentType]['feed_icon_url'];
                    }
                } else {
                    $action['real_log'] .= tra('edited') . ' <a href="' . $content->getDisplayUrl() . '">' . $content->getTitle() . '</a>';
                }
            } else {
                unset($action);
                //invalid content_id
            }
            if (empty($action['feed_icon_url'])) {
                $action['feed_icon_url'] = FEED_PKG_URL . 'icons/pixelmixerbasic/pencil_16.png';
            }
            $actions[] = $action;
        }
    }
    return $actions;
}
Ejemplo n.º 2
0
 $gStructure = new LibertyStructure($_REQUEST["structure_id"]);
 $gStructure->load();
 // order matters for these conditionals
 if (empty($gStructure) || !$gStructure->isValid()) {
     $gBitSystem->fatalError(tra('Invalid structure'));
 }
 if ($gStructure->mInfo['root_structure_id'] == $gStructure->mInfo['structure_id']) {
     $rootStructure =& $gStructure;
 } else {
     $rootStructure = new LibertyStructure($gStructure->mInfo['root_structure_id']);
     $rootStructure->load();
     $rootStructure->loadNavigation();
     $rootStructure->loadPath();
 }
 if (empty($gContent)) {
     $gContent = LibertyContent::getLibertyObject($gStructure->getField('content_id'));
     $gContent->verifyUpdatePermission();
 }
 $gBitSmarty->assign_by_ref('gStructure', $gStructure);
 $gBitSmarty->assign('editingStructure', TRUE);
 $gBitSmarty->assign('structureInfo', $gStructure->mInfo);
 // Store the actively stored structure name
 $gBitUser->storePreference('edit_structure_name', $rootStructure->mInfo['title']);
 $gBitUser->storePreference('edit_structure_id', $rootStructure->mStructureId);
 if (isset($_REQUEST["action"]) && $_REQUEST["action"] == 'remove' || !empty($_REQUEST["confirm"])) {
     $gBitUser->verifyTicket();
     if ($_REQUEST["action"] == 'remove' && ($gBitThemes->isAjaxRequest() || !empty($_REQUEST["confirm"]))) {
         $gBitUser->verifyTicket();
         if ($gStructure->removeStructureNode($_REQUEST["structure_id"], false)) {
             if ($gBitThemes->isAjaxRequest()) {
                 $feedback['success'] = tra("removed from") . ' ' . $gContent->getContentTypeName();