public function __construct()
 {
     if (!pageArray(2)) {
         forward("admin/plugins");
     }
     $guid = pageArray(2);
     adminGateKeeper();
     $plugin = getEntity($guid);
     classGateKeeper($plugin, "Plugin");
     $plugin->status = "disabled";
     $plugin->save();
     Cache::clear();
     Cache::clear();
     Admintab::deleteAll();
     Setting::updateSettingsTable();
     clearCache();
     Cache::clear();
     Systemvariable::set("setup_complete", false);
     $translations = getEntities(array("type" => "Translationentity"));
     if ($translations) {
         foreach ($translations as $translation) {
             $translation->delete();
         }
     }
     new SystemMessage("Your plugin has been disabled.");
     forward("admin/plugins");
 }
 /**
  * function to clear all cache data
  * by default accessible only for admin
  *
  * @access Public
  * @return void
  */
 public function clear_cache()
 {
     $this->autoRender = false;
     Cache::clear();
     clearCache();
     $files = array();
     $files = array_merge($files, glob(CACHE . '*'));
     // remove cached css
     $files = array_merge($files, glob(CACHE . 'css' . DS . '*'));
     // remove cached css
     $files = array_merge($files, glob(CACHE . 'js' . DS . '*'));
     // remove cached js
     $files = array_merge($files, glob(CACHE . 'models' . DS . '*'));
     // remove cached models
     $files = array_merge($files, glob(CACHE . 'persistent' . DS . '*'));
     // remove cached persistent
     foreach ($files as $f) {
         if (is_file($f)) {
             unlink($f);
         }
     }
     if (function_exists('apc_clear_cache')) {
         apc_clear_cache();
         apc_clear_cache('user');
     }
     $this->set(compact('files'));
     $this->layout = 'ajax';
 }
 function admin_upgrade($name = null)
 {
     if (empty($name)) {
         $this->Session->setFlash(__d('upgrader', 'Missing config name', true));
         $this->redirect('/admin');
     }
     clearCache(null, 'models');
     App::import('Lib', 'Upgrader.Upgrader');
     $upgrader = new Upgrader($name);
     $sErrors = $upgrader->check(true);
     if (!$sErrors) {
         $this->Session->setFlash(__d('upgrader', 'The database is valid', true));
         //$this->redirect(array('plugin'=>'upgrader','controller'=>'upgrader','action'=>'index'));
         $this->redirect('/admin');
     }
     $this->set('name', $name);
     //debug($sErrors);
     if (!empty($this->params['named']['start'])) {
         $error = array();
         $step = empty($this->params['named']['step']) ? 1 : $this->params['named']['step'];
         $res = $upgrader->run($error);
         if ($res === 'break') {
             $this->redirect(array('start' => '1', 'step' => $step++));
         }
         if ($res === true) {
             $this->Session->setFlash(__d('upgrader', 'The database has been fixed', true));
             //$this->redirect(array('plugin'=>'upgrader','controller'=>'upgrader','action'=>'index'));
             $this->redirect('/admin');
         } else {
             $this->Session->setFlash(__d('upgrader', 'An error occurred', true) . ' :<ul><li>' . implode('</li><li>', $error) . '</li></ul>');
         }
     }
 }
 public function __construct()
 {
     $guid = pageArray(2);
     adminGateKeeper();
     $plugin = getEntity($guid);
     Setting::updateSettingsTable();
     clearCache();
     Cache::clear();
     Cache::clear();
     if ($plugin->enable()) {
         new SystemMessage("Plugin Enabled");
         new Cache("enabled_plugins_", false, "site");
         new Cache("enabled_plugins_reversed", false, "site");
         Systemvariable::set("setup_complete", false);
         forward("admin/plugins");
     }
     Setting::updateSettingsTable();
     clearCache();
     Cache::clear();
     Cache::clear();
     Admintab::deleteAll();
     $translations = getEntities(array("type" => "Translationentity"));
     if ($translations) {
         foreach ($translations as $translation) {
             $translation->delete();
         }
     }
     new SystemMessage("Your plugin can't be enabled.  Check requirements");
     forward("admin/plugins");
 }
 public static function admin_clear_cache()
 {
     $cachePaths = array('persistent');
     foreach ($cachePaths as $config) {
         clearCache(null, $config);
     }
 }
 public function index()
 {
     //清除缓存
     clearCache();
     $this->home = HOME_PATH;
     $this->m = "../" . M_PATH;
     $this->display();
 }
 public function insert()
 {
     foreach ($_POST["types"] as $k => $p) {
         if ($p) {
             clearCache($k);
         }
     }
 }
 /**
  * Clear product cache for Cake/App
  *
  * @param $marketId
  * @param $locale
  * @param $duration
  * @param $sku
  */
 public function clearProductCache($marketId, $locale, $duration, $sku)
 {
     $cache_key = strtolower('cake_' . $duration . '_' . preg_replace('/\\B([A-Z])/', '_$1', $marketId . $locale . $sku));
     /**
      * Clear Cache for sku
      */
     $success = clearCache($cache_key, '', '');
     $this->set(['success' => $success, 'result' => $cache_key, '_serialize' => ['success', 'result']]);
 }
 public function submit()
 {
     $dirs = $_POST['id'];
     //dump($dirs);
     foreach ($dirs as $value) {
         clearCache($type = 0, $path = $value);
         $say .= "清理缓存文件夹成功! " . $value . "</br>";
     }
     $this->success($say);
 }
 function admin_clearcache()
 {
     //debug($configure);
     if (clearCache()) {
         $this->Session->setFlash(__('CakePHPs Cache is cleared!', true));
     } else {
         $this->Session->setFlash(__('CakePHPs Cache was not cleared!', true));
     }
     $this->redirect('/admin/settings/');
 }
 function admin_upgrade()
 {
     clearCache(null, 'models');
     $sErrors = NewsletterUpgrade::check();
     if (!$sErrors) {
         $this->Session->setFlash(__d('newsletter', 'The database is valid', true));
         $this->redirect(array('plugin' => 'newsletter', 'controller' => 'newsletter', 'action' => 'index'));
     }
     //debug($sErrors);
     if (!empty($this->params['named']['start'])) {
         $error = array();
         $step = empty($this->params['named']['step']) ? 1 : $this->params['named']['step'];
         $res = NewsletterUpgrade::run($error);
         if ($res === 'break') {
             $this->redirect(array('start' => '1', 'step' => $step++));
         }
         if ($res === true) {
             $this->Session->setFlash(__d('newsletter', 'The database has been fixed', true));
             $this->redirect(array('plugin' => 'newsletter', 'controller' => 'newsletter', 'action' => 'index'));
         } else {
             $this->Session->setFlash(__d('newsletter', 'An error occurred', true) . ' :<ul><li>' . implode('</li><li>', $error) . '</li></ul>');
         }
         /*
         App::import('Lib', 'Newsletter.QueryUtil'); 
         if(!empty($sErrors['missing_table'])){
         	$this->_fix_missing_tables($sErrors,$error);
         }elseif(!empty($sErrors['field_mismatch'])){
         	if(in_array('NewsletterEmail.sendlist_id',$sErrors['field_mismatch']['fields'])){
         		$this->_fix_email_list_relation($sErrors,$error);
         	}
         	if(in_array('NewsletterSended.sendlist_id',$sErrors['field_mismatch']['fields'])){
         		$this->_fix_sended_tabled($sErrors,$error);
         	}
         	if(in_array('NewsletterSended.newsletter_variant_id',$sErrors['field_mismatch']['fields'])){
         		$this->_fix_sended_variant($sErrors,$error);
         	}
         	if(in_array('NewsletterSended.name',$sErrors['field_mismatch']['fields'])){
         		$this->_fix_sended_name($sErrors,$error);
         	}
         	clearCache(null, 'models');
         }
         if(!empty($error)){
         	$this->Session->setFlash(
         		__d('newsletter','An error occurred', true)
         		.' :<ul><li>'
         		.implode('</li><li>',$error)
         		.'</li></ul>'
         	);
         }else{
         	$this->Session->setFlash(__d('newsletter','The database has been fixed', true));
         	$this->redirect(array('plugin'=>'newsletter','controller'=>'newsletter','action'=>'index'));
         }
         */
     }
 }
Exemple #12
0
 function delComment(&$Model, $c_id, $u_id)
 {
     $owner = $Model->Comment->read('name', $c_id);
     if ($u_id == $owner['Comment']['name']) {
         # clear cache
         clearCache($this->cacheName, '', '');
         return $Model->deleteComment($c_id);
     } else {
         return false;
     }
 }
 public function __construct()
 {
     adminGateKeeper();
     $settings = getEntities(array("type" => "Setting"));
     foreach ($settings as $setting) {
         $setting->delete();
     }
     Systemvariable::set("setup_complete", "false");
     clearCache();
     Cache::clear();
     forward();
 }
Exemple #14
0
function myClearCache($pattern)
{
    App::import('Core', 'Folder');
    $folder = new Folder(CACHE . 'views');
    $files = $folder->find('.*' . $pattern . '.*');
    if (!empty($files)) {
        foreach ($files as $file) {
            $file = r('.php', '', $file);
            clearCache($file);
        }
    }
}
 function _save()
 {
     $response = array();
     $this->Discussion->isNew = false;
     if ($this->Discussion->store($this->data)) {
         $response[] = "jQuery('#jr_postForm" . $this->data['Discussion']['discussion_id'] . "').slideUp('slow',function(){jQuery(this).html('');});";
         $response[] = "jreviews_admin.menu.moderation_counter('discussion_count');";
     }
     clearCache('', 'views');
     clearCache('', '__data');
     return $this->ajaxResponse($response);
 }
 /**
  * Cleans the JReviews cache
  * 
  */
 function cacheCleaner()
 {
     if (isset($this->c->Config->cache_cleanup) && $this->c->name != 'about') {
         $last_clean = Sanitize::getInt($this->c->Config, 'last_cache_clean');
         $now = time();
         if ($last_clean == 0 || $now - $last_clean > Sanitize::getInt($this->c->Config, 'cache_cleanup')) {
             $this->c->Config->store(array('last_cache_clean' => $now));
             clearCache('', 'views');
             clearCache('', '__data');
         }
     }
 }
Exemple #17
0
 function run()
 {
     global $session;
     if (isset($session->data["AUTHORIZED"])) {
         $this->authorized = 1;
     }
     if ($this->print) {
         $out['PRINT'] = 1;
     }
     $out["TODAY"] = date('l, F d, Y');
     $out["AUTHORIZED"] = $this->authorized;
     if ($this->authorized) {
         include_once DIR_MODULES . "control_access/control_access.class.php";
         $acc = new control_access();
         if (!$acc->checkAccess($this->action, 1)) {
             $this->redirect("?");
         }
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             clearCache(0);
         }
         $modules = SQLSelect("SELECT * FROM project_modules WHERE `HIDDEN`='0' ORDER BY CATEGORY, `PRIORITY`, `TITLE`");
         $old_cat = 'some_never_should_be_category_name';
         for ($i = 0; $i < count($modules); $i++) {
             if ($modules[$i]['NAME'] == $this->action) {
                 $modules[$i]['SELECTED'] = 1;
             }
             if ($modules[$i]['CATEGORY'] != $old_cat) {
                 $modules[$i]['NEW_CATEGORY'] = 1;
                 $old_cat = $modules[$i]['CATEGORY'];
                 if ($i > 0) {
                     //echo $last_allow."<br>";
                     $modules[$last_allow]['LAST_IN_CATEGORY'] = 1;
                 }
             }
             if (!$acc->checkAccess($modules[$i]['NAME'])) {
                 $modules[$i]['DENIED'] = 1;
             } else {
                 $last_allow = $i;
             }
             if (file_exists(ROOT . 'img/admin/icons/ico_' . $modules[$i]['NAME'] . '_sm.gif')) {
                 $modules[$i]['ICON_SM'] = ROOTHTML . 'img/admin/icons/ico_' . $modules[$i]['NAME'] . '_sm.gif';
             } else {
                 $modules[$i]['ICON_SM'] = ROOTHTML . 'img/admin/icons/ico_default_sm.gif';
             }
         }
         $modules[$last_allow]['LAST_IN_CATEGORY'] = 1;
         $out["SUB_MODULES"] = $modules;
     }
     $out["ACTION"] = $this->action;
     $this->data = $out;
     $p = new parser(DIR_TEMPLATES . $this->name . ".html", $this->data, &$this);
     return $p->result;
 }
Exemple #18
0
 function migrate()
 {
     $this->_preflight_check();
     App::import('Component', 'J2c.J2c');
     $J2c = new J2cComponent();
     $J2c->startup($this);
     $J2c->migrate_users();
     $J2c->migrate_taxonomies();
     $J2c->migrate_contents();
     clearCache();
     clearCache(null, 'queries', null);
 }
 function saveInPlace()
 {
     $column = Sanitize::getString($this->data, 'column');
     $fieldid = Sanitize::getInt($this->data, 'fieldid');
     $value = Sanitize::getString($this->data, 'text');
     $this->_db->setQuery("\n            UPDATE \n                #__jreviews_fields \n                    SET {$column} = " . $this->quote($value) . "\n\t\t        WHERE fieldid = {$fieldid}\n\t\t");
     if (!$this->_db->query()) {
         return false;
     }
     // Clear cache
     clearCache('', 'views');
     clearCache('', '__data');
     return true;
 }
Exemple #20
0
 /**
  *  Write configuration file
  */
 public function writeConfigFile()
 {
     $configFile = CONFIGS . 'core.php';
     $fh = fopen($configFile, 'r');
     $theData = fread($fh, filesize($configFile));
     fclose($fh);
     $theData = str_replace("'debug', 1", "'debug', 0", $theData);
     $theData = str_replace("'Cache.disable', true", "'Cache.disable', false", $theData);
     $newData = str_replace("'Cache.check', false", "'Cache.check', true", $theData);
     $fh2 = fopen($configFile, 'w');
     fwrite($fh2, $newData);
     fclose($fh2);
     clearCache();
 }
Exemple #21
0
 function delete($content_id, $user_id)
 {
     $query = "DELETE FROM {$this->useTable}" . "\n WHERE content_id = {$content_id} AND user_id = {$user_id}";
     $this->_db->setQuery($query);
     if ($this->_db->query()) {
         //            clearCache('listing_model','__data','');
         clearCache('com_content');
         // Trigger plugin
         $this->plgAfterSave();
         return true;
     }
     return false;
     return $result;
 }
 function __construct()
 {
     $access = getIgnoreAccess();
     setIgnoreAccess();
     $system_settings = getEntities(array("type" => "Setting", "metadata_name" => "tab", "metadata_value" => "adsense"));
     setIgnoreAccess($access);
     if ($system_settings) {
         foreach ($system_settings as $setting) {
             $setting->value = getInput($setting->name);
             $setting->save();
         }
     }
     clearCache();
     forward("admin/adsense");
 }
 function _save()
 {
     $response = array();
     if ($this->Claim->store($this->data)) {
         if ($this->data['Claim']['approved'] == 0) {
             $response[] = "\n                    jQuery('#jr_moderateForm" . $this->data['Claim']['claim_id'] . "').slideUp('slow',function()\n                    {\n                        jQuery(this).addClass('jr_form').html('" . __a("Claim will remain in moderation pending further action.", true, true) . "').slideDown('normal',function()\n                        {\n                            jQuery(this).effect('highlight',{},4000);\n                            setTimeout(function(){jQuery('#jr_moderateForm" . $this->data['Claim']['claim_id'] . "').fadeOut(1500)},3000);\n                        });\n                    });\n                ";
         } else {
             $response[] = "jQuery('#jr_moderateForm" . $this->data['Claim']['claim_id'] . "').slideUp('slow',function(){jQuery(this).html('');});";
             $response[] = "jreviews_admin.menu.moderation_counter('claim_count');";
         }
     }
     clearCache('', 'views');
     clearCache('', '__data');
     return $this->ajaxResponse($response);
 }
 public function __construct()
 {
     $access = getIgnoreAccess();
     setIgnoreAccess();
     $system_settings = getEntities(array("type" => "Setting"));
     setIgnoreAccess($access);
     if ($system_settings) {
         foreach ($system_settings as $setting) {
             $name = $setting->name;
             $value = getInput($name);
             $setting->value = $value;
             $setting->save();
         }
     }
     clearCache();
     forward("admin/general");
 }
 public function __construct()
 {
     adminGateKeeper();
     $name = pageArray(2);
     if ($name != "user") {
         $query = "DELETE FROM `entities` WHERE `type` = '{$name}'";
         Dbase::query($query);
         $query = "DROP TABLE `{$name}`";
         Dbase::query($query);
         Systemvariable::set("setup_complete", "false");
         clearCache();
         Cache::clear();
         Cache::clear();
         Cache::clear();
         new SystemMessage("Your table has been deleted.");
     }
     forward();
 }
Exemple #26
0
 function login()
 {
     if ($this->Session->read('Auth.User')) {
         $group_id = $this->Session->read("Auth.User.group_id");
         if ($group_id == 1) {
             Cache::clear();
             clearCache();
             $this->redirect($this->Auth->redirect(array('controller' => 'pages', 'action' => 'admin')));
         }
         if ($group_id == 2) {
             $this->redirect($this->Auth->redirect(array('controller' => 'pages', 'action' => 'teacher')));
         }
         if ($group_id == 3) {
             $this->redirect($this->Auth->redirect(array('controller' => 'pages', 'action' => 'student')));
         }
     }
     $this->set('title_for_layout', 'OTAS');
 }
 /**
  * undocumented function
  *
  * @return void
  * @access public
  */
 function admin_recalc_cache($type = null, $offset = 0)
 {
     $limit = 300;
     $this->set(compact('type', 'offset', 'limit'));
     if (empty($type)) {
         return;
     }
     ini_set('max_execution_time', 1800);
     ini_set('memory_limit', '1024M');
     if ($type == 'clear_file') {
         Cache::clear();
         clearCache();
         $this->Message->add(__('The cache has been cleared.', true), 'ok');
     }
     if ($type == 'session_restore') {
         User::restore();
     }
     if ($done) {
         $this->Message->add(__('The counter caches have been rebuilt.', true), 'ok');
     }
     $this->set(compact('done'));
 }
 public function __construct()
 {
     adminGateKeeper();
     $admin_guids = getAdminGuidArray();
     $admin_guids = implode(",", $admin_guids);
     $name = pageArray(2);
     $query = "DELETE FROM `entities` WHERE `type` = '{$name}' AND `guid` NOT IN ({$admin_guids})";
     Dbase::query($query);
     if ($name != "User") {
         $query = "DELETE FROM `{$name}`";
     } else {
         $query = "DELETE FROM `{$name}` WHERE `guid` NOT IN ({$admin_guids})";
     }
     Dbase::query($query);
     clearCache();
     Cache::clear();
     Cache::clear();
     Cache::clear();
     Systemvariable::set("setup_complete", "false");
     new SystemMessage("Your table has been purged.");
     forward();
 }
 public function __construct()
 {
     adminGateKeeper();
     Cache::clear();
     Cache::clear();
     $plugins = Plugin::getAll();
     foreach ($plugins as $plugin) {
         $plugin->disable();
     }
     Admintab::deleteAll();
     Setting::updateSettingsTable();
     clearCache();
     Cache::clear();
     Cache::clear();
     Cache::clear();
     Systemvariable::set("setup_complete", false);
     $translations = getEntities(array("type" => "Translationentity"));
     if ($translations) {
         foreach ($translations as $translation) {
             $translation->delete();
         }
     }
     forward("admin/plugins");
 }
Exemple #30
0
function clearCache($dirname)
{
    $cacheArr = array();
    $newCacheArr = array();
    if (file_exists('.' . $dirname . '/cache.txt')) {
        $cacheArr = file('.' . $dirname . '/cache.txt');
    }
    foreach ($cacheArr as $fileName) {
        $file = trim($fileName);
        if (file_exists('.' . $dirname . '/' . $file)) {
            unlink('.' . $dirname . '/' . $file);
            echo '.' . $dirname . '/' . $file . "| ";
        }
    }
    if (file_exists('.' . $dirname . '/cache.txt')) {
        unlink('.' . $dirname . '/cache.txt');
    }
    $dir = opendir('.' . $dirname);
    while (true == ($filename = readdir($dir))) {
        if ($filename != '.' && $filename != '..' && is_dir('.' . $dirname . '/' . $filename)) {
            clearCache($dirname . '/' . $filename);
        }
    }
}