Beispiel #1
0
    public static function fileUploadBlock()
    {
        if (self::$invalid) {
            return;
        }
        i18n::set('admin');
        $uploader = new Uploader('editFiles', 'EditPage::handleUpload', false, array('multi' => true));
        queue_js_string("/*\$(function(){\$('.view-uploads').overlay({\n\tmask: {\n\t\tcolor: '#000',\n\t\tloadSpeed: 200,\n\t\topacity: 0.7\n\t},\n\n\tcloseOnClick: true\n});});*/");
        $uploadedButton = sprintf("<a href='#' class='action view-uploads' rel='#cc_uploaded_overlay'>%s%s</a>", icon('folder_picture'), __('admin', 'view-all-files'));
        $uploadedFiles = <<<EOT
<div class="cc_uploaded_files">
{$uploadedButton}
\t<div id="cc_uploaded_overlay" class="cc_modal">
\t\t<h2>%s</h2>
\t\t<ul class="cc_file_list">
\t\t\t%s
\t\t</ul>
\t</div>
</div>
EOT;
        //foreach(Uploads::getAllFiles() as $)
        $r .= sprintf("<h3>%s</h3>%s%s", __('upload-files'), sprintf($uploadedFiles, __('uploaded-files'), $files), $uploader->createHTML());
        i18n::restore();
        return $r;
    }
Beispiel #2
0
 public static function create_display()
 {
     i18n::set('admin');
     if ($_POST['cc_form'] == 'create_page') {
         plugin('admin_create_post_pre_proccessing');
         $id = $_GET['id'];
         $title = filter('admin_create_post_title', self::get('title'));
         $content = filter('admin_create_post_content', self::get('content_area'));
         $last_modified = filter('admin_create_post_last_modified', time());
         $settings = filter('admin_create_post_settings', self::get('settings'));
         $weight = filter('admin_create_post_weight', self::get('weight'));
         $menutitle = filter('admin_create_post_menutitle', self::get('menutitle'));
         $parent_id = filter('admin_create_post_parent_id', self::get('parent_id'));
         $slug = filter('admin_create_post_slug', self::get('slug'));
         if (empty($menutitle) || empty($slug)) {
             $message = Message::error(__('blank-error'));
             plugin('admin_create_post_blank_error');
         } else {
             plugin('admin_create_post_post_proccessing');
             $values = array('title' => $title, 'content' => $content, 'settings' => unserialize($settings), 'weight' => $weight, 'menutitle' => $menutitle, 'parent_id' => $parent_id, 'slug' => $slug);
             $values = filter('admin_create_post_posted_values', $values);
             $values['settings'] = serialize($values['settings']);
             $res = Content::createNode($_GET['type'], $values);
             if ($res) {
                 $message = Message::success(sprintf(__('page-creation-successful') . ' (<a href="%s">%s</a>)', Admin::link('content'), __('view-all-pages')));
             } else {
                 $message = Message::error(__('page-creation-failed'));
             }
         }
         //Hooks::bind('post_edit_page', 'EditPage::handlePost');
     }
     $r = $message;
     $themeList = array_subkeys(Themes::getThemeList(), 'name');
     $themeList['-1'] = 'Default Theme';
     ksort($themeList);
     $form = new Form('self', 'post', 'create_page');
     $form->addHidden('settings', 'a:0:{}');
     $form->startFieldset(__('page-info'), array('id' => 'page_info_f'));
     $form->addInput(__('page-title'), 'text', 'title', self::get('title'), array('class' => 'large'));
     $form->addHidden('content_type', self::get('type'));
     $form->addSelectList(__('theme-override'), 'theme', $themeList);
     $form->addSelectList(__('parent'), 'parent_id', self::buildParentOptions(), true, $_POST['parent_id'] ? $_POST['parent_id'] : '0');
     $form->endFieldset();
     plugin('admin_create_custom_fields', array(&$form));
     $form->startFieldset(__('menu-settings'), array('id' => 'menu_settings_f'));
     $form->addInput(__('menu-title'), 'text', 'menutitle', self::get('menutitle'));
     $form->addInput(__('slug'), 'text', 'slug', self::get('slug'));
     $form->addInput(__('weight'), 'text', 'weight', $_POST['weight'] ? $_POST['weight'] : '0');
     $form->endFieldset();
     plugin('admin_create_custom_fields2', array(&$form));
     $form->startFieldset(__('content'));
     $content = self::get('content_area');
     $form->addEditor('<p></p>', 'content_area', empty($content) ? "<p></p>" : $content);
     $form->endFieldset();
     plugin('admin_create_custom_fields3', array(&$form));
     $form->addSubmit('', 'save', __('save'));
     i18n::restore();
     return array(__('admin', 'add-page'), $r . $form->endAndGetHTML());
 }
Beispiel #3
0
?>
</title>

		<?php 
load_library(array('bootstrap-css', 'jquery'));
queue_css(TH_PUB_ADMIN . 'design/styles.css');
load_css();
load_js();
?>
	</head>
	<body class="login">
		<div id="login-wrapper">
			<h2><?php 
_e('login_cc');
?>
</h2>
			<?php 
$form = new Form('self', 'post', 'login');
$form->startFieldset('');
$form->addInput(__("Username"), 'text', 'cc_login_uname');
$form->addInput(__("Password"), 'password', 'cc_login_passwd');
$form->addInput(__("remember-me"), 'checkbox', 'cc_login_remember', 'yes');
$form->addSubmit('', 'cc_login_login', __('login_cc'));
$form->endFieldset();
echo $form->endAndGetHTML();
i18n::restore();
?>
		</div>
	</body>
</html>
Beispiel #4
0
 public static function display()
 {
     $id = $_GET['id'];
     if (!is_numeric($id)) {
         i18n::restore();
         cc_redirect(Admin::link('users'));
         return 'redirected.';
     }
     $messages = "";
     if ($_POST['cc_form'] === 'edit-user') {
         $username = $_POST['name'];
         $password = $_POST['password'];
         $cpassword = $_POST['confirm-password'];
         $group = $_POST['group'];
         if ($password != $cpassword) {
             $messages .= Message::error(__('admin', 'passwords-dont-match'));
         } else {
             $result = Database::select('users', '*', array('users_id = ?', $id));
             $row = $result->fetch(PDO::FETCH_ASSOC);
             $result = Database::select('users', '*', array('name = ?', $username));
             if (!empty($result)) {
                 $userRow = $result->fetch(PDO::FETCH_ASSOC);
             } else {
                 $result = false;
             }
             if ($result && $userRow['name'] == $username && $id != $userRow['id']) {
                 $messages .= Message::error(__('admin', 'username-in-use'));
             } else {
                 if (!empty($password) && !empty($cpassword) && $password == $cpassword) {
                     $hash = hash('whirlpool', $password);
                 } else {
                     $hash = $row['value'];
                 }
                 $data = unserialize($row['data']);
                 $result = Database::update('users', array('name' => filter('admin_edit_user_username', $username), 'value' => $hash, 'type' => 'user', 'group' => filter('admin_edit_group', $group), 'data' => serialize(filter('admin_edit_user_data', $data))), null, array('id = ?', $id));
                 if ($result === 1) {
                     $messages .= Message::success(__('admin', 'user-updated'));
                 }
             }
         }
     }
     $result = Database::select('users', '*', array('users_id = ?', $id));
     if (empty($result)) {
         i18n::restore();
         cc_redirect(Admin::link('users'));
     }
     self::$row = $result->fetch(PDO::FETCH_ASSOC);
     $form = new Form('self', 'post', 'edit-user');
     $groups = Users::allGroups();
     foreach ($groups as $key => $value) {
         $groups[$value->getId()] = $value->getName();
     }
     $form->startFieldset(__("admin", 'user-information'));
     $form->addInput(__('admin', 'username'), 'text', 'name', self::get('name'));
     $form->addInput(__('admin', 'password'), 'password', 'password');
     $form->addInput(__('admin', 'confirm-password'), 'password', 'confirm-password');
     $form->addSelectList(__('admin', 'group'), 'group', $groups, true, self::get('group'));
     plugin('admin_edit_user_custom_fields', array(&$form));
     $form->addSubmit('', 'edit-user', __('admin', 'edit-user'));
     $form->endFieldset();
     plugin('admin_edit_user_custom_fieldset', array(&$form));
     $form = $form->endAndGetHTML();
     return array(sprintf("%s: %s", __('admin', 'edit-user'), self::get('name')), $messages . $form);
 }
Beispiel #5
0
 public static function create_display()
 {
     i18n::set('external-link-nodetype');
     $message = "";
     if ($_POST['cc_form'] == 'create_external_link') {
         $id = $_GET['id'];
         $weight = self::get('weight');
         $menutitle = self::get('menutitle');
         $parent_id = self::get('parent_id');
         $slug = self::get('slug');
         if (empty($url) || empty($text)) {
             $message = Message::error(__('blank-error'));
         } else {
             if (empty($weight)) {
                 $weight = '0';
             }
             $values = array('title' => '', 'content' => '', 'settings' => 'a:0:{}', 'weight' => $weight, 'menutitle' => $menutitle, 'parent_id' => $parent_id, 'slug' => $slug);
             $res = Content::createNode($_GET['type'], $values);
             if ($res) {
                 $message = Message::success(sprintf(__('link-creation-successful') . ' (<a href="%s">%s</a>)', Admin::link('content'), __('admin', 'view-all-pages')));
             } else {
                 $message = Message::error(__('link-creation-failed'));
             }
         }
     }
     $r = $message;
     $form = new Form('self', 'post', 'create_external_link');
     $form->addInput(__('url'), 'text', 'slug', self::get('slug'));
     $form->addInput(__('display-text'), 'text', 'menutitle', self::get('menutitle'));
     $form->addSelectList(__('parent'), 'parent_id', PageNode::buildParentOptions(), true, $_POST['parent_id'] ? $_POST['parent_id'] : '0');
     $form->addInput(__('weight'), 'text', 'weight', self::get('weight'));
     $form->addSubmit('', 'create', 'Create');
     i18n::restore();
     return array(__('external-link-nodetype', 'create-external-link'), $form->endAndGetHTML());
 }