code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
$input = (function ($settingName, $setting, $appView) { $settingId = str_replace('.', '_', $settingName); return $this->Bootstrap->switch([ 'label' => h($setting['description']), 'checked' => !empty($setting['value']), 'id' => $settingId, 'class' => [ (!empty($setting['error']) ? 'is-invalid' : ''), (!empty($setting['error']) ? $appView->get('variantFromSeverity')[$setting['severity']] : ''), ], 'attrs' => [ 'data-setting-name' => $settingName ] ]); })($settingName, $setting, $this);
Base
1
foreach ($week as $dayNum => $day) { if ($dayNum == $now['mday']) { $currentweek = $weekNum; } if ($dayNum <= $endofmonth) { // $monthly[$weekNum][$dayNum]['number'] = ($monthly[$weekNum][$dayNum]['ts'] != -1) ? $db->countObjects("eventdate", $locsql . " AND date >= " . expDateTime::startOfDayTimestamp($day['ts']) . " AND date <= " . expDateTime::endOfDayTimestamp($day['ts'])) : -1; $monthly[$weekNum][$dayNum]['number'] = ($monthly[$weekNum][$dayNum]['ts'] != -1) ? $ed->find("count", $locsql . " AND date >= " . expDateTime::startOfDayTimestamp($day['ts']) . " AND date <= " . expDateTime::endOfDayTimestamp($day['ts'])) : -1; } }
Class
2
public function getUserList() { $result = []; $users = CodeModel::all(User::tableName(), 'nick', 'nick', false); foreach ($users as $codeModel) { if ($codeModel->code != 'admin') { $result[$codeModel->code] = $codeModel->description; } } return $result; }
Base
1
public function approve() { expHistory::set('editable', $this->params); /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet // $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login']; // $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval']; // $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification']; // $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email']; if (empty($this->params['id'])) { flash('error', gt('No ID supplied for comment to approve')); expHistory::back(); } $comment = new expComment($this->params['id']); assign_to_template(array( 'comment'=>$comment )); }
Base
1
public function rename() { if (!AuthUser::hasPermission('file_manager_rename')) { Flash::set('error', __('You do not have sufficient permissions to rename this file or 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/rename')) { 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['file']; $data['current_name'] = str_replace('..', '', $data['current_name']); $data['new_name'] = str_replace('..', '', $data['new_name']); // Clean filenames $data['new_name'] = preg_replace('/ /', '_', $data['new_name']); $data['new_name'] = preg_replace('/[^a-z0-9_\-\.]/i', '', $data['new_name']); $path = substr($data['current_name'], 0, strrpos($data['current_name'], '/')); $file = FILES_DIR . '/' . $data['current_name']; // Check another file doesn't already exist with same name if (file_exists(FILES_DIR . '/' . $path . '/' . $data['new_name'])) { Flash::set('error', __('A file or directory with that name already exists!')); redirect(get_url('plugin/file_manager/browse/' . $path)); } if (file_exists($file)) { if (!rename($file, FILES_DIR . '/' . $path . '/' . $data['new_name'])) Flash::set('error', __('Permission denied!')); } else { Flash::set('error', __('File or directory not found!' . $file)); } redirect(get_url('plugin/file_manager/browse/' . $path)); }
Class
2
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); }
Base
1
public static function wpSetUpBeforeClass( $factory ) { self::make_user_by_role( 'administrator' ); self::$post = $factory->post->create_and_get(); }
Class
2
function edit_option_master() { expHistory::set('editable', $this->params); $params = isset($this->params['id']) ? $this->params['id'] : $this->params; $record = new option_master($params); assign_to_template(array( 'record'=>$record )); }
Base
1
public function getClone($modelId = null) { $this->authorize('view', AssetModel::class); // Check if the model exists if (is_null($model_to_clone = AssetModel::find($modelId))) { return redirect()->route('models.index')->with('error', trans('admin/models/message.does_not_exist')); } $model = clone $model_to_clone; $model->id = null; // Show the page return view('models/edit') ->with('depreciation_list', Helper::depreciationList()) ->with('item', $model) ->with('clone_model', $model_to_clone); }
Class
2
public static function initializeNavigation() { $sections = section::levelTemplate(0, 0); return $sections; }
Base
1
$res = preg_match("/^$map_part/", $this->url_parts[$i]); if ($res != 1) { $matched = false; break; } $pairs[$key] = $this->url_parts[$i]; $i++; } } else { $matched = false; } if ($matched) { // safeguard against false matches when a real action was what the user really wanted. if (count($this->url_parts) >= 2 && method_exists(expModules::getController($this->url_parts[0]), $this->url_parts[1])) return false; $this->url_parts = array(); $this->url_parts[0] = $map['controller']; $this->url_parts[1] = $map['action']; if (isset($map['view'])) { $this->url_parts[2] = 'view'; $this->url_parts[3] = $map['view']; } foreach($map as $key=>$value) { if ($key != 'controller' && $key != 'action' && $key != 'view' && $key != 'url_parts') { $this->url_parts[] = $key; $this->url_parts[] = $value; } } foreach($pairs as $key=>$value) { if ($key != 'controller') { $this->url_parts[] = $key; $this->url_parts[] = $value; } } $this->params = $this->convertPartsToParams(); return true; } } return false; }
Base
1
public function isAllowedFilename($filename){ $allow_array = array( '.jpg','.jpeg','.png','.bmp','.gif','.ico','.webp', '.mp3','.wav','.mp4', '.mov','.webmv','.flac','.mkv', '.zip','.tar','.gz','.tgz','.ipa','.apk','.rar','.iso', '.pdf','.ofd','.swf','.epub','.xps', '.doc','.docx','.wps', '.ppt','.pptx','.xls','.xlsx','.txt','.psd','.csv', '.cer','.ppt','.pub','.json','.css', ) ; $ext = strtolower(substr($filename,strripos($filename,'.')) ); //获取文件扩展名(转为小写后) if(in_array( $ext , $allow_array ) ){ return true ; } return false; }
Base
1
function add_application($uniq_name_orig,$uniq_name,$process_name,$display,$url,$command,$type,$min_value,$bdd){ if($type != 'MIN'){ $min_value = ""; } $sql = "select count(*) from bp where name = '" . $uniq_name . "';"; $req = $bdd->query($sql); $bp_exist = $req->fetch(); // add if($bp_exist[0] == 0 and empty($uniq_name_orig)){ $sql = "insert into bp (name,description,priority,type,command,url,min_value) values('" . $uniq_name ."','" . $process_name ."','" . $display . "','" . $type . "','" . $command . "','" . $url . "','" . $min_value . "')"; $bdd->exec($sql); } // uniq name modification elseif($uniq_name_orig != $uniq_name) { if($bp_exist[0] != 0){ // TODO QUENTIN } else { $sql = "update bp set name = '" . $uniq_name . "',description = '" . $process_name . "',priority = '" . $display . "',type = '" . $type . "',command = '" . $command . "',url = '" . $url . "',min_value = '" . $min_value . "' where name = '" . $uniq_name_orig . "'"; $bdd->exec($sql); $sql = "update bp_links set bp_name = '" . $uniq_name . "' where bp_name = '" . $uniq_name_orig . "'"; $bdd->exec($sql); $sql = "update bp_links set bp_link = '" . $uniq_name . "' where bp_link = '" . $uniq_name_orig . "'"; $bdd->exec($sql); $sql = "update bp_services set bp_name = '" . $uniq_name . "' where bp_name = '" . $uniq_name_orig . "'"; $bdd->exec($sql); } } // modification else{ $sql = "update bp set name = '" . $uniq_name . "',description = '" . $process_name . "',priority = '" . $display . "',type = '" . $type . "',command = '" . $command . "',url = '" . $url . "',min_value = '" . $min_value . "' where name = '" . $uniq_name . "'"; $bdd->exec($sql); } }
Base
1
public function getQuerySelect() { return ''; }
Base
1
public static function getModelTypes($assoc = false) { $modelTypes = Yii::app()->db->createCommand() ->selectDistinct('modelName') ->from('x2_fields') ->where('modelName!="Calendar"') ->order('modelName ASC') ->queryColumn(); if ($assoc === true) { return array_combine($modelTypes, array_map(function($term) { return Yii::t('app', X2Model::getModelTitle($term)); }, $modelTypes)); } $modelTypes = array_map(function($term) { return Yii::t('app', $term); }, $modelTypes); return $modelTypes; }
Class
2
public function admin_print_scripts( $not_used ) { // Load any uploaded KML into the search map - only works with browser uploader // See if wp_upload_handler found uploaded KML $kml_url = get_transient( 'gm_uploaded_kml_url' ); if (strlen($kml_url) > 0) { // Load the KML in the location editor echo ' <script type="text/javascript"> if (\'GeoMashupLocationEditor\' in parent) parent.GeoMashupLocationEditor.loadKml(\'' . $kml_url . '\'); </script>'; delete_transient( 'gm_uploaded_kml_url' ); } }
Class
2
function VerifyVariableSchedule_Update($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:''); // $all_teacher=$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
foreach ($days as $event) { if (empty($event->eventdate->date) || ($viewrange == 'upcoming' && $event->eventdate->date < time())) break; if (empty($event->eventstart)) $event->eventstart = $event->eventdate->date; $extitem[] = $event; }
Base
1
public function subscriptions() { global $db; expHistory::set('manageable', $this->params); // 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 $sub = new subscribers($this->params['id']); if (empty($sub->id)) expQueue::flashAndFlow('error', gt('We could not find any subscriptions matching the ID and Key you provided.')); // get this users subscriptions $subscriptions = $db->selectColumn('expeAlerts_subscribers', 'expeAlerts_id', 'subscribers_id='.$sub->id); // get a list of all available E-Alerts $ealerts = new expeAlerts(); assign_to_template(array( 'subscriber'=>$sub, 'subscriptions'=>$subscriptions, 'ealerts'=>$ealerts->find('all') )); }
Base
1
public function params() { $project = $this->getProject(); $values = $this->request->getValues(); if (empty($values['action_name']) || empty($values['project_id']) || empty($values['event_name'])) { $this->create(); return; } $action = $this->actionManager->getAction($values['action_name']); $action_params = $action->getActionRequiredParameters(); if (empty($action_params)) { $this->doCreation($project, $values + array('params' => array())); } $projects_list = $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId()); unset($projects_list[$project['id']]); $this->response->html($this->template->render('action_creation/params', array( 'values' => $values, 'action_params' => $action_params, 'columns_list' => $this->columnModel->getList($project['id']), 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id']), 'projects_list' => $projects_list, 'colors_list' => $this->colorModel->getList(), 'categories_list' => $this->categoryModel->getList($project['id']), 'links_list' => $this->linkModel->getList(0, false), 'priorities_list' => $this->projectTaskPriorityModel->getPriorities($project), 'project' => $project, 'available_actions' => $this->actionManager->getAvailableActions(), 'swimlane_list' => $this->swimlaneModel->getList($project['id']), 'events' => $this->actionManager->getCompatibleEvents($values['action_name']), ))); }
Base
1
public function testCreatesResponseWithAddedHeaderArray() { $r = new Response(); $r2 = $r->withAddedHeader('foo', ['baz', 'bar']); $this->assertFalse($r->hasHeader('foo')); $this->assertEquals('baz, bar', $r2->getHeaderLine('foo')); }
Base
1
$navs[$i]->link = expCore::makeLink(array('section' => $navs[$i]->id), '', $navs[$i]->sef_name); if (!$view) { // unset($navs[$i]); //FIXME this breaks jstree if we remove a parent and not the child $attr = new stdClass(); $attr->class = 'hidden'; // bs3 class to hide elements $navs[$i]->li_attr = $attr; } }
Base
1
public function buildCurrentUrl() { $url = URL_BASE; if ($this->url_style == 'sef') { $url .= substr(PATH_RELATIVE,0,-1).$this->sefPath; } else { $url .= urldecode((empty($_SERVER['REQUEST_URI'])) ? $_ENV['REQUEST_URI'] : $_SERVER['REQUEST_URI']); } return expString::escape(expString::sanitize($url)); }
Base
1
public function renderRequest() { $request = ''; foreach ($this->displayVars as $name) { if (!empty($GLOBALS[$name])) { $request .= '$' . $name . ' = ' . VarDumper::export($GLOBALS[$name]) . ";\n\n"; } } return '<pre>' . rtrim($request, "\n") . '</pre>'; }
Base
1
public function update($user, $notrigger = 0) { global $langs, $conf; $error = 0; // Clean parameters $this->address = ($this->address > 0 ? $this->address : $this->address); $this->zip = ($this->zip > 0 ? $this->zip : $this->zip); $this->town = ($this->town > 0 ? $this->town : $this->town); $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); $this->country = ($this->country ? $this->country : $this->country); $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."don SET "; $sql .= "amount = ".price2num($this->amount); $sql .= ",fk_payment = ".($this->modepaymentid ? $this->modepaymentid : "null");
Class
2
protected function encode($path) { if ($path !== '') { // cut ROOT from $path for security reason, even if hacker decodes the path he will not know the root $p = $this->relpathCE($path); // if reqesting root dir $path will be empty, then assign '/' as we cannot leave it blank for crypt if ($p === '') { $p = DIRECTORY_SEPARATOR; } // TODO crypt path and return hash $hash = $this->crypt($p); // hash is used as id in HTML that means it must contain vaild chars // make base64 html safe and append prefix in begining $hash = strtr(base64_encode($hash), '+/=', '-_.'); // remove dots '.' at the end, before it was '=' in base64 $hash = rtrim($hash, '.'); // append volume id to make hash unique return $this->id.$hash; } }
Base
1
function delete_recurring() { $item = $this->event->find('first', 'id=' . $this->params['id']); if ($item->is_recurring == 1) { // need to give user options expHistory::set('editable', $this->params); assign_to_template(array( 'checked_date' => $this->params['date_id'], 'event' => $item, )); } else { // Process a regular delete $item->delete(); } }
Base
1
function sigRenderTag ($input, array $args, Parser $parser, PPFrame $frame) { $username = $input; $img_url = sigGetAvatarUrl($username); $o = '<br>' . '<span class="scratch-sig">' . '<a href="/wiki/User:'.$username.'">' . '<img src="' . $img_url . '" width="18px" height="18px">' . '</a>' . ' ' . '<a href="/wiki/User:'.$username.'">' . '<b>'.$username.'</b>' . '</a>' . ' ' . '(' . '<a href="/wiki/User_Talk:'.$username.'">talk</a>' . ' | ' . '<a href="/wiki/Special:Contributions/'.$username.'">contribs</a>' . ')' . '</span>'; return $o; }
Base
1
public function testLegacyDispatch() { $event = new Event(); $return = $this->dispatcher->dispatch(self::preFoo, $event); $this->assertEquals('pre.foo', $event->getName()); }
Base
1
protected function get_remote_contents(&$url, $timeout = 30, $redirect_max = 5, $ua = 'Mozilla/5.0', $fp = null) { if (preg_match('~^(?:ht|f)tps?://[-_.!\~*\'()a-z0-9;/?:\@&=+\$,%#\*\[\]]+~i', $url)) { $info = parse_url($url); $host = strtolower($info['host']); // do not support IPv6 address if (preg_match('/^\[.*\]$/', $host)) { return false; } // do not support non dot URL if (strpos($host, '.') === false) { return false; } // disallow including "localhost" if (strpos($host, 'localhost') !== false) { return false; } // check IPv4 local loopback if (preg_match('/^(?:127|0177|0x7f)\.[0-9a-fx.]+$/', $host)) { return false; } // check by URL upload filter if ($this->urlUploadFilter && is_callable($this->urlUploadFilter)) { if (!call_user_func_array($this->urlUploadFilter, array($url, $this))) { return false; } } $method = (function_exists('curl_exec') && !ini_get('safe_mode') && !ini_get('open_basedir')) ? 'curl_get_contents' : 'fsock_get_contents'; return $this->$method($url, $timeout, $redirect_max, $ua, $fp); } return false; }
Base
1
public function __construct() { $this->options['alias'] = ''; // alias to replace root dir name $this->options['dirMode'] = 0755; // new dirs mode $this->options['fileMode'] = 0644; // new files mode $this->options['quarantine'] = '.quarantine'; // quarantine folder name - required to check archive (must be hidden) $this->options['rootCssClass'] = 'elfinder-navbar-root-local'; $this->options['followSymLinks'] = true; }
Base
1
function scan_page($parent_id) { global $db; $sections = $db->selectObjects('section','parent=' . $parent_id); $ret = ''; foreach ($sections as $page) { $cLoc = serialize(expCore::makeLocation('container','@section' . $page->id)); $ret .= scan_container($cLoc, $page->id); $ret .= scan_page($page->id); } return $ret; }
Base
1
function edit() { global $template; parent::edit(); $allforms = array(); $allforms[""] = gt('Disallow Feedback'); // calculate which event date is the one being edited $event_key = 0; foreach ($template->tpl->tpl_vars['record']->value->eventdate as $key=>$d) { if ($d->id == $this->params['date_id']) $event_key = $key; } assign_to_template(array( 'allforms' => array_merge($allforms, expTemplate::buildNameList("forms", "event/email", "tpl", "[!_]*")), 'checked_date' => !empty($this->params['date_id']) ? $this->params['date_id'] : null, 'event_key' => $event_key, )); }
Class
2
public function showall() { global $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( 'sections' => $navsections, 'current' => $current, 'canManage' => ((isset($user->is_acting_admin) && $user->is_acting_admin == 1) ? 1 : 0), )); }
Base
1
protected function markCompleted($endStatus, ServiceResponse $serviceResponse, $gatewayMessage) { parent::markCompleted($endStatus, $serviceResponse, $gatewayMessage); $this->createMessage(Message\PurchasedResponse::class, $gatewayMessage); ErrorHandling::safeExtend($this->payment, 'onCaptured', $serviceResponse); }
Class
2
public function saveConfig() { if (!empty($this->params['aggregate']) || !empty($this->params['pull_rss'])) { if ($this->params['order'] == 'rank ASC') { expValidator::failAndReturnToForm(gt('User defined ranking is not allowed when aggregating or pull RSS data feeds.'), $this->params); } } parent::saveConfig(); }
Class
2
private function resize($src, $srcImgInfo, $maxWidth, $maxHeight, $quality, $preserveExif) { $zoom = min(($maxWidth/$srcImgInfo[0]),($maxHeight/$srcImgInfo[1])); $width = round($srcImgInfo[0] * $zoom); $height = round($srcImgInfo[1] * $zoom); if (class_exists('Imagick', false)) { return $this->resize_imagick($src, $width, $height, $quality, $preserveExif); } else { return $this->resize_gd($src, $width, $height, $quality, $srcImgInfo); } }
Base
1
public function getMovie($id){ $url = "http://api.themoviedb.org/3/movie/".$id."?api_key=".$this->apikey; $movie = $this->curl($url); return $movie; }
Base
1
public static function modList(){ //$mod = ''; $handle = dir(GX_MOD); while (false !== ($entry = $handle->read())) { if ($entry != "." && $entry != ".." ) { $dir = GX_MOD.$entry; if(is_dir($dir) == true){ $mod[] = basename($dir); } } } $handle->close(); return $mod; }
Base
1
public static function quoteValue($value) { if ($value instanceof QueryParam || $value instanceof QueryExpression) { //no quote for query parameters nor expressions $value = $value->getValue(); } else if ($value === null || $value === 'NULL' || $value === 'null') { $value = 'NULL'; } else if (!preg_match("/^`.*?`$/", $value)) { //`field` is valid only for mysql :/ //phone numbers may start with '+' and will be considered as numeric $value = "'$value'"; } return $value; }
Base
1
public function actionGetItems(){ $sql = 'SELECT id, name as value FROM x2_x2leads WHERE name LIKE :qterm ORDER BY name ASC'; $command = Yii::app()->db->createCommand($sql); $qterm = $_GET['term'].'%'; $command->bindParam(":qterm", $qterm, PDO::PARAM_STR); $result = $command->queryAll(); echo CJSON::encode($result); Yii::app()->end(); }
Base
1
function XMLRPCgetUserGroupPrivs($name, $affiliation, $nodeid){ require_once(".ht-inc/privileges.php"); global $user; if(! checkUserHasPriv("userGrant", $user['id'], $nodeid)){ return array('status' => 'error', 'errorcode' => 53, 'errormsg' => 'Unable to add resource group to this node'); } $validate = array('name' => $name, 'affiliation' => $affiliation); $rc = validateAPIgroupInput($validate, 1); if($rc['status'] == 'error') return $rc; $privileges = array(); $nodePrivileges = getNodePrivileges($nodeid, 'usergroups'); $cascadedNodePrivileges = getNodeCascadePrivileges($nodeid, 'usergroups'); $cngp = $cascadedNodePrivileges['usergroups']; $ngp = $nodePrivileges['usergroups']; if(array_key_exists($name, $cngp)){ foreach($cngp[$name]['privs'] as $p){ if(! array_key_exists($name, $ngp) || ! in_array("block", $ngp[$name]['privs'])){ array_push($privileges, $p); } } } if(array_key_exists($name, $ngp)){ foreach($ngp[$name]['privs'] as $p){ if($p != "block"){ array_push($privileges, $p); } } } return array( 'status' => 'success', 'privileges' => array_unique($privileges)); }
Class
2
public function execute(&$params){ $model = new Actions; $model->type = 'note'; $model->complete = 'Yes'; $model->associationId = $params['model']->id; $model->associationType = $params['model']->module; $model->actionDescription = $this->parseOption('comment', $params); $model->assignedTo = $this->parseOption('assignedTo', $params); $model->completedBy = $this->parseOption('assignedTo', $params); if(empty($model->assignedTo) && $params['model']->hasAttribute('assignedTo')){ $model->assignedTo = $params['model']->assignedTo; $model->completedBy = $params['model']->assignedTo; } if($params['model']->hasAttribute('visibility')) $model->visibility = $params['model']->visibility; $model->createDate = time(); $model->completeDate = time(); if($model->save()){ return array( true, Yii::t('studio', 'View created action: ').$model->getLink()); }else{ return array(false, array_shift($model->getErrors())); } }
Base
1
protected function _mkfile($path, $name) { $path = $this->_joinPath($path, $name); return $this->connect->put($path, '') ? $path : false; /* if ($this->tmp) { $path = $this->_joinPath($path, $name); $local = $this->getTempFile(); $res = touch($local) && $this->connect->put($path, $local, NET_SFTP_LOCAL_FILE); unlink($local); return $res ? $path : false; } return false; */ }
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
protected function assertNoPHPErrors () { $this->assertElementNotPresent('css=.xdebug-error'); $this->assertElementNotPresent('css=#x2-php-error'); }
Class
2
public function showall() { expHistory::set('viewable', $this->params); // figure out if should limit the results if (isset($this->params['limit'])) { $limit = $this->params['limit'] == 'none' ? null : $this->params['limit']; } else { $limit = (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10; } $order = isset($this->config['order']) ? $this->config['order'] : 'publish DESC'; // pull the news posts from the database $items = $this->news->find('all', $this->aggregateWhereClause(), $order); // merge in any RSS news and perform the sort and limit the number of posts we return to the configured amount. if (!empty($this->config['pull_rss'])) $items = $this->mergeRssData($items); // setup the pagination object to paginate the news stories. $page = new expPaginator(array( 'records'=>$items, 'limit'=>$limit, 'order'=>$order, 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->params['controller'], 'action'=>$this->params['action'], 'src'=>$this->loc->src, 'view'=>empty($this->params['view']) ? null : $this->params['view'] )); assign_to_template(array( 'page'=>$page, 'items'=>$page->records, 'rank'=>($order==='rank')?1:0, 'params'=>$this->params, )); }
Class
2
public function __construct($message, $code = 0, Exception $previous = null) { parent::__construct($message, $code, $previous); }
Base
1
function PMA_importAjaxStatus($id) { header('Content-type: application/json'); echo json_encode( $_SESSION[$GLOBALS['SESSION_KEY']]['handler']::getUploadStatus($id) ); }
Base
1
public function destroy(Request $request, TransactionCurrency $currency) { /** @var User $user */ $user = auth()->user(); if (!$this->userRepository->hasRole($user, 'owner')) { $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); Log::channel('audit')->info(sprintf('Tried to delete currency %s but is not site owner.', $currency->code)); return redirect(route('currencies.index')); } if ($this->repository->currencyInUse($currency)) { $request->session()->flash('error', (string) trans('firefly.cannot_delete_currency', ['name' => e($currency->name)])); Log::channel('audit')->info(sprintf('Tried to delete currency %s but is in use.', $currency->code)); return redirect(route('currencies.index')); } if ($this->repository->isFallbackCurrency($currency)) { $request->session()->flash('error', (string) trans('firefly.cannot_delete_fallback_currency', ['name' => e($currency->name)])); Log::channel('audit')->info(sprintf('Tried to delete currency %s but is FALLBACK.', $currency->code)); return redirect(route('currencies.index')); } Log::channel('audit')->info(sprintf('Deleted currency %s.', $currency->code)); $this->repository->destroy($currency); $request->session()->flash('success', (string) trans('firefly.deleted_currency', ['name' => $currency->name])); return redirect($this->getPreviousUri('currencies.delete.uri')); }
Compound
4
public function getCookiePathsDataProvider() { return [ ['', '/'], ['/', '/'], ['/foo', '/'], ['/foo/bar', '/foo'], ['/foo/bar/', '/foo/bar'], ['foo', '/'], ['foo/bar', '/'], ['foo/bar/', '/'], ]; }
Class
2
public static function getMenuRaw($menuid){ $sql = sprintf("SELECT * FROM `menus` WHERE `menuid` = '%s' ORDER BY `order` ASC", $menuid); $menus = Db::result($sql); $n = Db::$num_rows; return $menus; }
Base
1
public function save_change_password() { global $user; $isuser = ($this->params['uid'] == $user->id) ? 1 : 0; if (!$user->isAdmin() && !$isuser) { flash('error', gt('You do not have permissions to change this users password.')); expHistory::back(); } if (($isuser && empty($this->params['password'])) || (!empty($this->params['password']) && $user->password != user::encryptPassword($this->params['password']))) { flash('error', gt('The current password you entered is not correct.')); expHistory::returnTo('editable'); } //eDebug($user); $u = new user($this->params['uid']); $ret = $u->setPassword($this->params['new_password1'], $this->params['new_password2']); //eDebug($u, true); if (is_string($ret)) { flash('error', $ret); expHistory::returnTo('editable'); } else { $params = array(); $params['is_admin'] = !empty($u->is_admin); $params['is_acting_admin'] = !empty($u->is_acting_admin); $u->update($params); } if (!$isuser) { flash('message', gt('The password for') . ' ' . $u->username . ' ' . gt('has been changed.')); } else { $user->password = $u->password; flash('message', gt('Your password has been changed.')); } expHistory::back(); }
Base
1
public function get_view_config() { global $template; // set paths we will search in for the view $paths = array( BASE.'themes/'.DISPLAY_THEME.'/modules/common/views/file/configure', BASE.'framework/modules/common/views/file/configure', ); foreach ($paths as $path) { $view = $path.'/'.$this->params['view'].'.tpl'; if (is_readable($view)) { if (bs(true)) { $bstrapview = $path.'/'.$this->params['view'].'.bootstrap.tpl'; if (file_exists($bstrapview)) { $view = $bstrapview; } } if (bs3(true)) { $bstrapview = $path.'/'.$this->params['view'].'.bootstrap3.tpl'; if (file_exists($bstrapview)) { $view = $bstrapview; } } $template = new controllertemplate($this, $view); $ar = new expAjaxReply(200, 'ok'); $ar->send(); } } }
Base
1
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_files WHERE website = '.protect($website->id), 'object'); $out = $DB->result(); if($type='json') $out = json_encode($out); return $out; }
Base
1
function XMLRPCaddResourceGroupPriv($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 add resource group to 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, $perms, array()); return array('status' => 'success'); } else { return array('status' => 'error', 'errorcode' => 56, 'errormsg' => 'Invalid resource type'); } }
Class
2
public function afterSave($event) { // look up current tags $oldTags = $this->getTags(); $newTags = array(); foreach ($this->scanForTags() as $tag) { if (!in_array($tag, $oldTags)) { // don't add duplicates if there are already tags $tagModel = new Tags; $tagModel->tag = $tag; // includes the # $tagModel->type = get_class($this->getOwner()); $tagModel->itemId = $this->getOwner()->id; $tagModel->itemName = $this->getOwner()->name; $tagModel->taggedBy = Yii::app()->getSuName(); $tagModel->timestamp = time(); if ($tagModel->save()) $newTags[] = $tag; } } $this->_tags = $newTags + $oldTags; // update tag cache if (!empty($newTags) && $this->flowTriggersEnabled) { X2Flow::trigger('RecordTagAddTrigger', array( 'model' => $this->getOwner(), 'tags' => $newTags, )); } }
Base
1
$layout[$loc] = array_merge($layout[$loc],$data); } } } return $layout; }
Base
1
public function rules() { return [ 'name' => 'required', 'email' => 'required|email', 'address' => '', 'primary_number' => 'numeric', 'secondary_number' => 'numeric', 'password' => 'required|min:5|confirmed', 'password_confirmation' => 'required|min:5', 'image_path' => '', 'roles' => 'required', 'departments' => 'required' ]; }
Class
2
function db_seq_nextval($seqname) { global $DatabaseType; if ($DatabaseType == 'mysqli') $seq = "fn_" . strtolower($seqname) . "()"; return $seq; }
Base
1
$user = db_fetch_cell_prepared('SELECT username FROM user_auth WHERE id = ?', array($check['user']), 'username'); form_alternate_row('line' . $check['id']); $name = get_data_source_title($check['datasource']); $title = $name; if (strlen($name) > 50) { $name = substr($name, 0, 50); } form_selectable_cell('<a class="linkEditMain" title="' . $title .'" href="' . htmlspecialchars('data_debug.php?action=view&id=' . $check['id']) . '">' . $name . '</a>', $check['id']); form_selectable_cell($user, $check['id']); form_selectable_cell(date('F j, Y, G:i', $check['started']), $check['id']); form_selectable_cell($check['datasource'], $check['id']); form_selectable_cell(debug_icon(($check['done'] ? (strlen($issue_line) ? 'off' : 'on' ) : '')), $check['id'], '', 'text-align: center;'); form_selectable_cell(debug_icon($info['rrd_writable']), $check['id'], '', 'text-align: center;'); form_selectable_cell(debug_icon($info['rrd_exists']), $check['id'], '', 'text-align: center;'); form_selectable_cell(debug_icon($info['active']), $check['id'], '', 'text-align: center;'); form_selectable_cell(debug_icon($info['rrd_match']), $check['id'], '', 'text-align: center;'); form_selectable_cell(debug_icon($info['valid_data']), $check['id'], '', 'text-align: center;'); form_selectable_cell(debug_icon(($info['rra_timestamp2'] != '' ? 1 : '')), $check['id'], '', 'text-align: center;'); form_selectable_cell('<a class=\'linkEditMain\' href=\'#\' title="' . html_escape($issue_title) . '">' . html_escape(strlen(trim($issue_line)) ? $issue_line : '<none>') . '</a>', $check['id']); form_checkbox_cell($check['id'], $check['id']); form_end_row(); } }else{
Base
1
function import() { $pullable_modules = expModules::listInstalledControllers($this->baseclassname); $modules = new expPaginator(array( 'records' => $pullable_modules, 'controller' => $this->loc->mod, 'action' => $this->params['action'], 'order' => isset($this->params['order']) ? $this->params['order'] : 'section', 'dir' => isset($this->params['dir']) ? $this->params['dir'] : '', 'page' => (isset($this->params['page']) ? $this->params['page'] : 1), 'columns' => array( gt('Title') => 'title', gt('Page') => 'section' ), )); assign_to_template(array( 'modules' => $modules, )); }
Base
1
public function addReplyTo($address, $name = '') { return $this->addAnAddress('Reply-To', $address, $name); }
Compound
4
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); }
Base
1
protected function sort(&$rowsKey, $sortColumn) { $sortMethod = $this->getTableSortMethod(); if ($sortColumn < 0) { switch ($sortMethod) { case 'natural': // Reverse natsort() uasort($rowsKey, function($first, $second) { return strnatcmp($second, $first); }); break; case 'standard': default: arsort($rowsKey); break; } } else { switch ($sortMethod) { case 'natural': natsort($rowsKey); break; case 'standard': default: asort($rowsKey); break; } } }
Class
2
$navs[$i]->link = expCore::makeLink(array('section' => $navs[$i]->id), '', $navs[$i]->sef_name); if (!$view) { // unset($navs[$i]); //FIXME this breaks jstree if we remove a parent and not the child $attr = new stdClass(); $attr->class = 'hidden'; // bs3 class to hide elements $navs[$i]->li_attr = $attr; } }
Base
1
public function AddCC($address, $name = '') { return $this->AddAnAddress('cc', $address, $name); }
Class
2
function edit() { global $user; /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login']; $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval']; $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification']; $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email']; if (empty($this->params['formtitle'])) { if (empty($this->params['id'])) { $formtitle = gt("Add New Note"); } else { $formtitle = gt("Edit Note"); } } else { $formtitle = $this->params['formtitle']; } $id = empty($this->params['id']) ? null : $this->params['id']; $simpleNote = new expSimpleNote($id); //FIXME here is where we might sanitize the note before displaying/editing it assign_to_template(array( 'simplenote'=>$simpleNote, 'user'=>$user, 'require_login'=>$require_login, 'require_approval'=>$require_approval, 'require_notification'=>$require_notification, 'notification_email'=>$notification_email, 'formtitle'=>$formtitle, 'content_type'=>$this->params['content_type'], 'content_id'=>$this->params['content_id'], 'tab'=>empty($this->params['tab'])?0:$this->params['tab'] )); }
Base
1
$clientIps = array_map('trim', explode(',', $this->headers->get(self::$trustedHeaders[self::HEADER_CLIENT_IP])));
Base
1
public static function isPublic($s) { if ($s == null) { return false; } while ($s->public && $s->parent > 0) { $s = new section($s->parent); } $lineage = (($s->public) ? 1 : 0); return $lineage; }
Class
2
public static function restoreX2WebUser () { if (isset (self::$_oldUserComponent)) { Yii::app()->setComponent ('user', self::$_oldUserComponent); } else { throw new CException ('X2WebUser component could not be restored'); } }
Base
1
public function __construct () { if (self::existConf()) { # code... self::config('config'); self::lang(GX_LANG); }else{ GxMain::install(); } }
Base
1
$evs = $this->event->find('all', "id=" . $edate->event_id . $featuresql); foreach ($evs as $key=>$event) { if ($condense) { $eventid = $event->id; $multiday_event = array_filter($events, create_function('$event', 'global $eventid; return $event->id === $eventid;')); if (!empty($multiday_event)) { unset($evs[$key]); continue; } } $evs[$key]->eventstart += $edate->date; $evs[$key]->eventend += $edate->date; $evs[$key]->date_id = $edate->id; if (!empty($event->expCat)) { $catcolor = empty($event->expCat[0]->color) ? null : trim($event->expCat[0]->color); // if (substr($catcolor,0,1)=='#') $catcolor = '" style="color:'.$catcolor.';'; $evs[$key]->color = $catcolor; } } if (count($events) < 500) { // magic number to not crash loop? $events = array_merge($events, $evs); } else { // $evs[$key]->title = gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!'); // $events = array_merge($events, $evs); flash('notice',gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!')); break; // keep from breaking system by too much data } }
Class
2
function URLEscape( $string ) { $string = preg_replace_callback( // Match both decimal & hex code (although hex codes can contain a-f letters). // Should be enough as the alphabet hex codes only have numbers. "/(&#x?[0-9]+;?)/i", function( $match ) { if ( mb_substr( $match[1], -1 ) !== ';' ) { // Fix stored XSS security issue: add semicolon to HTML entity so it can be decoded. // @link https://www.php.net/manual/en/function.html-entity-decode.php#104617 $match[1] .= ';'; } return $match[1]; }, $string ); // Fix stored XSS security issue: decode HTML entities from URL. $string = html_entity_decode( (string) $string ); $remove = [ // Fix stored XSS security issue: remove inline JS from URL. 'javascript:', ]; foreach ( $remove as $remove_string ) { while ( strpos( $string, $remove_string ) !== false ) { $string = str_ireplace( $remove, '', $string ); } } $entities = [ '%21', '%2A', '%27', '%28', '%29', '%3B', '%3A', '%40', '%26', '%3D', '%2B', '%24', '%2C', '%2F', '%3F', '%25', '%23', '%5B', '%5D', ]; $replacements = [ '!', '*', "'", '(', ')', ';', ':', '@', '&', '=', '+', '$', ',', '/', '?', '%', '#', '[', ']', ]; return str_replace( $entities, $replacements, rawurlencode( $string ) ); }
Base
1
function html_edit_form($param) { global $TEXT; if ($param['target'] !== 'section') { msg('No editor for edit target ' . $param['target'] . ' found.', -1); } $attr = array('tabindex'=>'1'); if (!$param['wr']) $attr['readonly'] = 'readonly'; $param['form']->addElement(form_makeWikiText($TEXT, $attr)); }
Base
1
function edit_freeform() { $section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params); if ($section->parent == -1) { notfoundController::handle_not_found(); exit; } // doesn't work for standalone pages if (empty($section->id)) { $section->public = 1; if (!isset($section->parent)) { // This is another precaution. The parent attribute // should ALWAYS be set by the caller. //FJD - if that's the case, then we should die. notfoundController::handle_not_authorized(); exit; //$section->parent = 0; } } assign_to_template(array( 'section' => $section, 'glyphs' => self::get_glyphs(), )); }
Base
1
public function handleObjectDeletionFromUserSide($confirm_msg = false, $op='del') { global $icmsTpl, $impresscms; $objectid = ( isset($_REQUEST[$this->handler->keyName]) ) ? (int) ($_REQUEST[$this->handler->keyName]) : 0; $icmsObj = $this->handler->get($objectid); if ($icmsObj->isNew()) { redirect_header("javascript:history.go(-1)", 3, _CO_ICMS_NOT_SELECTED); exit(); } $confirm = ( isset($_POST['confirm']) ) ? $_POST['confirm'] : 0; if ($confirm) { if (!$this->handler->delete($icmsObj)) { redirect_header($_POST['redirect_page'], 3, _CO_ICMS_DELETE_ERROR . $icmsObj->getHtmlErrors()); exit; } redirect_header($_POST['redirect_page'], 3, _CO_ICMS_DELETE_SUCCESS); exit(); } else { // no confirm: show deletion condition if (!$confirm_msg) { $confirm_msg = _CO_ICMS_DELETE_CONFIRM; } ob_start(); icms_core_Message::confirm(array( 'op' => $op, $this->handler->keyName => $icmsObj->getVar($this->handler->keyName), 'confirm' => 1, 'redirect_page' => $impresscms->urls['previouspage']), xoops_getenv('SCRIPT_NAME'), sprintf($confirm_msg , $icmsObj->getVar($this->handler->identifierName)), _CO_ICMS_DELETE ); $icmspersistable_delete_confirm = ob_get_clean(); $icmsTpl->assign('icmspersistable_delete_confirm', $icmspersistable_delete_confirm); } }
Base
1
public function get($extramediatypes = false) { try { return $this->getConfig($extramediatypes); } catch (\Exception $exception) { return $this->jsonError($exception); } }
Base
1
function move_standalone() { expSession::clearAllUsersSessionCache('navigation'); assign_to_template(array( 'parent' => $this->params['parent'], )); }
Base
1
private function getUrlencodedPrefix($string, $prefix) { if (0 !== strpos(rawurldecode($string), $prefix)) { return false; } $len = strlen($prefix); if (preg_match(sprintf('#^(%%[[:xdigit:]]{2}|.){%d}#', $len), $string, $match)) { return $match[0]; } return false; }
Base
1
public static function run () { $m = self::match(); // print_r($m); if (is_array($m)) { # code... $val = self::extract($m[0], $m[1]); if (isset($val) && $val != null ) { return $val; }else{ $val = ['error']; return $val; } }else{ $val = ['error']; return $val; } }
Base
1
public static function checkPermissions($permission,$location) { global $exponent_permissions_r, $router; // only applies to the 'manage' method if (empty($location->src) && empty($location->int) && (!empty($router->params['action']) && $router->params['action'] == 'manage') || strpos($router->current_url, 'action=manage') !== false) { if (!empty($exponent_permissions_r['navigation'])) foreach ($exponent_permissions_r['navigation'] as $page) { foreach ($page as $pageperm) { if (!empty($pageperm['manage'])) return true; } } } return false; }
Base
1
public function getFileAndFolderNameFilters() { return $this->fileAndFolderNameFilters; }
Base
1
static function displayname() { return gt("Navigation"); }
Base
1
private function _createdby( $option ) { $this->addTable( 'revision', 'creation_rev' ); $this->addTable( 'revision_actor_temp', 'creation_rev_actor' ); $this->_adduser( null, 'creation_rev_actor' ); $user = new \User; $this->addWhere( [ $this->DB->addQuotes( $user->newFromName( $option )->getActorId() ) . ' = creation_rev_actor.revactor_actor', 'creation_rev_actor.revactor_page = page_id', 'creation_rev.rev_parent_id = 0' ] ); }
Class
2
public static function slug($vars) { $s = Db::result("SELECT `slug` FROM `posts` WHERE `id` = '{$vars}' LIMIT 1"); $s = $s[0]->slug; return $s; }
Base
1
public function beforeSave () { $valid = parent::beforeSave (); if ($valid) { $table = Yii::app()->db->schema->tables[$this->myTableName]; $existing = array_key_exists($this->fieldName, $table->columns) && $table->columns[$this->fieldName] instanceof CDbColumnSchema; if($existing){ $valid = $this->modifyColumn(); } } return $valid; }
Class
2
foreach ($matches[1] as $index => $body) { $parts = explode('_', $body); $fileID = $parts[0]; $hash = $parts[1]; try { $file = erLhcoreClassModelChatFile::fetch($fileID); if (is_object($file) && $hash == $file->security_hash) { $url = (erLhcoreClassSystem::$httpsMode == true ? 'https:' : 'http:') . '//' . $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurldirect('file/downloadfile') . "/{$file->id}/{$hash}"; $media[] = array( 'id' => $file->id, 'size' => $file->size, 'upload_name' => $file->upload_name, 'type' => $file->type, 'extension' => $file->extension, 'hash' => $hash, 'url' => $url, ); $msg_text_cleaned = str_replace($matches[0][$index],'',$msg_text_cleaned); } } catch (Exception $e) { } }
Class
2
public function editspeed() { global $db; if (empty($this->params['id'])) return false; $calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']); $calc = new $calcname($this->params['id']); assign_to_template(array( 'calculator'=>$calc )); }
Class
2
$cLoc = serialize(expCore::makeLocation('container','@section' . $page->id)); $ret .= scan_container($cLoc, $page->id); $ret .= scan_page($page->id); }
Base
1
public function delete() { global $db, $history; /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login']; $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval']; $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification']; $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email']; if (empty($this->params['id'])) { flash('error', gt('Missing id for the comment you would like to delete')); $lastUrl = expHistory::getLast('editable'); } // delete the note $simplenote = new expSimpleNote($this->params['id']); $rows = $simplenote->delete(); // delete the assocication too $db->delete($simplenote->attachable_table, 'expsimplenote_id='.$this->params['id']); // send the user back where they came from. $lastUrl = expHistory::getLast('editable'); if (!empty($this->params['tab'])) { $lastUrl .= "#".$this->params['tab']; } redirect_to($lastUrl); }
Base
1
public static function ca() { if (is_null(self::$ca)) new CertificateAuthenticate(); return self::$ca; }
Base
1
function delete_vendor() { global $db; if (!empty($this->params['id'])){ $db->delete('vendor', 'id =' .$this->params['id']); } expHistory::back(); }
Class
2
public function Mail($from) { $this->error = null; // so no confusion is caused if(!$this->connected()) { $this->error = array( "error" => "Called Mail() without being connected"); return false; } $useVerp = ($this->do_verp ? " XVERP" : ""); fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF); $rply = $this->get_lines(); $code = substr($rply,0,3); if($this->do_debug >= 2) { $this->edebug("SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />'); } if($code != 250) { $this->error = array("error" => "MAIL not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4)); if($this->do_debug >= 1) { $this->edebug("SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />'); } return false; } return true; }
Base
1
function searchName() { return gt('Webpage'); }
Base
1
function RemoveXSSchars(&$val) { static $patterns = NULL; static $replacements = NULL; $val_before = $val; $found = true; if ( $patterns == NULL ) { $patterns = array(); $replacements = array(); // remove all non-printable characters. CR(0a) and LF(0b) and TAB(9) are // allowed this prevents some character re-spacing such as <java\0script> // note that you have to handle splits with \n, \r, and \t later since they // *are* allowed in some inputs $patterns[] = '/([\x00-\x08\x0b-\x0c\x0e-\x19])/'; $replacements[] = ''; // straight replacements, the user should never need these since they're // normal characters this prevents like // <IMG SRC=&#X40&#X61&#X76&#X61&#X73&#X63&#X72&#X69&#X70&#X74&#X3A&#X61&#X6C&#X65&#X72&#X74&#X28&#X27&#X58&#X53&#X53&#X27&#X29> // Calculate the search and replace patterns only once $search = 'abcdefghijklmnopqrstuvwxyz'; $search .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $search .= '1234567890!@#$%^&*()'; $search .= '~`";:?+/={}[]-_|\'\\'; for ($i = 0, $istrlen_search = strlen($search); $i < $istrlen_search; $i++) { // ;? matches the ;, which is optional // 0{0,8} matches any padded zeros, // which are optional and go up to 8 chars // &#x0040 @ search for the hex values $patterns[] = '/(&#[xX]0{0,8}'.dechex(ord($search[$i])).';?)/i'; $replacements[] = $search[$i]; // &#00064 @ 0{0,8} matches '0' zero to eight times // with a ; $patterns[] = '/(&#0{0,8}'.ord($search[$i]).';?)/'; $replacements[] = $search[$i]; } } $val = preg_replace($patterns, $replacements, $val); if ($val_before == $val) { // no replacements were made, so exit the loop $found = false; } return $found; }
Base
1
function clean_input_value($value) { if (is_string($value)) { return descript($value); } if (is_array($value)) { return array_map('descript', $value); } return ''; }
Base
1
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); if ($tag['project_id'] != $project['id']) { throw new AccessForbiddenException(); } if ($this->tagModel->remove($tag_id)) { $this->flash->success(t('Tag removed successfully.')); } else { $this->flash->failure(t('Unable to remove this tag.')); } $this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id']))); }
Base
1
public static function get_session($vars) { }
Base
1
$rst[$key] = self::parseAndTrim($st, $unescape); } return $rst; } $str = str_replace("<br>"," ",$str); $str = str_replace("</br>"," ",$str); $str = str_replace("<br/>"," ",$str); $str = str_replace("<br />"," ",$str); $str = str_replace("\r\n"," ",$str); $str = str_replace('"',"&quot;",$str); $str = str_replace("'","&#39;",$str); $str = str_replace("’","&rsquo;",$str); $str = str_replace("‘","&lsquo;",$str); $str = str_replace("®","&#174;",$str); $str = str_replace("–","-", $str); $str = str_replace("—","&#151;", $str); $str = str_replace("”","&rdquo;", $str); $str = str_replace("“","&ldquo;", $str); $str = str_replace("¼","&#188;",$str); $str = str_replace("½","&#189;",$str); $str = str_replace("¾","&#190;",$str); $str = str_replace("™","&trade;", $str); $str = trim($str); if ($unescape) { $str = stripcslashes($str); } else { $str = addslashes($str); } return $str; }
Base
1