public function RetrieveCircle($pFocusId, $pCircleId, $pLimit = null) { $friendsTable = $this->_Prefix . $this->_Tablename; $circlesMapTable = $this->_Prefix . 'FriendCirclesMap'; $prepared[] = $pFocusId; $prepared[] = $pCircleId; $query = "\n\t\t\tSELECT SQL_CALC_FOUND_ROWS *\n\t\t\tFROM `{$friendsTable}` AS f, `{$circlesMapTable}` AS c\n\t\t\tWHERE f.`Owner_FK` = ?\n\t\t\tAND f.`Verification` = 1 \n\t\t\tAND c.`Circle_PK` = ?\n\t\t\tAND c.`Friend_FK` = f.`Friend_PK`\n\t\t"; if ($pLimit) { $replacements['start'] = (int) $pLimit['start'] ? $pLimit['start'] : 0; $replacements['step'] = (int) $pLimit['step'] ? $pLimit['step'] : 20; $query .= ' LIMIT %start$s, %step$s '; $query = sprintfn($query, $replacements); } $this->Query($query, $prepared); return true; }
/** * Prepare a string for execution * * This is necessary because PDO doesn't have a method for retrieving post-prepared statements. * For debugging and optimization purposes, we want to be able to keep a list of executed sql statements. * * @access public * @var string $pQuery The SQL query to execute. * @var array $pPrepared Associative array list of prepared values. */ protected function _Prepare($pQuery, $pPrepared = null) { $query = $pQuery; $DBO = $this->GetSys("Database")->Get("DB"); // Start by replacing #_ with the system table prefix if (preg_match('/#__/', $query)) { $query = preg_replace('/#__/', $this->_Prefix, $query); } if (!$pPrepared) { return $query; } // Quote each value, to prevent injection. foreach ($pPrepared as $p => $prepare) { $prepared[$p] = str_replace('%', '%%', $DBO->quote(utf8_encode($prepare))); } // Replace all the %variable$s references first $query = sprintfn($query, $prepared); // Now replace all ? placeholders with a unique identifier $pcount = 0; while (preg_match('/\\?/', $query)) { $query = preg_replace('/\\?/', '@@##AA@@##', $query, 1); } // Now replace all unique placeholders with the value. $pcount = 0; while (preg_match('/@@##AA@@##/', $query)) { $query = preg_replace('/@@##AA@@##/', preg_quote($prepared[$pcount++]), $query, 1); } preg_match('/\\:(\\w+)/', $query, $results); foreach ($results as $r => $result) { list($null, $match) = explode(':', $result); if (!isset($prepared[$match])) { continue; } $query = preg_replace('/:(\\w+)/', $prepared[$match], $query, 1); } return $query; }
public function returnConfig() { $output = sprintfn($this->scheme, makeList($this->params)); return array('output' => rtrim($output) . ';', 'scope' => $this->scope, 'level' => $this->level); }
function postNewsOnSocialNetwork($title, $author, $post_id) { global $blog_settings; $planet_url = $blog_settings->get('planet_url'); // BP_PLANET_URL $post_url = $planet_url . '/?post_id=' . $post_id; $formating = $blog_settings->get('statusnet_post_format'); $textlimit = $blog_settings->get('statusnet_textlimit'); // $title_length = $textlimit - strlen($post_url) - strlen($formating); // $short_title = substr($title,0,$title_length)."..."; $content = sprintfn($formating, array("title" => $title, "author" => $author)); $content_max_length = $textlimit - strlen($post_url) - 4; $short_message = substr($content, 0, $content_max_length) . "..."; $status = $short_message . ' ' . $post_url; if ($blog_settings->get('statusnet_auto_post')) { postToStatusNet($blog_settings->get('statusnet_host'), $blog_settings->get('statusnet_username'), $blog_settings->get('statusnet_password'), $status); } }
/** * @access public * @param string The untranslated string * @param array list of variables to sprintf * @return string */ static function _($pString, $pParams = null) { eval(GLOBALS); $debug = $zApp->Config->GetConfiguration('debug'); $key = str_replace(' ', '_', $pString); $key = strtoupper($key); if (!$key) { return $pString; } $value = $zApp->GetCache('Language', $key); if ($value) { $return = $value; } else { $return = $pString; if ($debug == 'true') { $return = '<span class="untranslated">' . $return . '</span>'; if ($pParams) { $parameters = join(' | ', array_keys($pParams)); $return .= '<span class="untranslated">' . $parameters . '</span>'; } } } if (count($pParams) >= 1) { $return = sprintfn($return, $pParams); if (!$return) { $return = $pString; if ($debug == "true") { $return = '<span class="mistranslated">' . $return . '</span>'; if ($pParams) { $parameters = join(" | ", array_keys($pParams)); $return .= '<span class="mistranslatedp">' . $parameters . '</span>'; } } } } return $return; }