Пример #1
0
 /**
  * 增加一条feed
  * @param $ArrData 表单内容
  * @param $StrTag	tags
  */
 function AddFeed($ArrData, $StrTag)
 {
     $ArrData = $this->ArrRebuild($ArrData);
     $query = 'INSERT INTO .`feeds` (' . $ArrData['key'] . ') VALUES (' . $ArrData['value'] . ');';
     // 		print_r($query);
     $result = mysql_query($query, $this->ObDb) or die(mysql_error());
     $result = mysql_query('SELECT LAST_INSERT_ID( )', $this->ObDb) or die(mysql_error());
     $LastId = mysql_fetch_array($result);
     $LastId = $LastId[0];
     $StrTag = spliti(',', $StrTag);
     $ArrTag = array();
     foreach ($StrTag as $value) {
         !in_array($value, $ArrTag) ? $ArrTag[] = $value : true;
     }
     foreach ($ArrTag as $value) {
         if (trim($value)) {
             $Str .= "('{$LastId}' , '{$value}'),";
         }
     }
     $Str = rtrim($Str, ',');
     $query = 'INSERT INTO `feeds-tags` (fid,tag) VALUES ' . $Str . ';';
     // 		print_r($query);
     $result = mysql_query($query, $this->ObDb) or die(mysql_error());
     return true;
 }
Пример #2
0
 /**
  * Function returns the Query for the relationhips
  * @param <Vtiger_Record_Model> $recordModel
  * @param type $actions
  * @return <String>
  */
 public function getQuery($recordModel, $actions = false)
 {
     $parentModuleModel = $this->getParentModuleModel();
     $relatedModuleModel = $this->getRelationModuleModel();
     $relatedModuleName = $relatedModuleModel->get('name');
     $parentModuleName = $parentModuleModel->get('name');
     $functionName = $this->get('name');
     $focus = CRMEntity::getInstance($parentModuleName);
     $focus->id = $recordModel->getId();
     if (method_exists($parentModuleModel, $functionName)) {
         $query = $parentModuleModel->{$functionName}($recordModel, $relatedModuleModel);
     } else {
         $result = $focus->{$functionName}($recordModel->getId(), $parentModuleModel->getId(), $relatedModuleModel->getId(), $actions);
         $query = $result['query'];
     }
     //modify query if any module has summary fields, those fields we are displayed in related list of that module
     $relatedListFields = $relatedModuleModel->getConfigureRelatedListFields();
     if (count($relatedListFields) > 0) {
         $currentUser = Users_Record_Model::getCurrentUserModel();
         $queryGenerator = new QueryGenerator($relatedModuleName, $currentUser);
         $queryGenerator->setFields($relatedListFields);
         $selectColumnSql = $queryGenerator->getSelectClauseColumnSQL();
         $newQuery = spliti('FROM', $query);
         $selectColumnSql = 'SELECT DISTINCT vtiger_crmentity.crmid,' . $selectColumnSql;
     }
     if ($functionName == ('get_pricebook_products' || 'get_pricebook_services')) {
         $selectColumnSql = $selectColumnSql . ', vtiger_pricebookproductrel.listprice';
     }
     $query = $selectColumnSql . ' FROM ' . $newQuery[1];
     return $query;
 }
Пример #3
0
function efGroupPortal_MediaWikiPerformAction($output, $article, $title, $user, $request)
{
    $action = $request->getVal('action', 'view');
    $redirect = $request->getVal('redirect');
    if ($action === 'view' && $redirect === null) {
        if ($title->equals(Title::newMainPage())) {
            $groupPortals = spliti("\n", wfMsgForContentNoTrans('groupportal'));
            $groups = $user->getGroups();
            $targetPortal = '';
            foreach ($groupPortals as $groupPortal) {
                $mcount = preg_match('/^(.+)\\|(.+)$/', $groupPortal, $matches);
                if ($mcount > 0) {
                    if (in_array($matches[1], $groups) || $matches[1] == '*' && empty($targetPortal)) {
                        $targetPortal = $matches[2];
                    }
                }
            }
            if (!empty($targetPortal)) {
                $target = Title::newFromText($targetPortal);
                if (is_object($target)) {
                    $output->redirect($target->getLocalURL());
                    return false;
                }
            }
        }
    }
    return true;
}
Пример #4
0
function parsePlaylist($txt, $type = false)
{
    $txt = explode("\n", $txt);
    // trim will remove the \r
    $res = array();
    if ($type == "pls" || $type === false) {
        foreach ($txt as $t) {
            $t = trim($t);
            if (stripos($t, "file") !== false) {
                $pos = spliti("^file[0-9]*=", $t);
                if (count($pos) == 2 && strlen($pos[1]) > 0) {
                    $res[] = $pos[1];
                }
            }
        }
    } else {
        if ($type == "m3u" || $type === false && count($res) == 0) {
            foreach ($txt as $t) {
                $t = trim($t);
                if (strpos($t, "#") !== false || strlen($t) == 0) {
                    echo "skipping: {$t}\n";
                    continue;
                }
                $res[] = $t;
            }
        }
    }
    return $res;
}
Пример #5
0
 /**
  * Function to get list view query for popup window
  * @param <String> $sourceModule Parent module
  * @param <String> $field parent fieldname
  * @param <Integer> $record parent id
  * @param <String> $listQuery
  * @return <String> Listview Query
  */
 public function getQueryByModuleField($sourceModule, $field, $record, $listQuery)
 {
     if (in_array($sourceModule, array('Leads', 'Accounts', 'Contacts'))) {
         switch ($sourceModule) {
             case 'Leads':
                 $tableName = 'vtiger_campaignleadrel';
                 $relatedFieldName = 'leadid';
                 break;
             case 'Accounts':
                 $tableName = 'vtiger_campaignaccountrel';
                 $relatedFieldName = 'accountid';
                 break;
             case 'Contacts':
                 $tableName = 'vtiger_campaigncontrel';
                 $relatedFieldName = 'contactid';
                 break;
         }
         $condition = " vtiger_campaign.campaignid NOT IN (SELECT campaignid FROM {$tableName} WHERE {$relatedFieldName} = '{$record}')";
         $pos = stripos($listQuery, 'where');
         if ($pos) {
             $split = spliti('where', $listQuery);
             $overRideQuery = $split[0] . ' WHERE ' . $split[1] . ' AND ' . $condition;
         } else {
             $overRideQuery = $listQuery . ' WHERE ' . $condition;
         }
         return $overRideQuery;
     }
 }
Пример #6
0
 public function getQueryByModuleField($sourceModule, $field, $record, $listQuery)
 {
     $bmqdivx = "sourceModule";
     $zlolzuy = "sourceModule";
     ${${"GLOBALS"}["qrqojbhxesaz"]} = array("Leads", "Accounts", "HelpDesk", "Potentials");
     if (${$bmqdivx} == "PriceBooks" && ${${"GLOBALS"}["tebjrruj"]} == "priceBookRelatedList" || in_array(${$zlolzuy}, ${${"GLOBALS"}["qrqojbhxesaz"]}) || in_array(${${"GLOBALS"}["smtqzdj"]}, getInventoryModules())) {
         ${${"GLOBALS"}["vdridpr"]} = " vtiger_service.discontinued = 1 ";
         $csusxhsru = "field";
         $hxsdmdnrcwm = "sourceModule";
         $hxnvgeuqzxj = "supportedModulesList";
         if (${$hxsdmdnrcwm} == "PriceBooks" && ${$csusxhsru} == "priceBookRelatedList") {
             ${${"GLOBALS"}["vdridpr"]} .= " AND vtiger_service.serviceid NOT IN (SELECT productid FROM vtiger_pricebookproductrel WHERE pricebookid = '{$record}') ";
         } elseif (in_array(${${"GLOBALS"}["smtqzdj"]}, ${$hxnvgeuqzxj})) {
             $hcfqbvtwpxs = "condition";
             ${$hcfqbvtwpxs} .= " AND vtiger_service.serviceid NOT IN (SELECT relcrmid FROM vtiger_crmentityrel WHERE crmid = '{$record}' UNION SELECT crmid FROM vtiger_crmentityrel WHERE relcrmid = '{$record}') ";
         }
         ${${"GLOBALS"}["myxgfagm"]} = stripos(${${"GLOBALS"}["texkhgc"]}, "where");
         if (${${"GLOBALS"}["myxgfagm"]}) {
             ${"GLOBALS"}["jstyvedywb"] = "overRideQuery";
             ${"GLOBALS"}["duyhsdq"] = "split";
             ${"GLOBALS"}["tarygvij"] = "condition";
             $ahusbk = "listQuery";
             $lxqmuyuxd = "split";
             ${${"GLOBALS"}["duyhsdq"]} = spliti("where", ${$ahusbk});
             ${${"GLOBALS"}["jstyvedywb"]} = ${${"GLOBALS"}["wdrbrwcxv"]}[0] . " WHERE " . ${$lxqmuyuxd}[1] . " AND " . ${${"GLOBALS"}["tarygvij"]};
         } else {
             $arzttzsxki = "overRideQuery";
             ${$arzttzsxki} = ${${"GLOBALS"}["texkhgc"]} . " WHERE " . ${${"GLOBALS"}["vdridpr"]};
         }
         return ${${"GLOBALS"}["mvklfvtelnt"]};
     }
 }
Пример #7
0
function PHPruDirs() 
{
	global $HOME_DIR, $STOP_DIR, $STOP_FILE, $CONFIG, $input, $sizetotal;
	$dir = opendir('.'); 
	$ff = readdir($dir);
	while ($ff != '') 
	{ 
		$flag = 0;
		if (is_dir($ff)) 
		{ 
			foreach($STOP_DIR as $VALUE)
			{
				if (strtolower($ff) == strtolower(trim($VALUE)))
					$flag = 1;
			}
			if (($ff != '.') && ($ff != '..') && ($flag != 1)) 
				{	chdir($ff); PHPruDirs(); chdir('..');	} 
		} 
		$ff = readdir($dir); 
		if ($ff != '..' && !is_dir($ff))
		{
			$hlam = str_replace($STOP_FILE, "!", $ff);
			if ($hlam != $ff)
				continue;
			else
			{	
				$NOW_DIR = getcwd();
				$LINK = str_replace($HOME_DIR, trim($CONFIG[0]), $NOW_DIR);
				$LINK = str_replace('\\', '/', $LINK);
				$mtime = date("d.m.Yг.",filemtime($ff));
				$size = round(filesize($ff)/1024);
				$sizetotal += $size;
				$ff = trim($ff); 
				$FILE = file($ff);
				$text = implode(' ',$FILE);
				unset ($FIND);
				if($CONFIG[3] == 1)
				{
					@list($start,$end) = spliti('</TITLE>',$text,2);
					@list($recycle,$FIND) = spliti('<TITLE>',$start,2);
				}
				if (!isset($FIND))
					$FIND = $LINK.'/'.$ff;
				$clear = PHPruClear($text);
				
				$text = wordwrap ($clear, 100, "%^%");
				
				$input .= '<A HREF=\''.$LINK.'/'.$ff.'\' TARGET=_new>'.$FIND.'</A>';
				$input .= '^!^'.$size.'^!^'.$text.'^!^'.$mtime."\r\n";
			}
		}
	} 
closedir($dir); 
}
Пример #8
0
 /**
  * Function to get list view query for popup window
  * @param <String> $sourceModule Parent module
  * @param <String> $field parent fieldname
  * @param <Integer> $record parent id
  * @param <String> $listQuery
  * @return <String> Listview Query
  */
 public function getQueryByModuleField($sourceModule, $field, $record, $listQuery)
 {
     if ($sourceModule === 'Emails' && $field === 'composeEmail') {
         $condition = ' (( vtiger_notes.filelocationtype LIKE "%I%")) AND vtiger_notes.filename != "" AND vtiger_notes.filestatus = 1';
     } else {
         $condition = " vtiger_notes.notesid NOT IN (SELECT notesid FROM vtiger_senotesrel WHERE crmid = '{$record}') AND vtiger_notes.filestatus = 1";
     }
     $pos = stripos($listQuery, 'where');
     if ($pos) {
         $split = spliti('where', $listQuery);
         $overRideQuery = $split[0] . ' WHERE ' . $split[1] . ' AND ' . $condition;
     } else {
         $overRideQuery = $listQuery . ' WHERE ' . $condition;
     }
     return $overRideQuery;
 }
Пример #9
0
 /**
  * Function to get list view query for popup window
  * @param <String> $sourceModule Parent module
  * @param <String> $field parent fieldname
  * @param <Integer> $record parent id
  * @param <String> $listQuery
  * @return <String> Listview Query
  */
 public function getQueryByModuleField($sourceModule, $field, $record, $listQuery, $currencyId = false)
 {
     $relatedModulesList = array('Products', 'Services');
     if (in_array($sourceModule, $relatedModulesList)) {
         $pos = stripos($listQuery, ' where ');
         if ($currencyId && in_array($field, array('productid', 'serviceid'))) {
             $condition = " vtiger_pricebook.pricebookid IN (SELECT pricebookid FROM vtiger_pricebookproductrel WHERE productid = {$record})\n\t\t\t\t\t\t\t\tAND vtiger_pricebook.currency_id = {$currencyId} AND vtiger_pricebook.active = 1";
             if ($pos) {
                 $split = spliti(' where ', $listQuery);
                 $overRideQuery = $split[0] . ' WHERE ' . $split[1] . ' AND ' . $condition;
             } else {
                 $overRideQuery = $listQuery . ' WHERE ' . $condition;
             }
         }
         return $overRideQuery;
     }
 }
Пример #10
0
/** 
 * Smarty plugin 
 * ------------------------------------------------------------- 
 * File: block.sortlinks.php 
 * Type: block 
 * Name: sortlinks 
 * ------------------------------------------------------------- 
 */
function smarty_block_sortlinks($params, $content, &$gBitSmarty)
{
    if ($content) {
        $links = spliti("\n", $content);
        $links2 = array();
        foreach ($links as $value) {
            $splitted = preg_split("/[<>]/", $value, -1, PREG_SPLIT_NO_EMPTY);
            $links2[$splitted[2]] = $value;
        }
        if (isset($params['order']) && $params['order'] == 'reverse') {
            krsort($links2);
        } else {
            ksort($links2);
        }
        foreach ($links2 as $value) {
            echo $value;
        }
    }
}
Пример #11
0
 /**
  * INIT DIRECTORY.
  * @param: none
  */
 private function initdirectory()
 {
     # no need to urldecode => $_GET already do this!
     if (isset($_GET['p']) && $_GET['p'] != '') {
         $url = $_GET['p'];
         $tabParams = spliti($this->slash, $url);
         $this->url_params = $tabParams;
     } else {
         $this->url_params = NULL;
     }
     # get params from url
     $directory = $this->userDataPath;
     if (!empty($this->url_params)) {
         foreach ($this->url_params as $id) {
             $directory .= $id . $this->slash;
         }
     }
     $this->absoluteDirectoryPath = $directory;
 }
Пример #12
0
 /**
  * Reply to the operation.
  * @param $event event that triggered the operation.
  * @return BotMessage with magic 8's answer.
  */
 public function reply(BotEvent $event)
 {
     $sender = $event->getSender();
     $message = $event->getMessage();
     if (preg_match("/([^\\s]+)\\s+ou\\s+([^\\s?]+)/i", $message)) {
         $responses = spliti(" ou ", $message);
     } else {
         $responses = $this->responses;
     }
     $response = mt_rand(0, count($responses) - 1);
     $reply = $responses[$response];
     $reply = trim(str_replace("?", "", $reply));
     if ($event->isPrivate()) {
         $destination = $sender;
     } else {
         $reply = "{$sender}: {$reply}";
         $destination = $event->getDestination();
     }
     return new BotMessage($destination, $reply);
 }
Пример #13
0
 /**
  * Function to get list view query for popup window
  * @param <String> $sourceModule Parent module
  * @param <String> $field parent fieldname
  * @param <Integer> $record parent id
  * @param <String> $listQuery
  * @return <String> Listview Query
  */
 public function getQueryByModuleField($sourceModule, $field, $record, $listQuery)
 {
     $supportedModulesList = array('Leads', 'Accounts', 'HelpDesk', 'Potentials');
     if ($sourceModule == 'PriceBooks' && $field == 'priceBookRelatedList' || in_array($sourceModule, $supportedModulesList) || in_array($sourceModule, getInventoryModules())) {
         $condition = " vtiger_service.discontinued = 1 ";
         if ($sourceModule == 'PriceBooks' && $field == 'priceBookRelatedList') {
             $condition .= " AND vtiger_service.serviceid NOT IN (SELECT productid FROM vtiger_pricebookproductrel WHERE pricebookid = '{$record}') ";
         } elseif (in_array($sourceModule, $supportedModulesList)) {
             $condition .= " AND vtiger_service.serviceid NOT IN (SELECT relcrmid FROM vtiger_crmentityrel WHERE crmid = '{$record}' UNION SELECT crmid FROM vtiger_crmentityrel WHERE relcrmid = '{$record}') ";
         }
         $pos = stripos($listQuery, 'where');
         if ($pos) {
             $split = spliti('where', $listQuery);
             $overRideQuery = $split[0] . ' WHERE ' . $split[1] . ' AND ' . $condition;
         } else {
             $overRideQuery = $listQuery . ' WHERE ' . $condition;
         }
         return $overRideQuery;
     }
 }
Пример #14
0
function html2cell($html)
{
    #Parse what's inside the table in $html into a nice PHP array
    #Helena F Deus
    if (eregi('<TABLE>(.*)</TABLE>', $html, $table_contents)) {
        #parse teh lines
        if (eregi('<TR>(.*)</TR>', $table_contents[1], $row_contents)) {
            #$row = explode('<TR>', $row_contents[0]);
            $row = spliti('<TR>', $row_contents[0]);
            $row = array_filter($row);
            #explode has this annoying habit of adding empty values
            foreach ($row as $rowi => $a_row) {
                #remove </tr>
                $a_row = str_ireplace('</TR>', '', $a_row);
                #parse teh cells
                if (eregi('<TD>(.*)</TD>', $a_row, $cell_contents)) {
                    $cells[$rowi] = spliti('<TD>', $cell_contents[1]);
                    #remove emptyes
                    $cells[$rowi] = array_filter($cells[$rowi]);
                    #remove the /td
                    $cells[$rowi] = array_filter($cells[$rowi]);
                    foreach ($cells[$rowi] as $col => $a_cell) {
                        $a_cell = str_ireplace('</TD>', '', $a_cell);
                        $cells[$rowi][$col] = $a_cell;
                        if ($rowi > 1) {
                            $cells[$rowi][trim($cells[1][$col])] = $a_cell;
                        }
                    }
                } else {
                    return 'No cells';
                }
            }
        } else {
            return 'No rows';
        }
    } else {
        'No html tables found';
    }
    return $cells;
}
Пример #15
0
function wmv_bot($url, $ext)
{
    foreach (url_bot($url) as $url) {
        $file = file($url);
        $file[-1] = "";
        $file = implode("\n", $file);
        $file = spliti("http://", $file);
        //print_r($file);
        $urlz[-1] = "";
        $i = 0;
        foreach ($file as $url) {
            $url = explode(">", $url);
            $url = $url[0];
            if (eregi(".com", $url) && eregi($ext, $url) && !eregi(" |\"", $url)) {
                $urlz[$i] = "http://" . $url;
                $i++;
            }
        }
        print_r($urlz);
    }
    return $urlz;
}
Пример #16
0
 /**
  * Function to get the list view entries
  * @param Vtiger_Paging_Model $pagingModel
  * @return <Array> - Associative array of record id mapped to Vtiger_Record_Model instance.
  */
 public function getListViewCount()
 {
     $db = PearDatabase::getInstance();
     $queryGenerator = $this->get('query_generator');
     $listQuery = $queryGenerator->getQuery();
     $listQuery = preg_replace("/vtiger_crmentity.deleted\\s*=\\s*0/i", 'vtiger_crmentity.deleted = 1', $listQuery);
     $position = stripos($listQuery, 'from');
     if ($position) {
         $split = spliti('from', $listQuery);
         $splitCount = count($split);
         $listQuery = 'SELECT count(*) AS count ';
         for ($i = 1; $i < $splitCount; $i++) {
             $listQuery = $listQuery . ' FROM ' . $split[$i];
         }
     }
     if ($this->getModule()->get('name') == 'Calendar') {
         $listQuery .= ' AND activitytype <> "Emails"';
     }
     $listResult = $db->pquery($listQuery, array());
     $listViewCount = $db->query_result($listResult, 0, 'count');
     return $listViewCount;
 }
Пример #17
0
 /**
  * Function to get list view query for popup window
  * @param <String> $sourceModule Parent module
  * @param <String> $field parent fieldname
  * @param <Integer> $record parent id
  * @param <String> $listQuery
  * @return <String> Listview Query
  */
 public function getQueryByModuleField($sourceModule, $field, $record, $listQuery)
 {
     $supportedModulesList = array($this->getName(), 'Vendors', 'Leads', 'Accounts', 'Contacts', 'Potentials');
     if ($sourceModule == 'PriceBooks' && $field == 'priceBookRelatedList' || in_array($sourceModule, $supportedModulesList) || in_array($sourceModule, getInventoryModules())) {
         $condition = " vtiger_products.discontinued = 1 ";
         if ($sourceModule === $this->getName()) {
             $condition .= " AND vtiger_products.productid NOT IN (SELECT productid FROM vtiger_seproductsrel UNION SELECT crmid FROM vtiger_seproductsrel WHERE productid = '{$record}')  AND vtiger_products.productid <> '{$record}' ";
         } elseif ($sourceModule === 'PriceBooks') {
             $condition .= " AND vtiger_products.productid NOT IN (SELECT productid FROM vtiger_pricebookproductrel WHERE pricebookid = '{$record}') ";
         } elseif ($sourceModule === 'Vendors') {
             $condition .= " AND vtiger_products.vendor_id != '{$record}' ";
         } elseif (in_array($sourceModule, $supportedModulesList)) {
             $condition .= " AND vtiger_products.productid NOT IN (SELECT productid FROM vtiger_seproductsrel WHERE crmid = '{$record}')";
         }
         $pos = stripos($listQuery, 'where');
         if ($pos) {
             $split = spliti('where', $listQuery);
             $overRideQuery = $split[0] . ' WHERE ' . $split[1] . ' AND ' . $condition;
         } else {
             $overRideQuery = $listQuery . ' WHERE ' . $condition;
         }
         return $overRideQuery;
     }
 }
Пример #18
0
 /**
  * Function to get list view query for popup window
  * @param <String> $sourceModule Parent module
  * @param <String> $field parent fieldname
  * @param <Integer> $record parent id
  * @param <String> $listQuery
  * @return <String> Listview Query
  */
 public function getQueryByModuleField($sourceModule, $field, $record, $listQuery)
 {
     if ($sourceModule == 'Accounts' && $field == 'account_id' && $record || in_array($sourceModule, array('Campaigns', 'Products', 'Services', 'Emails'))) {
         if ($sourceModule === 'Campaigns') {
             $condition = " vtiger_account.accountid NOT IN (SELECT accountid FROM vtiger_campaignaccountrel WHERE campaignid = '{$record}')";
         } elseif ($sourceModule === 'Products') {
             $condition = " vtiger_account.accountid NOT IN (SELECT crmid FROM vtiger_seproductsrel WHERE productid = '{$record}')";
         } elseif ($sourceModule === 'Services') {
             $condition = " vtiger_account.accountid NOT IN (SELECT relcrmid FROM vtiger_crmentityrel WHERE crmid = '{$record}' UNION SELECT crmid FROM vtiger_crmentityrel WHERE relcrmid = '{$record}') ";
         } elseif ($sourceModule === 'Emails') {
             $condition = ' vtiger_account.emailoptout = 0';
         } else {
             $condition = " vtiger_account.accountid != '{$record}'";
         }
         $position = stripos($listQuery, 'where');
         if ($position) {
             $split = spliti('where', $listQuery);
             $overRideQuery = $split[0] . ' WHERE ' . $split[1] . ' AND ' . $condition;
         } else {
             $overRideQuery = $listQuery . ' WHERE ' . $condition;
         }
         return $overRideQuery;
     }
 }
Пример #19
0
 /**
  * Function returns export query
  * @param <String> $where
  * @return <String> export query
  */
 public function getExportQuery($focus, $query)
 {
     $baseTableName = $focus->table_name;
     $splitQuery = spliti(' FROM ', $query);
     $columnFields = explode(',', $splitQuery[0]);
     foreach ($columnFields as $key => &$value) {
         if ($value == ' vtiger_inventoryproductrel.discount_amount') {
             $value = ' vtiger_inventoryproductrel.discount_amount AS item_discount_amount';
         } else {
             if ($value == ' vtiger_inventoryproductrel.discount_percent') {
                 $value = ' vtiger_inventoryproductrel.discount_percent AS item_discount_percent';
             } else {
                 if ($value == " {$baseTableName}.currency_id") {
                     $value = ' vtiger_currency_info.currency_name AS currency_id';
                 }
             }
         }
     }
     $joinSplit = spliti(' WHERE ', $splitQuery[1]);
     $joinSplit[0] .= " LEFT JOIN vtiger_currency_info ON vtiger_currency_info.id = {$baseTableName}.currency_id";
     $splitQuery[1] = $joinSplit[0] . ' WHERE ' . $joinSplit[1];
     $query = implode(',', $columnFields) . ' FROM ' . $splitQuery[1];
     return $query;
 }
function line($head, $textok, $info, $running, $notonload, $command)
{
    $host = "127.0.0.1";
    $timeout = "1";
    global $i, $TEXT;
    $curdir = getcwd();
    list($partwampp, $directorwampp) = spliti('\\\\security', $curdir);
    $htaccess = ".htaccess";
    $configinc = "config.inc.php";
    $notrun = 0;
    $status = 0;
    $notload = 0;
    $newstatus = "nok";
    global $htxampp;
    global $phpmyadminconf;
    $htxampp = $partwampp . "\\htdocs\\xampp\\" . $htaccess;
    $phpmyadminconf = $partwampp . "\\phpmyadmin\\" . $configinc;
    if ($command == "phpmyadmin") {
        if (file_exists($phpmyadminconf)) {
            $datei = fopen($phpmyadminconf, 'r');
            $status = 1;
            while (!feof($datei)) {
                $zeile = fgets($datei, 255);
                @(list($left, $right) = split('=', $zeile));
                if (preg_match("/'auth_type'/i", $left)) {
                    if (preg_match("/'http'/i", $right)) {
                        $newstatus = "ok";
                    } elseif (preg_match("/'cookie'/i", $right)) {
                        $newstatus = "ok";
                    }
                    if ($newstatus == "ok") {
                        $status = 0;
                    } else {
                        $status = 1;
                    }
                }
            }
            fclose($datei);
        } else {
            $notrun = 1;
        }
    }
    if ($command == "mysqlroot") {
        if (($handle = @fsockopen($host, 3306, $errno, $errstr, $timeout)) == true) {
            @fclose($handle);
            if (@mysql_connect($host, "root", "")) {
                $status = 1;
            } else {
                $status = 0;
            }
        } else {
            $notrun = 1;
        }
    }
    if ($command == "xampp") {
        if (file_exists($htxampp)) {
            $status = 0;
        } else {
            $status = 1;
        }
    }
    if ($command == "php") {
        if (ini_get('safe_mode')) {
            $status = 0;
        } else {
            $status = 1;
        }
    }
    if ($command == "ftp") {
        if (($handle = @fsockopen($host, 21, $errno, $errstr, $timeout)) == true) {
            @fclose($handle);
            $conn_id = ftp_connect("127.0.0.1");
            $login_result = @ftp_login($conn_id, "newuser", "wampp");
            if (!$conn_id || !$login_result) {
                $status = 0;
            } else {
                $status = 1;
                ftp_quit($conn_id);
            }
        } else {
            $notrun = 1;
        }
    }
    if (extension_loaded("imap")) {
        if ($command == "pop") {
            if (($handle = @fsockopen($host, 110, $errno, $errstr, $timeout)) == true) {
                @fclose($handle);
                if ($mbox = @imap_open("{localhost/pop3:110}INBOX", "newuser", "wampp")) {
                    $status = 1;
                    imap_close($mbox);
                } else {
                    $status = 0;
                }
            } else {
                $notrun = 1;
            }
        }
    } else {
        $notload = 1;
    }
    if ($i > 0) {
        echo "<tr valign='bottom'>";
        echo "<td bgcolor='#ffffff' height='1' style='background-image:url(img/strichel.gif)' colspan='4'></td>";
        echo "</tr>";
    }
    echo "<tr bgcolor='#ffffff' valign='middle'><td><img src='img/blank.gif' alt='' width='1' height='20'></td><td class='tabval'>";
    if ($notload == 1) {
        echo $notonload;
    }
    if ($status == 0 && ($notrun == "" || $notrun < 1)) {
        echo $textok;
    } elseif ($notrun == 1) {
        echo $running;
    } else {
        echo $head;
    }
    echo "</td>";
    if ($status == 0 && $notrun != 1) {
        echo "<td>&nbsp;&nbsp;<span class='green'>&nbsp;" . $TEXT['security-ok'] . "&nbsp;</span></td>";
    } elseif ($status == 1) {
        echo "<td>&nbsp;&nbsp;<span class='red'>&nbsp;" . $TEXT['security-nok'] . "&nbsp;</span></td>";
    } elseif ($notrun == 1) {
        echo "<td>&nbsp;&nbsp;<span class='yellow'>&nbsp;" . $TEXT['security-noidea'] . "&nbsp;</span></td>";
    } else {
        echo "<td>&nbsp;&nbsp;<span class='yellow'>&nbsp;" . $TEXT['security-noidea'] . "&nbsp;</span></td>";
    }
    echo "<td>&nbsp;</td></tr>";
    if ($notrun == 1) {
        echo "<tr bgcolor='#ffffff'><td></td><td colspan='1' class='small'>{$running}<br><img src='img/blank.gif' alt='' width='10' height='10' border='0'></td><td></td><td></td></tr>";
    } elseif ($status) {
        echo "<tr bgcolor='#ffffff'><td></td><td colspan='1' class='small'>{$info}<br><img src='img/blank.gif' alt='' width='10' height='10' border='0'></td><td></td><td></td></tr>";
    }
    $i++;
}
Пример #21
0
/**
 * Created by PhpStorm.
 * User: pagrawal
 * Date: 10/12/15
 * Time: 3:23 PM
 */
$host = '127.0.0.1';
$user = '******';
$password = '';
$link = mysql_connect($host, $user, $password) or die('Error');
//var_dump($link);
mysql_select_db('chat') or die('Database Error');
header("Content-Type: text/xml");
$path = $_SERVER['PATH_INFO'];
if ($path != null) {
    $path_params = spliti("/", $path);
}
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    if ($path_params[1] != null) {
        settype($path_params[1], 'integer');
        $query = 'SELECT name, author, isbn FROM book where id = $path_params[1]';
    } else {
        $query = 'SELECT name, author, isbn FROM book';
    }
    $result = mysql_query($query) or die('Query Failed' . mysql_error());
    echo "<books>";
    while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
        echo "<book>";
        foreach ($line as $key => $col_value) {
            echo "<key>{$col_value}</key>";
        }
Пример #22
0
/**
 * This function is used to filter the post content
 * and replace particulars tags with the right sobstitution code
 * NOTE:
 * [[Image:image/name.ext|align|width|height|Caption or description]]
 *        |      0       |  1  |  2  |  3   |          4           |
 * words[]:
 * [0] image file (path) Obligatory
 * [1] alignment
 * [2] width
 * [3] height
 * [4] caption
 */
function parse_posts_for_images($content)
{
    global $wpdb, $post, $gallery_root, $gallery_address;
    // Check if in the post there are [[image]]'s tags, if not content is returned else it is processed
    if (strpos(strtolower($content), "[[image") === false || strpos(strtolower($content), "<code>[[image") == true) {
        return $content;
    } else {
        $gallery_uri = get_option('lg_gallery_uri');
        // Fix for permalinks
        if (strlen(get_option('permalink_structure')) != 0) {
            $gallery_uri = $gallery_uri . '?';
        } else {
            $gallery_uri = $gallery_uri . '&amp;';
        }
        $imagedata = array();
        $posstags = spliti("\\[\\[Image:", $content);
        $new_content = $content;
        // Search for tags
        for ($i = 0; $i <= count($posstags); $i++) {
            $smartlink = array();
            eregi('([^\\[]*)\\]\\]', $posstags[$i], $smartlink);
            if (strlen($smartlink[1]) > 0) {
                $imagedata[] = $smartlink[1];
            }
        }
        // Process tags
        foreach ($imagedata as $imgdata) {
            $folder = "";
            if (isset($imgdata)) {
                if (strpos($content, $imgdata) === false) {
                    return $content;
                }
                $words = explode("|", $imgdata);
                // Trimming spaces
                for ($i = 0; $i < count($words); $i++) {
                    $words[$i] = trim($words[$i]);
                }
                // extracts the image from the array
                $words = array_reverse($words);
                $image = array_pop($words);
                $width = '';
                $height = '';
                $align = array("center", "left", "right");
                $done = false;
                $alt = '';
                // assigning the right values
                foreach ($words as $key) {
                    if (is_numeric($key) && $width == '') {
                        $width = $key;
                    } else {
                        if (is_numeric($key) && $height == '') {
                            $height = $key;
                        } else {
                            if (!$done && in_array($key, $align)) {
                                $align = $key;
                                $done = true;
                            } else {
                                $alt = $key;
                            }
                        }
                    }
                }
                if ($width == '') {
                    $height = get_option('lg_thumbheight');
                    $width = get_option('lg_thumbwidth');
                } else {
                    if ($height == '') {
                        $height = $width;
                    }
                }
                // Fixing CSS issues
                if ($align == "center") {
                    $center_style = "margin:auto !important;";
                }
                $thumb_width = "width:" . ($width + 2) . "px;";
                // End of CSS issue
                /* ========================
                 * Sobstitution code header
                 * ======================== */
                $url = "<div class='thumb t{$align}'>\r\n\t\t\t\t\t\t\t<div style='{$thumb_width}{$center_style}' >";
                /* ===========================
                 * Gathering misc informations
                 * =========================== */
                $img = basename($image);
                $folder = str_replace($img, "", $image);
                $title = $alt;
                if (strlen($title) == 0) {
                    $caption = clean_image_caption($img, $folder);
                    $title = ereg_replace("<[^>]*>", "", $caption);
                }
                $xhtml_url = str_replace(" ", "%20", $image);
                // Cache System code (used for lightbox)
                $slide_folder = get_option('lg_slide_folder');
                if (file_exists($gallery_root . $folder . $img)) {
                    if (!file_exists($gallery_root . $folder . $slide_folder . $img) && strlen($image) > 0) {
                        // Not thumb = false
                        createCache($folder, $img, false);
                    }
                }
                $urlImg = str_replace(" ", "%20", $gallery_address . $folder . $slide_folder . $img);
                /* =============
                 * The Right URL
                 * ============= */
                // Lightbox Informations
                $lb_enabled = get_option('lg_enable_lb_support');
                $lb_posts = get_option('lg_enable_lb_posts_support');
                $lb_force = get_option('lg_force_lb_support');
                // Thickbox informations
                $tb_enabled = get_option('lg_enable_tb_support');
                $tb_posts = get_option('lg_enable_tb_posts_support');
                $tb_force = get_option('lg_force_tb_support');
                // Slides' cache infos
                $lg_scache = get_option('lg_enable_slides_cache');
                // Lightbox code
                if ($lb_enabled == "TRUE" && $lb_posts == "TRUE" && $lg_scache == "TRUE" && some_lightbox_plugin() || $lb_force == "TRUE") {
                    $url .= "<a href='{$urlImg}' rel='lightbox' title='{$title}' class='internal'>";
                } elseif ($tb_enabled == "TRUE" && $tb_posts == "TRUE" && $lg_scache == "TRUE" && some_thickbox_plugin() || $tb_force == "TRUE") {
                    $url .= "<a href='{$urlImg}' class='thickbox' title='{$title}'>";
                } else {
                    $url .= "<a href='{$gallery_uri}" . "file={$xhtml_url}' class='internal'>";
                }
                /* ================
                 * End of Right URL
                 * ================ */
                /* ========================
                 * Sobstitution code footer
                 * ======================== */
                $url .= "<img src='" . get_option('siteurl') . "/wp-content/plugins/lazyest-gallery/lazyest-thumbnailer.php?file={$xhtml_url}&amp;height={$height}&amp;width={$width}' alt='{$alt}'/>\r\n\t\t\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t\t\t<div class='thumbcaption'>\r\n\t\t\t\t\t\t\t\t\t<div class='gallerylink' style='float:right'><a href='{$gallery_uri}" . "file={$xhtml_url}' class='internal' >\r\n\t\t\t\t\t\t\t\t\t\t<img src='" . get_option('siteurl') . "/wp-content/plugins/lazyest-gallery/images/magnify-clip.png' alt='' />\r\n\t\t\t\t\t\t\t\t\t</a></div>\r\n\t\t\t\t\t\t\t\t\t{$title}\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t</div>";
                if (phpversion() >= 5) {
                    $new_content = str_ireplace("[[image:" . $imgdata . "]]", $url, $new_content);
                } else {
                    $new_content = str_replace("[[Image:" . $imgdata . "]]", $url, $new_content);
                }
            }
        }
        return $new_content;
    }
}
Пример #23
0
        if ($riga->FKEY == "SesName") {
            $data['SesName'] = $riga->VALUE;
        }
    }
    if (!$_REQUEST['edit']) {
        layout($data);
        die;
    } else {
        $postdata['bsession'] = $_REQUEST['bsession'];
        $postdata['bind'] = $_REQUEST['bind'];
        $postdata['bport'] = $_REQUEST['bport'];
        $postdata['directory'] = $_REQUEST['directory'];
        UpdateDb($postdata, $data);
        // sovrascrivo chkdir.bat in modo da forzare una autoconfigurazione al prossimo avvio
        $curdir = getcwd();
        list($phpdir, $installdir) = spliti('\\\\WEBSERVER\\\\HTTPD\\\\setup', $curdir);
        $apachedir = ereg_replace("\\\\", "/", $phpdir);
        $filename = "{$apachedir}/COMMON/script/chkdir.bat";
        $chkdir = "@echo off\r\n\t\tECHO DIRECTORY CHECK\r\n\t\tIF EXIST \"{$phpdir}\\WEBSERVER\\Apache\\conf\fakefile.null\" GOTO fine\r\n\t\tECHO KEYFORUM NEEDS CONFIGURATION\r\n\t\tECHO;\r\n\t\tinstall_keyforum.bat\r\n\t\t:fine\r\n\t\tECHO OK\r\n\t\tECHO;\r\n\t\t";
        $handle = fopen($filename, 'w');
        fwrite($handle, $chkdir);
        fclose($handle);
        echo "<CENTER><b><H3>Board {$_REQUEST['ws']} " . $lang['mngws_updated'] . "</H3></b>";
        echo "<font color=red><b><H3>" . $lang['mngws_reboot'] . "</H3></b></font><br><br></center></body></html>";
    }
}
function layoutws($data = array())
{
    if (!$_REQUEST['lang']) {
        $blanguage = GetUserLanguage();
    } else {
Пример #24
0
<?php

if ($language == 'ru' || $language == 'ua' || $language == 'be' || $language == 'en' || $language == 'de') {
} else {
    $language = 'ru';
}
$lang = parse_ini_file("application/lang/" . $language . ".ini");
$rout = spliti('/', $_SERVER['REQUEST_URI'], 3);
if (isset($message)) {
    echo "\n\t\t<script type='text/javascript'>\n\t\t\talert('" . $message . "');\n\t\t</script>\n\t";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Тест</title>	
	<meta http-equiv="Content-Type" content="charset=UTF-8"/>
	<link rel="stylesheet" type="text/css" href="/css/style.css"/>
	<script type="text/javascript" src="/js/jquery.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			$("#showPortfolio").click(function(){
				$("#portfolio").animate({width:"1024px", opacity:"1"}, 800);
				
			});
		});
	</script>
	
</head>
<body>	
	<div id="container">
Пример #25
0
/**
 * Takes a string representation of a file path (eg. 'path/to/file.ext') and
 * returns that path minus the filename as an array (eg. array('path', 'to') ).
 * 
 * @param $mixedPath a string representation of a file path.
 * @return array of strings representing directory paths.
 */
function getPathArray($mixedPath)
{
    $toReturn = array();
    $matchResult = preg_match('/^[\\\\|\\/]+/', $mixedPath);
    if ($matchResult != 0) {
        $toReturn[] = DS;
        // add / or \ to beginning of path if that is intended.
    }
    $splitPath = spliti('[/\\]', $mixedPath);
    for ($i = 0; $i < count($splitPath) - 1; ++$i) {
        $toReturn[] = $splitPath[$i];
        // add all the directories minus the filename.
    }
    return $toReturn;
}
Пример #26
0
function test_spliti()
{
    $str = "aBBBaCCCADDDaEEEaGGGA";
    $chunks = spliti("a", $str, 5);
    VS($chunks[0], "");
    VS($chunks[1], "BBB");
    VS($chunks[2], "CCC");
    VS($chunks[3], "DDD");
    VS($chunks[4], "EEEaGGGA");
}
Пример #27
0
 /**
  * Function to get relation query for particular module with function name
  * @param <record> $recordId
  * @param <String> $functionName
  * @param Vtiger_Module_Model $relatedModule
  * @return <String>
  */
 public function getRelationQuery($recordId, $functionName, $relatedModule)
 {
     $relatedModuleName = $relatedModule->getName();
     $focus = CRMEntity::getInstance($this->getName());
     $focus->id = $recordId;
     $result = $focus->{$functionName}($recordId, $this->getId(), $relatedModule->getId());
     $query = $result['query'] . ' ' . $this->getSpecificRelationQuery($relatedModuleName);
     $nonAdminQuery = $this->getNonAdminAccessControlQueryForRelation($relatedModuleName);
     //modify query if any module has summary fields, those fields we are displayed in related list of that module
     $relatedListFields = $relatedModule->getConfigureRelatedListFields();
     if ($relatedModuleName == 'Documents') {
         $relatedListFields['filelocationtype'] = 'filelocationtype';
         $relatedListFields['filestatus'] = 'filestatus';
     }
     if (count($relatedListFields) > 0) {
         $currentUser = Users_Record_Model::getCurrentUserModel();
         $queryGenerator = new QueryGenerator($relatedModuleName, $currentUser);
         $queryGenerator->setFields($relatedListFields);
         $selectColumnSql = $queryGenerator->getSelectClauseColumnSQL();
         $newQuery = spliti('FROM', $query);
         $selectColumnSql = 'SELECT DISTINCT vtiger_crmentity.crmid,' . $selectColumnSql;
         $query = $selectColumnSql . ' FROM ' . $newQuery[1];
     }
     if ($nonAdminQuery) {
         $query = appendFromClauseToQuery($query, $nonAdminQuery);
     }
     return $query;
 }
Пример #28
0
 /**
  * Function to update relation query
  * @param <String> $relationQuery
  * @return <String> $updatedQuery
  */
 public function updateQueryWithWhereCondition($relationQuery)
 {
     $condition = '';
     $whereCondition = $this->get("whereCondition");
     $count = count($whereCondition);
     if ($count > 1) {
         $appendAndCondition = true;
     }
     $i = 1;
     foreach ($whereCondition as $fieldName => $fieldValue) {
         $condition .= " {$fieldName} = '{$fieldValue}' ";
         if ($appendAndCondition && $i++ != $count) {
             $condition .= " AND ";
         }
     }
     $pos = stripos($relationQuery, 'where');
     if ($pos) {
         $split = spliti('where', $relationQuery);
         $updatedQuery = $split[0] . ' WHERE ' . $split[1] . ' AND ' . $condition;
     } else {
         $updatedQuery = $relationQuery . ' WHERE ' . $condition;
     }
     return $updatedQuery;
 }
Пример #29
0
	/**
	 * Function to get the list view entries
	 * @param Vtiger_Paging_Model $pagingModel
	 * @return <Array> - Associative array of record id mapped to Vtiger_Record_Model instance.
	 */
	public function getListViewCount()
	{
		$db = PearDatabase::getInstance();

		$queryGenerator = $this->get('query_generator');

		$moduleName = $this->getModule()->get('name');
		$moduleModel = Vtiger_Module_Model::getInstance($moduleName);

		$searchParams = $this->get('search_params');
		if (empty($searchParams)) {
			$searchParams = array();
		}

		$glue = "";
		if (count($queryGenerator->getWhereFields()) > 0 && (count($searchParams)) > 0) {
			$glue = QueryGenerator::$AND;
		}
		$queryGenerator->parseAdvFilterList($searchParams, $glue);

		$searchKey = $this->get('search_key');
		$searchValue = $this->get('search_value');
		$operator = $this->get('operator');
		if (!empty($searchKey)) {
			$queryGenerator->addUserSearchConditions(array('search_field' => $searchKey, 'search_text' => $searchValue, 'operator' => $operator));
		}



		$listQuery = $this->getQuery();
		$sourceModule = $this->get('src_module');
		if (!empty($sourceModule)) {
			if (method_exists($moduleModel, 'getQueryByModuleField')) {
				$overrideQuery = $moduleModel->getQueryByModuleField($sourceModule, $this->get('src_field'), $this->get('src_record'), $listQuery, $this->get('currency_id'));
				if (!empty($overrideQuery)) {
					$listQuery = $overrideQuery;
				}
			}
		}
		$position = stripos($listQuery, ' from ');
		if ($position) {
			$split = spliti(' from ', $listQuery);
			$splitCount = count($split);
			$listQuery = 'SELECT count(*) AS count ';
			for ($i = 1; $i < $splitCount; $i++) {
				$listQuery = $listQuery . ' FROM ' . $split[$i];
			}
		}

		if ($this->getModule()->get('name') == 'Calendar') {
			$listQuery .= ' AND activitytype <> "Emails"';
		}
		$listResult = $db->pquery($listQuery, array());
		return $db->query_result($listResult, 0, 'count');
	}
Пример #30
0
 /**
  * Function to get the list view entries
  * @param Vtiger_Paging_Model $pagingModel
  * @return <Array> - Associative array of record id mapped to Vtiger_Record_Model instance.
  */
 public function getListViewCount()
 {
     $db = PearDatabase::getInstance();
     $listQuery = $this->getQuery();
     $position = stripos($listQuery, 'from');
     if ($position) {
         $split = spliti('from', $listQuery);
         $splitCount = count($split);
         $listQuery = 'SELECT count(*) AS count ';
         for ($i = 1; $i < $splitCount; $i++) {
             $listQuery = $listQuery . ' FROM ' . $split[$i];
         }
     }
     $searchKey = $this->get('search_key');
     $searchValue = $this->get('search_value');
     if (!empty($searchKey) && !empty($searchValue)) {
         $listQuery .= " WHERE {$searchKey} LIKE '{$searchValue}%'";
     }
     $listResult = $db->pquery($listQuery, array());
     return $db->query_result($listResult, 0, 'count');
 }