function run()
 {
     global $SITE, $DB, $Templates;
     $_POST->setType('vis', 'any', true);
     $_POST->setType('def', 'string', true);
     $_REQUEST->setType('upd', 'any');
     $properties = $DB->setset->asArray(false, false, false, false, 'property');
     if ($_POST['def']) {
         $vis = $_POST['vis'];
         $def = $_POST['def'];
         foreach ($properties as $property) {
             $property = $property['property'];
             Settings::changeSetting($property, false, false, $vis[$property]);
             $SITE->settings[$property] = $def[$property];
         }
         redirect(url(array('upd' => 1), true));
     }
     if ($_REQUEST['upd']) {
         Flash::create(__('Settings updated'), 'confirmation');
     }
     __autoload('Form');
     $TRs = array();
     $settings_types = array(__('Administrator-specified'), __('User level, pre-specified'), __('User level, self-specified'), __('User- or group level, pre-specified'), __('User- or group level , self-specified'), __('Group level, pre-specified'), __('Group level, self-specified'));
     foreach ($properties as $property) {
         $TRs[] = new Tablerow(Settings::name($property['property']), new Select(false, 'vis[' . $property['property'] . ']', $settings_types, $property['visible']), Settings::display($property['type'], false, 'def[' . $property['property'] . ']', $SITE->settings[$property['property']], $property['description'], $property['set']));
     }
     $form = new Form('sitesettings');
     $this->setContent('header', __('Default user settings'));
     $this->setContent('main', $form->collection(new Table(new Tableheader(__('Property'), __('Type'), __('Property default')), $TRs)));
     $Templates->admin->render();
 }
Example #2
0
 function run()
 {
     global $USER, $Templates;
     $this->setContent('header', __('Terms and Conditions'));
     $_POST->setType('termsAgreed', 'any');
     if ($_POST['termsAgreed']) {
         $USER->acceptTerms();
         $this->setContent('main', __('Thank you'));
         redirect(-2, 3);
     } else {
         $form = new Form('Terms');
         $this->appendContent('main', $this->getContent('Terms') . $form->collection(new Set(new Minicheck(__('I agree'), 'termsAgreed', false, 'checked'))));
     }
     $Templates->render();
 }
Example #3
0
 /**
  * Display form for entering comment
  * @param $id Id of the page to comment
  * @return form
  */
 function displayForm($id = false)
 {
     global $USER, $CURRENT, $ID, $CONFIG;
     if (!$id) {
         if (!$CURRENT->settings['comments']) {
             return '';
         }
         $id = $ID;
     }
     if (is_object($id)) {
         $id = $id->ID;
     }
     if ($USER->ID == NOBODY) {
         if ($CONFIG->comments->guest_comments == 'none') {
             return;
         }
     } elseif ($CONFIG->comments->user_comments == 'none') {
         return;
     }
     $form = new Form('commentForm');
     $_POST->setType('commentbody', 'any');
     $_POST->setType('author', 'string');
     echo $form->collection(new Hidden('pid', $id), new Set($USER->ID === NOBODY ? new Input(__('Name'), 'author', $_POST['author']) : new FormText('Name', $USER->settings['displayname']), $USER->ID === NOBODY && $CONFIG->comments->CAPTCHA_for_guests ? reCAPTCHA::view() : null, new HTMLField(__('Comment'), 'commentbody', $_POST['commentbody'])));
 }
 /**
  * Display the page for editing normal permissions
  * @return string
  */
 private function editPermissions()
 {
     global $DB, $Controller;
     $r = '';
     $r .= '<h2>[' . get_class($this->that) . ']: ' . $this->that . '</h2>';
     $gform = new Form('nGP', url(null, array('edit', 'with', 'referrer', 'filter', 'popup')), false);
     $groups = $Controller->getClass('Group');
     propsort($groups, 'Name');
     $uform = new Form('findUser', url(null, array('edit', 'with', 'referrer', 'filter', 'popup')), false);
     $r .= '' . new Accordion(__('User permission'), $uform->collection(new Set(new Li(new Input(__('Find user'), 'keyword', $_REQUEST['keyword']), new Submit(__('Search'))))) . $this->userSearchResults(), __('Group permission'), $gform->collection(new Set(new Li(new Select(__('Choose group'), 'nP', $groups, false, false, __('Choose group')), new Submit(__('Add'))))));
     $r .= $this->__REEDprivilegeList();
     return $r;
 }
Example #5
0
    function feedback()
    {
        global $USER, $PAGE;
        $feedbackForm = new Form('feedbackform', '/Report', __('Send'), 'post', false);
        echo '
        <div class="help_div">
            <div class="help_content">' . ($USER->ID == NOBODY ? '<div class="disable"><h1>' . __('You must be logged in to send feedback') . '</h1><p style="text-align:center"><a href="javascript:;" class="linkbutton" onclick="feedbackLogin();">' . __('Login') . '</a></p></div>' : '') . '
                <div class="report_content">
                    <h2>' . __('Report an error') . '</h2>' . $feedbackForm->collection(new RadioSet('Feedback type', 'feedback', array('error' => __('Bug'), 'suggestion' => __('Other feedback')), false, 1), new TextArea(__('Description'), 'description', '', false, false, false, 20, 25)) . '<p style="margin-top:15px;">' . __('Here you can report any bugs you come across. Please include as much information as possible.') . '</p>
                </div>
            </div>
            <div id="btn_report"><h1><nobr>' . __('REPORT BUG') . '</nobr></h1></div>
        </div>';
        $ajaxReport = true;
        JS::raw('
        $("#btn_report").click(
            function() {
                $(this).siblings(".help_content")
                .stop(true)
                .animate({width:"toggle"},"fast");
            }
        );

        $("#feedbackform").submit(
            function () {
                if($("#feedbackform input[name=feedback]:checked").length != 1){
                    alert("' . __('You have to choose a feedback type') . '");
                    return(false);
                } else if($("#feedbackform textarea").val() == ""){
                    alert("' . __('Please describe the problem before sending') . '");
                    return(false);
                } else if(' . (int) (bool) $ajaxReport . '){
                    $.post("/Report", $("#feedbackform").serialize(),
                        function(data){
                            if(data.length > 0){
                                alert(data);
                            }
                        }
                    );
                    $("#btn_report").siblings(".help_content").stop(true).animate({width:"toggle"},"fast");
                    $("#feedbackform")[0].reset();
                    return(false);
                }
            }
        );

        function feedbackLogin() {
            $("#btn_report").siblings(".help_content").stop(true).animate({width:"toggle"},"fast","linear",
                function(){
                    $("#login2 .login_help .content_help:hidden")
                        .stop(true)
                        .slideToggle("fast");
                    $("#username").focus();
                }
            )
        };
    ');
    }
 /**
  * @return string
  */
 private function mainView()
 {
     global $USER, $CONFIG, $DB, $Controller;
     $form = new Form('newEvent');
     $calendarSettings = new Accordion(__('Calendar settings'), new Set(new Checkbox(__('Insert into calendar'), 'einscal'), Short::datetime(__('Starts'), 'cstart'), Short::datetime(__('Ends'), 'cend')));
     $calendarSettings->params = 'collapsible:true,active:false';
     return new Tabber('flows', __('New item'), $form->collection($calendarSettings, new Hidden('esave', 1), new Hidden('edit', $_REQUEST['edit'] ? $_REQUEST['edit'] : 'new'), new Set(new Select(__('Language'), 'lang', google::languages($CONFIG->Site->languages), $_POST['lang'] ? $_POST['lang'] : $USER->settings['language']), new Input(__('Title'), 'etitle', $_POST['etitle']), new ImagePicker(__('Image'), 'eimg'), new Li(Short::datetime(__('Publish'), 'estart', $_POST['estart']), $this->mayI(PUBLISH) ? new Minicheck(__('Activate post'), 'activated', true) : null), Short::datetime(__('Hide'), 'eend', $_POST['eend']), new TagInput(__('Flow'), 'flows', Flow::flows(), $_POST['flows'] ? $_POST['flows'] : '', true, false, 'required'), new htmlfield(_('Text'), 'etxt', $_POST['etxt']))), __('Flows'), $this->flowList());
 }
 /**
  * View the user-search form
  * @return string
  */
 private function findUser()
 {
     global $USER;
     $r = '';
     if ($this->may($USER, EDIT)) {
         $r = '<div class="ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">' . '<a href="' . url(array('view' => 'new'), 'id') . '">' . icon('large/identity-32') . __('Add user') . '</a>&nbsp;&nbsp;' . '<a href="' . url(array('view' => 'terms'), 'id') . '">' . icon('large/view_choose-32') . __('Terms and conditions') . '</a></div>';
     }
     $uform = new Form('findUser', url(null, array('id')), false);
     return $r . $uform->collection(new Set(new Li(new Input(__('Find user'), 'keyword', $_REQUEST['keyword']), new Submit(__('Search'))))) . $this->userSearchResults();
 }
 /**
  * Make a form to edit an information field
  * @param $field The field name (or 'new')
  * @return string The rendered form
  */
 function fieldForm($field = false)
 {
     global $CONFIG;
     $uinfoFields = @$CONFIG->userinfo->Fields;
     if ($field) {
         $info = @$uinfoFields[$field];
     } else {
         $info = array();
     }
     $form = new Form(!$field ? 'newFieldSubm' : 'editFieldSubm', url(null, 'id'));
     return $form->collection(new Fieldset(__('Create a new user information-field'), !$field ? null : new Hidden('oldname', $field), new Input(__('Label'), 'fieldlabel', @$info['label'], 'nonempty', __('The visible name of the field')), new Select(__('Type'), 'fieldtype', array('string' => __('Text'), 'image' => __('Image'), 'file' => __('File')), @$info['type'], false, false, false, __('The field type')), new Input(__('Validation'), 'fieldvalidation', @$info['validation'], false, __('Leave empty for no validation'))));
 }
 /**
  * Displays a list of the groups that can be administered
  * @return string
  */
 private function selectGroup()
 {
     global $DB, $Controller, $USER;
     $groups = $DB->spine->asList(array('class' => 'Group'), 'id');
     $g = '';
     if (count($groups) > 0) {
         $g = '<ul class="flul">';
         $pre = false;
         $i = 0;
         $groupObjs = $Controller->get($groups, OVERRIDE);
         uasort($groupObjs, create_function('$a,$b', 'return strnatcasecmp($a->Name, $b->Name);'));
         foreach ($groupObjs as $id => $group) {
             $groupName = $group->Name;
             if (strtolower(@$groupName[0]) !== $pre) {
                 if ($pre !== false) {
                     $g .= '</ul></li>';
                 }
                 $pre = strtolower(@$groupName[0]);
                 $g .= '<li class="fletter">' . strtoupper(@$groupName[0]) . '<ul>';
                 $i = 0;
             }
             $g .= '<li class="' . ($i % 2 ? 'odd' : 'even') . '"><span class="fixed-width">' . $groupName . '</span><div class="tools">' . (in_array($id, array(EVERYBODY_GROUP, MEMBER_GROUP)) || !$this->may($USER, EDIT) ? '' : icon('small/group', __('Manage members'), url(array('adm' => $id), 'edit', 'with'))) . (!$this->may($USER, EDIT) ? '' : icon('small/pencil', __('Edit group'), url(array('edit' => $id), 'id'))) . (in_array($id, array(ADMIN_GROUP, EVERYBODY_GROUP, MEMBER_GROUP)) ? icon('small/lock', __('This group is locked')) : ($this->may($USER, DELETE) ? icon('small/delete', __('Delete'), url(array('delgroup' => $id), 'id')) : '')) . ($Controller->menuEditor->mayI(EDIT) ? icon('small/page_add', __('Add group page to menu'), url(array('madd' => $id), 'id')) : '') . icon('small/script', __('View group statistics'), url(array('stats' => $id), 'id')) . '</div></li>';
             $i++;
         }
         $g .= '</ul></li></ul>';
     }
     if ($this->may($USER, EDIT)) {
         $form = new Form('newGroup', url(null, 'id'));
         return new Tabber('groups', new EmptyTab(__('Select group'), $g), new EmptyTab(__('Create group'), $form->collection(new Fieldset(__('New group'), new Input(__('Name'), 'groupname'), new select(__('Group type'), 'gtype', array('assigned' => __('Assigned'), 'vol' => __('Voluntary'), 'volpre' => __('Voluntary, preselected'))), new TextArea(__('Description'), 'groupdesc')))));
     } else {
         return $g;
     }
 }
 /**
  * Display all options
  * @return void
  */
 function viewAll()
 {
     global $DB, $USER;
     $r = $DB->config->get(array('type!' => 'not_editable'), false, false, 'section,property');
     $form = new Form();
     $e = $this->may($USER, EDIT);
     $lastSectionName = false;
     $lastSection = false;
     $sections = array();
     while ($c = Database::fetchAssoc($r)) {
         if ($lastSectionName != $c['section']) {
             $lastSectionName = $c['section'];
             if ($lastSection != false && $lastSection->count() == 0) {
                 array_pop($sections);
             }
             $sections[] = $lastSection = new Fieldset(ucwords(str_replace('_', ' ', $c['section'])));
         }
         $mult = false;
         $a = false;
         switch ($c['type']) {
             case 'CSV':
                 if (is_array($c['value'])) {
                     $c['value'] = @join(',', $c['value']);
                 }
             case 'text':
                 if ($e) {
                     $a = new Input(ucwords(__(str_replace('_', ' ', $c['property']))), 'conf[' . $c['section'] . '][' . $c['property'] . ']', $c['value'], null, __($c['description']));
                 } else {
                     $a = '<span class="property">' . ucwords(__(str_replace('_', ' ', $c['property']))) . ':</span> <span class="value">' . $c['value'] . '</span><span class="description">' . __($c['description']) . '</span>';
                 }
                 break;
             case 'password':
                 if ($e) {
                     $a = new Password(ucwords(__(str_replace('_', ' ', $c['property']))), 'conf[' . $c['section'] . '][' . $c['property'] . ']', '********', null, __($c['description']));
                 } else {
                     $a = '<span class="property">' . ucwords(__(str_replace('_', ' ', $c['property']))) . ':</span> <span class="value">********</span><span class="description">' . __($c['description']) . '</span>';
                 }
                 break;
             case 'set':
                 $mult = true;
             case 'select':
                 if (is_array($c['set'])) {
                     if ($e) {
                         $a = new Select(ucwords(__(str_replace('_', ' ', $c['property']))), 'conf[' . $c['section'] . '][' . $c['property'] . ']', array_map('__', $c['set']), $c['value'], $mult, false, false, __($c['description']));
                     } else {
                         $a = '<span class="property">' . ucwords(__(str_replace('_', ' ', $c['property']))) . ':</span> <span class="value">' . @$c['set'][$c['value']] . '</span><span class="description">' . __($c['description']) . '</span>';
                     }
                 }
                 break;
             case 'check':
                 if ($e) {
                     $a = new Checkbox(ucwords(__(str_replace('_', ' ', $c['property']))), 'conf[' . $c['section'] . '][' . $c['property'] . ']', $c['value'], $c['value'], false, __($c['description']));
                 } else {
                     $a = '<span class="property">' . ucwords(__(str_replace('_', ' ', $c['property']))) . ':</span> <span class="value">' . $c['value'] . '</span><span class="description">' . __($c['description']) . '</span>';
                 }
                 break;
         }
         if ($a) {
             $lastSection->add($a);
         }
     }
     if ($lastSection != false && $lastSection->count() == 0) {
         array_pop($sections);
     }
     if ($e) {
         return $form->collection($sections);
     } else {
         return join('', $sections);
     }
 }
Example #11
0
 /**
  * Quick way to make a form.
  * First argument is form action.
  * Second is the label of the submit button.
  * The rest of the arguments will be sent to Form::collection and the result returned
  * @return string
  *
  */
 function quick()
 {
     $args = func_get_args();
     $form = new Form(false, array_shift($args), array_shift($args));
     return $form->collection($args);
 }
Example #12
0
 /**
  * Display the page for file uploading
  * @return void
  */
 function uploadPage()
 {
     $form = new Form('uploadToFolder', url(null, true));
     return $form->collection(new Fieldset(__('Select files'), new FileUpload(__('File to upload'), 'uFiles[]'), new FileUpload(__('File to upload'), 'uFiles[]'), new FileUpload(__('File to upload'), 'uFiles[]'), new FileUpload(__('File to upload'), 'uFiles[]'), new CheckBox(__('Uncompress compressed files'), 'uncompress', false)));
 }
Example #13
0
    function viewRevisions($page, $l, $sectionMap = false)
    {
        global $DB, $Controller;
        if (is_numeric($page)) {
            $page = $Controller->{(string) $page}(EDIT);
        }
        $lang = google::languages($l);
        $revisions = array();
        $_REQUEST->setType('rev1', 'numeric', true);
        $_REQUEST->setType('rev2', 'numeric', true);
        //FIXME: Move to CSS
        Head::add('ins {background: lightgreen;}
del {background: pink;}
.revlegend {text-align: right;display:inline;margin: 0 0 0 45px;}
.revlegend ins,.revlegend del {margin: 0 5px;}', 'css-raw');
        $r1 = false;
        $r2 = false;
        $r = $DB->content->get(array('id' => $this->that->ID, 'language' => $l), false, false, 'revision DESC');
        while ($rev = Database::fetchAssoc($r)) {
            $revisions[$rev['section']][$rev['revision']] = strftime('%c', $rev['revision']);
            if ($_REQUEST['rev1'][$rev['section']] === $rev['revision']) {
                $r1[$rev['section']] = $rev;
            }
            if ($_REQUEST['rev2'][$rev['section']] === $rev['revision']) {
                $r2[$rev['section']] = $rev;
            }
        }
        $revArray = array();
        if ($revisions) {
            foreach ($revisions as $sectionName => $sectContent) {
                $revArray[] = new Tab($sectionMap && isset($sectionMap[$sectionName]) ? $sectionMap[$sectionName] : $sectionName, new Li(new Select('View revision', 'rev1[' . $sectionName . ']', $sectContent, $_REQUEST['rev1'][$sectionName], false, __('None')), new Submit('Revert to this', 'revert1[' . $sectionName . ']')), new Li(new Select('Compare to', 'rev2[' . $sectionName . ']', $sectContent, $_REQUEST['rev2'][$sectionName], false, __('None')), new Submit('Revert to this', 'revert2[' . $sectionName . ']')), isset($r1[$sectionName]) ? '<div class="revlegend"><ins>' . strftime('%c', $r1[$sectionName]['revision']) . '</ins>' . (isset($r2[$sectionName]) ? '<del>' . strftime('%c', $r2[$sectionName]['revision']) . '</del></div>' . '<div id="revdiff">' . diff($r2[$sectionName]['content'], $r1[$sectionName]['content']) . '</div>' : '<div id="revdiff">' . strip_tags($r1[$sectionName]['content'], '<p><div>') . '</div>') : null);
            }
            $rForm = new Form('revisionsForm', url(null, array('id', 'edit', 'view', 'lang'), false));
            return '<div class="nav">' . Short::backn() . '</div>' . $rForm->collection(new Hidden('lang', $l), new Tabber('r' . $l, $revArray));
        } else {
            return '<div class="nav">' . Short::backn() . '</div>' . __('There are no saved revisions for this page and language');
        }
    }
 function display()
 {
     $r = '<div id="' . $this->ID . '" class="col ' . ($this->place == 0 ? 'first ' : '') . 'module ' . numberToText($this->size) . ' ' . $this->module . '">' . '<h3>' . __($this->settings[$this->module]['name']) . icon('small/delete', __('Delete module'), url(array('del' => $this->ID), 'id')) . '</h3>';
     /* Module Select */
     $r .= '<label for="module">' . __('Module') . '</label><select id="module" name="btype" class="boxselector">';
     foreach ($this->settings as $module => $settings) {
         $r .= '<option value="' . $module . '"' . ($this->module == $module ? ' selected="selected"' : '') . '>' . __($settings['name']) . '</option>';
     }
     $r .= '</select><br />';
     /* Size select */
     $r .= '<label for="size">' . __('Size') . '</label><select id="size" name="msize" class="boxselector">';
     foreach ($this->settings[$this->module]['size'] as $size) {
         $r .= '<option value="' . $size . '"' . ($this->size == $size ? ' selected="selected"' : '') . '>' . $size . '</option>';
     }
     $r .= '</select><br />';
     /* Content select */
     $moduletype = $this->settings[$this->module]['type'];
     $r .= '<label for="type">' . __('Content type') . '</label><select id="type" name="mcont" class="boxselector"' . (count($moduletype) == 1 ? ' disabled="disabled"' : '') . '>';
     foreach ($moduletype as $type) {
         $r .= '<option value="' . $type . '"' . ($this->type == $type ? ' selected="selected"' : '') . '>' . __($type) . '</option>';
     }
     $r .= '</select>';
     /* Specific ID option */
     if ($this->type == 'id') {
         $r .= '<br/><label for="id">' . $this->settings[$this->module]['name'] . 'ID</label><input id="id" name="cid" value="' . (is_numeric($this->type) ? $this->content : '') . '
     " class="text" /><div class="tools">' . icon('small/folder_picture', __('Browse picture'), "javascript:exploreObj(" . $this->module . ");") . '</div>';
     }
     /* Input content option */
     if ($this->type == 'input') {
         $form = new Form('textcontent', url(array('edit' => $this->ID), 'id'), __('Save'));
         $r .= $form->collection(new Input(__('Content'), 'content', @$this->content));
     }
     /* Text content option */
     if ($this->type == 'text') {
         $form = new Form('textcontent', url(array('edit' => $this->ID), 'id'), __('Save'));
         $r .= $form->collection(new TextArea(__('Content'), 'content', @$this->content));
     }
     /* Image content option */
     if ($this->type == 'image') {
         $form = new Form('imagecontent', url(array('edit' => $this->ID), 'id'), __('Save'));
         $r .= $form->collection(new ImagePicker(__('Content'), 'content', @$this->content));
     }
     $r .= '</div>';
     return $r;
 }
 /**
  * Function for editing company proporties and adding a new one
  * @param $id Company ID to edit or void for new
  * @return string
  */
 function companyForm($company = false)
 {
     global $DB, $Controller;
     if ($company && !is_object($company)) {
         if (!($company = $Controller->retrieve($company))) {
             return false;
         }
     }
     if (is_object($company)) {
         $edit = true;
         if (!$company->mayI(EDIT)) {
             return false;
         }
     } else {
         $edit = false;
     }
     $form = new Form($edit ? 'updCompanySubm' : 'newCompanySubm', url(null, 'id'));
     return '<div class="nav"><a href="' . url(array('id' => 'companyEditor')) . '">' . icon('small/arrow_up') . __('To company manager') . '</a></div>' . $form->collection(new Fieldset($edit ? __('Edit existing comapny') : __('Create a new company'), new Hidden('compid', @$company->ID), new Input(__('Name'), 'name', @$company->Name, 'nonempty', __('Name of the company')), new ImagePicker(__('Logo'), 'logo', @$company->logo, 'nonempty', __('Company logo')), new Input(__('URL'), 'url', @$company->URL, 'nonempty', __('URL to company page')), new Checkbox(__('Automatic Redirect'), 'redirect', @$company->redirect, false, false, __('Redirect to Company URL instead of showing local page')), new Input(__('Weight'), 'weight', @$company->weight, 'nonempty', __('Initial weight of the company')), new Select(__('Type'), 'type', array('main' => __('Main sponsor'), 'sub' => __('Sub sponsor')), @$company->type)));
 }
Example #16
0
 /**
  * Outputs the pageeditor page
  * @param object $link The page that should be edited
  * @return string
  */
 function editor($link)
 {
     global $DB, $Templates, $Controller;
     $Form = new Form('LinkEditorForm');
     if ($link != 'new') {
         if (!is_object($link)) {
             $link = $Controller->{$link}(EDIT);
         } elseif (!$link->mayI(EDIT)) {
             return false;
         }
     }
     return '<div class="nav">' . ($Controller->menuEditor(READ) ? '<a href="' . url(array('id' => 'menuEditor')) . '">' . icon('small/arrow_up') . __('To menu manager') . '</a>' : '') . '</div>' . $Form->collection(new Fieldset(__('Link properties'), $_REQUEST['parent'] ? new Hidden('parent', $_REQUEST['parent']) : null, new Input(__('Title'), 'title', @$link->Name, 'required', __('The name of the link')), new Input(__('Target'), 'target', @$link->rawLink, 'required', __('The URL where to point the link')), new Input(__('Alias'), 'alias', @join(',', $link->aliases), false, __('Any alias to associate with the link')), new TextArea(__('Description'), 'desc', @$link->description, false, __('A description of the link'))));
 }
Example #17
0
 /**
  * @return string
  */
 private function mainView()
 {
     global $USER, $CONFIG, $DB, $Controller;
     $aList = array();
     $total = $DB->getCell("SELECT DISTINCT COUNT(*) FROM updates AS t1 \n            LEFT JOIN spine sp ON sp.id = t1.id\n            LEFT JOIN updates t2 ON t1.id = t2.id\n            AND t1.edited < t2.edited\n            WHERE t2.edited IS NULL\n            AND sp.class = 'Article'\n            ORDER BY t1.edited DESC");
     $perpage = 20;
     $pager = Pagination::getRange($perpage, $total);
     $r = $DB->query("SELECT DISTINCT sp.id FROM updates AS t1 \n            LEFT JOIN spine sp ON sp.id = t1.id\n            LEFT JOIN updates t2 ON t1.id = t2.id\n            AND t1.edited < t2.edited\n            WHERE t2.edited IS NULL\n            AND sp.class = 'Article'\n            ORDER BY t1.edited DESC\n            LIMIT " . $pager['range']['start'] . ", " . $perpage);
     while (false !== ($article = $DB->fetchAssoc($r))) {
         $article = $Controller->{$article['id']};
         $aList[] = '<li><span class="fixed-width">' . $article->Name . '</span><div class="tools">' . icon('small/eye', __('View'), url(array('id' => $article->ID))) . icon('small/pencil', __('Edit'), url(array('edit' => $article->ID), array('id'))) . icon('small/delete', __('Delete'), url(array('del' => $article->ID), 'id')) . '</div></li>';
     }
     $aList = listify($aList);
     if ($total > $perpage) {
         $aList .= $pager['links'];
     }
     $form = new Form('newArticle');
     $calendarSettings->params = 'collapsible:true,active:false';
     return new Tabber('events', __('Article manager'), $aList, __('New article'), $form->collection(new Hidden('asave', 1), new Hidden('edit', $_REQUEST['edit'] ? $_REQUEST['edit'] : 'new'), new Set(new Select(__('Language'), 'lang', google::languages($CONFIG->Site->languages), $USER->settings['language']), new Input(__('Title'), 'atitle'), new Li(new Datepicker(__('Publish'), 'apubd'), new Timepickr(false, 'apubt')), new htmlfield(__('Text'), 'atxt'), new htmlfield(__('Preamble'), 'apre'))));
 }