Пример #1
0
                        $prev = $content;
                    }
                    if ($content->priority > $config->priority && $content->priority < $succ->priority) {
                        $succ = $content;
                    }
                }
                srkSend((object) array('prev' => $prev->penId, 'succ' => $succ->penId));
            }
        }
    } elseif ($srkEnv->reqURL[2] == 'like' && $srkEnv->reqMethod == 'POST') {
        $like = new Like();
        if ($srkEnv->reqURLLength == 4) {
            $penId = $srkEnv->reqURL[4];
            $like->load($srkEnv->penPath . '/' . $penId);
        } elseif ($srkEnv->reqURLLength == 5) {
            $penId = $srkEnv->reqURL[4];
            $commentId = $srkEnv->reqURL[5];
            $like->load($srkEnv->penPath . '/' . $penId . '/comment/' . $commentId);
        }
        if ($srkEnv->reqURL[3] == 'query') {
            srkSend($like->query());
        } elseif (isset(Like::$actionMap[$srkEnv->reqURL[3]])) {
            $userId = $_SESSION['userId'];
            if (!$userId) {
                srkSend((object) array('error' => 'login'));
            } else {
                srkSend((object) array('error' => $like->click($userId, Like::$actionMap[$srkEnv->reqURL[3]])));
            }
        }
    }
}