code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
private function readData() { if (isset($this->tid) && $this->tid != - 1 ) { $_ticket_stmt = Database::prepare(' SELECT * FROM `' . TABLE_PANEL_TICKETS . '` WHERE `id` = :tid' ); $_ticket = Database::pexecute_first($_ticket_stmt, array('tid' => $this->tid)); $this->Set('customer', $_ticket['customerid'], true, false); $this->Set('admin', $_ticket['adminid'], true, false); $this->Set('subject', $_ticket['subject'], true, false); $this->Set('category', $_ticket['category'], true, false); $this->Set('priority', $_ticket['priority'], true, false); $this->Set('message', $_ticket['message'], true, false); $this->Set('dt', $_ticket['dt'], true, false); $this->Set('lastchange', $_ticket['lastchange'], true, false); $this->Set('ip', $_ticket['ip'], true, false); $this->Set('status', $_ticket['status'], true, false); $this->Set('lastreplier', $_ticket['lastreplier'], true, false); $this->Set('by', $_ticket['by'], true, false); $this->Set('answerto', $_ticket['answerto'], true, false); $this->Set('archived', $_ticket['archived'], true, false); } }
Class
2
foreach ($page as $pageperm) { if (!empty($pageperm['manage'])) return true; }
Base
1
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_templates WHERE website = '.protect($website->id), 'object'); if($type='json') $out = json_encode($DB->result()); return $out; }
Base
1
public function show() { $task = $this->getTask(); $subtask = $this->getSubtask(); $this->response->html($this->template->render('subtask_converter/show', array( 'subtask' => $subtask, 'task' => $task, ))); }
Base
1
function SafeStripSlashes($string) { return (get_magic_quotes_gpc() ? stripslashes($string) : $string); }
Base
1
static function is_username($username, &$error='') { if (strlen($username)<2) $error = __('Username must have at least two (2) characters'); elseif (!preg_match('/^[\p{L}\d._-]+$/u', $username)) $error = __('Username contains invalid characters'); return $error == ''; }
Base
1
private function getTaskLink() { $link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id')); if (empty($link)) { throw new PageNotFoundException(); } return $link; }
Base
1
public function 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
static function displayname() { return gt("Navigation"); }
Class
2
function delete_vendor() { global $db; if (!empty($this->params['id'])){ $db->delete('vendor', 'id =' .$this->params['id']); } expHistory::back(); }
Base
1
public static function update($vars) { if(is_array($vars)){ //print_r($vars); $u = $vars['user']; $sql = array( 'table' => 'user', 'id' => $vars['id'], 'key' => $u, ); Db::update($sql); if(isset($vars['detail']) && $vars['detail'] != ''){ $u = $vars['detail']; $sql = array( 'table' => 'user_detail', 'id' => $vars['id'], 'key' => $u, ); Db::update($sql); } Hooks::run('user_sqledit_action', $vars); } }
Base
1
public function approve_submit() { if (empty($this->params['id'])) { flash('error', gt('No ID supplied for comment to approve')); expHistory::back(); } /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet // $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login']; // $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval']; // $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification']; // $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email']; $comment = new expComment($this->params['id']); $comment->body = $this->params['body']; $comment->approved = $this->params['approved']; $comment->save(); expHistory::back(); }
Base
1
public function upload() { if (!AuthUser::hasPermission('file_manager_upload')) { Flash::set('error', __('You do not have sufficient permissions to upload a file.')); 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/upload')) { 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/')); } $mask = Plugin::getSetting('umask', 'file_manager'); umask(octdec($mask)); $data = $_POST['upload']; $path = str_replace('..', '', $data['path']); $overwrite = isset($data['overwrite']) ? true : false; // Clean filenames $filename = preg_replace('/ /', '_', $_FILES['upload_file']['name']); $filename = preg_replace('/[^a-z0-9_\-\.]/i', '', $filename); if (isset($_FILES)) { $file = $this->_upload_file($filename, FILES_DIR . '/' . $path . '/', $_FILES['upload_file']['tmp_name'], $overwrite); if ($file === false) Flash::set('error', __('File has not been uploaded!')); } redirect(get_url('plugin/file_manager/browse/' . $path)); }
Class
2
public function actionGetItems(){ $model = X2Model::model ($this->modelClass); if (isset ($model)) { $tableName = $model->tableName (); $sql = 'SELECT id, fileName as value FROM '.$tableName.' WHERE associationType!="theme" and fileName LIKE :qterm ORDER BY fileName 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
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 manage() { global $db; expHistory::set('manageable', $this->params); // $classes = array(); $dir = BASE."framework/modules/ecommerce/billingcalculators"; if (is_readable($dir)) { $dh = opendir($dir); while (($file = readdir($dh)) !== false) { if (is_file("$dir/$file") && substr("$dir/$file", -4) == ".php") { include_once("$dir/$file"); $classname = substr($file, 0, -4); $id = $db->selectValue('billingcalculator', 'id', 'calculator_name="'.$classname.'"'); if (empty($id)) { // $calobj = null; $calcobj = new $classname(); if ($calcobj->isSelectable() == true) { $obj = new billingcalculator(array( 'title'=>$calcobj->name(), // 'user_title'=>$calcobj->title, 'body'=>$calcobj->description(), 'calculator_name'=>$classname, 'enabled'=>false)); $obj->save(); } } } } } $bcalc = new billingcalculator(); $calculators = $bcalc->find('all'); assign_to_template(array( 'calculators'=>$calculators )); }
Base
1
public function isAllowedFilename($filename){ $allow_array = array( '.jpg','.jpeg','.png','.bmp','.gif','.ico','.webp', '.mp3','.wav','.m4a','.ogg','.webma','.mp4','.flv', '.mov','.webmv','.flac','.mkv', '.zip','.tar','.gz','.tgz','.ipa','.apk','.rar','.iso','.bz2','.epub', '.pdf','.ofd','.swf','.epub','.xps', '.doc','.docx','.odt','.rtf','.docm','.dotm','.dot','.dotx','.wps', '.ppt','.pptx','.xls','.xlsx','.txt','.psd','.csv', '.cer','.ppt','.pub','.properties','.json','.css', ) ; $ext = strtolower(substr($filename,strripos($filename,'.')) ); //获取文件扩展名(转为小写后) if(in_array( $ext , $allow_array ) ){ return true ; } return false; }
Base
1
public function getPLaying(){ $url = "http://api.themoviedb.org/3/movie/now_playing?api_key=".$this->apikey; $now_playing = $this->curl($url); return $now_playing; }
Base
1
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
public static function _date2timestamp( $datetime, $wtz=null ) { if( !isset( $datetime['hour'] )) $datetime['hour'] = 0; if( !isset( $datetime['min'] )) $datetime['min'] = 0; if( !isset( $datetime['sec'] )) $datetime['sec'] = 0; if( empty( $wtz ) && ( !isset( $datetime['tz'] ) || empty( $datetime['tz'] ))) return mktime( $datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year'] ); $output = $offset = 0; if( empty( $wtz )) { if( iCalUtilityFunctions::_isOffset( $datetime['tz'] )) { $offset = iCalUtilityFunctions::_tz2offset( $datetime['tz'] ) * -1; $wtz = 'UTC'; } else $wtz = $datetime['tz']; } if(( 'Z' == $wtz ) || ( 'GMT' == strtoupper( $wtz ))) $wtz = 'UTC'; try { $strdate = sprintf( '%04d-%02d-%02d %02d:%02d:%02d', $datetime['year'], $datetime['month'], $datetime['day'], $datetime['hour'], $datetime['min'], $datetime['sec'] ); $d = new DateTime( $strdate, new DateTimeZone( $wtz )); if( 0 != $offset ) // adjust for offset $d->modify( $offset.' seconds' ); $output = $d->format( 'U' ); unset( $d ); } catch( Exception $e ) { $output = mktime( $datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year'] ); } return $output; }
Class
2
public static function validateByRegex($path, $values, $regex) { $result = preg_match($regex, $values[$path]); return array($path => ($result ? '' : __('Incorrect value!'))); }
Class
2
$files[$key]->save(); } // eDebug($files,true); }
Base
1
$that->options['id_field'] => new \MongoDate(), ); }));
Base
1
foreach($item->attributes as $name => $value) if ($name !== 'id' && $name !== 'listId') $copy->$name = $value; $lineItems[] = $copy; } return $lineItems; }
Class
2
public static function format ($post, $id) { // split post for readmore... $post = Typo::Xclean($post); $more = explode('[[--readmore--]]', $post); //print_r($more); if (count($more) > 1) { $post = explode('[[--readmore--]]', $post); $post = $post[0]." <a href=\"".Url::post($id)."\">".READ_MORE."</a>"; }else{ $post = $post; } $post = Hooks::filter('post_content_filter', $post); return $post; }
Base
1
$banner->increaseImpressions(); } } // assign banner to the template and show it! assign_to_template(array( 'banners'=>$banners )); }
Class
2
public function save($check_notify = false) { if (isset($_POST['email_recipients']) && is_array($_POST['email_recipients'])) { $this->email_recipients = base64_encode(serialize($_POST['email_recipients'])); } return parent::save($check_notify); }
Class
2
public function install(array $options = null, &$status=null) { parent::install($options); parent::setup($options); //check if ssl is enabled $this->appcontext->run('v-list-web-domain', [$this->appcontext->user(), $this->domain, 'json'], $status); $sslEnabled = ($status->json[$this->domain]['SSL'] == 'no' ? 0 : 1); $webDomain = ($sslEnabled ? "https://" : "http://") . $this->domain . "/"; $this->appcontext->runUser('v-copy-fs-directory',[ $this->getDocRoot($this->extractsubdir . "/dokuwiki-release_stable_2020-07-29/."), $this->getDocRoot()], $status); // enable htaccess $this->appcontext->runUser('v-move-fs-file', [$this->getDocRoot(".htaccess.dist"), $this->getDocRoot(".htaccess")], $status); $installUrl = $webDomain . "install.php"; $cmd = "curl --request POST " . ($sslEnabled ? "" : "--insecure " )
Base
1
private function setColumnOption(&$column, string $name, string $key, bool $isWidget, bool $allowEmpty) { $newValue = $this->request->request->get($name . '-' . $key); if ($isWidget) { if (!empty($newValue) || $allowEmpty) { $column['children'][0][$key] = $newValue; } return; } if (!empty($newValue) || $allowEmpty) { $column[$key] = $newValue; } }
Base
1
public function update_version() { // get the current version $hv = new help_version(); $current_version = $hv->find('first', 'is_current=1'); // check to see if the we have a new current version and unset the old current version. if (!empty($this->params['is_current'])) { // $db->sql('UPDATE '.DB_TABLE_PREFIX.'_help_version set is_current=0'); help_version::clearHelpVersion(); } expSession::un_set('help-version'); // save the version $id = empty($this->params['id']) ? null : $this->params['id']; $version = new help_version(); // if we don't have a current version yet so we will force this one to be it if (empty($current_version->id)) $this->params['is_current'] = 1; $version->update($this->params); // if this is a new version we need to copy over docs if (empty($id)) { self::copydocs($current_version->id, $version->id); } // let's update the search index to reflect the current help version searchController::spider(); flash('message', gt('Saved help version').' '.$version->version); expHistory::back(); }
Class
2
function unlockTables() { $sql = "UNLOCK TABLES"; $res = mysqli_query($this->connection, $sql); return $res; }
Base
1
public function AddBCC($address, $name = '') { return $this->AddAnAddress('bcc', $address, $name); }
Class
2
protected function renderImageByGD($code) { $image = imagecreatetruecolor($this->width, $this->height); $backColor = imagecolorallocate( $image, (int) ($this->backColor % 0x1000000 / 0x10000), (int) ($this->backColor % 0x10000 / 0x100), $this->backColor % 0x100 ); imagefilledrectangle($image, 0, 0, $this->width - 1, $this->height - 1, $backColor); imagecolordeallocate($image, $backColor); if ($this->transparent) { imagecolortransparent($image, $backColor); } $foreColor = imagecolorallocate( $image, (int) ($this->foreColor % 0x1000000 / 0x10000), (int) ($this->foreColor % 0x10000 / 0x100), $this->foreColor % 0x100 ); $length = strlen($code); $box = imagettfbbox(30, 0, $this->fontFile, $code); $w = $box[4] - $box[0] + $this->offset * ($length - 1); $h = $box[1] - $box[5]; $scale = min(($this->width - $this->padding * 2) / $w, ($this->height - $this->padding * 2) / $h); $x = 10; $y = round($this->height * 27 / 40); for ($i = 0; $i < $length; ++$i) { $fontSize = (int) (mt_rand(26, 32) * $scale * 0.8); $angle = mt_rand(-10, 10); $letter = $code[$i]; $box = imagettftext($image, $fontSize, $angle, $x, $y, $foreColor, $this->fontFile, $letter); $x = $box[2] + $this->offset; } imagecolordeallocate($image, $foreColor); ob_start(); imagepng($image); imagedestroy($image); return ob_get_clean(); }
Class
2
static public function addCategory($_category = null, $_admin = 1, $_order = 1) { if ($_category != null && $_category != '' ) { if ($_order < 1) { $_order = 1; } $ins_stmt = Database::prepare(" INSERT INTO `" . TABLE_PANEL_TICKET_CATS . "` SET `name` = :name, `adminid` = :adminid, `logicalorder` = :lo" ); $ins_data = array( 'name' => $_category, 'adminid' => $_admin, 'lo' => $_order ); Database::pexecute($ins_stmt, $ins_data); return true; } return false; }
Class
2
public function formatTemplateArg( $arg, $s, $argNr, $firstCall, $maxLength, Article $article ) { $tableFormat = $this->getParameters()->getParameter( 'tablerow' ); // we could try to format fields differently within the first call of a template // currently we do not make such a difference // if the result starts with a '-' we add a leading space; thus we avoid a misinterpretation of |- as // a start of a new row (wiki table syntax) if ( array_key_exists( "$s.$argNr", $tableFormat ) ) { $n = -1; if ( $s >= 1 && $argNr == 0 && !$firstCall ) { $n = strpos( $tableFormat["$s.$argNr"], '|' ); if ( $n === false || !( strpos( substr( $tableFormat["$s.$argNr"], 0, $n ), '{' ) === false ) || !( strpos( substr( $tableFormat["$s.$argNr"], 0, $n ), '[' ) === false ) ) { $n = -1; } } $result = str_replace( '%%', $arg, substr( $tableFormat["$s.$argNr"], $n + 1 ) ); $result = str_replace( '%PAGE%', $article->mTitle->getPrefixedText(), $result ); $result = str_replace( '%IMAGE%', $this->parseImageUrlWithPath( $arg ), $result ); //@TODO: This just blindly passes the argument through hoping it is an image. --Alexia $result = $this->cutAt( $maxLength, $result ); if ( strlen( $result ) > 0 && $result[0] == '-' ) { return ' ' . $result; } else { return $result; } } $result = $this->cutAt( $maxLength, $arg ); if ( strlen( $result ) > 0 && $result[0] == '-' ) { return ' ' . $result; } else { return $result; } }
Class
2
static function dropdownConnect($itemtype, $fromtype, $myname, $entity_restrict = -1, $onlyglobal = 0, $used = []) { global $CFG_GLPI; $rand = mt_rand(); $field_id = Html::cleanId("dropdown_".$myname.$rand); $param = [ 'entity_restrict' => $entity_restrict, 'fromtype' => $fromtype, 'itemtype' => $itemtype, 'onlyglobal' => $onlyglobal, 'used' => $used, '_idor_token' => Session::getNewIDORToken($itemtype), ]; echo Html::jsAjaxDropdown($myname, $field_id, $CFG_GLPI['root_doc']."/ajax/getDropdownConnect.php", $param); return $rand; }
Class
2
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $category = $this->getCategory(); if ($this->categoryModel->remove($category['id'])) { $this->flash->success(t('Category removed successfully.')); } else { $this->flash->failure(t('Unable to remove this category.')); } $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id']))); }
Base
1
if(!is_array($sections)) $sections = array(); foreach($sections as $section) { if(!empty($section['width']) && !in_array($section['width'], $widths)) array_push($widths, $section['width']); } } return $widths; }
Base
1
function getUserPartForHeader() { global $i18n; if (!$this->id) return null; $user_part = htmlspecialchars($this->name); $user_part .= ' - '.htmlspecialchars($this->role_name); if ($this->behalf_id) { $user_part .= ' <span class="onBehalf">'.$i18n->get('label.on_behalf').' '.htmlspecialchars($this->behalf_name).'</span>'; } if ($this->behalf_group_id) { $user_part .= ', <span class="onBehalf">'.htmlspecialchars($this->behalf_group_name).'</span>'; } else { if ($this->group_name) // Note: we did not require group names in the past. $user_part .= ', '.$this->group_name; } return $user_part; }
Base
1
$contents = ['form' => tep_draw_form('status', 'orders_status.php', 'page=' . $_GET['page'] . '&action=insert')];
Base
1
function updateObject($object, $table, $where=null, $identifier='id', $is_revisioned=false) { if ($is_revisioned) { $object->revision_id++; //if ($table=="text") eDebug($object); $res = $this->insertObject($object, $table); //if ($table=="text") eDebug($object,true); $this->trim_revisions($table, $object->$identifier, WORKFLOW_REVISION_LIMIT); return $res; } $sql = "UPDATE " . $this->prefix . "$table SET "; foreach (get_object_vars($object) as $var => $val) { //We do not want to save any fields that start with an '_' //if($is_revisioned && $var=='revision_id') $val++; if ($var{0} != '_') { if (is_array($val) || is_object($val)) { $val = serialize($val); $sql .= "`$var`='".$val."',"; } else { $sql .= "`$var`='" . $this->escapeString($val) . "',"; } } } $sql = substr($sql, 0, -1) . " WHERE "; if ($where != null) $sql .= $this->injectProof($where); else $sql .= "`" . $identifier . "`=" . $object->$identifier; //if ($table == 'text') eDebug($sql,true); $res = (@mysqli_query($this->connection, $sql) != false); return $res; }
Class
2
$contents[] = ['class' => 'text-center', 'text' => tep_draw_bootstrap_button(IMAGE_SAVE, 'fas fa-save', null, 'primary', null, 'btn-success xxx text-white mr-2') . tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-times', tep_href_link('zones.php', 'page=' . $_GET['page']), null, null, 'btn-light')];
Base
1
public static function getSName($zdb, $id, $wid = false, $wnick = false) { try { $select = $zdb->select(self::TABLE); $select->where(self::PK . ' = ' . $id); $results = $zdb->execute($select); $row = $results->current(); return self::getNameWithCase( $row->nom_adh, $row->prenom_adh, false, ($wid === true ? $row->id_adh : false), ($wnick === true ? $row->pseudo_adh : false) ); } catch (Throwable $e) { Analog::log( 'Cannot get formatted name for member form id `' . $id . '` | ' . $e->getMessage(), Analog::WARNING ); throw $e; } }
Base
1
function searchCategory() { return gt('Event'); }
Base
1
public function actionEditDropdown() { $model = new Dropdowns; if (isset($_POST['Dropdowns'])) { $model = Dropdowns::model()->findByPk( $_POST['Dropdowns']['id']); if ($model->id == Actions::COLORS_DROPDOWN_ID) { if (AuxLib::issetIsArray($_POST['Dropdowns']['values']) && AuxLib::issetIsArray($_POST['Dropdowns']['labels']) && count($_POST['Dropdowns']['values']) === count($_POST['Dropdowns']['labels'])) { if (AuxLib::issetIsArray($_POST['Admin']) && isset($_POST['Admin']['enableColorDropdownLegend'])) { Yii::app()->settings->enableColorDropdownLegend = $_POST['Admin']['enableColorDropdownLegend']; Yii::app()->settings->save(); } $options = array_combine( $_POST['Dropdowns']['values'], $_POST['Dropdowns']['labels']); $temp = array(); foreach ($options as $value => $label) { if ($value != "") $temp[$value] = $label; } $model->options = json_encode($temp); $model->save(); } } else { $model->attributes = $_POST['Dropdowns']; $temp = array(); if (is_array($model->options) && count($model->options) > 0) { foreach ($model->options as $option) { if ($option != "") $temp[$option] = $option; } $model->options = json_encode($temp); if ($model->save()) { } } } } $this->redirect( 'manageDropDowns' ); }
Base
1
public function disable() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->disable($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane updated successfully.')); } else { $this->flash->failure(t('Unable to update this swimlane.')); } $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); }
Base
1
public function showall() { expHistory::set('viewable', $this->params); $limit = (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10; if (!empty($this->params['view']) && ($this->params['view'] == 'showall_accordion' || $this->params['view'] == 'showall_tabbed')) { $limit = '0'; } $order = isset($this->config['order']) ? $this->config['order'] : "rank"; $page = new expPaginator(array( 'model'=>'photo', 'where'=>$this->aggregateWhereClause(), 'limit'=>$limit, 'order'=>$order, 'categorize'=>empty($this->config['usecategories']) ? false : $this->config['usecategories'], 'uncat'=>!empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized'), 'groups'=>!isset($this->params['gallery']) ? array() : array($this->params['gallery']), 'grouplimit'=>!empty($this->params['view']) && $this->params['view'] == 'showall_galleries' ? 1 : null, 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->baseclassname, 'action'=>$this->params['action'], 'src'=>$this->loc->src, 'columns'=>array( gt('Title')=>'title' ), )); assign_to_template(array( 'page'=>$page, 'params'=>$this->params, )); }
Base
1
public function upload() { if (!AuthUser::hasPermission('file_manager_upload')) { Flash::set('error', __('You do not have sufficient permissions to upload a file.')); 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/upload')) { 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/')); } $mask = Plugin::getSetting('umask', 'file_manager'); umask(octdec($mask)); $data = $_POST['upload']; $path = str_replace('..', '', $data['path']); $overwrite = isset($data['overwrite']) ? true : false; // Clean filenames $filename = preg_replace('/ /', '_', $_FILES['upload_file']['name']); $filename = preg_replace('/[^a-z0-9_\-\.]/i', '', $filename); if (isset($_FILES)) { $file = $this->_upload_file($filename, FILES_DIR . '/' . $path . '/', $_FILES['upload_file']['tmp_name'], $overwrite); if ($file === false) Flash::set('error', __('File has not been uploaded!')); } redirect(get_url('plugin/file_manager/browse/' . $path)); }
Class
2
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(); } } }
Class
2
function download_selected($dir) { $dir = get_abs_dir($dir); global $site_name; require_once("_include/fun_archive.php"); $items = qxpage_selected_items(); // check if user selected any items to download switch (count($items)) { case 0: show_error($GLOBALS["error_msg"]["miscselitems"]); case 1: if (is_file($items[0])) { download_item( $dir, $items[0] ); break; } // nobreak, downloading a directory is done // with the zip file default: zip_download( $dir, $items ); } }
Base
1
protected function _restoreDb($data) { if (empty($data['Tool']['backup']['tmp_name'])) { return false; } $tmpPath = TMP . 'schemas' . DS; $targetPath = $tmpPath . $data['Tool']['backup']['name']; if (!move_uploaded_file($data['Tool']['backup']['tmp_name'], $targetPath)) { return false; } /* ZIPファイルを解凍する */ $Simplezip = new Simplezip(); if (!$Simplezip->unzip($targetPath, $tmpPath)) { return false; } @unlink($targetPath); $result = true; $db = ConnectionManager::getDataSource('default'); $db->begin(); if (!$this->_loadBackup($tmpPath . 'core' . DS, $data['Tool']['encoding'])) { $result = false; } if (!$this->_loadBackup($tmpPath . 'plugin' . DS, $data['Tool']['encoding'])) { $result = false; } if ($result) { $db->commit(); } else { $db->rollback(); } $this->_resetTmpSchemaFolder(); clearAllCache(); return $result; }
Base
1
protected function curl_get_contents( &$url, $timeout, $redirect_max, $ua, $outfp ){ $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, $url ); curl_setopt( $ch, CURLOPT_HEADER, false ); if ($outfp) { curl_setopt( $ch, CURLOPT_FILE, $outfp ); } else { curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch, CURLOPT_BINARYTRANSFER, true ); } curl_setopt( $ch, CURLOPT_LOW_SPEED_LIMIT, 1 ); curl_setopt( $ch, CURLOPT_LOW_SPEED_TIME, $timeout ); curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt( $ch, CURLOPT_MAXREDIRS, $redirect_max); curl_setopt( $ch, CURLOPT_USERAGENT, $ua); $result = curl_exec( $ch ); $url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); curl_close( $ch ); return $outfp? $outfp : $result; }
Base
1
public static function parseAndTrimExport($str, $isHTML = false) { //�Death from above�? � //echo "1<br>"; eDebug($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("\r\n", " ", $str); $str = str_replace("\t", " ", $str); $str = str_replace(",", "\,", $str); $str = str_replace("�", "&#188;", $str); $str = str_replace("�", "&#189;", $str); $str = str_replace("�", "&#190;", $str); if (!$isHTML) { $str = str_replace('\"', "&quot;", $str); $str = str_replace('"', "&quot;", $str); } else { $str = str_replace('"', '""', $str); } //$str = htmlspecialchars($str); //$str = utf8_encode($str); $str = trim(str_replace("�", "&trade;", $str)); //echo "2<br>"; eDebug($str,die); return $str; }
Base
1
public static function gZip () { #ob_start(ob_gzhandler); ob_start(); ob_implicit_flush(0); }
Base
1
function edit_section() { global $db, $user; $parent = new section($this->params['parent']); if (empty($parent->id)) $parent->id = 0; assign_to_template(array( 'haveStandalone' => ($db->countObjects('section', 'parent=-1') && $parent->id >= 0), 'parent' => $parent, 'isAdministrator' => $user->isAdmin(), )); }
Base
1
public function setPageTextMatchRegex( array $pageTextMatchRegex = [] ) { $this->pageTextMatchRegex = (array)$pageTextMatchRegex; }
Class
2
$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 } }
Base
1
$cols = explode( '}:', $label ); if ( count( $cols ) <= 1 ) { if ( array_key_exists( $t, $_tableRow ) ) { $tableRow[$groupNr] = $_tableRow[$t]; } } else { $n = count( explode( ':', $cols[1] ) ); $colNr = -1; $t--; for ( $i = 1; $i <= $n; $i++ ) { $colNr++; $t++; if ( array_key_exists( $t, $_tableRow ) ) { $tableRow[$groupNr . '.' . $colNr] = $_tableRow[$t]; } } } } return $tableRow; }
Class
2
function update_optiongroup_master() { global $db; $id = empty($this->params['id']) ? null : $this->params['id']; $og = new optiongroup_master($id); $oldtitle = $og->title; $og->update($this->params); // if the title of the master changed we should update the option groups that are already using it. if ($oldtitle != $og->title) { $db->sql('UPDATE '.$db->prefix.'optiongroup SET title="'.$og->title.'" WHERE title="'.$oldtitle.'"'); } expHistory::back(); }
Base
1
public function index($id) { //check permissions $template = $this->TemplateElement->Template->checkAuthorisation($id, $this->Auth->user(), false); if (!$this->_isSiteAdmin() && !$template) { throw new MethodNotAllowedException('No template with the provided ID exists, or you are not authorised to see it.'); } $templateElements = $this->TemplateElement->find('all', array( 'conditions' => array( 'template_id' => $id, ), 'contain' => array( 'TemplateElementAttribute', 'TemplateElementText', 'TemplateElementFile' ), 'order' => array('TemplateElement.position ASC') )); $this->loadModel('Attribute'); $this->set('validTypeGroups', $this->Attribute->validTypeGroups); $this->set('id', $id); $this->layout = 'ajaxTemplate'; $this->set('elements', $templateElements); $mayModify = false; if ($this->_isSiteAdmin() || $template['Template']['org'] == $this->Auth->user('Organisation')['name']) { $mayModify = true; } $this->set('mayModify', $mayModify); $this->render('ajax/ajaxIndex'); }
Base
1
public function manage() { expHistory::set('viewable', $this->params); $page = new expPaginator(array( 'model'=>'order_status', 'where'=>1, 'limit'=>10, 'order'=>'rank', 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->params['controller'], 'action'=>$this->params['action'], //'columns'=>array('Name'=>'title') )); assign_to_template(array( 'page'=>$page )); }
Class
2
public static function restoreX2AuthManager () { if (isset (self::$_oldAuthManagerComponent)) { Yii::app()->setComponent ('authManager', self::$_oldAuthManagerComponent); } else { throw new CException ('X2AuthManager component could not be restored'); } }
Base
1
static function testLDAPConnection($auths_id, $replicate_id = -1) { $config_ldap = new self(); $res = $config_ldap->getFromDB($auths_id); // we prevent some delay... if (!$res) { return false; } //Test connection to a replicate if ($replicate_id != -1) { $replicate = new AuthLdapReplicate(); $replicate->getFromDB($replicate_id); $host = $replicate->fields["host"]; $port = $replicate->fields["port"]; } else { //Test connection to a master ldap server $host = $config_ldap->fields['host']; $port = $config_ldap->fields['port']; } $ds = self::connectToServer($host, $port, $config_ldap->fields['rootdn'], Toolbox::decrypt($config_ldap->fields['rootdn_passwd'], GLPIKEY), $config_ldap->fields['use_tls'], $config_ldap->fields['deref_option']); if ($ds) { return true; } return false; }
Base
1
} elseif (!empty($this->params['src'])) { if ($this->params['src'] == $loc->src) { $this->config = $config->config; break; } } }
Class
2
public static function filesBySearch($text, $wid=NULL, $orderby="name ASC") { global $DB; global $website; if(empty($wid)) $wid = $website->id; $DB->query(' SELECT * FROM nv_files WHERE name LIKE '.protect('%'.$text.'%').' AND website = '.$wid.' ORDER BY '.$orderby); return $DB->result(); }
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; }
Class
2
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query(' SELECT * FROM nv_notes WHERE website = '.protect($website->id), 'object' ); $out = $DB->result(); if($type='json') $out = json_encode($out); return $out; }
Base
1
public function update($key, $qty) { if ((int)$qty && ((int)$qty > 0)) { $this->session->data['cart'][$key] = (int)$qty; } else { $this->remove($key); } $this->data = array(); }
Base
1
public function testNotRemoveAuthorizationHeaderOnRedirect() { $mock = new MockHandler([ new Response(302, ['Location' => 'http://example.com/2']), static function (RequestInterface $request) { self::assertTrue($request->hasHeader('Authorization')); return new Response(200); } ]); $handler = HandlerStack::create($mock); $client = new Client(['handler' => $handler]); $client->get('http://example.com?a=b', ['auth' => ['testuser', 'testpass']]); }
Class
2
public function theme_switch() { if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change the theme.')); } expSettings::change('DISPLAY_THEME_REAL', $this->params['theme']); expSession::set('display_theme',$this->params['theme']); $sv = isset($this->params['sv'])?$this->params['sv']:''; if (strtolower($sv)=='default') { $sv = ''; } expSettings::change('THEME_STYLE_REAL',$sv); expSession::set('theme_style',$sv); expDatabase::install_dbtables(); // update tables to include any custom definitions in the new theme // $message = (MINIFY != 1) ? "Exponent is now minifying Javascript and CSS" : "Exponent is no longer minifying Javascript and CSS" ; // flash('message',$message); $message = gt("You have selected the")." '".$this->params['theme']."' ".gt("theme"); if ($sv != '') { $message .= ' '.gt('with').' '.$this->params['sv'].' '.gt('style variation'); } flash('message',$message); // expSession::un_set('framework'); expSession::set('force_less_compile', 1); // expTheme::removeSmartyCache(); expSession::clearAllUsersSessionCache(); expHistory::returnTo('manageable'); }
Base
1
foreach ($post['fields'] as $abs_pos => $field) { if ($current_cat != $post[$field . '_category']) { //reset position when category has changed $pos = 0; //set new current category $current_cat = $post[$field . '_category']; } $required = null; if (isset($post[$field . '_required'])) { $required = $post[$field . '_required']; } else { $required = false; } $res[$current_cat][] = array( 'field_id' => $field, 'label' => $post[$field . '_label'], 'category' => $post[$field . '_category'], 'visible' => $post[$field . '_visible'], 'required' => $required ); $pos++; }
Base
1
public function setModel(Model $model) { $this->model = $model; $this->extensions = $this->model->getAllowedExtensions(); $this->from($this->model->getObjectTypeDirName()); return $this; }
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; }
Class
2
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 actionGetItems(){ $sql = 'SELECT id, name as value FROM x2_docs 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); exit; }
Class
2
public static function save_uploaded_user_avatar() { $avatar_data = wp_parse_args( LP_Request::get( 'lp-user-avatar-crop' ), array( 'name' => '', 'width' => '', 'height' => '', 'points' => '', 'nonce' => '', ) ); $current_user_id = get_current_user_id(); if ( ! wp_verify_nonce( $avatar_data['nonce'], 'save-uploaded-profile-' . $current_user_id ) ) { die( 'ERROR VERIFY NONCE!' ); } $url = learn_press_update_user_profile_avatar(); if ( $url ) { $user = learn_press_get_current_user(); learn_press_send_json( array( 'success' => true, 'avatar' => sprintf( '<img src="%s" />', $url ), ) ); }; wp_die(); }
Class
2
static function convertXMLFeedSafeChar($str) { $str = str_replace("<br>","",$str); $str = str_replace("</br>","",$str); $str = str_replace("<br/>","",$str); $str = str_replace("<br />","",$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("�","-", $str); $str = str_replace("�", '"', $str); $str = str_replace("&rdquo;",'"', $str); $str = str_replace("�", '"', $str); $str = str_replace("&ldquo;",'"', $str); $str = str_replace("\r\n"," ",$str); $str = str_replace("�"," 1/4",$str); $str = str_replace("&#188;"," 1/4", $str); $str = str_replace("�"," 1/2",$str); $str = str_replace("&#189;"," 1/2",$str); $str = str_replace("�"," 3/4",$str); $str = str_replace("&#190;"," 3/4",$str); $str = str_replace("�", "(TM)", $str); $str = str_replace("&trade;","(TM)", $str); $str = str_replace("&reg;","(R)", $str); $str = str_replace("�","(R)",$str); $str = str_replace("&","&amp;",$str); $str = str_replace(">","&gt;",$str); return trim($str); }
Base
1
function move_standalone() { expSession::clearAllUsersSessionCache('navigation'); assign_to_template(array( 'parent' => $this->params['parent'], )); }
Base
1
private function _notmodifiedby( $option ) { $user = new \User; $this->addWhere( 'NOT EXISTS (SELECT 1 FROM ' . $this->tableNames['revision_actor_temp'] . ' WHERE ' . $this->tableNames['revision_actor_temp'] . '.revactor_page=page_id AND ' . $this->tableNames['revision_actor_temp'] . '.revactor_actor = ' . $this->DB->addQuotes( $user->newFromName( $option )->getActorId() ) . ' LIMIT 1)' ); }
Class
2
public function store() { $data = array( 'type_name' => $this->name ); try { if ($this->id !== null && $this->id > 0) { if ($this->old_name !== null) { $this->deleteTranslation($this->old_name); $this->addTranslation($this->name); } $update = $this->zdb->update(self::TABLE); $update->set($data)->where( self::PK . '=' . $this->id ); $this->zdb->execute($update); } else { $insert = $this->zdb->insert(self::TABLE); $insert->values($data); $add = $this->zdb->execute($insert); if (!$add->count() > 0) { Analog::log('Not stored!', Analog::ERROR); return false; } $this->id = $this->zdb->getLastGeneratedValue($this); $this->addTranslation($this->name); } return true; } catch (Throwable $e) { Analog::log( 'An error occurred storing payment type: ' . $e->getMessage() . "\n" . print_r($data, true), Analog::ERROR ); throw $e; } }
Base
1
$body = str_replace(array("\n"), "<br />", $body); } else { // It's going elsewhere (doesn't like quoted-printable) $body = str_replace(array("\n"), " -- ", $body); } $title = $items[$i]->title; $msg .= "BEGIN:VEVENT\n"; $msg .= $dtstart . $dtend; $msg .= "UID:" . $items[$i]->date_id . "\n"; $msg .= "DTSTAMP:" . date("Ymd\THis", time()) . "Z\n"; if ($title) { $msg .= "SUMMARY:$title\n"; } if ($body) { $msg .= "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" . $body . "\n"; } // if($link_url) { $msg .= "URL: $link_url\n";} if (!empty($this->config['usecategories'])) { if (!empty($items[$i]->expCat[0]->title)) { $msg .= "CATEGORIES:".$items[$i]->expCat[0]->title."\n"; } else { $msg .= "CATEGORIES:".$this->config['uncat']."\n"; } } $msg .= "END:VEVENT\n"; }
Base
1
static function testLDAPConnection($auths_id, $replicate_id = -1) { $config_ldap = new self(); $res = $config_ldap->getFromDB($auths_id); // we prevent some delay... if (!$res) { return false; } //Test connection to a replicate if ($replicate_id != -1) { $replicate = new AuthLdapReplicate(); $replicate->getFromDB($replicate_id); $host = $replicate->fields["host"]; $port = $replicate->fields["port"]; } else { //Test connection to a master ldap server $host = $config_ldap->fields['host']; $port = $config_ldap->fields['port']; } $ds = self::connectToServer($host, $port, $config_ldap->fields['rootdn'], Toolbox::decrypt($config_ldap->fields['rootdn_passwd'], GLPIKEY), $config_ldap->fields['use_tls'], $config_ldap->fields['deref_option']); if ($ds) { return true; } return false; }
Class
2
$controller = new $ctlname(); if (method_exists($controller,'isSearchable') && $controller->isSearchable()) { // $mods[$controller->name()] = $controller->addContentToSearch(); $mods[$controller->searchName()] = $controller->addContentToSearch(); } } uksort($mods,'strnatcasecmp'); assign_to_template(array( 'mods'=>$mods )); }
Class
2
public function toolbar() { // global $user; $menu = array(); $dirs = array( BASE.'framework/modules/administration/menus', BASE.'themes/'.DISPLAY_THEME.'/modules/administration/menus' ); foreach ($dirs as $dir) { if (is_readable($dir)) { $dh = opendir($dir); while (($file = readdir($dh)) !== false) { if (substr($file,-4,4) == '.php' && is_readable($dir.'/'.$file) && is_file($dir.'/'.$file)) { $menu[substr($file,0,-4)] = include($dir.'/'.$file); if (empty($menu[substr($file,0,-4)])) unset($menu[substr($file,0,-4)]); } } } } // sort the top level menus alphabetically by filename ksort($menu); $sorted = array(); foreach($menu as $m) $sorted[] = $m; // slingbar position if (isset($_COOKIE['slingbar-top'])){ $top = $_COOKIE['slingbar-top']; } else { $top = SLINGBAR_TOP; } assign_to_template(array( 'menu'=>(bs3()) ? $sorted : json_encode($sorted), "top"=>$top )); }
Base
1
'data' => str_replace(array_keys($tags), array_values($tags), $content), 'status' => array(), 'type' => 'text/html; charset=UTF-8' ) ); }
Base
1
public function search_external() { // global $db, $user; global $db; $sql = "select DISTINCT(a.id) as id, a.source as source, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email "; $sql .= "from " . $db->prefix . "external_addresses as a "; //R JOIN " . //$db->prefix . "billingmethods as bm ON bm.addresses_id=a.id "; $sql .= " WHERE match (a.firstname,a.lastname,a.email,a.organization) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) "; $sql .= "order by match (a.firstname,a.lastname,a.email,a.organization) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) ASC LIMIT 12"; $res = $db->selectObjectsBySql($sql); foreach ($res as $key=>$record) { $res[$key]->title = $record->firstname . ' ' . $record->lastname; } //eDebug($sql); $ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res); $ar->send(); }
Base
1
private function writeComment(Worksheet $pSheet, $coordinate) { $result = ''; if (!$this->isPdf && isset($pSheet->getComments()[$coordinate])) { $result .= '<a class="comment-indicator"></a>'; $result .= '<div class="comment">' . nl2br($pSheet->getComment($coordinate)->getText()->getPlainText()) . '</div>'; $result .= PHP_EOL; } return $result; }
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
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
private function getStateId(string $state, string $machine) { return $this->getContainer()->get(Connection::class) ->fetchColumn(' SELECT LOWER(HEX(state_machine_state.id)) FROM state_machine_state INNER JOIN state_machine ON state_machine.id = state_machine_state.state_machine_id AND state_machine.technical_name = :machine WHERE state_machine_state.technical_name = :state ', [ 'state' => $state, 'machine' => $machine, ]); }
Class
2
public function getDisplayName ($plural=true) { return Yii::t('contacts', '{contact} List|{contact} Lists', array( (int) $plural, '{contact}' => Modules::displayName(false, 'Contacts'), )); }
Class
2
function edit_vendor() { $vendor = new vendor(); if(isset($this->params['id'])) { $vendor = $vendor->find('first', 'id =' .$this->params['id']); assign_to_template(array( 'vendor'=>$vendor )); } }
Base
1
public function save($filename) { $json = []; foreach ($this as $cookie) { /** @var SetCookie $cookie */ if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { $json[] = $cookie->toArray(); } } if (false === file_put_contents($filename, json_encode($json))) { throw new \RuntimeException("Unable to save file {$filename}"); } }
Base
1
foreach ($indexToDelete as $indexName) { $this->addSql('DROP INDEX ' . $indexName . ' ON ' . $users); }
Compound
4
$links[] = CHtml::link(CHtml::encode($tag->tag),array('/search/search','term'=>CHtml::encode($tag->tag)));
Class
2
public function activate_address() { global $db, $user; $object = new stdClass(); $object->id = $this->params['id']; $db->setUniqueFlag($object, 'addresses', $this->params['is_what'], "user_id=" . $user->id); flash("message", gt("Successfully updated address.")); expHistory::back(); }
Base
1
public static function url($mod) { $url = Site::$url."/inc/mod/".$mod; return $url; }
Base
1
public function __construct () { }
Base
1
public function setText($text) { $return = $this->setOneToOne($text, Text::class, 'text', 'container'); $this->setType('ctText'); return $return; }
Base
1
private function getCategory() { $category = $this->categoryModel->getById($this->request->getIntegerParam('category_id')); if (empty($category)) { throw new PageNotFoundException(); } return $category; }
Base
1