Esempio n. 1
0
function supppage($idpage)
{
    delfile($idpage);
    global $db;
    if (!$db->Query("delete from contenu where id=" . $idpage)) {
        $db->Kill('Error1');
    }
    return true;
}
Esempio n. 2
0
function suppnews($idalbum)
{
    delfile($idalbum);
    global $db;
    if (!$db->Query("delete from album where id=" . $idalbum)) {
        $db->Kill('Error1');
        return false;
    } else {
        return true;
    }
}
Esempio n. 3
0
function suppevent($idevent)
{
    delfile($idevent);
    global $db;
    if (!$db->Query("delete from event where id=" . $idevent)) {
        $db->Kill('Error1');
        return false;
    } else {
        return true;
    }
}
Esempio n. 4
0
function suppnews($iddoc)
{
    delfile($iddoc);
    global $db;
    if (!$db->Query("delete from document where id=" . $iddoc)) {
        $db->Kill('Error1');
        return false;
    } else {
        return true;
    }
}
Esempio n. 5
0
function supppage($idpage)
{
    delfile($idpage);
    global $db;
    $parent = $db->QuerySingleValue("SELECT parent from page where id=" . $idpage);
    $sqlparen = "select id from page where parent=" . $parent;
    if (!$db->Query("delete from page where id=" . $idpage)) {
        $db->Kill('Error1');
    }
    if ($parent != "") {
        if (!$db->Query($sqlparen)) {
            $db->Kill("");
        }
        if ($db->RowCount() == 0) {
            if (!$db->Query("update page  set app = NULL where id=" . $parent)) {
                $db->Kill('Error1');
            }
        }
    }
    return true;
}
Esempio n. 6
0
    echo 'Kategorie erfolgreich editiert!';
}
#########################################
#########################################
#          Kategorie löschen            #
#########################################
if ($_GET['go'] == 'delete') {
    $zeile = file($catfile);
    $zeilen = sizeof($zeile);
    for ($i = 0; $i < $zeilen; $i++) {
        $eintrag = explode('§', $zeile[$i]);
        if ($eintrag[0] == $_GET['catid']) {
            if ($eintrag[2] != '') {
                // Alte Datei löschen
                $file = $dir . $eintrag[2];
                if (delfile($file) == 0) {
                    echo 'Alte Datei konnte nicht gelöscht werden!';
                }
            }
            $zeilen--;
            for ($j = $i; $j < $zeilen; $j++) {
                $zeile[$j] = $zeile[$j + 1];
            }
        }
    }
    $fp = fopen($catfile, "w+");
    flock($fp, 2);
    for ($i = 0; $i < $zeilen; $i++) {
        fwrite($fp, $zeile[$i]);
    }
    flock($fp, 3);
Esempio n. 7
0
    $lastid = $dbh->lastInsertId();
    $newid = $lastid;
    echo "<script>document.location='{$scriptname}?action=edititem&id={$newid}'</script>";
    echo "<a href='{$scriptname}?action=edititem&amp;id={$newid}'>Go here</a></body></html>";
    exit;
}
/* delete associated file */
if (isset($_GET['delfid'])) {
    /* displayed from showfiles() */
    //remove file link
    $sql = "DELETE from item2file where itemid={$id} AND fileid=" . $_GET['delfid'];
    $sth = db_exec($dbh, $sql);
    //check if others point to this file
    $nlinks = countfileidlinks($_GET['delfid'], $dbh);
    if ($nlinks == 0) {
        delfile($_GET['delfid'], $dbh);
    }
    //echo "$nlinks DELETED ".$_GET['delfid'];
    echo "<script>window.location='{$scriptname}?action={$action}&id={$id}'</script> ";
    echo "<br><a href='{$scriptname}?action={$action}&id={$id}'>Go here</a></body></html>";
    exit;
}
//check for arguments
if (!isset($_GET['id'])) {
    echo "edititem:missing arguments";
    exit;
}
/* update item data */
//if came here from a form post, update db with new values
if (isset($_POST['itemtypeid']) && $_GET['id'] != "new" && isvalidfrm()) {
    //get form post variables and create the sql query
Esempio n. 8
0
    $dbo = new dbex();
    dbtarget('w', $dbServs);
    $pre = get_argg('pre');
    bakindata($dbo, '../docs/' . $pre . '_1.sql');
    echo "<script language='javascript'> alert('{$d_langpackage->d_lead_suc}'); location.href='database.save.php'; </script>";
}
//删除备份文件
$fid = get_argg('fid');
if ($fid) {
    $is_check = check_rights("g05");
    if (!$is_check) {
        echo $m_langpackage->m_no_pri;
        exit;
    }
    $file_pre = $fid . "_1.sql";
    delfile('../docs/' . $file_pre);
    echo "{$d_langpackage->d_del_suc}";
    exit;
}
function delfile($filename, $check = 1)
{
    @chmod($filename, 0777);
    return @unlink($filename);
}
function bakindata($dbo, $filename)
{
    $sql = file($filename);
    $query = '';
    $num = 0;
    foreach ($sql as $key => $value) {
        $value = trim($value);
Esempio n. 9
0
 function tminisave($have)
 {
     global $_M;
     //新方法
     $this->iniclass->tminisave($have);
     $wap_ok = 0;
     $cglist = $this->configlist;
     if ($have['mobile'] == '1') {
         $have['wap_skin_user'] = $have['met_skin_user'];
         $have['wap_skin_css'] = $have['met_skin_css'];
         $cglist = $this->mobile_configlist;
         //$have['flash_10001'] = $_M['config']['flash_10001'];
         $have['flash_10001'] = '1|' . $have['met_flash_10001_y'];
         $wap_ok = 1;
     } else {
         /*备用字段*/
         $preview['otherinfo']['imgurl1'] = $have['imgurl1'];
         $preview['otherinfo']['imgurl2'] = $have['imgurl2'];
         $query = "update {$_M[table][otherinfo]} SET ";
         for ($i = 1; $i <= 10; $i++) {
             $infoval = $have['info' . $i];
             if (isset($have['info' . $i])) {
                 $query .= "info{$i} = '{$infoval}',";
             }
         }
         $query .= "\n\t\t\t\timgurl1 = '{$have['imgurl1']}',\n\t\t\t\timgurl2 = '{$have['imgurl2']}'\n\t\t\t\twhere id='{$have['otherinfoid']}'\n\t\t\t";
         DB::query($query);
         load::sys_func('file');
         delfile(PATH_WEB . "cache/otherinfo_{$this->lang}.inc.php");
         $have['flash_10001'] = '1|' . $have['met_flash_10001_x'] . '|' . $have['met_flash_10001_y'] . '|' . $have['met_flash_10001_imgtype'];
     }
     $cglist[] = 'met_productTabok';
     $cglist[] = 'met_productTabname';
     $cglist[] = 'met_productTabname_1';
     $cglist[] = 'met_productTabname_2';
     $cglist[] = 'met_productTabname_3';
     $cglist[] = 'met_productTabname_4';
     configsave($cglist, $have, $this->lang);
     /*保存系统配置*/
     /*保存banner设置*/
     $nowidold = array();
     $bannerid = DB::get_all("select * from {$_M[table][flash]} where wap_ok='{$wap_ok}' and (module like '%,10001,%' or module = 'metinfo') and lang='{$this->lang}' and img_path!='' order by no_order ");
     foreach ($bannerid as $key => $val) {
         $nowidold[] = $val['id'];
     }
     $nowidnew = array();
     $have['indexbannerlist'] = str_replace("\\", "", $have['indexbannerlist']);
     $bannerlist = json_decode($have['indexbannerlist'], true);
     foreach ($bannerlist as $key => $val) {
         if ($val['img_path'] != '') {
             if (!strstr($val['img_path'], "../")) {
                 $val['img_path'] = '../' . $val['img_path'];
             }
             if ($val['id']) {
                 $query = "update {$_M[table][flash]} SET \n\t\t\t\t\timg_title = '{$val['img_title']}',\n\t\t\t\t\timg_path  = '{$val['img_path']}',\n\t\t\t\t\timg_link  = '{$val['img_link']}',\n\t\t\t\t\tno_order  = '{$key}'\n\t\t\t\t\tWHERE id  = '{$val['id']}'";
                 $nowidnew[] = $val['id'];
             } else {
                 $query = "INSERT INTO {$_M[table][flash]} SET \n\t\t\t\t\timg_title = '{$val['img_title']}',\n\t\t\t\t\timg_path  = '{$val['img_path']}',\n\t\t\t\t\timg_link  = '{$val['img_link']}',\n\t\t\t\t\tno_order  = '{$key}',\n\t\t\t\t\tmodule    = ',10001,',\n\t\t\t\t\twap_ok    = '{$wap_ok}',\n\t\t\t\t\tlang      = '{$this->lang}'";
             }
             DB::query($query);
         }
     }
     $nowid = array_diff($nowidold, $nowidnew);
     if ($nowid) {
         foreach ($nowid as $key => $val) {
             $query = "delete from {$_M[table][flash]} where id='{$val}'";
             DB::query($query);
         }
     }
 }
Esempio n. 10
0
 function output_onpost_table_photosview()
 {
     global $vars, $db, $main;
     if (isset($_POST['id'])) {
         foreach ((array) $_POST['id'] as $key => $value) {
             $db->del("photos", "id = '" . $value . "'");
             $uploaddir = $vars['folders']['photos'];
             $filename = 'photo-' . $value . ".*";
             delfile(ROOT_PATH . $uploaddir . $filename);
             $filename = 'photo-' . $value . "-*.*";
             delfile(ROOT_PATH . $uploaddir . $filename);
         }
     }
     foreach ((array) array('N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW', 'PANORAMIC') as $value) {
         if (isset($_FILES[$value]['tmp_name']) && $_FILES[$value]['tmp_name'] != '') {
             if (@(!imagecreatefromjpeg($_FILES[$value]['tmp_name']))) {
                 continue;
             }
             $db->add("photos", array('node_id' => intval(get('node')), 'type' => 'view', 'view_point' => $value, 'info' => $_POST['info-' . $value]));
             $ins_id = $db->insert_id;
             $uploaddir = $vars['folders']['photos'];
             $filename = 'photo-' . $ins_id . '.jpg';
             $filename_s = 'photo-' . $ins_id . '-s.jpg';
             if (@move_uploaded_file($_FILES[$value]['tmp_name'], ROOT_PATH . $uploaddir . $filename) === FALSE) {
                 $db->del("photos", "id = '" . $ins_id . "'");
                 log_admin_action($nodes, "#photos_node#" . get('node'), "upload_failed");
                 #@#
                 $main->message->set_fromlang("error", "upload_file_failed");
                 return;
             }
             if ($value == 'PANORAMIC') {
                 $image_s = resizeJPG(ROOT_PATH . $uploaddir . $filename, 600, 200);
             } else {
                 $image_s = resizeJPG(ROOT_PATH . $uploaddir . $filename, 200, 200);
             }
             imagejpeg($image_s, ROOT_PATH . $uploaddir . $filename_s);
         } elseif ($_POST['info-' . $value] != '') {
             $db->set("photos", array('info' => $_POST['info-' . $value]), "node_id = " . intval(get('node')) . " AND view_point = '" . $value . "'");
         }
     }
     log_admin_action($nodes, "#photos_node#" . get('node'), "update_success");
     #@#
     $main->message->set_fromlang('info', 'update_success', makelink("", TRUE));
 }
Esempio n. 11
0
function deletefile($fid)
{
    global $DreamCMS;
    $rs = $DreamCMS->db->get_row("SELECT * FROM `#DC@__file` WHERE `id`='{$fid}' LIMIT 1");
    delfile(DCPATH . $rs->path);
    if ($rs->thumbpath) {
        delfile(DCPATH . $rs->thumbpath);
        $DreamCMS->db->query("UPDATE `#DC@__article` SET `pic`='' WHERE `pic`='{$rs->thumbpath}'");
    }
    $DreamCMS->db->query("UPDATE `#DC@__article` SET `pic`='' WHERE `pic`='{$rs->path}'");
    $DreamCMS->db->query("DELETE FROM `#DC@__file` WHERE `id`='{$fid}' LIMIT 1");
    return true;
}
Esempio n. 12
0
function deletefile($fid)
{
    global $iCMS;
    $rs = $iCMS->db->getRow("SELECT * FROM `#iCMS@__file` WHERE `id`='{$fid}' LIMIT 1");
    $thumbfilepath = gethumb($rs->path, '', '', true, true);
    delfile(iPATH . $rs->path, false);
    echo $rs->path . ' 文件删除…<span style="color:green;">√</span><br />';
    if ($thumbfilepath) {
        foreach ($thumbfilepath as $wh => $fp) {
            delfile($fp, false);
            echo '缩略图 ' . $wh . ' 文件删除…<span style="color:green;">√</span><br />';
        }
    }
    $iCMS->db->query("UPDATE `#iCMS@__article` SET `pic`='' WHERE `pic`='{$rs->path}'");
    $iCMS->db->query("DELETE FROM `#iCMS@__file` WHERE `id`='{$fid}' LIMIT 1");
    return true;
}
Esempio n. 13
0
    $tmp_name = $_FILES['face']['tmp_name'];
    $tmp_file_name_arr = explode('.', $filename);
    $new_file_name = $tmp_file_name_arr[0] . '_' . time() . '.' . $tmp_file_name_arr[1];
    if (file_exists($_FILES['face']['tmp_name'])) {
        savefile($tmp_name, $new_file_name);
    } else {
        $result = array('status' => -1, 'msg' => '上传图片失败');
        echo json_encode($result);
        return;
    }
    $url = $host_sae . $new_file_name;
    $result = array('status' => 1, 'msg' => 'ok', 'info' => array('url' => $url));
    $r = detect($url);
    if ($r['status'] == 1) {
        if (empty($r['output']['face'])) {
            delfile($new_file_name);
            $result = array('status' => -2, 'msg' => '上传的图片没有脸呀,亲');
            echo json_encode($result);
            return;
        }
        $college_id = charge($r['output']);
        $result['info']['college'] = array('id' => $college_id, 'name' => $college[$college_id]);
        $result['info']['face'] = $r['output']['face'];
    }
    echo json_encode($result);
    return;
}
function detect($url)
{
    if (!$url) {
        return array('status' => -1);
Esempio n. 14
0
/**
 * 删除文件夹
 * @param  string  $fileDir  要删除的文件夹
 * @param  int     $type  	 0:删除本文件夹及文件夹下文件,1:只删除本文件夹下的文件。默认都删除
 * @return boolean 			 删除成功返回true,否则返回false
 */
function deldir($fileDir, $type = 0)
{
    $fileDir = path_absolute($fileDir);
    @clearstatcache();
    $fileDir = substr($fileDir, -1) == '/' ? $fileDir : $fileDir . '/';
    if (!is_dir($fileDir)) {
        return false;
    }
    $resource = opendir($fileDir);
    @clearstatcache();
    while (($file = readdir($resource)) !== false) {
        if ($file == '.' || $file == '..') {
            continue;
        }
        if (!is_dir($fileDir . $file)) {
            delfile($fileDir . $file);
        } else {
            deldir($fileDir . $file);
        }
    }
    closedir($resource);
    @clearstatcache();
    if ($type == 0) {
        rmdir($fileDir);
    }
    return true;
}
Esempio n. 15
0
            $htaccess = "RewriteEngine On\n";
            $htaccess .= "RewriteBase {$iCMS->dir}\n";
            $htaccess .= "# 首页\n";
            $htaccess .= "RewriteRule ^index" . preg_quote($_POST['rewrite']['ext'], '/') . "\$ index.php\n";
            $htaccess .= "# 独立页面、栏目、文章、评论、搜索、留言、标签\n";
            if ($_POST['customlink'] == '2' && empty($_POST['rewrite']['dir'])) {
                if ($_POST['linkmode'] == 'id') {
                    $htaccess .= "RewriteRule ^(list|show){$preg_quote_split}(.*)\$ \$1.php?id{$preg_quote_split}\$2\n";
                } elseif ($_POST['linkmode'] == 'title') {
                    $htaccess .= "RewriteRule ^(list|show){$preg_quote_split}(.*)\$ \$1.php?t{$preg_quote_split}\$2\n";
                }
                $htaccess .= "RewriteRule ^index{$preg_quote_split}page{$preg_quote_split}(.*)" . preg_quote($_POST['rewrite']['ext'], '/') . "\$ index.php?page{$preg_quote_split}\$1" . preg_quote($_POST['rewrite']['ext'], '/') . "\n";
                $htaccess .= "RewriteRule ^index{$preg_quote_split}(.*)" . preg_quote($_POST['rewrite']['ext'], '/') . "\$ index.php?p{$preg_quote_split}\$1" . preg_quote($_POST['rewrite']['ext'], '/') . "\n";
                $htaccess .= "RewriteRule ^comment{$preg_quote_split}(.*)\$ comment.php?aid{$preg_quote_split}\$1\n";
                $htaccess .= "RewriteRule ^tag{$preg_quote_split}(.*)\$ tag.php?t{$preg_quote_split}\$1\n";
                $htaccess .= "RewriteRule ^search{$preg_quote_split}(.*)\$ search.php?keyword{$preg_quote_split}\$1\n";
            } else {
                $htaccess .= "RewriteRule ^(index|list|show|comment|search|message|tag)" . preg_quote($_POST['rewrite']['dir'], '/') . "(.*)\$ \$1.php?\$2\n";
            }
            writefile(iPATH . '.htaccess', $htaccess);
        }
        if ($_POST['ishtm'] == "1") {
            delfile(iPATH . '.htaccess');
            //			delfile(iPATH.$config['indexname'].'.html');
        }
        $iCMS->clear_compiled_tpl();
        redirect('配置已更新', __REF__);
    }
    exit;
}
include iCMS_admincp_tpl("setting");
Esempio n. 16
0
    return sprintf($retstring, $size, $sizestring);
}
if (isset($ydel) && $ydel != "") {
    delDir($ydel);
}
if (isset($mdel) && $mdel != "") {
    delDir($mdel);
}
if (isset($fdel) && $fdel != "") {
    delfile($fdel);
}
if (isset($mzip) && $mzip != "") {
    makeZip($mzip, $path, $year, $month);
}
if (isset($ipdel) && $ipdel != "" && $done) {
    delfile($ipdel);
    copy("config/index/chat_ip_logs.htm", "acount/pages/chat_ip_logs.htm");
    chmod("acount/pages/chat_ip_logs.htm", 0666);
}
?>
<A NAME="home"></A>
<?php 
if (isset($Message)) {
    echo "<div><table align=center border=0 cellpadding=3 class=menu style=background:white><tr><td class=success align=center><br /><h4>" . $Message . "</h4></td></tr></table></div>";
}
if (file_exists("acount/pages/chat_ip_logs.htm")) {
    ?>
<P CLASS=title><?php 
    echo sprintf(A_CHAT_LOGS_1, APP_NAME);
    ?>
</P>
Esempio n. 17
0
function MakeArticleHtm($aid = '', $p = '1')
{
    global $DreamCMS;
    if (!$DreamCMS->config['ishtm'] || empty($aid)) {
        return false;
    }
    $DreamCMS->mode = 'CreateHtml';
    //$htmldate=$DreamCMS->Show($aid,$p);		//原
    $htmldate = $DreamCMS->Show($aid, $p, 1);
    //zhaoyanmin 更新静态页和添加静态页时有跳转地址防止跳转
    //$body=explode('<div style="page-break-after: always"><span style="display: none">&nbsp;</span></div>',$DreamCMS->result->body);
    $body = explode('<div style="page-break-after: always;"><span style="DISPLAY:none">&nbsp;</span></div>', $DreamCMS->result->body);
    //zhaoyanmin		内容分页
    $total = count($body);
    if ($DreamCMS->config['htmdircreaterule'] == '0') {
        $FDir = $DreamCMS->result->catalogdir;
    } elseif ($DreamCMS->config['htmdircreaterule'] == '1') {
        $FDir = _getdate('Y-m-d');
    } elseif ($DreamCMS->config['htmdircreaterule'] == '2') {
        $FDir = str_replace(array('Y', 'y', 'm', 'n', 'd', 'j', 'C'), array(_getdate('Y'), _getdate('y'), _getdate('m'), _getdate('n'), _getdate('d'), _getdate('j'), $DreamCMS->result->catalogdir), $DreamCMS->config['customhtmdircreaterule']);
    } else {
        $FDir = _getdate('Ymd');
    }
    $ODir = substr($DreamCMS->result->filename, 0, strrpos($DreamCMS->result->filename, '/'));
    $_Dir = $ODir == $FDir ? $ODir : $FDir;
    $RootDir = DCPATH . $DreamCMS->config['htmdir'] . $_Dir;
    createdir($RootDir);
    switch ($DreamCMS->config['htmnamerule']) {
        case "0":
            $filename = $DreamCMS->result->id;
            break;
        case "pinyin":
            $filename = $DreamCMS->result->customlink;
            break;
        case "pubdate":
            $filename = $DreamCMS->result->pubdate;
            break;
        default:
            $filename = $DreamCMS->result->id;
    }
    $NewFileName = $_Dir . '/' . $filename;
    $total > 1 && $p != 1 && ($filename .= '_' . $p);
    $FilePath = $RootDir . "/{$filename}" . $DreamCMS->config['htmlext'];
    if ($NewFileName == $DreamCMS->result->filename) {
        writefile($FilePath, $htmldate);
    } else {
        delfile(DCPATH . $DreamCMS->config['htmdir'] . $DreamCMS->result->filename . $DreamCMS->config['htmlext']);
        if ($total > 1) {
            for ($i = 1; $i <= $total; $i++) {
                delfile(DCPATH . $DreamCMS->config['htmdir'] . $DreamCMS->result->filename . '_' . $i . $DreamCMS->config['htmlext']);
            }
        }
        writefile($FilePath, $htmldate);
    }
    $total > 1 && $p < $total && MakeArticleHtm($aid, $p + 1);
    $DreamCMS->db->query("UPDATE `#DC@__article` SET `filename` = '{$NewFileName}' WHERE `id` ='{$aid}'");
    return true;
}
Esempio n. 18
0
File: file.php Progetto: n2i/xvnkb
    $AppUI->setMsg('You dont have permission to ' . $cmd . ' file', UI_MSG_ERROR);
    $AppUI->redirect('&m=tasks&a=view&task_id=' . $obj->task_id);
    exit;
}
switch ($cmd) {
    case 'get':
        getfile();
        break;
    case 'put':
        putfile();
        break;
    case 'update':
        updatefile();
        break;
    case 'delete':
        delfile();
        break;
    default:
        break;
}
$task_folder = $root . '/' . $obj->task_project . '/' . $obj->task_id;
if (!is_dir($task_folder)) {
    if (version_compare(phpversion(), '5.0') < 0) {
        $project_folder = $root . '/' . $obj->task_project;
        if (!is_dir($root)) {
            mkdir($root, 0700);
        }
        if (!is_dir($project_folder)) {
            mkdir($project_folder, 0700);
        }
        if (!is_dir($task_folder)) {
Esempio n. 19
0
 function DelBanner($id = 0)
 {
     if ($id > 0) {
         $_REQUEST['id'] = $id;
     }
     $dataset = new A_DataSet(STRUCTURE);
     if ($row = $dataset->Delete()) {
         delfile($row['filepath']);
         return true;
     } else {
         return false;
     }
 }
                if ($_POST['linkmode'] == 'id') {
                    $htaccess .= "RewriteRule ^(list|show){$preg_quote_split}(.*)\$ \$1.php?id{$preg_quote_split}\$2\n";
                } elseif ($_POST['linkmode'] == 'title') {
                    $htaccess .= "RewriteRule ^(list|show){$preg_quote_split}(.*)\$ \$1.php?t{$preg_quote_split}\$2\n";
                }
                $htaccess .= "RewriteRule ^(index){$preg_quote_split}(.*)\$ \$1.php?p{$preg_quote_split}\$2\n";
                $htaccess .= "RewriteRule ^(comment){$preg_quote_split}(.*)\$ \$1.php?aid{$preg_quote_split}\$2\n";
                $htaccess .= "RewriteRule ^(tag){$preg_quote_split}(.*)\$ \$1.php?t{$preg_quote_split}\$2\n";
                $htaccess .= "RewriteRule ^(search){$preg_quote_split}(.*)\$ \$1.php?keyword{$preg_quote_split}\$2\n";
            } else {
                $htaccess .= "RewriteRule ^(index|list|show|comment|search|message|tag)" . preg_quote($_POST['rewrite']['dir'], '/') . "(.*)\$ \$1.php?\$2\n";
            }
            writefile(DCPATH . '.htaccess', $htaccess);
        }
        if ($_POST['ishtm'] == "1") {
            delfile(DCPATH . '.htaccess');
            //			delfile(DCPATH.$config['indexname'].'.html');
        }
        $DreamCMS->clear_compiled_tpl();
        redirect('配置已更新', $_SERVER['HTTP_REFERER']);
    }
    exit;
}
da_admin_head();
?>

<link rel="stylesheet" href="images/style.css" type="text/css" media="all" />
<script type="text/JavaScript">admincpnav('首页&nbsp;&raquo;&nbsp;系统设置','');</script>
<div class="container" id="cpcontainer">
  <h3>系统设置</h3>
  <form name="cpform" method="post" action="admincp.php?do=setting&operation=post" id="cpform" >
Esempio n. 21
0
                $db->query($query);
            }
        }
        $db->query("INSERT INTO " . $tablepre . "admin_member(username,password,name,sex,intotime,intime,outtime,ipadd,hit,powergroup,inputclassid,isclass) VALUES ('{$username}','{$password}','{$username}',1,{$nowtime},{$nowtime},{$nowtime},0,0,1,1,1)");
        $db->query("UPDATE " . $tablepre . "config SET value='{$domain}' WHERE valname='domain'");
        $db->query("UPDATE " . $tablepre . "config SET value='{$sitename}' WHERE valname='sitename'");
        $db->query("UPDATE " . $tablepre . "config SET value='{$admine_mail}' WHERE valname='admine_mail'");
        $db->query("UPDATE " . $tablepre . "lngpack SET langstr='{$sitename}' WHERE keycode='sitename'");
        foreach ($func_app as $key => $value) {
            if ($value['isdel'] && !in_array($value['appcode'], $apptype)) {
                $app_sql_menuid = implode(',', $value['menuid']);
                $db_where = "mlid IN ({$app_sql_menuid})";
                $db->query('UPDATE ' . $tablepre . 'menulink SET isclass=0 WHERE ' . $db_where);
                $db->query('UPDATE ' . $tablepre . 'apply SET isetup=0 WHERE ' . "applycode='{$value['appcode']}'");
                foreach ($value['file'] as $filename) {
                    $appdelfile = admin_ROOT . $filename;
                    delfile($appdelfile);
                }
            } else {
                $db->query('UPDATE ' . $tablepre . 'apply SET isetup=1 WHERE ' . "applycode='{$value['appcode']}'");
            }
        }
        if (!file_exists($installlock)) {
            @touch(admin_ROOT . './datacache/install.lock');
        }
        $setupclass = true;
        if ($setupclass) {
            echo '<script type="text/javascript">document.getElementById("laststep").disabled=false;document.getElementById("laststep").value = \'安装成功\';</script>' . "\r\n";
        }
    }
}
Esempio n. 22
0
function delArticle($id, $uid = '-1', $postype = '1')
{
    global $iCMS;
    $sql = $uid != "-1" ? "and `userid`='{$uid}' and `postype`='{$postype}'" : "";
    $id = (int) $id;
    $art = $iCMS->db->getRow("SELECT * FROM `#iCMS@__article` WHERE id='{$id}' {$sql} Limit 1");
    if ($art->pic) {
        $usePic = $iCMS->db->getValue("SELECT id FROM `#iCMS@__article` WHERE `pic`='{$art->pic}' and `id`<>'{$id}'");
        if (empty($usePic)) {
            $thumbfilepath = gethumb($art->pic, '', '', true, true);
            delfile(iPATH . $art->pic);
            echo $art->pic . ' 文件删除…<span style="color:green;">√</span><br />';
            if ($thumbfilepath) {
                foreach ($thumbfilepath as $wh => $fp) {
                    delfile($fp);
                    echo '缩略图 ' . $wh . ' 文件删除…<span style="color:green;">√</span><br />';
                }
            }
            $iCMS->db->query("DELETE FROM `#iCMS@__file` WHERE `path` = '{$art->pic}'");
            echo $art->pic . ' 数据删除…<span style="color:green;">√</span><br />';
        } else {
            echo $art->pic . '文件 其它文章正在使用,请到文件管理删除…<span style="color:green;">×</span><br />';
        }
    }
    $catalog = $iCMS->cache('catalog.cache', 'include/syscache', 0, true);
    $art->catalogdir = $iCMS->cdir($catalog[$art->cid]);
    $_urlArray = array('id' => $art->id, 'link' => $art->customlink, 'url' => $art->url, 'dir' => $art->catalogdir, 'pubdate' => $art->pubdate);
    $body = $iCMS->db->getValue("SELECT `body` FROM `#iCMS@__articledata` WHERE aid='{$id}' Limit 1");
    if ($iCMS->config['ishtm'] && empty($art->url)) {
        $bArray = explode('<div style="page-break-after: always"><span style="display: none">&nbsp;</span></div>', $body);
        $total = count($bArray);
        if ($total > 1) {
            for ($i = 0; $i <= $total; $i++) {
                $filename = $iCMS->iurl('show', $_urlArray, $i, iPATH);
                echo getfilepath($filename, iPATH, '-') . ' 静态文件删除…<span style="color:green;">√</span><br />';
                delfile($filename, false);
            }
        }
    }
    $frs = $iCMS->db->getArray("SELECT `path` FROM `#iCMS@__file` WHERE `aid`='{$id}'");
    for ($i = 0; $i < count($frs); $i++) {
        if (!empty($frs[$i])) {
            $frs[$i]['path'] && delfile(iPATH . $frs[$i]['path']);
            echo $frs[$i]['path'] . ' 文件删除…<span style="color:green;">√</span><br />';
        }
    }
    if ($art->tags) {
        $tagArray = explode(",", $art->tags);
        foreach ($tagArray as $k => $v) {
            if ($iCMS->db->getValue("SELECT `count` FROM `#iCMS@__tags` WHERE `name`='{$v}'") == "1") {
                $iCMS->db->query("DELETE FROM `#iCMS@__tags`  WHERE `name`='{$v}'");
            } else {
                $iCMS->db->query("UPDATE `#iCMS@__tags` SET  `count`=count-1  WHERE `name`='{$v}'");
            }
        }
        echo ' 标签更新…<span style="color:green;">√</span><br />';
    }
    $iCMS->db->query("DELETE FROM `#iCMS@__file` WHERE `aid`='{$id}'");
    echo ' 相关文件数据删除…<span style="color:green;">√</span><br />';
    $iCMS->db->query("DELETE FROM `#iCMS@__comment` WHERE aid='{$id}'");
    echo ' 评论数据删除…<span style="color:green;">√</span><br />';
    $iCMS->db->query("DELETE FROM `#iCMS@__article` WHERE id='{$id}'");
    $iCMS->db->query("DELETE FROM `#iCMS@__articledata` WHERE `id`='{$id}'");
    echo ' 文章数据删除…<span style="color:green;">√</span><br />';
    $iCMS->db->query("UPDATE `#iCMS@__catalog` SET `count` = count-1 WHERE `id` ='{$art->cid}' LIMIT 1");
    echo ' 栏目数据更新…<span style="color:green;">√</span><br />';
    echo ' 删除完成…<span style="color:green;">√</span><br />';
    return true;
}
Esempio n. 23
0
function delfile($deldir)
{
    if (@is_file($deldir)) {
        @chmod($deldir, 0777);
        return @unlink($deldir);
    } else {
        if (@is_dir($deldir)) {
            if (($mydir = @opendir($deldir)) == NULL) {
                return false;
            }
            while (false !== ($file = @readdir($mydir))) {
                $name = File_Str($deldir . '/' . $file);
                if ($file != '.' && $file != '..') {
                    delfile($name);
                }
            }
            @closedir($mydir);
            @chmod($deldir, 0777);
            return @rmdir($deldir) ? true : false;
        }
    }
}
Esempio n. 24
0
function delfile($arg)
{
    if (file_exists($arg)) {
        @chmod($arg, 0755);
        if (is_dir($arg)) {
            $handle = opendir($arg);
            while (false !== ($aux = readdir($handle))) {
                if ($aux != "." && $aux != "..") {
                    delfile($arg . "/" . $aux);
                }
            }
            @closedir($handle);
            rmdir($arg);
        } else {
            unlink($arg);
        }
    }
}
Esempio n. 25
0
 }
 if ($width == $_width && $height == $_height) {
     //不对源图缩放
     $_img = icf($tMap[$type], $iPic);
     $_Type = $_img['type'];
 } else {
     $img = icf($tMap[$type], $iPic);
     $_Type = $img['type'];
     if ($img['res']) {
         $thumb = imagecreatetruecolor($_width, $_height);
         imagecopyresampled($thumb, $img['res'], 0, 0, 0, 0, $_width, $_height, $width, $height);
         $_tmpfile = $iCMS->config['uploadfiledir'] . '/crop_tmp_' . time() . rand(1, 999999);
         __image($thumb, $_Type, getfilepath($_tmpfile, iPATH, '+'));
         $_tmpfile .= '.' . $_Type;
         $_img = icf($tMap[$type], $_tmpfile);
         delfile($_tmpfile);
     }
 }
 if ($_img['res']) {
     $_thumb = imagecreatetruecolor($w, $h);
     imagecopyresampled($_thumb, $_img['res'], 0, 0, $x, $y, $w, $h, $w, $h);
     $thumbpath = substr($iPic, 0, strrpos($iPic, '/')) . "/thumb";
     $picName = substr($iPic, 0, strrpos($iPic, '.'));
     $picName = substr($picName, strrpos($picName, '/'));
     $fileName = $thumbpath . $picName . '_' . $w . 'x' . $h;
     createdir($thumbpath);
     __image($_thumb, $_img['type'], $fileName);
     $fileName .= '.' . $_Type;
     alert($pic . ' 剪裁成功!', 'javascript:insert("' . $iCMS->dir . getfilepath($fileName, iPATH, '-') . '","' . $_POST['in'] . '");');
 }
 break;
Esempio n. 26
0
function File_Delete($file, $folder){

	if (file_exists($folder.$file)){
		delfile($folder.$file);
	}

}
Esempio n. 27
0
function delArticle($id)
{
    global $DreamCMS;
    $id = (int) $id;
    $art = $DreamCMS->db->get_row("SELECT `pic`,`filename`,`cid`,`tags`FROM `#DC@__article` WHERE id='{$id}' Limit 1");
    if ($art->pic) {
        $thumbfilepath = gethumb($art->pic);
        delfile(DCPATH . $art->pic);
        $thumbfilepath && delfile(DCPATH . $art->pic);
        $DreamCMS->db->query("DELETE FROM `#DC@__file` WHERE `path` = '{$art->pic}'");
    }
    $body = $DreamCMS->db->get_var("SELECT `body` FROM `#DC@__articledata` WHERE aid='{$id}' Limit 1");
    if ($art->filename) {
        $bArray = explode('<div style="page-break-after: always"><span style="display: none">&nbsp;</span></div>', $body);
        $total = count($bArray);
        delfile(DCPATH . $DreamCMS->config['htmdir'] . $art->filename . ".html");
        if ($total > 1) {
            for ($i = 1; $i <= $total; $i++) {
                delfile(DCPATH . $DreamCMS->config['htmdir'] . $art->filename . '_' . $i . '.html');
            }
        }
    }
    $frs = $DreamCMS->db->get_results("SELECT `path`, `thumbpath` FROM `#DC@__file` WHERE `aid`='{$id}'");
    for ($i = 0; $i < count($frs); $i++) {
        if (!empty($frs[$i])) {
            $frs[$i]['path'] && delfile(DCPATH . $frs[$i]['path']);
            $frs[$i]['thumbpath'] && delfile(DCPATH . $frs[$i]['thumbpath']);
        }
    }
    if ($art->tags) {
        $tagArray = explode(" ", $art->tags);
        foreach ($tagArray as $k => $v) {
            if ($DreamCMS->db->get_var("SELECT `count` FROM `#DC@__tags` WHERE `name`='{$v}'") == "1") {
                $DreamCMS->db->query("DELETE FROM `#DC@__tags`  WHERE `name`='{$v}'");
            } else {
                $DreamCMS->db->query("UPDATE `#DC@__tags` SET  `count`=count-1  WHERE `name`='{$v}'");
            }
        }
    }
    $DreamCMS->db->query("DELETE FROM `#DC@__file` WHERE `aid`='{$id}'");
    $DreamCMS->db->query("DELETE FROM `#DC@__comment` WHERE aid='{$id}'");
    $DreamCMS->db->query("DELETE FROM `#DC@__article` WHERE id='{$id}'");
    $DreamCMS->db->query("DELETE FROM `#DC@__articledata` WHERE `id`='{$id}'");
    $DreamCMS->db->query("UPDATE `#DC@__catalog` SET `count` = count-1 WHERE `id` ='{$art->cid}' LIMIT 1");
    return true;
}
Esempio n. 28
0
 function dositemapeditor()
 {
     global $_M;
     $configlist = array();
     $configlist[] = 'met_sitemap_auto';
     $configlist[] = 'met_sitemap_not1';
     $configlist[] = 'met_sitemap_not2';
     $configlist[] = 'met_sitemap_lang';
     $configlist[] = 'met_sitemap_xml';
     $configlist[] = 'met_sitemap_txt';
     configsave($configlist);
     /*保存系统配置*/
     load::sys_func('file');
     /*验证读写权限*/
     function yanquan($fname)
     {
         global $_M;
         $r = false;
         if (!file_exists(PATH_WEB . $fname)) {
             file_put_contents(PATH_WEB . $fname, 'metinfo');
             $str = 'metinfo';
         } else {
             $str = file_get_contents(PATH_WEB . $fname);
         }
         if (!file_put_contents(PATH_WEB . $fname, $str)) {
             $r = true;
         }
         return $r;
     }
     $err = false;
     if (!$_M['form']['met_sitemap_xml']) {
         delfile(PATH_WEB . "/sitemap.xml");
     } else {
         $err = yanquan('sitemap.xml');
     }
     if (!$_M['form']['met_sitemap_txt']) {
         delfile(PATH_WEB . "/sitemap.txt");
     } else {
         $err = yanquan('sitemap.txt');
     }
     if ($err) {
         turnover("{$_M[url][own_form]}a=dositemap", $_M['form']['otherinfocache2']);
     } else {
         $sitemaptype = $_M['form']['met_sitemap_xml'] ? 'xml' : ($_M['form']['met_sitemap_txt'] ? 'txt' : 0);
         sitemap_robots($sitemaptype);
         if ($_M['form']['met_sitemap_xml'] || $_M['form']['met_sitemap_txt']) {
             $gent = "sitemap/index.php?lang={$_M[lang]}&htmsitemap={$_M['config']['met_member_force']}";
             $curl = load::sys_class('curl', 'new');
             $curl->set('host', $_M['url']['site']);
             $curl->set('file', $gent);
             $post = array('post' => '');
             $curl->curl_post($post);
         }
         turnover("{$_M[url][own_form]}a=dositemap");
     }
 }
Esempio n. 29
0
function delfiles($files)
{
    $result = array("error" => -2);
    $path = $_SERVER['DOCUMENT_ROOT'];
    $path = trim($path, "/");
    $reffiles = array();
    $befordelfun = $config["beforedelfile"];
    $afterdelfun = $config["afterdelfile"];
    if (is_array($files)) {
        for ($i = 0; $i < count($files); $i++) {
            if (!delfile($files[$i], $befordelfun, $afterdelfun, $path)) {
                $reffiles[] = $files[$i]->fname;
            }
        }
    } else {
        if (!delfile($files, $befordelfun, $afterdelfun, $path)) {
            $reffiles[] = $files->fname;
        }
    }
    if (count($reffiles) > 0) {
        $result = array("error" => -3, "nrfiles" => $reffiles);
    } else {
        $result = array("error" => 0);
    }
    return $result;
}
Esempio n. 30
0
    $s .= sprintf("%1s%1s%1s", $world['read'], $world['write'], $world['execute']);
    return trim($s);
}
//===================Delect File=============================
$del = $_GET['del'];
function delfile($name)
{
    passthru("del " . $name);
}
function deldir($name)
{
    passthru("rmdir " . $name);
}
if ($del) {
    if (is_file($del)) {
        delfile($del);
    } else {
        deldir($del);
    }
}
//==================Quan li thu muc ==========================
if ($act == "manager") {
    $arr = array();
    $arr = array_merge($arr, glob("*"));
    $arr = array_merge($arr, glob(".*"));
    $arr = array_merge($arr, glob("*.*"));
    $arr = array_unique($arr);
    sort($arr);
    echo "<table width=100%><tr><td align=center><b>Name</td><td align=center><b>Type</td><td align=center><b>Size</td><td align=center><b>Perms</td><td align=center>Delete</td></tr>";
    foreach ($arr as $filename) {
        if ($filename != "." and $filename != "..") {