Пример #1
0
        }
    }
    //Else the token was bad, couldn't retrieve user ID
    //OR the user has already requested a validation number in past
    //Perhaps return the same validation number?
    $ret = array('success' => false, 'message' => 'Bad token or user already requested validation number.');
    echo json_encode($ret);
});
$app->post('/vote', function () use($app) {
    $validation_num = $app->request->post('validnum');
    // Validation number given to user
    $userid = $app->request->post('userspecifiedid');
    //User-specified id
    $vote = $app->request->post('vote');
    //ASCII candidate ID
    $recorded = recordVote($userid, $validation_num, $vote);
    if ($recorded) {
        $ret = array('success' => true, 'message' => "{$userid}");
    } else {
        $ret = array('success' => false, 'message' => ' ');
    }
    echo json_encode($ret);
});
$app->post('/publish', function () use($app) {
    $token = $app->request->post('token');
    $ret = array('success' => true, 'message' => 'Voting Results', 'auth' => validToken($token), 'data' => publishResults());
    echo json_encode($ret);
});
/*
*********************************************************************  
*********************************************************************  
Пример #2
0
     echo $app->enqueueMessage(JText::_('COM_DATSOGALLERY_MSG_AFTER_SUCCESS_PURCHASE'));
     GalleryHeader();
     echo dgCategories($catid);
     GalleryFooter();
     break;
 case 'cancel':
     echo $app->enqueueMessage(JText::_('COM_DATSOGALLERY_MSG_AFTER_CANCELED_ORDER'));
     GalleryHeader();
     echo dgCategories($catid);
     GalleryFooter();
     break;
 case 'notify':
     ppIpn();
     break;
 case 'vote':
     recordVote();
     break;
 case 'addtag':
     addTag();
     break;
 case 'removetag':
     removeTag();
     break;
 case 'showtags':
     showTags($id);
     break;
 case 'addtofavorites':
     addToFavorites();
     break;
 case 'editpic':
     GalleryHeader();
Пример #3
0
        $ret = array('success' => false, 'message' => "Param(s) too long.");
        echo json_encode($ret);
        return json_encode($ret);
    }
    //The following function should:
    //1. Check if validation number is in list
    //2. Check if user-specified ID is unique (gen one?)
    //3. check if candidate ID is valid (does it matter?)
    //Check if validation number is valid
    if (!verifyValidationNumber($validation_num)) {
        $ret = array('success' => false, 'message' => 'Bad validation number.');
        echo json_encode($ret);
        return json_encode($ret);
    }
    //Attempt to vote
    $recorded = recordVote($voter_id, $validation_num, $vote);
    if ($recorded) {
        $ret = array('success' => true, 'message' => "Vote recorded! Voter id is " . $voter_id);
    } else {
        $ret = array('success' => false, 'message' => 'Could not vote. Have you voted already?');
    }
});
//Deprecated, publishing will be done via cronjob
$app->post('/publish', function () use($app) {
    $token = $app->request->post('token');
    $ret = array('success' => true, 'message' => 'Voting Results', 'auth' => validToken($token), 'data' => $ctf->publishResults());
    echo json_encode($ret);
});
$app->get('/results_tabulated', function () use($app) {
    $result = mysql_query("SELECT candidate_id, COUNT(*) FROM ctf_votes GROUP BY candidate_id");
    $res_arr = mysql_fetch_array($result);
Пример #4
0
        break;
    case 'save':
        mosCache::cleanCache('com_content');
        saveContent($access);
        break;
    case 'cancel':
        cancelContent($access);
        break;
    case 'emailform':
        emailContentForm($id);
        break;
    case 'emailsend':
        emailContentSend($id);
        break;
    case 'vote':
        recordVote($url, $user_rating, $cid, $database);
        break;
    default:
        $cache->call('showBlogSection', 0, $gid, $access, $pop, $now);
        break;
}
function frontpage($gid, &$access, $pop, $now)
{
    global $database, $mainframe, $my, $Itemid;
    global $mosConfig_offset;
    $noauth = !$mainframe->getCfg('shownoauth');
    // Parameters
    $menu =& new mosMenu($database);
    $menu->load($Itemid);
    $params =& new mosParameters($menu->params);
    $orderby_sec = $params->def('orderby_sec', '');