Public function PesquisaCentroCustoEmpresa($pesquisa, $Cod) {

	$option = "";
	$CentroaAlteracao = false;
	$String = new CString();
	$ObjModel = new ModellancaCrBd();
	$resultado = parent::ListaCentroCusto(trim($pesquisa));
	if ($Cod)
	    $CentroaAlteracao = $ObjModel->RecuperaCampo("CENTRO_CUSTO_ID", "F_LANCA_CR", "F_LANCA_CR_ID", $String->descriptografa($Cod));


	if ($resultado) {
	    foreach ($resultado as $ListaCentro){
		$select = "";
		if ($CentroaAlteracao == $ListaCentro->getIdCentroCusto()) {
		    $select = ' selected="selected" ';
		}

		$option .= '<option' . $select . ' value="' . $ListaCentro->getIdCentroCusto() . '">' . $ListaCentro->getNomeCentroCusto() . '</option>';
	    }
	    $Retorno = '<label class="col-sm-2 control-label" for="combobox">Centro Custo *</label>
			<div class="col-sm-3">
			    <select  name="centro_custo" id="centro_custo"  class="form-control input-sm" required="required">
				<option value=""></option>' .
		    $option . '
		    </select>
			</div>
		    </div>';
	    echo $Retorno;
	    exit();
	} else {
	    echo 0;
	    exit();
	}
    }
Example #2
0
    Public function PesquisaClienteGrupo($pesquisa) {
	$String = new CString();
	
	$resultado = parent::ListaEmpresaGrupos($String->convertem($pesquisa, 1));

	echo json_encode($resultado);

    }
Example #3
0
 /**
  * Inject data from paramter to content tags ({}) .
  *
  * @param	$content	Original content with content tags.
  * @param	$params	Text contain all values need to be replaced.
  * @param	$html	Auto detect url tag and insert inline.
  * @return	$text	The content after replacing.
  **/
 public static function injectTags($content, $paramsTxt, $html = false)
 {
     $params = new CParameter($paramsTxt);
     preg_match_all("/{(.*?)}/", $content, $matches, PREG_SET_ORDER);
     if (!empty($matches)) {
         foreach ($matches as $val) {
             $replaceWith = JString::trim($params->get($val[1], null));
             if (!is_null($replaceWith)) {
                 //if the replacement start with 'index.php', we can CRoute it
                 if (JString::strpos($replaceWith, 'index.php') === 0) {
                     $replaceWith = CRoute::getExternalURL($replaceWith);
                 }
                 if ($html) {
                     $replaceUrl = $params->get($val[1] . '_url', null);
                     if (!is_null($replaceUrl)) {
                         if ($val[1] == 'stream') {
                             $replaceUrl .= '#activity-stream-container';
                         }
                         //if the replacement start with 'index.php', we can CRoute it
                         if (JString::strpos($replaceUrl, 'index.php') === 0) {
                             $replaceUrl = CRoute::getExternalURL($replaceUrl);
                         }
                         $replaceWith = '<a href="' . $replaceUrl . '">' . $replaceWith . '</a>';
                     }
                 }
                 $content = CString::str_ireplace($val[0], $replaceWith, $content);
             }
         }
     }
     return $content;
 }
Example #4
0
 public function setImage($path, $type = 'thumb')
 {
     CError::assert($path, '', '!empty', __FILE__, __LINE__);
     $db = $this->getDBO();
     // Fix the back quotes
     $path = CString::str_ireplace('\\', '/', $path);
     $type = JString::strtolower($type);
     // Test if the record exists.
     $oldFile = $this->{$type};
     if ($db->getErrorNum()) {
         JError::raiseError(500, $db->stderr());
     }
     if ($oldFile) {
         // File exists, try to remove old files first.
         $oldFile = CString::str_ireplace('/', '/', $oldFile);
         // If old file is default_thumb or default, we should not remove it.
         //
         // Need proper way to test it
         if (!JString::stristr($oldFile, 'group.jpg') && !JString::stristr($oldFile, 'group_thumb.jpg') && !JString::stristr($oldFile, 'default.jpg') && !JString::stristr($oldFile, 'default_thumb.jpg')) {
             jimport('joomla.filesystem.file');
             JFile::delete($oldFile);
         }
     }
     $this->{$type} = $path;
     $this->store();
 }
Example #5
0
 function onActivityContentDisplay($args)
 {
     $model =& CFactory::getModel('Wall');
     $wall =& JTable::getInstance('Wall', 'CTable');
     $my = CFactory::getUser();
     if (empty($args->content)) {
         return '';
     }
     $wall->load($args->cid);
     CFactory::load('libraries', 'privacy');
     CFactory::load('libraries', 'comment');
     $comment = CComment::stripCommentData($wall->comment);
     $config = CFactory::getConfig();
     $commentcut = false;
     if (strlen($comment) > $config->getInt('streamcontentlength')) {
         $origcomment = $comment;
         $comment = JString::substr($comment, 0, $config->getInt('streamcontentlength')) . ' ...';
         $commentcut = true;
     }
     if (CPrivacy::isAccessAllowed($my->id, $args->target, 'user', 'privacyProfileView')) {
         CFactory::load('helpers', 'videos');
         CFactory::load('libraries', 'videos');
         CFactory::load('libraries', 'wall');
         $videoContent = '';
         $params = new CParameter($args->params);
         $videoLink = $params->get('videolink');
         $image = $params->get('url');
         // For older activities that does not have videoLink , we need to process it the old way.
         if (!$videoLink) {
             $html = CWallLibrary::_processWallContent($comment);
             $tmpl = new CTemplate();
             $html = CStringHelper::escape($html);
             if ($commentcut) {
                 //add read more/less link for content
                 $html .= '<br /><br /><a href="javascript:void(0)" onclick="jQuery(\'#shortcomment_' . $args->cid . '\').hide(); jQuery(\'#origcomment_' . $args->cid . '\').show();" >' . JText::_('COM_COMMUNITY_READ_MORE') . '</a>';
                 $html = '<div id="shortcomment_' . $args->cid . '">' . $html . '</div>';
                 $html .= '<div id="origcomment_' . $args->cid . '" style="display:none;">' . $origcomment . '<br /><br /><a href="javascript:void(0);" onclick="jQuery(\'#shortcomment_' . $args->cid . '\').show(); jQuery(\'#origcomment_' . $args->cid . '\').hide();" >' . JText::_('COM_COMMUNITY_READ_LESS') . '</a></div>';
             }
             $tmpl->set('comment', $html);
             $html = $tmpl->fetch('activity.wall.post');
         } else {
             $html = '<ul class ="cDetailList clrfix">';
             $html .= '<li>';
             $image = !$image ? rtrim(JURI::root(), '/') . '/components/com_community/assets/playvideo.gif' : $image;
             $videoLib = new CVideoLibrary();
             $provider = $videoLib->getProvider($videoLink);
             $html .= '<!-- avatar --><div class="avatarWrap"><a href="javascript:void(0);" onclick="joms.activities.showVideo(\'' . $args->id . '\');"><img width="64" src="' . $image . '" class="cAvatar"/></a></div><!-- avatar -->';
             $videoPlayer = $provider->getViewHTML($provider->getId(), '300', '300');
             $comment = CString::str_ireplace($videoLink, '', $comment);
             $html .= '<!-- details --><div class="detailWrap alpha">' . $comment . '</div><!-- details -->';
             if (!empty($videoPlayer)) {
                 $html .= '<div style="display: none;clear: both;padding-top: 5px;" class="video-object">' . $videoPlayer . '</div>';
             }
             $html .= '</li>';
             $html .= '</ul>';
         }
         return $html;
     }
 }
Example #6
0
 /**
  * Retrieve menu items in JomSocial's toolbar
  * 
  * @access	public
  * @param
  * 
  * @return	Array	An array of #__menu objects.
  **/
 public function getItems()
 {
     $config = CFactory::getConfig();
     $db = JFactory::getDBO();
     $menus = array();
     // For menu access
     $my = CFactory::getUser();
     //joomla 1.6
     $menutitlecol = !C_JOOMLA_15 ? 'title' : 'name';
     $query = 'SELECT a.' . $db->nameQuote('id') . ', a.' . $db->nameQuote('link') . ', a.' . $menutitlecol . ' as name, a.' . $db->nameQuote(TABLE_MENU_PARENTID) . ', false as script ' . ' FROM ' . $db->nameQuote('#__menu') . ' AS a ' . ' LEFT JOIN ' . $db->nameQuote('#__menu') . ' AS b ' . ' ON b.' . $db->nameQuote('id') . '=a.' . $db->nameQuote(TABLE_MENU_PARENTID) . ' AND b.' . $db->nameQuote('published') . '=' . $db->Quote(1) . ' ' . ' WHERE a.' . $db->nameQuote('published') . '=' . $db->Quote(1) . ' ' . ' AND a.' . $db->nameQuote('menutype') . '=' . $db->Quote($config->get('toolbar_menutype'));
     if ($my->id == 0) {
         $query .= ' AND a.' . $db->nameQuote('access') . '=' . $db->Quote(0);
     }
     CFactory::load('helpers', 'owner');
     if ($my->id > 0 && !COwnerHelper::isCommunityAdmin()) {
         //			$query	.= ' AND a.' . $db->nameQuote( 'access' ) . '>=' . $db->Quote( 0 ) . ' AND a.' . $db->nameQuote( 'access' ) . '<' . $db->Quote( 2 );
         //we haven't supported access level setting for toolbar menu yet.
         $query .= ' AND a.' . $db->nameQuote('access') . '>=' . $db->Quote(0);
     }
     if (COwnerHelper::isCommunityAdmin()) {
         $query .= ' AND a.' . $db->nameQuote('access') . '>=' . $db->Quote(0);
     }
     $ordering_field = TABLE_MENU_ORDERING_FIELD;
     $query .= ' ORDER BY a.' . $db->nameQuote($ordering_field);
     $db->setQuery($query);
     $result = $db->loadObjectList();
     // remove disabled apps base on &view=value in result's link
     $this->cleanMenus($result);
     //avoid multiple count execution
     $parentColumn = TABLE_MENU_PARENTID;
     $menus = array();
     foreach ($result as $i => $row) {
         //get top main links on toolbar
         //add Itemid if not our components and dont add item id for external link
         $row->link = CString::str_ireplace('https://', 'http://', $row->link);
         if (strpos($row->link, 'com_community') == false && strpos($row->link, 'http://') === false) {
             $row->link .= "&Itemid=" . $row->id;
         }
         if ($row->{$parentColumn} == MENU_PARENT_ID) {
             $obj = new stdClass();
             $obj->item = $row;
             $obj->item->script = false;
             $obj->childs = null;
             $menus[$row->id] = $obj;
         }
     }
     // Retrieve child menus from the original result.
     // Since we reduce the number of sql queries, we need to use php to split the menu's out
     // accordingly.
     foreach ($result as $i => $row) {
         if ($row->{$parentColumn} != MENU_PARENT_ID && isset($menus[$row->{$parentColumn}])) {
             if (!is_array($menus[$row->{$parentColumn}]->childs)) {
                 $menus[$row->{$parentColumn}]->childs = array();
             }
             $menus[$row->{$parentColumn}]->childs[] = $row;
         }
     }
     return $menus;
 }
Example #7
0
 /**
  * Displays the viewing profile page.
  * 	 	
  * @access	public
  * @param	array  An associative array to display the fields
  */
 public function profile(&$data)
 {
     $mainframe = JFactory::getApplication();
     $friendsModel = CFactory::getModel('friends');
     $showfriends = JRequest::getVar('showfriends', false);
     $userid = JRequest::getVar('userid', '');
     $user = CFactory::getUser($userid);
     $linkUrl = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id);
     $document = JFactory::getDocument();
     $document->setTitle(JText::sprintf('COM_COMMUNITY_USERS_FEED_TITLE', $user->getDisplayName()));
     $document->setDescription(JText::sprintf('COM_COMMUNITY_USERS_FEED_DESCRIPTION', $user->getDisplayName(), $user->lastvisitDate));
     $document->setLink($linkUrl);
     include_once JPATH_COMPONENT . '/libraries/activities.php';
     $act = new CActivityStream();
     $friendIds = $friendsModel->getFriendIds($user->id);
     $friendIds = $showfriends ? $friendIds : null;
     $rows = $act->getFEED($user->id, $friendIds, null, $mainframe->getCfg('feed_limit'));
     // add the avatar image
     $rssImage = new JFeedImage();
     $rssImage->url = $user->getThumbAvatar();
     $rssImage->link = $linkUrl;
     $rssImage->width = 64;
     $rssImage->height = 64;
     $document->image = $rssImage;
     //CFactory::load( 'helpers' , 'string' );
     //CFactory::load( 'helpers' , 'time' );
     foreach ($rows->data as $row) {
         if ($row->type != 'title') {
             // Get activities link
             $pattern = '/<a href=\\"(.*?)\\"/';
             preg_match_all($pattern, $row->title, $matches);
             // Use activity owner link when activity link is not available
             if (!empty($matches[1][1])) {
                 $linkUrl = $matches[1][1];
             } else {
                 if (!empty($matches[1][0])) {
                     $linkUrl = $matches[1][0];
                 }
             }
             // load individual item creator class
             $item = new JFeedItem();
             $item->title = $row->title;
             $item->link = $linkUrl;
             $item->description = "<img src=\"{$row->favicon}\" alt=\"\" />&nbsp;" . $row->title;
             $item->date = CTimeHelper::getDate($row->createdDateRaw)->toRFC822();
             $item->category = '';
             //$row->category;
             $item->description = CString::str_ireplace('_QQQ_', '"', $item->description);
             // Make sure url is absolute
             $pattern = '/href="(.*?)index.php/';
             $replace = 'href="' . JURI::base() . 'index.php';
             $string = $item->description;
             $item->description = preg_replace($pattern, $replace, $string);
             // loads item info into rss array
             $document->addItem($item);
         }
     }
 }
Example #8
0
 /**
  * Add sharing sites into bookmarks
  * @params	string	$providerName	Pass the provider name to be displayed
  * @params	string	$imageURL	 	 Image that needs to be displayed beside the provider
  * @params	string	$apiURL			Api URL that JomSocial should link to
  **/
 public function add($providerName, $className, $apiURL)
 {
     $apiURL = CString::str_ireplace('{uri}', $this->currentURI, $apiURL);
     $obj = new stdClass();
     $obj->name = $providerName;
     $obj->className = $className;
     $obj->link = $apiURL;
     $this->_bookmarks[JString::strtolower($providerName)] = $obj;
 }
Example #9
0
 /**
  * The default method that will display the output of this view which is called by
  * Joomla
  *
  * @param	string template	Template file name
  **/
 public function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $params = $this->get('Params');
     //user's email privacy setting
     //CFactory::load( 'libraries' , 'notificationtypes' );
     $notificationTypes = new CNotificationTypes();
     $lists = array();
     for ($i = 1; $i <= 31; $i++) {
         $qscale[] = JHTML::_('select.option', $i, $i);
     }
     $lists['qscale'] = JHTML::_('select.genericlist', $qscale, 'qscale', 'class="inputbox" size="1"', 'value', 'text', $params->get('qscale', '11'));
     $videosSize = array(JHTML::_('select.option', '320x240', '320x240 (QVGA 4:3)'), JHTML::_('select.option', '400x240', '400x240 (WQVGA 5:3)'), JHTML::_('select.option', '400x300', '400x300 (Quarter SVGA 4:3)'), JHTML::_('select.option', '480x272', '480x272 (Sony PSP 30:17)'), JHTML::_('select.option', '480x320', '480x320 (iPhone 3:2)'), JHTML::_('select.option', '480x360', '480x360 (4:3)'), JHTML::_('select.option', '512x384', '512x384 (4:3)'), JHTML::_('select.option', '600x480', '600x480 (4:3)'), JHTML::_('select.option', '640x360', '640x360 (16:9)'), JHTML::_('select.option', '640x480', '640x480 (VCA 4:3)'), JHTML::_('select.option', '800x600', '800x600 (SVGA 4:3)'));
     $lists['videosSize'] = JHTML::_('select.genericlist', $videosSize, 'videosSize', 'class="inputbox" size="1"', 'value', 'text', $params->get('videosSize'));
     $imgQuality = array(JHTML::_('select.option', '60', 'Low'), JHTML::_('select.option', '80', 'Medium'), JHTML::_('select.option', '90', 'High'), JHTML::_('select.option', '95', 'Very High'));
     $lists['imgQuality'] = JHTML::_('select.genericlist', $imgQuality, 'output_image_quality', 'class="inputbox" size="1"', 'value', 'text', $params->get('output_image_quality'));
     //album mode
     $albumMode = array(JHTML::_('select.option', '0', JText::_('COM_COMMUNITY_SAME_WINDOW')), JHTML::_('select.option', '1', JText::_('COM_COMMUNITY_MODAL_WINDOW')));
     $lists['albumMode'] = JHTML::_('select.genericlist', $albumMode, 'album_mode', 'class="inputbox" size="1"', 'value', 'text', $params->get('album_mode'));
     //video mode
     $videoMode = array(JHTML::_('select.option', '0', JText::_('COM_COMMUNITY_SAME_WINDOW')), JHTML::_('select.option', '1', JText::_('COM_COMMUNITY_MODAL_WINDOW')));
     $lists['videoMode'] = JHTML::_('select.genericlist', $videoMode, 'video_mode', 'class="inputbox" size="1"', 'value', 'text', $params->get('video_mode'));
     //video native
     $videoNative = array(JHTML::_('select.option', '0', JText::_('COM_COMMUNITY_STREAM_VIDEO_PLAYER_MEDIAELEMENT')), JHTML::_('select.option', '1', JText::_('COM_COMMUNITY_STREAM_VIDEO_PLAYER_NATIVE')));
     $lists['videoNative'] = JHTML::_('select.genericlist', $videoNative, 'video_native', 'class="inputbox" size="1"', 'value', 'text', $params->get('video_native'));
     // Group discussion order option
     $groupDiscussionOrder = array(JHTML::_('select.option', 'ASC', 'Older first'), JHTML::_('select.option', 'DESC', 'Newer first'));
     $lists['groupDicussOrder'] = JHTML::_('select.genericlist', $groupDiscussionOrder, 'group_discuss_order', 'class="inputbox" size="1"', 'value', 'text', $params->get('group_discuss_order'));
     $videoThumbSize = array(JHTML::_('select.option', '320x180', '320x180'), JHTML::_('select.option', '640x360', '640x360'), JHTML::_('select.option', '1280x720', '1280x720'));
     $lists['videoThumbSize'] = JHTML::_('select.genericlist', $videoThumbSize, 'videosThumbSize', 'class="inputbox" size="1"', 'value', 'text', $params->get('videosThumbSize'));
     $dstOffset = array();
     $counter = -4;
     for ($i = 0; $i <= 8; $i++) {
         $dstOffset[] = JHTML::_('select.option', $counter, $counter);
         $counter++;
     }
     $watermarkPosition = array(JHTML::_('select.option', 'left_top', JText::_('COM_COMMUNITY_CONFIGURATION_PHOTOS_WATERMARK_POSITION_LFFT_TOP')), JHTML::_('select.option', 'left_bottom', JText::_('COM_COMMUNITY_CONFIGURATION_PHOTOS_WATERMARK_POSITION_LFFT_BOTTOM')), JHTML::_('select.option', 'right_top', JText::_('COM_COMMUNITY_CONFIGURATION_PHOTOS_WATERMARK_POSITION_RIGHT_TOP')), JHTML::_('select.option', 'right_bottom', JText::_('COM_COMMUNITY_CONFIGURATION_PHOTOS_WATERMARK_POSITION_RIGHT_BOTTOM')));
     $lists['watermarkPosition'] = JHTML::_('select.genericlist', $watermarkPosition, 'watermark_position', 'class="inputbox" size="1"', 'value', 'text', $params->get('watermark_position'));
     $lists['dstOffset'] = JHTML::_('select.genericlist', $dstOffset, 'daylightsavingoffset', 'class="inputbox" size="1"', 'value', 'text', $params->get('daylightsavingoffset'));
     $networkModel = $this->getModel('network', false);
     $JSNInfo = $networkModel->getJSNInfo();
     $JSON_output = $networkModel->getJSON();
     $lists['enable'] = JHTML::_('select.booleanlist', 'network_enable', 'class="inputbox"', $JSNInfo['network_enable']);
     $uploadLimit = ini_get('upload_max_filesize');
     $uploadLimit = CString::str_ireplace('M', ' MB', $uploadLimit);
     require_once JPATH_ROOT . '/administrator/components/com_community/libraries/autoupdate.php';
     $isuptodate = CAutoUpdate::checkUpdate();
     $this->assign('JSNInfo', $JSNInfo);
     $this->assign('JSON_output', $JSON_output);
     $this->assign('lists', $lists);
     $this->assign('uploadLimit', $uploadLimit);
     $this->assign('config', $params);
     $this->assign('isuptodate', $isuptodate);
     $this->assign('notificationTypes', $notificationTypes);
     parent::display($tpl);
 }
    Public function PesquisaClienteGrupo($pesquisa)
    {
        $String = new CString();
        //recebo o paametro vindo do form
        $parametro = isset($_POST['pesquisaClienteCategoria']) ? $_POST['pesquisaClienteCategoria'] : null;
        $msg = "";
        //começo a concatenar a tabela
        $msg .= "<table class='table table-hover tablePesquisaClienteGrupo' id='tabela' border='1'>";
        $msg .= "	<thead>";
        $msg .= "		<tr >";
        $msg .= "			<th>Cód</th>";
        $msg .= "			<th>Tipo</th>";
        $msg .= "			<th class='EmpresaGrupo' ><a href='#'>Nome</a></th>";
        $msg .= "		</tr>";
        $msg .= "	</thead>";
        $msg .= "	<tbody>";
        $resultado = parent::ListaEmpresaGrupos($String->convertem($pesquisa, 1));

        //resgata os dados na tabela
        if ($resultado) {
            foreach ($resultado as $res) {
                $msg .= "<tr tabindex='0'>";
                $msg .= "<td class='cod'>" . $res->getCodFontePagadora() . "</td>";
                $msg .= "<td class='tipo'>" . $res->getTipoFontePagadora() . "</td>";
                $msg .= "<td class='EmpresaGrupo'><a href='#'>" . $res->getFontePagadora() . "</a></td>";
                $msg .= "</tr>";
            }
        } else {
            $msg = "";
            $msg .= "Nenhum resultado foi encontrado...";
            ?>
            <script>
                $("#pesquisaClienteCategoria").val('');
            </script>
        <?php

        }
        $msg .= "	</tbody>";
        $msg .= "</table>";
        //retorna a msg concatenada
        echo $msg;
    }
Example #11
0
 public function friends($data = null)
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $document = JFactory::getDocument();
     $id = JRequest::getCmd('userid', 0);
     $sorted = $jinput->get->get('sort', 'latest', 'STRING');
     //JRequest::getVar( 'sort' , 'latest' , 'GET' );
     $filter = JRequest::getWord('filter', 'all', 'GET');
     $isMine = $id == $my->id && $my->id != 0;
     $my = CFactory::getUser();
     $id = $id == 0 ? $my->id : $id;
     $user = CFactory::getUser($id);
     $friends = CFactory::getModel('friends');
     $blockModel = CFactory::getModel('block');
     $document->setLink(CRoute::_('index.php?option=com_community'));
     $rows = $friends->getFriends($id, $sorted, true, $filter);
     // Hide submenu if we are viewing other's friends
     if ($isMine) {
         $document->setTitle(JText::_('COM_COMMUNITY_FRIENDS_MY_FRIENDS'));
     } else {
         $document->setTitle(JText::sprintf('COM_COMMUNITY_FRIENDS_ALL_FRIENDS', $user->getDisplayName()));
     }
     $sortItems = array('latest' => JText::_('COM_COMMUNITY_SORT_RECENT_FRIENDS'), 'online' => JText::_('COM_COMMUNITY_ONLINE'));
     $resultRows = array();
     // @todo: preload all friends
     foreach ($rows as $row) {
         $user = CFactory::getUser($row->id);
         $obj = clone $row;
         $obj->friendsCount = $user->getFriendCount();
         $obj->profileLink = CUrlHelper::userLink($row->id);
         $obj->isFriend = true;
         $obj->isBlocked = $blockModel->getBlockStatus($user->id, $my->id);
         $resultRows[] = $obj;
     }
     unset($rows);
     foreach ($resultRows as $row) {
         if (!$row->isBlocked) {
             // load individual item creator class
             $item = new JFeedItem();
             $item->title = strip_tags($row->name);
             $item->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $row->id);
             $item->description = '<img src="' . JURI::base() . $row->_thumb . '" alt="" />&nbsp;' . $row->_status;
             $item->date = $row->lastvisitDate;
             $item->category = '';
             //$row->category;
             $item->description = CString::str_ireplace('_QQQ_', '"', $item->description);
             // Make sure url is absolute
             $item->description = CString::str_ireplace('href="/', 'href="' . JURI::base(), $item->description);
             // loads item info into rss array
             $document->addItem($item);
         }
     }
 }
Example #12
0
 /**
  * The default method that will display the output of this view which is called by
  * Joomla
  * 
  * @param	string template	Template file name
  **/
 public function display($tpl = null)
 {
     //Load pane behavior
     jimport('joomla.html.pane');
     $pane =& JPane::getInstance('sliders');
     $document =& JFactory::getDocument();
     // Load tooltips
     JHTML::_('behavior.tooltip', '.hasTip');
     $params = $this->get('Params');
     //user's email privacy setting
     CFactory::load('libraries', 'emailtypes');
     $emailtypes = new CEmailTypes();
     // Add submenu
     $contents = '';
     ob_start();
     require_once JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_community' . DS . 'views' . DS . 'configuration' . DS . 'tmpl' . DS . 'navigation.php';
     $contents = ob_get_contents();
     ob_end_clean();
     $document =& JFactory::getDocument();
     $document->setBuffer($contents, 'modules', 'submenu');
     $lists = array();
     for ($i = 1; $i <= 31; $i++) {
         $qscale[] = JHTML::_('select.option', $i, $i);
     }
     $lists['qscale'] = JHTML::_('select.genericlist', $qscale, 'qscale', 'class="inputbox" size="1"', 'value', 'text', $params->get('qscale', '11'));
     $videosSize = array(JHTML::_('select.option', '320x240', '320x240 (QVGA 4:3)'), JHTML::_('select.option', '400x240', '400x240 (WQVGA 5:3)'), JHTML::_('select.option', '400x300', '400x300 (Quarter SVGA 4:3)'), JHTML::_('select.option', '480x272', '480x272 (Sony PSP 30:17)'), JHTML::_('select.option', '480x320', '480x320 (iPhone 3:2)'), JHTML::_('select.option', '480x360', '480x360 (4:3)'), JHTML::_('select.option', '512x384', '512x384 (4:3)'), JHTML::_('select.option', '600x480', '600x480 (4:3)'), JHTML::_('select.option', '640x360', '640x360 (16:9)'), JHTML::_('select.option', '640x480', '640x480 (VCA 4:3)'), JHTML::_('select.option', '800x600', '800x600 (SVGA 4:3)'));
     $lists['videosSize'] = JHTML::_('select.genericlist', $videosSize, 'videosSize', 'class="inputbox" size="1"', 'value', 'text', $params->get('videosSize'));
     $imgQuality = array(JHTML::_('select.option', '60', 'Low'), JHTML::_('select.option', '80', 'Medium'), JHTML::_('select.option', '90', 'High'), JHTML::_('select.option', '95', 'Very High'));
     $lists['imgQuality'] = JHTML::_('select.genericlist', $imgQuality, 'output_image_quality', 'class="inputbox" size="1"', 'value', 'text', $params->get('output_image_quality'));
     // Group discussion order option
     $groupDiscussionOrder = array(JHTML::_('select.option', 'ASC', 'Older first'), JHTML::_('select.option', 'DESC', 'Newer first'));
     $lists['groupDicussOrder'] = JHTML::_('select.genericlist', $groupDiscussionOrder, 'group_discuss_order', 'class="inputbox" size="1"', 'value', 'text', $params->get('group_discuss_order'));
     $dstOffset = array();
     $counter = -4;
     for ($i = 0; $i <= 8; $i++) {
         $dstOffset[] = JHTML::_('select.option', $counter, $counter);
         $counter++;
     }
     $lists['dstOffset'] = JHTML::_('select.genericlist', $dstOffset, 'daylightsavingoffset', 'class="inputbox" size="1"', 'value', 'text', $params->get('daylightsavingoffset'));
     $networkModel = $this->getModel('network', false);
     $JSNInfo =& $networkModel->getJSNInfo();
     $JSON_output =& $networkModel->getJSON();
     $lists['enable'] = JHTML::_('select.booleanlist', 'network_enable', 'class="inputbox"', $JSNInfo['network_enable']);
     $uploadLimit = ini_get('upload_max_filesize');
     $uploadLimit = CString::str_ireplace('M', ' MB', $uploadLimit);
     $this->assignRef('JSNInfo', $JSNInfo);
     $this->assignRef('JSON_output', $JSON_output);
     $this->assignRef('lists', $lists);
     $this->assign('uploadLimit', $uploadLimit);
     $this->assign('config', $params);
     $this->assign('emailtypes', $emailtypes->getEmailTypes());
     parent::display($tpl);
 }
Example #13
0
 public function getDuration()
 {
     $duration = '';
     //Get duration
     $pattern = "'<span class=gray id=video-duration>(.*?)</span>'s";
     preg_match_all($pattern, $this->xmlContent, $matches);
     if ($matches) {
         $duration = explode(":", CString::str_ireplace("&nbsp;", "", trim(strip_tags($matches[1][0]))));
         $duration = $duration[0] * 60 + $duration[1];
     }
     return $duration;
 }
Example #14
0
 /**
  * 解密播放链接的解密串
  * <pre>
  * 		return array(
  * 						'tuid'=>0,			//教程ID
  * 						'tucid'=>0,			//章节ID
  * 						'uid'=>0,			//用户ID
  * 						'timestamp'=>0		//时间戳
  * 					);
  * </pre>
  *
  * @param string $_strKey
  * @return array
  */
 public static function decodePlayKey($_strKey = "")
 {
     $strDecodeKey = CString::decode($_strKey, self::PLAY_KEY);
     $strDecodeKey = trim($strDecodeKey);
     $aryDecode = explode('|', $strDecodeKey);
     if (empty($aryDecode) || count($aryDecode) != 4) {
         throw new CModelException("无法解析的KEY!");
     }
     //$aryTimestamp = explode('*',$aryDecode[3]);
     //$aryDecode[3] = $aryTimestamp[1];
     return array('tuid' => $aryDecode[0], 'tucid' => $aryDecode[1], 'uid' => $aryDecode[2], 'timestamp' => $aryDecode[3]);
 }
Example #15
0
 public function getDescription()
 {
     $description = '';
     // Store description
     $pattern = "'<blip\\:puredescription>(.*?)<\\/blip\\:puredescription>'s";
     preg_match_all($pattern, $this->xmlContent, $matches);
     if ($matches) {
         $description = CString::str_ireplace('&apos;', "'", $matches[1][0]);
         $description = CString::str_ireplace('<![CDATA[', '', $description);
         $description = CString::str_ireplace(']]>', '', $description);
     }
     return $description;
 }
    Public function PesquisaFornecedorCategoria($pesquisa) {
	$String = new CString();
//recebo o paametro vindo do form
	$parametro = isset($_POST['pesquisaFonecedorCategoria']) ? $_POST['pesquisaFonecedorCategoria'] : null;
	$msg = "";
//começo a concatenar a tabela
	$msg .="<table class='table table-hover' id='tabela' border='1'>";
	$msg .="	<thead>";
	$msg .="		<tr >";
	$msg .="			<th>Fornecedor / Categoria de despesa</th>";
	$msg .="		</tr>";
	$msg .="	</thead>";
	$msg .="	<tbody>";

	$resultado = parent::ListaFornecedorCategoria($String->convertem($pesquisa, 1));

	//resgata os dados na tabela
	if ($resultado) {
	    foreach ($resultado as $res){
		$msg .="<tr tabindex='0'>";
		$msg .="    <td class='valor'>" . $res->getFonteDespesa() . "</td>";
		$msg .="</tr>";
	    }
	} else {
	    $msg = "";
	    $msg .="Nenhum resultado foi encontrado...";
	    ?>
	    <script>
	        $("#pesquisaFonecedorCategoria").val('');
	    </script>
	    <?php

	}
	$msg .="</tbody>";
	$msg .="</table>";
	//retorna a msg concatenada
	echo $msg;
    }
Example #17
0
 /**
  * Creates a URL path from a path string or as empty.
  *
  * If a source path string is provided, it should start with "/". Just like in any valid URL, the path string is
  * not expected to contain characters that cannot be represented literally and percent-encoding is expected to be
  * used for any such characters. No trailing "/" are stripped off the path string, so if the path is e.g.
  * "/comp0/comp1/", it produces an empty string as the last component.
  *
  * @param  string $path **OPTIONAL. Default is** *create an empty URL path*. A string with the source path.
  */
 public function __construct($path = null)
 {
     assert('!isset($path) || is_cstring($path)', vs(isset($this), get_defined_vars()));
     assert('!isset($path) || CString::startsWith($path, "/")', vs(isset($this), get_defined_vars()));
     if (isset($path)) {
         $path = CString::stripStart($path, "/");
         $this->m_components = CString::split($path, "/");
         $len = CArray::length($this->m_components);
         for ($i = 0; $i < $len; $i++) {
             $this->m_components[$i] = CUrl::leaveTdNew($this->m_components[$i]);
         }
     } else {
         $this->m_components = CArray::make();
     }
 }
Example #18
0
 public function submitToJomsocial()
 {
     require_once JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_community' . DS . 'models' . DS . 'network.php';
     $model = new CommunityModelNetwork();
     $network =& $model->getJSNInfo();
     // to run or not to run?
     if (empty($network['network_enable'])) {
         return;
     }
     if ($network['network_cron_freq']) {
         $time_diff = time() - $network['network_cron_last_run'];
         $cron_freq = $network['network_cron_freq'] * 60 * 60;
         // 1 hour
         if ($time_diff < $cron_freq) {
             return;
         }
     }
     // prepare data
     foreach ($network as $key => $value) {
         $token = JUtility::getToken();
         $keys = array('network_site_name', 'network_description', 'network_keywords', 'network_language', 'network_member_count', 'network_group_count', 'network_site_url', 'network_join_url', 'network_logo_url');
         if (in_array($key, $keys)) {
             $key = CString::str_ireplace('network_', '', $key);
             $input_filtered[$key] = $value;
         }
     }
     if (!defined('SERVICES_JSON_SLICE')) {
         include_once AZRUL_SYSTEM_PATH . '/pc_includes/JSON.php';
     }
     $json = new Services_JSON();
     $json_output = $json->encode($input_filtered);
     // post data
     $post_data = array();
     $post_data['jsonText'] = $json_output;
     $config = CFactory::getConfig();
     $post_url = $config->get('jsnetwork_path');
     CFactory::load('helpers', 'remote');
     $test = CRemoteHelper::post($post_url, $post_data);
     // save
     $network['network_cron_last_run'] = time();
     $token = JUtility::getToken();
     $network[$token] = 1;
     // set post data
     foreach ($network as $key => $value) {
         JRequest::setVar($key, $value, 'POST');
     }
     $model->save();
 }
Example #19
0
 /**
  * Index method
  */
 public function actionLogin()
 {
     $objLoginModel = LoginModel::model();
     try {
         //检查是否是post请求
         $boolCheckLogin = false;
         if (Nbt::app()->request->isPostRequest) {
             // 绑定数据
             $aryUserInfo['uname'] = isset($_POST['uname']) ? htmlspecialchars(trim($_POST['uname'])) : '';
             $aryUserInfo['pwd'] = isset($_POST['pwd']) ? CString::encodeMachinePassword(trim($_POST['pwd'])) : '';
             $strIsRemember = isset($_POST['remember']) ? htmlspecialchars(trim($_POST['remember'])) : 'no';
             // 检查登录
             $boolCheckLogin = LoginModel::model()->checkLogin($aryUserInfo);
             if ($boolCheckLogin === false) {
                 throw new CModelException(CUtil::i18n('controllers,login_index_pwdWrong'));
             }
             //根据是否登入成功,再判断是否将用户名和密码写入cookie
             if ($boolCheckLogin === true && $strIsRemember === 'yes') {
                 $aryUserInfo['pwd'] = CString::encode($aryUserInfo['pwd'], UKEY);
                 //设置cookie,时间为一年
                 setcookie($this->_cookeName, base64_encode(json_encode($aryUserInfo)), time() + 365 * 24 * 3600);
             }
         } else {
             if (!empty($_COOKIE[$this->_cookeName]) && $boolCheckLogin === false) {
                 $aryUserInfo = json_decode(base64_decode($_COOKIE[$this->_cookeName]), 1);
                 $aryUserInfo['pwd'] = CString::decode($aryUserInfo['pwd'], UKEY);
                 if (($boolCheckLogin = $objLoginModel->checkLogin($aryUserInfo)) === false) {
                     throw new CModelException(CUtil::i18n('controllers,login_index_pwdWrong'));
                 }
             }
         }
         //contains/判断是否登入成功
         if ($boolCheckLogin === true) {
             Nbt::app()->session->set('userInfo', $aryUserInfo);
             UtilMsg::saveTipToSession(CUtil::i18n('controllers,login_index_success'));
             $this->redirect(array('index/index'));
         }
     } catch (CModelException $e) {
         UtilMsg::saveErrorTipToSession($e->getMessage());
     }
     $this->layout = 'login';
     $this->seoTitle = CUtil::i18n('controllers,login_index_seoTitle');
     //根据key判断文件是否存在,如果不存在则)创建一个默认账户
     $objLoginModel->createDefaultUserInfo();
     $this->render('login', array('aryData' => $aryUserInfo));
 }
Example #20
0
 public static function _getGoogleAdsHTML($googleCode, $userId)
 {
     ob_start();
     ?>
         <div id="community-mygoodleads-wrap">
             <?php 
     $gCode = html_entity_decode($googleCode);
     $gCode = CString::str_ireplace("<br />", "\n", $gCode);
     $gCode = preg_replace('/eval\\((.*)\\)/', '', $gCode);
     ?>
             <?php 
     echo "{$gCode}\n";
     ?>
         </div>
         <?php 
     $contents = ob_get_contents();
     ob_end_clean();
     return $contents;
 }
Example #21
0
 /**
  * Add new notification
  */
 public function add($from, $to, $title, $content, $privacy = COMMUNITY_PRIVACY_PUBLIC)
 {
     jimport('joomla.utilities.date');
     $db =& $this->getDBO();
     $date =& JFactory::getDate();
     $obj = new stdClass();
     $obj->actor = $from;
     $obj->target = $to;
     $obj->title = $title;
     $obj->content = $content;
     $obj->created = $date->toMySQL();
     $userFrom =& JFactory::getUser($from);
     $userTo =& JFactory::getUser($to);
     // Porcess the message and title
     $search = array('{actor}', '{target}');
     $replace = array($userFrom->name, $userTo->name);
     $title = CString::str_ireplace($search, $replace, $title);
     $content = CString::str_ireplace($search, $replace, $content);
     return $this;
 }
Example #22
0
 public function display($data = null)
 {
     $mainframe = JFactory::getApplication();
     $document = JFactory::getDocument();
     $model = CFactory::getModel('search');
     $members = $model->getPeople();
     // Prepare feeds
     // 		$document->setTitle($title);
     foreach ($members as $member) {
         $user = CFactory::getUser($member->id);
         $friendCount = JText::sprintf(CStringHelper::isPlural($user->getFriendCount()) ? 'COM_COMMUNITY_FRIENDS_COUNT_MANY' : 'COM_COMMUNITY_FRIENDS_COUNT', $user->getFriendCount());
         $item = new JFeedItem();
         $item->title = $user->getDisplayName();
         $item->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id);
         $item->description = '<img src="' . $user->getThumbAvatar() . '" alt="" />&nbsp;' . $friendCount;
         $item->date = '';
         $item->description = CString::str_ireplace('_QQQ_', '"', $item->description);
         // Make sure url is absolute
         $item->description = CString::str_ireplace('href="/', 'href="' . JURI::base(), $item->description);
         $document->addItem($item);
     }
 }
Example #23
0
 /**
  *	Set the avatar for specific application. Caller must have a database table
  *	that is named after the appType. E.g, users should have jos_community_users	 
  *	
  * @param	appType		Application type. ( users , groups )
  * @param	path		The relative path to the avatars.
  * @param	type		The type of Image, thumb or avatar.
  *
  **/
 public function setImage($id, $path, $type = 'thumb')
 {
     CError::assert($id, '', '!empty', __FILE__, __LINE__);
     CError::assert($path, '', '!empty', __FILE__, __LINE__);
     $db =& $this->getDBO();
     // Fix the back quotes
     $path = CString::str_ireplace('\\', '/', $path);
     $type = JString::strtolower($type);
     // Test if the record exists.
     $query = 'SELECT ' . $db->nameQuote($type) . ' FROM ' . $db->nameQuote('#__community_users') . 'WHERE ' . $db->nameQuote('userid') . '=' . $db->Quote($id);
     $db->setQuery($query);
     $oldFile = $db->loadResult();
     if ($db->getErrorNum()) {
         JError::raiseError(500, $db->stderr());
     }
     if (!$oldFile) {
         $query = 'UPDATE ' . $db->nameQuote('#__community_users') . ' ' . 'SET ' . $db->nameQuote($type) . '=' . $db->Quote($path) . ' ' . 'WHERE ' . $db->nameQuote('userid') . '=' . $db->Quote($id);
         $db->setQuery($query);
         $db->query($query);
         if ($db->getErrorNum()) {
             JError::raiseError(500, $db->stderr());
         }
     } else {
         $query = 'UPDATE ' . $db->nameQuote('#__community_users') . ' ' . 'SET ' . $db->nameQuote($type) . '=' . $db->Quote($path) . ' ' . 'WHERE ' . $db->nameQuote('userid') . '=' . $db->Quote($id);
         $db->setQuery($query);
         $db->query($query);
         if ($db->getErrorNum()) {
             JError::raiseError(500, $db->stderr());
         }
         // If old file is default_thumb or default, we should not remove it.
         // Need proper way to test it
         if (!Jstring::stristr($oldFile, 'components/com_community/assets/default.jpg') && !Jstring::stristr($oldFile, 'components/com_community/assets/default_thumb.jpg')) {
             // File exists, try to remove old files first.
             $oldFile = CString::str_ireplace('/', DS, $oldFile);
             JFile::delete($oldFile);
         }
     }
 }
Example #24
0
 /**
  * Creates an HTTP cookie to be sent along with an HTTP response.
  *
  * Internally, the value of a cookie is always stored as a string. If the cookie's value was provided as an array
  * or map, it's encoded into JSON and is stored as a JSON string. Boolean values are stored as "1" for `true` and
  * as "0" for `false`.
  *
  * @param  string $cookieName The cookie's name.
  * @param  mixed $value The cookie's value. This can be a string, a `bool`, an `int`, a `float`, an array, or a
  * map.
  */
 public function __construct($cookieName, $value)
 {
     assert('is_cstring($cookieName) && (is_cstring($value) || is_bool($value) || is_int($value) || ' . 'is_float($value) || is_collection($value))', vs(isset($this), get_defined_vars()));
     $this->m_name = $cookieName;
     if (is_cstring($value)) {
         $this->m_value = $value;
     } else {
         if (is_bool($value)) {
             $this->m_value = CString::fromBool10($value);
         } else {
             if (is_int($value)) {
                 $this->m_value = CString::fromInt($value);
             } else {
                 if (is_float($value)) {
                     $this->m_value = CString::fromFloat($value);
                 } else {
                     $json = new CJson($value);
                     $this->m_value = $json->encode();
                 }
             }
         }
     }
 }
Example #25
0
 public function display($data = null)
 {
     $mainframe = JFactory::getApplication();
     $config = CFactory::getConfig();
     $document = JFactory::getDocument();
     $document->setTitle(JText::sprintf('COM_COMMUNITY_FRONTPAGE_TITLE', $config->get('sitename')));
     $document->setLink(CRoute::_('index.php?option=com_community'));
     $my = CFactory::getUser();
     CFactory::load('libraries', 'activities');
     CFactory::load('helpers', 'string');
     CFactory::load('helpers', 'time');
     $act = new CActivityStream();
     $rows = $act->getFEED('', '', null, $mainframe->getCfg('feed_limit'));
     if ($config->get('showactivitystream') == COMMUNITY_SHOW || $config->get('showactivitystream') == COMMUNITY_MEMBERS_ONLY && $my->id != 0) {
         foreach ($rows->data as $row) {
             if ($row->type != 'title') {
                 // load individual item creator class
                 $item = new JFeedItem();
                 // cannot escape the title. it's already formated. we should
                 // escape it during CActivityStream::add
                 //$item->title 		= CStringHelper::escape($row->title);
                 $item->title = $row->title;
                 $item->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $row->actor);
                 $item->description = "<img src=\"{$row->favicon}\" alt=\"\"/>&nbsp;" . $row->title;
                 $item->date = CTimeHelper::getDate($row->createdDateRaw)->toRFC822();
                 $item->category = '';
                 //$row->category;
                 $item->description = CString::str_ireplace('_QQQ_', '"', $item->description);
                 // Make sure url is absolute
                 $item->description = CString::str_ireplace('href="/', 'href="' . JURI::base(), $item->description);
                 // loads item info into rss array
                 $document->addItem($item);
             }
         }
     }
 }
Example #26
0
 /**
  * Replaces any reference to one of the framework's special directories in a path with the directory's actual path
  * and returns the usable path.
  *
  * A framework's directory is referenced in a path by wrapping its ID into double curly braces, as in
  * "{{PHRED_PATH_TO_FRAMEWORK_ROOT}}", optionally with "/" after the reference.
  *
  * @param  string $path The path to the file or directory (can be absolute or relative).
  *
  * @return CUStringObject The usable path.
  */
 public static function frameworkPath($path)
 {
     assert('!isset($path) || is_cstring($path)', vs(isset($this), get_defined_vars()));
     if (!isset($path)) {
         return null;
     }
     // Replace every "{{EXAMPLE_PATH}}" in the path string with the value of "EXAMPLE_PATH" key from $GLOBALS
     // variable if such key exists in the variable.
     $modified = false;
     $path = CRegex::replaceWithCallback($path, "/\\{\\{\\w+\\}\\}/", function ($matches) use(&$modified) {
         $pathVarName = CString::substr($matches[0], 2, CString::length($matches[0]) - 4);
         if (isset($GLOBALS[$pathVarName])) {
             $modified = true;
             return $GLOBALS[$pathVarName] . "/";
         } else {
             assert('false', vs(isset($this), get_defined_vars()));
             return $matches[0];
         }
     });
     if ($modified) {
         $path = CRegex::replace($path, "/\\/{2,}/", "/");
     }
     return $path;
 }
    public function GravaLaudoAlterado() {

	$CString = new CString();

	$posicao = isset($_POST["NumTermo"]) ? $_POST["NumTermo"] : 0;

	$incremento = "";

	$data_atual = date('Y-m-d  H:i:s');

	if ($_POST["adicional"] != '') {
	    $incremento = $_POST["adicional"];
	}
	$string = "";


	if ($posicao) {
	    for ($i = 0; $i < count($posicao); $i++){
		$string .= $_POST[$posicao[$i]] . " " . "<br>";
	    }
	}

	$string = $CString->convertem(ucfirst($string . $incremento), 1);

	if (($posicao === 0) AND ( $incremento == "")) {
	    parent::setMsg("Informe alguma descrição para o laudo");
	    return false;
	}

	$Model = new ModelLaudosMedico();
	if ($Model->GravaLaudoAlterado($_POST["item_laudo_id"], $string)) {
	    echo 1;
	} else {
	    echo $Model->getMsg();
	}
	exit();
    }
Example #28
0
 protected static function requestField($map, $fieldName, CInputFilter $inputFilter, &$success)
 {
     $success = true;
     // Account for the fact that, with PHP, GET and POST (and cookie) fields arrive having "." replaced with "_"
     // in their names.
     $fieldName = CString::replace($fieldName, ".", "_");
     $value;
     $hasField = false;
     if (CMap::hasKey($map, $fieldName)) {
         $value = $map[$fieldName];
         if (isset($value)) {
             if (!is_cstring($value) && !is_cmap($value)) {
                 // Should not happen in the known versions of PHP.
                 assert('false', vs(isset($this), get_defined_vars()));
                 $success = false;
                 return $inputFilter->defaultValue();
             }
             if (!self::$ms_treatEmptyRequestValuesAsAbsent) {
                 $hasField = true;
             } else {
                 if (is_cstring($value)) {
                     $hasField = !CString::isEmpty($value);
                 } else {
                     $hasField = !CMap::isEmpty($value) && !(CMap::length($value) == 1 && CMap::hasKey($value, 0) && is_cstring($value[0]) && CString::isEmpty($value[0]));
                 }
             }
         }
     }
     if (!$hasField) {
         $success = false;
         return $inputFilter->defaultValue();
     }
     $inputFilterOrFilterCollection;
     if ($inputFilter->expectedType() != CInputFilter::CARRAY && $inputFilter->expectedType() != CInputFilter::CMAP) {
         $inputFilterOrFilterCollection = $inputFilter;
     } else {
         $inputFilterOrFilterCollection = $inputFilter->collectionInputFilters();
     }
     // Recursively convert any PHP array that has sequential keys and for which CArray type is expected into a
     // CArray, while leaving PHP arrays for which CMap type is expected untouched.
     $value = self::recurseValueBeforeFiltering($value, $inputFilterOrFilterCollection, $success, 0);
     if (!$success) {
         return $inputFilter->defaultValue();
     }
     return $inputFilter->filter($value, $success);
 }
Example #29
0
 private function _createPhoto($data)
 {
     $db = $this->getDBO();
     // Fix the directory separators.
     $data->image = CString::str_ireplace('\\', '/', $data->image);
     $data->thumbnail = CString::str_ireplace('\\', '/', $data->thumbnail);
     $db->insertObject('#__community_photos', $data);
     if ($db->getErrorNum()) {
         JError::raiseError(500, $db->stderr());
     }
     $data->id = $db->insertid();
     return $data;
 }
Example #30
0
 public function testEnterTd()
 {
     // ASCII.
     $res = CRegex::enterTd(".(]/", "/");
     $this->assertTrue(CString::equals($res, "\\.\\(\\]\\/"));
     $res = CRegex::enterTd(".(]#", "#");
     $this->assertTrue(CString::equals($res, "\\.\\(\\]\\#"));
     // Unicode.
     $res = CRegex::enterTd(".(señor]/", "/");
     $this->assertTrue(CString::equals($res, "\\.\\(señor\\]\\/"));
     $res = CRegex::enterTd(".(señor]#", "#");
     $this->assertTrue(CString::equals($res, "\\.\\(señor\\]\\#"));
 }