本文整理汇总了PHP中FSS_Helper::dbPrefix方法的典型用法代码示例。如果您正苦于以下问题:PHP FSS_Helper::dbPrefix方法的具体用法?PHP FSS_Helper::dbPrefix怎么用?PHP FSS_Helper::dbPrefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FSS_Helper
的用法示例。
在下文中一共展示了FSS_Helper::dbPrefix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeSQL
function makeSQL($sql)
{
$db = JFactory::getDBO();
$parser = new FSSParser();
$parser->template = $sql;
$user = JFactory::getUser();
$parser->setVar('user_id', $user->id);
$parser->setVar('username', $user->username);
foreach ($this->filter as $filter) {
if (isset($filter->type) && $filter->type == "daterange") {
$replace = 1;
$to = FSS_Input::getString("{$filter->name}_to", $this->getDateRangeTo($filter));
$from = FSS_Input::getString("{$filter->name}_from", $this->getDateRangeFrom($filter));
$find = "{" . $filter->name . "_from}";
$replace = FSSJ3Helper::getEscaped($db, $from);
//$sql = str_replace($find, $replace, $sql);
$parser->SetVar($filter->name . "_from", $replace);
$find = "{" . $filter->name . "_to}";
$replace = FSSJ3Helper::getEscaped($db, $to);
//$sql = str_replace($find, $replace, $sql);
$parser->SetVar($filter->name . "_to", $replace);
// need to filter the column by the date rand selected
} elseif (isset($filter->type) && $filter->type == "date") {
$replace = 1;
$date = FSS_Input::getString("{$filter->name}", date("Y-m-d"));
$find = "{" . $filter->name . "}";
$replace = FSSJ3Helper::getEscaped($db, $date);
$parser->SetVar($filter->name, $replace);
// need to filter the column by the date rand selected
} elseif (isset($filter->type) && $filter->type == "lookup") {
$value = FSS_Input::getString('filter_' . $filter->name, '');
$find = "{" . $filter->name . "}";
if ($value == "") {
//$parser->SetVar($find, "1");
} else {
$replace = " {$filter->field} = '" . FSSJ3Helper::getEscaped($db, $value) . "' ";
//$sql = str_replace($find, $replace, $sql);
$parser->SetVar($filter->name, $replace);
}
} else {
$value = FSS_Input::getString('filter_' . $filter->name, $filter->default);
if (!empty($filter->options) && array_key_exists($value, $filter->options)) {
$option = $filter->options[$value];
$find = "{" . $filter->name . "}";
$replace = $option->value;
} else {
$replace = "";
}
//$sql = str_replace($find, $replace, $sql);
$parser->SetVar($filter->name, $replace);
}
}
foreach ($this->group as $group) {
$find = "{" . $group->name . "}";
$find_disp = "{" . $group->name . "_disp}";
if ($group->type == "dategroup") {
$value = FSS_Input::getString('group_' . $group->name, 'day');
$replace = "DATE({$group->field})";
$replace_disp = "DATE({$group->field})";
switch ($value) {
case 'week':
$replace = "week";
$replace_disp = "CONCAT(YEAR({$group->field}), ' week ', WEEK({$group->field}))";
break;
case 'month':
$replace = "month";
$replace_disp = "CONCAT(MONTHNAME({$group->field}), ' ', YEAR({$group->field}))";
break;
case 'year':
$replace = "year";
$replace_disp = "YEAR({$group->field})";
break;
}
}
//$sql = str_replace($find, $replace, $sql);
//$sql = str_replace($find_disp, $replace_disp, $sql);
$parser->SetVar($group->name, $replace);
$parser->SetVar($group->name . "_disp", $replace_disp);
}
$final_sql = $parser->Parse();
$final_sql = str_replace("#__", FSS_Helper::dbPrefix(), $final_sql);
$this->vars = $parser->vars;
return $final_sql;
}
示例2: RestoreData
function RestoreData(&$data)
{
global $log;
$db = JFactory::getDBO();
/*echo "<pre>";
print_r($data);
echo "<pre>";
exit;*/
foreach ($data as $table => $stuff) {
$tabler = str_replace('jos_', FSS_Helper::dbPrefix(), $table);
//$table =
// auto import of lite module stuff
if (strpos($tabler, "fsf") > 0) {
$tabler = str_replace("fsf", "fss", $tabler);
}
if (strpos($tabler, "fst") > 0) {
$tabler = str_replace("fst", "fss", $tabler);
}
if (array_key_exists('data', $stuff)) {
$qry = "TRUNCATE `{$tabler}`";
$log .= $qry . "\n";
$db->setQuery($qry);
$db->Query();
$log .= "\n\nProcessing table " . $table . " as {$tabler}\n";
$log .= $this->RestoreTableData($tabler, $stuff, true);
}
}
}