Server IP : 103.119.228.120 / Your IP : 3.142.249.105 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/hendraso/public_html/Additional/smarty3/sysplugins/ |
Upload File : |
<?php /** * Smarty Internal Plugin * * @package Smarty * @subpackage Cacher */ /** * Cache Handler API * * @package Smarty * @subpackage Cacher * @author Rodney Rehm */ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource { /** * fetch cached content and its modification time from data source * * @param string $id unique cache content identifier * @param string $name template name * @param string $cache_id cache id * @param string $compile_id compile id * @param string $content cached content * @param integer $mtime cache modification timestamp (epoch) * @return void */ abstract protected function fetch($id, $name, $cache_id, $compile_id, &$content, &$mtime); /** * Fetch cached content's modification timestamp from data source * * {@internal implementing this method is optional. * Only implement it if modification times can be accessed faster than loading the complete cached content.}} * * @param string $id unique cache content identifier * @param string $name template name * @param string $cache_id cache id * @param string $compile_id compile id * @return integer|boolean timestamp (epoch) the template was modified, or false if not found */ protected function fetchTimestamp($id, $name, $cache_id, $compile_id) { return null; } /** * Save content to cache * * @param string $id unique cache content identifier * @param string $name template name * @param string $cache_id cache id * @param string $compile_id compile id * @param integer|null $exp_time seconds till expiration or null * @param string $content content to cache * @return boolean success */ abstract protected function save($id, $name, $cache_id, $compile_id, $exp_time, $content); /** * Delete content from cache * * @param string $name template name * @param string $cache_id cache id * @param string $compile_id compile id * @param integer|null $exp_time seconds till expiration time in seconds or null * @return integer number of deleted caches */ abstract protected function delete($name, $cache_id, $compile_id, $exp_time); /** * populate Cached Object with meta data from Resource * * @param Smarty_Template_Cached $cached cached object * @param Smarty_Internal_Template $_template template object * @return void */ public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template) { $_cache_id = isset($cached->cache_id) ? preg_replace('![^\w\|]+!', '_', $cached->cache_id) : null; $_compile_id = isset($cached->compile_id) ? preg_replace('![^\w\|]+!', '_', $cached->compile_id) : null; $cached->filepath = sha1($cached->source->filepath . $_cache_id . $_compile_id); $this->populateTimestamp($cached); } /** * populate Cached Object with timestamp and exists from Resource * * @param Smarty_Template_Cached $source cached object * @return void */ public function populateTimestamp(Smarty_Template_Cached $cached) { $mtime = $this->fetchTimestamp($cached->filepath, $cached->source->name, $cached->cache_id, $cached->compile_id); if ($mtime !== null) { $cached->timestamp = $mtime; $cached->exists = !!$cached->timestamp; return; } $timestamp = null; $this->fetch($cached->filepath, $cached->source->name, $cached->cache_id, $cached->compile_id, $cached->content, $timestamp); $cached->timestamp = isset($timestamp) ? $timestamp : false; $cached->exists = !!$cached->timestamp; } /** * Read the cached template and process the header * * @param Smarty_Internal_Template $_template template object * @param Smarty_Template_Cached $cached cached object * @return booelan true or false if the cached content does not exist */ public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached=null) { if (!$cached) { $cached = $_template->cached; } $content = $cached->content ? $cached->content : null; $timestamp = $cached->timestamp ? $cached->timestamp : null; if ($content === null || !$timestamp) { $this->fetch( $_template->cached->filepath, $_template->source->name, $_template->cache_id, $_template->compile_id, $content, $timestamp ); } if (isset($content)) { $_smarty_tpl = $_template; eval("?>" . $content); return true; } return false; } /** * Write the rendered template output to cache * * @param Smarty_Internal_Template $_template template object * @param string $content content to cache * @return boolean success */ public function writeCachedContent(Smarty_Internal_Template $_template, $content) { return $this->save( $_template->cached->filepath, $_template->source->name, $_template->cache_id, $_template->compile_id, $_template->properties['cache_lifetime'], $content ); } /** * Empty cache * * @param Smarty $smarty Smarty object * @param integer $exp_time expiration time (number of seconds, not timestamp) * @return integer number of cache files deleted */ public function clearAll(Smarty $smarty, $exp_time=null) { $this->cache = array(); return $this->delete(null, null, null, $exp_time); } /** * Empty cache for a specific template * * @param Smarty $smarty Smarty object * @param string $resource_name template name * @param string $cache_id cache id * @param string $compile_id compile id * @param integer $exp_time expiration time (number of seconds, not timestamp) * @return integer number of cache files deleted */ public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time) { $this->cache = array(); $cache_name = null; if (isset($resource_name)) { $_save_stat = $smarty->caching; $smarty->caching = true; $tpl = new $smarty->template_class($resource_name, $smarty); $smarty->caching = $_save_stat; if ($tpl->source->exists) { $cache_name = $tpl->source->name; } else { return 0; } // remove from template cache if ($smarty->allow_ambiguous_resources) { $_templateId = $tpl->source->unique_resource . $tpl->cache_id . $tpl->compile_id; } else { $_templateId = $smarty->joined_template_dir . '#' . $resource_name . $tpl->cache_id . $tpl->compile_id; } if (isset($_templateId[150])) { $_templateId = sha1($_templateId); } unset($smarty->template_objects[$_templateId]); // template object no longer needed unset($tpl); } return $this->delete($cache_name, $cache_id, $compile_id, $exp_time); } /** * Check is cache is locked for this template * * @param Smarty $smarty Smarty object * @param Smarty_Template_Cached $cached cached object * @return booelan true or false if cache is locked */ public function hasLock(Smarty $smarty, Smarty_Template_Cached $cached) { $id = $cached->filepath; $name = $cached->source->name . '.lock'; $mtime = $this->fetchTimestamp($id, $name, null, null); if ($mtime === null) { $this->fetch($id, $name, null, null, $content, $mtime); } return $mtime && time() - $mtime < $smarty->locking_timeout; } /** * Lock cache for this template * * @param Smarty $smarty Smarty object * @param Smarty_Template_Cached $cached cached object */ public function acquireLock(Smarty $smarty, Smarty_Template_Cached $cached) { $cached->is_locked = true; $id = $cached->filepath; $name = $cached->source->name . '.lock'; $this->save($id, $name, null, null, $smarty->locking_timeout, ''); } /** * Unlock cache for this template * * @param Smarty $smarty Smarty object * @param Smarty_Template_Cached $cached cached object */ public function releaseLock(Smarty $smarty, Smarty_Template_Cached $cached) { $cached->is_locked = false; $name = $cached->source->name . '.lock'; $this->delete($name, null, null, null); } }