$outboundMessagesTable = new OutboundMessageTable($manageObj->db); //$outboundMessagesTable->testPopulate(); } echo "\n\tEnd Initializing Street Team / Facebook tables\n"; if (defined('ENABLE_CARDS')) { if ($manageObj->modifyLibrary(PATH_FACEBOOK . '/classes/', 'cards.class.php')) { // Card Table require_once PATH_FACEBOOK . '/classes/cards.class.php'; CardTable::createTable($manageObj); } } if (defined('ENABLE_ASK')) { if ($manageObj->modifyLibrary(PATH_FACEBOOK . '/classes/', 'ask.class.php')) { // Ask Tables require_once PATH_FACEBOOK . '/classes/ask.class.php'; askQuestionsTable::createTable($manageObj); askAnswersTable::createTable($manageObj); } $q = $manageObj->db->query("SHOW INDEX FROM AskQuestions;"); if ($manageObj->db->countQ($q) == 0) { $manageObj->db->query("ALTER TABLE AskQuestions ADD FULLTEXT INDEX related (question);"); } } if (defined('ENABLE_IDEAS')) { if ($manageObj->modifyLibrary(PATH_FACEBOOK . '/classes/', 'ideas.class.php')) { // Ideas Table require_once PATH_FACEBOOK . '/classes/ideas.class.php'; ideasTable::createTable($manageObj); } $q = $manageObj->db->query("SHOW INDEX FROM Ideas;"); if ($manageObj->db->countQ($q) == 0) {
function ajaxAskRecordLike($isSessionValid = false, $mode = 'question', $userid = 0, $id = 0) { if ($isSessionValid) { require_once PATH_CORE . '/classes/log.class.php'; $logObj = new log($this->db); if ($mode == 'question') { // record the like in the log $logItem = $logObj->serialize(0, $userid, 'likeQuestion', $id); $inLog = $logObj->update($logItem); if ($inLog) { $aqTable = new askQuestionsTable($this->db); $qr = $aqTable->getRowObject(); $qr->load($id); $qr->numLikes += 1; $qr->update(); $code = '<a href="#" class="voteLink" onclick="return askRecordLike(\'' . $mode . '\',' . $id . ');" title="like this question">Like</a> ' . $qr->numLikes; } else { $code = 'You already liked this!'; } } else { // mode : answer $logItem = $logObj->serialize(0, $userid, 'likeAnswer', $id); $inLog = $logObj->update($logItem); if ($inLog) { $aaTable = new askAnswersTable($this->db); $ar = $aaTable->getRowObject(); $ar->load($id); $ar->numLikes += 1; $ar->update(); $code = '<a href="#" class="voteLink" onclick="return askRecordLike(\'' . $mode . '\',' . $id . ');" title="like this question">Like</a> ' . $ar->numLikes; } else { $code = 'You already liked this!'; } } } else { $code = '<a href="' . URL_CANVAS . '?p=ask" requirelogin="******">Please authorize ' . SITE_TITLE . ' with Facebook before continuing.</a>'; } return $code; }