Example #1
0
 function save_cache()
 {
     $this->CONTENT = ob_get_contents();
     //Записываем буфер в переменную
     rcms_delete_files($this->dir_cache . "/" . $this->hash_code);
     file_write_contents($this->dir_cache . "/" . $this->hash_code, $this->CONTENT);
 }
function rcms_delete_files($file, $recursive = false, $wildcard = false)
{
    if ($recursive) {
        if ($wildcard) {
            $els = rcms_scandir(dirname($file), basename($file));
        } else {
            $els = rcms_scandir($file);
        }
        foreach ($els as $el) {
            rcms_delete_files($file . '/' . $el, true);
        }
    }
    if (!$wildcard) {
        if (is_dir($file)) {
            return rmdir($file);
        } else {
            return unlink($file);
        }
    } else {
        $els = rcms_scandir(dirname($file), basename($file));
        foreach ($els as $el) {
            if (is_dir(dirname($file) . '/' . $el)) {
                rmdir(dirname($file) . '/' . $el);
            } else {
                unlink(dirname($file) . '/' . $el);
            }
        }
    }
}
Example #3
0
function fupload_delete($file, $dir = FILES_PATH)
{
    if (is_file($dir . $file)) {
        rcms_delete_files($dir . $file);
        return true;
    } else {
        return false;
    }
}
Example #4
0
 /**
  * Deletes SMS from local queue
  * 
  * @param string $filename Existing sms filename
  * 
  * @return int 0 - ok, 1 - deletion unsuccessful, 2 - file not found 
  */
 public function deleteSms($filename)
 {
     if (file_exists(self::QUEUE_PATH . $filename)) {
         rcms_delete_files(self::QUEUE_PATH . $filename);
         $result = 0;
         if (file_exists(self::QUEUE_PATH . $filename)) {
             $result = 1;
         }
     } else {
         $result = 2;
     }
     return $result;
 }
Example #5
0
function ucm_delete($id)
{
    $filename = basename($id) . '.ucm';
    if (!is_file(DF_PATH . $filename)) {
        return false;
    }
    if (rcms_delete_files(DF_PATH . $filename)) {
        $config = file_get_contents(CONFIG_PATH . 'menus.ini');
        $config = preg_replace('/[0-9]* = "ucm:' . $id . '"\\s/i', '', $config);
        file_write_contents(CONFIG_PATH . 'menus.ini', $config);
        return true;
    } else {
        return false;
    }
}
Example #6
0
function ucm_delete($id, $dir = MENU_MODULES_PATH)
{
    $id = basename($id);
    $workdir = $dir . 'ucm.' . $id;
    if (is_dir($workdir)) {
        if (rcms_delete_files($workdir, true)) {
            $config = file_get_contents(CONFIG_PATH . 'menus.ini');
            $config = preg_replace('/[0-9]* = "ucm.' . $id . '"\\s/i', '', $config);
            if (!file_write_contents(CONFIG_PATH . 'menus.ini', $config)) {
                return 6;
            }
            return 0;
        } else {
            return 4;
        }
    } else {
        return 4;
    }
}
Example #7
0
function upload_avatar()
{
    global $avatars_path;
    global $system;
    global $avatar_h;
    global $avatar_w;
    if (isset($_POST['upload_avatar']) and $_POST['upload_avatar'] == "true" and is_images($_FILES['avatar']['name'])) {
        $avarez = getimagesize($_FILES['avatar']['tmp_name']);
        $img = $avarez[2];
        switch ($img) {
            case "1":
                $img = 'gif';
                break;
            case "2":
                $img = 'jpg';
                break;
            case "3":
                $img = 'png';
                break;
            default:
                $img = 'Too big - deleted!';
                break;
        }
        //show_window(__('Uploaded images'),'width = '.$avarez[0].' px, '.'height = '.$avarez[1].' px, '.' image: '.$img,'center');
        if ($avarez[0] <= "{$avatar_w}" and $avarez[1] <= "{$avatar_h}") {
            $uploadfile = $avatars_path . $system->user['username'];
            $exttmp = strtolower(substr(strrev($_FILES['avatar']['name']), 0, 4));
            $ext = $exttmp;
            $ext[0] = $exttmp[2];
            $ext[2] = $exttmp[0];
            $ext = substr($ext, 0, 3);
            $tmpupl = $uploadfile;
            $uploadfile = $uploadfile . '.' . $ext;
            if ($ext == 'gif' and $img != 'Too big - deleted!') {
                if (file_exists($tmpupl . '.jpg')) {
                    rcms_delete_files($tmpupl . '.jpg');
                }
                if (file_exists($tmpupl . '.png')) {
                    rcms_delete_files($tmpupl . '.png');
                }
            }
            if ($ext == 'jpg' and $img != 'Too big - deleted!') {
                if (file_exists($tmpupl . '.gif')) {
                    rcms_delete_files($tmpupl . '.gif');
                }
                if (file_exists($tmpupl . '.png')) {
                    rcms_delete_files($tmpupl . '.png');
                }
            }
            if ($ext == 'png' and $img != 'Too big - deleted!') {
                if (file_exists($tmpupl . '.gif')) {
                    rcms_delete_files($tmpupl . '.gif');
                }
                if (file_exists($tmpupl . '.jpg')) {
                    rcms_delete_files($tmpupl . '.jpg');
                }
            }
            if (@move_uploaded_file($_FILES['avatar']['tmp_name'], $uploadfile)) {
                show_window(__('Result'), __('Avatar filesuccessfully uploaded'), 'center');
                $config_ext = parse_ini_file(CONFIG_PATH . 'adminpanel.ini');
                if ($config_ext['chmod_on']) {
                    chmod($uploadfile, octdec($config_ext['chmod']));
                    return $_FILES['avatar']['name'];
                }
            } else {
                show_window(__('Result'), __('Your avatar don\'t meet our requirements'), 'center');
            }
        }
    } else {
        show_window(__('Result'), __('Your avatar don\'t meet our requirements'), 'center');
    }
}
Example #8
0
}
$installer = parse_ini_file(CONFIG_PATH . 'installer.ini', true);
$uninstaller = parse_ini_file(CONFIG_PATH . 'uninstaller.ini', true);
// Delete installing modules
if (!empty($_POST['delete'])) {
    $result = '';
    foreach ($_POST['delete'] as $filename => $cond) {
        $filename = basename($filename);
        if (!empty($cond)) {
            $name = explode('_', $filename);
            if (empty($_POST['patch'][$uninstaller[$name[0]]['filename']])) {
                $files = explode(',', $uninstaller[$name[0]]['files']);
                foreach ($files as $file) {
                    $file = RCMS_ROOT_PATH . $file;
                    if (is_file($file) && $file != "." && $file != "..") {
                        rcms_delete_files($file);
                        $result .= __('File removed') . ': ' . $file . '<br/>';
                    }
                    if (is_dir($file) && $file != "." && $file != "..") {
                        if (@rmdir($file)) {
                            $result .= __('Directory removed') . ': ' . $file . '<br/>';
                        }
                    }
                }
                if ($file != './') {
                    $result .= __('File removed') . ': ' . $file . '<br/>';
                } else {
                    $result .= '------------------------------------------------------<br/>' . __('Module removed') . ': ' . $name[0] . '<br/><br/>';
                }
                if (is_file($installerPath . $filename)) {
                    $installer[$name[0]] = $uninstaller[$name[0]];
Example #9
0
function gzfile_write_contents($file, $text, $mode = 'w+')
{
    set_time_limit(0);
    if (!IGNORE_LOCK_FILES && is_file($file . '.lock')) {
        return false;
    }
    $fp = fopen($file . '.lock', 'w+');
    fwrite($fp, 'lock');
    fclose($fp);
    if ($fp = gzopen($file, $mode)) {
        if (!empty($text) && !gzwrite($fp, $text)) {
            return false;
        }
        gzclose($fp);
    } else {
        return false;
    }
    rcms_delete_files($file . '.lock');
    return true;
}
Example #10
0
function poll_remove()
{
    if (!is_file(DATA_PATH . 'poll.dat')) {
        return 13;
    }
    if (!($file = @unserialize(@file_get_contents(DATA_PATH . 'poll.dat')))) {
        return false;
    }
    if (!is_file(DATA_PATH . 'poll.old.dat')) {
        $old = array();
    } else {
        $old = @unserialize(@file_get_contents(DATA_PATH . 'poll.old.dat'));
    }
    unset($file['ips']);
    $old[] = $file;
    file_write_contents(DATA_PATH . 'poll.old.dat', serialize($old));
    rcms_delete_files(DATA_PATH . 'poll.dat');
    return 0;
}
Example #11
0
if ($system->current_point == '__MAIN__') {
    if ($system->checkForRight('HELP')) {
        $lang = curlang();
        $help_dir = DATA_PATH . 'help/' . $lang;
        $module = get('edit');
        $file = $help_dir . '/' . $module;
        if (!is_dir(DATA_PATH . 'help/')) {
            mkdir(DATA_PATH . 'help/', 0777);
        }
        if (!is_dir($help_dir)) {
            mkdir($help_dir, 0777);
        }
        if (!empty($_GET['delete'])) {
            $dfile = $help_dir . '/' . get('delete');
            if (rcms_delete_files($dfile)) {
                show_window(__('Result'), __('File removed'));
            } else {
                show_window(__('Result'), __('Error occurred') . ':' . $dfile);
            }
        }
        if (!empty($_POST['save']) && !empty($module)) {
            file_write_contents($file, $_POST['help_edit']);
            show_window(__('Result'), __('File updated') . '. ' . __('Show') . ' — ' . show_help($module));
        }
        if (!empty($module)) {
            $result = file_exists($file) ? file_get_contents($file) : '';
            $frm = new InputForm('', 'post', __('Submit'));
            $frm->hidden('save', '1');
            $frm->addrow('', $frm->textarea('help_edit', $result, 55, 15) . tinymce_selector('help_edit'), 'top');
            $result = $frm->show(true);
function articles_delete_category($id, $dir = ARTICLES_PATH)
{
    if (!is_dir($dir . $id)) {
        return 12;
    }
    $catprefix = $dir . $id . '/';
    $articles = rcms_scandir($dir);
    foreach ($articles as $article) {
        if (is_dir($catprefix . $article)) {
            articles_delete($id, $article, $dir);
        }
    }
    rcms_delete_files($catprefix, true);
    return 0;
}
Example #13
0
 function removeImage($filename)
 {
     $this->unregisterInIndex($filename);
     if (is_file(GALLERY_IMAGES_DIR . $filename)) {
         rcms_delete_files(GALLERY_IMAGES_DIR . $filename);
     }
     if (is_file(GALLERY_COMMENTS_DIR . $filename . '.dat')) {
         rcms_delete_files(GALLERY_COMMENTS_DIR . $filename . '.dat');
     }
     if (is_file(GALLERY_THUMBS_DIR . $filename . '.jpg')) {
         rcms_delete_files(GALLERY_THUMBS_DIR . $filename . '.jpg');
     }
     return true;
 }
Example #14
0
 }
 //downloading mysql dump
 if (wf_CheckGet(array('download'))) {
     if (cfr('ROOT')) {
         $filePath = base64_decode($_GET['download']);
         zb_DownloadFile($filePath);
     } else {
         show_error(__('Access denied'));
     }
 }
 //deleting dump
 if (wf_CheckGet(array('deletedump'))) {
     if (cfr('ROOT')) {
         $deletePath = base64_decode($_GET['deletedump']);
         if (file_exists($deletePath)) {
             rcms_delete_files($deletePath);
             log_register('BACKUP DELETE `' . $deletePath . '`');
             rcms_redirect('?module=backups');
         } else {
             show_error(__('Not existing item'));
         }
     } else {
         show_error(__('Access denied'));
     }
 }
 function web_AvailableDBBackupsList()
 {
     $backupsPath = DATA_PATH . 'backups/sql/';
     $availbacks = rcms_scandir($backupsPath);
     $result = __('No existing DB backups here');
     if (!empty($availbacks)) {
////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) 2004 ReloadCMS Development Team                            //
//   http://reloadcms.sf.net                                                  //
//                                                                            //
//   This program is distributed in the hope that it will be useful,          //
//   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
//                                                                            //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
if (isset($_POST['deletebackupility'])) {
    $d = opendir(BACKUP_PATH);
    while ($f = readdir($d)) {
        if (is_file(BACKUP_PATH . $f)) {
            rcms_delete_files(BACKUP_PATH . $f);
        }
    }
    closedir($d);
}
if (!empty($_POST['backupit'])) {
    $bkupfilename = './backups/backup_' . date('H-i-s_d.m.Y') . '.tar.gz';
    $bkp = new gzip_file($bkupfilename);
    $bkp->set_options(array('basedir' => RCMS_ROOT_PATH, 'overwrite' => 1, 'level' => 9));
    $bkp->add_files('config');
    $bkp->add_files('content');
    $bkp->create_archive();
    $frm = new InputForm("", "post", $lang['admincp']['general']['backup']['getit']);
    $frm->addbreak($lang['admincp']['general']['backup']['done']);
    $frm->hidden('getit', basename($bkupfilename));
    $frm->show();
Example #16
0
    if ($id != $newid && is_file(PAGES_PATH . $newid)) {
        return false;
    }
    $page = array('title' => $title, 'text' => $text, 'description' => $description, 'keywords' => $keywords, 'mode' => $mode, 'author_nick' => $system->user['nickname'], 'author_name' => $system->user['username'], 'date' => sql_to_unix_time($date));
    if (!file_write_contents(PAGES_PATH . $id, serialize($page))) {
        return false;
    }
    rcms_rename_file(PAGES_PATH . $id, PAGES_PATH . $newid);
    return true;
}
//API
$result = '';
if (!empty($_POST['delete']) && is_array($_POST['delete'])) {
    foreach ($_POST['delete'] as $id => $cond) {
        if ($cond) {
            if (rcms_delete_files(DATA_PATH . 'pages/' . $id)) {
                $result .= __('Article removed') . ': ' . $id . '<br />';
            } else {
                $result .= __('Error occurred') . ': ' . $id . '<br />';
            }
        }
    }
    unset($_POST['edit']);
} elseif (!empty($_POST['newsave'])) {
    if (page_create($_POST['id'], $_POST['mode'], $_POST['date'])) {
        $result .= __('Article saved');
    } else {
        $result .= __('Error occurred');
    }
} elseif (!empty($_POST['edit']) && !empty($_POST['save'])) {
    if (page_change($_POST['edit'], $_POST['id'], $_POST['title'], $_POST['text'], $_POST['description'], $_POST['keywords'], $_POST['mode'], $_POST['date'])) {
Example #17
0
function statistic_clean()
{
    return rcms_delete_files(DATA_PATH . 'stats.dat');
}
Example #18
0
        if (!empty($cond)) {
            if (rcms_delete_files(BACKUP_PATH . $backup_entry)) {
                $result .= __('File removed') . ': ' . $backup_entry . '<br/>';
            } else {
                $result .= __('Error occurred') . ': ' . $backup_entry . '<br/>';
            }
        }
    }
}
//Restore ./content	and ./config from archive
if (!empty($_POST['browse_archive']) and empty($_POST['delete'])) {
    if (!empty($_POST['restore'])) {
        $restorefilename = BACKUP_PATH . $_POST['restore'];
        if (is_file($restorefilename)) {
            rcms_delete_files(CONFIG_PATH, true);
            rcms_delete_files(DATA_PATH, true);
            $Archive = new archiveTar();
            $Archive->archive_name = $restorefilename;
            $success = $Archive->restoreArchive(RCMS_ROOT_PATH);
            if (!$success) {
                $Errors = $Archive->showErrors(basename($restorefilename));
            }
            if (!empty($Errors)) {
                $result .= $Errors;
            } else {
                $result .= __('Restoring done') . ' (' . basename($restorefilename) . ')';
            }
        } else {
            $result .= __('Nothing founded') . ': (' . basename($restorefilename) . ')';
        }
    }
Example #19
0
<?php 
////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) ReloadCMS Development Team                                 //
//   http://reloadcms.com                                                     //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
//Initialisation
$skin = str_replace('.php', '', basename(__FILE__));
$css_file = DATA_PATH . 'skins/' . $skin . '.ini';
//API
if (!empty($_POST['css_config'])) {
    file_write_contents($css_file, serialize($_POST['css_config']));
    rcms_showAdminMessage(__('Configuration updated'));
}
if (!empty($_POST['reset'])) {
    rcms_delete_files($css_file);
}
if (is_file($css_file)) {
    $css_config = unserialize(file_get_contents($css_file));
} else {
    include SKIN_PATH . $skin . '/style.default.php';
}
// Interface generation
?>
<div id="dialog" title="<?php 
echo __('Skin') . ' ' . $skin . ' &mdash; ' . __('Configuration');
?>
" style="font-size:0.8em;">
<?php 
//Skin configuration
$frm = new InputForm('', 'post', __('Save'));
Example #20
0
                    $action = '';
                }
            }
        } else {
            show_error(__('You cannot archive this topic'));
        }
    } else {
        show_error(__('There is no topic with this id'));
    }
} elseif ($action == 'del_topic') {
    $topic_id = empty($_GET['t']) ? 0 : (int) $_GET['t'];
    if (!empty($topics[$topic_id])) {
        if ($system->checkForRight('FORUM') || $system->user['username'] != 'guest' && $system->user['username'] == $topics[$topic_id]['author_name'] && $topics[$topic_id]['replies'] == 0) {
            rcms_remove_index($topic_id, $topics, true);
            if (is_file(FORUM_PATH . 'topic.' . $topic_id . '.dat')) {
                rcms_delete_files(FORUM_PATH . 'topic.' . $topic_id . '.dat');
            }
            if (file_write_contents(FORUM_PATH . 'topic_index.dat', serialize($topics))) {
                rcms_redirect('?module=' . $module, true);
                $action = '';
            }
        } else {
            show_error(__('You cannot delete this topic'));
        }
    } else {
        show_error(__('There is no topic with this id'));
    }
} elseif ($action == 'del_post') {
    $topic_id = empty($_GET['t']) ? 0 : (int) $_GET['t'];
    $post_id = empty($_GET['p']) ? 0 : (int) $_GET['p'] - 2;
    if (!empty($topics[$topic_id])) {
Example #21
0
/**
 * Deletes HTML document template from FS
 * 
 * @param string $template
 */
function zb_DocsDeleteTemplate($template)
{
    $docpath = DATA_PATH . 'documents/';
    $headerspath = $docpath . 'headers/';
    $templatespath = $docpath . 'templates/';
    rcms_delete_files($headerspath . $template);
    rcms_delete_files($templatespath . $template);
    log_register("DOCS TEMPLATE DELETE " . $template);
}
Example #22
0
//Analog Widget Logic from WP
$select_menus = "<select name=\\'modules[]\\' onChange=\\'if (\$(this).val()!=0) \$(this).prev().val(\$(this).val());\\'>" . "<option value=\\'0\\'>" . __('Select') . '</option>';
foreach ($current as $element => $text) {
    if (substr($element, 0, 1) != '/') {
        $select_menus .= "<option value=\\'" . $element . "\\'>" . $text . '</option>';
    }
}
$select_menus .= '</select> ';
if (!empty($_POST['logic'])) {
    //delete self host
    $_POST['logic']['modules'] = str_replace('http://www.' . $_SERVER['HTTP_HOST'] . '/', '', $_POST['logic']['modules']);
    $_POST['logic']['modules'] = str_replace('http://' . $_SERVER['HTTP_HOST'] . '/', '', $_POST['logic']['modules']);
    //safe config to logicing
    file_write_contents(CONFIG_PATH . 'logic.ini', serialize(str_replace('http://' . $_SERVER['HTTP_HOST'] . '/', '', $_POST['logic'])));
} elseif (post('settingschange')) {
    rcms_delete_files(CONFIG_PATH . 'logic.ini');
}
if (is_file(CONFIG_PATH . 'logic.ini')) {
    $logic = unserialize(file_get_contents(CONFIG_PATH . 'logic.ini'));
}
$frm = new InputForm('', 'post', __('Submit'), '', '', '', 'addlogic');
//logic
$add_logic = '<div>+ ' . __('Module') . " <input type=\\'text\\' name=\\'logic[modules][]\\' size=\\'15\\' /> " . $select_menus . __('Logic') . "<input type=\\'text\\' name=\\'logic[expression][]\\' size=\\'35\\'/> " . "<img src=\\'" . IMAGES_PATH . "skins/neok.gif\\' title=\\'" . __('Delete') . "\\' style=\\'cursor:pointer;display:table-cell;vertical-align:middle;\\' onClick=\\'\$(\$(this).parents().get(0)).remove();\\'>" . '</div>';
$frm->addbreak(__('Logic') . ' <img onClick="$(\'#add_logic\').append(\'' . $add_logic . '\');" title="' . __('Add') . '" src="' . IMAGES_PATH . 'skins/plus.gif" style="cursor:pointer;display:table-cell;vertical-align:middle;"/>&nbsp;&nbsp;&nbsp;');
if (!empty($logic['modules'])) {
    foreach ($logic['modules'] as $i => $value) {
        if (!empty($logic['modules'][$i])) {
            $frm->addrow(__('Module') . ' ' . $frm->text_box('logic[modules][]', @$logic['modules'][$i], 15) . stripslashes($select_menus), ' ' . __('Logic') . ' ' . $frm->text_box('logic[expression][]', @$logic['expression'][$i], 35) . '<img src="' . IMAGES_PATH . 'neok.gif" style="cursor:pointer;display:table-cell;vertical-align:middle;" onClick="$($(this).parents(\'tr\').get(0)).remove();">');
        }
    }
}
Example #23
0
 function deleteArticle($cat_id, $art_id)
 {
     $cat_id = (int) $cat_id;
     $art_id = (int) $art_id;
     if (empty($this->container)) {
         $this->last_error = __('No section selected!');
         return false;
     }
     global $system;
     if ($this->container !== '#root' && $this->container !== '#hidden') {
         if (!($category = $this->getCategory($cat_id))) {
             $this->last_error = __('There are no category with this ID');
             return false;
         }
         if ($category['accesslevel'] > (int) @$system->user['accesslevel'] && !$system->checkForRight('-any-')) {
             $this->last_error = __('Access denied');
             return false;
         }
         $art_prefix = ARTICLES_PATH . $this->container . '/' . $cat_id . '/' . $art_id . '/';
         $art_data =& $this->articles[$this->container][$cat_id][$art_id];
     } else {
         $art_prefix = ARTICLES_PATH . $this->container . '/' . $art_id . '/';
         $art_data =& $this->articles[$this->container][$art_id];
     }
     rcms_delete_files($art_prefix, true);
     if ($this->container !== '#root' && $this->container !== '#hidden') {
         rcms_remove_index($art_id, $this->index[$cat_id], true);
         unset($this->index[$cat_id][$art_id]);
     } else {
         rcms_remove_index($art_id, $this->index, true);
     }
     $this->saveIndex();
     return true;
 }
Example #24
0
function user_delete($username)
{
    $username = basename($username);
    if (!rcms_delete_files(USERS_PATH . $username)) {
        return 5;
    }
    user_remove_from_cache($username, $cache);
    user_activate_admin($username);
    return 0;
}
Example #25
0
 function logMerge($title, $t_d, $t_m, $t_y, $f_d = 1, $f_m = 1, $f_y = 1980)
 {
     $logs = rcms_scandir($this->logging);
     $f = mktime(0, 0, 0, $f_m, $f_d, $f_y);
     $t = mktime(0, 0, 0, $t_m, $t_d, $t_y);
     $to_merge = array();
     foreach ($logs as $log_entry) {
         if (preg_match("/^(.*?)-(.*?)-(.*?)\\.log(|.gz)\$/i", $log_entry, $matches)) {
             $c = mktime(0, 0, 0, $matches[2], $matches[3], $matches[1]);
             if ($c >= $f && $c <= $t) {
                 $to_merge[] = $log_entry;
             }
         }
     }
     if (!empty($to_merge)) {
         if ($this->logging_gz) {
             $suffix = '.gz';
         } else {
             $suffix = '';
         }
         $merged_file = $this->logging . $title . '.tar' . $suffix;
         $merged = new tar();
         $merged->isGzipped = $this->logging_gz;
         $merged->filename = $merged_file;
         $path = getcwd();
         chdir($this->logging);
         foreach ($to_merge as $file) {
             $merged->addFile($file, substr($file, -3) == '.gz');
         }
         chdir($path);
         if ($merged->saveTar()) {
             foreach ($to_merge as $file) {
                 rcms_delete_files($this->logging . $file);
             }
         }
     }
     return true;
 }
Example #26
0
            $_POST['nconfig']['admin_file'] = $admin_file;
        }
    }
    write_ini_file($_POST['nconfig'], CONFIG_PATH . 'config.ini');
    rcms_showAdminMessage(__('Configuration updated'));
}
if (!empty($_POST['redirect'])) {
    //delete self host
    $_POST['redirect']['from_arr'] = str_replace('http://www.' . $_SERVER['HTTP_HOST'] . '/', '', $_POST['redirect']['from_arr']);
    $_POST['redirect']['from_arr'] = str_replace('http://' . $_SERVER['HTTP_HOST'] . '/', '', $_POST['redirect']['from_arr']);
    $_POST['redirect']['to_arr'] = str_replace('http://www.' . $_SERVER['HTTP_HOST'] . '/', '', $_POST['redirect']['to_arr']);
    $_POST['redirect']['to_arr'] = str_replace('http://' . $_SERVER['HTTP_HOST'] . '/', '', $_POST['redirect']['to_arr']);
    //safe config to redirecting
    file_write_contents(CONFIG_PATH . 'redirect.ini', serialize(str_replace('http://' . $_SERVER['HTTP_HOST'] . '/', '', $_POST['redirect'])));
} elseif (isset($_POST['meta_tags']) && is_file(CONFIG_PATH . 'redirect.ini')) {
    rcms_delete_files(CONFIG_PATH . 'redirect.ini');
}
if (isset($_POST['meta_tags'])) {
    file_write_contents(DATA_PATH . 'meta_tags.html', $_POST['meta_tags']);
}
if (isset($_POST['welcome_mesg'])) {
    file_write_contents(DATA_PATH . 'intro.html', $_POST["welcome_mesg"]);
}
if (isset($_POST['clear_cache'])) {
    rcms_clear_directory(CACHE_DIR);
}
$system->config = parse_ini_file(CONFIG_PATH . 'config.ini');
$config =& $system->config;
if (is_file(CONFIG_PATH . 'redirect.ini')) {
    $redirect = unserialize(file_get_contents(CONFIG_PATH . 'redirect.ini'));
}
Example #27
0
 $result = $sitemap->sitemapFileName . '&nbsp;' . __('added successfully') . '<br/>';
 if (!empty($_POST['gz'])) {
     $sitemap->createGZipFile = true;
     $result .= $_POST['filename'] . '.gz&nbsp;' . __('added successfully') . '<br/>';
 }
 $sitemap->createSitemap();
 // create sitemap in memory
 $sitemap->writeSitemap();
 // write sitemap as file
 if (isset($_POST['robots_txt'])) {
     file_write_contents(RCMS_ROOT_PATH . 'robots.txt', $_POST['robots_txt']);
 }
 //save robots.txt
 if (!empty($_POST['robots'])) {
     //build new robots.txt
     rcms_delete_files(RCMS_ROOT_PATH . 'robots.txt');
     $sitemap->updateRobots();
     $result .= 'robots.txt&nbsp;' . __('added successfully') . '<br/>';
 }
 if (!empty($_POST['engines'])) {
     // submit sitemaps to search engines
     $result .= "<pre>";
     $result .= $sitemap->submitSitemap('');
     $result .= "</pre>";
 }
 $result .= __('Memory peak usage: ') . number_format(memory_get_peak_usage() / (1024 * 1024), 2) . "MB";
 $time2 = explode(" ", microtime());
 $time2 = $time2[1];
 $result .= '<br/>' . __('Execution time: ') . number_format($time2 - $time) . "s<br/>";
 $result .= __('Done') . '<br/>';
 $result .= __('Look at') . '&nbsp;<a href="' . $_POST['filename'] . '" target="_blank"> sitemap.xml  </a> &nbsp;<br/>';
Example #28
0
    $frm->hidden('browse_archive', '1');
    $frm->hidden('browse', $_POST['archive']);
    $frm->show();
    $_POST['archive'] = basename($_POST['archive']);
    if (@is_readable($system->logging . $_POST['archive'])) {
        $output = '';
        $archive = new tar();
        $archive->openTAR($system->logging . $_POST['archive']);
        foreach ($_POST['viewlog'] as $logfile) {
            $logfile = basename($logfile);
            if ($gz_contents = $archive->getFile($logfile)) {
                $gz_contents = $gz_contents['file'];
                if (substr($logfile, -3) == '.gz') {
                    file_write_contents($system->logging . $logfile, $gz_contents);
                    $contents = gzfile_get_contents($system->logging . $logfile);
                    rcms_delete_files($system->logging . $logfile);
                } else {
                    $contents =& $gz_contents;
                }
                $output .= rcms_parse_text('[quote=' . $logfile . ']' . $contents . '[/quote]', true, false, true);
            }
        }
        unset($archive);
    }
    rcms_showAdminMessage($output);
} elseif (!empty($_POST['browse_archive']) && !empty($_POST['browse'])) {
    $frm = new InputForm('', 'post', '&lt;&lt;&lt; ' . __('Back'));
    $frm->show();
    $_POST['browse'] = basename($_POST['browse']);
    if (is_readable($system->logging . $_POST['browse'])) {
        $archive = new tar();
Example #29
0
        $msg = __('Nothing founded');
        rcms_mkdir(RCMS_ROOT_PATH . 'uploads/' . $system->user['username']);
        //rcms_redirect('');
    }
}
if (empty($_GET['path'])) {
    $user_path = $start_path;
} else {
    $user_path = realpath($_GET['path']);
    if (strlen($start_path) > strlen($user_path)) {
        $user_path = $start_path;
    }
}
$user_path = str_replace('\\', '/', $user_path) . '/';
if (user_can_delete(get('delete'))) {
    if (!rcms_delete_files($user_path . $_GET['delete'], true)) {
        $msg .= __('Error occurred') . ' ' . $_GET['delete'];
    } else {
        $msg .= __('Deleted') . ' ' . $_GET['delete'];
    }
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo $system->config['encoding'];
?>
">
<?php 
rcms_show_element('meta');
Example #30
0
 function deleteUser($username)
 {
     if (USERS_MYSQL) {
         $username = mysql_real_escape_string($username);
         nr_query("DELETE FROM `users` WHERE `username`='" . $username . "'");
     } else {
         $username = basename($username);
         if (!rcms_delete_files(USERS_PATH . $username)) {
             return false;
         }
     }
     user_remove_from_cache($username, $cache);
     return true;
 }