function vote($voter, $site_id)
{
    $settings = get_option('votesys_options');
    if ($settings['track_by_time']) {
        if (can_vote($voter, $site_id)) {
            //dadeda tasku
            add_points($voter, $settings['add_point_sk']);
            //panaikina senaji balsa mysqle
            delete_vote($voter->id, $site_id);
            //uzregistruoja nauja balsa mysqle
            create_vote($voter->id, $site_id);
        }
    } else {
        //dadeda tasku
        add_points($voter, $settings['add_point_sk']);
        //panaikina senaji balsa mysqle
        delete_vote($voter->id, $site_id);
        //uzregistruoja nauja balsa mysqle
        create_vote($voter->id, $site_id);
    }
}
Esempio n. 2
0
function route($action)
{
    global $html_main_content, $title;
    show_err();
    switch ($action) {
        case '':
            main();
            break;
        case 'user_show':
            $title = print_lg('Show all users', $_SESSION['lang']);
            user_show();
            break;
        case 'user_info':
            $title = print_lg('User info', $_SESSION['lang']);
            user_info();
            break;
        case 'show_news':
            show_news();
            break;
        case 'logout':
            logout();
            break;
        case 'add_news':
            $title = print_lg('Add news', $_SESSION['lang']);
            add_news();
            break;
        case 'registration':
            $title = print_lg('Registration', $_SESSION['lang']);
            registration();
            break;
        case 'delete_news':
            delete_news();
            break;
        case 'edit_news':
            $title = print_lg('Edit news', $_SESSION['lang']);
            edit_news();
            break;
        case 'pages':
            main();
            break;
        case 'profileview':
            $title = print_lg('You information', $_SESSION['lang']);
            profileview();
            break;
        case 'delete_user':
            delete_user();
            break;
        case 'user_delete':
            user_delete();
            break;
        case 'user_edit':
            $title = print_lg('Edit user', $_SESSION['lang']);
            user_edit();
            break;
        case 'edit_language':
            $title = print_lg('Edit language', $_SESSION['lang']);
            edit_language();
            break;
        case 'delete_comments':
            delete_comments();
            break;
        case 'delete_vote':
            delete_vote();
            break;
        default:
            $html_main_content .= print_lg('Page not found', $_SESSION['lang']);
            break;
    }
}