Esempio n. 1
0
 /**
  * @param $post WP_Post
  * @throws ErrorException
  */
 function __construct($post)
 {
     if (gettype($post) != 'object' or get_class($post) != 'WP_Post') {
         td_util::error(__FILE__, 'td_module: ' . get_Class($this) . '($post): $post is not WP_Post');
     }
     //this filter is used by td_unique_posts.php - to add unique posts to the array for the datasource
     apply_filters("td_wp_booster_module_constructor", $this, $post);
     $this->post = $post;
     // by default the WordPress title is not escaped on twenty fifteen
     $this->title = get_the_title($post->ID);
     $this->title_attribute = esc_attr(strip_tags($this->title));
     $this->href = esc_url(get_permalink($post->ID));
     if (has_post_thumbnail($this->post->ID)) {
         $tmp_get_post_thumbnail_id = get_post_thumbnail_id($this->post->ID);
         if (!empty($tmp_get_post_thumbnail_id)) {
             // if we have a wrong id, leave the post_thumb_id NULL
             $this->post_thumb_id = $tmp_get_post_thumbnail_id;
         }
     }
     //get the review metadata
     //$this->td_review = get_post_meta($this->post->ID, 'td_review', true); @todo $this->td_review variable name must be replaced and the 'get_quotes_on_blocks', 'get_category' methods also
     $this->td_review = get_post_meta($this->post->ID, 'td_post_theme_settings', true);
     if (!empty($this->td_review['has_review']) and (!empty($this->td_review['p_review_stars']) or !empty($this->td_review['p_review_percents']) or !empty($this->td_review['p_review_points']))) {
         $this->is_review = true;
     }
 }
 /**
  * Create the user-Proxy according to the given User-Object
  *
  * @return UserInterface
  * @throws \UnexpectedValueException
  */
 public function factory($userObject)
 {
     if ($userObject instanceof \Hybridauth\Entity\Profile) {
         $userProxy = new HybridAuthUserWrapper();
         $userProxy->setUser($userObject);
         return $userProxy;
     }
     throw new \UnexpectedValueException(sprintf('The given Object could not be found. Found "%s" instead', get_Class($userObject)));
 }
 /**
  * Create the user-Proxy according to the given User-Object
  *
  * @return UserInterface
  * @throws \UnexpectedValueException
  */
 public function factory($userObject)
 {
     switch (get_class($userObject)) {
         case 'Hybridauth\\Entity\\Profile':
             $userProxy = new HybridAuthUserWrapper();
             $userProxy->setUser($userObject);
             return $userProxy;
             break;
         default:
             throw new \UnexpectedValueException(sprintf('The given Object could not be found. Found "%s" instead', get_Class($userObject)));
     }
     throw new \UnexpectedValueException('The given Object could not be found');
     return false;
 }
 public function serialise($data)
 {
     if (is_object($data)) {
         $parent = $this->writeParentTag(get_Class($data), $this->dom);
         $this->serialiseObject($parent, $data);
         return $this->dom;
     } else {
         if (is_array($data)) {
             $parent = $this->writeParentTag('array', $this->dom);
             $this->serialiseArray($parent, $data);
             return $this->dom;
         }
     }
     exit("Serialise Requires data to be type object or string");
 }
Esempio n. 5
0
 /**
  * @param $post WP_Post
  * @throws ErrorException
  */
 function __construct($post)
 {
     if (gettype($post) != 'object' or get_class($post) != 'WP_Post') {
         throw new ErrorException('td_module: ' . get_Class($this) . '($post): $post is not WP_Post');
     }
     //this filter is used by td_unique_posts.php - to add unique posts to the array for the datasource
     apply_filters("td_wp_booster_module_constructor", $this, $post);
     $this->post = $post;
     // by default the WordPress title is not escaped on twenty fifteen
     $this->title = get_the_title($post->ID);
     $this->title_attribute = esc_attr(strip_tags($this->title));
     $this->href = esc_url(get_permalink($post->ID));
     if (has_post_thumbnail($this->post->ID)) {
         $this->post_has_thumb = true;
     }
     //get the review metadata
     //$this->td_review = get_post_meta($this->post->ID, 'td_review', true); @todo $this->td_review variable name must be replaced and the 'get_quotes_on_blocks', 'get_category' methods also
     $this->td_review = get_post_meta($this->post->ID, 'td_post_theme_settings', true);
 }
 /**
  * show for PDF the webapplications associated with a device
  *
  * @param $pdf
  * @param $item
  *
  **/
 static function PdfFromItems(PluginPdfSimplePDF $pdf, CommonGLPI $item)
 {
     global $DB, $CFG_GLPI;
     $pdf->setColumnsSize(100);
     $pdf->displayTitle('<b>' . _n('Associated web application', 'Associated web applications', 2, 'webapplications') . '</b>');
     $ID = $item->getField('id');
     $itemtype = get_Class($item);
     $canread = $item->can($ID, READ);
     $canedit = $item->can($ID, UPDATE);
     $web = new PluginWebapplicationsWebapplication();
     $query = "SELECT `glpi_plugin_webapplications_webapplications`.* " . " FROM `glpi_plugin_webapplications_webapplications_items`,`glpi_plugin_webapplications_webapplications` " . " LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id` = `glpi_plugin_webapplications_webapplications`.`entities_id`) " . " WHERE `glpi_plugin_webapplications_webapplications_items`.`items_id` = '" . $ID . "' \n         AND `glpi_plugin_webapplications_webapplications_items`.`itemtype` = '" . $itemtype . "' \n         AND `glpi_plugin_webapplications_webapplications_items`.`plugin_webapplications_webapplications_id` = `glpi_plugin_webapplications_webapplications`.`id` " . getEntitiesRestrictRequest(" AND ", "glpi_plugin_webapplications_webapplications", '', '', $web->maybeRecursive());
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     if (!$number) {
         $pdf->displayLine(__('No item found'));
     } else {
         if (Session::isMultiEntitiesMode()) {
             $pdf->setColumnsSize(25, 25, 15, 15, 20);
             $pdf->displayTitle('<b><i>' . __('Name'), __('Entity'), __('Technician in charge of the hardware'), __('Group in charge of the hardware'), PluginWebapplicationsWebapplicationType::getTypeName(1) . '</i></b>');
         } else {
             $pdf->setColumnsSize(30, 30, 20, 20);
             $pdf->displayTitle('<b><i>' . __('Name'), __('Technician in charge of the hardware'), __('Group in charge of the hardware'), PluginWebapplicationsWebapplicationType::getTypeName(1) . '</i></b>');
         }
         while ($data = $DB->fetch_array($result)) {
             $webapplicationsID = $data["id"];
             if (Session::isMultiEntitiesMode()) {
                 $pdf->setColumnsSize(25, 25, 15, 15, 20);
                 $pdf->displayLine($data["name"], Html::clean(Dropdown::getDropdownName("glpi_entities", $data['entities_id'])), Html::clean(getUsername("glpi_users", $data["users_id_tech"])), Html::clean(Dropdown::getDropdownName("glpi_groups", $data["groups_id_tech"])), Html::clean(Dropdown::getDropdownName("glpi_plugin_webapplications_webapplicationtypes", $data["plugin_webapplications_webapplicationtypes_id"])));
             } else {
                 $pdf->setColumnsSize(50, 25, 25);
                 $pdf->displayLine($data["name"], Html::clean(getUsername("glpi_users", $data["users_id_tech"])), Html::clean(Dropdown::getDropdownName("glpi_groups", $data["groups_id_tech"])), Html::clean(Dropdown::getDropdownName("glpi_plugin_webapplications_webapplicationtypes", $data["plugin_webapplications_webapplicationtypes_id"])));
             }
         }
     }
 }
Esempio n. 7
0
 /** 
  * show for PDF the resources associated with a device
  * 
  * @param $ID of the device
  * @param $itemtype : type of the device
  * 
  */
 static function PdfFromItems($pdf, $item)
 {
     global $DB, $CFG_GLPI;
     $pdf->setColumnsSize(100);
     $pdf->displayTitle('<b>' . __('Associated Human Resource', 'resources') . '</b>');
     $ID = $item->getField('id');
     $itemtype = get_Class($item);
     $canread = $item->can($ID, 'r');
     $canedit = $item->can($ID, 'w');
     $PluginResourcesResource = new PluginResourcesResource();
     $query = "SELECT `glpi_plugin_resources_resources`.* " . " FROM `glpi_plugin_resources_resources_items`,`glpi_plugin_resources_resources` " . " LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id` = `glpi_plugin_resources_resources`.`entities_id`) " . " WHERE `glpi_plugin_resources_resources_items`.`items_id` = '" . $ID . "' \n         AND `glpi_plugin_resources_resources_items`.`itemtype` = '" . $itemtype . "' \n         AND `glpi_plugin_resources_resources_items`.`plugin_resources_resources_id` = `glpi_plugin_resources_resources`.`id` " . getEntitiesRestrictRequest(" AND ", "glpi_plugin_resources_resources", '', '', $PluginResourcesResource->maybeRecursive());
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     if (!$number) {
         $pdf->displayLine(__('No item found'));
     } else {
         if (Session::isMultiEntitiesMode()) {
             $pdf->setColumnsSize(14, 14, 14, 14, 14, 14, 16);
             $pdf->displayTitle('<b><i>' . __('Name'), __('Entity'), __('Location'), PluginResourcesContractType::getTypeName(1), PluginResourcesDepartment::getTypeName(1), __('Arrival date', 'resources'), __('Departure date', 'resources') . '</i></b>');
         } else {
             $pdf->setColumnsSize(17, 17, 17, 17, 17, 17);
             $pdf->displayTitle('<b><i>' . __('Name'), __('Location'), PluginResourcesContractType::getTypeName(1), PluginResourcesDepartment::getTypeName(1), __('Arrival date', 'resources'), __('Departure date', 'resources') . '</i></b>');
         }
         while ($data = $DB->fetch_array($result)) {
             $resourcesID = $data["id"];
             if (Session::isMultiEntitiesMode()) {
                 $pdf->setColumnsSize(14, 14, 14, 14, 14, 14, 16);
                 $pdf->displayLine($data["name"], Html::clean(Dropdown::getDropdownName("glpi_entities", $data['entities_id'])), Html::clean(Dropdown::getDropdownName("glpi_locations", $data["locations_id"])), Html::clean(Dropdown::getDropdownName("glpi_plugin_resources_contracttypes", $data["plugin_resources_contracttypes_id"])), Html::clean(Dropdown::getDropdownName("glpi_plugin_resources_departments", $data["plugin_resources_departments_id"])), Html::convDate($data["date_begin"]), Html::convDate($data["date_end"]));
             } else {
                 $pdf->setColumnsSize(17, 17, 17, 17, 17, 17);
                 $pdf->displayLine($data["name"], Html::clean(Dropdown::getDropdownName("glpi_locations", $data["locations_id"])), Html::clean(Dropdown::getDropdownName("glpi_plugin_resources_contracttypes", $data["plugin_resources_contracttypes_id"])), Html::clean(Dropdown::getDropdownName("glpi_plugin_resources_departments", $data["plugin_resources_departments_id"])), Html::convDate($data["date_begin"]), Html::convDate($data["date_end"]));
             }
         }
     }
 }
 private function getZhuanTiListByType($cmsObjArr)
 {/*{{{*/
     $oldZhuanTiList = ZhuanTiClient::getInstance()->getZhuanTiByDoctorId($cmsObjArr['doctorIds'],50000); 
     $newZhuanTiList = PaperClient::getInstance()->queryPaperListByTag($cmsObjArr['entity']->id,get_Class($cmsObjArr['entity']));
     return CombineZhuanTi::combineZhuanTiList($oldZhuanTiList,$newZhuanTiList);
 }/*}}}*/
 public function __construct()
 {
     parent::__construct();
     $this->table = get_Class($this);
     $this->load->database();
 }
Esempio n. 10
0
 /**
  * show for PDF the applicatif associated with a device
  *
  * @param $pdf
  * @param $item
  **/
 static function pdfForItem(PluginPdfSimplePDF $pdf, CommonGLPI $item)
 {
     global $DB, $CFG_GLPI;
     $ID = $item->getField('id');
     $itemtype = get_Class($item);
     $canread = $item->can($ID, 'r');
     $canedit = $item->can($ID, 'w');
     $pdf->setColumnsSize(100);
     $pdf->displayTitle("<b>" . __('Associated appliances', 'appliances') . "</b>");
     $query = "SELECT `glpi_plugin_appliances_appliances_items`.`id` AS entID,\n                       `glpi_plugin_appliances_appliances`.*\n                FROM `glpi_plugin_appliances_appliances_items`,\n                     `glpi_plugin_appliances_appliances`\n                LEFT JOIN `glpi_entities`\n                     ON (`glpi_entities`.`id` = `glpi_plugin_appliances_appliances`.`entities_id`)\n                WHERE `glpi_plugin_appliances_appliances_items`.`items_id` = '" . $ID;
     "'\n                      AND `glpi_plugin_appliances_appliances_items`.`itemtype` = '";
     $itemtype;
     "'\n                      AND `glpi_plugin_appliances_appliances_items`.`plugin_appliances_appliances_id`\n                           = `glpi_plugin_appliances_appliances`.`id`" . getEntitiesRestrictRequest(" AND", "glpi_plugin_appliances_appliances", 'entities_id', $item->getEntityID(), true);
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     if (!$number) {
         $pdf->displayLine(__('No item found'));
     } else {
         if (Session::isMultiEntitiesMode()) {
             $pdf->setColumnsSize(30, 30, 20, 20);
             $pdf->displayTitle('<b><i>' . __('Name'), __('Entity'), __('Group'), __('Type') . '</i></b>');
         } else {
             $pdf->setColumnsSize(50, 25, 25);
             $pdf->displayTitle('<b><i>' . __('Name'), __('Group'), __('Type') . '</i></b>');
         }
         while ($data = $DB->fetch_array($result)) {
             $appliancesID = $data["id"];
             if (Session::isMultiEntitiesMode()) {
                 $pdf->setColumnsSize(30, 30, 20, 20);
                 $pdf->displayLine($data["name"], Html::clean(Dropdown::getDropdownName("glpi_entities", $data['entities_id'])), Html::clean(Dropdown::getDropdownName("glpi_groups", $data["groups_id"])), Html::clean(Dropdown::getDropdownName("glpi_plugin_appliances_appliancetypes", $data["plugin_appliances_appliancetypes_id"])));
             } else {
                 $pdf->setColumnsSize(50, 25, 25);
                 $pdf->displayLine($data["name"], Html::clean(Dropdown::getDropdownName("glpi_groups", $data["groups_id"])), Html::clean(Dropdown::getDropdownName("glpi_plugin_appliances_appliancetypes", $data["plugin_appliances_appliancetypes_id"])));
             }
             PluginAppliancesRelation::showList_PDF($pdf, $data["relationtype"], $data["entID"]);
             PluginAppliancesOptvalue_Item::showList_PDF($pdf, $ID, $appliancesID);
         }
     }
     $pdf->displaySpace();
 }
Esempio n. 11
0
 static function preItemUpdate(CommonDBTM $item)
 {
     //find container (if not exist, do nothing)
     if (isset($_REQUEST['c_id'])) {
         $c_id = $_REQUEST['c_id'];
     } else {
         $c_id = self::findContainer(get_Class($item), $item->fields['id'], "dom");
         if ($c_id === false) {
             return false;
         }
     }
     //find fields associated to found container
     $field_obj = new PluginFieldsField();
     $fields = $field_obj->find("plugin_fields_containers_id = {$c_id} AND type != 'header'", "ranking");
     //prepare datas to update
     $datas = array('plugin_fields_containers_id' => $c_id, 'items_id' => $item->fields['id']);
     foreach ($fields as $field) {
         if (isset($item->input[$field['name']])) {
             //standard field
             $input = $field['name'];
         } else {
             //dropdown field
             $input = "plugin_fields_" . $field['name'] . "dropdowns_id";
         }
         if (isset($item->input[$input])) {
             $datas[$input] = $item->input[$input];
         }
     }
     //update datas
     $container = new self();
     if ($container->updateFieldsValues($datas)) {
         return true;
     }
     return $item->input = array();
 }
Esempio n. 12
0
	private function DrawColTitles() {
		// Método encargado de dibujar los títulos de las columnas..

		$this->code.= '<tr>';
		$i = 0;
		foreach ($this->columns as $col) {
			
			$idHeader = '';
			
			if( get_Class($this->columns[$i]) ==  'ColumnDos' ){ 										
				$idHeader = " id='".$this->columns[$i]->GetIDdivHeader()."' ";										
			}					
				
			if ($col->getVisible()) {		// Si la columna está visible..
				$colStyle = 'style="';
				if (($this->colsSeparator) and ($i < (count($this->columns) - 1)))
					$colStyle.= 'border-right: 1px solid '.$this->colsSeparatorColor.';';

				$width = "";
				if ($this->columns[$i]->getWidth() > 0)
					$width = ' width="'.$this->columns[$i]->getWidth().'"';

				$colStyle.= '"';
				$showMessage = ($this->showProcessMessage)?"true":"false";

				if ($this->orderBy == $i) {
					$img = '';
					if (!strpos($this->orderBy, "_D_")) {
						if ($i > 0)
							$img = '<img border="0" src="/images/grid_asc.gif" title="Ascendente" />';
						$url = $this->BuildUrl(1, $i."_D_");
					}
					else {
						if ($i > 0)
							$img = '<img border="0" src="/images/grid_desc.gif" title="Descendente" />';
						$url = $this->BuildUrl(1, $i);
					}
				}
				else {
					$img = '';
					$url = $this->BuildUrl(1, $i);
				}

				if (($this->columns[$i]->getUseStyleForTitle()) and ($this->columns[$i]->getCellClass() != ""))
					$class = $this->columns[$i]->getCellClass();
				else
					$class = $this->headerStyle;

				$title = "";
				if ($this->columns[$i]->getTitleHint() != "")
					$title = 'title="'.$this->columns[$i]->getTitleHint().'"';
				
				if($this->AsignEventColumn){
					$this->code.= '<td class="'.$class.'" '.$colStyle.$width.'>';
					$this->code.= '<table width="100%" border="0" cellpadding="0" cellspacing="0">';
					$this->code.= '<tr>';
					$this->code.= '<td width="28"></td>';			
					$this->code.= '<td align="center" '.$title.' '.$idHeader.' ><a class="'.$this->titleStyle.'" href="#" onClick="changePage(\''.$url.'\', '.$showMessage.', '.(($this->refreshIntoWindow)?'true':'false').')">'.$col->getTitle().'</a></td>';
					$this->code.= '<td align="right" width="28">'.$img.'</td>';
					$this->code.= '</tr>';
					$this->code.= '</table>';
					$this->code.= '</td>';
				}else{				
					//Esto le quita la animacion a las columnas
					$this->code.= '<td class="'.$class.'" '.$colStyle.$width.'  '.$title.'  '.$idHeader.'  >';
					$this->code.= '<font class='.$this->titleStyle.' >'.$col->getTitle()."</font>";
					$this->code.= '</td>';					
				}				
			}
			$i++;
		}
		$this->code.= '</tr>';
	}
Esempio n. 13
0
 static function showAssociated($item, $withtemplate = '')
 {
     global $DB, $CFG_GLPI;
     $display_entity = Session::isMultiEntitiesMode();
     $numcols = 5;
     if ($display_entity) {
         $numcols++;
     }
     $ID = $item->getField('id');
     $itemtype = get_Class($item);
     $entity = $item->getEntityID();
     $showgroup = true;
     if (!class_exists($itemtype)) {
         $datatable = "";
         $form = "";
     } else {
         $objeto = new $itemtype();
         $datatable = $objeto->getTable();
         $form = Toolbox::getItemTypeFormURL($itemtype);
     }
     if ($showgroup) {
         $moreselect = ", g.name AS grp";
         $morejoin = " LEFT JOIN glpi_groups AS g ON d.groups_id = g.id";
     } else {
         $numcols--;
         $moreselect = "";
         $morejoin = "";
     }
     if ($withtemplate != 2) {
         //echo "<form method='post' action=\"".$CFG_GLPI["root_doc"]."/plugins/relation/front/relation.form.php\">";
         echo "<form method='post' name='relation_form' id='add_relation_form'  action=" . PluginRelationRelation::getFormURL(true) . ">";
     }
     echo "<div align='center'><table class='tab_cadre_fixe'>";
     // Children
     $query4 = "SELECT `name` FROM `{$datatable}` WHERE `id` = '{$ID}'";
     $result4 = $DB->query($query4);
     $thisdata = $DB->fetch_array($result4);
     echo "<tr><th colspan='" . $numcols . "'>" . __('Elementos relacionados', 'Elementos relacionados') . "</th></tr>";
     // CRI 26/11/2015 Cambio de orden de columna tipo de relacion
     echo "<tr>";
     if ($showgroup) {
         echo "<th>" . __('Tipo Relacion', 'Tipo Relacion') . "</th>";
     }
     echo "<th>" . __('Nombre', 'Nombre') . "</th>";
     echo "<th>" . __('Estado', 'Estado') . "</th>";
     // CRI 2.0 Añadir Estado del CI 11/12/2014
     if ($display_entity) {
         echo "<th>" . __('Entidad', 'Entidad') . "</th>";
     }
     echo "<th>" . __('Tipo', 'Tipo') . "</th>";
     if (Session::haveRight("plugin_relation", CREATE)) {
         echo "<th>&nbsp;</th>";
     }
     echo "</tr>";
     //imprimo las relaciones directas
     $queryAssociated = "select r.id, r.items_id, r.itemtype, tr.name from glpi_plugin_relation_relations r left join glpi_plugin_relation_typerelations tr on r.relation_type=tr.id  where r.parent_id=";
     $queryAssociated .= $ID . " and r.parent_type='" . $itemtype . "'order by 4,3,2";
     $resultAssociated = $DB->query($queryAssociated);
     if ($DB->numrows($resultAssociated)) {
         while ($data = $DB->fetch_array($resultAssociated)) {
             //print_r($data);
             //echo "<br>";
             $nombreClase = $data['itemtype'];
             $form = Toolbox::getItemTypeFormURL($nombreClase);
             $objAsociado = new $nombreClase();
             $objAsociado->getFromDB($data['items_id']);
             echo '<tr class="tab_bg_1">';
             // CRI 2.0 Cambio de orden de columna tipo de relacion
             if ($showgroup) {
                 echo '<td align="center">' . $data['name'] . '</td>';
             }
             if ($data['itemtype'] == "User") {
                 $user = getUserName($data['items_id'], 2);
                 echo '<td align="center"><a href="' . $form . '?id=' . $data['items_id'] . '">' . getUserName($data['items_id']) . ' (' . $objAsociado->fields['name'] . ")&nbsp;" . Html::showToolTip($user["comment"], array('link' => $user["link"], 'display' => false));
                 //getUserName($data['items_id'])
                 echo '</a></td>';
             } else {
                 echo '<td align="center"><a href="' . $form . '?id=' . $data['items_id'] . '">' . $objAsociado->fields['name'];
                 if ($_SESSION["glpiis_ids_visible"]) {
                     echo " (" . $data["items_id"] . ")";
                 }
                 echo '</a></td>';
             }
             echo '<td align="center">' . PluginRelationRelation::getStatusItem($data['itemtype'], $data['items_id']) . '</td>';
             //CRI 2.0 Añadir Estado del CI 11/12/2014
             if ($display_entity) {
                 if ($objAsociado->fields['entities_id'] == 0) {
                     echo "<td align='center'>" . __('Entidad Raiz', 'Entidad Raiz') . "</td>";
                 } else {
                     echo "<td align='center'>" . Dropdown::getDropdownName("glpi_entities", $objAsociado->fields['entities_id']) . "</td>";
                 }
                 //echo "<td align='center'>".$objAsociado->fields['entities_id']."</td>";
             }
             echo '<td align="center">' . PluginRelationRelation::getViewNameClass($data['itemtype']) . '</td>';
             // Gobierno TI: [olb26s] uso de funcion getViewNameClass
             if (Session::haveRight('plugin_relation', CREATE)) {
                 if ($withtemplate < 2) {
                     echo "<td align='center' class='tab_bg_2'><a href='" . $CFG_GLPI["root_doc"] . "/plugins/relation/front/relation.form.php?deleterelation=deleterelation&amp;id=" . $data['id'] . "'>" . __('Eliminar', 'Eliminar') . "</a></td>";
                 }
             }
             echo '</tr>';
         }
     }
     //imprimo las relaciones inversas
     $queryAssociated = "select r.id, r.parent_id, r.parent_type, tr.invname from glpi_plugin_relation_relations r left join glpi_plugin_relation_typerelations tr on r.relation_type=tr.id  where r.items_id=";
     $queryAssociated .= $ID . " and itemtype='" . $itemtype . "' order by 4,3,2";
     $resultAssociated = $DB->query($queryAssociated);
     if ($DB->numrows($resultAssociated) > 0) {
         while ($data = $DB->fetch_array($resultAssociated)) {
             $nombreClase = $data['parent_type'];
             $form = Toolbox::getItemTypeFormURL($nombreClase);
             $objAsociado = new $nombreClase();
             $objAsociado->getFromDB($data['parent_id']);
             echo '<tr class="tab_bg_1">';
             // CRI 2.0 26/11/2015 Cambio de orden de columna tipo de relacion
             if ($showgroup) {
                 echo '<td align="center">' . $data['invname'] . '</td>';
             }
             if ($data['parent_type'] == "User") {
                 $user = getUserName($data['parent_id'], 2);
                 echo '<td align="center"><a href="' . $form . '?id=' . $data['parent_id'] . '">' . getUserName($data['parent_id']) . ' (' . $objAsociado->fields['name'] . ")&nbsp;" . Html::showToolTip($user["comment"], array('link' => $user["link"], 'display' => false));
                 echo '</a></td>';
             } else {
                 echo '<td align="center"><a href="' . $form . '?id=' . $data['parent_id'] . '">' . $objAsociado->fields['name'];
                 if ($_SESSION["glpiis_ids_visible"]) {
                     echo " (" . $data["parent_id"] . ")";
                 }
                 echo '</a></td>';
             }
             echo '<td align="center">' . PluginRelationRelation::getStatusItem($data['parent_type'], $data['parent_id']) . '</td>';
             //CRI 2.0 Añadir Estado del CI 11/12/2014
             if ($display_entity) {
                 if ($objAsociado->fields['entities_id'] == 0) {
                     echo "<td align='center'>" . __('Entidad Raiz', 'Entidad Raiz') . "</td>";
                 } else {
                     echo "<td align='center'>" . Dropdown::getDropdownName("glpi_entities", $objAsociado->fields['entities_id']) . "</td>";
                 }
             }
             echo '<td align="center">' . PluginRelationRelation::getViewNameClass($data['parent_type']) . '</td>';
             // Gobierno TI: [olb26s] uso de funcion getViewNameClass
             if (Session::haveRight('plugin_relation', CREATE)) {
                 if ($withtemplate < 2) {
                     echo "<td align='center' class='tab_bg_2'><a href='" . $CFG_GLPI["root_doc"] . "/plugins/relation/front/relation.form.php?deleterelation=deleterelation&amp;id=" . $data['id'] . "'>" . __('Eliminar', 'Eliminar') . "</a></td>";
                 }
             }
             echo '</tr>';
         }
     }
     if (Session::haveRight('plugin_relation', CREATE)) {
         echo '<tr class="tab_bg_1">';
         echo '<td align="center" colspan="' . ($numcols - 1) . '">';
         echo '<input type="hidden" name="id" value="' . $ID . '">';
         echo '<input type="hidden" name="type" value="' . $itemtype . '">';
         PluginRelationRelation::dropdown(array('name' => "childID", 'itemtype' => $itemtype, 'entity' => $entity));
         echo '</td>';
         echo '<td align="center"><input class="submit" type="submit" value="' . _sx('button', 'Add') . '" name="additem"/></td>';
         echo '</tr>';
     }
     if (!empty($withtemplate)) {
         echo "<input type='hidden' name='is_template' value='1'>";
     }
     echo "</table></div>";
     //echo "</form>";
     Html::closeForm();
     // Imprimir Grafico
     if (PluginRelationRelation::command_exists('dot') == true) {
         echo "<br><table class='tab_cadre' cellpadding='2'>";
         echo "<tr><th>" . __('Grafico de la Relacion', 'Grafico de la Relacion') . "</th></tr>";
         echo "<tr class='tab_bg_1'><td>";
         $im = PluginRelationPrototype::relationGraphviz($ID, $itemtype);
         //echo '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJMAAAFYCAYAAABXvc7WAAAABmJLR0QA/wD/AP+gvaeTAAAgAElEQVR4nO2deXxU1fn/P3eZLZlkkkAWAiQhhEXcEBAURaggbq3SiiIERGyLdvnWbv6k1X6/drOb/db6besGLrVgbRCUzRAUQaCyK2JZZE+AJGxZZ73L8/vjZIYEJgkh986dGc6b133NcJdzn8l85jnnnuV5BCIicDjdZ6totQWc5IGLiWMYXEwcw5CtNqANmzYBlZVWW5E4jBoFFBRYbUWE+BLTc88BCxZYbUXiMH8+MG2a1VZEiL9qbto0gIhvnW1xSPyJiZOwcDFxDIOLiWMY8dUANxGv14f6hgboRNA0DbqmIzu7B9LcbqtNSxqSXkyapqH2xElU15xAQ1MTGpuacfpMHbxeH/r07oVRI4aid69e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8GGimTPZryY/n+hXv2JtLM7Fs20b0QMPsB9qbi7Rn/5E5PfH3IzYiylMVRXRnDlEPXqwX9I3v5n4k+9iiaoSLVxIdNNN7EHn6quJXn2VKBCwzCTrxBTG6yV68UU2wAgQjRhB9Mc/XvRgY9KzcSNrLuTmEoki0aRJRB9+aLVVRNSdgV6jIWLDMgsWsF70ujr2FFJaCnztayzB9KXKnj3Am2+yv83+/cCVV7L8b9OmAS2xPeKBzlenWIGisOyLCxYA777LAraOHg3cdhubbzN0aHKvlPH5gDVrWNdKeTkTUGEhMHUqE9CVV1ptYVTiU0yt8XqBtWvb/mGzs4GJE5nnGjWKZWtM5CkwTU2sR3rjxrMD56p69gc0cSJbHRLnMcniX0znsn8/E1V5ObB+PQvW6XazYYKRI5m4hg5lgTfiUWBeL7B3L7BlC1uTtnkzm22haWzV7M03MwFNmGB+hnaDSTwxtYaIfTHhL2XTJmDHDlZN2u2s13fQIGDgwLNbfj6Qm9t+XEYjOHmSbZWVzL69e1nS7C++YBPRAJZ7ZOTIs9uoUczjJjCJLaZoBALAf/7DvrjwF7lvH/t/6wl8qalMVLm5bEJYdjYbrA6HrM7IYNWK2832e72s7RYMsjaNprF42IEAE87x42dFpChn79OrV1tBDxrE5g8VF8d9tdVVkk9MHVFdzb70mhr2pdfUALW1Z0UQDLK8xERAfT27prGRCcflYtNabTYmMEFggnM4mBjz8pgws7OZgHJy2JNWWpq1nzmGXFpi4pjKxc8B53DOhYuJYxhcTBzD4GLiGMb/B/UgWMdoanJHAAAAAElFTkSuQmCC"/>';
         //echo $im;
         echo "<div id=target></div>";
         echo "<div align='center'>";
         echo "<a onclick='view_relation_graphviz.dialog(\"open\");' href='#view_relation_graphviz' title='" . __('Relacion') . "'>" . __('Ver relacion', 'relation') . "</a>";
         echo "</div>";
         Ajax::createModalWindow('view_relation_graphviz', $CFG_GLPI["root_doc"] . "/plugins/relation/front/relation.test.php?item_id=" . $ID . "&item_type=" . $itemtype, array('title' => __('Ver Relaciones', 'relation')));
         //echo '<img src="data:image/gif;base64,'.base64_encode($im).'"/>';
         //echo $CFG_GLPI["root_doc"].'/plugins/relation/front/relation.test.php?item_id='.$ID.'&item_type='.$itemtype;
         //echo "<img src='".$CFG_GLPI["root_doc"]."/plugins/relation/front/relation.test.php?item_id=$ID&item_type=$itemtype' alt=''>";
         //echo file_get_contents($CFG_GLPI["root_doc"]."/plugins/relation/front/relation.test.php?item_id=".$ID."&item_type=".$itemtype);
         echo "</td></tr>";
         echo "</table>";
         Html::scriptStart();
         echo "\$(document).ready(function(){\n\t\t\t\t\$('#target').load('" . $CFG_GLPI["root_doc"] . "/plugins/relation/front/relation.test.php?item_id=" . $ID . "&item_type=" . $itemtype . "');\n\t\t\t\t});";
         echo Html::scriptEnd();
     }
 }
Esempio n. 14
0
 public function getResponseFile()
 {
     throw new KurogoDataException("getResponseFile() does not yet work with " . get_Class($this));
 }
Esempio n. 15
0
 public function toValidator($command)
 {
     return str_replace('Command', 'Validator', get_Class($command));
 }
Esempio n. 16
0
 public function __construct()
 {
     $this->log = new logBase(get_Class($this));
 }
    /**
        * @brief 获取问卷展示的信息,同时展示等待状态下健康记录的答案(即未提交的健康记录)
        * @author zjj 
        *
        * @param $questionSheet 问卷
        * @param $patient 患者 
        *
        * @return $questionSheetInfos 问卷展示信息
     */
    private function getQuestionSheetDisplayInfos(QuestionSheet $questionSheet, Patient $patient)
    {/*{{{*/
        $answerContents = PatientFileClient::getInstance()->getAnswerContentsOfWaitRecord4Patient($patient->id);
        $allQuestionInfos = $questionSheet->getWrapperQuestionArr();

        $questionSheetInfos = array();
        $unDisplyWrapperIds = DAL::get()->queryUnDisplayWrapperIdsByPatientId('QuestionWrapper', $patient->id);
        foreach ($allQuestionInfos as $questionInfo)
        {
            $wrapper = $questionInfo['wrapper'];
            //过滤不在展示日期内的问题包
            if (in_array($wrapper->id, $unDisplyWrapperIds))
            {
                continue;
            }

            $questionSheetInfo['wrapperName'] = $wrapper->name;
            if (count($questionInfo['questions']) > 1)
            {
                $questionSheetInfo['type'] = get_Class($wrapper);
                $questionSheetInfo['value'] = $this->getQuestionDisplayInfos($questionInfo['questions'], $answerContents);
            }
            else
            {
                $questionSheetInfo['type'] = get_Class($questionInfo['questions'][0]);
                $questionInfos = $this->getQuestionDisplayInfos($questionInfo['questions'], $answerContents);
                $questionSheetInfo['value'] = array_shift($questionInfos);
            }
            $questionSheetInfos[] = $questionSheetInfo;
        }

        return $questionSheetInfos;
    }/*}}}*/
Esempio n. 18
0
 /** 
  * show for PDF the projet associated with a device
  * 
  * @param $ID of the device
  * @param $itemtype : type of the device
  * 
  */
 static function PdfFromItems($pdf, $item)
 {
     global $DB, $CFG_GLPI;
     $pdf->setColumnsSize(100);
     $pdf->displayTitle('<b>' . _n('Associated project', 'Associated projects', 2, 'projet') . '</b>');
     $ID = $item->getField('id');
     $itemtype = get_Class($item);
     $canread = $item->can($ID, 'r');
     $canedit = $item->can($ID, 'w');
     $PluginProjetProjet = new PluginProjetProjet();
     $query = "SELECT `glpi_plugin_projet_projets`.* " . " FROM `glpi_plugin_projet_projets_items`,`glpi_plugin_projet_projets` " . " LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id` = `glpi_plugin_projet_projets`.`entities_id`) " . " WHERE `glpi_plugin_projet_projets_items`.`items_id` = '" . $ID . "' \n         AND `glpi_plugin_projet_projets_items`.`itemtype` = '" . $itemtype . "' \n         AND `glpi_plugin_projet_projets_items`.`plugin_projet_projets_id` = `glpi_plugin_projet_projets`.`id` " . getEntitiesRestrictRequest(" AND ", "glpi_plugin_projet_projets", '', '', $PluginProjetProjet->maybeRecursive());
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     if (!$number) {
         $pdf->displayLine(__('No item found'));
     } else {
         if (Session::isMultiEntitiesMode()) {
             $pdf->setColumnsSize(14, 14, 14, 14, 14, 14, 16);
             $pdf->displayTitle('<b><i>' . __('Name'), __('Entity'), __('Comments'), __('Description'), __('Progress'), __('Start date'), __('End date') . '</i></b>');
         } else {
             $pdf->setColumnsSize(17, 17, 17, 17, 17, 17);
             $pdf->displayTitle('<b><i>' . __('Name'), __('Comments'), __('Description'), __('Progress'), __('Start date'), __('End date') . '</i></b>');
         }
         while ($data = $DB->fetch_array($result)) {
             if (Session::isMultiEntitiesMode()) {
                 $pdf->setColumnsSize(14, 14, 14, 14, 14, 14, 16);
                 $pdf->displayLine($data["name"], Html::clean(Dropdown::getDropdownName("glpi_entities", $data['entities_id'])), $data["comment"], $data["description"], PluginProjetProjet::displayProgressBar('100', $data["advance"], array("simple" => true)), Html::convdate($data["date_begin"]), Html::convdate($data["date_end"]));
             } else {
                 $pdf->setColumnsSize(17, 17, 17, 17, 17, 17);
                 $pdf->displayLine($data["name"], $data["comment"], $data["description"], PluginProjetProjet::displayProgressBar('100', $data["advance"], array("simple" => true)), Html::convdate($data["date_begin"]), Html::convdate($data["date_end"]));
             }
         }
     }
 }
Esempio n. 19
0
 /**
  * Submits a new query to the database.
  * @param string $formstring name of the form to use
  * @param array $formParams
  * @return array $response
  */
 public function submit($formstring, array $formParams = array())
 {
     // get the formclass
     $formConfig = Daiquiri_Config::getInstance()->query->forms->{$formstring};
     if ($formConfig === null || get_Class($formConfig) !== 'Zend_Config') {
         throw new Exception('form options not found');
     } else {
         $formOptions = $formConfig->toArray();
         $formOptions['name'] = $formstring;
     }
     // get queues
     $resource = Query_Model_Resource_AbstractQuery::factory();
     $queues = array();
     $defaultQueue = false;
     if ($resource::$hasQueues === true) {
         try {
             $queues = $resource->fetchQueues();
             $defaultQueue = $resource->fetchDefaultQueue();
         } catch (Exception $e) {
             return array('status' => 'error');
         }
         $usrGrp = Daiquiri_Auth::getInstance()->getCurrentRole();
         foreach ($queues as $key => $value) {
             // show only the guest queue for the guest user:
             if ($value['name'] !== "guest" && $usrGrp === "guest") {
                 unset($queues[$key]);
             }
             // remove the guest queue if this is a non guest user
             if ($value['name'] === "guest" && $usrGrp !== "guest") {
                 unset($queues[$key]);
             }
         }
     }
     // get the form
     $form = new $formConfig->class(array('formOptions' => $formOptions, 'queues' => $queues, 'defaultQueue' => $defaultQueue));
     // init errors array
     $errors = array();
     // validate form
     if (!empty($formParams)) {
         if ($form->isValid($formParams)) {
             // form is valid, get sql string from functions
             $sql = $form->getQuery();
             $tablename = $form->getTablename();
             $queueId = $form->getQueue();
             //clean from default flag
             $queueId = str_replace("_def", "", $queueId);
             if (empty($tablename)) {
                 $tablename = null;
             }
             $options = array();
             if (!empty($queueId)) {
                 $options['queue'] = $queues[$queueId]['name'];
             }
             // validate query
             $model = new Query_Model_Query();
             if ($model->validate($sql, false, $tablename, $errors) !== true) {
                 // set description for form
                 $form->setDescription(implode('; ', $errors));
                 // construct response array
                 return array('form' => $form, 'formOptions' => $formOptions, 'status' => 'error', 'errors' => array('form' => $errors));
             }
             // take a detour to the query plan
             if ($model->canShowPlan()) {
                 // store query, tablename and queue in session
                 Zend_Session::namespaceUnset('query_plan');
                 $ns = new Zend_Session_Namespace('query_plan');
                 $ns->sql = $sql;
                 $ns->tablename = $tablename;
                 if (isset($options['queue'])) {
                     $ns->queue = $options['queue'];
                 } else {
                     $ns->queue = null;
                 }
                 $ns->plan = $model->plan($sql, $errors);
                 if (!empty($errors)) {
                     return $this->getModelHelper('CRUD')->validationErrorResponse($form, $errors);
                 }
                 // construct response with redirect to plan
                 $baseurl = Daiquiri_Config::getInstance()->getSiteUrl();
                 return array('status' => 'plan', 'redirect' => $baseurl . '/query/form/plan?form=' . $formstring);
             } else {
                 // submit query
                 $response = $model->query($sql, false, $tablename, $options);
                 if ($response['status'] === 'ok') {
                     // submitting the query was successful
                     return $response;
                 } else {
                     // set description for form
                     $form->setDescription(implode('; ', $response['errors']));
                     // construct response array
                     return array('form' => $form, 'formOptions' => $formOptions, 'status' => 'error', 'errors' => array('form' => $response['errors']));
                 }
             }
         } else {
             return array('form' => $form, 'formOptions' => $formOptions, 'status' => 'error', 'errors' => $form->getMessages());
         }
     }
     return array('form' => $form, 'formOptions' => $formOptions, 'status' => 'form');
 }
Esempio n. 20
0
 /**
  *	Standard method to show a box (usage by boxes not mandatory, a box can still use its own function)
  *
  *	@param	array	$head       Array with properties of box title
  *	@param  array	$contents   Array with properties of box lines
  *	@return	void
  */
 function showBox($head, $contents)
 {
     global $langs, $conf;
     $MAXLENGTHBOX = 60;
     // Mettre 0 pour pas de limite
     $bcx[0] = 'class="box_pair"';
     $bcx[1] = 'class="box_impair"';
     $var = false;
     dol_syslog(get_Class($this));
     // Define nbcol and nblines of the box to show
     $nbcol = 0;
     if (isset($contents[0])) {
         $nbcol = count($contents[0]);
     }
     $nblines = count($contents);
     print "\n\n<!-- Box start -->\n";
     print '<div class="box" id="boxto_' . $this->box_id . '">' . "\n";
     if (!empty($head['text']) || !empty($head['sublink']) || $nblines) {
         print '<table summary="boxtable' . $this->box_id . '" width="100%" class="noborder boxtable">' . "\n";
     }
     // Show box title
     if (!empty($head['text']) || !empty($head['sublink'])) {
         //print '<div id="boxto_'.$this->box_id.'_title">'."\n";
         //print '<table summary="boxtabletitle'.$this->box_id.'" width="100%" class="noborder">'."\n";
         print '<tr class="box_titre">';
         print '<td';
         if ($nbcol > 0) {
             print ' colspan="' . $nbcol . '"';
         }
         print '>';
         if ($conf->use_javascript_ajax) {
             print '<table summary="" class="nobordernopadding" width="100%"><tr><td>';
         }
         if (!empty($head['text'])) {
             $s = dol_trunc($head['text'], isset($head['limit']) ? $head['limit'] : $MAXLENGTHBOX);
             print $s;
         }
         if (!empty($head['sublink'])) {
             print ' <a href="' . $head['sublink'] . '" target="_blank">' . img_picto($head['subtext'], $head['subpicto']) . '</a>';
         }
         if ($conf->use_javascript_ajax) {
             print '</td><td class="nocellnopadd" width="30" nowrap="nowrap">';
             // The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object
             print img_picto($langs->trans("MoveBox", $this->box_id), 'grip', 'class="boxhandle" style="cursor:move;"');
             print img_picto($langs->trans("Close", $this->box_id), 'close', 'class="boxclose" style="cursor:pointer;" id="imgclose' . $this->box_id . '"');
             print '</td></tr></table>';
         }
         print '</td>';
         print "</tr>\n";
         //			print "</table>\n";
         //			print "</div>\n";
     }
     // Show box lines
     if ($nblines) {
         //print '<table summary="boxtablelines'.$this->box_id.'" width="100%" class="noborder">'."\n";
         // Loop on each record
         for ($i = 0, $n = $nblines; $i < $n; $i++) {
             if (isset($contents[$i])) {
                 $var = !$var;
                 // TR
                 if (isset($contents[$i][0]['tr'])) {
                     print '<tr valign="top" ' . $contents[$i][0]['tr'] . '>';
                 } else {
                     print '<tr valign="top" ' . $bcx[$var] . '>';
                 }
                 // Loop on each TD
                 $nbcolthisline = count($contents[$i]);
                 for ($j = 0; $j < $nbcolthisline; $j++) {
                     // Define tdparam
                     $tdparam = '';
                     if (isset($contents[$i][$j]['td'])) {
                         $tdparam .= ' ' . $contents[$i][$j]['td'];
                     }
                     if (empty($contents[$i][$j]['text'])) {
                         $contents[$i][$j]['text'] = "";
                     }
                     $texte = isset($contents[$i][$j]['text']) ? $contents[$i][$j]['text'] : '';
                     $textewithnotags = preg_replace('/<([^>]+)>/i', '', $texte);
                     $texte2 = isset($contents[$i][$j]['text2']) ? $contents[$i][$j]['text2'] : '';
                     $texte2withnotags = preg_replace('/<([^>]+)>/i', '', $texte2);
                     //print "xxx $textewithnotags y";
                     print '<td' . $tdparam . '>';
                     // Url
                     if (!empty($contents[$i][$j]['url'])) {
                         print '<a href="' . $contents[$i][$j]['url'] . '" title="' . $textewithnotags . '"';
                         //print ' alt="'.$textewithnotags.'"';      // Pas de alt sur un "<a href>"
                         print isset($contents[$i][$j]['target']) ? ' target="' . $contents[$i][$j]['target'] . '"' : '';
                         print '>';
                     }
                     // Logo
                     if (!empty($contents[$i][$j]['logo'])) {
                         $logo = preg_replace("/^object_/i", "", $contents[$i][$j]['logo']);
                         print img_object($langs->trans("Show"), $logo);
                     }
                     $maxlength = $MAXLENGTHBOX;
                     if (!empty($contents[$i][$j]['maxlength'])) {
                         $maxlength = $contents[$i][$j]['maxlength'];
                     }
                     if ($maxlength) {
                         $textewithnotags = dol_trunc($textewithnotags, $maxlength);
                     }
                     if (preg_match('/^<img/i', $texte) || !empty($contents[$i][$j]['asis'])) {
                         print $texte;
                     } else {
                         print $textewithnotags;
                     }
                     // show text with html cleaning
                     // End Url
                     if (!empty($contents[$i][$j]['url'])) {
                         print '</a>';
                     }
                     if (preg_match('/^<img/i', $texte2) || !empty($contents[$i][$j]['asis2'])) {
                         print $texte2;
                     } else {
                         print $texte2withnotags;
                     }
                     // show text with html cleaning
                     print "</td>";
                 }
                 print "</tr>\n";
             }
         }
     }
     if (!empty($head['text']) || !empty($head['sublink']) || $nblines) {
         print "</table>\n";
     }
     // If invisible box with no contents
     if (empty($head['text']) && empty($head['sublink']) && !$nblines) {
         print "<br>\n";
     }
     print "</div>\n";
     print "<!-- Box end -->\n\n";
 }
 /**
  * replace Markups
  **/
 private function replaceMarkups(DOMElement $itemDom)
 {
     $string = "";
     $explicitHtmlBr = false;
     foreach ($itemDom->childNodes as $element) {
         if (get_Class($element) == "DOMText") {
             //seems that encoding is lost when using the DOM ???
             $string .= htmlspecialchars($element->wholeText);
         }
         if (get_Class($element) == "DOMElement") {
             switch ($element->tagName) {
                 case "toggleRead":
                     $class = '';
                     if ($itemDom->tagName == 'question') {
                         $class = 'dontread';
                     } else {
                         $class = 'read';
                     }
                     // This code retrieve what is in the <toggleRead> tag but
                     // add a trailing carriage return (I don't know why) so
                     // I remove it.
                     $nodeValue = $element->nodeValue;
                     $string .= "<html:span class=\"" . $class . "\">" . $nodeValue . "</html:span>";
                     break;
                 case "html:br":
                     $explicitHtmlBr = true;
                     $string .= "<html:br/>";
                     break;
                 default:
                     if ($element->getAttribute("html:class") == "") {
                         $class = $element->getAttribute("class");
                     } else {
                         $class = $element->getAttribute("html:class");
                     }
                     $string .= "<" . $element->tagName . " class=\"" . $class . "\">" . $element->nodeValue . "</" . $element->tagName . ">";
                     //echo "<big>";echo $string;echo "</big>";
                     break;
             }
         }
     }
     //$string = str_replace("<toggleRead>","<html:span class=\"read\">",$string);
     //$string = str_replace("</toggleRead>","</html:span>",$string);
     //remove any starting or ending starting line
     $string = trim($string);
     if (!$explicitHtmlBr) {
         $string = $string;
         //echo $string;
         $string = str_replace("\n", '<html:br/>', $string);
     }
     return $string;
 }
Esempio n. 22
0
 /**
  * Path Parser
  *
  * Extract a path from a URI and actually connect to an SSH server if appropriate
  *
  * If "notification" is set as a context parameter the message code for successful login is
  * NET_SSH2_MSG_USERAUTH_SUCCESS. For a failed login it's NET_SSH2_MSG_USERAUTH_FAILURE.
  *
  * @param String $path
  * @return String
  * @access private
  */
 function _parse_path($path)
 {
     extract(parse_url($path) + array('port' => 22));
     if (!isset($host)) {
         return false;
     }
     if (isset($this->context)) {
         $context = stream_context_get_params($this->context);
         if (isset($context['notification'])) {
             $this->notification = $context['notification'];
         }
     }
     if ($host[0] == '$') {
         $host = substr($host, 1);
         global ${$host};
         if (!is_object(${$host}) || get_class(${$host}) != 'Net_SFTP') {
             return false;
         }
         $this->sftp = ${$host};
     } else {
         if (isset($this->context)) {
             $context = stream_context_get_options($this->context);
         }
         if (isset($context[$scheme]['session'])) {
             $sftp = $context[$scheme]['session'];
         }
         if (isset($context[$scheme]['sftp'])) {
             $sftp = $context[$scheme]['sftp'];
         }
         if (isset($sftp) && is_object($sftp) && get_class($sftp) == 'Net_SFTP') {
             $this->sftp = $sftp;
             return $path;
         }
         if (isset($context[$scheme]['username'])) {
             $user = $context[$scheme]['username'];
         }
         if (isset($context[$scheme]['password'])) {
             $pass = $context[$scheme]['password'];
         }
         if (isset($context[$scheme]['privkey']) && is_object($context[$scheme]['privkey']) && get_Class($context[$scheme]['privkey']) == 'Crypt_RSA') {
             $pass = $context[$scheme]['privkey'];
         }
         if (!isset($user) || !isset($pass)) {
             return false;
         }
         // casting $pass to a string is necessary in the event that it's a Crypt_RSA object
         if (isset(self::$instances[$host][$port][$user][(string) $pass])) {
             $this->sftp = self::$instances[$host][$port][$user][(string) $pass];
         } else {
             $this->sftp = new Net_SFTP($host, $port);
             $this->sftp->disableStatCache();
             if (isset($this->notification) && is_callable($this->notification)) {
                 /* if !is_callable($this->notification) we could do this:
                 
                                        user_error('fopen(): failed to call user notifier', E_USER_WARNING);
                 
                                        the ftp wrapper gives errors like that when the notifier isn't callable.
                                        i've opted not to do that, however, since the ftp wrapper gives the line
                                        on which the fopen occurred as the line number - not the line that the
                                        user_error is on.
                                     */
                 call_user_func($this->notification, STREAM_NOTIFY_CONNECT, STREAM_NOTIFY_SEVERITY_INFO, '', 0, 0, 0);
                 call_user_func($this->notification, STREAM_NOTIFY_AUTH_REQUIRED, STREAM_NOTIFY_SEVERITY_INFO, '', 0, 0, 0);
                 if (!$this->sftp->login($user, $pass)) {
                     call_user_func($this->notification, STREAM_NOTIFY_AUTH_RESULT, STREAM_NOTIFY_SEVERITY_ERR, 'Login Failure', NET_SSH2_MSG_USERAUTH_FAILURE, 0, 0);
                     return false;
                 }
                 call_user_func($this->notification, STREAM_NOTIFY_AUTH_RESULT, STREAM_NOTIFY_SEVERITY_INFO, 'Login Success', NET_SSH2_MSG_USERAUTH_SUCCESS, 0, 0);
             } else {
                 if (!$this->sftp->login($user, $pass)) {
                     return false;
                 }
             }
             self::$instances[$host][$port][$user][(string) $pass] = $this->sftp;
         }
     }
     return $path;
 }
Esempio n. 23
0
 /**
  * Pre item hook for add and update
  * Validates and store plugin data in item object
  *
  * @param CommonDBTM $item Item instance
  *
  * @return boolean
  */
 static function preItem(CommonDBTM $item)
 {
     //find container (if not exist, do nothing)
     if (isset($_REQUEST['c_id'])) {
         $c_id = $_REQUEST['c_id'];
     } else {
         $c_id = self::findContainer(get_Class($item), "dom");
         if ($c_id === false) {
             $c_id = self::findContainer(get_Class($item));
             //tries for 'tab'
             if ($c_id === false) {
                 return false;
             }
         }
     }
     //need to check if container is usable on this object entity
     $loc_c = new PluginFieldsContainer();
     $loc_c->getFromDB($c_id);
     $entities = array($loc_c->fields['entities_id']);
     if ($loc_c->fields['is_recursive']) {
         $entities = getSonsOf(getTableForItemType('Entity'), $loc_c->fields['entities_id']);
     }
     //workaround: when a ticket is created from readdonly profile,
     //it is not initialized; see https://github.com/glpi-project/glpi/issues/1438
     if (!isset($item->fields) || count($item->fields) == 0) {
         $item->fields = $item->input;
     }
     if (!in_array($item->fields['entities_id'], $entities)) {
         return false;
     }
     $data = self::populateData($c_id, $item);
     if ($data !== false) {
         if (self::validateValues($data, $item::getType(), isset($_REQUEST['massiveaction'])) === false) {
             return $item->input = [];
         }
         return $item->plugin_fields_data = $data;
     }
     return $item->input = [];
 }