Пример #1
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     // Get view related request variables.
     $this->type = $app->input->get('type', '', 'cmd');
     $this->pid = $app->input->get('pid', 0, 'int');
     // Get model data.
     $m = $this->getModel();
     $this->state = $this->get('State');
     $this->isecure = $m->itemIsSecure($this->pid);
     $item = $m->getItem($app->input->get('nid', 0, 'int'));
     //echo'<xmp>';var_dump($item);echo'</xmp>';jexit();
     // Construct the breadcrumb
     $this->buildPathway($item ? $item->itemID : $this->pid);
     if ($item && (int) $item->secured) {
         $item->title = base64_decode($item->title);
         if ($item->contentID) {
             $cookn = UserNotesHelper::hashCookieName($item->itemID, $item->contentID);
             $cookv = $app->input->cookie->getBase64($cookn);
             if ($cookv) {
                 setcookie($cookn, '', time() - 3600);
                 $item->ephrase = UserNotesHelper::doCrypt($item->itemID . '-@:' . $item->contentID, base64_decode($cookv), true);
             } elseif ($ephrase = $app->input->post->get('ephrase', '', 'string')) {
                 $item->ephrase = $ephrase;
             } else {
                 $this->item = $item;
                 return parent::display('ephrase');
             }
             $item->serial_content = UserNotesHelper::doCrypt($item->ephrase, base64_decode($item->serial_content), true);
         }
     }
     if (!$item) {
         $item = (object) array('itemID' => 0, 'parentID' => $this->pid, 'contentID' => null, 'checked_out' => null, 'secured' => $this->isecure ? '1' : null);
     } else {
         $m->checkOut($item->itemID);
     }
     $this->item = $item;
     $this->form = $m->getForm($item);
     if ($this->type == 'f') {
         if ($this->isecure) {
             $this->form->removeField('maksec');
         } else {
             $this->form->removeField('pissec');
         }
     }
     //echo'<xmp>';var_dump($this->form);jexit();
     $this->form->setFieldAttribute('ephrase', 'type', 'password');
     // Check for errors.
     // @TODO: Maybe this could go into JComponentHelper::raiseErrors($this->get('Errors'))
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     // Get the current menu item
     $this->params = $app->getParams();
     // Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
     $this->_prepareDocument();
     return parent::display($tpl);
 }
Пример #2
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     // Get view related request variables.
     // Get model data.
     $this->state = $this->get('State');
     $this->item = $this->get('Item');
     //var_dump($this->item);
     // Construct the breadcrumb
     $this->buildPathway($this->item->itemID);
     //		if ($this->state->secured && !$app->input->post->get('ephrase','','string')) {
     if ($this->item->secured && !$app->input->post->get('ephrase', '', 'string')) {
         return parent::display('ephrase');
     }
     //echo'<xmp>';var_dump($app->input->post->get('ephrase','','string'), $this->item, UserNotesHelper::hashCookieName($this->item->itemID, $this->item->contentID));echo'</xmp>';
     //		if ($this->state->secured) {
     if ($this->item->secured) {
         $cookn = UserNotesHelper::hashCookieName($this->item->itemID, $this->item->contentID);
         $ephrase = $app->input->post->get('ephrase', '', 'string');
         $this->item->serial_content = UserNotesHelper::doCrypt($ephrase, base64_decode($this->item->serial_content), true);
         $cookv = UserNotesHelper::doCrypt($this->item->itemID . '-@:' . $this->item->contentID, $ephrase);
         setcookie($cookn, base64_encode($cookv), 0, '', '', true);
     }
     // Check for errors.
     // @TODO: Maybe this could go into JComponentHelper::raiseErrors($this->get('Errors'))
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     // Get the component parameters
     $cparams = JComponentHelper::getParams('com_usernotes');
     // Get the current menu item
     $this->params = $app->getParams();
     // Meld the params
     if (!$this->params->get('maxUpload')) {
         $this->params->set('maxUpload', $cparams->get('maxUpload', UserNotesHelper::phpMaxUp()));
     }
     // establish the max file upload size
     $this->maxUploadBytes = min($this->params->get('maxUpload'), UserNotesHelper::phpMaxUp());
     // Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
     $this->_prepareDocument();
     return parent::display($tpl);
 }
Пример #3
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     // Get view related request variables.
     // Get model data.
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->item = $this->getModel()->getItem();
     $this->parentID = $this->state->get('parent.id');
     // If at the root, check storage useage and queue a message if near quota
     if (!$this->parentID) {
         $mparams = $app->getParams();
         $storQuota = (int) $mparams->get('storQuota', 0);
         if (!$storQuota) {
             $storQuota = (int) $this->state->cparams->get('storQuota', 0);
         }
         if ($storQuota) {
             $storSize = $this->get('StorSize');
             $posq = $storSize / $storQuota;
             if ($posq > 0.9) {
                 $svty = 'notice';
                 $msg = JText::sprintf('COM_USERNOTES_NOTICE_QUOTA', UserNotesHelper::formatBytes($storSize, 1, ''), $posq * 100);
                 if ($posq > 0.95) {
                     $svty = 'warning';
                     $msg = '<span style="color:red">' . $msg . '</span>';
                 }
                 $app->enqueueMessage($msg, $svty);
             }
         }
     }
     // Create breadcrumbs to this item
     $this->buildPathway($this->parentID);
     // Check for errors.
     // @TODO: Maybe this could go into JComponentHelper::raiseErrors($this->get('Errors'))
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     // Get the component parameters
     $this->cparams = JComponentHelper::getParams('com_usernotes');
     $this->_prepareDocument();
     return parent::display($tpl);
 }
Пример #4
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     // add to the bread crumb
     $app->getPathWay()->addItem('Search', '');
     // Get view related request variables.
     $sterm = $app->input->getString('sterm');
     // Get model data.
     $m = $this->getModel();
     //var_dump($sterm);
     $items = $m->search($sterm);
     //var_dump($items);
     // Check for errors.
     // @TODO: Maybe this could go into JComponentHelper::raiseErrors($this->get('Errors'))
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $this->items = $items;
     $this->_prepareDocument();
     return parent::display($tpl);
 }