code
stringlengths 12
2.05k
| label_name
stringclasses 5
values | label
int64 0
4
|
---|---|---|
public function getList($location, $features, $etag, $mediatypes) {
$featuresArray = explode(';', $features);
$mediaTypesArray = explode(';', $mediatypes);
try {
return $this->getFilesAndAlbums($location, $featuresArray, $etag, $mediaTypesArray);
} catch (\Exception $exception) {
return $this->jsonError($exception);
}
} | Base | 1 |
public static function delete($id){
return Categories::delete($id);
}
| Base | 1 |
public function __construct(ImageService $imageService, PdfGenerator $pdfGenerator)
{
$this->imageService = $imageService;
$this->pdfGenerator = $pdfGenerator;
} | Base | 1 |
public function addTags($tags) {
$result = false;
$addedTags = array();
foreach ((array) $tags as $tagName) {
if (empty($tagName))
continue;
if (!in_array($tagName, $this->getTags())) { // check for duplicate tag
$tag = new Tags;
$tag->tag = '#' . ltrim($tagName, '#');
$tag->itemId = $this->getOwner()->id;
$tag->type = get_class($this->getOwner());
$tag->taggedBy = Yii::app()->getSuName();
$tag->timestamp = time();
$tag->itemName = $this->getOwner()->name;
if ($tag->save()) {
$this->_tags[] = $tag->tag; // update tag cache
$addedTags[] = $tagName;
$result = true;
} else {
throw new CHttpException(422, 'Failed saving tag due to errors: ' . json_encode($tag->errors));
}
}
}
if ($this->flowTriggersEnabled)
X2Flow::trigger('RecordTagAddTrigger', array(
'model' => $this->getOwner(),
'tags' => $addedTags,
));
return $result;
} | Base | 1 |
private function getCategory()
{
$category = $this->categoryModel->getById($this->request->getIntegerParam('category_id'));
if (empty($category)) {
throw new PageNotFoundException();
}
return $category;
} | Base | 1 |
public function testCanCreateNewResponseWithStatusAndReason()
{
$r = new Response(200);
$r2 = $r->withStatus(201, 'Foo');
$this->assertEquals(200, $r->getStatusCode());
$this->assertEquals('OK', $r->getReasonPhrase());
$this->assertEquals(201, $r2->getStatusCode());
$this->assertEquals('Foo', $r2->getReasonPhrase());
} | Base | 1 |
public function getZipFile($path) {
$filename = basename($path);
// echo "<pre>";
// echo $path."\n";
// echo $filename."\n";
// echo "isFile => ".is_file($path) ? 'isFile' : 'isNoFile'."\n";
// echo "</pre>";
if (is_file($path) || true) {
// Send the file for download!
header("Expires: 0");
header("Cache-Control: must-revalidate");
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=$filename");
header("Content-Description: File Transfer");
@readfile($path);
// Delete the temporary file
unlink($path);
}
} | Base | 1 |
protected function getComment()
{
$comment = $this->commentModel->getById($this->request->getIntegerParam('comment_id'));
if (empty($comment)) {
throw new PageNotFoundException();
}
if (! $this->userSession->isAdmin() && $comment['user_id'] != $this->userSession->getId()) {
throw new AccessForbiddenException();
}
return $comment;
} | Base | 1 |
public function load($id)
{
try {
$select = $this->zdb->select(self::TABLE, 't');
$select->where(self::PK . ' = ' . $id);
$select->join(
array('a' => PREFIX_DB . Adherent::TABLE),
't.' . Adherent::PK . '=a.' . Adherent::PK,
array()
);
//restrict query on current member id if he's not admin nor staff member
if (!$this->login->isAdmin() && !$this->login->isStaff() && !$this->login->isGroupManager()) {
if (!$this->login->isLogged()) {
Analog::log(
'Non-logged-in users cannot load transaction id `' . $id,
Analog::ERROR
);
return false;
}
$select->where
->nest()
->equalTo('a.' . Adherent::PK, $this->login->id)
->or
->equalTo('a.parent_id', $this->login->id)
->unnest()
->and
->equalTo('t.' . self::PK, $id)
;
} else {
$select->where->equalTo(self::PK, $id);
}
$results = $this->zdb->execute($select);
$result = $results->current();
if ($result) {
$this->loadFromRS($result);
return true;
} else {
Analog::log(
'Transaction id `' . $id . '` does not exists',
Analog::WARNING
);
return false;
}
} catch (Throwable $e) {
Analog::log(
'Cannot load transaction form id `' . $id . '` | ' .
$e->getMessage(),
Analog::WARNING
);
throw $e;
}
} | Base | 1 |
protected function curl_get_contents(&$url, $timeout, $redirect_max, $ua, $outfp)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
if ($outfp) {
curl_setopt($ch, CURLOPT_FILE, $outfp);
} else {
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
}
curl_setopt($ch, CURLOPT_LOW_SPEED_LIMIT, 1);
curl_setopt($ch, CURLOPT_LOW_SPEED_TIME, $timeout);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_MAXREDIRS, $redirect_max);
curl_setopt($ch, CURLOPT_USERAGENT, $ua);
$result = curl_exec($ch);
$url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
curl_close($ch);
return $outfp ? $outfp : $result;
} | Base | 1 |
$_fn[] = self::buildCondition($v, ' && ');
}
$fn[] = '('.\implode(' || ', $_fn).')';
break;
case '$where':
if (\is_callable($value)) {
// need implementation
}
break;
default:
$d = '$document';
if (\strpos($key, '.') !== false) {
$keys = \explode('.', $key);
foreach ($keys as $k) {
$d .= '[\''.$k.'\']';
}
} else {
$d .= '[\''.$key.'\']';
}
if (\is_array($value)) {
$fn[] = "\\MongoLite\\UtilArrayQuery::check((isset({$d}) ? {$d} : null), ".\var_export($value, true).')';
} else {
if (is_null($value)) {
$fn[] = "(!isset({$d}))";
} else {
$_value = \var_export($value, true);
$fn[] = "(isset({$d}) && (
is_array({$d}) && is_string({$_value})
? in_array({$_value}, {$d})
: {$d}=={$_value}
)
)";
}
}
}
}
return \count($fn) ? \trim(\implode($concat, $fn)) : 'true';
} | Base | 1 |
private function createSink(StreamInterface $stream, array $options)
{
if (!empty($options['stream'])) {
return $stream;
}
$sink = isset($options['sink'])
? $options['sink']
: fopen('php://temp', 'r+');
return is_string($sink)
? new Psr7\Stream(Psr7\try_fopen($sink, 'r+'))
: Psr7\stream_for($sink);
} | Base | 1 |
public function setLinks($links)
{
$return = $this->setOneToMany($links, Link::class, 'links', 'container');
$this->setType('ctLinks');
return $return;
} | Base | 1 |
public static function access ($grp='4') {
if ( isset($_SESSION['gxsess']['val']['group']) ) {
if($_SESSION['gxsess']['val']['group'] <= $grp) {
return true;
}else{
return false;
}
}
}
| Base | 1 |
public function testPages () {
$this->visitPages ( $this->allPages );
} | Base | 1 |
public static function withQueryValue(UriInterface $uri, $key, $value)
{
$current = $uri->getQuery();
$key = strtr($key, self::$replaceQuery);
if (!$current) {
$result = [];
} else {
$result = [];
foreach (explode('&', $current) as $part) {
if (explode('=', $part)[0] !== $key) {
$result[] = $part;
};
}
}
if ($value !== null) {
$result[] = $key . '=' . strtr($value, self::$replaceQuery);
} else {
$result[] = $key;
}
return $uri->withQuery(implode('&', $result));
} | Base | 1 |
public function testInfoWithoutUrl()
{
$this->assertRequestIsRedirect('info');
} | Base | 1 |
function edit_vendor() {
$vendor = new vendor();
if(isset($this->params['id'])) {
$vendor = $vendor->find('first', 'id =' .$this->params['id']);
assign_to_template(array(
'vendor'=>$vendor
));
}
} | Class | 2 |
function &getAll(&$dbh, $proposalId)
{
$sql = "SELECT *, UNIX_TIMESTAMP(timestamp) AS timestamp FROM package_proposal_votes WHERE pkg_prop_id = ". $dbh->quoteSmart($proposalId) ." ORDER BY timestamp ASC";
$res = $dbh->query($sql);
if (DB::isError($res)) {
return $res;
}
$votes = array();
while ($set = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
$set['reviews'] = unserialize($set['reviews']);
$votes[$set['user_handle']] = new ppVote($set);
}
return $votes;
} | Base | 1 |
function db_properties($table)
{
global $DatabaseType, $DatabaseUsername;
switch ($DatabaseType) {
case 'mysqli':
$result = DBQuery("SHOW COLUMNS FROM $table");
while ($row = db_fetch_row($result)) {
$properties[strtoupper($row['FIELD'])]['TYPE'] = strtoupper($row['TYPE'], strpos($row['TYPE'], '('));
if (!$pos = strpos($row['TYPE'], ','))
$pos = strpos($row['TYPE'], ')');
else
$properties[strtoupper($row['FIELD'])]['SCALE'] = substr($row['TYPE'], $pos + 1);
$properties[strtoupper($row['FIELD'])]['SIZE'] = substr($row['TYPE'], strpos($row['TYPE'], '(') + 1, $pos);
if ($row['NULL'] != '')
$properties[strtoupper($row['FIELD'])]['NULL'] = "Y";
else
$properties[strtoupper($row['FIELD'])]['NULL'] = "N";
}
break;
}
return $properties;
} | Base | 1 |
public static function getHost() {
if (isset($_SERVER['HTTP_HOST'])) {
$site_address = (erLhcoreClassSystem::$httpsMode == true ? 'https:' : 'http:') . '//' . $_SERVER['HTTP_HOST'] ;
} else if (class_exists('erLhcoreClassInstance')) {
$site_address = 'https://' . erLhcoreClassInstance::$instanceChat->address . '.' . erConfigClassLhConfig::getInstance()->getSetting( 'site', 'seller_domain');
} else if (class_exists('erLhcoreClassExtensionLhcphpresque')) {
$site_address = erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionLhcphpresque')->settings['site_address'];
} else {
$site_address = '';
}
return $site_address;
} | Class | 2 |
public function actionHideWidget() {
if (isset($_POST['name'])) {
$name = $_POST['name'];
$layout = Yii::app()->params->profile->getLayout();
// the widget could be in any of the blocks in the page, so check all of them
foreach ($layout as $b => &$block) {
if (isset($block[$name])) {
if ($b == 'right') {
$layout['hiddenRight'][$name] = $block[$name];
} else {
$layout['hidden'][$name] = $block[$name];
}
unset($block[$name]);
Yii::app()->params->profile->saveLayout($layout);
break;
}
}
// make a list of hidden widgets, using <li>, to send back to the browser
$list = "";
foreach ($layout['hidden'] as $name => $widget) {
$list .= "<li><span class=\"x2-widget-menu-item\" id=\"$name\">{$widget['title']}</span></li>";
}
foreach ($layout['hiddenRight'] as $name => $widget) {
$list .= "<li><span class=\"x2-widget-menu-item right\" id=\"$name\">{$widget['title']}</span></li>";
}
echo Yii::app()->params->profile->getWidgetMenu();
}
} | Base | 1 |
public function disable()
{
$this->checkCSRFParam();
$project = $this->getProject();
$swimlane_id = $this->request->getIntegerParam('swimlane_id');
if ($this->swimlaneModel->disable($project['id'], $swimlane_id)) {
$this->flash->success(t('Swimlane updated successfully.'));
} else {
$this->flash->failure(t('Unable to update this swimlane.'));
}
$this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
} | Base | 1 |
public function saveConfig() {
if (!empty($this->params['aggregate']) || !empty($this->params['pull_rss'])) {
if ($this->params['order'] == 'rank ASC') {
expValidator::failAndReturnToForm(gt('User defined ranking is not allowed when aggregating or pull RSS data feeds.'), $this->params);
}
}
parent::saveConfig();
} | Base | 1 |
public static function makeConfig ($file) {
$config = "<?php if(!defined('GX_LIB')) die(\"Direct Access Not Allowed!\");
/**
* GeniXCMS - Content Management System
*
* PHP Based Content Management System and Framework
*
* @package GeniXCMS
* @since 0.0.1 build date 20140925
* @version 0.0.1
* @link https://github.com/semplon/GeniXCMS
* @author Puguh Wijayanto (www.metalgenix.com)
* @copyright 2014-2015 Puguh Wijayanto
* @license http://www.opensource.org/licenses/mit-license.php MIT
*
*/
// DB CONFIG
define('DB_HOST', '".Session::val('dbhost')."');
define('DB_NAME', '".Session::val('dbname')."');
define('DB_PASS', '".Session::val('dbpass')."');
define('DB_USER', '".Session::val('dbuser')."');
define('DB_DRIVER', 'mysqli');
define('THEME', 'default');
define('GX_LANG', 'english');
define('SMART_URL', false); //set 'true' if you want use SMART URL (SEO Friendly URL)
define('GX_URL_PREFIX', '.html');
define('SECURITY', '".Typo::getToken(200)."'); // for security purpose, will be used for creating password
";
try{
$f = fopen($file, "w");
$c = fwrite($f, $config);
fclose($f);
}catch (Exception $e) {
echo $e->getMessage();
}
return $config;
} | Base | 1 |
public function getQueryGroupby()
{
$R1 = 'R1_' . $this->id;
$R2 = 'R2_' . $this->id;
return "$R2.value";
} | Base | 1 |
private function getCategory()
{
$category = $this->categoryModel->getById($this->request->getIntegerParam('category_id'));
if (empty($category)) {
throw new PageNotFoundException();
}
return $category;
} | Base | 1 |
addChangeLogEntry($request["logid"], NULL, unixToDatetime($end),
$request['start'], NULL, NULL, 0);
return array('status' => 'error',
'errorcode' => 44,
'errormsg' => 'concurrent license restriction');
} | Class | 2 |
echo apply_filters( 'atom_enclosure', '<link href="' . trim( htmlspecialchars( $enclosure[0] ) ) . '" rel="enclosure" length="' . trim( $enclosure[1] ) . '" type="' . trim( $enclosure[2] ) . '" />' . "\n" );
}
} | Base | 1 |
public function confirm()
{
$task = $this->getTask();
$link_id = $this->request->getIntegerParam('link_id');
$link = $this->taskExternalLinkModel->getById($link_id);
if (empty($link)) {
throw new PageNotFoundException();
}
$this->response->html($this->template->render('task_external_link/remove', array(
'link' => $link,
'task' => $task,
)));
} | Base | 1 |
public function manage() {
expHistory::set('viewable', $this->params);
$page = new expPaginator(array(
'model'=>'order_status',
'where'=>1,
'limit'=>10,
'order'=>'rank',
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->params['controller'],
'action'=>$this->params['action'],
//'columns'=>array('Name'=>'title')
));
assign_to_template(array(
'page'=>$page
));
} | Base | 1 |
$contents[] = ['class' => 'text-center', 'text' => tep_draw_bootstrap_button(IMAGE_SAVE, 'fas fa-save', null, 'primary', null, 'btn-success xxx text-white mr-2') . tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-times', tep_href_link('countries.php', 'page=' . $_GET['page']), null, null, 'btn-light')]; | Base | 1 |
public static function insert($vars) {
if(is_array($vars)) {
$slug = Typo::slugify($vars['title']);
$vars = array_merge($vars, array('slug' => $slug));
//print_r($vars);
$ins = array(
'table' => 'options',
'key' => $vars
);
$post = Db::insert($ins);
}
return $post;
} | Base | 1 |
public function Quit($close_on_error = true) {
$this->error = null; // so there is no confusion
if(!$this->connected()) {
$this->error = array(
"error" => "Called Quit() without being connected");
return false;
}
// send the quit command to the server
fputs($this->smtp_conn,"quit" . $this->CRLF);
// get any good-bye messages
$byemsg = $this->get_lines();
if($this->do_debug >= 2) {
$this->edebug("SMTP -> FROM SERVER:" . $byemsg . $this->CRLF . '<br />');
}
$rval = true;
$e = null;
$code = substr($byemsg,0,3);
if($code != 221) {
// use e as a tmp var cause Close will overwrite $this->error
$e = array("error" => "SMTP server rejected quit command",
"smtp_code" => $code,
"smtp_rply" => substr($byemsg,4));
$rval = false;
if($this->do_debug >= 1) {
$this->edebug("SMTP -> ERROR: " . $e["error"] . ": " . $byemsg . $this->CRLF . '<br />');
}
}
if(empty($e) || $close_on_error) {
$this->Close();
}
return $rval;
} | Class | 2 |
public static function rpc ($url) {
new Pinger();
//require_once( GX_LIB.'/Vendor/IXR_Library.php' );
$url = 'http://'.$url;
$client = new IXR_Client( $url );
$client->timeout = 3;
$client->useragent .= ' -- PingTool/1.0.0';
$client->debug = false;
if( $client->query( 'weblogUpdates.extendedPing', self::$myBlogName, self::$myBlogUrl, self::$myBlogUpdateUrl, self::$myBlogRSSFeedUrl ) )
{
return $client->getResponse();
}
//echo 'Failed extended XML-RPC ping for "' . $url . '": ' . $client->getErrorCode() . '->' . $client->getErrorMessage() . '<br />';
if( $client->query( 'weblogUpdates.ping', self::$myBlogName, self::$myBlogUrl ) )
{
return $client->getResponse();
}
//echo 'Failed basic XML-RPC ping for "' . $url . '": ' . $client->getErrorCode() . '->' . $client->getErrorMessage() . '<br />';
return false;
}
| Base | 1 |
unset($return[$key]);
}
}
break;
}
return @array_change_key_case($return, CASE_UPPER);
} | Base | 1 |
function import() {
$pullable_modules = expModules::listInstalledControllers($this->baseclassname);
$modules = new expPaginator(array(
'records' => $pullable_modules,
'controller' => $this->loc->mod,
'action' => $this->params['action'],
'order' => isset($this->params['order']) ? $this->params['order'] : 'section',
'dir' => isset($this->params['dir']) ? $this->params['dir'] : '',
'page' => (isset($this->params['page']) ? $this->params['page'] : 1),
'columns' => array(
gt('Title') => 'title',
gt('Page') => 'section'
),
));
assign_to_template(array(
'modules' => $modules,
));
}
| Class | 2 |
public function activate_discount(){
if (isset($this->params['id'])) {
$discount = new discounts($this->params['id']);
$discount->update($this->params);
//if ($discount->discountulator->hasConfig() && empty($discount->config)) {
//flash('messages', $discount->discountulator->name().' requires configuration. Please do so now.');
//redirect_to(array('controller'=>'billing', 'action'=>'configure', 'id'=>$discount->id));
//}
}
expHistory::back();
} | Class | 2 |
public function setHeadItemAttributes( $attributes ) {
$this->headItemAttributes = \Sanitizer::fixTagAttributes( $attributes, 'li' );
} | Class | 2 |
public function skip($value)
{
return $this->offset($value);
} | Base | 1 |
recyclebin::sendToRecycleBin($loc, $parent);
//FIXME if we delete the module & sectionref the module completely disappears
// if (class_exists($secref->module)) {
// $modclass = $secref->module;
// //FIXME: more module/controller glue code
// if (expModules::controllerExists($modclass)) {
// $modclass = expModules::getControllerClassName($modclass);
// $mod = new $modclass($loc->src);
// $mod->delete_instance();
// } else {
// $mod = new $modclass();
// $mod->deleteIn($loc);
// }
// }
}
// $db->delete('sectionref', 'section=' . $parent);
$db->delete('section', 'parent=' . $parent);
}
| Base | 1 |
public function backup($type='json')
{
global $DB;
global $website;
$out = array();
$DB->query('
SELECT * FROM nv_comments
WHERE website = '.protect($website->id),
'object'
);
$out = $DB->result();
if($type='json')
$out = json_encode($out);
return $out;
}
| Base | 1 |
public function __construct() {
}
| Base | 1 |
$link = str_replace(URL_FULL, '', makeLink(array('section' => $section->id)));
| Class | 2 |
$files[$key]->save();
}
// eDebug($files,true);
} | Base | 1 |
$src = substr($ref->source, strlen($prefix)) . $section->id;
if (call_user_func(array($ref->module, 'hasContent'))) {
$oloc = expCore::makeLocation($ref->module, $ref->source);
$nloc = expCore::makeLocation($ref->module, $src);
if ($ref->module != "container") {
call_user_func(array($ref->module, 'copyContent'), $oloc, $nloc);
} else {
call_user_func(array($ref->module, 'copyContent'), $oloc, $nloc, $section->id);
}
}
}
| Base | 1 |
public static function dropdown($vars) {
if(is_array($vars)){
//print_r($vars);
$name = $vars['name'];
$where = "WHERE ";
if(isset($vars['parent'])) {
$where .= " `parent` = '{$vars['parent']}' ";
}else{
$where .= "1 ";
}
$order_by = "ORDER BY ";
if(isset($vars['order_by'])) {
$order_by .= " {$vars['order_by']} ";
}else{
$order_by .= " `name` ";
}
if (isset($vars['sort'])) {
$sort = " {$vars['sort']}";
}
}
$cat = Db::result("SELECT * FROM `cat` {$where} {$order_by} {$sort}");
$drop = "<select name=\"{$name}\" class=\"form-control\"><option></option>";
if(Db::$num_rows > 0 ){
foreach ($cat as $c) {
# code...
if($c->parent == ''){
if(isset($vars['selected']) && $c->id == $vars['selected']) $sel = "SELECTED"; else $sel = "";
$drop .= "<option value=\"{$c->id}\" $sel style=\"padding-left: 10px;\">{$c->name}</option>";
foreach ($cat as $c2) {
# code...
if($c2->parent == $c->id){
if(isset($vars['selected']) && $c2->id == $vars['selected']) $sel = "SELECTED"; else $sel = "";
$drop .= "<option value=\"{$c2->id}\" $sel style=\"padding-left: 10px;\"> {$c2->name}</option>";
}
}
}
}
}
$drop .= "</select>";
return $drop;
} | Compound | 4 |
public function testGetEventsPublicProfile(){
TestingAuxLib::loadX2NonWebUser ();
TestingAuxLib::suLogin ('testuser');
Yii::app()->settings->historyPrivacy = null;
$lastEventId=0;
$lastTimestamp=0;
$myProfile = Profile::model()->findByAttributes(array('username' => 'testuser2'));
$events=Events::getEvents(
$lastEventId,$lastTimestamp,null,$myProfile, false);
$this->assertEquals (
array_map (
function ($event) { return $event->id; },
Events::model ()->findAllByAttributes (array (
'user' => 'testuser2',
'visibility' => 1
))
),
array_map (function ($event) { return $event->id; }, $events['events']));
TestingAuxLib::restoreX2WebUser ();
} | Base | 1 |
function captureAuthorization() {
//eDebug($this->params,true);
$order = new order($this->params['id']);
/*eDebug($this->params);
//eDebug($order,true);*/
//eDebug($order,true);
//$billing = new billing();
//eDebug($billing, true);
//$billing->calculator = new $calcname($order->billingmethod[0]->billingcalculator_id);
$calc = $order->billingmethod[0]->billingcalculator->calculator;
$calc->config = $order->billingmethod[0]->billingcalculator->config;
//$calc = new $calc-
//eDebug($calc,true);
if (!method_exists($calc, 'delayed_capture')) {
flash('error', gt('The Billing Calculator does not support delayed capture'));
expHistory::back();
}
$result = $calc->delayed_capture($order->billingmethod[0], $this->params['capture_amt'], $order);
if (empty($result->errorCode)) {
flash('message', gt('The authorized payment was successfully captured'));
expHistory::back();
} else {
flash('error', gt('An error was encountered while capturing the authorized payment.') . '<br /><br />' . $result->message);
expHistory::back();
}
} | Base | 1 |
public function behaviors() {
return array_merge(parent::behaviors(),array(
'X2LinkableBehavior'=>array(
'class'=>'X2LinkableBehavior',
'module'=>'marketing'
),
'ERememberFiltersBehavior' => array(
'class'=>'application.components.ERememberFiltersBehavior',
'defaults'=>array(),
'defaultStickOnClear'=>false
)
));
} | Class | 2 |
function ttValidDate($val)
{
$val = trim($val);
if (strlen($val) == 0)
return false;
// This should accept a string in format 'YYYY-MM-DD', 'MM/DD/YYYY', 'DD-MM-YYYY', 'DD.MM.YYYY', or 'DD.MM.YYYY whatever'.
if (!preg_match('/^\d\d\d\d-\d\d-\d\d$/', $val) &&
!preg_match('/^\d\d\/\d\d\/\d\d\d\d$/', $val) &&
!preg_match('/^\d\d\-\d\d\-\d\d\d\d$/', $val) &&
!preg_match('/^\d\d\.\d\d\.\d\d\d\d$/', $val) &&
!preg_match('/^\d\d\.\d\d\.\d\d\d\d .+$/', $val))
return false;
return true;
} | Base | 1 |
$src = substr($ref->source, strlen($prefix)) . $section->id;
if (call_user_func(array($ref->module, 'hasContent'))) {
$oloc = expCore::makeLocation($ref->module, $ref->source);
$nloc = expCore::makeLocation($ref->module, $src);
if ($ref->module != "container") {
call_user_func(array($ref->module, 'copyContent'), $oloc, $nloc);
} else {
call_user_func(array($ref->module, 'copyContent'), $oloc, $nloc, $section->id);
}
}
}
| Class | 2 |
public static function makeConfig ($file) {
$config = "<?php if(!defined('GX_LIB')) die(\"Direct Access Not Allowed!\");
/**
* GeniXCMS - Content Management System
*
* PHP Based Content Management System and Framework
*
* @package GeniXCMS
* @since 0.0.1 build date 20140925
* @version 0.0.1
* @link https://github.com/semplon/GeniXCMS
* @author Puguh Wijayanto (www.metalgenix.com)
* @copyright 2014-2015 Puguh Wijayanto
* @license http://www.opensource.org/licenses/mit-license.php MIT
*
*/
// DB CONFIG
define('DB_HOST', '".Session::val('dbhost')."');
define('DB_NAME', '".Session::val('dbname')."');
define('DB_PASS', '".Session::val('dbpass')."');
define('DB_USER', '".Session::val('dbuser')."');
define('DB_DRIVER', 'mysqli');
define('THEME', 'default');
define('GX_LANG', 'english');
define('SMART_URL', false); //set 'true' if you want use SMART URL (SEO Friendly URL)
define('GX_URL_PREFIX', '.html');
define('SECURITY', '".Typo::getToken(200)."'); // for security purpose, will be used for creating password
";
try{
$f = fopen($file, "w");
$c = fwrite($f, $config);
fclose($f);
}catch (Exception $e) {
echo $e->getMessage();
}
return $config;
} | Base | 1 |
public function get_view_config() {
global $template;
// set paths we will search in for the view
$paths = array(
BASE.'themes/'.DISPLAY_THEME.'/modules/common/views/file/configure',
BASE.'framework/modules/common/views/file/configure',
);
foreach ($paths as $path) {
$view = $path.'/'.$this->params['view'].'.tpl';
if (is_readable($view)) {
if (bs(true)) {
$bstrapview = $path.'/'.$this->params['view'].'.bootstrap.tpl';
if (file_exists($bstrapview)) {
$view = $bstrapview;
}
}
if (bs3(true)) {
$bstrapview = $path.'/'.$this->params['view'].'.bootstrap3.tpl';
if (file_exists($bstrapview)) {
$view = $bstrapview;
}
}
$template = new controllertemplate($this, $view);
$ar = new expAjaxReply(200, 'ok');
$ar->send();
}
}
} | Base | 1 |
public function sdm_save_thumbnail_meta_data($post_id) { // Save Thumbnail Upload metabox
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
return;
if (!isset($_POST['sdm_thumbnail_box_nonce_check']) || !wp_verify_nonce($_POST['sdm_thumbnail_box_nonce_check'], 'sdm_thumbnail_box_nonce'))
return;
if (isset($_POST['sdm_upload_thumbnail'])) {
update_post_meta($post_id, 'sdm_upload_thumbnail', $_POST['sdm_upload_thumbnail']);
}
} | Base | 1 |
function scan($dir, $filter = '') {
$path = FM_ROOT_PATH.'/'.$dir;
$ite = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));
$rii = new RegexIterator($ite, "/(".$filter.")/i");
$files = array();
foreach ($rii as $file) {
if (!$file->isDir()) {
$fileName = $file->getFilename();
$location = str_replace(FM_ROOT_PATH, '', $file->getPath());
$files[] = array(
"name" => $fileName,
"type" => "file",
"path" => $location,
);
}
}
return $files;
} | Base | 1 |
protected function getFile()
{
$task_id = $this->request->getIntegerParam('task_id');
$file_id = $this->request->getIntegerParam('file_id');
$model = 'projectFileModel';
if ($task_id > 0) {
$model = 'taskFileModel';
$project_id = $this->taskFinderModel->getProjectId($task_id);
if ($project_id !== $this->request->getIntegerParam('project_id')) {
throw new AccessForbiddenException();
}
}
$file = $this->$model->getById($file_id);
if (empty($file)) {
throw new PageNotFoundException();
}
$file['model'] = $model;
return $file;
} | Class | 2 |
public static function update_object_score($object, $object_id)
{
global $DB;
list($votes, $score) = webuser_vote::calculate_object_score($object, $object_id);
$table = array(
'item' => 'nv_items',
'structure' => 'nv_structure',
'product' => 'nv_products'
);
if(empty($table[$object]))
return false;
$DB->execute('
UPDATE '.$table[$object].'
SET votes = '.protect($votes).',
score = '.protect($score).'
WHERE id = '.protect($object_id)
);
return true;
}
| Base | 1 |
public static function sitemap() {
switch (SMART_URL) {
case true:
# code...
$url = Options::get('siteurl')."/sitemap".GX_URL_PREFIX;
break;
default:
# code...
$url = Options::get('siteurl')."/index.php?page=sitemap";
break;
}
return $url;
} | Compound | 4 |
public static function onLoadExtensionSchemaUpdates( DatabaseUpdater $updater ) {
$config = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 'globalnewfiles' );
if ( $config->get( 'CreateWikiDatabase' ) === $config->get( 'DBname' ) ) {
$updater->addExtensionTable(
'gnf_files',
__DIR__ . '/../sql/gnf_files.sql'
);
$updater->modifyExtensionField(
'gnf_files',
'files_timestamp',
__DIR__ . '/../sql/patches/patch-gnf_files-binary.sql'
);
$updater->modifyTable(
'gnf_files',
__DIR__ . '/../sql/patches/patch-gnf_files-add-indexes.sql',
true
);
}
return true;
} | Class | 2 |
public function merge($branch, $options = NULL)
{
$this->run('merge', $options, $branch);
return $this;
} | Class | 2 |
function change_pass()
{
global $txp_user;
extract(psa(array('new_pass', 'mail_password')));
if (empty($new_pass)) {
author_list(array(gTxt('password_required'), E_ERROR));
return;
}
$rs = change_user_password($txp_user, $new_pass);
if ($rs) {
$message = gTxt('password_changed');
if ($mail_password) {
$email = fetch('email', 'txp_users', 'name', $txp_user);
send_new_password($new_pass, $email, $txp_user);
$message .= sp.gTxt('and_mailed_to').sp.$email;
}
$message .= '.';
author_list($message);
}
} | Base | 1 |
public static function getHelpVersionId($version) {
global $db;
return $db->selectValue('help_version', 'id', 'version="'.$version.'"');
} | Base | 1 |
protected function assertCsvUploaded($csv) {
$uploadedPath = implode(DIRECTORY_SEPARATOR, array(
Yii::app()->basePath,
'data',
'data.csv'
));
$this->assertFileExists ($uploadedPath);
$this->assertFileEquals ($csv, $uploadedPath);
} | Base | 1 |
public function __invoke(Request $request)
{
$this->authorize('manage modules');
$response = ModuleInstaller::upload($request);
return response()->json($response);
} | Base | 1 |
function searchByModelForm() {
// get the search terms
$terms = $this->params['search_string'];
$sql = "model like '%" . $terms . "%'";
$limit = !empty($this->config['limit']) ? $this->config['limit'] : 10;
$page = new expPaginator(array(
'model' => 'product',
'where' => $sql,
'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit,
'order' => 'title',
'dir' => 'DESC',
'page' => (isset($this->params['page']) ? $this->params['page'] : 1),
'controller' => $this->params['controller'],
'action' => $this->params['action'],
'columns' => array(
gt('Model #') => 'model',
gt('Product Name') => 'title',
gt('Price') => 'base_price'
),
));
assign_to_template(array(
'page' => $page,
'terms' => $terms
));
} | Class | 2 |
public function params()
{
$project = $this->getProject();
$values = $this->request->getValues();
if (empty($values['action_name']) || empty($values['project_id']) || empty($values['event_name'])) {
$this->create();
return;
}
$action = $this->actionManager->getAction($values['action_name']);
$action_params = $action->getActionRequiredParameters();
if (empty($action_params)) {
$this->doCreation($project, $values + array('params' => array()));
}
$projects_list = $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId());
unset($projects_list[$project['id']]);
$this->response->html($this->template->render('action_creation/params', array(
'values' => $values,
'action_params' => $action_params,
'columns_list' => $this->columnModel->getList($project['id']),
'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id']),
'projects_list' => $projects_list,
'colors_list' => $this->colorModel->getList(),
'categories_list' => $this->categoryModel->getList($project['id']),
'links_list' => $this->linkModel->getList(0, false),
'priorities_list' => $this->projectTaskPriorityModel->getPriorities($project),
'project' => $project,
'available_actions' => $this->actionManager->getAvailableActions(),
'swimlane_list' => $this->swimlaneModel->getList($project['id']),
'events' => $this->actionManager->getCompatibleEvents($values['action_name']),
)));
} | Class | 2 |
$links[] = CHtml::link(CHtml::encode($tag->tag),array('/search/search','term'=>CHtml::encode($tag->tag))); | Base | 1 |
public function actionView($id) {
$model = CActiveRecord::model('Docs')->findByPk($id);
if (!$this->checkPermissions($model, 'view')) $this->denied ();
if(isset($model)){
$permissions=explode(", ",$model->editPermissions);
if(in_array(Yii::app()->user->getName(),$permissions))
$editFlag=true;
else
$editFlag=false;
}
//echo $model->visibility;exit;
if (!isset($model) ||
!(($model->visibility==1 ||
($model->visibility==0 && $model->createdBy==Yii::app()->user->getName())) ||
Yii::app()->params->isAdmin|| $editFlag))
$this->redirect(array('/docs/docs/index'));
// add doc to user's recent item list
User::addRecentItem('d', $id, Yii::app()->user->getId());
X2Flow::trigger('RecordViewTrigger',array('model'=>$model));
$this->render('view', array(
'model' => $model,
));
} | Class | 2 |
public function getMovieData($id){
$getMovie = $this->getMovie($id);
$getCast = $this->getCast($id);
$getImage = $this->getImage($id);
$data = array_merge($getMovie, $getCast);
$data = array_merge($data, $getImage);
return $data;
}
| Base | 1 |
$arcs['create']['application/x-rar'] = array('cmd' => ELFINDER_RAR_PATH, 'argc' => 'a -inul' . (defined('ELFINDER_RAR_MA4') && ELFINDER_RAR_MA4? ' -ma4' : ''), 'ext' => 'rar'); | Base | 1 |
public function testRedirectLinkGeneration () {
Yii::app()->controller = new MarketingController (
'campaign', new MarketingModule ('campaign', null));
$_SERVER['SERVER_NAME'] = 'localhost';
$cmb = $this->instantiate();
$contact = $this->contacts('testUser_unsent');
$campaign = $this->campaign('redirectLinkGeneration');
$url = preg_replace ('/^[^"]*"([^"]*)".*$/', '$1', $campaign->content);
list($subject,$message,$uniqueId) = $cmb->prepareEmail(
$this->campaign('redirectLinkGeneration'),
$contact,$this->listItem('testUser_unsent')->emailAddress);
$this->assertRegExp ('/'.preg_quote (urlencode ($url)).'/', $message);
} | Base | 1 |
$ul->appendChild(new XMLElement('li', $s->get('navigation_group')));
$groups[] = $s->get('navigation_group');
} | Base | 1 |
public function getDisplayName ($plural=true) {
return Yii::t('calendar', 'Calendar');
} | Base | 1 |
public function approve_toggle() {
global $history;
if (empty($this->params['id'])) return;
/* The global constants can be overriden by passing appropriate params */
//sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
$require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];
$require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];
$require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];
$notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];
$simplenote = new expSimpleNote($this->params['id']);
$simplenote->approved = $simplenote->approved == 1 ? 0 : 1;
$simplenote->save();
$lastUrl = makelink($history->history[$history->history['lasts']['type']][count($history->history[$history->history['lasts']['type']])-1]['params']);
if (!empty($this->params['tab']))
{
$lastUrl .= "#".$this->params['tab'];
}
redirect_to($lastUrl);
} | Base | 1 |
function phpAds_SessionStart()
{
global $session;
if (empty($_COOKIE['sessionID'])) {
$session = array();
$_COOKIE['sessionID'] = md5(uniqid('phpads', 1));
phpAds_SessionSetAdminCookie('sessionID', $_COOKIE['sessionID']);
}
return $_COOKIE['sessionID'];
} | Compound | 4 |
protected function _unpack($path, $arc) {
die('Not yet implemented. (_unpack)');
return false;
} | Base | 1 |
public function enableCurrency(TransactionCurrency $currency)
{
app('preferences')->mark();
$this->repository->enable($currency);
session()->flash('success', (string) trans('firefly.currency_is_now_enabled', ['name' => $currency->name]));
Log::channel('audit')->info(sprintf('Enabled currency %s.', $currency->code));
return redirect(route('currencies.index'));
} | Compound | 4 |
self::removeLevel($kid->id);
}
}
| Base | 1 |
public static function available($username, $website_id)
{
global $DB;
// remove spaces and make username lowercase (only to compare case insensitive)
$username = trim($username);
$username = mb_strtolower($username);
$data = NULL;
if($DB->query('SELECT COUNT(*) as total
FROM nv_webusers
WHERE LOWER(username) = '.protect($username).'
AND website = '.$website_id))
{
$data = $DB->first();
}
return ($data->total <= 0);
}
| Base | 1 |
public function authenticate($website, $username, $password)
{
global $DB;
global $events;
$username = trim($username);
$username = mb_strtolower($username);
$A1 = md5($username.':'.APP_REALM.':'.$password);
$website_check = '';
if($website > 0)
$website_check = 'AND website = '.protect($website);
if($DB->query('SELECT *
FROM nv_webusers
WHERE ( access = 0 OR
(access = 2 AND
(access_begin = 0 OR access_begin < '.time().') AND
(access_end = 0 OR access_end > '.time().')
)
)
'.$website_check.'
AND LOWER(username) = '.protect($username))
)
{
$data = $DB->result();
if(!empty($data))
{
if($data[0]->password==$A1)
{
$this->load_from_resultset($data);
// maybe this function is called without initializing $events
if(method_exists($events, 'trigger'))
{
$events->trigger(
'webuser',
'sign_in',
array(
'webuser' => $this,
'by' => 'authenticate'
)
);
}
return true;
}
}
}
return false;
}
| Base | 1 |
return $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3'] : ($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3())) && false ?: '_'}); | Base | 1 |
public function __toString()
{
return self::createUriString(
$this->scheme,
$this->getAuthority(),
$this->getPath(),
$this->query,
$this->fragment
);
} | Base | 1 |
public function shouldRun(DateTime $date)
{
global $timedate;
$runDate = clone $date;
$this->handleTimeZone($runDate);
$cron = Cron\CronExpression::factory($this->schedule);
if (empty($this->last_run) && $cron->isDue($runDate)) {
return true;
}
$lastRun = $this->last_run ? $timedate->fromDb($this->last_run) : $timedate->fromDb($this->date_entered);
$this->handleTimeZone($lastRun);
$next = $cron->getNextRunDate($lastRun);
return $next <= $runDate;
} | Class | 2 |
public function delete() {
global $db;
/* The global constants can be overriden by passing appropriate params */
//sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];
// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];
// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];
// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];
if (empty($this->params['id'])) {
flash('error', gt('Missing id for the comment you would like to delete'));
expHistory::back();
}
// delete the comment
$comment = new expComment($this->params['id']);
$comment->delete();
// delete the association too
$db->delete($comment->attachable_table, 'expcomments_id='.$this->params['id']);
// send the user back where they came from.
expHistory::back();
} | Class | 2 |
$description = "User (" . $this->User->id . "): " . $this->Auth->user('email');
$fieldsResult = "Password changed.";
}
// query
$this->Log = ClassRegistry::init('Log');
$this->Log->create();
$this->Log->save(array(
'org' => $this->Auth->user('Organisation')['name'],
'model' => $model,
'model_id' => $modelId,
'email' => $this->Auth->user('email'),
'action' => $action,
'title' => $description,
'change' => isset($fieldsResult) ? $fieldsResult : ''));
// write to syslogd as well
App::import('Lib', 'SysLog.SysLog');
$syslog = new SysLog();
if (isset($fieldsResult) && $fieldsResult) {
$syslog->write('notice', $description . ' -- ' . $action . ' -- ' . $fieldsResult);
} else {
$syslog->write('notice', $description . ' -- ' . $action);
}
} | Class | 2 |
form_selectable_cell('<a class="linkEditMain" href="' . html_escape('automation_networks.php?action=edit&id=' . $network['id']) . '">' . $network['name'] . '</a>', $network['id']);
form_selectable_cell($network['data_collector'], $network['id']);
form_selectable_cell($sched_types[$network['sched_type']], $network['id']);
form_selectable_cell(number_format_i18n($network['total_ips']), $network['id'], '', 'text-align:right;');
form_selectable_cell($mystat, $network['id'], '', 'text-align:right;');
form_selectable_cell($progress, $network['id'], '', 'text-align:right;');
form_selectable_cell(number_format_i18n($updown['up']) . '/' . number_format_i18n($updown['snmp']), $network['id'], '', 'text-align:right;');
form_selectable_cell(number_format_i18n($network['threads']), $network['id'], '', 'text-align:right;');
form_selectable_cell(round($network['last_runtime'],2), $network['id'], '', 'text-align:right;');
form_selectable_cell($network['enabled'] == '' || $network['sched_type'] == '1' ? __('N/A'):($network['next_start'] == '0000-00-00 00:00:00' ? substr($network['start_at'],0,16):substr($network['next_start'],0,16)), $network['id'], '', 'text-align:right;');
form_selectable_cell($network['last_started'] == '0000-00-00 00:00:00' ? 'Never':substr($network['last_started'],0,16), $network['id'], '', 'text-align:right;');
form_checkbox_cell($network['name'], $network['id']);
form_end_row();
}
} else { | Base | 1 |
$contents[] = ['class' => 'text-center', 'text' => tep_draw_bootstrap_button(IMAGE_SAVE, 'fas fa-save', null, 'primary', null, 'btn-success xxx text-white mr-2') . tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-times', tep_href_link('customer_data_groups.php', 'page=' . $_GET['page']), null, null, 'btn-light')]; | Base | 1 |
public function beforeFilter()
{
parent::beforeFilter();
$this->Security->unlockedActions = array_merge($this->Security->unlockedActions, array('setHomePage'));
} | Base | 1 |
private function encloseForCSV($field)
{
return '"' . cleanCSV($field) . '"';
} | Base | 1 |
public function testCanCreateNewResponseWithStatusAndNoReason()
{
$r = new Response(200);
$r2 = $r->withStatus(201);
$this->assertEquals(200, $r->getStatusCode());
$this->assertEquals('OK', $r->getReasonPhrase());
$this->assertEquals(201, $r2->getStatusCode());
$this->assertEquals('Created', $r2->getReasonPhrase());
} | Base | 1 |
private function getSwimlane()
{
$swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id'));
if (empty($swimlane)) {
throw new PageNotFoundException();
}
return $swimlane;
} | Class | 2 |
public function SetFrom($address, $name = '', $auto = 1) {
$address = trim($address);
$name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
if (!$this->ValidateAddress($address)) {
$this->SetError($this->Lang('invalid_address').': '. $address);
if ($this->exceptions) {
throw new phpmailerException($this->Lang('invalid_address').': '.$address);
}
if ($this->SMTPDebug) {
$this->edebug($this->Lang('invalid_address').': '.$address);
}
return false;
}
$this->From = $address;
$this->FromName = $name;
if ($auto) {
if (empty($this->ReplyTo)) {
$this->AddAnAddress('Reply-To', $address, $name);
}
if (empty($this->Sender)) {
$this->Sender = $address;
}
}
return true;
} | Base | 1 |
public static function parseAndTrim($str, $isHTML = false) { //�Death from above�? �
//echo "1<br>"; eDebug($str);
// global $db;
$str = str_replace("�", "’", $str);
$str = str_replace("�", "‘", $str);
$str = str_replace("�", "®", $str);
$str = str_replace("�", "-", $str);
$str = str_replace("�", "—", $str);
$str = str_replace("�", "”", $str);
$str = str_replace("�", "“", $str);
$str = str_replace("\r\n", " ", $str);
//$str = str_replace(",","\,",$str);
$str = str_replace('\"', """, $str);
$str = str_replace('"', """, $str);
$str = str_replace("�", "¼", $str);
$str = str_replace("�", "½", $str);
$str = str_replace("�", "¾", $str);
//$str = htmlspecialchars($str);
//$str = utf8_encode($str);
// if (DB_ENGINE=='mysqli') {
// $str = @mysqli_real_escape_string($db->connection,trim(str_replace("�", "™", $str)));
// } elseif(DB_ENGINE=='mysql') {
// $str = @mysql_real_escape_string(trim(str_replace("�", "™", $str)),$db->connection);
// } else {
// $str = trim(str_replace("�", "™", $str));
// }
$str = @expString::escape(trim(str_replace("�", "™", $str)));
//echo "2<br>"; eDebug($str,die);
return $str;
} | Base | 1 |
function productFeed() {
// global $db;
//check query password to avoid DDOS
/*
* condition = new
* description
* id - SKU
* link
* price
* title
* brand - manufacturer
* image link - fullsized image, up to 10, comma seperated
* product type - category - "Electronics > Audio > Audio Accessories MP3 Player Accessories","Health & Beauty > Healthcare > Biometric Monitors > Pedometers"
*/
$out = '"id","condition","description","like","price","title","brand","image link","product type"' . chr(13) . chr(10);
$p = new product();
$prods = $p->find('all', 'parent_id=0 AND ');
//$prods = $db->selectObjects('product','parent_id=0 AND');
} | Base | 1 |
function __construct($apikey){
$this->apikey = $apikey;
$this->config = $this->getConfig($apikey);
//echo $this->apikey;
}
| Base | 1 |
public function getPurchaseOrderByJSON() {
if(!empty($this->params['vendor'])) {
$purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']);
} else {
$purchase_orders = $this->purchase_order->find('all');
}
echo json_encode($purchase_orders);
} | Base | 1 |
function import() {
$pullable_modules = expModules::listInstalledControllers($this->baseclassname);
$modules = new expPaginator(array(
'records' => $pullable_modules,
'controller' => $this->loc->mod,
'action' => $this->params['action'],
'order' => isset($this->params['order']) ? $this->params['order'] : 'section',
'dir' => isset($this->params['dir']) ? $this->params['dir'] : '',
'page' => (isset($this->params['page']) ? $this->params['page'] : 1),
'columns' => array(
gt('Title') => 'title',
gt('Page') => 'section'
),
));
assign_to_template(array(
'modules' => $modules,
));
}
| Base | 1 |
$parser->getOutput()->mTemplates[$nsp] = array_diff_assoc( $parser->getOutput()->mTemplates[$nsp], self::$createdLinks[1][$nsp] );
// echo ("<pre> elim: parser Tpls [$nsp] nachher = ". count($parser->getOutput()->mTemplates[$nsp]) ."</pre>\n");
if ( count( $parser->getOutput()->mTemplates[$nsp] ) == 0 ) {
unset( $parser->getOutput()->mTemplates[$nsp] );
}
}
} | Class | 2 |
public function search_external() {
// global $db, $user;
global $db;
$sql = "select DISTINCT(a.id) as id, a.source as source, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email ";
$sql .= "from " . $db->prefix . "external_addresses as a "; //R JOIN " .
//$db->prefix . "billingmethods as bm ON bm.addresses_id=a.id ";
$sql .= " WHERE match (a.firstname,a.lastname,a.email,a.organization) against ('" . $this->params['query'] .
"*' IN BOOLEAN MODE) ";
$sql .= "order by match (a.firstname,a.lastname,a.email,a.organization) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) ASC LIMIT 12";
$res = $db->selectObjectsBySql($sql);
foreach ($res as $key=>$record) {
$res[$key]->title = $record->firstname . ' ' . $record->lastname;
}
//eDebug($sql);
$ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res);
$ar->send();
} | Base | 1 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.