code
stringlengths 12
2.05k
| label_name
stringclasses 5
values | label
int64 0
4
|
---|---|---|
private static function isNonStandardPort($scheme, $host, $port)
{
if (!$scheme && $port) {
return true;
}
if (!$host || !$port) {
return false;
}
return !isset(static::$schemes[$scheme]) || $port !== static::$schemes[$scheme];
} | Base | 1 |
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 |
function render($mode, &$renderer, $data) {
if($mode == 'xhtml') {
global $conf;
$id = $data[0];
$name = $data[1];
//prepare for formating
$link['target'] = $conf['target']['wiki'];
$link['style'] = '';
$link['pre'] = '';
$link['suf'] = '';
$link['more'] = '';
$link['class'] = 'internallink';
$link['url'] = DOKU_INTERNAL_LINK . $id;
$link['name'] = ($name) ? $name : $id;
$link['title'] = ($name) ? $name : $id;
//add search string
if($search){
($conf['userewrite']) ? $link['url'].='?s=' : $link['url'].='&s=';
$link['url'] .= urlencode($search);
}
//output formatted
$renderer->doc .= $renderer->_formatLink($link);
}
return true;
} | Base | 1 |
public function getItems2 (
$prefix='', $page=0, $limit=20, $valueAttr='name', $nameAttr='name') {
$modelClass = get_class ($this->owner);
$model = CActiveRecord::model ($modelClass);
$table = $model->tableName ();
$offset = intval ($page) * intval ($limit);
AuxLib::coerceToArray ($valueAttr);
$modelClass::checkThrowAttrError (array_merge ($valueAttr, array ($nameAttr)));
$params = array ();
if ($prefix !== '') {
$params[':prefix'] = $prefix . '%';
}
$offset = abs ((int) $offset);
$limit = abs ((int) $limit);
$command = Yii::app()->db->createCommand ("
SELECT " . implode (',', $valueAttr) . ", $nameAttr as __name
FROM $table
WHERE " . ($prefix === '' ?
'1=1' : ($nameAttr . ' LIKE :prefix')
) . "
ORDER BY __name
LIMIT $offset, $limit
"); | Class | 2 |
foreach ($allgroups as $gid) {
$g = group::getGroupById($gid);
expPermissions::grantGroup($g, 'manage', $sloc);
}
| 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);
}
| Class | 2 |
$modelNames[ucfirst($module->name)] = self::getModelTitle($modelName);
}
asort ($modelNames);
if ($criteria !== null) {
return $modelNames;
} else {
self::$_modelNames = $modelNames;
}
}
return self::$_modelNames;
} | Base | 1 |
function selectBillingOptions() {
} | Class | 2 |
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 |
public static function add() {
}
| Base | 1 |
public function getPopular(){
$url = "http://api.themoviedb.org/3/movie/popular?api_key=".$this->apikey;
$popular = $this->curl($url);
return $popular;
}
| Base | 1 |
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 |
$module_views[$key]['name'] = gt($value['name']);
}
// look for a config form for this module's current view
// $controller->loc->mod = expModules::getControllerClassName($controller->loc->mod);
//check to see if hcview was passed along, indicating a hard-coded module
// if (!empty($controller->params['hcview'])) {
// $viewname = $controller->params['hcview'];
// } else {
// $viewname = $db->selectValue('container', 'view', "internal='".serialize($controller->loc)."'");
// }
// $viewconfig = $viewname.'.config';
// foreach ($modpaths as $path) {
// if (file_exists($path.'/'.$viewconfig)) {
// $fileparts = explode('_', $viewname);
// if ($fileparts[0]=='show'||$fileparts[0]=='showall') array_shift($fileparts);
// $module_views[$viewname]['name'] = ucwords(implode(' ', $fileparts)).' '.gt('View Configuration');
// $module_views[$viewname]['file'] =$path.'/'.$viewconfig;
// }
// }
// sort the views highest to lowest by filename
// we are reverse sorting now so our array merge
// will overwrite property..we will run array_reverse
// when we're finished to get them back in the right order
krsort($common_views);
krsort($module_views);
if (!empty($moduleconfig)) $common_views = array_merge($common_views, $moduleconfig);
$views = array_merge($common_views, $module_views);
$views = array_reverse($views);
return $views;
} | Class | 2 |
public function setLoggerChannel($channel = 'Organizr', $username = null)
{
if ($this->hasDB()) {
$setLogger = false;
if ($username) {
$username = htmlspecialchars($username);
}
if ($this->logger) {
if ($channel) {
if (strtolower($this->logger->getChannel()) !== strtolower($channel)) {
$setLogger = true;
}
}
if ($username) {
if (strtolower($this->logger->getTraceId()) !== strtolower($channel)) {
$setLogger = true;
}
}
} else {
$setLogger = true;
}
if ($setLogger) {
$channel = $channel ?: 'Organizr';
return $this->setupLogger($channel, $username);
} else {
return $this->logger;
}
}
} | Base | 1 |
function update_upcharge() {
$this->loc->src = "@globalstoresettings";
$config = new expConfig($this->loc);
$this->config = $config->config;
//This will make sure that only the country or region that given a rate value will be saved in the db
$upcharge = array();
foreach($this->params['upcharge'] as $key => $item) {
if(!empty($item)) {
$upcharge[$key] = $item;
}
}
$this->config['upcharge'] = $upcharge;
$config->update(array('config'=>$this->config));
flash('message', gt('Configuration updated'));
expHistory::back();
} | Base | 1 |
public function updateTab($id, $array)
{
if (!$id || $id == '') {
$this->setAPIResponse('error', 'id was not set', 422);
return null;
}
if (!$array) {
$this->setAPIResponse('error', 'no data was sent', 422);
return null;
}
$tabInfo = $this->getTabById($id);
if ($tabInfo) {
$array = $this->checkKeys($tabInfo, $array);
} else {
$this->setAPIResponse('error', 'No tab info found', 404);
return false;
}
if (array_key_exists('name', $array)) {
$array['name'] = htmlspecialchars($array['name']);
if ($this->isTabNameTaken($array['name'], $id)) {
$this->setAPIResponse('error', 'Tab name: ' . $array['name'] . ' is already taken', 409);
return false;
}
}
if (array_key_exists('default', $array)) {
if ($array['default']) {
$this->clearTabDefault();
}
}
$response = [
array(
'function' => 'query',
'query' => array(
'UPDATE tabs SET',
$array,
'WHERE id = ?',
$id
)
),
];
$this->setAPIResponse(null, 'Tab info updated');
$this->setLoggerChannel('Tab Management');
$this->logger->debug('Edited Tab Info for [' . $tabInfo['name'] . ']');
return $this->processQueries($response);
} | Base | 1 |
$instance->processor = [0 => ${($_ = isset($this->services['App\Db']) ? $this->services['App\Db'] : $this->getDbService()) && false ?: '_'}, 1 => ${($_ = isset($this->services['App\Bus']) ? $this->services['App\Bus'] : $this->getBusService()) && false ?: '_'}]; | Base | 1 |
public function manage()
{
expHistory::set('manageable',$this->params);
$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
));
} | Base | 1 |
public function __construct(public Config $Config, private Sql $Sql)
{
$this->Db = Db::getConnection();
} | Base | 1 |
public function testCheckHTTP()
{
if (! function_exists('curl_init')) {
$this->markTestSkipped('Missing curl extension!');
}
$this->assertTrue(
$this->object->checkHTTP("http://www.phpmyadmin.net/test/data")
);
$this->assertContains(
"TEST DATA",
$this->object->checkHTTP("http://www.phpmyadmin.net/test/data", true)
);
$this->assertFalse(
$this->object->checkHTTP("http://www.phpmyadmin.net/test/nothing")
);
} | Class | 2 |
$a = ${($_ = isset($this->services['App\Registry']) ? $this->services['App\Registry'] : $this->getRegistryService()) && false ?: '_'}; | Base | 1 |
public static function inc ($vars, $data = "") {
$file = GX_PATH.'/gxadmin/inc/'.$vars.'.php';
if (file_exists($file)) {
include($file);
}
}
| Base | 1 |
function edit_optiongroup_master() {
expHistory::set('editable', $this->params);
$id = isset($this->params['id']) ? $this->params['id'] : null;
$record = new optiongroup_master($id);
assign_to_template(array(
'record'=>$record
));
} | Class | 2 |
foreach($functions as $function)
{
if($function->id == $f)
{
if($function->enabled=='1')
$sortable_assigned[] = '<li class="ui-state-highlight" value="'.$function->id.'" category="'.$function->category.'"><img src="'.NAVIGATE_URL.'/'.$function->icon.'" align="absmiddle" /> '.t($function->lid, $function->lid).'</li>';
else
$sortable_assigned[] = '<li class="ui-state-highlight ui-state-disabled" value="'.$function->id.'" category="'.$function->category.'"><img src="'.NAVIGATE_URL.'/'.$function->icon.'" align="absmiddle" /> '.t($function->lid, $function->lid).'</li>';
}
}
| Base | 1 |
function VerifyVariableSchedule($columns)
{
// $teacher=$columns['TEACHER_ID'];
// $secteacher=$columns['SECONDARY_TEACHER_ID'];
// if($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']!='')
// $all_teacher=$teacher.($secteacher!=''?','.$secteacher:'');
// else
// $all_teacher=($secteacher!=''?$secteacher:'');
$teacher=($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']!=''?$_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']:$columns['TEACHER_ID']);
$secteacher=($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['SECONDARY_TEACHER_ID']!=''?$_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['SECONDARY_TEACHER_ID']:$columns['SECONDARY_TEACHER_ID']);
// $secteacher=$qr_teachers[1]['SECONDARY_TEACHER_ID'];
if($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']!='')
$all_teacher=$teacher.($secteacher!=''?','.$secteacher:''); | Base | 1 |
public function comments_count()
{
global $DB;
if(empty($this->_comments_count))
{
$DB->query('
SELECT COUNT(*) as total
FROM nv_comments
WHERE website = ' . protect($this->website) . '
AND object_type = "item"
AND object_id = ' . protect($this->id) . '
AND status = 0'
);
$out = $DB->result('total');
$this->_comments_count = $out[0];
}
return $this->_comments_count;
}
| Base | 1 |
public function AddCC($address, $name = '') {
return $this->AddAnAddress('cc', $address, $name);
} | Base | 1 |
static function author() {
return "Dave Leffler";
}
| Base | 1 |
function wp_embed_handler_youtube( $matches, $attr, $url, $rawattr ) {
global $wp_embed;
$embed = $wp_embed->autoembed( "https://youtube.com/watch?v={$matches[2]}" );
/**
* Filters the YoutTube embed output.
*
* @since 4.0.0
*
* @see wp_embed_handler_youtube()
*
* @param string $embed YouTube embed output.
* @param array $attr An array of embed attributes.
* @param string $url The original URL that was matched by the regex.
* @param array $rawattr The original unmodified attributes.
*/
return apply_filters( 'wp_embed_handler_youtube', $embed, $attr, $url, $rawattr );
} | Base | 1 |
public static function isHadSub($parent, $menuid =''){
$sql = sprintf("SELECT * FROM `menus` WHERE `parent` = '%s' %s", $parent, $where);
} | Base | 1 |
$data .= '<input type="hidden" name="'.htmlspecialchars($key).'" value="'.htmlspecialchars($value).'" />';
}
echo "<html><head><title>CSRF check failed</title></head>
<body>
<p>CSRF check failed. Your form session may have expired, or you may not have
cookies enabled.</p>
<form method='post' action=''>$data<input type='submit' value='Try again' /></form>
<p>Debug: $tokens</p></body></html>
";
} | Compound | 4 |
private function __pullEvent($eventId, &$successes, &$fails, $eventModel, $server, $user, $jobId)
{
$event = $eventModel->downloadEventFromServer(
$eventId,
$server
);
if (!empty($event)) {
if ($this->__checkIfEventIsBlockedBeforePull($event)) {
return false;
}
$event = $this->__updatePulledEventBeforeInsert($event, $server, $user);
if (!$this->__checkIfEventSaveAble($event)) {
$fails[$eventId] = __('Empty event detected.');
} else {
$this->__checkIfPulledEventExistsAndAddOrUpdate($event, $eventId, $successes, $fails, $eventModel, $server, $user, $jobId);
}
} else {
// error
$fails[$eventId] = __('failed downloading the event') . ': ' . json_encode($event);
}
return true;
} | Class | 2 |
public function __construct () {
}
| Base | 1 |
public static function go($input, $path, $allowed='', $uniq=false, $size='', $width = '', $height = ''){
$filename = Typo::cleanX($_FILES[$input]['name']);
$filename = str_replace(' ', '_', $filename);
if(isset($_FILES[$input]) && $_FILES[$input]['error'] == 0){
if($uniq == true){
$uniqfile = sha1(microtime().$filename);
}else{
$uniqfile = '';
}
$extension = pathinfo($_FILES[$input]['name'], PATHINFO_EXTENSION);
$filetmp = $_FILES[$input]['tmp_name'];
$filepath = GX_PATH.$path.$uniqfile.$filename;
if(!in_array(strtolower($extension), $allowed)){
$result['error'] = 'File not allowed';
}else{
if(move_uploaded_file(
$filetmp,
$filepath)
){
$result['filesize'] = filesize($filepath);
$result['filename'] = $uniqfile.$filename;
$result['path'] = $path.$uniqfile.$filename;
$result['filepath'] = $filepath;
$result['fileurl'] = Options::get('siteurl').$path.$uniqfile.$filename;
}else{
$result['error'] = 'Cannot upload to directory, please check
if directory is exist or You had permission to write it.';
}
}
}else{
//$result['error'] = $_FILES[$input]['error'];
$result['error'] = '';
}
return $result;
} | Base | 1 |
public function approve_toggle() {
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']) ? 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->approved = $comment->approved == 1 ? 0 : 1;
if ($comment->approved) {
$this->sendApprovalNotification($comment,$this->params);
}
$comment->save();
expHistory::back();
} | Base | 1 |
$removed[] = $fi->getFilename();
}
if ($removed = implode(', ', $removed)) {
$result .= $removed . ' ' . dgettext('tuleap-tracker', 'removed');
}
$added = $this->fetchAddedFiles(array_diff($this->files, $changeset_value->getFiles()), $format, $is_for_mail);
if ($added && $result) {
$result .= $format === 'html' ? '; ' : PHP_EOL;
}
$result .= $added;
return $result;
}
return false;
} | Base | 1 |
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 |
public static function BBCode2Html($text) {
$text = trim($text);
$text = self::parseEmoji($text);
// Smileys to find...
$in = array(
);
// And replace them by...
$out = array(
);
$in[] = '[/*]';
$in[] = '[*]';
$out[] = '</li>';
$out[] = '<li>';
$text = str_replace($in, $out, $text);
// BBCode to find...
$in = array( '/\[b\](.*?)\[\/b\]/ms',
'/\[i\](.*?)\[\/i\]/ms',
'/\[u\](.*?)\[\/u\]/ms',
'/\[mark\](.*?)\[\/mark\]/ms',
'/\[s\](.*?)\[\/s\]/ms',
'/\[list\=(.*?)\](.*?)\[\/list\]/ms',
'/\[list\](.*?)\[\/list\]/ms',
'/\[\*\]\s?(.*?)\n/ms',
'/\[fs(.*?)\](.*?)\[\/fs(.*?)\]/ms',
'/\[color\=(.*?)\](.*?)\[\/color\]/ms'
);
// And replace them by...
$out = array( '<strong>\1</strong>',
'<em>\1</em>',
'<u>\1</u>',
'<mark>\1</mark>',
'<strike>\1</strike>',
'<ol start="\1">\2</ol>',
'<ul>\1</ul>',
'<li>\1</li>',
'<span style="font-size:\1pt">\2</span>',
'<span style="color:#\1">\2</span>'
);
$text = preg_replace($in, $out, $text);
// Prepare quote's
$text = str_replace("\r\n","\n",$text);
// paragraphs
$text = str_replace("\r", "", $text);
$text = nl2br($text);
// clean some tags to remain strict
// not very elegant, but it works. No time to do better ;)
if (!function_exists('removeBr')) {
function removeBr($s) {
return str_replace("<br />", "", $s[0]);
}
}
$text = preg_replace_callback('/<pre>(.*?)<\/pre>/ms', "removeBr", $text);
$text = preg_replace('/<p><pre>(.*?)<\/pre><\/p>/ms', "<pre>\\1</pre>", $text);
$text = preg_replace_callback('/<ul>(.*?)<\/ul>/ms', "removeBr", $text);
$text = preg_replace('/<p><ul>(.*?)<\/ul><\/p>/ms', "<ul>\\1</ul>", $text);
return $text;
} | Base | 1 |
public function delete() {
global $user;
$count = $this->address->find('count', 'user_id=' . $user->id);
if($count > 1)
{
$address = new address($this->params['id']);
if ($user->isAdmin() || ($user->id == $address->user_id)) {
if ($address->is_billing)
{
$billAddress = $this->address->find('first', 'user_id=' . $user->id . " AND id != " . $address->id);
$billAddress->is_billing = true;
$billAddress->save();
}
if ($address->is_shipping)
{
$shipAddress = $this->address->find('first', 'user_id=' . $user->id . " AND id != " . $address->id);
$shipAddress->is_shipping = true;
$shipAddress->save();
}
parent::delete();
}
}
else
{
flash("error", gt("You must have at least one address."));
}
expHistory::back();
} | Base | 1 |
function critere_where_dist($idb, &$boucles, $crit) {
$boucle = &$boucles[$idb];
if (isset($crit->param[0])) {
$_where = calculer_liste($crit->param[0], $idb, $boucles, $boucle->id_parent);
} else {
$_where = '@$Pile[0]["where"]';
}
if ($crit->cond) {
$_where = "(($_where) ? ($_where) : '')";
}
if ($crit->not) {
$_where = "array('NOT',$_where)";
}
$boucle->where[] = $_where;
} | Base | 1 |
public function update_groupdiscounts() {
global $db;
if (empty($this->params['id'])) {
// look for existing discounts for the same group
$existing_id = $db->selectValue('groupdiscounts', 'id', 'group_id='.$this->params['group_id']);
if (!empty($existing_id)) flashAndFlow('error',gt('There is already a discount for that group.'));
}
$gd = new groupdiscounts();
$gd->update($this->params);
expHistory::back();
} | Class | 2 |
public static function dropdown($vars){
if(is_array($vars)){
//print_r($vars);
$name = $vars['name'];
$where = "WHERE ";
if(isset($vars['type'])) {
$where .= " `type` = '{$vars['type']}' AND ";
}else{
$where .= " ";
}
$where .= " `status` = '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']}";
}else{
$sort = 'ASC';
}
}
$cat = Db::result("SELECT * FROM `posts` {$where} {$order_by} {$sort}");
$num = Db::$num_rows;
$drop = "<select name=\"{$name}\" class=\"form-control\"><option></option>";
if($num > 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->title}</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;
} | Base | 1 |
static function activate($uid, $karmalevel = 'pear.dev')
{
require_once 'Damblan/Karma.php';
global $dbh, $auth_user;
$karma = new Damblan_Karma($dbh);
$user = user::info($uid, null, 0);
if (!isset($user['registered'])) {
return false;
}
@$arr = unserialize($user['userinfo']);
include_once 'pear-database-note.php';
note::removeAll($uid);
$data = array();
$data['registered'] = 1;
$data['active'] = 1;
/* $data['ppp_only'] = 0; */
if (is_array($arr)) {
$data['userinfo'] = $arr[1];
}
$data['created'] = gmdate('Y-m-d H:i');
$data['createdby'] = $auth_user->handle;
$data['handle'] = $user['handle'];
user::update($data, true);
$karma->grant($user['handle'], $karmalevel);
if ($karma->has($user['handle'], 'pear.dev')) {
include_once 'pear-rest.php';
$pear_rest = new pearweb_Channel_REST_Generator(PEAR_REST_PATH, $dbh);
$pear_rest->saveMaintainerREST($user['handle']);
$pear_rest->saveAllMaintainersREST();
}
include_once 'pear-database-note.php';
note::add($uid, "Account opened");
$msg = "Your PEAR account request has been opened.\n".
"To log in, go to http://" . PEAR_CHANNELNAME . "/ and click on \"login\" in\n".
"the top-right menu.\n";
$xhdr = 'From: ' . $auth_user->handle . '@php.net';
if (!DEVBOX) {
mail($user['email'], "Your PEAR Account Request", $msg, $xhdr, '-f ' . PEAR_BOUNCE_EMAIL);
}
return true;
} | 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,
)));
} | 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);
} | Class | 2 |
protected function getFoo2Service()
{
return $this->services['Foo\Foo'] = new \Foo\Foo();
} | Base | 1 |
public function getQuerySelect()
{
$R1 = 'R1_' . $this->field->id;
$R2 = 'R2_' . $this->field->id;
$R3 = 'R3_' . $this->field->id;
return "$R2.user_id AS `" . $this->field->name . "`";
} | Base | 1 |
protected function _joinPath($dir, $name)
{
return rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $name;
} | Base | 1 |
$date->delete(); // event automatically deleted if all assoc eventdates are deleted
}
expHistory::back();
}
| Base | 1 |
function nvweb_content_comments_count($object_id = NULL, $object_type = "item")
{
global $DB;
global $website;
global $current;
$element = $current['object'];
if($current['type']=='structure' && $object_type == "item")
$element = $element->elements(0); // item = structure->elements(first)
if(empty($object_id))
$object_id = $element->id;
$DB->query('SELECT COUNT(*) as total
FROM nv_comments
WHERE website = '.protect($website->id).'
AND object_type = "'.$object_type.'"
AND object_id = '.protect($object_id).'
AND status = 0'
);
$out = $DB->result('total');
return $out[0];
}
| Base | 1 |
public static function meta($cont_title='', $cont_desc='', $pre =''){
global $data;
//print_r($data);
//if(empty($data['posts'][0]->title)){
if(is_array($data) && isset($data['posts'][0]->title)){
$sitenamelength = strlen(Options::get('sitename'));
$limit = 70-$sitenamelength-6;
$cont_title = substr(Typo::Xclean(Typo::strip($data['posts'][0]->title)),0,$limit);
$titlelength = strlen($data['posts'][0]->title);
if($titlelength > $limit+3) { $dotted = "...";} else {$dotted = "";}
$cont_title = "{$pre} {$cont_title}{$dotted} - ";
}else{
$cont_title = "";
}
if(is_array($data) && isset($data['posts'][0]->content)){
$desc = Typo::strip($data['posts'][0]->content);
}else{
$desc = "";
}
$meta = "
<!--// Start Meta: Generated Automaticaly by GeniXCMS -->
<!-- SEO: Title stripped 70chars for SEO Purpose -->
<title>{$cont_title}".Options::get('sitename')."</title>
<meta name=\"Keyword\" content=\"".Options::get('sitekeywords')."\">
<!-- SEO: Description stripped 150chars for SEO Purpose -->
<meta name=\"Description\" content=\"".self::desc($desc)."\">
<meta name=\"Author\" content=\"Puguh Wijayanto | MetalGenix IT Solutions - www.metalgenix.com\">
<meta name=\"Generator\" content=\"GeniXCMS\">
<meta name=\"robots\" content=\"".Options::get('robots')."\">
<meta name=\"revisit-after\" content=\" days\">
<link rel=\"shortcut icon\" href=\"".Options::get('siteicon')."\" />
";
$meta .= "
<!-- Generated Automaticaly by GeniXCMS :End Meta //-->";
echo $meta;
} | 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 |
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 function rules()
{
return [
'sku' => ['required'],
'name' => ['required', Rule::unique('products')->ignore($this->segment(3))],
'quantity' => ['required', 'integer', 'min:0'],
'price' => ['required', 'numeric', 'min:0'],
'sale_price' => ['nullable', 'numeric'],
'weight' => ['nullable', 'numeric', 'min:0']
];
} | Base | 1 |
function searchName() { return gt('Webpage'); }
| Base | 1 |
public function updateAmazonOrderTracking($order_id, $courier_id, $courier_from_list, $tracking_no) {
$this->db->query("
UPDATE `" . DB_PREFIX . "amazon_order`
SET `courier_id` = '" . $courier_id . "',
`courier_other` = " . (int)!$courier_from_list . ",
`tracking_no` = '" . $tracking_no . "'
WHERE `order_id` = " . (int)$order_id . ""); | Base | 1 |
function build_daterange_sql($timestamp, $endtimestamp=null, $field='date', $multiday=false) {
if (empty($endtimestamp)) {
$date_sql = "((".$field." >= " . expDateTime::startOfDayTimestamp($timestamp) . " AND ".$field." <= " . expDateTime::endOfDayTimestamp($timestamp) . ")";
} else {
$date_sql = "((".$field." >= " . expDateTime::startOfDayTimestamp($timestamp) . " AND ".$field." <= " . expDateTime::endOfDayTimestamp($endtimestamp) . ")";
}
if ($multiday)
$date_sql .= " OR (" . expDateTime::startOfDayTimestamp($timestamp) . " BETWEEN ".$field." AND dateFinished)";
$date_sql .= ")";
return $date_sql;
}
| Base | 1 |
public function pluginDetails()
{
return [
'name' => 'Debugbar',
'description' => 'Debugbar integration for OctoberCMS.',
'author' => 'RainLab',
'icon' => 'icon-cog',
'homepage' => 'https://github.com/rainlab/debugbar-plugin'
];
} | Base | 1 |
function delete_selected() {
$item = $this->event->find('first', 'id=' . $this->params['id']);
if ($item && $item->is_recurring == 1) {
$event_remaining = false;
$eventdates = $item->eventdate[0]->find('all', 'event_id=' . $item->id);
foreach ($eventdates as $ed) {
if (array_key_exists($ed->id, $this->params['dates'])) {
$ed->delete();
} else {
$event_remaining = true;
}
}
if (!$event_remaining) {
$item->delete(); // model will also ensure we delete all event dates
}
expHistory::back();
} else {
notfoundController::handle_not_found();
}
}
| Base | 1 |
private function edebug($str) {
if ($this->Debugoutput == "error_log") {
error_log($str);
} else {
echo $str;
}
} | Class | 2 |
function __construct(bool $connect = false) {
global $CFG_GLPI;
$options = [
'base_uri' => GLPI_MARKETPLACE_PLUGINS_API_URI,
'connect_timeout' => self::TIMEOUT,
];
// add proxy string if configured in glpi
if (!empty($CFG_GLPI["proxy_name"])) {
$proxy_creds = !empty($CFG_GLPI["proxy_user"])
? $CFG_GLPI["proxy_user"].":".Toolbox::decrypt($CFG_GLPI["proxy_passwd"], GLPIKEY)."@"
: "";
$proxy_string = "http://{$proxy_creds}".$CFG_GLPI['proxy_name'].":".$CFG_GLPI['proxy_port'];
$options['proxy'] = $proxy_string;
}
// init guzzle client with base options
$this->httpClient = new Guzzle_Client($options);
} | Class | 2 |
$name = ucfirst($module->name);
if (in_array($name, $skipModules)) {
continue;
}
if($name != 'Document'){
$controllerName = $name.'Controller';
if(file_exists('protected/modules/'.$module->name.'/controllers/'.$controllerName.'.php')){
Yii::import("application.modules.$module->name.controllers.$controllerName");
$controller = new $controllerName($controllerName);
$model = $controller->modelClass;
if(class_exists($model)){
$moduleList[$model] = Yii::t('app', $module->title);
}
}
}
}
return $moduleList;
} | Class | 2 |
public function validateForField(App\Request $request)
{
$fieldModel = Vtiger_Module_Model::getInstance($request->getModule())->getFieldByName($request->getByType('fieldName', 2));
if (!$fieldModel || !$fieldModel->isActiveField() || !$fieldModel->isViewEnabled()) {
throw new \App\Exceptions\NoPermitted('ERR_NO_PERMISSIONS_TO_FIELD', 406);
}
$recordModel = \Vtiger_Record_Model::getCleanInstance($fieldModel->getModuleName());
$fieldModel->getUITypeModel()->setValueFromRequest($request, $recordModel, 'fieldValue');
$response = new Vtiger_Response();
$response->setResult([
'raw' => $recordModel->get($fieldModel->getName()),
'display' => $recordModel->getDisplayValue($fieldModel->getName()),
]);
$response->emit();
} | Base | 1 |
function selectArraysBySql($sql) {
$res = @mysqli_query($this->connection, $this->injectProof($sql));
if ($res == null)
return array();
$arrays = array();
for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)
$arrays[] = mysqli_fetch_assoc($res);
return $arrays;
} | Base | 1 |
public function confirm()
{
$task = $this->getTask();
$link = $this->getTaskLink();
$this->response->html($this->template->render('task_internal_link/remove', array(
'link' => $link,
'task' => $task,
)));
} | Base | 1 |
public function editTitle() {
global $user;
$file = new expFile($this->params['id']);
if ($user->id==$file->poster || $user->isAdmin()) {
$file->title = $this->params['newValue'];
$file->save();
$ar = new expAjaxReply(200, gt('Your title was updated successfully'), $file);
} else {
$ar = new expAjaxReply(300, gt("You didn't create this file, so you can't edit it."));
}
$ar->send();
} | Base | 1 |
$backup = ['sys' => $GLOBALS['TYPO3_CONF_VARS']['SYS'], 'server' => $_SERVER]; | Variant | 0 |
public function testReturnsIdentityWhenRemovingMissingHeader()
{
$r = new Response();
$this->assertSame($r, $r->withoutHeader('foo'));
} | Base | 1 |
public function update()
{
global $DB;
global $events;
if(!is_array($this->categories))
$this->categories = array();
$ok = $DB->execute('
UPDATE nv_feeds
SET categories = :categories, format = :format, image = :image, entries = :entries,
content = :content, views = :views, permission = :permission, enabled = :enabled
WHERE id = :id AND website = :website',
array(
'id' => $this->id,
'website' => $this->website,
'categories' => implode(',', $this->categories),
'format' => $this->format,
'image' => value_or_default($this->image, 0),
'entries' => value_or_default($this->entries, 10),
'content' => $this->content,
'views' => value_or_default($this->views, 0),
'permission' => value_or_default($this->permission, 0),
'enabled' => value_or_default($this->enabled, 0)
)
);
if(!$ok)
throw new Exception($DB->get_last_error());
webdictionary::save_element_strings('feed', $this->id, $this->dictionary);
path::saveElementPaths('feed', $this->id, $this->paths);
if(method_exists($events, 'trigger'))
{
$events->trigger(
'feed',
'save',
array(
'feed' => $this
)
);
}
return true;
}
| Base | 1 |
protected function fsock_get_contents(&$url, $timeout, $redirect_max, $ua, $outfp)
{
$connect_timeout = 3;
$connect_try = 3;
$method = 'GET';
$readsize = 4096;
$ssl = '';
$getSize = null;
$headers = '';
$arr = parse_url($url);
if (!$arr) {
// Bad request
return false;
}
if ($arr['scheme'] === 'https') {
$ssl = 'ssl://';
}
// query
$arr['query'] = isset($arr['query']) ? '?' . $arr['query'] : '';
// port
$port = isset($arr['port']) ? $arr['port'] : '';
$arr['port'] = $port ? $port : ($ssl ? 443 : 80);
$url_base = $arr['scheme'] . '://' . $arr['host'] . ($port ? (':' . $port) : ''); | Base | 1 |
public function configure() {
$this->config['defaultbanner'] = array();
if (!empty($this->config['defaultbanner_id'])) {
$this->config['defaultbanner'][] = new expFile($this->config['defaultbanner_id']);
}
parent::configure();
$banners = $this->banner->find('all', null, 'companies_id');
assign_to_template(array(
'banners'=>$banners,
'title'=>static::displayname()
));
} | 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()
));
} | Base | 1 |
public static function v($vars) {
$opt = self::$_data;
// echo "<pre>";
foreach ($opt as $k => $v) {
// echo $v->name;
if ($v->name == $vars) {
return $v->value;
}
}
// echo "</pre>";
}
| Base | 1 |
public function pending() {
// global $db;
// make sure we have what we need.
if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('Your subscriber ID was not supplied.'));
// find the subscriber and their pending subscriptions
$ealerts = expeAlerts::getPendingBySubscriber($this->params['id']);
$subscriber = new subscribers($this->params['id']);
// render the template
assign_to_template(array(
'subscriber'=>$subscriber,
'ealerts'=>$ealerts
));
} | Class | 2 |
public function testIdExceptionPhp53()
{
if (PHP_VERSION_ID >= 50400) {
$this->markTestSkipped('Test skipped, for PHP 5.3 only.');
}
$this->proxy->setActive(true);
$this->proxy->setId('foo');
} | Base | 1 |
public function verifyPhoneNumber(App\Request $request)
{
if ('phone' !== $this->fieldModel->getFieldDataType()) {
throw new \App\Exceptions\NoPermitted('ERR_NO_PERMISSIONS_TO_FIELD');
}
$response = new Vtiger_Response();
$data = ['isValidNumber' => false];
if ($request->isEmpty('phoneCountry', true)) {
$data['message'] = \App\Language::translate('LBL_NO_PHONE_COUNTRY');
}
if (empty($data['message'])) {
try {
$data = App\Fields\Phone::verifyNumber($request->getByType('phoneNumber', 'Text'), $request->getByType('phoneCountry', 1));
} catch (\App\Exceptions\FieldException $e) {
$data = ['isValidNumber' => false];
}
}
if (!$data['isValidNumber'] && empty($data['message'])) {
$data['message'] = \App\Language::translate('LBL_INVALID_PHONE_NUMBER');
}
$response->setResult($data);
$response->emit();
} | 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 |
static function displayname() {
return "Events";
}
| Class | 2 |
protected function _move($source, $targetDir, $name) {
$target = $this->_joinPath($targetDir, $name);
$ret = @rename($source, $target) ? $target : false;
$ret && clearstatcache();
return $ret;
} | Base | 1 |
public function manage_sitemap() {
global $db, $user, $sectionObj, $sections;
expHistory::set('viewable', $this->params);
$id = $sectionObj->id;
$current = null;
// all we need to do is determine the current section
$navsections = $sections;
if ($sectionObj->parent == -1) {
$current = $sectionObj;
} else {
foreach ($navsections as $section) {
if ($section->id == $id) {
$current = $section;
break;
}
}
}
assign_to_template(array(
'sasections' => $db->selectObjects('section', 'parent=-1'),
'sections' => $navsections,
'current' => $current,
'canManage' => ((isset($user->is_acting_admin) && $user->is_acting_admin == 1) ? 1 : 0),
));
}
| 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()
));
} | Base | 1 |
public function manage_messages() {
expHistory::set('manageable', $this->params);
$page = new expPaginator(array(
'model'=>'order_status_messages',
'where'=>1,
'limit'=>10,
'order'=>'body',
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->params['controller'],
'action'=>$this->params['action'],
//'columns'=>array('Name'=>'title')
));
//eDebug($page);
assign_to_template(array(
'page'=>$page
));
} | Base | 1 |
public static function DragnDropReRank2() {
global $router, $db;
$id = $router->params['id'];
$page = new section($id);
$old_rank = $page->rank;
$old_parent = $page->parent;
$new_rank = $router->params['position'] + 1; // rank
$new_parent = intval($router->params['parent']);
$db->decrement($page->tablename, 'rank', 1, 'rank>' . $old_rank . ' AND parent=' . $old_parent); // close in hole
$db->increment($page->tablename, 'rank', 1, 'rank>=' . $new_rank . ' AND parent=' . $new_parent); // make room
$params = array();
$params['parent'] = $new_parent;
$params['rank'] = $new_rank;
$page->update($params);
self::checkForSectionalAdmins($id);
expSession::clearAllUsersSessionCache('navigation');
}
| Class | 2 |
public function edit(Request $request, $id) {
return $this->view('post::admin.posts.edit', [
'content_id'=>$id
]);
} | Base | 1 |
public function getQuerySelect()
{
$R1 = 'R1_' . $this->id;
$R2 = 'R2_' . $this->id;
return "$R2.value AS `" . $this->name . "`";
} | Base | 1 |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$swimlane_id = $this->request->getIntegerParam('swimlane_id');
if ($this->swimlaneModel->remove($project['id'], $swimlane_id)) {
$this->flash->success(t('Swimlane removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this swimlane.'));
}
$this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
} | Base | 1 |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$swimlane_id = $this->request->getIntegerParam('swimlane_id');
if ($this->swimlaneModel->remove($project['id'], $swimlane_id)) {
$this->flash->success(t('Swimlane removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this swimlane.'));
}
$this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
} | Base | 1 |
public function downloadfile() {
if (empty($this->params['fileid'])) {
flash('error', gt('There was an error while trying to download your file. No File Specified.'));
expHistory::back();
}
$fd = new filedownload($this->params['fileid']);
if (empty($this->params['filenum'])) $this->params['filenum'] = 0;
if (empty($fd->expFile['downloadable'][$this->params['filenum']]->id)) {
flash('error', gt('There was an error while trying to download your file. The file you were looking for could not be found.'));
expHistory::back();
}
$fd->downloads++;
$fd->save();
// this will set the id to the id of the actual file..makes the download go right.
$this->params['id'] = $fd->expFile['downloadable'][$this->params['filenum']]->id;
parent::downloadfile();
} | Base | 1 |
public function editAlt() {
global $user;
$file = new expFile($this->params['id']);
if ($user->id==$file->poster || $user->isAdmin()) {
$file->alt = $this->params['newValue'];
$file->save();
$ar = new expAjaxReply(200, gt('Your alt was updated successfully'), $file);
} else {
$ar = new expAjaxReply(300, gt("You didn't create this file, so you can't edit it."));
}
$ar->send();
echo json_encode($file); //FIXME we exit before hitting this
} | Class | 2 |
function PMA_countLines($filename)
{
global $LINE_COUNT;
if (defined('LINE_COUNTS')) {
return $LINE_COUNT[$filename];
}
// ensure that the file is inside the phpMyAdmin folder
$depath = 1;
foreach (explode('/', $filename) as $part) {
if ($part == '..') {
$depath--;
} elseif ($part != '.') {
$depath++;
}
if ($depath < 0) {
return 0;
}
}
$linecount = 0;
$handle = fopen('./js/' . $filename, 'r');
while (!feof($handle)) {
$line = fgets($handle);
if ($line === false) {
break;
}
$linecount++;
}
fclose($handle);
return $linecount;
} | Base | 1 |
public function getAlpha($key, $default = '', $deep = false)
{
return preg_replace('/[^[:alpha:]]/', '', $this->get($key, $default, $deep));
} | 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 |
$section = new section(intval($page));
if ($section) {
// self::deleteLevel($section->id);
$section->delete();
}
}
}
| Class | 2 |
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId());
$this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']);
} | Base | 1 |
public function getPageData()
{
$data = parent::getPageData();
$data['menu'] = 'admin';
$data['showonmenu'] = false;
$data['title'] = 'options';
$data['icon'] = 'fas fa-wrench';
return $data;
} | Base | 1 |
function barcode_print($code, $encoding="ANY", $scale = 2 ,$mode = "png")
{
// DOLCHANGE LDR Add log
dol_syslog("barcode.lib.php::barcode_print $code $encoding $scale $mode");
$bars=barcode_encode($code,$encoding);
if (! $bars)
{
// DOLCHANGE LDR Return error message instead of array
$error='Bad Value '.$code.' for encoding '.$encoding;
dol_syslog('barcode.lib.php::barcode_print '.$error, LOG_ERR);
return $error;
}
if (! $mode) $mode="png";
//if (preg_match("/^(text|txt|plain)$/i",$mode)) print barcode_outtext($bars['text'],$bars['bars']);
//elseif (preg_match("/^(html|htm)$/i",$mode)) print barcode_outhtml($bars['text'],$bars['bars'], $scale,0, 0);
//else
barcode_outimage($bars['text'], $bars['bars'], $scale, $mode);
return $bars;
} | Class | 2 |
$a = ${($_ = isset($this->services['App\Processor']) ? $this->services['App\Processor'] : $this->getProcessorService()) && false ?: '_'}; | Base | 1 |
public function confirm()
{
$project = $this->getProject();
$filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id'));
$this->response->html($this->helper->layout->project('custom_filter/remove', array(
'project' => $project,
'filter' => $filter,
'title' => t('Remove a custom filter')
)));
} | Base | 1 |
function dol_print_error($db='',$error='')
{
global $conf,$langs,$argv;
global $dolibarr_main_prod;
$out = '';
$syslog = '';
// Si erreur intervenue avant chargement langue
if (! $langs)
{
require_once DOL_DOCUMENT_ROOT .'/core/class/translate.class.php';
$langs = new Translate('', $conf);
$langs->load("main");
}
$langs->load("main");
$langs->load("errors");
if ($_SERVER['DOCUMENT_ROOT']) // Mode web
{
$out.=$langs->trans("DolibarrHasDetectedError").".<br>\n";
if (! empty($conf->global->MAIN_FEATURES_LEVEL))
$out.="You use an experimental level of features, so please do NOT report any bugs, anywhere, until going back to MAIN_FEATURES_LEVEL = 0.<br>\n";
$out.=$langs->trans("InformationToHelpDiagnose").":<br>\n";
$out.="<b>".$langs->trans("Date").":</b> ".dol_print_date(time(),'dayhourlog')."<br>\n";;
$out.="<b>".$langs->trans("Dolibarr").":</b> ".DOL_VERSION."<br>\n";;
if (isset($conf->global->MAIN_FEATURES_LEVEL)) $out.="<b>".$langs->trans("LevelOfFeature").":</b> ".$conf->global->MAIN_FEATURES_LEVEL."<br>\n";;
if (function_exists("phpversion"))
{
$out.="<b>".$langs->trans("PHP").":</b> ".phpversion()."<br>\n";
//phpinfo(); // This is to show location of php.ini file
}
$out.="<b>".$langs->trans("Server").":</b> ".$_SERVER["SERVER_SOFTWARE"]."<br>\n";;
$out.="<br>\n";
$out.="<b>".$langs->trans("RequestedUrl").":</b> ".$_SERVER["REQUEST_URI"]."<br>\n";;
$out.="<b>".$langs->trans("Referer").":</b> ".(isset($_SERVER["HTTP_REFERER"])?$_SERVER["HTTP_REFERER"]:'')."<br>\n";;
$out.="<b>".$langs->trans("MenuManager").":</b> ".$conf->top_menu."<br>\n";
$out.="<br>\n";
$syslog.="url=".$_SERVER["REQUEST_URI"];
$syslog.=", query_string=".$_SERVER["QUERY_STRING"];
} | Base | 1 |
public function create_directory() {
if (!AuthUser::hasPermission('file_manager_mkdir')) {
Flash::set('error', __('You do not have sufficient permissions to create a directory.'));
redirect(get_url('plugin/file_manager/browse/'));
}
// CSRF checks
if (isset($_POST['csrf_token'])) {
$csrf_token = $_POST['csrf_token'];
if (!SecureToken::validateToken($csrf_token, BASE_URL.'plugin/file_manager/create_directory')) {
Flash::set('error', __('Invalid CSRF token found!'));
redirect(get_url('plugin/file_manager/browse/'));
}
}
else {
Flash::set('error', __('No CSRF token found!'));
redirect(get_url('plugin/file_manager/browse/'));
}
$data = $_POST['directory'];
$path = str_replace('..', '', $data['path']);
$dirname = str_replace('..', '', $data['name']);
$dir = FILES_DIR . "/{$path}/{$dirname}";
if (mkdir($dir)) {
$mode = Plugin::getSetting('dirmode', 'file_manager');
chmod($dir, octdec($mode));
} else {
Flash::set('error', __('Directory :name has not been created!', array(':name' => $dirname)));
}
redirect(get_url('plugin/file_manager/browse/' . $path));
} | Class | 2 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.