function printServiceErrorMsg($errCode, $errMsg = null, $errorImg = "") { if ($errCode == null) { $errCode = 500; } if (is_numeric($errCode)) { $errorMessage = getErrorTitle($errCode); } else { $errorMessage = ""; } if ($errMsg == null) { $errMsg = $errorMessage; } if ($errorImg != null && strlen($errorImg) > 0) { $errorImg = loadMedia($errorImg); } else { $errorImg = loadMedia("images/errors/msg_default.png"); } $arr = array(); $arr['ErrorCode'] = $errCode; $arr['Data'] = $errMsg; $arr['ErrorDescs'] = _replace($errorMessage); $arr['ErrorIcon'] = $errorImg; printServiceData($arr, null, $errCode); }
function getErrorTitle($code) { $err = getErrorList(); if (isset($err[$code])) { if (function_exists("_replace")) { return _replace($err[$code]); } else { $lr = new LogiksReplace(); return $lr->_replace($err[$code]); } } else { return "Unknown Error Code"; } }
function toTitle($s, $process = false) { if ($s == null || strlen($s) <= 0) { return ""; } if ($process) { $s = _replace($s); } $s = str_replace("_", " ", $s); $s = strtolower($s); $s = trim($s); $s = ucwords($s); return $s; }
function logiks_replace($subject) { if (function_exists("_replace")) { return _replace($subject); } elseif (class_exists("LogiksReplace")) { $lr = new LogiksReplace(); return $lr->_replace($subject); } else { $subject = str_replace("#ROOT#", ROOT, $subject); if (defined("SITENAME")) { $subject = str_replace("#SITENAME#", SITENAME, $subject); if (defined("APPS_FOLDER")) { $subject = str_replace("#APPROOT#", APPS_FOLDER . $site . "/", $subject); } } if (defined("THEME_FOLDER")) { if (defined("APPS_THEME")) { $subject = str_replace("#THEME#", THEME_FOLDER . APPS_THEME, $subject); } else { $subject = str_replace("#THEME#", THEME_FOLDER . "default/", $subject); } } } return $subject; }
function Delete($_associate_array) { $_delete_commands = explode(";",$this->DeleteCommand); foreach($_associate_array as $_key=>$_value) { for($i=0;$i<sizeof($_delete_commands);$i++) { $_delete_commands[$i] = _replace("@".$_key,_slash_encode($_value),$_delete_commands[$i]); } } foreach($_delete_commands as $_delete_command) { if (mysql_query($_delete_command,$this->_Link)==false) { return false; } } return true; }
public function test_replace() { $_REQUEST['data'] = 'test data'; $actual = _replace('Something is not fine in the #data#'); $this->assertEquals('Something is not fine in the test data', $actual); }
function _theme(&$panel) { function _commentCompression($str) { $str = preg_replace('/<!-- BEGIN:(.*?) -->.*?<!-- END:\\1 -->/s', '##$1##', $str); $str = preg_replace('/##BEGIN:(.*?)##.*?##END:\\1##/s', '##$1##', $str); return $str; } function _replace($replace, $with, &$inside) { $inside = str_ireplace('<!-- ' . $replace . ' -->', $with, $inside); $inside = str_ireplace('##' . $replace . '##', $with, $inside); } function _include($u, $a) { foreach ($a as $b) { if (file_exists($u . $b)) { ob_start(); include $u . $b; $u = ob_get_contents(); ob_end_clean(); return _commentCompression($u); } } return false; } $current = $panel['current']; if (!$current) { $current = $panel['website']; } $theme = _include('themes/' . $current['opts']['theme'] . '/templates/' . $current['opts']['template'], array(0 => '', 1 => '.php', 2 => '.html', 3 => '.txt')); $page = _include('pages/' . $panel['website']['page'], array(0 => '.php', 1 => '.html', 2 => '.txt')); if (!$page) { $page = _include('pages/' . $current['opts']['missing'], array(0 => '.php', 1 => '.html', 2 => '.txt')); } _replace('content', $page, $theme); $theme = preg_replace('/(href|src)="\\.\\./', '$1="' . 'themes/' . $current['opts']['theme'], $theme); foreach ($panel['html'] as $a => $b) { _replace($a, $b, $theme); } if ($current['opts']) { foreach ($current['opts'] as $a => $b) { if (is_string($b)) { _replace($a, $b, $theme); } } } foreach ($panel['website']['opts'] as $a => $b) { if (is_string($b)) { _replace('site-' . $a, $b, $theme); } } $theme = preg_replace('/(<!--\\s|##).*?(\\s-->|##)/', '', $theme); echo $theme; }
updateUserEnv($mailto); $datax = _replace($data); $a = sendMail($mailto, $subject, $datax, $from, $cc, $bcc); } } } else { //Pear::Mail if ($_POST['mode'] == "bulk") { $email = new EMail(); $a = $email->sendMimeMessageAdvanced($to, $subject, $cc, $bcc, $data, $attach); } else { set_time_limit(0); $to = explode(",", $to); foreach ($to as $mailto) { updateUserEnv($mailto); $datax = _replace($data); $email = new EMail(); $a = $email->sendMimeMessageAdvanced($mailto, $subject, $cc, $bcc, $datax, $attach); } } } if ($a) { if (substr(strtolower($onsuccess), 0, 7) == "http://" || substr(strtolower($onsuccess), 0, 8) == "https://") { header("Location:{$onsuccess}"); } else { echo "<div width=100% align=center><p>{$onsuccess}</p></div>"; } } else { if (substr(strtolower($onerror), 0, 7) == "http://" || substr(strtolower($onerror), 0, 8) == "https://") { header("Location:{$onerror}"); } else {
function parseSQLWhere($where) { if (!is_array($whr)) { $wA = explode(",", $where); } else { $wA = $where; } foreach ($wA as $a1 => $a2) { $a3 = preg_split("/(:[a-zA-Z0-9]+:)/", $a2, -1, PREG_SPLIT_DELIM_CAPTURE); if (!isset($a3[2]) || $a3[2] == null || $a3[2] == "") { $wA[$a1] = "({$a3[0]} IS NULL OR {$a3[0]}='') "; continue; } elseif ($a3[2][0] == "@") { $a3[2] = _replace("#" . substr($a3[2], 1) . "#"); } $wA[$a1] = getRelation(substr($a3[1], 1, strlen($a3[1]) - 2), $a3[0], $a3[2]); } $where = implode(" AND ", $wA); return $where; }