/**
  * Admin_Action_ShowBlockForm
  * This will show the edition/creation page for content blocks
  *
  */
 public function Admin_Action_ShowBlockForm()
 {
     $ssf = new SendStudio_Functions();
     $action = 'new';
     $GLOBALS['blockid'] = isset($_GET['id']) && $_GET['id'] > 0 ? $_GET['id'] : md5(rand(1, 100000000));
     $GLOBALS['tagid'] = isset($_GET['tagId']) && $_GET['tagId'] > 0 ? $_GET['tagId'] : 0;
     $GLOBALS['blockaction'] = isset($_GET['id']) && $_GET['id'] > 0 ? 'edit' : 'new';
     $GLOBALS['BlockEditor'] = $ssf->GetHTMLEditor('', false, 'blockcontent', 'exact', 260, 630);
     $GLOBALS['CustomDatepickerUI'] = $this->template_system->ParseTemplate('UI.DatePicker.Custom_IEM', true);
     $this->template_system->ParseTemplate('dynamiccontentblocks_form');
 }
Exemple #2
0
 public function Admin_Action_Edit()
 {
     $ssf = new SendStudio_Functions();
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         $id = isset($_POST['share_id']) ? $_POST['share_id'] : 0;
         if ($id == 0) {
             $name = isset($_POST['share_name']) ? $_POST['share_name'] : rand();
             $html = isset($_POST['share_html']) ? $_POST['share_html'] : rand();
             $users = isset($_POST['share_users']) ? $_POST['share_users'] : array();
             $users = is_array($users) ? $users : array();
             $result = $this->db->InsertQuery("share", array('name' => $name, 'html' => $html));
             $lid = $this->db->LastId();
             foreach ($users as $k => $v) {
                 $result = $this->db->UpdateQuery("users", array('share' => $lid), "`userid`=" . $this->db->Quote($v));
             }
             FlashMessage(GetLang("Addon_social_template_added_ok"), SS_FLASH_MSG_SUCCESS, "index.php?Page=Addons&Addon=social&Action=manage");
         } else {
             $name = isset($_POST['share_name']) ? $_POST['share_name'] : rand();
             $html = isset($_POST['share_html']) ? $_POST['share_html'] : '';
             $users = isset($_POST['share_users']) ? $_POST['share_users'] : array();
             $lid = $id;
             $result = $this->db->UpdateQuery("users", array('share' => 0), "`share`=" . $this->db->Quote($lid));
             $users = is_array($users) ? $users : array();
             foreach ($users as $k => $v) {
                 $result = $this->db->UpdateQuery("users", array('share' => $lid), "`userid`=" . $this->db->Quote($v));
             }
             $result = $this->db->UpdateQuery("share", array('name' => $name, 'html' => $html), "`uid`=" . $this->db->Quote($id));
             FlashMessage(GetLang("Addon_social_template_updated_ok"), SS_FLASH_MSG_SUCCESS, "index.php?Page=Addons&Addon=social&Action=manage");
         }
     } else {
         $uid = isset($_GET['id']) ? $_GET['id'] : 0;
         $uid = $this->db->Quote($uid);
         $last = $this->db->Query("SELECT * FROM " . SENDSTUDIO_TABLEPREFIX . "share WHERE uid={$uid} LIMIT 1");
         $share = $this->db->Fetch($last);
         if ($share) {
             $query = "SELECT * FROM " . SENDSTUDIO_TABLEPREFIX . "users";
             $result = $this->db->Query($query);
             $users = array();
             while ($row = $this->db->Fetch($result)) {
                 $users[] = $row;
             }
             $this->template_system->Assign('shares', $r, false);
             $this->template_system->Assign('users', $users, false);
             $this->template_system->assign('name', $share['name']);
             $this->template_system->assign('uid', $share['uid']);
             $this->template_system->assign('html', $ssf->GetHTMLEditor($share['html'], false, 'share', 'exact', 250, "99%"));
             $this->template_system->ParseTemplate('edit');
         } else {
             FlashMessage(GetLang("Addon_social_error_template"), SS_FLASH_MSG_ERROR, "index.php?Page=Addons&Addon=social&Action=manage");
         }
     }
     //FlashMessage(GetLang("Addon_fbl_Not_Exist"),SS_FLASH_MSG_ERROR,"index.php?Page=Addons&Addon=social&Action=manage");
 }