예제 #1
0
    ?>
            </div>
        <?php 
}
?>

    </div>

    <div class="section">

        <div style="float: right">            
            <?php 
if ($EDITMODE && test('Nud') && $archive_id == 0) {
    ?>
                <input type="button" onClick="if (confirm('Please confirm')) { window.location = '<?php 
    echo cn_url_modify('action=delete', cn_snippet_digital_signature('a'));
    ?>
'; return true; } else return false;" value="Delete">
            <?php 
}
?>
            <?php 
if (empty($_POST['full_story'])) {
    ?>
<input type=button onClick="ShowOrHide('full-story','');" value="Toggle Full-Story"><?php 
}
?>
            <input type=submit name="do_editsave" style='font-weight: bold' title="Post the New Article" value="     <?php 
if (!$EDITMODE) {
    echo 'Add News';
} else {
예제 #2
0
                <input type="submit" value="Go">
        </div>

        <!-- Make pagination -->
        <?php 
if ($page || $has_next) {
    ?>
            <div class="pagination">
                <?php 
    if ($page - $per_page >= 0) {
        echo '<a href="' . cn_url_modify('mod=editnews', 'page=' . ($page - $per_page)) . '">&lt;&lt; Prev page</a>';
    } elseif ($page && $page < $per_page) {
        echo '<a href="' . cn_url_modify('mod=editnews', 'page') . '">&lt;&lt; Prev page</a>';
    } else {
        echo '&lt;&lt; Prev page';
    }
    echo ' [<b>' . intval($page / $per_page) . '</b>] ';
    if ($has_next) {
        echo '<a href="' . cn_url_modify('mod=editnews', 'page=' . ($page + $per_page)) . '">Next page &gt;&gt;</a>';
    }
    ?>
            </div>
        <?php 
}
?>
    </div>

</form>

예제 #3
0
        <th>Regdate</th>
        <th>Written news</th>
        <th>Access</th>
    </tr>
    <?php 
if ($users) {
    foreach ($users as $id => $user) {
        ?>
        <tr <?php 
        if (isset($user['name']) && $user_name == $user['name']) {
            echo 'class="row_selected"';
        }
        ?>
>
            <td width="400px"><a href="<?php 
        echo isset($user['name']) ? cn_url_modify('user_name=' . $user['name']) : '';
        ?>
"><?php 
        echo isset($user['name']) ? cn_htmlspecialchars($user['name']) : '';
        ?>
</td>
            <td align="center"><?php 
        echo isset($user['id']) ? date('Y-m-d H:i', $user['id']) : '';
        ?>
</td>
            <td align="center"><?php 
        echo isset($user['cnt']) ? intval($user['cnt']) : 0;
        ?>
</td>
            <td align="center"><?php 
        echo isset($user['acl']) && isset($grp[$user['acl']]['N']) ? cn_htmlspecialchars(ucfirst($grp[$user['acl']]['N'])) : '';
예제 #4
0
    echo 'user.log';
}
?>
</p>

<div>
    <?php 
if ($st - $num >= 0) {
    echo '<a href="' . cn_url_modify('st=' . ($st - $num)) . '">&lt;&lt; Prev</a>';
} else {
    echo '&lt;&lt; Prev';
}
?>
    &nbsp;[<?php 
echo $st;
?>
]&nbsp;
    <?php 
if (!$isfin) {
    echo '<a href="' . cn_url_modify('st=' . ($st + $num)) . '">Next &gt;&gt;</a>';
} else {
    echo 'Next &gt;&gt;';
}
?>
    <!--a href="<?php 
/*echo cn_url_modify('st='.($st+$num));*/
?>
">Next &gt;&gt;</a-->
</div>

예제 #5
0
foreach ($grp as $id => $acl) {
    ?>

            <tr<?php 
    if ($id == $group_id) {
        echo ' class="row_selected"';
    }
    ?>
>

                <td align="center"><?php 
    echo $id;
    ?>
</td>
                <td><a href="<?php 
    echo cn_url_modify("group_id={$id}");
    ?>
"><?php 
    echo cn_htmlspecialchars($acl['name']);
    ?>
</a></td>
                <td><?php 
    $ps = array();
    $sp = spsep($acl['acl']);
    foreach ($sp as $name) {
        $ps[] = '<a href="#" title="' . join('; ', $form_desc[$name]) . '" onclick="return(tiny_msg(this));">' . $name . '</a>';
    }
    echo join(', ', $ps);
    ?>
                </td>
                <td><?php 
예제 #6
0
        } elseif ($item['type'] == 'image') {
            ?>

                <div>
                    <input id="faddm_<?php 
            echo $name;
            ?>
" type="text" style="width: 500px" value="<?php 
            echo isset($item['#value']) ? cn_htmlspecialchars($item['#value']) : '';
            ?>
" name="faddm[<?php 
            echo $name;
            ?>
]" />
                    <a class="external" href="#" onclick="<?php 
            echo cn_snippet_open_win(cn_url_modify('mod=media', 'opt=inline', 'faddm=Y', 'callback=faddm_' . $name), array('w' => 1000));
            ?>
">Select resource</a>
                </div>

            <?php 
        } elseif ($item['type'] == 'select') {
            ?>

                <div style="margin: 4px 0 4px 0;">
                    <select name="faddm[<?php 
            echo $name;
            ?>
]">
                    <?php 
            $opts = spsep($item['meta'], ';');
예제 #7
0
        <table class="std-table" width="100%">

            <tr><th>ID</th> <th>Translate</th></tr>
            <?php 
    foreach ($tkn as $id => $tran) {
        ?>

                <tr <?php 
        if ($id == $exid) {
            echo 'class="row_selected"';
        }
        ?>
>
                    <td><a href="<?php 
        echo cn_url_modify('lang_token=' . $lang_token, 'exid=' . $id);
        ?>
"><?php 
        echo $id;
        ?>
</a></td>
                    <td><?php 
        echo cn_htmlspecialchars($tran);
        ?>
</td>
                </tr>

            <?php 
    }
    ?>
예제 #8
0
$odd = 0;
list($sub, $options, $options_list) = _GL('sub, options, options_list');
cn_snippet_messages();
cn_snippet_bc();
?>
<ul class="sysconf_top">
    <?php 
foreach ($options_list as $ID => $ol) {
    ?>
        <li<?php 
    if ($sub == $ID) {
        echo ' class="selected"';
    }
    ?>
><a href="<?php 
    echo cn_url_modify("sub={$ID}");
    ?>
"><?php 
    echo ucfirst($ID);
    ?>
</a></li>
    <?php 
}
?>
</ul>
<div style="clear: both;"></div>

<form action="<?php 
echo PHP_SELF;
?>
" method="POST">
예제 #9
0
/**
 * @desc show_archives.php is DEPRECATED, use show_news.php instead
 * In news is [archid] field, copied by migration script
 */
require_once 'core/init.php';
// Check including & init
check_direct_including('show_archives.php');
$_list_archives = db_get_archives();
if (isset($static) && $static) {
    $_archive = 0;
} else {
    $_archive = REQ('archive');
}
// Select
if (!$_archive) {
    krsort($_list_archives);
    foreach ($_list_archives as $id => $info) {
        $count = intval($info['c']);
        if ($url = cn_rewrite('archive', $id)) {
            $arch_url = $url;
        } else {
            $arch_url = cn_url_modify('archive=' . $id);
        }
        echo "<a href=\"{$arch_url}\">" . date("d M Y", $info['min']) . " &ndash; " . date("d M Y", $info['max']) . " (<b>{$count}</b>)</a><br />";
    }
    $_found_archives = count($_list_archives);
    unset($static, $id);
} else {
    include 'show_news.php';
}
예제 #10
0
function media_invoke()
{
    $popup_form = '';
    list($path, $opt) = GET('folder, opt', 'GETPOST');
    list($do_action, $pending) = GET('do_action, pending', 'POST');
    // Change default uploads dir
    $udir = cn_path_construct(SERVDIR, 'uploads');
    if (getoption('uploads_dir')) {
        $udir = preparation_path(getoption('uploads_dir'));
    }
    $edir = getoption('uploads_ext') ? getoption('uploads_ext') : getoption('http_script_dir') . '/uploads';
    $dfile = cn_path_construct($udir, $path);
    // Remove root identifier
    $path = preparation_path($path);
    // Path detection
    $path = preg_replace('/[^a-z0-9\\/_\\\\]/i', '-', $path);
    $root_dir = cn_path_construct($udir, $path) . DIRECTORY_SEPARATOR;
    $just_uploaded = array();
    // Get path struct
    $pathes = spsep($path, DIRECTORY_SEPARATOR);
    if (isset($pathes[0]) && $pathes[0] === '') {
        unset($pathes[0]);
    }
    // Do upload files
    if (request_type('POST')) {
        cn_dsi_check();
        // Allowed Exts.
        $AE = spsep(getoption('allowed_extensions'));
        // Generate thumbnail after upload
        $thumbnail_with_upload = getoption('thumbnail_with_upload');
        // UPLOAD FILES
        if (REQ('upload', 'POST')) {
            list($overwrite) = GET('overwrite');
            $is_uploaded = FALSE;
            // Try for fopen url upload
            if ($upload_from_inet = REQ('upload_from_inet')) {
                if (ini_get('allow_url_fopen')) {
                    // Get filename
                    $url_name = spsep($upload_from_inet, '/');
                    $url_name = $url_name[count($url_name) - 1];
                    $url_name = preg_replace('/(%20|\\s|\\?|&|\\/)/', '_', $url_name);
                    $url_name = str_replace('%', '_', $url_name);
                    // resolve filename
                    $c_file = $dfile . $url_name;
                    // Overwrite [if can], or add file
                    if ($overwrite && file_exists($c_file) || !file_exists($c_file)) {
                        // Use context for disable error notices
                        if (function_exists('stream_context_create')) {
                            $context = stream_context_create(array('http' => array('ignore_errors' => true)));
                            $fw = fopen($upload_from_inet, 'rb', false, $context);
                        } else {
                            // Read file
                            $fw = fopen($upload_from_inet, 'rb');
                        }
                        // --------- (fetch content) ------
                        ob_start();
                        fpassthru($fw);
                        $file_image = ob_get_clean();
                        fclose($fw);
                        // ---------
                        // write2disk
                        if ($wf = fopen($c_file, 'w')) {
                            fwrite($wf, $file_image);
                            fclose($wf);
                        }
                        // check image
                        list($w, $h) = getimagesize($c_file);
                        if ($w && $h) {
                            cn_throw_message('File uploaded');
                            $max_width = getoption('max_thumbnail_width');
                            if ($w > $max_width && $thumbnail_with_upload) {
                                $resize_result = resize_image($c_file, $max_width, 0);
                                cn_throw_message($resize_result['msg'], $resize_result['status'] ? 'n' : 'w');
                            }
                            $is_uploaded = TRUE;
                            $just_uploaded[$url_name] = TRUE;
                        } else {
                            cn_throw_message("Wrong image file", 'e');
                            unlink($c_file);
                        }
                    } else {
                        cn_throw_message("Can't overwrite or save", 'e');
                    }
                } else {
                    cn_throw_message('allow_url_fopen=0, check server configurations');
                }
            }
            // Upload from local
            foreach ($_FILES['upload_file']['name'] as $id => $name) {
                if ($name) {
                    $ext = NULL;
                    if (preg_match('/\\.(\\w+)$/i', $name, $c)) {
                        $ext = strtolower($c[1]);
                    }
                    // Check allowed ext
                    if ($ext && in_array($ext, $AE)) {
                        // encode url
                        $name = str_replace('%2F', '/', urlencode($name));
                        // encoded? replace filename
                        if (strpos($name, '%') !== FALSE) {
                            $name = str_replace('%', '', strtolower($name));
                        }
                        // check file for exist
                        if (file_exists($c_file = $dfile . $name)) {
                            if ($overwrite) {
                                cn_throw_message('File [' . cn_htmlspecialchars($c_file) . '] overwritten', 'w');
                            } else {
                                cn_throw_message('File [' . cn_htmlspecialchars($c_file) . '] already exists', 'e');
                                continue;
                            }
                        }
                        // Upload file to server
                        if (move_uploaded_file($_FILES['upload_file']['tmp_name'][$id], $c_file)) {
                            $just_uploaded[$name] = TRUE;
                            cn_throw_message('File uploaded [<b>' . cn_htmlspecialchars($name) . '</b>]');
                            $max_width = getoption('max_thumbnail_width');
                            list($w, $h) = getimagesize($c_file);
                            if ($w > $max_width && $thumbnail_with_upload) {
                                $resize_result = resize_image($c_file, $max_width, 0);
                                cn_throw_message($resize_result['msg'], $resize_result['status'] ? 'n' : 'w');
                            }
                        } else {
                            cn_throw_message('File [' . cn_htmlspecialchars($c_file) . '] not uploaded! Please, check upload_max_filesize in PHP settings.', 'e');
                        }
                    } else {
                        cn_throw_message('File extension [' . cn_htmlspecialchars($ext) . '] not allowed', 'e');
                    }
                } elseif (!$is_uploaded) {
                    cn_throw_message('No selected files for upload', 'e');
                }
            }
        } elseif ($do_action || $pending) {
            list($rm) = GET('rm', 'POST');
            // action --> delete entries
            if ($do_action == 'delete') {
                if (empty($rm)) {
                    cn_throw_message('No files selected', 'w');
                } else {
                    foreach ($rm as $file) {
                        if (file_exists($cfile = $dfile . $file)) {
                            if (is_dir($cfile)) {
                                rmdir($cfile);
                            } else {
                                //get thumbnail path
                                $path_parts = pathinfo($cfile);
                                $thumbnail_path = $path_parts['dirname'] . DIRECTORY_SEPARATOR . '.thumb.' . $path_parts['basename'];
                                if (file_exists($thumbnail_path)) {
                                    unlink($thumbnail_path);
                                }
                                unlink($cfile);
                            }
                        }
                        if (file_exists($cfile)) {
                            cn_throw_message('File [' . cn_htmlspecialchars($cfile) . '] not deleted!', 'e');
                        } else {
                            cn_throw_message('File [' . cn_htmlspecialchars($file) . '] deleted successfully');
                        }
                    }
                }
            } elseif ($do_action == 'create') {
                $popup_form = i18n('Enter directory name') . ' <input type="text" name="new_dir" value="" />';
            } elseif ($pending == 'create') {
                $new_dir_arr = GET('new_dir', 'POST');
                $new_folder = array_pop($new_dir_arr);
                $new_folder = preg_replace('/[^a-z0-9_]/i', '-', $new_folder);
                if ($new_folder) {
                    $cfile = $dfile . $new_folder;
                    if (is_dir($cfile)) {
                        cn_throw_message('Folder [' . $new_folder . '] already exists!', 'e');
                    } else {
                        mkdir($cfile);
                        if (!is_dir($cfile)) {
                            cn_throw_message('Folder [' . cn_htmlspecialchars($cfile) . ' not created]', 'e');
                        } else {
                            cn_throw_message('Folder [' . $new_folder . '] created!');
                        }
                    }
                } else {
                    cn_throw_message('Specify folder name', 'w');
                }
                $popup_form = '';
            } elseif ($do_action == 'rename') {
                if ($rm) {
                    $popup_form = '<div class="big_font">' . i18n('Rename file to') . '</div>';
                    $popup_form .= i18n('Tip: Write new file name') . '<br />';
                    $popup_form .= '<table>';
                    foreach ($rm as $id => $fn) {
                        $hfn = cn_htmlspecialchars($fn);
                        $popup_form .= '<tr><td align="right" class="indent"><b>' . $hfn . '</b><td>';
                        $popup_form .= '<td><input type="hidden" name="ids[' . $id . ']" value="' . $hfn . '"/>&rarr;</td>';
                        $popup_form .= '<td><input style="width: 300px;" type="text" name="place[' . $id . ']" value="' . $hfn . '" /> ';
                        $popup_form .= '</td></tr>';
                    }
                    $popup_form .= '</table>';
                } else {
                    cn_throw_message('Select files to rename', 'w');
                }
            } elseif ($pending == 'rename') {
                // ...
                list($ids, $place) = GET('ids, place', 'POST');
                // prevent illegal moves
                $safe_dir = scan_dir($root_dir);
                foreach ($safe_dir as $id => $v) {
                    $safe_dir[$id] = md5($v);
                }
                // do move all files / dirs
                foreach ($ids as $id => $file) {
                    if (in_array(md5($file), $safe_dir)) {
                        $filename = $place[$id];
                        if (strpos($filename, '\\') || strpos($filename, '/')) {
                            cn_throw_message(i18n('The name of file [%1] should not contain special characters', cn_htmlspecialchars($file)), 'e');
                            continue;
                        }
                        $renameto = $root_dir . $filename;
                        $thumb = $root_dir . '.thumb.' . $file;
                        // do move
                        if (rename($root_dir . $file, $renameto)) {
                            if (file_exists($thumb)) {
                                rename($thumb, $root_dir . '.thumb.' . $filename);
                            }
                            cn_throw_message(i18n('File [%1] renamed to [%2]', cn_htmlspecialchars($file), cn_htmlspecialchars($filename)));
                        } else {
                            cn_throw_message(i18n('File [%1] not renamed', cn_htmlspecialchars($file)), 'e');
                        }
                    }
                }
            } elseif ($do_action == 'move') {
                if ($rm) {
                    $popup_form = '<div class="big_font">' . i18n('Move files to') . '</div>';
                    $popup_form .= i18n('Tip: You can select the folder to move the file') . '<br />';
                    $popup_form .= '<table>';
                    $folders = array();
                    $dirs = scan_dir($root_dir);
                    foreach ($dirs as $entry) {
                        if (is_dir($root_dir . $entry) && !($entry === '..' || $entry === '.')) {
                            $folders[] = $entry;
                        }
                    }
                    foreach ($rm as $id => $fn) {
                        $hfn = cn_htmlspecialchars($fn);
                        $popup_form .= '<tr><td align="right" class="indent"><b>' . $hfn . '</b><td>';
                        $popup_form .= '<td><input type="hidden" name="ids[' . $id . ']" value="' . $hfn . '"/>&rarr;</td>';
                        $popup_form .= '<td>';
                        $cnt_folders = count($folders);
                        if ($cnt_folders != 0 && !($cnt_folders == 1 && in_array($hfn, $folders))) {
                            $popup_form .= '<select name="place_folder_' . $id . '">';
                            foreach ($folders as $dirn) {
                                if ($dirn != $hfn) {
                                    $popup_form .= '<option value="' . $dirn . '">' . $dirn . '</option>';
                                }
                            }
                            $popup_form .= '</select>';
                        }
                        if ($root_dir != $udir) {
                            $popup_form .= '<nobr><input type="checkbox" onclick="javascript:hideFolderList(this,' . $id . ')" name="moveup[' . $id . ']" value="Y" /> Move up</nobr>';
                        } else {
                            $popup_form .= '<nobr> X Move up (You are in root folder)</nobr>';
                        }
                        $popup_form .= '</td></tr>';
                    }
                    $popup_form .= '</table>';
                } else {
                    cn_throw_message('Select files to move', 'w');
                }
            } elseif ($pending == 'move') {
                // ...
                list($ids, $moveup) = GET('ids, moveup', 'POST');
                // prevent illegal moves
                $safe_dir = scan_dir($root_dir);
                foreach ($safe_dir as $id => $v) {
                    $safe_dir[$id] = md5($v);
                }
                // do move all files / dirs
                foreach ($ids as $id => $file) {
                    list($place_folder) = GET('place_folder_' . $id);
                    if (in_array(md5($file), $safe_dir)) {
                        $NF = '';
                        $foldername = preg_replace('/\\.\\//i', '', $place_folder);
                        // move this file up
                        if (isset($moveup[$id]) && count($pathes) > 0) {
                            $nwfolder = dirname($root_dir);
                            $foldername = 'up folder';
                        } else {
                            $nwfolder = $root_dir . ($NF = isset($rm[0]) ? $rm[0] : '') . DIRECTORY_SEPARATOR . $foldername;
                            if ($rm[0]) {
                                $NF = $rm[0] . DIRECTORY_SEPARATOR;
                            }
                        }
                        $moveto = $nwfolder . DIRECTORY_SEPARATOR . $file;
                        //check for image thumbnail
                        $thumb = $root_dir . '.thumb.' . $file;
                        // do move
                        if (rename($root_dir . $file, $moveto)) {
                            if (file_exists($thumb)) {
                                rename($thumb, $nwfolder . DIRECTORY_SEPARATOR . '.thumb.' . $file);
                            }
                            cn_throw_message(i18n('File [%1] moved to [%2]', cn_htmlspecialchars($file), cn_htmlspecialchars($foldername)));
                        } else {
                            cn_throw_message(i18n('File [%1] not moved', cn_htmlspecialchars($file)), 'e');
                        }
                    }
                }
            } elseif ($do_action == 'thumb') {
                if (!empty($_POST['rm'])) {
                    $popup_form = get_sizes_form('Make thumbnails', $do_action);
                } else {
                    cn_throw_message('Select files to make thumbnail', 'w');
                }
            } elseif ($pending == 'thumb') {
                do_resize_image($root_dir);
            } elseif ($do_action == 'resize') {
                if (!empty($_POST['rm'])) {
                    $popup_form = get_sizes_form('Resize source image', $do_action);
                } else {
                    cn_throw_message('Select files to resize', 'w');
                }
            } elseif ($pending == 'resize') {
                do_resize_image($root_dir, false);
            } elseif (!hook('media/post_action')) {
                msg_info("Action error");
            }
        }
    }
    // Check dir exists
    if (is_dir($root_dir)) {
        $raw_files = scan_dir($root_dir);
    } else {
        cn_throw_message('Dir not exists', 'e');
        $raw_files = array();
    }
    $dirs = $files = array();
    foreach ($raw_files as $file) {
        if (preg_match('/avatar_/', $file)) {
            continue;
        }
        $file_location = "{$root_dir}/{$file}";
        if (is_dir($file_location)) {
            $dirs[] = array('url' => "{$path}/{$file}", 'name' => $file);
        } elseif (filesize(cn_path_construct($udir, $path) . $file) != 0) {
            list($w, $h) = getimagesize(cn_path_construct($udir, $path) . $file);
            $is_thumb = preg_match('/\\.thumb\\./', $file);
            $files[] = array('name' => $file, 'url' => $edir . '/' . ($path ? $path . '/' : '') . $file, 'thumb' => file_exists($root_dir . '/.thumb.' . pathinfo($file, PATHINFO_BASENAME)) ? $edir . '/' . ($path ? $path . '/' : '') . '.thumb.' . pathinfo($file, PATHINFO_BASENAME) : '', 'local' => ($path ? $path . '/' : '') . $file, 'just_uploaded' => isset($just_uploaded[$file]) ? TRUE : FALSE, 'is_thumb' => $is_thumb, 'w' => $w, 'h' => $h, 'fs' => round(filesize($file_location) / 1024, 1));
        }
    }
    uasort($dirs, 'usort_by_name_asc');
    uasort($files, 'usort_by_name_asc');
    // Top level (dashboard)
    cn_bc_add('Dashboard', cn_url_modify(array('reset')));
    cn_bc_add('Media manager', cn_url_modify());
    cn_assign("files, dirs, path, pathes, popup_form, root_dir", $files, $dirs, $path, $pathes, $popup_form, $root_dir);
    if ($opt === 'inline') {
        echo exec_tpl('window', 'title=Quick insert image', 'style=media/style.css', 'content=' . exec_tpl('media/general'));
    } else {
        echoheader('-@media/style.css', 'Media manager');
        echo exec_tpl('media/general');
        echofooter();
    }
}
예제 #11
0
    <li<?php 
if ($sub == '') {
    echo " class='selected'";
}
?>
><a href="<?php 
echo cn_url_modify('sub=');
?>
">Integrate news in site</a></li>
    <li<?php 
if ($sub == 'rss') {
    echo " class='selected'";
}
?>
><a href="<?php 
echo cn_url_modify('sub=rss');
?>
">RSS Setup</a></li>
</ul>
<div style="clear: both;"></div>

<form action="<?php 
echo PHP_SELF;
?>
" method="POST">
<?php 
cn_form_open('mod, opt, sub');
?>

<!-- site news integration -->
<?php 
예제 #12
0
    <br/>
    <div class="panel">
        <input type="submit" value="Save changes" />

        <select name="snippet">
            <?php 
foreach ($__list as $id => $_t) {
    echo '<option ' . ($id == $__snippet ? 'selected' : '') . '>' . cn_htmlspecialchars($id) . '</option>';
}
?>
        </select>

        <input type="submit" name="select" value="Select" />

        <input type="text" value="" name="create" style="width: 250px;"/>
        <input type="submit" value="Create new" />

        <?php 
if ($__can_delete) {
    ?>
        <input type="submit" name="delete" value="Delete snippet" />
        <?php 
}
?>
    </div>

</form>
<p style="text-align: right;"><a href="#" onclick="<?php 
echo cn_snippet_open_win(cn_url_modify(array('reset'), 'mod=help', 'section=snippets'));
?>
" class="external">Understanding snippets</a></p>
예제 #13
0
function edit_news_delete()
{
    cn_dsi_check();
    if (!test('Nud')) {
        msg_info("Unable to delete news: no permission");
    }
    $FlatDB = new FlatDB();
    list($id, $source) = GET('id, source', 'GET');
    $ida = db_index_load($source);
    $nloc = db_get_nloc($id);
    $db = db_news_load($nloc);
    // ------
    $FlatDB->cn_remove_categories($db[$id]['c'], $db[$id]['id']);
    $FlatDB->cn_update_date(0, $db[$id]['id']);
    $FlatDB->cn_user_sync($db[$id]['u'], 0, $db[$id]['id']);
    $FlatDB->cn_remove_tags($db[$id]['tg'], $db[$id]['id']);
    // ------
    unset($db[$id]);
    unset($ida[$id]);
    // Remove from meta-index
    $_ts_id = bt_get_id($id, 'nts_id');
    bt_del_id($id, 'nts_id');
    bt_del_id($_ts_id, 'nid_ts');
    // Remove page alias
    $_ts_pg = bt_get_id($id, 'ts_pg');
    bt_del_id($id, 'ts_pg');
    bt_del_id($_ts_pg, 'pg_ts');
    // save block
    db_save_news($db, $nloc);
    db_index_save($ida, $source);
    db_index_update_overall($source);
    cn_relocation(cn_url_modify(array('reset'), 'mod=editnews', "source={$source}"));
    $FlatDB->cache_clean();
}
예제 #14
0
</a></li>
        <?php 
    }
    ?>
    </ul>
    <h2>Plugins</h2>
    <?php 
    foreach ($plugins as $plugin) {
        ?>
        <li<?php 
        if ($plugin['selected']) {
            echo ' class="sl"';
        }
        ?>
><a href="<?php 
        echo cn_url_modify('selected=' . $plugin['md5']);
        ?>
"><?php 
        echo ucfirst($plugin['name']);
        ?>
</a></li>
    <?php 
    }
    ?>
</div>

<div class="widget-settings">
    <form action="<?php 
    echo PHP_SELF;
    ?>
" method="POST">
예제 #15
0
     // Limits
     $limit_skip = false;
     $page_limits = getoption('pagination_pages') ? getoption('pagination_pages') : 10;
     $current_page = intval($start_from / $number);
     $limit_left = $current_page - $page_limits;
     $limit_right = $current_page + $page_limits;
     for ($i = 0; $i < $pages; $i++) {
         $_next_num = $number * $i;
         if (getoption('rw_engine') && !$_ignore_rewrite) {
             if ($tag) {
                 $url = cn_rewrite('tag', $tag, $_next_num, $PSTF);
             } else {
                 $url = cn_rewrite('list', $_next_num, $archive, $PSTF);
             }
         } else {
             $url = cn_url_modify("start_from={$_next_num}");
         }
         if ($limit_skip == false && ($limit_left >= $i || $i > $limit_right)) {
             $links .= '<span class="cn-page-skip">...</span> ';
             $limit_skip = true;
         } elseif ($i != $current_page) {
             $links .= '<a class="cn-page-news" href="' . $url . '">' . ($i + 1) . '</a> ';
             $limit_skip = false;
         } else {
             $links .= '<span class="cn-current-page-news">' . ($i + 1) . '</span> ';
             $limit_skip = false;
         }
     }
     $out = str_replace('{pages}', $links, $out);
     echo $out;
 }
예제 #16
0
function dashboard_templates()
{
    $all_templates = array();
    $template_parts = array();
    $def_ids = array('active' => 'Active News', 'full' => 'Full Story', 'comment' => 'Comment', 'form' => 'Add comment form', 'prev_next' => 'News Pagination', 'comments_prev_next' => 'Comments Pagination');
    list($template, $sub) = GET('template, sub', 'GPG');
    // Default templates
    $list = cn_template_list();
    // User changes
    $tuser = getoption('#templates');
    // Basic template name and fetch data (user/system)
    if (!$template) {
        $template = 'default';
    }
    // Copy default subtemplate, if not exists
    if (!isset($tuser[$template])) {
        foreach ($list[$template] as $_sub => $_var) {
            $tuser[$template][$_sub] = $_var;
        }
    }
    // Get all templates, mark it as user/system
    foreach ($tuser as $id => $vs) {
        $all_templates[$id] = 'User';
    }
    foreach ($list as $id => $vs) {
        $all_templates[$id] = 'Sys';
    }
    $odata = array();
    foreach ($tuser[$template] as $id => $subtpl) {
        if (isset($def_ids[$id])) {
            $_name = $def_ids[$id];
        } else {
            $_name = ucfirst(str_replace('_', ' ', $id));
        }
        $odata[$id] = $subtpl;
        $template_parts[$id] = $_name;
    }
    reset($odata);
    // Get subtmpl by default
    if (!$sub) {
        $sub = key($odata);
    }
    // ------------------------------------------------------------------------------------ ACTIONS --------------------
    // save template?
    if (request_type('POST')) {
        cn_dsi_check();
        // ------------------------
        if (REQ('select', 'POST')) {
            cn_relocation(cn_url_modify(array('reset'), 'mod=' . REQ('mod'), 'opt=' . REQ('opt'), 'template=' . $template));
        } elseif (REQ('create') || REQ('template_name')) {
            $template_name = trim(strtolower(preg_replace('/[^a-z0-9_]/i', '-', REQ('template_name'))));
            if (!$template_name) {
                cn_throw_message('Enter correct template name', 'e');
            } elseif (isset($all_templates[$template_name])) {
                cn_throw_message('Template already exists', 'e');
            } else {
                $tuser[$template][$sub] = REQ('save_template_text', 'POST');
                setoption("#templates/{$template_name}", $tuser[$template]);
                msg_info('Template [' . $template_name . '] created', cn_url_modify(array('reset'), 'mod=' . REQ('mod'), 'opt=' . REQ('opt'), 'template=' . $template_name));
            }
        } elseif (REQ('delete')) {
            if ($all_templates[$template] === 'Sys') {
                cn_throw_message("Template '{$template}' is system template, can't delete", 'e');
            } else {
                unset($tuser[$template]);
                setoption('#templates', $tuser);
                msg_info('Template [' . $template . '] deleted!', cn_url_modify(array('reset'), 'mod=' . REQ('mod'), 'opt=' . REQ('opt')));
            }
        } elseif (REQ('reset')) {
            if ($all_templates[$template] === 'Sys') {
                unset($tuser[$template]);
                setoption("#templates", $tuser);
                cn_throw_message("Template reset to default");
            } else {
                cn_throw_message("Template is user template, can't reset", 'e');
            }
        } else {
            $tuser[$template][$sub] = REQ('save_template_text', 'POST');
            setoption("#templates", $tuser);
            cn_throw_message('Template saved successfully');
        }
    }
    if (isset($_POST['template'])) {
        $_GET['template'] = $_POST['template'];
    }
    if (isset($_POST['sub'])) {
        $_GET['sub'] = $_POST['sub'];
    }
    // user can't delete system template, only modify
    $can_delete = $all_templates[$template] == 'Sys' ? FALSE : TRUE;
    // get template text (may be modified before)
    $template_text = isset($tuser[$template][$sub]) ? $tuser[$template][$sub] : (isset($list[$template][$sub]) ? $list[$template][$sub] : '');
    // ----
    cn_assign('template_parts, all_templates, template_text, template, sub, can_delete', $template_parts, $all_templates, $template_text, $template, $sub, $can_delete);
    echoheader('-@dashboard/style.css', "Templates");
    echo exec_tpl('dashboard/template');
    echofooter();
}
예제 #17
0
</form>

<br/>
<div>
    <ul class="sysconf_top">
        <?php 
foreach ($template_parts as $id => $template_name) {
    ?>
            <li <?php 
    if ($sub == $id) {
        echo 'class="selected"';
    }
    ?>
><a href="<?php 
    echo cn_url_modify('sub=' . $id);
    ?>
"><?php 
    echo $template_name;
    ?>
</a></li>
        <?php 
}
?>
    </ul>
    <div style="clear: left;"> </div>
</div>

<form action="<?php 
echo PHP_SELF;
?>
예제 #18
0
        <th>Count news</th>
        <th>First date</th>
        <th>Last date</th>
    </tr>

    <?php 
foreach ($arch_list as $id => $item) {
    ?>
        <tr align="center" <?php 
    if ($id == $archive_id) {
        echo 'class="row_selected"';
    }
    ?>
>
            <td><a href="<?php 
    echo cn_url_modify('archive_id=' . $id);
    ?>
"><?php 
    echo date('Y-m-d H:i:s', $id);
    ?>
</a></td>
            <td><?php 
    echo $item['c'];
    ?>
</td>
            <td><?php 
    echo date('Y-m-d H:i:s', $item['min']);
    ?>
</td>
            <td><?php 
    echo date('Y-m-d H:i:s', $item['max']);
예제 #19
0
    }
}
?>
                        
                </select>
            </td>
        </tr>

        <tr>
            <td align="right">Icon</td>
            <td><input style="width: 350px;" type="text" id="category_icon" name="category_icon" value="<?php 
echo cn_htmlspecialchars($category_icon);
?>
"/> 
                <a class="external" href="#" onclick="<?php 
echo cn_snippet_open_win(cn_url_modify('mod=media', 'opt=inline', 'faddm=C', 'callback=category_icon'), array('w' => 640));
?>
">
                    Media manager
                </a> 
            </td>
        </tr>

        <tr>
            <td>Groups</td>
            <td>
                <?php 
foreach ($groups as $id => $name) {
    ?>
                <input type="checkbox" name="category_acl[]" <?php 
    if ($category_acl && in_array($id, $category_acl)) {
예제 #20
0
    ?>
            <tr>
                <td><?php 
    echo $ip;
    ?>
</td>
                <td align="center"><?php 
    echo $item[0];
    ?>
</td>
                <!-- <td align="center"><?php 
    echo $item[1];
    ?>
</td> -->
                <td align="center">[<a href="<?php 
    echo cn_url_modify('unblock=' . $ip, cn_snippet_digital_signature('a'));
    ?>
" onclick="return(confirm('Confirm unblock'));">unblock</a>]</td>
            </tr>
        <?php 
}
?>
    </table>

    <table width="100%" class="std-table panel">
        <tr>
            <td align="right" height="25">IP Address:&nbsp;</td>
            <td height="25"> <input type="text" name="add_ip"> <input type="submit" value="Block IP / Name"> example: <i>129.32.31.44</i> or <i>129.32.*.*</i>, or <i>username</i> </td>
        </tr>
    </table>
예제 #21
0
    <?php 
}
?>

    <h2 style="margin-top: 0;"><?php 
echo i18n('Site options');
?>
</h2>
    <div class="options">
        <?php 
foreach ($dashboard as $id => $item) {
    ?>

            <div class="opt-item">
                <a href="<?php 
    echo cn_url_modify("mod=" . $item['mod'], "opt=" . $item['opt']);
    ?>
">
                    <div><img src="skins/images/<?php 
    echo $item['img'];
    ?>
" width="48" /></div>
                    <div><?php 
    echo $item['name'];
    ?>
</div>
                </a>
            </div>

        <?php 
}
예제 #22
0
            <td><?php 
    echo cn_htmlspecialchars($u);
    ?>
</td>
            <td>

            <?php 
    if (is_array($v)) {
        echo '<a href="' . cn_url_modify('path=' . $path . '/' . $u) . '">click to expand &rarr;</a>';
        $edit = FALSE;
    } elseif (is_numeric($v)) {
        echo $v;
        $edit = TRUE;
    } elseif (strlen($v) > 128) {
        echo cn_htmlspecialchars(clever_truncate($v, 128));
        $edit = TRUE;
    } else {
        echo cn_htmlspecialchars($v);
        $edit = TRUE;
    }
    if ($edit) {
        echo ' [<a href="#" onclick="' . cn_snippet_open_win(cn_url_modify('edit=' . $u), array('w' => 800, 'h' => 550, 'l' => 'auto')) . '" class="external">edit</a>]';
    }
    ?>
            </td>
        </tr>
    <?php 
}
?>
</table>
예제 #23
0
    <table class="std-table" width="100%">

        <?php 
cn_snippet_show_list_head('Name|Size (kb)|Date archived');
?>

        <?php 
foreach ($archives as $archive) {
    ?>
        <tr>
            <td><?php 
    echo $archive['name'];
    ?>
 [<a href="<?php 
    echo cn_url_modify('unpack=' . $archive['name'], cn_snippet_digital_signature('a'));
    ?>
" onclick="return(confirm('Unpack this archive? It replace all news'));">unpack</a>]</td>
            <td align="center"><?php 
    echo round($archive['size'] / 1024, 2);
    ?>
</td>
            <td align="center"><?php 
    echo $archive['date'];
    ?>
</td>
        </tr>
        <?php 
}
?>
예제 #24
0
function cn_modify_bb_comm_edit($e, $t)
{
    $user = member_get();
    $edit_link = '<a href="' . cn_url_modify('id=' . intval($_GET['id']), 'edit_id=' . intval($e['id'])) . '">' . $t . '</a>';
    if (test('Mes') && $e['u'] == $user['name']) {
        return $edit_link;
    }
    if (test('Mea')) {
        return $edit_link;
    }
    return '';
}
예제 #25
0
            $st = 0;
        }
        if (getoption('rw_engine')) {
            $hrefA = '<a href="' . cn_rewrite('comments', $id, $st) . '">\\1</a>';
        } else {
            $hrefA = '<a href="' . cn_url_modify('start_from=' . $st) . '">\\1</a>';
        }
    } else {
        $hrefA = '\\1';
    }
    // Make next link
    if (($st = $start_from + $com_by_page) < $total_comments) {
        if (getoption('rw_engine')) {
            $hrefB = '<a href="' . cn_rewrite('comments', $id, $st) . '">\\1</a>';
        } else {
            $hrefB = '<a href="' . cn_url_modify('start_from=' . $st) . '">\\1</a>';
        }
    } else {
        $hrefB = '\\1';
    }
    // No comments to show
    if ($hrefA == '\\1' && $hrefB == '\\1') {
        $cpn = '';
    }
    // Replace
    $cpn = preg_replace('/\\[prev-link\\](.*?)\\[\\/prev-link\\]/i', $hrefA, $cpn);
    $cpn = preg_replace('/\\[next-link\\](.*?)\\[\\/next-link\\]/i', $hrefB, $cpn);
    $cpn = str_replace('{pages}', intval($start_from / $com_by_page) + 1, $cpn);
} else {
    $cpn = '';
}
예제 #26
0
    ?>
">..</a></td> </tr>

        <?php 
}
?>

        <!-- show dirs -->
        <?php 
foreach ($dirs as $dir) {
    $next_folder = join(DIRECTORY_SEPARATOR, array_merge($cp, array($dir['name'])));
    ?>
            <tr>
                <td align="center"><img src="skins/images/dir.png" /></td>
                <td colspan="4"><a href="<?php 
    echo cn_url_modify("folder={$next_folder}");
    ?>
" style="color: #C04000"><b><?php 
    echo $dir['name'];
    ?>
</b></a></td>
                <td align="center"><input type="checkbox" name="rm[]" value="<?php 
    echo cn_htmlspecialchars($dir['name']);
    ?>
" /></td>
            </tr>
        <?php 
}
?>

        <!-- show files -->
예제 #27
0
<?php

list($sub) = _GL('sub');
cn_snippet_bc();
?>
<ul class="sysconf_top">
    <li<?php 
if ($sub == 'migrate') {
    echo " class='selected'";
}
?>
><a href="<?php 
echo cn_url_modify('sub=migrate');
?>
">Migration</a></li>
    <li<?php 
if ($sub == 'sysconf') {
    echo " class='selected'";
}
?>
><a href="<?php 
echo cn_url_modify('sub=sysconf', 'path');
?>
">System conf</a></li>
</ul>
<div style="clear: both;"></div>
예제 #28
0
                unset($_list_archives[$archive_id]);
            } else {
                break;
            }
        } while (TRUE);
        // show results ------------
        if (!$found) {
            echo "<p class='cutenews_not_match'>" . i18n('There are no news articles matching your search criteria') . "</p>";
        } else {
            // Close "cn_search_body"
            echo "</div>";
        }
        echo '<div class="cn_paginate_search">';
        $__PHP_SELF = $PHP_SELF;
        $PHP_SELF = $_SERVER['SCRIPT_NAME'];
        if ($search_st - $number >= 0 && $number) {
            echo ' <a href="' . cn_url_modify('search_st=' . ($search_st - $number)) . '">&lt;&lt; Prev</a> ';
        }
        if ($search_st) {
            echo ' (skip <b class="search_skip">' . $search_st . '</b> items) ';
        }
        if ($_next_link) {
            echo ' <a href="' . cn_url_modify('search_st=' . ($search_st + $number)) . '">Next &gt;&gt;</a>';
        }
        $PHP_SELF = $__PHP_SELF;
        unset($__PHP_SELF);
        echo '</div>';
    }
    echo '<p class="cutenews_search_results"><i>' . i18n('Search performed for') . ' ' . round(microtime(true) - $mc_start, 4) . ' s.</i></p>';
}
return TRUE;
예제 #29
0
    <table class="std-table" width="100%">
        <tr><th>Word</th> <th>Replace</th></tr>

        <?php 
if (is_array($wlist) && $wlist) {
    foreach ($wlist as $name => $var) {
        ?>

            <tr <?php 
        if ($word == $name) {
            echo 'class="row_selected"';
        }
        ?>
>
                <td><a href="<?php 
        echo cn_url_modify('word=' . $name);
        ?>
"><?php 
        echo cn_htmlspecialchars($name);
        ?>
</a></td>
                <td><?php 
        echo cn_htmlspecialchars($var);
        ?>
</td>
            </tr>

        <?php 
    }
} else {
    ?>
예제 #30
0
?>
<table class="std-table" width="100%">
    <tr> <th>Name</th> <th>Type</th> <th>Desc</th> <th>Meta</th> <th>Group</th> <th>Required</th> </tr>

    <?php 
if ($list) {
    foreach ($list as $_name => $item) {
        ?>
        <tr <?php 
        if ($name == $_name) {
            echo 'class="row_selected"';
        }
        ?>
>
            <td align="center"><a href="<?php 
        echo cn_url_modify("extr_name={$_name}");
        ?>
"><?php 
        echo cn_htmlspecialchars($_name);
        ?>
</a></td>
            <td align="center" style="color: #666666;"><?php 
        echo $item['type'];
        ?>
</td>
            <td><?php 
        echo cn_htmlspecialchars($item['desc']);
        ?>
</td>
            <td><?php 
        echo cn_htmlspecialchars($item['meta']);