Example #1
0
 /**
  * Show form for editing pages
  */
 private function editPage()
 {
     $id = fix_id($_REQUEST['id']);
     $manager = UserPageManager::getInstance();
     $item = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id));
     if (is_object($item)) {
         $template = new TemplateHandler('edit_page.xml', $this->path . 'templates/');
         // add tag handler from user manager
         $user_manager = UserManager::getInstance();
         $template->registerTagHandler('_user_list', $user_manager, 'tag_UserList');
         $params = array('id' => $item->id, 'owner' => $item->owner, 'title' => unfix_chars($item->title), 'content' => $item->content, 'editable' => $item->editable, 'visible' => $item->visible, 'form_action' => backend_UrlMake($this->name, 'save_page'), 'cancel_action' => window_Close('user_pages_edit'));
         $template->restoreXML();
         $template->setLocalParams($params);
         $template->parse();
     }
 }
Example #2
0
 /**
  * Show content of a form in editing state for sepected `code` object
  */
 private function changeCode()
 {
     $id = fix_id(fix_chars($_REQUEST['id']));
     $manager = CodeManager::getInstance();
     $item = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id));
     $template = new TemplateHandler('change.xml', $this->path . 'templates/');
     $template->setMappedModule($this->name);
     $params = array('id' => $item->id, 'code' => unfix_chars($item->code), 'url' => unfix_chars($item->url), 'form_action' => backend_UrlMake($this->name, 'codes_save'), 'cancel_action' => window_Close('codes_change'));
     $template->restoreXML();
     $template->setLocalParams($params);
     $template->parse();
 }
Example #3
0
 /**
  * Change tip form
  */
 private function changeTip()
 {
     $id = fix_id($_REQUEST['id']);
     $manager = TipManager::getInstance();
     $item = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id));
     if (is_object($item)) {
         $template = new TemplateHandler('change.xml', $this->path . 'templates/');
         $template->setMappedModule($this->name);
         $params = array('id' => $item->id, 'content' => unfix_chars($item->content), 'visible' => $item->visible, 'form_action' => backend_UrlMake($this->name, 'tips_save'), 'cancel_action' => window_Close('tips_change'));
         $template->restoreXML();
         $template->setLocalParams($params);
         $template->parse();
     }
 }
Example #4
0
 /**
  * Print form for changing article group data
  */
 private function changeGroup()
 {
     $id = fix_id(fix_chars($_REQUEST['id']));
     $manager = ArticleGroupManager::getInstance();
     $item = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id));
     $template = new TemplateHandler('group_change.xml', $this->path . 'templates/');
     $template->setMappedModule($this->name);
     $params = array('id' => $item->id, 'text_id' => $item->text_id, 'title' => unfix_chars($item->title), 'description' => $item->description, 'form_action' => backend_UrlMake($this->name, 'groups_save'), 'cancel_action' => window_Close('article_groups_change'));
     $template->restoreXML();
     $template->setLocalParams($params);
     $template->parse();
 }
Example #5
0
 /**
  * Print form for changing data
  */
 private function changeData()
 {
     $id = fix_id(fix_chars($_REQUEST['id']));
     $manager = DownloadsManager::getInstance();
     $item = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id));
     $template = new TemplateHandler('change.xml', $this->path . 'templates/');
     $template->setMappedModule($this->name);
     $params = array('id' => $item->id, 'name' => unfix_chars($item->name), 'description' => $item->description, 'filename' => $item->filename, 'visible' => $item->visible, 'form_action' => backend_UrlMake($this->name, 'save'), 'cancel_action' => window_Close('downloads_change'));
     $template->restoreXML();
     $template->setLocalParams($params);
     $template->parse();
 }
Example #6
0
 /**
  * Show content of a form in editing state for sepected `link` object
  */
 private function changeLink()
 {
     $id = fix_id(fix_chars($_REQUEST['id']));
     $manager = LinksManager::getInstance();
     $item = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id));
     $template = new TemplateHandler('links_change.xml', $this->path . 'templates/');
     $template->setMappedModule($this->name);
     $params = array('id' => $item->id, 'text' => unfix_chars($item->text), 'description' => unfix_chars($item->description), 'url' => unfix_chars($item->url), 'external' => $item->external, 'sponsored' => $item->sponsored, 'display_limit' => $item->display_limit, 'sponsored_clicks' => $item->sponsored_clicks, 'form_action' => backend_UrlMake($this->name, 'links_save'), 'cancel_action' => window_Close('links_change'));
     $template->restoreXML();
     $template->setLocalParams($params);
     $template->parse();
 }
Example #7
0
 /**
  * Change room data
  */
 private function changeRoom()
 {
     $id = fix_id($_REQUEST['id']);
     $manager = ChatRoomManager::getInstance();
     $item = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id));
     $template = new TemplateHandler('rooms_change.xml', $this->path . 'templates/');
     $template->setMappedModule($this->name);
     if (is_object($item)) {
         $params = array('id' => $item->id, 'text_id' => $item->text_id, 'name' => unfix_chars($item->name), 'description' => $item->description, 'limit' => $item->limit, 'password' => $item->password, 'form_action' => backend_UrlMake($this->name, 'rooms_save'), 'cancel_action' => window_Close('chat_rooms_change'));
         $template->restoreXML();
         $template->setLocalParams($params);
         $template->parse();
     }
 }
Example #8
0
/**
 * A rollback for fix_chars function. This function should be used to prepare text
 * for editing, when text is entered through web interface. This function replaces
 * <br> with \n and <b> with [b]...
 *
 * @param string $string
 * @return string
 * @author MeanEYE
 */
function unfix_chars($string)
{
    if (!is_array($string)) {
        $string = str_replace("&#42;", "*", $string);
        $string = str_replace("&#34;", chr(34), $string);
        $string = str_replace("&#39;", "'", $string);
        $string = str_replace("&#39;", "'", $string);
        $string = str_replace("&lt;", "<", $string);
        $string = str_replace("&gt;", ">", $string);
    } else {
        foreach ($string as $key => $value) {
            $string[$key] = unfix_chars($value);
        }
    }
    return $string;
}