Exemplo n.º 1
0
 function do_batch()
 {
     $idArray = (array) $_POST['id'];
     $idArray or iPHP::alert("请选择要删除的用户组");
     $ids = implode(',', $idArray);
     $batch = $_POST['batch'];
     switch ($batch) {
         case 'dels':
             iPHP::$break = false;
             foreach ($idArray as $id) {
                 $this->do_del($id, false);
             }
             iPHP::$break = true;
             iPHP::success('全部删除完成!', 'js:1');
             break;
     }
 }
Exemplo n.º 2
0
 function do_batch()
 {
     $idArray = (array) $_POST['id'];
     $idArray or iPHP::alert("请选择要操作的标签");
     $ids = implode(',', $idArray);
     $batch = $_POST['batch'];
     switch ($batch) {
         case 'dels':
             iPHP::$break = false;
             foreach ($idArray as $id) {
                 $this->do_del($id, false);
             }
             iPHP::$break = true;
             iPHP::success('标签全部删除完成!', 'js:1');
             break;
         case 'move':
             $_POST['cid'] or iPHP::alert("请选择目标栏目!");
             iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
             map::init('category', $this->appid);
             $cid = (int) $_POST['cid'];
             foreach ($idArray as $id) {
                 $_cid = iDB::value("SELECT `cid` FROM `#iCMS@__tags` where `id` ='{$id}'");
                 iDB::update("tags", compact('cid'), compact('id'));
                 if ($_cid != $cid) {
                     map::diff($cid, $_cid, $id);
                     $this->categoryApp->update_count_one($_cid, '-');
                     $this->categoryApp->update_count_one($cid);
                 }
             }
             iPHP::success('成功移动到目标栏目!', 'js:1');
             break;
         case 'mvtcid':
             $_POST['tcid'] or iPHP::alert("请选择目标分类!");
             iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
             map::init('category', $this->appid);
             $tcid = (int) $_POST['tcid'];
             foreach ($idArray as $id) {
                 $_tcid = iDB::value("SELECT `tcid` FROM `#iCMS@__tags` where `id` ='{$id}'");
                 iDB::update("tags", compact('tcid'), compact('id'));
                 if ($_tcid != $tcid) {
                     map::diff($tcid, $_tcid, $id);
                     $this->categoryApp->update_count_one($_tcid, '-');
                     $this->categoryApp->update_count_one($tcid);
                 }
             }
             iPHP::success('成功移动到目标分类!', 'js:1');
             break;
         case 'prop':
             iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
             map::init('prop', $this->appid);
             $pid = implode(',', (array) $_POST['pid']);
             foreach ((array) $_POST['id'] as $id) {
                 $_pid = iDB::value("SELECT pid FROM `#iCMS@__tags` WHERE `id`='{$id}'");
                 iDB::update("tags", compact('pid'), compact('id'));
                 map::diff($pid, $_pid, $id);
             }
             iPHP::success('属性设置完成!', 'js:1');
             break;
         case 'weight':
             $weight = _int($_POST['mweight']);
             $sql = "`weight` = '{$weight}'";
             break;
         case 'tpl':
             $tpl = iS::escapeStr($_POST['mtpl']);
             $sql = "`tpl` = '{$tpl}'";
             break;
         case 'keyword':
             if ($_POST['pattern'] == 'replace') {
                 $sql = "`keywords` = '" . iS::escapeStr($_POST['mkeyword']) . "'";
             } elseif ($_POST['pattern'] == 'addto') {
                 foreach ($idArray as $id) {
                     $keywords = iDB::value("SELECT keywords FROM `#iCMS@__tags` WHERE `id`='{$id}'");
                     $sql = "`keywords` = '" . ($keywords ? $keywords . ',' . iS::escapeStr($_POST['mkeyword']) : iS::escapeStr($_POST['mkeyword'])) . "'";
                     iDB::query("UPDATE `#iCMS@__tags` SET {$sql} WHERE `id`='{$id}'");
                 }
                 iPHP::success('关键字更改完成!', 'js:1');
             }
             break;
         case 'tag':
             if ($_POST['pattern'] == 'replace') {
                 $sql = "`related` = '" . iS::escapeStr($_POST['mtag']) . "'";
             } elseif ($_POST['pattern'] == 'addto') {
                 foreach ($idArray as $id) {
                     $keywords = iDB::value("SELECT related FROM `#iCMS@__tags` WHERE `id`='{$id}'");
                     $sql = "`related` = '" . ($keywords ? $keywords . ',' . iS::escapeStr($_POST['mtag']) : iS::escapeStr($_POST['mtag'])) . "'";
                     iDB::query("UPDATE `#iCMS@__tags` SET {$sql} WHERE `id`='{$id}'");
                 }
                 iPHP::success('相关标签更改完成!', 'js:1');
             }
             break;
         default:
             if (strpos($batch, ':')) {
                 $data = iACP::fields($batch);
                 foreach ($idArray as $id) {
                     $data && iDB::update("tags", $data, array('id' => $id));
                 }
                 iPHP::success('操作成功!', 'js:1');
             } else {
                 iPHP::alert('请选择要操作项!', 'js:1');
             }
     }
     $sql && iDB::query("UPDATE `#iCMS@__tags` SET {$sql} WHERE `id` IN ({$ids})");
     iPHP::success('操作成功!', 'js:1');
 }
Exemplo n.º 3
0
 function do_batch()
 {
     $_POST['id'] or iPHP::alert("请选择要操作的" . $this->category_name);
     $id_array = (array) $_POST['id'];
     $ids = implode(',', $id_array);
     $batch = $_POST['batch'];
     switch ($batch) {
         case 'move':
             $tocid = (int) $_POST['tocid'];
             $key = array_search($tocid, $id_array);
             if ($tocid) {
                 unset($id_array[$key]);
             }
             //清除同ID
             foreach ($id_array as $k => $cid) {
                 iDB::query("UPDATE `#iCMS@__category` SET `rootid` ='{$tocid}' WHERE `cid` ='{$cid}'");
             }
             $this->cache(true, $this->appid);
             iPHP::success('更新完成!', 'js:1');
             break;
         case 'merge':
             $tocid = (int) $_POST['tocid'];
             $key = array_search($tocid, $id_array);
             unset($id_array[$key]);
             //清除同ID
             foreach ($id_array as $k => $cid) {
                 $this->mergecontent($tocid, $cid);
                 $this->do_del($cid, false);
             }
             $this->update_count($tocid);
             $this->cache(true, $this->appid);
             iPHP::success('更新完成!', 'js:1');
             break;
         case 'name':
             foreach ($id_array as $k => $cid) {
                 $name = iS::escapeStr($_POST['name'][$cid]);
                 iDB::query("UPDATE `#iCMS@__category` SET `name` = '{$name}' WHERE `cid` ='" . (int) $cid . "' LIMIT 1");
                 $this->cahce_one($cid);
             }
             iPHP::success('更新完成!', 'js:1');
             break;
         case 'status':
             $val = (int) $_POST['status'];
             $sql = "`status` = '{$val}'";
             break;
         case 'mode':
             $val = (int) $_POST['mode'];
             $sql = "`mode` = '{$val}'";
             break;
         case 'categoryRule':
             $val = iS::escapeStr($_POST['categoryRule']);
             $sql = "`categoryRule` = '{$val}'";
             break;
         case 'contentRule':
             $val = iS::escapeStr($_POST['contentRule']);
             $sql = "`contentRule` = '{$val}'";
             break;
         case 'urlRule':
             $val = iS::escapeStr($_POST['urlRule']);
             $sql = "`urlRule` = '{$val}'";
             break;
         case 'indexTPL':
             $val = iS::escapeStr($_POST['indexTPL']);
             $sql = "`indexTPL` = '{$val}'";
             break;
         case 'listTPL':
             $val = iS::escapeStr($_POST['listTPL']);
             $sql = "`listTPL` = '{$val}'";
             break;
         case 'contentTPL':
             $val = iS::escapeStr($_POST['contentTPL']);
             $sql = "`contentTPL` = '{$val}'";
             break;
         case 'recount':
             foreach ($id_array as $k => $cid) {
                 $this->update_count($cid);
             }
             iPHP::success('操作成功!', 'js:1');
             break;
         case 'dels':
             iPHP::$break = false;
             foreach ($id_array as $cid) {
                 iACP::CP($cid, 'd', 'alert');
                 $this->do_del($cid, false);
                 $this->cahce_one($cid);
             }
             iPHP::$break = true;
             iPHP::success('全部删除完成!', 'js:1');
             break;
     }
     $sql && iDB::query("UPDATE `#iCMS@__category` SET {$sql} WHERE `cid` IN ({$ids})");
     $this->cache(true, $this->appid);
     iPHP::success('操作成功!', 'js:1');
 }
Exemplo n.º 4
0
 function do_mpublish($pubArray = array())
 {
     iPHP::$break = false;
     if ($_POST['pub']) {
         foreach ((array) $_POST['pub'] as $i => $a) {
             list($cid, $pid, $rid, $url, $title) = explode('|', $a);
             $pubArray[] = array('sid' => 0, 'url' => $url, 'title' => $title, 'cid' => $cid, 'rid' => $rid, 'pid' => $pid);
         }
     }
     if (empty($pubArray)) {
         iPHP::$break = true;
         iPHP::alert('暂无最新内容', 0, 30);
     }
     $_count = count($pubArray);
     ob_start();
     ob_end_flush();
     ob_implicit_flush(1);
     foreach ((array) $pubArray as $i => $a) {
         spider::$sid = $a['sid'];
         spider::$cid = $a['cid'];
         spider::$pid = $a['pid'];
         spider::$rid = $a['rid'];
         spider::$url = $a['url'];
         spider::$title = $a['title'];
         $rs = $this->multipublish();
         $updateMsg = $i ? true : false;
         $timeout = $i++ == $_count ? '3' : false;
         iPHP::dialog($rs['msg'], 'js:' . $rs['js'], $timeout, 0, $updateMsg);
         ob_flush();
         flush();
     }
     iDB::update('spider_project', array('lastupdate' => time()), array('id' => $this->pid));
     iPHP::dialog('success:#:check:#:采集完成!', 0, 3, 0, true);
 }
Exemplo n.º 5
0
 function do_batch()
 {
     $idArray = (array) $_POST['id'];
     $idArray or iPHP::alert("请选择要操作的属性");
     $ids = implode(',', $idArray);
     $batch = $_POST['batch'];
     switch ($batch) {
         case 'dels':
             iPHP::$break = false;
             foreach ($idArray as $id) {
                 $this->do_del($id, false);
             }
             iPHP::$break = true;
             iPHP::success('属性全部删除完成!', 'js:1');
             break;
         case 'refresh':
             $this->cache();
             iPHP::success('属性缓存全部更新完成!', 'js:1');
             break;
     }
 }
Exemplo n.º 6
0
 function do_batch()
 {
     $_POST['id'] or iPHP::alert("请选择要操作的文章");
     $ids = implode(',', (array) $_POST['id']);
     $batch = $_POST['batch'];
     switch ($batch) {
         case 'order':
             foreach ((array) $_POST['ordernum'] as $id => $ordernum) {
                 articleTable::update(compact('ordernum'), compact('id'));
             }
             iPHP::success('排序已更新!', 'js:1');
             break;
         case 'baiduping':
             foreach ((array) $_POST['id'] as $id) {
                 $this->do_baiduping($id, false);
             }
             iPHP::success('推送完成!', 'js:1');
             break;
         case 'move':
             $_POST['cid'] or iPHP::alert("请选择目标栏目!");
             iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
             map::init('category', $this->appid);
             $cid = (int) $_POST['cid'];
             iACP::CP($cid, 'ca', 'alert');
             foreach ((array) $_POST['id'] as $id) {
                 $_cid = articleTable::value('cid', $id);
                 articleTable::update(compact('cid'), compact('id'));
                 if ($_cid != $cid) {
                     map::diff($cid, $_cid, $id);
                     $this->categoryApp->update_count_one($_cid, '-');
                     $this->categoryApp->update_count_one($cid);
                 }
             }
             iPHP::success('成功移动到目标栏目!', 'js:1');
             break;
         case 'scid':
             //$_POST['scid'] OR iPHP::alert("请选择目标栏目!");
             iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
             map::init('category', $this->appid);
             $scid = implode(',', (array) $_POST['scid']);
             foreach ((array) $_POST['id'] as $id) {
                 $_scid = articleTable::value('scid', $id);
                 articleTable::update(compact('scid'), compact('id'));
                 map::diff($scid, $_scid, $id);
             }
             iPHP::success('文章副栏目设置完成!', 'js:1');
             break;
         case 'prop':
             iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
             map::init('prop', $this->appid);
             $pid = implode(',', (array) $_POST['pid']);
             foreach ((array) $_POST['id'] as $id) {
                 $_pid = articleTable::value('pid', $id);
                 articleTable::update(compact('pid'), compact('id'));
                 map::diff($pid, $_pid, $id);
             }
             iPHP::success('文章属性设置完成!', 'js:1');
             break;
         case 'weight':
             $data = array('weight' => _int($_POST['mweight']));
             break;
         case 'keyword':
             if ($_POST['pattern'] == 'replace') {
                 $data = array('keywords' => iS::escapeStr($_POST['mkeyword']));
             } elseif ($_POST['pattern'] == 'addto') {
                 foreach ($_POST['id'] as $id) {
                     $keywords = articleTable::value('keywords', $id);
                     $keywords = $keywords ? $keywords . ',' . iS::escapeStr($_POST['mkeyword']) : iS::escapeStr($_POST['mkeyword']);
                     articleTable::update(compact('keywords'), compact('id'));
                 }
                 iPHP::success('文章关键字更改完成!', 'js:1');
             }
             break;
         case 'tag':
             iPHP::app('tag.class', 'static');
             foreach ($_POST['id'] as $id) {
                 $art = articleTable::row($id, 'tags,cid');
                 $mtag = iS::escapeStr($_POST['mtag']);
                 if ($_POST['pattern'] == 'replace') {
                 } elseif ($_POST['pattern'] == 'addto') {
                     $art['tags'] && ($mtag = $art['tags'] . ',' . $mtag);
                 }
                 $tags = tag::diff($mtag, $art['tags'], iMember::$userid, $id, $art['cid']);
                 $tags = addslashes($tags);
                 articleTable::update(compact('tags'), compact('id'));
             }
             iPHP::success('文章标签更改完成!', 'js:1');
             break;
         case 'thumb':
             foreach ((array) $_POST['id'] as $id) {
                 $body = articleTable::body($id);
                 $picurl = $this->remotepic($body, 'autopic', $id);
                 $this->pic($picurl, $id);
             }
             iPHP::success('成功提取缩略图!', 'js:1');
             break;
         case 'dels':
             iPHP::$break = false;
             ob_implicit_flush();
             $_count = count($_POST['id']);
             foreach ((array) $_POST['id'] as $i => $id) {
                 $msg = $this->delArticle($id);
                 $msg .= $this->del_msg('文章删除完成!');
                 $updateMsg = $i ? true : false;
                 $timeout = $i++ == $_count ? '3' : false;
                 iPHP::dialog($msg, 'js:parent.$("#id' . $id . '").remove();', $timeout, 0, $updateMsg);
                 ob_end_flush();
             }
             iPHP::$break = true;
             iPHP::success('文章全部删除完成!', 'js:1', 3, 0, true);
             break;
         default:
             $data = iACP::fields($batch);
     }
     $data && articleTable::batch($data, $ids);
     iPHP::success('操作成功!', 'js:1');
 }
Exemplo n.º 7
0
 function do_batch()
 {
     $idA = (array) $_POST['id'];
     $idA or iPHP::alert("请选择要操作的用户");
     $ids = implode(',', (array) $_POST['id']);
     $batch = $_POST['batch'];
     switch ($batch) {
         case 'prop':
             iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
             map::init('prop', iCMS_APP_USER);
             $pid = implode(',', (array) $_POST['pid']);
             foreach ((array) $_POST['id'] as $id) {
                 $_pid = iDB::value("SELECT `pid` FROM `#iCMS@__user` where `uid`='{$id}' LIMIT 1");
                 iDB::update('user', compact('pid'), array('uid' => $id));
                 map::diff($pid, $_pid, $id);
             }
             iPHP::success('用户属性设置完成!', 'js:1');
             break;
         case 'dels':
             iPHP::$break = false;
             foreach ($idA as $id) {
                 $this->do_del($id, false);
             }
             iPHP::$break = true;
             iPHP::success('用户全部删除完成!', 'js:1');
             break;
     }
 }