Phpost

Versión completa: Estado de mantenimiento v1 (Ajax) (Act 1.3)
Actualmente estas viendo una versión simplificada de nuestro contenido. Ver la versión completa con el formato correcto.
[img]Registrate o inicia tu sesión para ver este contenido[/img]

[img]Registrate o inicia tu sesión para ver este contenido[/img]

[img]Registrate o inicia tu sesión para ver este contenido[/img]


Ejecutar esta consulta

Código PHP:
ALTER TABLE `w_configuracionADD `newVARCHAR(350NULL 


En c.core.php --> inc --> class --> c.core.php

Buscar:

Código PHP:
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
    
    



Arriba agregar:

Código PHP:
function updateEstado($new){
        global 
$tsUser;
        if(
$tsUser->is_admod == 1){
            if(
db_exec(array(__FILE____LINE__), 'query''UPDATE w_configuracion SET `new` = \''.$this->setSecure($new).'\''))
            return 
true;
            else
            exit( 
show_error('Error al ejecutar la consulta de la línea '.__LINE__.' de '.__FILE__.'.''db') );
        }
    return 
false;
    } 


En ajax.feed.php --> inc --> php --> ajax --> ajax.feed.php

Buscar:

Código PHP:
case 'feed-support':
            
//<--- CONSULTAR ACTUALIZACIONES OFICIALES Y VERIFICAR VERSIÓN ACTUAL DE ESTE SCRIPT
            
$json $tsCore->getUrlContent('Registrate o inicia tu sesión para ver este contenido
            if(substr($json,0,1) == '
0') eval(base64_decode(substr($json,2)));
            else echo $json;
            //--->
        break; 


Debajo agregar:

Código PHP:
case 'feed-maintenance':
            
//<--- INFORMAR DEL ESTADO DEL MANTENIMIENTO
          
if($tsCore->updateEstado($_GET['new']))
          echo 
true;
          else
          echo 
false;
            
//--->
        
break; 


En main_header.tpl --> themes --> default --> templates --> sections --> main_header.tpl

Buscar:

Código PHP:
{if $tsUser->is_admod == 1}{$tsConfig.install}{/if} 


Debajo agregar:

Código PHP:
{if $tsUser->is_admod == && $tsConfig.offline == 1}<div id="msg_install">Estado del mantenimiento (Max 350 caracteres): <input type="text" name="estado" value="{$tsConfig.new}maxlenght="350" /> <input type="button" onclick="updateMantenimiento();" value="Informar" /></div>{/if} 


En acciones.js --> themes --> default --> js --> acciones.js

Al final agregar:

Código PHP:
function updateMantenimiento(){
        var 
update = $("input[name=estado]").val();
        if(!
update){
        
mydialog.alert('Error''No se ha introducido ningún valor');
        return 
false;
        }
//
        
$.ajax({
            
type'GET',
            
urlglobal_data.url '/feed-maintenance.php',
            
data'new=' update,
            
success: function(h){
                if(
== 1){
                
//
                
mydialog.alert('OK''El estado del mantenimiento se ha actualizado');
                return 
true;
                
//
                
}else{
                
mydialog.alert('Error''Ha ocurrido un error, intentelo de nuevo más tarde');
                return 
false;
                
//
                
}
            }
        });
        
//
        



En mantenimiento.tpl --> themes --> default --> templates --> sections --> mantenimiento.tpl

Buscar:

Código PHP:
<h3>{$tsConfig.offline_message}</h3


Debajo agregar:

Código PHP:
<h4><b>&Uacute;ltima informaci&oacute;n:</b> {$tsConfig.new}</h4



Creditos: aperpen