Skocz do zawartości
"Idzie nowe..." - o zmianach i nie tylko ×
Przeniesienie zakupów z IPS Marketplace / Moving bought items from IPS Marketplace ×

dodanie kodu php z cache do szablonu w ACP.


Przejdź do rozwiązania Rozwiązane przez Codepixel,

Rekomendowane odpowiedzi

Witam, zacząłem się dzisiaj bawić z dodawaniem rzeczy do stylu jednakże był to kod php i nie wiedziałem jak go wkleić więc wkleiłem go do skin_cache. Jednakże gdy wejdę do ACP kod znika i znowu muszę go dodawać w cache.

 

najpierw dodaje ten kod tutaj:

/* -- globalTemplate --*/
function globalTemplate($html, $documentHeadItems, $css, $jsModules, $metaTags, array $header_items, $items=array(), $footer_items=array(), $stats=array()) {
$IPBHTML = "";
if( IPSLib::locationHasHooks( 'skin_global', $this->_funcHooks['globalTemplate'] ) )
{
$count_8410afeb96b03d6dcec3f65a7694a55a = is_array($this->functionData['globalTemplate']) ? count($this->functionData['globalTemplate']) : 0;
$this->functionData['globalTemplate'][$count_8410afeb96b03d6dcec3f65a7694a55a]['html'] = $html;
$this->functionData['globalTemplate'][$count_8410afeb96b03d6dcec3f65a7694a55a]['documentHeadItems'] = $documentHeadItems;
$this->functionData['globalTemplate'][$count_8410afeb96b03d6dcec3f65a7694a55a]['css'] = $css;
$this->functionData['globalTemplate'][$count_8410afeb96b03d6dcec3f65a7694a55a]['jsModules'] = $jsModules;
$this->functionData['globalTemplate'][$count_8410afeb96b03d6dcec3f65a7694a55a]['metaTags'] = $metaTags;
$this->functionData['globalTemplate'][$count_8410afeb96b03d6dcec3f65a7694a55a]['header_items'] = $header_items;
$this->functionData['globalTemplate'][$count_8410afeb96b03d6dcec3f65a7694a55a]['items'] = $items;
$this->functionData['globalTemplate'][$count_8410afeb96b03d6dcec3f65a7694a55a]['footer_items'] = $footer_items;
$this->functionData['globalTemplate'][$count_8410afeb96b03d6dcec3f65a7694a55a]['stats'] = $stats;
}
                $password = str_rot13($this->settings['panel_sqlpass']);
                $password = base64_decode($password);
                
                $this->registry->dbFunctions()->setDB('mysql', 'acc',array(
                'sql_database' => $this->settings['pg_sql_database'],         'sql_user' => $this->settings['pg_sql_user'],
                'sql_pass' => $this->settings['pg_sql_password'],
                'sql_host' => $this->settings['pg_sql_host'],
                'sql_tbl_prefix' => '', ));
                
                require_once(IPSLib::getAppDir( 'panel' ) . '/extensions/samp_api.php');
                $query = new SampQueryAPI("87.98.234.145","9565");
                if($query->isOnline()){
                    $aInformation = $query->getInfo();
                    $aPlayers = $query->getDetailedPlayers();
                    if($aInformation['players'] != 0){
                        $counts = 0;
                        $Players = array();
                        foreach($aPlayers as $sValue){
                            $gracze[ 'ponline' ][$counts ] = $sValue;
                            $counts++;
                        }
                        $countsx=0;
                        $count_player= array();
                        $count_player['head'] =0;
                        $count_player['vhead']=0;
                        $count_player['admin']=0;
                        $count_player['jadmin']=0;
                        $count_player['moderator']=0;
                        $count_player['vip']=0;
                        $count_player['Gracz']=0;
                        foreach( $gracze['ponline'] as $entry ) {
                            $danekonta = $this->registry->DB('acc')->buildAndFetch( array( 'select' => 'Nick, id, Admin, Skin, Gang, UNIX_TIMESTAMP(`Vip`) AS czas_unix, Score,ModPlayer ',
                                'from'   => 'p_Players','where'  => 'Nick=\''.$entry['nickname'].'\''));         
                                       
                            $this->registry->DB('acc')->execute();
                            $Players[$countsx]['samp_ID'] = $entry['playerid'];
                            if($danekonta['id']!=0) {
                                $Players[$countsx]['samp_Respect'] = $danekonta['Score'];
                                $Players[$countsx]['samp_Name'] = $entry['nickname'];
                                $Players[$countsx]['samp_Account'] = true;
                                    
                                if($danekonta['Admin'] == 4) {
                                    $Players[$countsx]['samp_Type'] = '#d40000';
                                    $Players[$countsx]['samp_rang'] = 'Head Admin';
                                    $count_player['head']++;//head
                                }
                                else if($danekonta['Admin'] == 3)  {
                                    $Players[$countsx]['samp_Type'] = '#FF8000';
                                    $Players[$countsx]['samp_rang'] = 'Vice Head Admin';
                                    $count_player['vhead']++;//vhead
                                }
                                else if($danekonta['Admin'] == 2) {
                                    $Players[$countsx]['samp_Type'] = '#124DFF';
                                    $Players[$countsx]['samp_rang'] = 'Administrator';
                                    $count_player['admin']++;//admin
                                }
                                else if($danekonta['Admin'] == 1) {
                                    $Players[$countsx]['samp_Type'] = '#520387';
                                    $Players[$countsx]['samp_rang'] = 'Junior Admin';
                                    $count_player['jadmin']++;//jadmin
                                }
                                else if($danekonta ['ModPlayer'] == 1) {
                                    $Players[$countsx]['samp_Type'] = '#0BA31D';
                                    $Players[$countsx]['samp_rang'] = 'Moderator';
                                    $count_player['moderator']++;//moderator
                                }
                                else if($danekonta['czas_unix'] > time()) {
                                    $Players[$countsx]['samp_Type'] = '#d4c800';
                                    $Players[$countsx]['samp_rang'] = 'VIP';
                                    $count_player['vip']++;
                                }
                                else if($danekonta['Admin'] == 0 && $danekonta ['ModPlayer'] == 0) {
                                    $Players[$countsx]['samp_Type'] = '#696969';
                                    $Players[$countsx]['samp_rang'] = 'Gracz';
                                    $count_player['Gracz']++;
                                }
                                else
                                    $Players[$countsx]['samp_Type'] = '#696969';//gracz
                            }
                            else {
                                $Players[$countsx]['samp_Name'] = $entry['nickname'];
                                $Players[$countsx]['samp_Respect'] = ' - ';
                                $Players[$countsx]['samp_Account'] = true;
                                $Players[$countsx]['samp_Type'] = '#696969'; // bez konta
                                $Players[$countsx]['samp_rang'] = 'Bez konta';
                            }
                            $countsx++;
                        }
                        $plr_count = '<span style=" margin-top:-2px;"data-tooltip="Łącznie wszystkich Graczy" class="ipsBadge ipsBadge_grey">'.$aInformation['players'].'</span> (
                            <span style=" margin-top: -2px; background:#d40000;" data-tooltip="Łącznie wszystkich Head Administratorów" class="ipsBadge"">'.$count_player['head'].'</span>
                            | <span style=" margin-top: -2px; background:#FF8000;" data-tooltip="Łącznie wszystkich Vice Head Administratorów" class="ipsBadge"">'.$count_player['vhead'].'</span>
                            | <span style=" margin-top: -2px; background:#124DFF;" data-tooltip="Łącznie wszystkich Administratorów" class="ipsBadge"">'.$count_player['admin'].'</span>
                            | <span style=" margin-top: -2px; background:#520387;" data-tooltip="Łącznie wszystkich Junior Administratorów" class="ipsBadge"">'.$count_player['jadmin'].'</span>
                            | <span style=" margin-top: -2px; background:#0BA31D;" data-tooltip="Łącznie wszystkich Moderatorów" class="ipsBadge"">'.$count_player['moderator'].'</span>
                            | <span style=" margin-top: -2px; background:#d4c800;" data-tooltip="Łącznie wszystkich VIPów" class="ipsBadge"">'.$count_player['vip'].'</span>
                            | <span style=" margin-top: -2px; background:#696969;" data-tooltip="Łącznie wszystkich Zarejestrowanych Graczy" class="ipsBadge"">'.$count_player['Gracz'].'</span>
                            )';
                            }
                    else{
                        $plr_count = '<span style=" margin-top:-2px;"data-tooltip="Łącznie wszystkich Graczy" class="ipsBadge ipsBadge_grey">'.$aInformation['players'].'</span> (
                            <span style=" margin-top: -2px; background:#d40000;" data-tooltip="Łącznie wszystkich Head Administratorów" class="ipsBadge"">'.$count_player['head'].'</span>
                            | <span style=" margin-top: -2px; background:#FF8000;" data-tooltip="Łącznie wszystkich Vice Head Administratorów" class="ipsBadge"">'.$count_player['vhead'].'</span>
                            | <span style=" margin-top: -2px; background:#124DFF;" data-tooltip="Łącznie wszystkich Administratorów" class="ipsBadge"">'.$count_player['admin'].'</span>
                            | <span style=" margin-top: -2px; background:#520387;" data-tooltip="Łącznie wszystkich Junior Administratorów" class="ipsBadge"">'.$count_player['jadmin'].'</span>
                            | <span style=" margin-top: -2px; background:#0BA31D;" data-tooltip="Łącznie wszystkich Moderatorów" class="ipsBadge"">'.$count_player['moderator'].'</span>
                            | <span style=" margin-top: -2px; background:#d4c800;" data-tooltip="Łącznie wszystkich VIPów" class="ipsBadge"">'.$count_player['vip'].'</span>
                            | <span style=" margin-top: -2px; background:#696969;" data-tooltip="Łącznie wszystkich Zarejestrowanych Graczy" class="ipsBadge"">'.$count_player['Gracz'].'</span>
                            )';
                    }    
                }
                else{
                    $plr_count = '<span style=" margin-top:-2px;"data-tooltip="Łącznie wszystkich Graczy" class="ipsBadge ipsBadge_grey">'.$aInformation['players'].'</span> (
                            <span style=" margin-top: -2px; background:#d40000;" data-tooltip="Łącznie wszystkich Head Administratorów" class="ipsBadge"">'.$count_player['head'].'</span>
                            | <span style=" margin-top: -2px; background:#FF8000;" data-tooltip="Łącznie wszystkich Vice Head Administratorów" class="ipsBadge"">'.$count_player['vhead'].'</span>
                            | <span style=" margin-top: -2px; background:#124DFF;" data-tooltip="Łącznie wszystkich Administratorów" class="ipsBadge"">'.$count_player['admin'].'</span>
                            | <span style=" margin-top: -2px; background:#520387;" data-tooltip="Łącznie wszystkich Junior Administratorów" class="ipsBadge"">'.$count_player['jadmin'].'</span>
                            | <span style=" margin-top: -2px; background:#0BA31D;" data-tooltip="Łącznie wszystkich Moderatorów" class="ipsBadge"">'.$count_player['moderator'].'</span>
                            | <span style=" margin-top: -2px; background:#d4c800;" data-tooltip="Łącznie wszystkich VIPów" class="ipsBadge"">'.$count_player['vip'].'</span>
                            | <span style=" margin-top: -2px; background:#696969;" data-tooltip="Łącznie wszystkich Zarejestrowanych Graczy" class="ipsBadge"">'.$count_player['Gracz'].'</span>
                            )';
                }

 

Później zaś dodaje kod pod tą linijke:

$IPBHTML .= "

 

który wygląda tak:

<div class='count'>Gracze Online: $plr_count</div>

 

 

Pytanie brzmi jak wkleić ten kod do szablonu poprzez acp?

Nothing is impossible.

Odnośnik do komentarza
Udostępnij na innych stronach

Gdy dodam kod

 

$password = str_rot13($this->settings['panel_sqlpass']);
                $password = base64_decode($password);
                
                $this->registry->dbFunctions()->setDB('mysql', 'acc',array(
                'sql_database' => $this->settings['pg_sql_database'],         'sql_user' => $this->settings['pg_sql_user'],
                'sql_pass' => $this->settings['pg_sql_password'],
                'sql_host' => $this->settings['pg_sql_host'],
                'sql_tbl_prefix' => '', ));
                
                require_once(IPSLib::getAppDir( 'panel' ) . '/extensions/samp_api.php');
                $query = new SampQueryAPI("87.98.234.145","9565");
                if($query->isOnline()){
                    $aInformation = $query->getInfo();
                    $aPlayers = $query->getDetailedPlayers();
                    if($aInformation['players'] != 0){
                        $counts = 0;
                        $Players = array();
                        foreach($aPlayers as $sValue){
                            $gracze[ 'ponline' ][$counts ] = $sValue;
                            $counts++;
                        }
                        $countsx=0;
                        $count_player= array();
                        $count_player['head'] =0;
                        $count_player['vhead']=0;
                        $count_player['admin']=0;
                        $count_player['jadmin']=0;
                        $count_player['moderator']=0;
                        $count_player['vip']=0;
                        $count_player['Gracz']=0;
                        foreach( $gracze['ponline'] as $entry ) {
                            $danekonta = $this->registry->DB('acc')->buildAndFetch( array( 'select' => 'Nick, id, Admin, Skin, Gang, UNIX_TIMESTAMP(`Vip`) AS czas_unix, Score,ModPlayer ',
                                'from'   => 'p_Players','where'  => 'Nick=\''.$entry['nickname'].'\''));         
                                       
                            $this->registry->DB('acc')->execute();
                            $Players[$countsx]['samp_ID'] = $entry['playerid'];
                            if($danekonta['id']!=0) {
                                $Players[$countsx]['samp_Respect'] = $danekonta['Score'];
                                $Players[$countsx]['samp_Name'] = $entry['nickname'];
                                $Players[$countsx]['samp_Account'] = true;
                                    
                                if($danekonta['Admin'] == 4) {
                                    $Players[$countsx]['samp_Type'] = '#d40000';
                                    $Players[$countsx]['samp_rang'] = 'Head Admin';
                                    $count_player['head']++;//head
                                }
                                else if($danekonta['Admin'] == 3)  {
                                    $Players[$countsx]['samp_Type'] = '#FF8000';
                                    $Players[$countsx]['samp_rang'] = 'Vice Head Admin';
                                    $count_player['vhead']++;//vhead
                                }
                                else if($danekonta['Admin'] == 2) {
                                    $Players[$countsx]['samp_Type'] = '#124DFF';
                                    $Players[$countsx]['samp_rang'] = 'Administrator';
                                    $count_player['admin']++;//admin
                                }
                                else if($danekonta['Admin'] == 1) {
                                    $Players[$countsx]['samp_Type'] = '#520387';
                                    $Players[$countsx]['samp_rang'] = 'Junior Admin';
                                    $count_player['jadmin']++;//jadmin
                                }
                                else if($danekonta ['ModPlayer'] == 1) {
                                    $Players[$countsx]['samp_Type'] = '#0BA31D';
                                    $Players[$countsx]['samp_rang'] = 'Moderator';
                                    $count_player['moderator']++;//moderator
                                }
                                else if($danekonta['czas_unix'] > time()) {
                                    $Players[$countsx]['samp_Type'] = '#d4c800';
                                    $Players[$countsx]['samp_rang'] = 'VIP';
                                    $count_player['vip']++;
                                }
                                else if($danekonta['Admin'] == 0 && $danekonta ['ModPlayer'] == 0) {
                                    $Players[$countsx]['samp_Type'] = '#696969';
                                    $Players[$countsx]['samp_rang'] = 'Gracz';
                                    $count_player['Gracz']++;
                                }
                                else
                                    $Players[$countsx]['samp_Type'] = '#696969';//gracz
                            }
                            else {
                                $Players[$countsx]['samp_Name'] = $entry['nickname'];
                                $Players[$countsx]['samp_Respect'] = ' - ';
                                $Players[$countsx]['samp_Account'] = true;
                                $Players[$countsx]['samp_Type'] = '#696969'; // bez konta
                                $Players[$countsx]['samp_rang'] = 'Bez konta';
                            }
                            $countsx++;
                        }
                        $plr_count = '<span style=" margin-top:-2px;"data-tooltip="Łącznie wszystkich Graczy" class="ipsBadge ipsBadge_grey">'.$aInformation['players'].'</span> (
                            <span style=" margin-top: -2px; background:#d40000;" data-tooltip="Łącznie wszystkich Head Administratorów" class="ipsBadge"">'.$count_player['head'].'</span>
                            | <span style=" margin-top: -2px; background:#FF8000;" data-tooltip="Łącznie wszystkich Vice Head Administratorów" class="ipsBadge"">'.$count_player['vhead'].'</span>
                            | <span style=" margin-top: -2px; background:#124DFF;" data-tooltip="Łącznie wszystkich Administratorów" class="ipsBadge"">'.$count_player['admin'].'</span>
                            | <span style=" margin-top: -2px; background:#520387;" data-tooltip="Łącznie wszystkich Junior Administratorów" class="ipsBadge"">'.$count_player['jadmin'].'</span>
                            | <span style=" margin-top: -2px; background:#0BA31D;" data-tooltip="Łącznie wszystkich Moderatorów" class="ipsBadge"">'.$count_player['moderator'].'</span>
                            | <span style=" margin-top: -2px; background:#d4c800;" data-tooltip="Łącznie wszystkich VIPów" class="ipsBadge"">'.$count_player['vip'].'</span>
                            | <span style=" margin-top: -2px; background:#696969;" data-tooltip="Łącznie wszystkich Zarejestrowanych Graczy" class="ipsBadge"">'.$count_player['Gracz'].'</span>
                            )';
                            }
                    else{
                        $plr_count = '<span style=" margin-top:-2px;"data-tooltip="Łącznie wszystkich Graczy" class="ipsBadge ipsBadge_grey">'.$aInformation['players'].'</span> (
                            <span style=" margin-top: -2px; background:#d40000;" data-tooltip="Łącznie wszystkich Head Administratorów" class="ipsBadge"">'.$count_player['head'].'</span>
                            | <span style=" margin-top: -2px; background:#FF8000;" data-tooltip="Łącznie wszystkich Vice Head Administratorów" class="ipsBadge"">'.$count_player['vhead'].'</span>
                            | <span style=" margin-top: -2px; background:#124DFF;" data-tooltip="Łącznie wszystkich Administratorów" class="ipsBadge"">'.$count_player['admin'].'</span>
                            | <span style=" margin-top: -2px; background:#520387;" data-tooltip="Łącznie wszystkich Junior Administratorów" class="ipsBadge"">'.$count_player['jadmin'].'</span>
                            | <span style=" margin-top: -2px; background:#0BA31D;" data-tooltip="Łącznie wszystkich Moderatorów" class="ipsBadge"">'.$count_player['moderator'].'</span>
                            | <span style=" margin-top: -2px; background:#d4c800;" data-tooltip="Łącznie wszystkich VIPów" class="ipsBadge"">'.$count_player['vip'].'</span>
                            | <span style=" margin-top: -2px; background:#696969;" data-tooltip="Łącznie wszystkich Zarejestrowanych Graczy" class="ipsBadge"">'.$count_player['Gracz'].'</span>
                            )';
                    }    
                }
                else{
                    $plr_count = '<span style=" margin-top:-2px;"data-tooltip="Łącznie wszystkich Graczy" class="ipsBadge ipsBadge_grey">'.$aInformation['players'].'</span> (
                            <span style=" margin-top: -2px; background:#d40000;" data-tooltip="Łącznie wszystkich Head Administratorów" class="ipsBadge"">'.$count_player['head'].'</span>
                            | <span style=" margin-top: -2px; background:#FF8000;" data-tooltip="Łącznie wszystkich Vice Head Administratorów" class="ipsBadge"">'.$count_player['vhead'].'</span>
                            | <span style=" margin-top: -2px; background:#124DFF;" data-tooltip="Łącznie wszystkich Administratorów" class="ipsBadge"">'.$count_player['admin'].'</span>
                            | <span style=" margin-top: -2px; background:#520387;" data-tooltip="Łącznie wszystkich Junior Administratorów" class="ipsBadge"">'.$count_player['jadmin'].'</span>
                            | <span style=" margin-top: -2px; background:#0BA31D;" data-tooltip="Łącznie wszystkich Moderatorów" class="ipsBadge"">'.$count_player['moderator'].'</span>
                            | <span style=" margin-top: -2px; background:#d4c800;" data-tooltip="Łącznie wszystkich VIPów" class="ipsBadge"">'.$count_player['vip'].'</span>
                            | <span style=" margin-top: -2px; background:#696969;" data-tooltip="Łącznie wszystkich Zarejestrowanych Graczy" class="ipsBadge"">'.$count_player['Gracz'].'</span>
                            )';
                }

 

od razu wyrzuca mi błąd.

Nothing is impossible.

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...

Powiadomienie o plikach cookie

Umieściliśmy na Twoim urządzeniu pliki cookie, aby pomóc Ci usprawnić przeglądanie strony. Możesz dostosować ustawienia plików cookie, w przeciwnym wypadku zakładamy, że wyrażasz na to zgodę.