Exemple #1
0
 $query = DB::query("SELECT * FROM " . DB::table('poll_setting'));
 while ($row = DB::fetch($query)) {
     $setting[$row['skey']] = $row['svalue'];
 }
 $customlang = array('poll_vote_error', 'poll_per_once', 'poll_limittime_short', 'poll_vote_succeed');
 if (!submitcheck('settingsubmit')) {
     $avaliable = DB::result_first("SELECT available FROM " . DB::table('common_module') . " WHERE identifier='poll'");
     shownav('poll', 'nav_poll_setting');
     showsubmenu('nav_poll_setting');
     showformheader('poll&operation=setting');
     showtableheader('nav_basic', 'fixpadding');
     showsetting('poll_module_available', 'settingnew[available]', $avaliable, 'radio');
     showtablefooter();
     showtableheader('customlang', 'fixpadding');
     foreach ($customlang as $langvar) {
         showsetting($langvar, "settingnew[{$langvar}]", customlang($langvar, null, $setting, 'poll/message'), 'text');
     }
     showsubmit('settingsubmit');
     showtablefooter();
     showformfooter();
 } else {
     if ($_G['gp_settingnew']) {
         $available = !empty($_G['gp_settingnew']['available']) ? 1 : 0;
         DB::update('common_module', array('available' => $available), array('identifier' => 'poll'));
         foreach ($customlang as $langvar) {
             $langnew = $_G['gp_settingnew'][$langvar];
             DB::query("REPLACE INTO " . DB::table('poll_setting') . " (skey, svalue) VALUES ('{$langvar}', '{$langnew}')");
         }
     }
     updatecache('modulelist');
     updatecache('poll_setting', 'poll');
Exemple #2
0
function checkinlastdate($lastdate, $check = 'cookie')
{
    global $_G, $poll_setting;
    $lastdate = intval($lastdate);
    $limittime = intval($poll_setting['limittime']) * 60;
    if ($lastdate && empty($poll_setting['limittime'])) {
        if (!empty($poll_setting['errordetail'])) {
            $customlang = customlang('poll_per_once', null, $_G['cache']['poll_setting'], 'poll/message');
            showmessage($customlang);
        } else {
            $customlang = customlang('poll_vote_error', null, $_G['cache']['poll_setting'], 'poll/message');
            showmessage($customlang);
        }
    } elseif (intval($_G['timestamp'] - $lastdate) < $limittime) {
        if (!empty($poll_setting['errordetail'])) {
            $utime = dgmdate($lastdate + $limittime, 'u');
            $check = lang('poll/message', 'poll_repeattype_' . $check);
            $customlang = customlang('poll_limittime_short', array('check' => $check, 'utime' => $utime), $_G['cache']['poll_setting'], 'poll/message');
            showmessage($customlang);
        } else {
            $customlang = customlang('poll_vote_error', null, $_G['cache']['poll_setting'], 'poll/message');
            showmessage($customlang);
        }
    }
}