#30556 - Fixed XSS exception while submission of widget edit form.
authorManoj K <manoj.k@zyxware.com>
Mon, 20 Oct 2014 10:33:11 +0000 (16:03 +0530)
committerManoj K <manoj.k@zyxware.com>
Mon, 20 Oct 2014 10:33:11 +0000 (16:03 +0530)
CRM/Wci/BAO/Widget.php
CRM/Wci/Form/CreateWidget.php
templates/CRM/Wci/Form/CreateWidget.tpl

index d1b9cce5eac5cd3b10cfa761166ffee3b16094c8..1d35044a3a12426fecf3a55b1d6cb3e477baf24e 100644 (file)
@@ -152,6 +152,7 @@ class CRM_Wci_BAO_Widget extends CRM_Wci_DAO_Widget {
       $data["color_border"] = $dao->color_border;
       $data["color_button"] = $dao->color_button;
       $data["color_button_bg"] = $dao->color_button_bg;
+      $data['style_rules'] = $dao->style_rules;
       $data["pb_percentage"] = CRM_Wci_BAO_ProgressBar::getProgressbarPercentage($dao->progress_bar_id);
     }
 
index ca7a4481b19a4626c61e87c1fac6eca27d1a81cf..bc114f0757b1a62ced657d8335a0d3a86e263352 100644 (file)
@@ -149,7 +149,7 @@ class CRM_Wci_Form_CreateWidget extends CRM_Core_Form {
         ),
     ));
     
-    $this->add('textarea', 'embd_code', ts('Code to embed:'));
+    // $this->add('textarea', 'embd_code', ts('Code to embed:'));
     
     // export form elements
     $this->assign('elementNames', $this->getRenderableElementNames());
@@ -213,18 +213,18 @@ where w.id=" . $this->_id;
               'custom_template' => $cust_templ));
         }
       }
-      $widget_controller_path = getWciWidgetControllerPath();
-      
-      $emb_code = "<script src=\"http://code.jquery.com/jquery-1.9.1.min.js\"></script>
-<script type=\"text/javascript\" src=\"" . $widget_controller_path . "?widgetId=" . $this->_id . "\"></script>
-<script>
-$( document ).ready(function() {
-$('#widgetwci').html(wciwidgetcode);
-});
-</script>
-<div id='widgetwci'>
-</div>";
-      $this->getElement('embd_code')->setValue($emb_code);
+      // $widget_controller_path = getWciWidgetControllerPath();
+      // 
+      // $emb_code = "<script src=\"http://code.jquery.com/jquery-1.9.1.min.js\"></script>
+// <script type=\"text/javascript\" src=\"" . $widget_controller_path . "?widgetId=" . $this->_id . "\"></script>
+// <script>
+// $( document ).ready(function() {
+// $('#widgetwci').html(wciwidgetcode);
+// });
+// </script>
+// <div id='widgetwci'>
+// </div>";
+      // $this->getElement('embd_code')->setValue($emb_code);
     }
     else {
       /** Keep template in civicrm-wci/templates folder*/
index e4046780fd4b75548d1531a7c69e5a18d4117ffc..52db603f4edac32b265c67937175a9e31d75703e 100644 (file)
       $template->assign('wciform', $data);
       $template->template_dir[] = getWciWidgetTemplatePath();
       $wcidata = $template->fetch('wciwidget.tpl');
+      $widget_controller_path = getWciWidgetControllerPath();
     }
   {/php}
 
+  <div class="crm-section">
+    <div class="label">
+      <label for="embd_code">Code to embed:</label>
+    </div>
+    <div class="content">
+      <div class="resizable-textarea">
+        <span>{literal}
+          <textarea name="embd_code" id="embd_code" class="form-textarea textarea-processed">&lt;script src="http://code.jquery.com/jquery-1.9.1.min.js"&gt;&lt;/script&gt;
+&lt;script type="text/javascript" src="{/literal}{php}echo $widget_controller_path;{/php}{literal}?widgetId={/literal}{php}echo $wid_id;{/php}{literal}"&gt;&lt;/script&gt;
+&lt;script&gt;
+  $( document ).ready(function() {
+    $('#widgetwci').html(wciwidgetcode);
+  });
+&lt;/script&gt;
+&lt;div id='widgetwci'&gt;&lt;/div&gt;</textarea>{/literal}
+          <div class="grippie" style="margin-right: 18px;"></div>
+        </span>
+      </div>
+    </div>
+    <div class="clear"></div>
+  </div>
   <div class="crm-section">
     <div class="content">
     {include file="CRM/Wci/Page/wciwidget.tpl"}