403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/abricos.chatgpt/admin/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/abricos.chatgpt/admin/chatgpt_setup.php
<?php
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_before.php");
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_after.php");
if (!CModule::IncludeModule("abricos.chatgpt"))
die;
$profileID=intval($_POST['PROFILE_ID']);

if(CModule::IncludeModuleEx('abricos.chatgpt')==3) echo GetMessage('DEMO_OFF');
if ($strErrorMessage <> '' and !empty($strErrorMessage))
		ShowError($strErrorMessage);


	if($_GET['ACTION']=='DELETE')
	{
	 CAgent::RemoveAgent("AgentChatgpt(" .$_GET['PROFILE_ID'].");", "abricos.chatgpt");
	 if($_GET['PROFILE_ID'] and is_numeric($_GET['PROFILE_ID']))
	 {
	  $insSql ="DELETE FROM `abricos_chatgpt_profile` WHERE `id`=".$DB->ForSql($_GET['PROFILE_ID']).";";
	  $resIns = $DB->Query($insSql, false, __LINE__);
	 }
    }
	if($_POST['ACTION']=='SAVE')
	{
		$strErrorMessage='';

	    if(!$_POST['SETUP_PROFILE_NAME'])
	       $strErrorMessage.= GetMessage('EXPORT_NO_NAME').'<br>';
		if(isset($_POST['SETUP_FIELDS_LIST']))
			{
				$massVar=explode(',',$_POST['SETUP_FIELDS_LIST']);
				$SETUP_VARS='';
				foreach ($massVar as $val)
				{
					if($val=='V')
					{
						$i=0;
						foreach ($_POST[$val] as $valCat)
						{
							$SETUP_VARS .=$val.'['.$i.']='.$valCat.'&';
							$i++;
						}
					}
					elseif($val=='CHATGPT_PROP')
					{
						$z=0;
						foreach ($_POST[$val] as $valP)
						{
							$SETUP_VARS .=$val.'['.$z.']='.$valP.'&';
							$z++;
						}
					}
					else
					$SETUP_VARS .=$val.'='.$_POST[$val].'&';
				}
				$SETUP_VARS=substr($SETUP_VARS, 0, -1);
				
				if($_POST['PROFILE_ID'])
				{
					$insSql ="UPDATE `abricos_chatgpt_profile` SET `name_prof`='".$DB->ForSql($_POST['SETUP_PROFILE_NAME'])."',`period`=".intval($periodAgent).",`SETUP_VARS`='".$DB->ForSql($SETUP_VARS)."' where `id`=".$_POST['PROFILE_ID'];
				  $res = $DB->Query($insSql, false, __LINE__);
				}
				else
				{
					$arFields = array(
			            "name_prof"  => "'".$_POST['SETUP_PROFILE_NAME']."'",
			            "period"  => 60,
			            "SETUP_VARS"  => "'".$SETUP_VARS."'"
			            );
					$ID = $DB->Insert("abricos_chatgpt_profile", $arFields, __LINE__);
	            }

				if ($resIns)
					$strErrorMessage= GetMessage('EXPORT_OK').'<br>';
	           
			}

	}
    elseif($_GET['ACTION']=='EXPORT_EDIT' OR $_GET['ACTION']=='NEW')
    {
    if($_GET['VAR']=='EDITCAT')
		require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/abricos.chatgpt/load/edit_category.php");
	elseif($_GET['VAR']=='NEWEL')
		require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/abricos.chatgpt/load/new_element.php");
	else
		require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/abricos.chatgpt/load/chatgpt_setup.php");
    }
    elseif ($_GET["ACTION"]=="START")
	{
		if($_GET['PROFILE_ID'])
	    {
		  CAgent::RemoveAgent("AgentChatgpt(" .$_GET['PROFILE_ID'].");", "abricos.chatgpt");
		  CAgent::AddAgent("AgentChatgpt(".$_GET['PROFILE_ID'].");","abricos.chatgpt","N", 60, "", "Y");
		  $insSql ="UPDATE `abricos_chatgpt_profile` SET `action`='START' where `id`=".$DB->ForSql($_GET['PROFILE_ID']).";";
		  $res = $DB->Query($insSql, false, __LINE__);
	    }
	}
	elseif ($_GET["ACTION"]=="STOP")
	{
		if($_GET['PROFILE_ID'])
	    {
		  	CAgent::RemoveAgent("AgentChatgpt(" .$_GET['PROFILE_ID'].");", "abricos.chatgpt");
			$insSql ="UPDATE `abricos_chatgpt_profile` SET `action`='STOP' where `id`=".$DB->ForSql($_GET['PROFILE_ID']).";";
		    $res = $DB->Query($insSql, false, __LINE__);
	    }
	}
if($_GET['ACTION']!='EXPORT_EDIT' and $_GET['ACTION']!='NEW') {?>
<style>
.ui-btn-primary{
    float: right;
    margin: 10px 0;
}
</style>
						<div class="ui-btn-split ui-btn-primary">
							<a href="?lang=ru&STEP=1&ACT_FILE=chatgpt&ACTION=NEW&VAR=EDITEL" class="ui-btn-main">
								<?=GetMessage('CES_ADD_PROFILE')?>	</a>
							<button onclick="BX.adminList.ShowMenu(this, [{'LINK':'?lang=ru&STEP=1&ACT_FILE=chatgpt&ACTION=NEW&VAR=EDITEL','ICONCLASS':'btn_new','ID':'create_new_product_button_','TEXT':'<?=GetMessage('EDITEL')?>','TITLE':'<?=GetMessage('EDITEL')?>'	,'SHOW_TITLE':true},
{'LINK':'?lang=ru&STEP=1&ACT_FILE=chatgpt&ACTION=NEW&VAR=EDITCAT','TEXT':'<?=GetMessage('EDITCAT')?>','TITLE':'<?=GetMessage('EDITCAT')?>','SHOW_TITLE':true},

]);" class="ui-btn-extra adm-list-table-popup-active"></button>
						</div>
<table class="adm-list-table" id="tbl_sale_order">
	<thead>
				<tr class="adm-list-table-header">
             <td class="adm-list-table-cell">
				<div class="adm-list-table-cell-inner"><?=GetMessage('CES_PROFILE_DELETE')?></div>
			</td>
			<td class="adm-list-table-cell">
				<div class="adm-list-table-cell-inner">ID</div>
			</td>
			<td class="adm-list-table-cell" >
				<div class="adm-list-table-cell-inner"><?=GetMessage('CES_PROFILE')?></div>
			</td>
			<td class="adm-list-table-cell">
				<div class="adm-list-table-cell-inner"><?=GetMessage('CES_EDIT_PROFILE')?></div>
			</td>
            <td class="adm-list-table-cell">
				<div class="adm-list-table-cell-inner"><?=GetMessage('CES_RUN_EXPORT')?></div>
			</td>

				</tr>
	</thead>
	<tbody>

<?
		global $DB;
		\Bitrix\Main\UI\Extension::load("ui.buttons");
		$strSql ="SELECT * FROM `abricos_chatgpt_profile`;";
		$res = $DB->Query($strSql, false, $err_mess.__LINE__);
		while ($row = $res->Fetch())
			{
			 $var=CAbricosChatgptLib::prepareVars($row["SETUP_VARS"]);
			 if(!$var['VAR']) $var['VAR']='EDITEL';
			?>

				<tr class="adm-list-table-row">
				<td class="adm-list-table-cell" width='50'><a href="?lang=ru&ACT_FILE=chatgpt&ACTION=DELETE&PROFILE_ID=<?=$row['id']?>">&#10006;</a></td>
			<td class="adm-list-table-cell" width='50'><?=$row['id']?></td>
			<td class="adm-list-table-cell"><?=$row['name_prof']?></td>
			<td class="adm-list-table-cell"><a href="?lang=ru&STEP=1&ACT_FILE=chatgpt&ACTION=EXPORT_EDIT&PROFILE_ID=<?=$row['id']?>&VAR=<?=$var['VAR']?>"><?=GetMessage('CES_EDIT_PROFILE')?></a></td>
            <? if($row['action']=='STOP' or empty($row['action']))
				{
				  $actMes=GetMessage('CES_RUN_EXPORT');
				  $actMesStatus=GetMessage('CES_STOP_EXP');
				  $act='START';
				}
			  if($row['action']=='START')
			  {
				  $act='STOP';
				  $actMesStatus=GetMessage('CES_START_EXPORT');
				  $actMes=GetMessage('CES_STOP_EXPORT');
			  }
				  ?>
			<td class="adm-list-table-cell">
			
			<?=$actMesStatus?>&nbsp;&nbsp;<a href="?lang=ru&ACT_FILE=chatgpt&ACTION=<?=$act?>&PROFILE_ID=<?=$row['id']?>"><?=$actMes?></a></td>

            </tr>
			<?}?>
             </table>
		<?

}
	require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin.php");
?>

Youez - 2016 - github.com/yon3zu
LinuXploit