Exemplo n.º 1
0
function getCatOptions($catid = 0, $scatid = 0, $notcatid = 0, $padding = '')
{
    foreach (C::t('news_cat')->fetch_all_by_pid($catid) as $value) {
        if ($notcatid == $value['catid']) {
            continue;
        }
        $html .= '<option value="' . $value['catid'] . '" ' . ($value['catid'] == $scatid ? 'selected="selected"' : '') . '>' . $padding . $value['name'] . '</option>';
        $html .= getCatOptions($value['catid'], $scatid, $notcatid, $padding . '&nbsp;&nbsp;&nbsp;&nbsp;');
    }
    return $html;
}
Exemplo n.º 2
0
             showmessage('do_success', dreferer(), array('data' => rawurlencode(json_encode(array('catid' => $ncatid, 'pid' => $pid, 'name' => $name)))), array('showmsg' => true));
         } else {
             if ($ncatid = C::t('news_cat')->insert_by_catid(array('name' => $name, 'pid' => $pid))) {
                 showmessage('do_success', dreferer(), array('data' => rawurlencode(json_encode(array('catid' => $ncatid, 'pid' => $pid, 'name' => $name)))), array('showmsg' => true));
             } else {
                 showmessage('分类添加失败', dreferer(), array(), array('showmsg' => true));
             }
         }
     } else {
         $catoptions = getCatOptions(0, $catid);
         if ($step == 2) {
             $cat = C::t('news_cat')->fetch($catid);
             $catoptions = getCatOptions(0, $cat['pid'], $cat['catid']);
         } else {
             $cat = array('catid' => 0);
             $catoptions = getCatOptions(0, $catid);
         }
     }
 } elseif ($step == 4) {
     //删除
     if (submitcheck('catdeletesubmit')) {
         $perm = getPermByUid($_G['uid']);
         if ($perm < 2) {
             showmessage('没有权限', dreferer(), array(), array('showmsg' => true));
         }
         if (C::t('news_cat')->delete_by_catid($catid)) {
             showmessage('do_success', dreferer(), array('catid' => $catid), array('showmsg' => true));
         } else {
             showmessage('删除失败', dreferer(), array(), array('showmsg' => true));
         }
     } else {
Exemplo n.º 3
0
                        if (count($open[$arr[$count - 1]]) > $count) {
                            $open[$arr[count($arr) - 1]] = $arr;
                        }
                    } else {
                        $open[$arr[$count - 1]] = $arr;
                    }
                }
            }
        }
        $openarr = json_encode(array('orgids' => $open));
        $pics = C::t('news_pic')->fetch_all_by_newid($newid);
    } else {
        $navtitle = '新建';
        $navlast = '新建';
        $news = array('votestatus' => 0, 'commentstatus' => '0', 'catid' => intval($_GET['catid']), 'type' => 0);
    }
    $sel = implode(',', $sel);
    $catoptions = getCatOptions(0, $news['catid']);
    include template('news_edit');
}
function getAidsByMessage($message)
{
    $aids = array();
    if (preg_match_all("/path=\"attach::(\\d+)\"/i", $message, $matches)) {
        $aids = $matches[1];
    }
    if (preg_match_all("/path=\"" . rawurlencode('attach::') . "(\\d+)\"/i", $message, $matches1)) {
        $aids = array_merge($aids, $matches1[1]);
    }
    return array_unique($aids);
}