code
stringlengths 12
2.05k
| label_name
stringclasses 5
values | label
int64 0
4
|
---|---|---|
public function checkCode($secret, $code, $discrepancy = 3)
{
/*
$time = floor(time() / 30);
for ($i = -1; $i <= 1; $i++) {
if ($this->getCode($secret, $time + $i) == $code) {
return true;
}
}
*/
$currentTimeSlice = floor(time() / 30);
for ($i = -$discrepancy; $i <= $discrepancy; $i++) {
$calculatedCode = $this->getCode($secret, $currentTimeSlice + $i);
if ($calculatedCode == $code ) {
return true;
}
}
return false;
} | Base | 1 |
static function dropdownConnect($itemtype, $fromtype, $myname, $entity_restrict = -1,
$onlyglobal = 0, $used = []) {
global $CFG_GLPI;
$rand = mt_rand();
$field_id = Html::cleanId("dropdown_".$myname.$rand);
$param = [
'entity_restrict' => $entity_restrict,
'fromtype' => $fromtype,
'itemtype' => $itemtype,
'onlyglobal' => $onlyglobal,
'used' => $used,
'_idor_token' => Session::getNewIDORToken($itemtype),
];
echo Html::jsAjaxDropdown($myname, $field_id,
$CFG_GLPI['root_doc']."/ajax/getDropdownConnect.php",
$param);
return $rand;
} | Base | 1 |
public function __construct() {
self::$hooks = self::load();
}
| Base | 1 |
public function testPages()
{
\MicroweberPackages\Multilanguage\MultilanguageHelpers::setMultilanguageEnabled(false);
$this->browse(function (Browser $browser) {
$browser->within(new AdminLogin(), function ($browser) {
$browser->fillForm();
});
$routeCollection = Route::getRoutes();
foreach ($routeCollection as $value) {
if ($value->getActionMethod() == 'GET') {
continue;
}
if (strpos($value->uri(), 'admin') !== false) {
$browser->visit($value->uri());
$browser->within(new ChekForJavascriptErrors(), function ($browser) {
$browser->validate();
});
$browser->pause(2000);
}
}
});
} | Base | 1 |
public function testResolveTranslation()
{
$translator = $this->prophesize(TranslatorInterface::class);
$translator->getLocale()->willReturn('de');
$translator->setLocale('de')->shouldBeCalled();
$translator->trans('test-key')->willReturn('TEST');
$entity = $this->prophesize(RoutableInterface::class);
$entity->getLocale()->willReturn('en');
$provider = new SymfonyExpressionTokenProvider($translator->reveal());
$this->assertEquals('TEST', $provider->provide($entity, 'translator.trans("test-key")'));
} | Base | 1 |
protected function edebug($str)
{
if (!$this->SMTPDebug) {
return;
}
switch ($this->Debugoutput) {
case 'error_log':
error_log($str);
break;
case 'html':
//Cleans up output a bit for a better looking display that's HTML-safe
echo htmlentities(preg_replace('/[\r\n]+/', '', $str), ENT_QUOTES, $this->CharSet) . "<br>\n";
break;
case 'echo':
default:
echo $str."\n";
}
} | Compound | 4 |
public function Connect($host, $port = 0, $tval = 30) {
// set the error val to null so there is no confusion
$this->error = null;
// make sure we are __not__ connected
if($this->connected()) {
// already connected, generate error
$this->error = array("error" => "Already connected to a server");
return false;
}
if(empty($port)) {
$port = $this->SMTP_PORT;
}
// connect to the smtp server
$this->smtp_conn = @fsockopen($host, // the host of the server
$port, // the port to use
$errno, // error number if any
$errstr, // error message if any
$tval); // give up after ? secs
// verify we connected properly
if(empty($this->smtp_conn)) {
$this->error = array("error" => "Failed to connect to server",
"errno" => $errno,
"errstr" => $errstr);
if($this->do_debug >= 1) {
$this->edebug("SMTP -> ERROR: " . $this->error["error"] . ": $errstr ($errno)" . $this->CRLF . '<br />');
}
return false;
}
// SMTP server can take longer to respond, give longer timeout for first read
// Windows does not have support for this timeout function
if(substr(PHP_OS, 0, 3) != "WIN") {
$max = ini_get('max_execution_time');
if ($max != 0 && $tval > $max) { // don't bother if unlimited
@set_time_limit($tval);
}
stream_set_timeout($this->smtp_conn, $tval, 0);
}
// get any announcement
$announce = $this->get_lines();
if($this->do_debug >= 2) {
$this->edebug("SMTP -> FROM SERVER:" . $announce . $this->CRLF . '<br />');
}
return true;
} | Base | 1 |
public static function getHelpVersion($version_id) {
global $db;
return $db->selectValue('help_version', 'version', 'id="'.$version_id.'"');
} | Base | 1 |
public function confirm()
{
$project = $this->getProject();
$this->response->html($this->helper->layout->project('action/remove', array(
'action' => $this->actionModel->getById($this->request->getIntegerParam('action_id')),
'available_events' => $this->eventManager->getAll(),
'available_actions' => $this->actionManager->getAvailableActions(),
'project' => $project,
'title' => t('Remove an action')
)));
} | Base | 1 |
public static function initializeNavigation() {
$sections = section::levelTemplate(0, 0);
return $sections;
}
| Base | 1 |
foreach ($day as $extevent) {
$event_cache = new stdClass();
$event_cache->feed = $extgcalurl;
$event_cache->event_id = $extevent->event_id;
$event_cache->title = $extevent->title;
$event_cache->body = $extevent->body;
$event_cache->eventdate = $extevent->eventdate->date;
if (isset($extevent->dateFinished) && $extevent->dateFinished != -68400)
$event_cache->dateFinished = $extevent->dateFinished;
if (isset($extevent->eventstart))
$event_cache->eventstart = $extevent->eventstart;
if (isset($extevent->eventend))
$event_cache->eventend = $extevent->eventend;
if (isset($extevent->is_allday))
$event_cache->is_allday = $extevent->is_allday;
$found = false;
if ($extevent->eventdate->date < $start) // prevent duplicating events crossing month boundaries
$found = $db->selectObject('event_cache','feed="'.$extgcalurl.'" AND event_id="'.$event_cache->event_id.'" AND eventdate='.$event_cache->eventdate);
if (!$found)
$db->insertObject($event_cache,'event_cache');
}
| Base | 1 |
private function checkAuthenticationTag() {
if ($this->authentication_tag === $this->calculateAuthenticationTag()) {
return true;
} else {
throw new JOSE_Exception_UnexpectedAlgorithm('Invalid authentication tag');
}
} | Class | 2 |
public function update() {
//populate the alt tag field if the user didn't
if (empty($this->params['alt'])) $this->params['alt'] = $this->params['title'];
// call expController update to save the image
parent::update();
} | Base | 1 |
public static function textEncode( $mix )
{
if ( is_array( $mix ) )
return implode(',', array_map( array('ezjscAjaxContent', 'textEncode'), array_filter( $mix ) ) );
return $mix;
} | Base | 1 |
function db_seq_nextval($seqname)
{
global $DatabaseType;
if ($DatabaseType == 'mysqli')
$seq = "fn_" . strtolower($seqname) . "()";
return $seq;
} | Base | 1 |
public function approve_submit() {
if (empty($this->params['id'])) {
flash('error', gt('No ID supplied for comment to approve'));
expHistory::back();
}
/* 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'];
$comment = new expComment($this->params['id']);
$comment->body = $this->params['body'];
$comment->approved = $this->params['approved'];
$comment->save();
expHistory::back();
} | Class | 2 |
public static function path($var) {
return GX_LIB.'Vendor/'.$var."/";
}
| Base | 1 |
function _setupMcrypt()
{
$this->_clearBuffers();
$this->enchanged = $this->dechanged = true;
if (!isset($this->enmcrypt)) {
static $mcrypt_modes = array(
self::MODE_CTR => 'ctr',
self::MODE_ECB => MCRYPT_MODE_ECB,
self::MODE_CBC => MCRYPT_MODE_CBC,
self::MODE_CFB => 'ncfb',
self::MODE_OFB => MCRYPT_MODE_NOFB,
self::MODE_STREAM => MCRYPT_MODE_STREAM,
);
$this->demcrypt = mcrypt_module_open($this->cipher_name_mcrypt, '', $mcrypt_modes[$this->mode], '');
$this->enmcrypt = mcrypt_module_open($this->cipher_name_mcrypt, '', $mcrypt_modes[$this->mode], '');
// we need the $ecb mcrypt resource (only) in MODE_CFB with enableContinuousBuffer()
// to workaround mcrypt's broken ncfb implementation in buffered mode
// see: {@link http://phpseclib.sourceforge.net/cfb-demo.phps}
if ($this->mode == self::MODE_CFB) {
$this->ecb = mcrypt_module_open($this->cipher_name_mcrypt, '', MCRYPT_MODE_ECB, '');
}
} // else should mcrypt_generic_deinit be called?
if ($this->mode == self::MODE_CFB) {
mcrypt_generic_init($this->ecb, $this->key, str_repeat("\0", $this->block_size));
}
} | Class | 2 |
public function getQueryGroupby()
{
return "a.id";
} | Base | 1 |
$sloc = expCore::makeLocation('navigation', null, $section->id);
// remove any manage permissions for this page and it's children
// $db->delete('userpermission', "module='navigationController' AND internal=".$section->id);
// $db->delete('grouppermission', "module='navigationController' AND internal=".$section->id);
foreach ($allusers as $uid) {
$u = user::getUserById($uid);
expPermissions::grant($u, 'manage', $sloc);
}
foreach ($allgroups as $gid) {
$g = group::getGroupById($gid);
expPermissions::grantGroup($g, 'manage', $sloc);
}
}
}
| Class | 2 |
$logo = "<img src=\"".Options::get('siteurl').Options::get('logo')."\"
style=\"width: $width; height: $height; margin: 1px;\">";
}else{
$logo = "<span class=\"mg genixcms-logo\"></span>";
}
return $logo;
} | Base | 1 |
static function description() {
return "Manage events and schedules, and optionally publish them.";
}
| Base | 1 |
function updateObject($object, $table, $where=null, $identifier='id', $is_revisioned=false) {
if ($is_revisioned) {
$object->revision_id++;
//if ($table=="text") eDebug($object);
$res = $this->insertObject($object, $table);
//if ($table=="text") eDebug($object,true);
$this->trim_revisions($table, $object->$identifier, WORKFLOW_REVISION_LIMIT);
return $res;
}
$sql = "UPDATE " . $this->prefix . "$table SET ";
foreach (get_object_vars($object) as $var => $val) {
//We do not want to save any fields that start with an '_'
//if($is_revisioned && $var=='revision_id') $val++;
if ($var{0} != '_') {
if (is_array($val) || is_object($val)) {
$val = serialize($val);
$sql .= "`$var`='".$val."',";
} else {
$sql .= "`$var`='".mysqli_real_escape_string($this->connection,$val)."',";
}
}
}
$sql = substr($sql, 0, -1) . " WHERE ";
if ($where != null)
$sql .= $where;
else
$sql .= "`" . $identifier . "`=" . $object->$identifier;
//if ($table == 'text') eDebug($sql,true);
$res = (@mysqli_query($this->connection, $sql) != false);
return $res;
} | Base | 1 |
public function paramRules() {
return array(
'title' => Yii::t('studio',$this->title),
'info' => Yii::t('studio',$this->info),
'modelRequired' => 'Contacts',
'options' => array(
array(
'name'=>'listId',
'label'=>Yii::t('studio','List'),
'type'=>'link',
'linkType'=>'X2List',
'linkSource'=>Yii::app()->createUrl(
CActiveRecord::model('X2List')->autoCompleteSource
)
),
));
} | Class | 2 |
$k = trim(strtok($val, ':'));
$v = trim(substr(strstr($val, ':'), 1));
if ($v == '') continue;
$hasdata = true;
if (isset($translate[$k])) {
$k = $translate[$k];
if ($k == '') continue;
if (strstr($k, '.')) {
eval("\$block" . getvarname($k) . "=\$v;");
continue;
}
} else $k = strtolower($k);
if ($k == 'handle') {
$v = strtok($v, ' ');
$gkey = strtoupper($v);
}
if (isset($block[$k]) && is_array($block[$k]))
$block[$k][] = $v;
else
if (!isset($block[$k]) || $block[$k] == '')
$block[$k] = $v;
else {
$x = $block[$k];
unset($block[$k]);
$block[$k][] = $x;
$block[$k][] = $v;
}
} | Base | 1 |
public static function totalUser() {
$posts = Db::result("SELECT `id` FROM `user` WHERE `group` > '0' ");
$npost = Db::$num_rows;
return $npost;
}
| Base | 1 |
$files[$i] = '.' . DIRECTORY_SEPARATOR . basename($file);
}
$files = array_map('escapeshellarg', $files);
$cmd = $arc['cmd'] . ' ' . $arc['argc'] . ' ' . escapeshellarg($name) . ' ' . implode(' ', $files);
$err_out = '';
$this->procExec($cmd, $o, $c, $err_out, $dir);
chdir($cwd);
} else {
return false;
}
}
$path = $dir . DIRECTORY_SEPARATOR . $name;
return file_exists($path) ? $path : false;
} | Base | 1 |
function download_item($dir, $item)
{
// Security Fix:
$item=basename($item);
if (!permissions_grant($dir, $item, "read"))
show_error($GLOBALS["error_msg"]["accessfunc"]);
if (!get_is_file($dir,$item))
{
_debug("error download");
show_error($item.": ".$GLOBALS["error_msg"]["fileexist"]);
}
if (!get_show_item($dir, $item))
show_error($item.": ".$GLOBALS["error_msg"]["accessfile"]);
$abs_item = get_abs_item($dir,$item);
_download($abs_item, $item);
} | Base | 1 |
public function clean()
{
$dataSourceConfig = ConnectionManager::getDataSource('default')->config;
$dataSource = $dataSourceConfig['datasource'];
if ($dataSource == 'Database/Mysql') {
$sql = 'DELETE FROM bruteforces WHERE `expire` <= NOW();';
} elseif ($dataSource == 'Database/Postgres') {
$sql = 'DELETE FROM bruteforces WHERE expire <= NOW();';
}
$this->query($sql);
} | Base | 1 |
private function _lastmodifiedby( $option ) {
$user = new \User;
$this->addWhere( $this->DB->addQuotes( $user->newFromName( $option )->getActorId() ) . ' = (SELECT revactor_actor FROM ' . $this->tableNames['revision_actor_temp'] . ' WHERE ' . $this->tableNames['revision_actor_temp'] . '.revactor_page=page_id ORDER BY ' . $this->tableNames['revision_actor_temp'] . '.revactor_timestamp DESC LIMIT 1)' );
} | Class | 2 |
public function remove()
{
$project = $this->getProject();
$this->checkCSRFParam();
$column_id = $this->request->getIntegerParam('column_id');
if ($this->columnModel->remove($column_id)) {
$this->flash->success(t('Column removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this column.'));
}
$this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])));
} | Base | 1 |
$period_days_append_sql= substr($period_days_append_sql,0,-4).'))';
}
$exist_RET= DBGet(DBQuery("SELECT s.ID FROM schedule s WHERE student_id=". $student_id." AND s.syear='".UserSyear()."' {$mp_append_sql}{$period_days_append_sql} UNION SELECT s.ID FROM temp_schedule s WHERE student_id=". $student_id."{$mp_append_sql}{$period_days_append_sql}"));
if($exist_RET)
return 'There is a Period Conflict ('.$course_RET[1]['CP_TITLE'].')';
else
{
return true;
}
} | Base | 1 |
$masteroption->delete();
}
// delete the mastergroup
$db->delete('optiongroup', 'optiongroup_master_id='.$mastergroup->id);
$mastergroup->delete();
expHistory::back();
} | Base | 1 |
public function update(Request $request, string $attachmentId)
{
$attachment = $this->attachment->newQuery()->findOrFail($attachmentId);
try {
$this->validate($request, [
'attachment_edit_name' => 'required|string|min:1|max:255',
'attachment_edit_url' => 'string|min:1|max:255'
]);
} catch (ValidationException $exception) {
return response()->view('attachments.manager-edit-form', array_merge($request->only(['attachment_edit_name', 'attachment_edit_url']), [
'attachment' => $attachment,
'errors' => new MessageBag($exception->errors()),
]), 422);
}
$this->checkOwnablePermission('view', $attachment->page);
$this->checkOwnablePermission('page-update', $attachment->page);
$this->checkOwnablePermission('attachment-create', $attachment);
$attachment = $this->attachmentService->updateFile($attachment, [
'name' => $request->get('attachment_edit_name'),
'link' => $request->get('attachment_edit_url'),
]);
return view('attachments.manager-edit-form', [
'attachment' => $attachment,
]);
} | Base | 1 |
public function setFlashCookieObject($name, $object, $time = 60)
{
setcookie($name, json_encode($object), time() + $time, '/');
return $this;
} | Base | 1 |
function insertObject($object, $table) {
//if ($table=="text") eDebug($object,true);
$sql = "INSERT INTO `" . $this->prefix . "$table` (";
$values = ") VALUES (";
foreach (get_object_vars($object) as $var => $val) {
//We do not want to save any fields that start with an '_'
if ($var{0} != '_') {
$sql .= "`$var`,";
if ($values != ") VALUES (") {
$values .= ",";
}
$values .= "'" . $this->escapeString($val) . "'";
}
}
$sql = substr($sql, 0, -1) . substr($values, 0) . ")";
//if($table=='text')eDebug($sql,true);
if (@mysqli_query($this->connection, $sql) != false) {
$id = mysqli_insert_id($this->connection);
return $id;
} else
return 0;
} | Base | 1 |
LP_Request::register_ajax( $action, $callback );
}
add_action( 'wp_ajax_learnpress_upload-user-avatar', array( __CLASS__, 'upload_user_avatar' ) );
} | Class | 2 |
public static function createFromGlobals()
{
// With the php's bug #66606, the php's built-in web server
// stores the Content-Type and Content-Length header values in
// HTTP_CONTENT_TYPE and HTTP_CONTENT_LENGTH fields.
$server = $_SERVER;
if ('cli-server' === php_sapi_name()) {
if (array_key_exists('HTTP_CONTENT_LENGTH', $_SERVER)) {
$server['CONTENT_LENGTH'] = $_SERVER['HTTP_CONTENT_LENGTH'];
}
if (array_key_exists('HTTP_CONTENT_TYPE', $_SERVER)) {
$server['CONTENT_TYPE'] = $_SERVER['HTTP_CONTENT_TYPE'];
}
}
$request = self::createRequestFromFactory($_GET, $_POST, array(), $_COOKIE, $_FILES, $server);
if (0 === strpos($request->headers->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded')
&& in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), array('PUT', 'DELETE', 'PATCH'))
) {
parse_str($request->getContent(), $data);
$request->request = new ParameterBag($data);
}
return $request;
} | 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 |
$period_days_append_sql= substr($period_days_append_sql,0,-4).'))';
}
$exist_RET= DBGet(DBQuery("SELECT s.ID FROM schedule s WHERE student_id=". $student_id." AND s.syear='".UserSyear()."' {$mp_append_sql}{$period_days_append_sql} UNION SELECT s.ID FROM temp_schedule s WHERE student_id=". $student_id."{$mp_append_sql}{$period_days_append_sql}"));
if($exist_RET)
return 'There is a Period Conflict ('.$course_RET[1]['CP_TITLE'].')';
else
{
return true;
}
} | Base | 1 |
public static function getTemplateHierarchyFlat($parent, $depth = 1) {
global $db;
$arr = array();
$kids = $db->selectObjects('section_template', 'parent=' . $parent, 'rank');
// $kids = expSorter::sort(array('array'=>$kids,'sortby'=>'rank', 'order'=>'ASC'));
for ($i = 0, $iMax = count($kids); $i < $iMax; $i++) {
$page = $kids[$i];
$page->depth = $depth;
$page->first = ($i == 0 ? 1 : 0);
$page->last = ($i == count($kids) - 1 ? 1 : 0);
$arr[] = $page;
$arr = array_merge($arr, self::getTemplateHierarchyFlat($page->id, $depth + 1));
}
return $arr;
}
| Class | 2 |
public function update()
{
$project = $this->getProject();
$tag_id = $this->request->getIntegerParam('tag_id');
$tag = $this->tagModel->getById($tag_id);
$values = $this->request->getValues();
list($valid, $errors) = $this->tagValidator->validateModification($values);
if ($tag['project_id'] != $project['id']) {
throw new AccessForbiddenException();
}
if ($valid) {
if ($this->tagModel->update($values['id'], $values['name'])) {
$this->flash->success(t('Tag updated successfully.'));
} else {
$this->flash->failure(t('Unable to update this tag.'));
}
$this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id'])));
} else {
$this->edit($values, $errors);
}
} | Base | 1 |
public static function secureCompare($known, $user)
{
if (function_exists('hash_equals')) {
// use hash_equals() if available (PHP >= 5.6)
return hash_equals($known, $user);
}
// compare manually in constant time
$len = mb_strlen($known, '8bit'); // see mbstring.func_overload
if ($len !== mb_strlen($user, '8bit')) {
return false; // length differs
}
$diff = 0;
for ($i = 0; $i < $len; ++$i) {
$diff |= $known[$i] ^ $user[$i];
}
// if all the bytes in $a and $b are identical, $diff should be equal to 0
return $diff === 0;
} | Compound | 4 |
public static function slugify($text)
{
// strip tags
$text = strip_tags($text);
// replace non letter or digits by -
$text = preg_replace('~[^\\pL\d]+~u', '-', $text);
// trim
$text = trim($text, '-');
// transliterate
setlocale(LC_CTYPE, Options::v('country').'.utf8');
$text = iconv('utf-8', 'ASCII//TRANSLIT', $text);
// lowercase
$text = strtolower($text);
// remove unwanted characters
$text = preg_replace('~[^-\w]+~', '', $text);
if (empty($text)) {
return 'n-a';
}
return $text;
} | Base | 1 |
public function backup($type='json')
{
global $DB;
global $website;
$DB->query('SELECT * FROM nv_brands WHERE website = '.protect($website->id), 'object');
$out = $DB->result();
if($type='json')
$out = json_encode($out);
return $out;
}
| Base | 1 |
public function buildControl() {
$control = new colorcontrol();
if (!empty($this->params['value'])) $control->value = $this->params['value'];
if ($this->params['value'][0] != '#') $this->params['value'] = '#' . $this->params['value'];
$control->default = $this->params['value'];
if (!empty($this->params['hide'])) $control->hide = $this->params['hide'];
if (isset($this->params['flip'])) $control->flip = $this->params['flip'];
$this->params['name'] = !empty($this->params['name']) ? $this->params['name'] : '';
$control->name = $this->params['name'];
$this->params['id'] = !empty($this->params['id']) ? $this->params['id'] : '';
$control->id = isset($this->params['id']) && $this->params['id'] != "" ? $this->params['id'] : "";
//echo $control->id;
if (empty($control->id)) $control->id = $this->params['name'];
if (empty($control->name)) $control->name = $this->params['id'];
// attempt to translate the label
if (!empty($this->params['label'])) {
$this->params['label'] = gt($this->params['label']);
} else {
$this->params['label'] = null;
}
echo $control->toHTML($this->params['label'], $this->params['name']);
// $ar = new expAjaxReply(200, gt('The control was created'), json_encode(array('data'=>$code)));
// $ar->send();
}
| 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;
} | Class | 2 |
protected function _archive($dir, $files, $name, $arc) {
die('Not yet implemented. (_archive)');
return false;
} | Base | 1 |
public function update(){
$login_user = $this->checkLogin();
$item_id = I("item_id/d");
$item_name = I("item_name");
$item_description = I("item_description");
$item_domain = I("item_domain");
$password = I("password");
$uid = $login_user['uid'] ;
if(!$this->checkItemManage($uid , $item_id)){
$this->sendError(10303);
return ;
}
if ($item_domain) {
if(!ctype_alnum($item_domain) || is_numeric($item_domain) ){
//echo '个性域名只能是字母或数字的组合';exit;
$this->sendError(10305);
return false;
}
$item = D("Item")->where("item_domain = '%s' and item_id !='%s' ",array($item_domain,$item_id))->find();
if ($item) {
//个性域名已经存在
$this->sendError(10304);
return false;
}
}
$save_data = array(
"item_name" => $item_name ,
"item_description" => $item_description ,
"item_domain" => $item_domain ,
"password" => $password ,
);
$items = D("Item")->where("item_id = '$item_id' ")->save($save_data);
$items = $items ? $items : array();
$this->sendResult($items);
} | Compound | 4 |
protected function gdImageBackground($image, $bgcolor){
if( $bgcolor == 'transparent' ){
imagesavealpha($image,true);
$bgcolor1 = imagecolorallocatealpha($image, 255, 255, 255, 127);
}else{
list($r, $g, $b) = sscanf($bgcolor, "#%02x%02x%02x");
$bgcolor1 = imagecolorallocate($image, $r, $g, $b);
}
imagefill($image, 0, 0, $bgcolor1);
} | Base | 1 |
protected function _copy($source, $targetDir, $name)
{
$res = false;
$target = $this->_joinPath($targetDir, $name);
if ($this->tmp) {
$local = $this->getTempFile();
if ($this->connect->get($source, $local)
&& $this->connect->put($target, $local, NET_SFTP_LOCAL_FILE)) {
$res = true;
}
unlink($local);
} else {
//not memory efficient
$res = $this->_filePutContents($target, $this->_getContents($source));
}
return $res;
} | Base | 1 |
public function save()
{
$project = $this->getProject();
$values = $this->request->getValues();
list($valid, $errors) = $this->categoryValidator->validateCreation($values);
if ($valid) {
if ($this->categoryModel->create($values) !== false) {
$this->flash->success(t('Your category have been created successfully.'));
$this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])), true);
return;
} else {
$errors = array('name' => array(t('Another category with the same name exists in this project')));
}
}
$this->create($values, $errors);
} | Base | 1 |
public function showall() {
expHistory::set('viewable', $this->params);
$hv = new help_version();
//$current_version = $hv->find('first', 'is_current=1');
$ref_version = $hv->find('first', 'version=\''.$this->help_version.'\'');
// pagination parameter..hard coded for now.
$where = $this->aggregateWhereClause();
$where .= 'AND help_version_id='.(empty($ref_version->id)?'0':$ref_version->id); | Class | 2 |
public function setItemAttributes( $attributes ) {
$this->itemAttributes = \Sanitizer::fixTagAttributes( $attributes, 'li' );
} | Class | 2 |
public function sdm_save_other_details_meta_data($post_id) { // Save Statistics Upload metabox
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
}
if (!isset($_POST['sdm_other_details_nonce_check']) || !wp_verify_nonce($_POST['sdm_other_details_nonce_check'], 'sdm_other_details_nonce')) {
return;
}
if (isset($_POST['sdm_item_file_size'])) {
update_post_meta($post_id, 'sdm_item_file_size', $_POST['sdm_item_file_size']);
}
if (isset($_POST['sdm_item_version'])) {
update_post_meta($post_id, 'sdm_item_version', $_POST['sdm_item_version']);
}
} | Base | 1 |
private function getTaskLink()
{
$link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id'));
if (empty($link)) {
throw new PageNotFoundException();
}
return $link;
} | Base | 1 |
public function confirm()
{
$project = $this->getProject();
$category = $this->getCategory();
$this->response->html($this->helper->layout->project('category/remove', array(
'project' => $project,
'category' => $category,
)));
} | Class | 2 |
public function setArticles($articles)
{
$return = $this->setOneToMany($articles, Article::class, 'articles', 'container');
$this->setType('ctArticles');
return $return;
} | Base | 1 |
public static function dumpArray( $arg ) {
$numargs = count( $arg );
if ( $numargs < 3 ) {
return '';
}
$var = trim( $arg[2] );
$text = " array {$var} = {";
$n = 0;
if ( array_key_exists( $var, self::$memoryArray ) ) {
foreach ( self::$memoryArray[$var] as $value ) {
if ( $n++ > 0 ) {
$text .= ', ';
}
$text .= "{$value}";
}
}
return $text . "}\n";
} | Class | 2 |
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 get($columns = ['*'])
{
if (!is_null($this->cacheMinutes)) {
$results = $this->getCached($columns);
}
else {
$results = $this->getFresh($columns);
}
$models = $this->getModels($results ?: []);
return $this->model->newCollection($models);
} | Base | 1 |
public function handle($stanza, $parent = false)
{
$message = $stanza->forwarded->message;
$jid = explode('/',(string)$message->attributes()->from);
$to = current(explode('/',(string)$message->attributes()->to));
if($message->composing)
$this->event('composing', array($jid[0], $to));
if($message->paused)
$this->event('paused', array($jid[0], $to));
if($message->gone)
$this->event('gone', array($jid[0], $to));
if($message->body || $message->subject) {
$m = new \Modl\Message;
$m->set($message, $stanza->forwarded);
if(!preg_match('#^\?OTR#', $m->body)) {
$md = new \Modl\MessageDAO;
$md->set($m);
$this->pack($m);
$this->deliver();
}
}
} | Class | 2 |
protected function _save($fp, $dir, $name, $stat) {
$path = $this->_joinPath($dir, $name);
$meta = stream_get_meta_data($fp);
$uri = isset($meta['uri'])? $meta['uri'] : '';
if ($uri && ! preg_match('#^[a-zA-Z0-9]+://#', $uri)) {
@fclose($fp);
$isCmdPaste = ($this->ARGS['cmd'] === 'paste');
$isCmdCopy = ($isCmdPaste && empty($this->ARGS['cut']));
if (($isCmdCopy || !@rename($uri, $path)) && !@copy($uri, $path)) {
return false;
}
// re-create the source file for remove processing of paste command
$isCmdPaste && !$isCmdCopy && touch($uri);
} else {
if (@file_put_contents($path, $fp, LOCK_EX) === false) {
return false;
}
}
@chmod($path, $this->options['fileMode']);
clearstatcache();
return $path;
} | Base | 1 |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id'));
$this->checkPermission($project, $filter);
if ($this->customFilterModel->remove($filter['id'])) {
$this->flash->success(t('Custom filter removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this custom filter.'));
}
$this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id'])));
} | Base | 1 |
public static function v () {
return self::$version." ".self::$v_release;
}
| Base | 1 |
function manage_upcharge() {
$this->loc->src = "@globalstoresettings";
$config = new expConfig($this->loc);
$this->config = $config->config;
$gc = new geoCountry();
$countries = $gc->find('all');
$gr = new geoRegion();
$regions = $gr->find('all',null,'rank asc,name asc');
assign_to_template(array(
'countries'=>$countries,
'regions'=>$regions,
'upcharge'=>!empty($this->config['upcharge'])?$this->config['upcharge']:''
));
} | Base | 1 |
public static function canView($section) {
global $db;
if ($section == null) {
return false;
}
if ($section->public == 0) {
// Not a public section. Check permissions.
return expPermissions::check('view', expCore::makeLocation('navigation', '', $section->id));
} else { // Is public. check parents.
if ($section->parent <= 0) {
// Out of parents, and since we are still checking, we haven't hit a private section.
return true;
} else {
$s = $db->selectObject('section', 'id=' . $section->parent);
return self::canView($s);
}
}
}
| Class | 2 |
function render() {
$output = $this->pageContext->getOutput();
$output->enableOOUI();
$this->showAddBypassForm();
$this->showBypassesList();
}
| Compound | 4 |
static function isSearchable() {
return true;
}
| Class | 2 |
public static function parseAndTrimExport($str, $isHTML = false) { //�Death from above�? �
//echo "1<br>"; eDebug($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("�", "“", $str);
$str = str_replace("\r\n", " ", $str);
$str = str_replace("\t", " ", $str);
$str = str_replace(",", "\,", $str);
$str = str_replace("�", "¼", $str);
$str = str_replace("�", "½", $str);
$str = str_replace("�", "¾", $str);
if (!$isHTML) {
$str = str_replace('\"', """, $str);
$str = str_replace('"', """, $str);
} else {
$str = str_replace('"', '""', $str);
}
//$str = htmlspecialchars($str);
//$str = utf8_encode($str);
$str = trim(str_replace("�", "™", $str));
//echo "2<br>"; eDebug($str,die);
return $str;
} | Class | 2 |
function lockTable($table,$lockType="WRITE") {
$sql = "LOCK TABLES `" . $this->prefix . "$table` $lockType";
$res = mysqli_query($this->connection, $sql);
return $res;
} | Class | 2 |
public function destroy(Appointment $appointment)
{
if (!auth()->user()->can("appointment-create")) {
return response("Access denied", 403);
}
$deleted = $appointment->delete();
if ($deleted) {
return response("Success");
}
return response("Error", 503);
} | Base | 1 |
public static function rss() {
switch (SMART_URL) {
case true:
# code...
$url = Options::get('siteurl')."/rss".GX_URL_PREFIX;
break;
default:
# code...
$url = Options::get('siteurl')."/index.php?rss";
break;
}
return $url;
} | Base | 1 |
foreach($image->expTag as $tag) {
if (isset($used_tags[$tag->id])) {
$used_tags[$tag->id]->count++;
} else {
$exptag = new expTag($tag->id);
$used_tags[$tag->id] = $exptag;
$used_tags[$tag->id]->count = 1;
}
} | Base | 1 |
function wp_statistics_get_site_title( $url ) {
//Get ody Page
$html = wp_statistics_get_html_page( $url );
if ( $html === false ) {
return false;
}
//Get Page Title
if ( class_exists( 'DOMDocument' ) ) {
$dom = new DOMDocument;
@$dom->loadHTML( $html );
$title = '';
if ( isset( $dom ) and $dom->getElementsByTagName( 'title' )->length > 0 ) {
$title = $dom->getElementsByTagName( 'title' )->item( '0' )->nodeValue;
}
return ( wp_strip_all_tags( $title ) == "" ? false : $title );
}
return false;
} | Base | 1 |
private function getCategory()
{
$category = $this->categoryModel->getById($this->request->getIntegerParam('category_id'));
if (empty($category)) {
throw new PageNotFoundException();
}
return $category;
} | Base | 1 |
$input = ['name' => 'ldap', 'rootdn_passwd' => $password]; | Class | 2 |
private function runCallback() {
foreach ($this->records as &$record) {
if (isset($record->ref_type)) {
$refType = $record->ref_type;
if (class_exists($record->ref_type)) {
$type = new $refType();
$classinfo = new ReflectionClass($type);
if ($classinfo->hasMethod('paginationCallback')) {
$item = new $type($record->original_id);
$item->paginationCallback($record);
}
}
}
}
} | Base | 1 |
public function manage_versions() {
expHistory::set('manageable', $this->params);
$hv = new help_version();
$current_version = $hv->find('first', 'is_current=1');
$sql = 'SELECT hv.*, COUNT(h.title) AS num_docs FROM '.DB_TABLE_PREFIX.'_help h ';
$sql .= 'RIGHT JOIN '.DB_TABLE_PREFIX.'_help_version hv ON h.help_version_id=hv.id GROUP BY hv.version';
$page = new expPaginator(array(
'sql'=>$sql,
'limit'=>30,
'order' => (isset($this->params['order']) ? $this->params['order'] : 'version'),
'dir' => (isset($this->params['dir']) ? $this->params['dir'] : 'DESC'),
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->baseclassname,
'action'=>$this->params['action'],
'src'=>$this->loc->src,
'columns'=>array(
gt('Version')=>'version',
gt('Title')=>'title',
gt('Current')=>'is_current',
gt('# of Docs')=>'num_docs'
),
));
assign_to_template(array(
'current_version'=>$current_version,
'page'=>$page
));
} | Base | 1 |
protected function itemLock($hashes, $autoUnlock = true)
{
if (!elFinder::$commonTempPath) {
return;
}
if (!is_array($hashes)) {
$hashes = array($hashes);
}
foreach ($hashes as $hash) {
$lock = elFinder::$commonTempPath . DIRECTORY_SEPARATOR . $hash . '.lock';
if ($this->itemLocked($hash)) {
$cnt = file_get_contents($lock) + 1;
} else {
$cnt = 1;
}
if (file_put_contents($lock, $cnt, LOCK_EX)) {
if ($autoUnlock) {
$this->autoUnlocks[] = $hash;
}
}
}
} | Base | 1 |
foreach ($day as $extevent) {
$event_cache = new stdClass();
$event_cache->feed = $extgcalurl;
$event_cache->event_id = $extevent->event_id;
$event_cache->title = $extevent->title;
$event_cache->body = $extevent->body;
$event_cache->eventdate = $extevent->eventdate->date;
if (isset($extevent->dateFinished) && $extevent->dateFinished != -68400)
$event_cache->dateFinished = $extevent->dateFinished;
if (isset($extevent->eventstart))
$event_cache->eventstart = $extevent->eventstart;
if (isset($extevent->eventend))
$event_cache->eventend = $extevent->eventend;
if (isset($extevent->is_allday))
$event_cache->is_allday = $extevent->is_allday;
$found = false;
if ($extevent->eventdate->date < $start) // prevent duplicating events crossing month boundaries
$found = $db->selectObject('event_cache','feed="'.$extgcalurl.'" AND event_id="'.$event_cache->event_id.'" AND eventdate='.$event_cache->eventdate);
if (!$found)
$db->insertObject($event_cache,'event_cache');
}
| Base | 1 |
function manage () {
expHistory::set('viewable', $this->params);
$vendor = new vendor();
$vendors = $vendor->find('all');
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');
}
assign_to_template(array(
'purchase_orders'=>$purchase_orders,
'vendors' => $vendors,
'vendor_id' => @$this->params['vendor']
));
} | Base | 1 |
public function confirm() {
global $db;
// make sure we have what we need.
if (empty($this->params['key'])) expQueue::flashAndFlow('error', gt('The security key for account was not supplied.'));
if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The subscriber id for account was not supplied.'));
// verify the id/key pair
$id = $db->selectValue('subscribers','id', 'id='.$this->params['id'].' AND hash="'.$this->params['key'].'"');
if (empty($id)) expQueue::flashAndFlow('error', gt('We could not find any subscriptions matching the ID and Key you provided.'));
// activate this users pending subscriptions
$sub = new stdClass();
$sub->enabled = 1;
$db->updateObject($sub, 'expeAlerts_subscribers', 'subscribers_id='.$id);
// find the users active subscriptions
$ealerts = expeAlerts::getBySubscriber($id);
assign_to_template(array(
'ealerts'=>$ealerts
));
} | Class | 2 |
public function enable()
{
$this->checkCSRFParam();
$project = $this->getProject();
$swimlane_id = $this->request->getIntegerParam('swimlane_id');
if ($this->swimlaneModel->enable($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 |
function XMLRPCremoveResourceGroupPriv($name, $type, $nodeid, $permissions){
require_once(".ht-inc/privileges.php");
global $user;
if(! checkUserHasPriv("resourceGrant", $user['id'], $nodeid)){
return array('status' => 'error',
'errorcode' => 53,
'errormsg' => 'Unable to remove group privileges on this node');
}
if($typeid = getResourceTypeID($type)){
if(!checkForGroupName($name, 'resource', '', $typeid)){
return array('status' => 'error',
'errorcode' => 28,
'errormsg' => 'resource group does not exist');
}
$perms = explode(':', $permissions);
updateResourcePrivs("$type/$name", $nodeid, array(), $perms);
return array('status' => 'success');
} else {
return array('status' => 'error',
'errorcode' => 56,
'errormsg' => 'Invalid resource type');
}
} | Class | 2 |
public function confirm()
{
$task = $this->getTask();
$comment = $this->getComment();
$this->response->html($this->template->render('comment/remove', array(
'comment' => $comment,
'task' => $task,
'title' => t('Remove a comment')
)));
} | Base | 1 |
AND subtype IN ('.implode(",", array_map(function($k){ return protect($k);}, $subtypes)).')'
| Base | 1 |
protected function loginRequired()
{
Yii::$app->user->logout();
Yii::$app->user->loginRequired();
return false;
} | Class | 2 |
public static function _date2timestamp( $datetime, $wtz=null ) {
if( !isset( $datetime['hour'] )) $datetime['hour'] = 0;
if( !isset( $datetime['min'] )) $datetime['min'] = 0;
if( !isset( $datetime['sec'] )) $datetime['sec'] = 0;
if( empty( $wtz ) && ( !isset( $datetime['tz'] ) || empty( $datetime['tz'] )))
return mktime( $datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year'] );
$output = $offset = 0;
if( empty( $wtz )) {
if( iCalUtilityFunctions::_isOffset( $datetime['tz'] )) {
$offset = iCalUtilityFunctions::_tz2offset( $datetime['tz'] ) * -1;
$wtz = 'UTC';
}
else
$wtz = $datetime['tz'];
}
if(( 'Z' == $wtz ) || ( 'GMT' == strtoupper( $wtz )))
$wtz = 'UTC';
try {
$strdate = sprintf( '%04d-%02d-%02d %02d:%02d:%02d', $datetime['year'], $datetime['month'], $datetime['day'], $datetime['hour'], $datetime['min'], $datetime['sec'] );
$d = new DateTime( $strdate, new DateTimeZone( $wtz ));
if( 0 != $offset ) // adjust for offset
$d->modify( $offset.' seconds' );
$output = $d->format( 'U' );
unset( $d );
}
catch( Exception $e ) {
$output = mktime( $datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year'] );
}
return $output;
}
| Class | 2 |
$WHERE[] = ['NOT' => ['name' => $locks]];
}
// Build query for frequency and allowed hour
$WHERE[] = ['OR' => [
['AND' => [
['hourmin' => ['<', $DB->quoteName('hourmax')]],
'hourmin' => ['<=', $hour],
'hourmax' => ['>', $hour]
]],
['AND' => [
'hourmin' => ['>', $DB->quoteName('hourmax')],
'OR' => [
'hourmin' => ['<=', $hour],
'hourmax' => ['>', $hour]
]
]]
]];
$WHERE[] = ['OR' => [
'lastrun' => null,
new \QueryExpression('unix_timestamp(' . $DB->quoteName('lastrun') . ') + ' . $DB->quoteName('frequency') . ' <= unix_timestamp(now())')
]];
}
$iterator = $DB->request([
'SELECT' => [
'*',
new \QueryExpression("LOCATE('Plugin', " . $DB->quoteName('itemtype') . ") AS ISPLUGIN")
],
'FROM' => $this->getTable(),
'WHERE' => $WHERE,
// Core task before plugins
'ORDER' => [
'ISPLUGIN',
new \QueryExpression('unix_timestamp(' . $DB->quoteName('lastrun') . ')+' . $DB->quoteName('frequency') . '')
]
]);
if (count($iterator)) {
$this->fields = $iterator->next();
return true;
}
return false;
} | Base | 1 |
function edit() {
if (empty($this->params['content_id'])) {
flash('message',gt('An error occurred: No content id set.'));
expHistory::back();
}
/* The global constants can be overridden 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'];
$id = empty($this->params['id']) ? null : $this->params['id'];
$comment = new expComment($id);
//FIXME here is where we might sanitize the comment before displaying/editing it
assign_to_template(array(
'content_id'=>$this->params['content_id'],
'content_type'=>$this->params['content_type'],
'comment'=>$comment
));
} | Base | 1 |
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 search() {
// global $db, $user;
global $db;
$sql = "select DISTINCT(a.id) as id, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email ";
$sql .= "from " . $db->prefix . "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 |
unset($return[$key]);
}
}
break;
}
return @array_change_key_case($return, CASE_UPPER);
} | Base | 1 |
public function showall() {
expHistory::set('viewable', $this->params);
$hv = new help_version();
//$current_version = $hv->find('first', 'is_current=1');
$ref_version = $hv->find('first', 'version=\''.$this->help_version.'\'');
// pagination parameter..hard coded for now.
$where = $this->aggregateWhereClause();
$where .= 'AND help_version_id='.(empty($ref_version->id)?'0':$ref_version->id); | Base | 1 |
public function update()
{
$project = $this->getProject();
$values = $this->request->getValues();
list($valid, $errors) = $this->swimlaneValidator->validateModification($values);
if ($valid) {
if ($this->swimlaneModel->update($values['id'], $values)) {
$this->flash->success(t('Swimlane updated successfully.'));
return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
} else {
$errors = array('name' => array(t('Another swimlane with the same name exists in the project')));
}
}
return $this->edit($values, $errors);
} | Base | 1 |
public function getQueryOrderby()
{
$uh = UserHelper::instance();
$R1 = 'R1_' . $this->field->id;
$R2 = 'R2_' . $this->field->id;
return $R2 . "." . str_replace('user.', '', $uh->getDisplayNameSQLOrder());
} | Base | 1 |
public function rename(){
if($this->request->isMethod('POST')){
$new_file = $this->request->input('new_file');
if(!\Security::isExecutable($new_file) && \Storage::move($this->request->input('old_file'), $new_file)){
if($this->request->ajax()){
return response()->json(['success' => trans('File successfully renamed!')]);
}
}else{
if($this->request->ajax()){
return response()->json(['danger' => trans('message.something_went_wrong')]);
}
}
}
} | Base | 1 |
function configure() {
expHistory::set('editable', $this->params);
// little bit of trickery so that that categories can have their own configs
$this->loc->src = "@globalstoresettings";
$config = new expConfig($this->loc);
$this->config = $config->config;
$pullable_modules = expModules::listInstalledControllers($this->baseclassname, $this->loc);
$views = expTemplate::get_config_templates($this, $this->loc);
$gc = new geoCountry();
$countries = $gc->find('all');
$gr = new geoRegion();
$regions = $gr->find('all');
assign_to_template(array(
'config'=>$this->config,
'pullable_modules'=>$pullable_modules,
'views'=>$views,
'countries'=>$countries,
'regions'=>$regions,
'title'=>static::displayname()
));
} | Class | 2 |
function cleanCSV($string)
{
$check = '/^[=@]/';
if (!is_numeric($string)) {
$check = '/^[=@+-]/';
}
return preg_replace($check, "", $string);
} | Base | 1 |
End of preview. Expand
in Dataset Viewer.
README.md exists but content is empty.
- Downloads last month
- 34