예제 #1
0
    $num = 0;
    $smilies = $imgfilter = array();
    $query = DB::query("SELECT url FROM " . DB::table('common_smiley') . " WHERE typeid='{$id}' AND type='smiley'");
    while ($img = DB::fetch($query)) {
        $imgfilter[] = $img[url];
    }
    $smiliesdir = dir($smdir);
    while ($entry = $smiliesdir->read()) {
        if (in_array(strtolower(fileext($entry)), $imgextarray) && !in_array($entry, $imgfilter) && preg_match("/^[\\w\\-\\.\\[\\]\\(\\)\\<\\> &]+\$/", substr($entry, 0, strrpos($entry, '.'))) && strlen($entry) < 30 && is_file($smdir . '/' . $entry)) {
            $smilies[] = array('available' => 1, 'displayorder' => 0, 'url' => $entry);
            $num++;
        }
    }
    $smiliesdir->close();
    if ($smilies) {
        addsmilies($id, $smilies);
        updatecache(array('smilies', 'smileycodes', 'smilies_js'));
        cpmsg('smilies_update_succeed', "action=smilies", 'succeed', array('smurl' => $smurl, 'num' => $num, 'typename' => $smtype['name']));
    } else {
        cpmsg('smilies_update_error', '', 'error', array('smurl' => $smurl));
    }
} elseif ($operation == 'import') {
    if (!submitcheck('importsubmit')) {
        shownav('style', 'smilies_edit');
        showsubmenu('nav_smilies', array(array('smilies_type', 'smilies', 0), array('smilies_import', 'smilies&operation=import', 1)));
        showtips('smilies_tips_import');
        showformheader('smilies&operation=import', 'enctype');
        showtableheader('smilies_import');
        showimportdata();
        showsubmit('importsubmit');
        showtablefooter();
예제 #2
0
        updatecache(array('smileytypes', 'smilies', 'smileycodes', 'smilies_js'));
        showmessage('do_success', dreferer());
    }
} elseif ($operation == 'update' && $id) {
    if (!($smtype = C::t('imagetype')->fetch($id))) {
        showmessage(lang('message', 'smilies_type_nonexistence'), dreferer());
    } else {
        $smurl = './static/image/smiley/' . $smtype['directory'];
        $smdir = DZZ_ROOT . $smurl;
        if (!is_dir($smdir)) {
            showmessage(lang('message', 'smilies_directory_invalid', array('smurl' => $smurl)), ADMINSCRIPT . '?mod=setting&op=smiley');
        }
    }
    $smilies = update_smiles($smdir, $id, $imgextarray);
    if ($smilies['smilies']) {
        addsmilies($id, $smilies['smilies']);
        updatecache(array('smilies', 'smileycodes', 'smilies_js'));
        showmessage(lang('message', 'smilies_update_succeed', array('smurl' => $smurl, 'num' => $smilies['num'], 'typename' => $smtype['name'])), ADMINSCRIPT . '?mod=setting&op=smiley');
    } else {
        showmessage(lang('message', 'smilies_update_error', array('smurl' => $smurl)), ADMINSCRIPT . '?mod=setting&op=smiley');
    }
} elseif ($operation == 'edit' && $id) {
    $smtype = C::t('imagetype')->fetch($id);
    $smurl = './static/image/smiley/' . $smtype['directory'];
    $smdir = DZZ_ROOT . $smurl;
    if (!is_dir($smdir)) {
        showmessage(lang('message', 'smilies_directory_invalid', array('smurl' => $smurl)), dreferer());
    }
    if (!submitcheck('editsubmit')) {
        $page = empty($_GET['page']) ? 1 : intval($_GET['page']);
        $smiliesperpage = 100;