Example #1
0
 /**
  * Parse $path for cache file groups
  *
  * @return	array
  */
 protected function _parse($path = null)
 {
     $path = $path !== null ? $path : $this->getState('path');
     jimport('joomla.filesystem.folder');
     $folders = JFolder::folders($path);
     $data = array();
     foreach ($folders as $folder) {
         $files = array();
         $files = JFolder::files($path . DS . $folder);
         $item = new CacheItem($folder);
         foreach ($files as $file) {
             $item->updateSize(filesize($path . DS . $folder . DS . $file) / 1024);
         }
         $data[$folder] = $item;
     }
     return $data;
 }
 public function __construct($filename)
 {
     parent::__construct($filename);
     $this->next = false;
     $this->classes = array();
     if (function_exists('token_get_all') == false) {
         Core::throwError('Function token_get_all() is not supported. You can not use the ClassManager.', E_NOTICE);
     }
 }
 function cache_package_browser($filename, $cachedir = "cache/")
 {
     global $lang;
     if (SCRIPTNAME != 'admin') {
         $lang->group('admin/global');
     }
     parent::CacheItem($filename, $cachedir);
     $this->max_age = 60 * 60 * 6;
     $this->types = array(1 => array('name' => $lang->phrase('admin_pb_type1_name'), 'name2' => $lang->phrase('admin_pb_type1_name2'), 'import' => 'admin.php?action=packages&job=package_import&file=', 'update' => 'admin.php?action=packages&job=package_update&file='), 2 => array('name' => $lang->phrase('admin_pb_type2_name'), 'name2' => $lang->phrase('admin_pb_type2_name2'), 'import' => 'admin.php?action=designs&job=design_import&file=', 'update' => null), 3 => array('name' => $lang->phrase('admin_pb_type3_name'), 'name2' => $lang->phrase('admin_pb_type3_name2'), 'import' => 'admin.php?action=bbcodes&job=smileys_import&file=', 'update' => null), 4 => array('name' => $lang->phrase('admin_pb_type4_name'), 'name2' => $lang->phrase('admin_pb_type4_name2'), 'import' => 'admin.php?action=language&job=import&file=', 'update' => null), 5 => array('name' => $lang->phrase('admin_pb_type5_name'), 'name2' => $lang->phrase('admin_pb_type5_name2'), 'import' => 'admin.php?action=bbcodes&job=custombb_import&file=', 'update' => null));
 }
 public function import()
 {
     if (parent::import()) {
         foreach ($this->data as $fields) {
             foreach ($fields as $row) {
                 $this->addField($row);
             }
         }
         return true;
     }
     return false;
 }
Example #5
0
error_reporting(E_ALL);
DEFINE('SCRIPTNAME', 'popup');
include "data/config.inc.php";
include "classes/function.viscacha_frontend.php";
$zeitmessung1 = t1();
$slog = new slog();
$my = $slog->logged();
$lang->init($my->language);
$tpl = new tpl();
($code = $plugins->load('popup_start')) ? eval($code) : null;
if ($_GET['action'] == "hlcode") {
    if (strlen($_GET['fid']) != 32) {
        echo $tpl->parse("popup/header");
        error($lang->phrase('query_string_error'), 'javascript:parent.close();');
    }
    $codeObj = new CacheItem($_GET['fid'], 'cache/geshicode/');
    if (!$codeObj->import()) {
        echo $tpl->parse("popup/header");
        error($lang->phrase('query_string_error'), 'javascript:parent.close();');
    }
    $sourcecode = $codeObj->get();
    $sourcecode['source'] = html_entity_decode($sourcecode['source'], ENT_QUOTES);
    ($code = $plugins->load('popup_hlcode_start')) ? eval($code) : null;
    if ($_GET['temp'] == 1) {
        viscacha_header('Content-Type: text/plain');
        viscacha_header('Content-Length: ' . strlen($sourcecode['source']));
        viscacha_header('Content-Disposition: attachment; filename="' . date('d-m-Y_H-i') . '.txt"');
        echo $sourcecode['source'];
        $slog->updatelogged();
        $db->close();
        exit;
function save_error_data($fc, $fid = '')
{
    global $gpc;
    if (!is_hash($fid)) {
        $fid = md5(microtime());
    }
    $cache = new CacheItem($fid, 'temp/errordata/');
    $cache->set($fc);
    $cache->export();
    return $fid;
}
Example #7
0
"><?php 
        echo $lang->phrase('admin_db_click_if_no_redirection');
        ?>
</a></td>
		  </tr>
		 </table>
		<?php 
        echo foot();
    } else {
        error('admin.php?action=db&job=backup', $lang->phrase('admin_db_backup_missing_permissions'));
        $filesystem->unlink($tfile);
        $x->delete();
    }
} elseif ($job == 'backup4') {
    $name = $gpc->get('name', none);
    $x = new CacheItem('backup_' . $name);
    $x->import();
    $temp = $x->get();
    $x->delete();
    // Speichern der Backup-Datei
    $tfile = "admin/backup/{$name}.sql.tmp";
    $file = "admin/backup/{$name}.sql";
    $filesystem->rename($tfile, $file);
    $ok = $lang->phrase('admin_db_backup_successfully_created');
    if (!empty($temp['zip'])) {
        $zipfile = "admin/backup/{$name}.zip";
        require_once 'classes/class.zip.php';
        $archive = new PclZip($zipfile);
        $v_list = $archive->create($file, PCLZIP_OPT_REMOVE_PATH, dirname($file));
        if ($v_list == 0) {
            $ok = $lang->phrase('admin_db_zip_error_saved_txt') . '<br />' . $lang->phrase('admin_db_error') . ' ' . $archive->errorInfo(true);
function save_error_data($fc)
{
    global $gpc;
    $fid = md5(microtime());
    $cache = new CacheItem($fid, 'temp/errordata/');
    if ($cache->exists() == false) {
        foreach ($fc as $key => $row) {
            $fc[$key] = $gpc->unescape($row);
        }
        $cache->set($fc);
        $cache->export();
    }
    return $fid;
}
 function cb_hlcode($matches)
 {
     global $lang;
     $pid = $this->noparse_id();
     list(, $sclang, $code, $nl) = $matches;
     $rows = explode("\n", $code);
     if (count($rows) > 1) {
         $code = $code2 = $this->code_prepare($code);
         $a = 0;
         $aa = array();
         $unique = md5($code);
         $cache = new CacheItem($unique, 'cache/geshicode/');
         if ($cache->exists() == false) {
             $export = array('language' => $sclang, 'source' => $code);
             $cache->set($export);
             $cache->export();
         }
         foreach ($rows as $row) {
             $a++;
             $aa[] = "{$a}:&nbsp;";
         }
         $aa = implode("<br />", $aa);
         $this->noparse[$pid] = '<strong class="bb_blockcode_header"><a target="_blank" href="popup.php?action=hlcode&amp;fid=' . $unique . SID2URL_x . '">' . $lang->phrase('bb_ext_sourcecode') . '</a></strong><div class="bb_blockcode"><table><tr><td width="1%">' . $aa . '</td><td width="99%">' . $this->nl2br($code2) . '</td></tr></table></div>';
     } else {
         $code2 = $this->code_prepare($code, count($rows) <= 1);
         $this->noparse[$pid] = '<code class="bb_inlinecode">' . $code2 . '</code>';
         if (!empty($nl)) {
             $this->noparse[$pid] .= '<br />';
         }
     }
     return '<!PID:' . $pid . '>';
 }
Example #10
0
 /**
  * @covers Phossa\Cache\CacheItem::get
  */
 public function testGet()
 {
     $this->assertEquals(null, $this->object->get());
 }
Example #11
0
 public function commit()
 {
     CacheItem::saveAll($this->pending);
 }
Example #12
0
    ?>
 <table class="border" border="0" cellspacing="0" cellpadding="4" align="center">
  <tr>
   <td class="obox"><b>Step 1 of <?php 
    echo $steps + 1;
    ?>
</b></td>
  </tr>
  <tr>
   <td class="mbox">The datas have been saved<br>Now the mails will be sent step by step.</td>
  </tr>
 </table>
<?php 
    echo foot();
} elseif ($job == 'newsletter3') {
    $cache = new CacheItem('newsletter_session');
    $cache->import();
    $emails = $cache->get();
    $int2 = $gpc->get('int2', int, 100);
    $page = $gpc->get('page', int, 1);
    $anz = count($emails);
    $steps = ceil($anz / $int2);
    $result = $db->query('SELECT * FROM ' . $db->pre . 'newsletter WHERE id = ' . $gpc->get('id', int));
    $row = $db->fetch_assoc($result);
    $split = array_chunk($emails, $int2);
    $minus = $page - 1;
    $plus = $page + 1;
    $i = 0;
    if (!isset($split[$minus]) || !is_array($split[$minus])) {
        echo head();
        error('admin.php?action=members&job=newsletter', 'No e-mail address found for this echelon!');
 function cb_hlcode($sclang, $code)
 {
     global $lang;
     $pid = $this->noparse_id();
     $code = trim($code);
     $rows = preg_split('/(\\r\\n|\\r|\\n)/', $code);
     $code2 = preg_replace('/\\[b\\](.+?)\\[\\/b\\]/is', "<strong>\\1</strong>", $code);
     $code2 = str_replace("]", "&#93;", $code2);
     $code2 = str_replace("[", "&#91;", $code2);
     $code2 = str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;", $code2);
     if (count($rows) > 1) {
         $a = 0;
         $aa = array();
         $unique = md5($code);
         $cache = new CacheItem($unique, 'cache/geshicode/');
         if ($cache->exists() == false) {
             $export = array('language' => $sclang, 'source' => trim($code));
             $cache->set($export);
             $cache->export();
         }
         foreach ($rows as $row) {
             $a++;
             $aa[] = "{$a}:&nbsp;";
         }
         $aa = implode("<br />", $aa);
         $this->noparse[$pid] = '<strong class="bb_blockcode_header"><a target="_blank" href="popup.php?action=hlcode&amp;fid=' . $unique . SID2URL_x . '">' . $lang->phrase('bb_ext_sourcecode') . '</a></strong><div class="bb_blockcode"><table><tr><td width="1%">' . $aa . '</td><td width="99%">' . $this->nl2br($code2) . '</td></tr></table></div>';
     } else {
         $this->noparse[$pid] = '<code class="bb_inlinecode">' . $this->nl2br($code2) . '</code>';
     }
     return '<!PID:' . $pid . '>';
 }
Example #14
0
 /**
  * 读取缓存
  */
 public function get($key)
 {
     if (empty($key)) {
         throw new CacheException('[缓存错误]请指定读取缓存的key');
     }
     //直接返回的数据
     $data = $this->_cacheObject->get($key);
     $content = unserialize($data);
     //结果对象
     $cacheItemObject = new CacheItem();
     $cacheItemObject->setKey($key);
     $cacheItemObject->setValue($content);
     //触发获取缓存时的Hooks
     CHooks::callHooks(HOOKS_CACHE_GET, $cacheItemObject);
     //经过HOOKS的数据
     $endContent = $cacheItemObject->getValue();
     return !empty($endContent) ? $endContent : null;
 }
Example #15
0
    ?>
 <table class="border" border="0" cellspacing="0" cellpadding="4" align="center">
  <tr> 
   <td class="obox"><b>Step 1 of <?php 
    echo $steps + 1;
    ?>
</b></td>
  </tr>
  <tr> 
   <td class="mbox">The datas have been saved<br>Now the mails will be sent in echelons.</td>
  </tr>
 </table>	
<?php 
    echo foot();
} elseif ($job == 'newsletter3') {
    $cache = new CacheItem('newsletter_session');
    $emails = $cache->get();
    $int2 = $gpc->get('int2', int, 100);
    $page = $gpc->get('page', int, 1);
    $anz = count($emails);
    $steps = ceil($anz / $int2);
    $result = $db->query('SELECT * FROM ' . $db->pre . 'newsletter WHERE id = ' . $gpc->get('id', int));
    $row = $db->fetch_assoc($result);
    $split = array_chunk($emails, $int2);
    $minus = $page - 1;
    $plus = $page + 1;
    $i = 0;
    if (!isset($split[$minus]) || !is_array($split[$minus])) {
        echo head();
        error('admin.php?action=members&job=newsletter', 'No e-mail address found for this echelon!');
    }
Example #16
0
	<?php 
    echo foot();
} elseif ($job == 'cache_refresh') {
    $file = $gpc->get('file', str);
    echo head();
    $cache = new CacheItem($file);
    $data = $cache->delete();
    ok('admin.php?action=misc&job=cache', 'The cache-file was deleted. Therefore, this file will not be listed in the overview for the time being. If it is necessary the next time the cache will be rebuild and listed automatically into the overview.');
} elseif ($job == 'cache_refresh_all') {
    echo head();
    $dir = 'cache';
    if ($dh = @opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            if (strpos($file, '.inc.php') !== false) {
                $file = str_replace('.inc.php', '', $file);
                $cache = new CacheItem($file);
                $data = $cache->delete();
            }
        }
        closedir($dh);
    }
    ok('admin.php?action=misc&job=cache', 'The cache-files were deleted. Therefore, this file will not be listed in the overview for the time being. If it is necessary the next time the cache will be rebuild and listed automatically into the overview.');
} elseif ($job == 'onlinestatus') {
    echo head();
    $b = file_get_contents('data/imservers.php');
    ?>
<form name="form" method="post" action="admin.php?action=misc&job=onlinestatus2">
 <table class="border" border="0" cellspacing="0" cellpadding="4" align="center">
  <tr> 
   <td class="obox" colspan="2"><b>Online-Status Server</b></td>
  </tr>
Example #17
0
</a>
   <?php 
        }
        ?>
   </td>
  </tr>
  <?php 
    }
    ?>
 </table>
	<?php 
    echo foot();
} elseif ($job == 'cache_view') {
    $file = $gpc->get('file', str);
    echo head();
    $cache = new CacheItem($file);
    $cache->import();
    $data = $cache->get();
    // ToDo: Better appearance
    ob_start();
    print_r($data);
    $out = ob_get_contents();
    ob_end_clean();
    $out = htmlspecialchars($out);
    ?>
 <table class="border" border="0" cellspacing="0" cellpadding="4" align="center">
  <tr>
   <td class="obox"><b><?php 
    echo $lang->phrase('admin_misc_cache_manager');
    ?>
 &raquo; <?php 
Example #18
0
	$nid = $db->insert_id();

	$data['chunks'] = array_chunk(explode(',', $data['users']), $data['batch']);

	$cache = new CacheItem('newsletter_'.$nid);
	$cache->set($data);
	$cache->export();

	echo head();
	ok('admin.php?action=members&job=newsletter3&id='.$nid, $lang->phrase('admin_member_mail_will_be_sent'));
}
elseif ($job == 'newsletter3') {
	$page = $gpc->get('page', int, 1);
	$id = $gpc->get('id', int);

	$cache = new CacheItem('newsletter_'.$id);
	$cache->import();
	$data = $cache->get();

	require_once("classes/mail/class.phpmailer.php");
	$mail = new PHPMailer();
	$mail->From = $data['from_mail'];
	$mail->FromName = $data['from_name'];
	$mail->Subject = $data['title'];
	if ($config['smtp'] == 1) {
		$mail->Mailer = "smtp";
		$mail->IsSMTP();
		$mail->Host = $config['smtp_host'];
		if ($config['smtp_auth'] == 1) {
			$mail->SMTPAuth = true;
			$mail->Username = $config['smtp_username'];
 public function __construct($filename, $cachedir = "data/cache/")
 {
     parent::__construct($filename, $cachedir);
 }