code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
protected function GetRefs($refList, $type) { if (!$refList) return; if (empty($type)) return; $args = array(); $args[] = '--' . $type; $args[] = '--dereference'; $ret = $this->exe->Execute($refList->GetProject()->GetPath(), GIT_SHOW_REF, $args); $lines = explode("\n", $ret); $refs = array(); $commits = array(); foreach ($lines as $line) { if (preg_match('/^([0-9a-fA-F]{40}) refs\/' . $type . '\/([^^]+)(\^{})?$/', $line, $regs)) { if (!empty($regs[3]) && ($regs[3] == '^{}')) { $commits[$regs[2]] = $regs[1]; } else { $refs[$regs[2]] = $regs[1]; } } } return array($refs, $commits); }
Base
1
$product = X2Model::model('Products')->findByAttributes(array('name'=>$lineItem->name)); if (isset($product)) $lineItem->productId = $product->id; if(empty($lineItem->currency)) $lineItem->currency = $defaultCurrency; if($lineItem->isPercentAdjustment) { $lineItem->adjustment = Fields::strToNumeric( $lineItem->adjustment,'percentage'); } else { $lineItem->adjustment = Fields::strToNumeric( $lineItem->adjustment,'currency',$curSym); } $lineItem->price = Fields::strToNumeric($lineItem->price,'currency',$curSym); $lineItem->total = Fields::strToNumeric($lineItem->total,'currency',$curSym); }
Base
1
public function renameTag($oldName, $newName) { // http://stackoverflow.com/a/1873932 // create new as alias to old (`git tag NEW OLD`) $this->run('tag', $newName, $oldName); // delete old (`git tag -d OLD`) $this->removeTag($oldName); return $this; }
Class
2
$ret = array_merge($ret, csrf_flattenpost2($level+1, $nk, $v)); }
Compound
4
public function duplicateAction(Project $project, Request $request, ProjectDuplicationService $projectDuplicationService) { $newProject = $projectDuplicationService->duplicate($project, $project->getName() . ' [COPY]'); return $this->redirectToRoute('project_details', ['id' => $newProject->getId()]); }
Compound
4
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 insert() { global $DB; $ok = $DB->execute(' INSERT INTO nv_menus (id, codename, icon, lid, notes, functions, enabled) VALUES ( 0, :codename, :icon, :lid, :notes, :functions, :enabled)', array( 'codename' => value_or_default($this->codename, ""), 'icon' => value_or_default($this->icon, ""), 'lid' => value_or_default($this->lid, 0), 'notes' => value_or_default($this->notes, ""), 'functions' => json_encode($this->functions), 'enabled' => value_or_default($this->enabled, 0) ) ); if(!$ok) throw new Exception($DB->get_last_error()); $this->id = $DB->get_last_id(); return true; }
Base
1
function searchCategory() { return gt('Event'); }
Base
1
public function confirm() { $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); $this->response->html($this->template->render('project_tag/remove', array( 'tag' => $tag, 'project' => $project, ))); }
Base
1
public function getViewItemLink($icmsObj, $onlyUrl=false, $withimage=true, $userSide=false) { if ($this->handler->_moduleName != 'system') { $admin_side = $userSide ? '' : 'admin/'; $ret = $this->handler->_moduleUrl . $admin_side . $this->handler->_page . "?" . $this->handler->keyName . "=" . $icmsObj->getVar($this->handler->keyName); } else { $admin_side = ''; $ret = $this->handler->_moduleUrl . $admin_side . 'admin.php?fct=' . $this->handler->_itemname . "&amp;op=view&amp;" . $this->handler->keyName . "=" . $icmsObj->getVar($this->handler->keyName); } if ($onlyUrl) { return $ret; } elseif ($withimage) { return "<a href='" . $ret . "'> <img src='" . ICMS_IMAGES_SET_URL . "/actions/viewmag.png' style='vertical-align: middle;' alt='" . _PREVIEW . "' title='" . _PREVIEW . "'/></a>"; } return "<a href='" . $ret . "'>" . $icmsObj->getVar($this->handler->identifierName) . "</a>"; }
Base
1
$connecttext = preg_replace("/#connectport#/", $connectport, $connecttext); $connectMethods[$key]["connecttext"] = $connecttext; } return array('status' => 'ready', 'serverIP' => $serverIP, 'user' => $thisuser, 'password' => $passwd, 'connectport' => $connectport, 'connectMethods' => $connectMethods); } return array('status' => 'notready'); }
Class
2
public static function returnChildrenAsJSON() { global $db; //$nav = section::levelTemplate(intval($_REQUEST['id'], 0)); $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $nav = $db->selectObjects('section', 'parent=' . $id, 'rank'); //FIXME $manage_all is moot w/ cascading perms now? $manage_all = false; if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $id))) { $manage_all = true; } //FIXME recode to use foreach $key=>$value $navcount = count($nav); for ($i = 0; $i < $navcount; $i++) { if ($manage_all || expPermissions::check('manage', expCore::makeLocation('navigation', '', $nav[$i]->id))) { $nav[$i]->manage = 1; $view = true; } else { $nav[$i]->manage = 0; $view = $nav[$i]->public ? true : expPermissions::check('view', expCore::makeLocation('navigation', '', $nav[$i]->id)); } $nav[$i]->link = expCore::makeLink(array('section' => $nav[$i]->id), '', $nav[$i]->sef_name); if (!$view) unset($nav[$i]); } $nav= array_values($nav); // $nav[$navcount - 1]->last = true; if (count($nav)) $nav[count($nav) - 1]->last = true; // echo expJavascript::ajaxReply(201, '', $nav); $ar = new expAjaxReply(201, '', $nav); $ar->send(); }
Base
1
public function getPurchaseOrderByJSON() { if(!empty($this->params['vendor'])) { $purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']); } else { $purchase_orders = $this->purchase_order->find('all'); } echo json_encode($purchase_orders); }
Class
2
function get_filedisplay_views() { expTemplate::get_filedisplay_views(); $paths = array( BASE.'framework/modules/common/views/file/', BASE.'themes/'.DISPLAY_THEME.'modules/common/views/file/', ); $views = array(); foreach ($paths as $path) { if (is_readable($path)) { $dh = opendir($path); while (($file = readdir($dh)) !== false) { if (is_readable($path.'/'.$file) && substr($file, -4) == '.tpl' && substr($file, -14) != '.bootstrap.tpl' && substr($file, -15) != '.bootstrap3.tpl' && substr($file, -10) != '.newui.tpl') { $filename = substr($file, 0, -4); $views[$filename] = gt($filename); } } } } return $views; }
Base
1
function selectArraysBySql($sql) { $res = @mysqli_query($this->connection, $this->injectProof($sql)); if ($res == null) return array(); $arrays = array(); for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) $arrays[] = mysqli_fetch_assoc($res); return $arrays; }
Base
1
function showallSubcategories() { // global $db; expHistory::set('viewable', $this->params); // $parent = isset($this->params['cat']) ? $this->params['cat'] : expSession::get('catid'); $catid = expSession::get('catid'); $parent = !empty($catid) ? $catid : (!empty($this->params['cat']) ? $this->params['cat'] : 0); $category = new storeCategory($parent); $categories = $category->getEcomSubcategories(); $ancestors = $category->pathToNode(); assign_to_template(array( 'categories' => $categories, 'ancestors' => $ancestors, 'category' => $category )); }
Class
2
public function providesExceptionData() { $notFoundEnvMessage = 'Not found in env'; $notFoundEnvException = new NotFoundEnvException($notFoundEnvMessage); $notFoundEnvStatus = Http::STATUS_NOT_FOUND; $notFoundServiceMessage = 'Not found in service'; $notFoundServiceException = new NotFoundServiceException($notFoundServiceMessage); $notFoundServiceStatus = Http::STATUS_NOT_FOUND; $forbiddenServiceMessage = 'Forbidden in service'; $forbiddenServiceException = new ForbiddenServiceException($forbiddenServiceMessage); $forbiddenServiceStatus = Http::STATUS_FORBIDDEN; $errorServiceMessage = 'Broken service'; $errorServiceException = new InternalServerErrorServiceException($errorServiceMessage); $errorServiceStatus = Http::STATUS_INTERNAL_SERVER_ERROR; $coreServiceMessage = 'Broken core'; $coreServiceException = new \Exception($coreServiceMessage); $coreServiceStatus = Http::STATUS_INTERNAL_SERVER_ERROR; return [ [$notFoundEnvException, $notFoundEnvMessage, $notFoundEnvStatus], [$notFoundServiceException, $notFoundServiceMessage, $notFoundServiceStatus], [$forbiddenServiceException, $forbiddenServiceMessage, $forbiddenServiceStatus], [$errorServiceException, $errorServiceMessage, $errorServiceStatus], [$coreServiceException, $coreServiceMessage, $coreServiceStatus] ]; }
Base
1
public function remove($zdb) { $id = (int)$this->id; if ($id === self::MR || $id === self::MRS) { throw new \RuntimeException(_T("You cannot delete Mr. or Mrs. titles!")); } try { $delete = $zdb->delete(self::TABLE); $delete->where( self::PK . ' = ' . $id ); $zdb->execute($delete); Analog::log( 'Title #' . $id . ' (' . $this->short . ') deleted successfully.', Analog::INFO ); return true; } catch (\RuntimeException $re) { throw $re; } catch (Throwable $e) { Analog::log( 'Unable to delete title ' . $id . ' | ' . $e->getMessage(), Analog::ERROR ); throw $e; } }
Base
1
public function showall_tags() { $images = $this->image->find('all'); $used_tags = array(); foreach ($images as $image) { foreach($image->expTag as $tag) { if (isset($used_tags[$tag->id])) { $used_tags[$tag->id]->count++; } else { $exptag = new expTag($tag->id); $used_tags[$tag->id] = $exptag; $used_tags[$tag->id]->count = 1; } } } assign_to_template(array( 'tags'=>$used_tags )); }
Base
1
public function thumbnailTreeAction() { $this->checkPermission('thumbnails'); $thumbnails = []; $list = new Asset\Image\Thumbnail\Config\Listing(); $groups = []; foreach ($list->getThumbnails() as $item) { if ($item->getGroup()) { if (empty($groups[$item->getGroup()])) { $groups[$item->getGroup()] = [ 'id' => 'group_' . $item->getName(), 'text' => $item->getGroup(), 'expandable' => true, 'leaf' => false, 'allowChildren' => true, 'iconCls' => 'pimcore_icon_folder', 'group' => $item->getGroup(), 'children' => [], ]; } $groups[$item->getGroup()]['children'][] = [ 'id' => $item->getName(), 'text' => $item->getName(), 'leaf' => true, 'iconCls' => 'pimcore_icon_thumbnails', 'cls' => 'pimcore_treenode_disabled', 'writeable' => $item->isWriteable(), ]; } else { $thumbnails[] = [ 'id' => $item->getName(), 'text' => $item->getName(), 'leaf' => true, 'iconCls' => 'pimcore_icon_thumbnails', 'cls' => 'pimcore_treenode_disabled', 'writeable' => $item->isWriteable(), ]; } } foreach ($groups as $group) { $thumbnails[] = $group; } return $this->adminJson($thumbnails); }
Base
1
$ret[$key] = sprintf( $format, ++$i, $err[0], $err[1], $err[2], $err[3] ); } return $ret; }
Base
1
public function attributeLabels() { return array( 'actionId' => Yii::t('actions','Action ID'), 'text' => Yii::t('actions','Action Text'), ); }
Base
1
function update() { parent::update(); expSession::clearAllUsersSessionCache('navigation'); }
Base
1
public function getInvalidPaths() { return array( array('foo[['), array('foo[d'), array('foo[bar]]'), array('foo[bar]d'), ); }
Base
1
public function actionPublishPost() { $post = new Events; // $user = $this->loadModel($id); if (isset($_POST['text']) && $_POST['text'] != "") { $post->text = $_POST['text']; $post->visibility = $_POST['visibility']; if (isset($_POST['associationId'])) $post->associationId = $_POST['associationId']; //$soc->attributes = $_POST['Social']; //die(var_dump($_POST['Social'])); $post->user = Yii::app()->user->getName(); $post->type = 'feed'; $post->subtype = $_POST['subtype']; $post->lastUpdated = time(); $post->timestamp = time(); if ($post->save()) { if (!empty($post->associationId) && $post->associationId != Yii::app()->user->getId()) { $notif = new Notification; $notif->type = 'social_post'; $notif->createdBy = $post->user; $notif->modelType = 'Profile'; $notif->modelId = $post->associationId; $notif->user = Yii::app()->db->createCommand() ->select('username') ->from('x2_users') ->where('id=:id', array(':id' => $post->associationId)) ->queryScalar(); // $prof = X2Model::model('Profile')->findByAttributes(array('username'=>$post->user)); // $notif->text = "$prof->fullName posted on your profile."; // $notif->record = "profile:$prof->id"; // $notif->viewed = 0; $notif->createDate = time(); // $subject=X2Model::model('Profile')->findByPk($id); // $notif->user = $subject->username; $notif->save(); } } } }
Class
2
private function getCategory() { $category = $this->categoryModel->getById($this->request->getIntegerParam('category_id')); if (empty($category)) { throw new PageNotFoundException(); } return $category; }
Base
1
function get_abs_item($dir, $item) { // get absolute file+path return get_abs_dir($dir).DIRECTORY_SEPARATOR.$item; }
Base
1
function checkRights(&$db,&$user) { return $user->hasRight($db,'testplan_metrics'); }
Base
1
protected function deleteFileInStorage(Attachment $attachment) { $storage = $this->getStorage(); $dirPath = $this->adjustPathForStorageDisk(dirname($attachment->path)); $storage->delete($this->adjustPathForStorageDisk($attachment->path)); if (count($storage->allFiles($dirPath)) === 0) { $storage->deleteDirectory($dirPath); } }
Base
1
} elseif (isset($graph['data_query_name'])) { if (isset($prev_data_query_name)) { if ($prev_data_query_name != $graph['data_query_name']) { $print = true; $prev_data_query_name = $graph['data_query_name']; } else { $print = false; } } else { $print = true; $prev_data_query_name = $graph['data_query_name']; } if ($print) { if (!$start) { while(($i % $columns) != 0) { print "<td style='text-align:center;width:" . round(100 / $columns, 3) . "%;'></td>"; $i++; } print "</tr>\n"; } print "<tr class='tableHeader'> <td class='graphSubHeaderColumn textHeaderDark' colspan='$columns'>" . __('Data Query:') . ' ' . $graph['data_query_name'] . "</td> </tr>\n"; $i = 0; } } if ($i == 0) { print "<tr class='tableRowGraph'>\n"; $start = false; } ?> <td style='width:<?php print round(100 / $columns, 2);?>%;'> <table style='text-align:center;margin:auto;'> <tr> <td> <div class='graphWrapper' id='wrapper_<?php print $graph['local_graph_id']?>' graph_width='<?php print read_user_setting('default_width');?>' graph_height='<?php print read_user_setting('default_height');?>'></div> <?php print (read_user_setting('show_graph_title') == 'on' ? "<span class='center'>" . htmlspecialchars($graph['title_cache']) . '</span>' : '');?> </td> <td id='dd<?php print $graph['local_graph_id'];?>' class='noprint graphDrillDown'> <?php print graph_drilldown_icons($graph['local_graph_id'], 'graph_buttons_thumbnails');?> </td> </tr> </table> </td> <?php $i++; $k++; if (($i % $columns) == 0 && ($k < $num_graphs)) { $i=0; $j++; print "</tr>\n"; $start = true; } } if (!$start) { while(($i % $columns) != 0) { print "<td style='text-align:center;width:" . round(100 / $columns, 2) . "%;'></td>"; $i++; } print "</tr>\n"; } } else {
Base
1
protected function setUp() { static::$functions = []; static::$fopen = null; static::$fread = null; parent::setUp(); $this->security = new ExposedSecurity(); $this->security->derivationIterations = 1000; // speed up test running }
Class
2
public function update() { $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); $values = $this->request->getValues(); list($valid, $errors) = $this->tagValidator->validateModification($values); if ($tag['project_id'] != $project['id']) { throw new AccessForbiddenException(); } if ($valid) { if ($this->tagModel->update($values['id'], $values['name'])) { $this->flash->success(t('Tag updated successfully.')); } else { $this->flash->failure(t('Unable to update this tag.')); } $this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id']))); } else { $this->edit($values, $errors); } }
Base
1
function db_seq_nextval($seqname) { global $DatabaseType; if ($DatabaseType == 'mysqli') $seq = "fn_" . strtolower($seqname) . "()"; return $seq; }
Base
1
public function Connected() { if(!empty($this->smtp_conn)) { $sock_status = socket_get_status($this->smtp_conn); if($sock_status["eof"]) { // the socket is valid but we are not connected if($this->do_debug >= 1) { $this->edebug("SMTP -> NOTICE:" . $this->CRLF . "EOF caught while checking if connected"); } $this->Close(); return false; } return true; // everything looks good } return false; }
Base
1
public function privateCore(&$response, $user, $permissions) { parent::privateCore($response, $user, $permissions); $this->model = new PageOption(); $this->loadSelectedViewName(); $this->backPage = $this->request->get('url') ?: $this->selectedViewName; $this->selectedUser = $this->user->admin ? $this->request->get('nick') : $this->user->nick; $this->loadPageOptions(); $action = $this->request->get('action', ''); switch ($action) { case 'delete': $this->deleteAction(); break; case 'save': $this->saveAction(); break; } }
Base
1
public function assets_path($file = NULL, $path = NULL, $module = NULL, $absolute = NULL) { $cache = ''; if (!isset($absolute)) $absolute = $this->assets_absolute_path; $CI = $this->_get_assets_config(); if ($this->asset_append_cache_timestamp AND in_array($path, $this->asset_append_cache_timestamp) AND !empty($file)) { $q_str = (strpos($file, '?') === FALSE) ? '?' : '&'; $cache = $q_str.'c='.strtotime($this->assets_last_updated); } // if it is an absolute path already provided, then we just return it without any caching if (!$this->_is_local_path($file)) { return $file.$cache; } $assets_folders = $this->assets_folders; $asset_type = (!empty($assets_folders[$path])) ? $assets_folders[$path] : $CI->config->item($path); // if absolute path, then we just return that if (!$this->_is_local_path($this->assets_path)) { return $this->assets_path.$asset_type.$file.$cache; } $assets_path = $this->_get_assets_path($module); $path = WEB_PATH.$assets_path.$asset_type.$file.$cache; if ($absolute) { $protocol = ($_SERVER["SERVER_PORT"] == 443) ? "https://" : "http://"; $path = $protocol.$_SERVER['HTTP_HOST'].$path; } return $path; }
Class
2
public function startup(Event $event) { $controller = $event->subject(); $request = $controller->request; $response = $controller->response; $cookieName = $this->_config['cookieName']; $cookieData = $request->cookie($cookieName); if ($cookieData) { $request->params['_csrfToken'] = $cookieData; } if ($request->is('requested')) { return; } if ($request->is('get') && $cookieData === null) { $this->_setCookie($request, $response); } if ($request->is(['patch', 'put', 'post', 'delete'])) { $this->_validateToken($request); unset($request->data[$this->_config['field']]); } }
Compound
4
function update_option_master() { global $db; $id = empty($this->params['id']) ? null : $this->params['id']; $opt = new option_master($id); $oldtitle = $opt->title; $opt->update($this->params); // if the title of the master changed we should update the option groups that are already using it. if ($oldtitle != $opt->title) { }$db->sql('UPDATE '.$db->prefix.'option SET title="'.$opt->title.'" WHERE option_master_id='.$opt->id); expHistory::back(); }
Base
1
$context['clockicons'] = unserialize(base64_decode('YTozOntzOjE6ImgiO2E6NTp7aTowO2k6MTY7aToxO2k6ODtpOjI7aTo0O2k6MztpOjI7aTo0O2k6MTt9czoxOiJtIjthOjY6e2k6MDtpOjMyO2k6MTtpOjE2O2k6MjtpOjg7aTozO2k6NDtpOjQ7aToyO2k6NTtpOjE7fXM6MToicyI7YTo2OntpOjA7aTozMjtpOjE7aToxNjtpOjI7aTo4O2k6MztpOjQ7aTo0O2k6MjtpOjU7aToxO319')); }
Base
1
static public function resize($src, $dst, $width, $height, $crop=0){ if(!list($w, $h) = getimagesize($src)) return "Unsupported picture type!"; $type = strtolower(substr(strrchr($src,"."),1)); if($type == 'jpeg') $type = 'jpg'; switch($type){ case 'bmp': $img = imagecreatefromwbmp($src); break; case 'gif': $img = imagecreatefromgif($src); break; case 'jpg': $img = imagecreatefromjpeg($src); break; case 'png': $img = imagecreatefrompng($src); break; default : return "Unsupported picture type!"; } // resize if($crop){ if($w < $width or $h < $height) return "Picture is too small!"; $ratio = max($width/$w, $height/$h); $h = $height / $ratio; $x = ($w - $width / $ratio) / 2; $w = $width / $ratio; } else{ if($w < $width and $h < $height) return "Picture is too small!"; $ratio = min($width/$w, $height/$h); $width = $w * $ratio; $height = $h * $ratio; $x = 0; } $new = imagecreatetruecolor($width, $height); // preserve transparency if($type == "gif" or $type == "png"){ imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127)); imagealphablending($new, false); imagesavealpha($new, true); } imagecopyresampled($new, $img, 0, 0, $x, 0, $width, $height, $w, $h); switch($type){ case 'bmp': imagewbmp($new, $dst); break; case 'gif': imagegif($new, $dst); break; case 'jpg': imagejpeg($new, $dst); break; case 'png': imagepng($new, $dst); break; } return true; }
Base
1
function update() { parent::update(); expSession::clearAllUsersSessionCache('navigation'); }
Class
2
public function validateWriteAccess($skipRequestTypeCheck = false) { if (!$skipRequestTypeCheck && 'POST' !== $_SERVER['REQUEST_METHOD']) { throw new \App\Exceptions\Csrf('Invalid request - validate Write Access'); } $this->validateReadAccess(); if (class_exists('CSRFConfig') && !\CsrfMagic\Csrf::check(false)) { throw new \App\Exceptions\Csrf('Unsupported request'); } }
Compound
4
$debug_info .= sprintf("%s%s\r\n", str_pad($header_name . ': ', 20), w3_escape_comment($header_value)); } }
Compound
4
function insertObject($object, $table) { //if ($table=="text") eDebug($object,true); $sql = "INSERT INTO `" . $this->prefix . "$table` ("; $values = ") VALUES ("; foreach (get_object_vars($object) as $var => $val) { //We do not want to save any fields that start with an '_' if ($var{0} != '_') { $sql .= "`$var`,"; if ($values != ") VALUES (") { $values .= ","; } $values .= "'" . $this->escapeString($val) . "'"; } } $sql = substr($sql, 0, -1) . substr($values, 0) . ")"; //if($table=='text')eDebug($sql,true); if (@mysqli_query($this->connection, $sql) != false) { $id = mysqli_insert_id($this->connection); return $id; } else return 0; }
Base
1
public function delete(DeleteInvoiceRequest $request) { $this->authorize('delete multiple invoices'); Invoice::destroy($request->ids); return response()->json([ 'success' => true, ]); }
Class
2
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 manage() { expHistory::set('viewable', $this->params); $page = new expPaginator(array( 'model'=>'order_status', 'where'=>1, 'limit'=>10, 'order'=>'rank', 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->params['controller'], 'action'=>$this->params['action'], //'columns'=>array('Name'=>'title') )); assign_to_template(array( 'page'=>$page )); }
Base
1
static function decrypt($string, $key) { $result = ''; $string = base64_decode($string); for ($i=0; $i<strlen($string); $i++) { $char = substr($string, $i, 1); $keychar = substr($key, ($i % strlen($key))-1, 1); $char = chr(ord($char)-ord($keychar)); $result .= $char; } return Toolbox::unclean_cross_side_scripting_deep($result); }
Class
2
public function string($skip_ajax = false) { if ($skip_ajax == true) { $url = $this->current($skip_ajax); } else { $url = false; } $u1 = implode('/', $this->segment(-1, $url)); // clear request params $cleanParam = new HTMLClean(); $u1 = $cleanParam->cleanArray($u1); return $u1; }
Base
1
function update_vendor() { $vendor = new vendor(); $vendor->update($this->params['vendor']); expHistory::back(); }
Base
1
public function confirm() { $task = $this->getTask(); $comment = $this->getComment(); $this->response->html($this->template->render('comment/remove', array( 'comment' => $comment, 'task' => $task, 'title' => t('Remove a comment') ))); }
Base
1
public function update() { //populate the alt tag field if the user didn't if (empty($this->params['alt'])) $this->params['alt'] = $this->params['title']; // call expController update to save the image parent::update(); }
Base
1
$this->archiveSize += filesize($p); } } } else {
Base
1
public function delete(){ $item_id = I("item_id/d"); $id = I("id/d"); $login_user = $this->checkLogin(); $uid = $login_user['uid'] ; if(!$this->checkItemEdit($uid , $item_id)){ $this->sendError(10303); return ; } $ret = D("ItemVariable")->where(" item_id = '%d' and id = '%d' ",array($item_id,$id))->delete(); if ($ret) { $this->sendResult($ret); }else{ $this->sendError(10101); } }
Compound
4
public static function parentPlaceholder($section = '') { if (! isset(static::$parentPlaceholder[$section])) { static::$parentPlaceholder[$section] = '##parent-placeholder-'.sha1($section).'##'; } return static::$parentPlaceholder[$section]; }
Class
2
public function getQuerySelect() { return ''; }
Base
1
public static function httpMethodProvider() { return [ ['PATCH'], ['PUT'], ['POST'], ['DELETE'] ]; }
Compound
4
public static function functionExist($var) { if (file_exists(GX_THEME.$var.'/function.php')) { return true; }else{ return false; } }
Base
1
function scan($dir, $filter = '') { $path = FM_ROOT_PATH.'/'.$dir; $ite = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); $rii = new RegexIterator($ite, "/(".$filter.")/i"); $files = array(); foreach ($rii as $file) { if (!$file->isDir()) { $fileName = $file->getFilename(); $location = str_replace(FM_ROOT_PATH, '', $file->getPath()); $files[] = array( "name" => $fileName, "type" => "file", "path" => $location, ); } } return $files; }
Base
1
function configure() { expHistory::set('editable', $this->params); // little bit of trickery so that that categories can have their own configs $this->loc->src = "@globalstoresettings"; $config = new expConfig($this->loc); $this->config = $config->config; $pullable_modules = expModules::listInstalledControllers($this->baseclassname, $this->loc); $views = expTemplate::get_config_templates($this, $this->loc); $gc = new geoCountry(); $countries = $gc->find('all'); $gr = new geoRegion(); $regions = $gr->find('all'); assign_to_template(array( 'config'=>$this->config, 'pullable_modules'=>$pullable_modules, 'views'=>$views, 'countries'=>$countries, 'regions'=>$regions, 'title'=>static::displayname() )); }
Class
2
$text = wfMessage( 'intersection_noincludecats', $args )->text(); } } if ( empty( $text ) ) { $text = wfMessage( 'dpl_log_' . $errorMessageId, $args )->text(); } $this->buffer[] = '<p>Extension:DynamicPageList (DPL), version ' . DPL_VERSION . ': ' . $text . '</p>'; } return false; }
Class
2
public function approve_toggle() { if (empty($this->params['id'])) return; /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet // $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login']; // $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval']; // $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification']; // $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email']; $comment = new expComment($this->params['id']); $comment->approved = $comment->approved == 1 ? 0 : 1; if ($comment->approved) { $this->sendApprovalNotification($comment,$this->params); } $comment->save(); expHistory::back(); }
Base
1
function test_valid_comment() { $result = $this->myxmlrpcserver->wp_newComment( array( 1, 'administrator', 'administrator', self::$post->ID, array( 'content' => rand_str( 100 ), ), ) ); $this->assertNotIXRError( $result ); }
Class
2
public function confirm() { $project = $this->getProject(); $filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id')); $this->response->html($this->helper->layout->project('custom_filter/remove', array( 'project' => $project, 'filter' => $filter, 'title' => t('Remove a custom filter') ))); }
Base
1
foreach ($usr as $u) { # code... $msgs = str_replace('{{userid}}', $u->userid, $msg); $vars = array( 'to' => $u->email, 'to_name' => $u->userid, 'message' => $msgs, 'subject' => $subject, 'msgtype' => $_POST['type'] ); $mailsend = Mail::send($vars); if($mailsend !== null){ $alermailsend[] = $mailsend; } sleep(3); }
Base
1
public static function incFront($vars, $param='') { $file = GX_PATH.'/inc/lib/Control/Frontend/'.$vars.'.control.php'; if ( file_exists($file) ) { # code... include($file); }else{ self::error('404'); } }
Base
1
function update_upcharge() { $this->loc->src = "@globalstoresettings"; $config = new expConfig($this->loc); $this->config = $config->config; //This will make sure that only the country or region that given a rate value will be saved in the db $upcharge = array(); foreach($this->params['upcharge'] as $key => $item) { if(!empty($item)) { $upcharge[$key] = $item; } } $this->config['upcharge'] = $upcharge; $config->update(array('config'=>$this->config)); flash('message', gt('Configuration updated')); expHistory::back(); }
Class
2
public function run() { if ($this->user->isCurrentUser() || \Yii::$app->user->isGuest) { return; } // Add class for javascript handling $this->followOptions['class'] .= ' followButton'; $this->unfollowOptions['class'] .= ' unfollowButton'; // Hide inactive button if ($this->user->isFollowedByUser()) { $this->followOptions['style'] .= ' display:none;'; } else { $this->unfollowOptions['style'] .= ' display:none;'; } // Add UserId Buttons $this->followOptions['data-content-container-id'] = $this->user->id; $this->unfollowOptions['data-content-container-id'] = $this->user->id; // Add JS Action $this->followOptions['data-action-click'] = 'content.container.follow'; $this->unfollowOptions['data-action-click'] = 'content.container.unfollow'; // Add Action Url $this->followOptions['data-action-url'] = $this->user->createUrl('/user/profile/follow'); $this->unfollowOptions['data-action-url'] = $this->user->createUrl('/user/profile/unfollow'); // Add Action Url $this->followOptions['data-ui-loader'] = ''; $this->unfollowOptions['data-ui-loader'] = ''; // Confirm action "Unfollow" $this->unfollowOptions['data-action-confirm'] = Yii::t('SpaceModule.base', 'Would you like to unfollow {userName}?', [ '{userName}' => '<strong>' . $this->user->getDisplayName() . '</strong>' ]); $module = Yii::$app->getModule('user'); // still enable unfollow if following was disabled afterwards. if ($module->disableFollow) { return Html::a($this->unfollowLabel, '#', $this->unfollowOptions); } return Html::a($this->unfollowLabel, '#', $this->unfollowOptions) . Html::a($this->followLabel, '#', $this->followOptions); }
Base
1
function manage_vendors () { expHistory::set('viewable', $this->params); $vendor = new vendor(); $vendors = $vendor->find('all'); assign_to_template(array( 'vendors'=>$vendors )); }
Class
2
public function save() { $project = $this->getProject(); $values = $this->request->getValues(); list($valid, $errors) = $this->categoryValidator->validateCreation($values); if ($valid) { if ($this->categoryModel->create($values) !== false) { $this->flash->success(t('Your category have been created successfully.')); $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])), true); return; } else { $errors = array('name' => array(t('Another category with the same name exists in this project'))); } } $this->create($values, $errors); }
Base
1
public function resetauthkey($id = null) { if (!$this->_isAdmin() && Configure::read('MISP.disableUserSelfManagement')) { throw new MethodNotAllowedException('User self-management has been disabled on this instance.'); } if ($id == 'me') { $id = $this->Auth->user('id'); } if (!$this->userRole['perm_auth']) { throw new MethodNotAllowedException('Invalid action.'); } $this->User->id = $id; if (!$id || !$this->User->exists($id)) { throw new MethodNotAllowedException('Invalid user.'); } $user = $this->User->read(); $oldKey = $this->User->data['User']['authkey']; if (!$this->_isSiteAdmin() && !($this->_isAdmin() && $this->Auth->user('org_id') == $this->User->data['User']['org_id']) && ($this->Auth->user('id') != $id)) { throw new MethodNotAllowedException('Invalid user.'); } $newkey = $this->User->generateAuthKey(); $this->User->saveField('authkey', $newkey); $this->__extralog( 'reset_auth_key', 'Authentication key for user ' . $user['User']['id'] . ' (' . $user['User']['email'] . ')', $fieldsResult = 'authkey(' . $oldKey . ') => (' . $newkey . ')' ); if (!$this->_isRest()) { $this->Flash->success(__('New authkey generated.', true)); $this->_refreshAuth(); $this->redirect($this->referer()); } else { return $this->RestResponse->saveSuccessResponse('User', 'resetauthkey', $id, $this->response->type(), 'Authkey updated: ' . $newkey); } }
Class
2
public function testGetDeep() { $bag = new ParameterBag(array('foo' => array('bar' => array('moo' => 'boo')))); $this->assertEquals(array('moo' => 'boo'), $bag->get('foo[bar]', null, true)); $this->assertEquals('boo', $bag->get('foo[bar][moo]', null, true)); $this->assertEquals('default', $bag->get('foo[bar][foo]', 'default', true)); $this->assertEquals('default', $bag->get('bar[moo][foo]', 'default', true)); }
Base
1
private function getTaskLink() { $link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id')); if (empty($link)) { throw new PageNotFoundException(); } return $link; }
Base
1
function reparent_standalone() { $standalone = $this->section->find($this->params['page']); if ($standalone) { $standalone->parent = $this->params['parent']; $standalone->update(); expSession::clearAllUsersSessionCache('navigation'); expHistory::back(); } else { notfoundController::handle_not_found(); } }
Base
1
private function createResponse( RequestInterface $request, array $options, $stream, $startTime ) { $hdrs = $this->lastHeaders; $this->lastHeaders = []; $parts = explode(' ', array_shift($hdrs), 3); $ver = explode('/', $parts[0])[1]; $status = $parts[1]; $reason = isset($parts[2]) ? $parts[2] : null; $headers = \GuzzleHttp\headers_from_lines($hdrs); list ($stream, $headers) = $this->checkDecode($options, $headers, $stream); $stream = Psr7\stream_for($stream); $sink = $this->createSink($stream, $options); $response = new Psr7\Response($status, $headers, $sink, $ver, $reason); if (isset($options['on_headers'])) { try { $options['on_headers']($response); } catch (\Exception $e) { $msg = 'An error was encountered during the on_headers event'; $ex = new RequestException($msg, $request, $response, $e); return new RejectedPromise($ex); } } if ($sink !== $stream) { $this->drain($stream, $sink); } $this->invokeStats($options, $request, $startTime, $response, null); return new FulfilledPromise($response); }
Base
1
$this->headerLines = ['Host' => [$host]] + $this->headerLines;
Base
1
public function handle($request, Closure $next) { /** @var \Barryvdh\Debugbar\LaravelDebugbar $debugbar */ $debugbar = $this->app['debugbar']; try { return $next($request); } catch (\Exception $ex) { if (!\Request::ajax()) { throw $ex; } $debugbar->addException($ex); $message = $ex instanceof AjaxException ? $ex->getContents() : \October\Rain\Exception\ErrorHandler::getDetailedMessage($ex); return \Response::make($message, $this->getStatusCode($ex), $debugbar->getDataAsHeaders()); } }
Base
1
public function testOnKernelResponseListenerRemovesItself() { $session = $this->createMock(SessionInterface::class); $session->expects($this->any())->method('getName')->willReturn('SESSIONNAME'); $tokenStorage = $this->createMock(TokenStorageInterface::class); $dispatcher = $this->createMock(EventDispatcherInterface::class); $listener = new ContextListener($tokenStorage, [], 'key123', null, $dispatcher); $request = new Request(); $request->attributes->set('_security_firewall_run', true); $request->setSession($session); $event = new ResponseEvent($this->createMock(HttpKernelInterface::class), $request, HttpKernelInterface::MAIN_REQUEST, new Response()); $dispatcher->expects($this->once()) ->method('removeListener') ->with(KernelEvents::RESPONSE, [$listener, 'onKernelResponse']); $listener->onKernelResponse($event); }
Class
2
function send_feedback() { $success = false; if (isset($this->params['id'])) { $ed = new eventdate($this->params['id']); // $email_addrs = array(); if ($ed->event->feedback_email != '') { $msgtemplate = expTemplate::get_template_for_action($this, 'email/_' . $this->params['formname'], $this->loc); $msgtemplate->assign('params', $this->params); $msgtemplate->assign('event', $ed); $email_addrs = explode(',', $ed->event->feedback_email); //This is an easy way to remove duplicates $email_addrs = array_flip(array_flip($email_addrs)); $email_addrs = array_map('trim', $email_addrs); $mail = new expMail(); $success += $mail->quickSend(array( "text_message" => $msgtemplate->render(), 'to' => $email_addrs, 'from' => !empty($this->params['email']) ? $this->params['email'] : trim(SMTP_FROMADDRESS), 'subject' => $this->params['subject'], )); } } if ($success) { flashAndFlow('message', gt('Your feedback was successfully sent.')); } else { flashAndFlow('error', gt('We could not send your feedback. Please contact your administrator.')); } }
Base
1
public static function type($id) { $id = sprintf('%d', $id); if(isset($id)){ $cat = Db::result("SELECT `type` FROM `cat` WHERE `id` = '{$id}' LIMIT 1"); //print_r($cat); if(isset($cat['error'])){ return ''; }else{ return $cat[0]->type; } }else{ echo "No ID Selected"; } //print_r($cat); }
Base
1
public static function navtojson() { return json_encode(self::navhierarchy()); }
Base
1
function manage () { expHistory::set('viewable', $this->params); $vendor = new vendor(); $vendors = $vendor->find('all'); if(!empty($this->params['vendor'])) { $purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']); } else { $purchase_orders = $this->purchase_order->find('all'); } assign_to_template(array( 'purchase_orders'=>$purchase_orders, 'vendors' => $vendors, 'vendor_id' => @$this->params['vendor'] )); }
Base
1
public function testGetDropdownConnect($params, $expected, $session_params = []) { $this->login(); $bkp_params = []; //set session params if any if (count($session_params)) { foreach ($session_params as $param => $value) { if (isset($_SESSION[$param])) { $bkp_params[$param] = $_SESSION[$param]; } $_SESSION[$param] = $value; } } $params['_idor_token'] = \Session::getNewIDORToken($params['itemtype'] ?? ''); $result = \Dropdown::getDropdownConnect($params, false); //reset session params before executing test if (count($session_params)) { foreach ($session_params as $param => $value) { if (isset($bkp_params[$param])) { $_SESSION[$param] = $bkp_params[$param]; } else { unset($_SESSION[$param]); } } } $this->array($result)->isIdenticalTo($expected); }
Class
2
protected function decode($hash) { if (strpos($hash, $this->id) === 0) { // cut volume id after it was prepended in encode $h = substr($hash, strlen($this->id)); // replace HTML safe base64 to normal $h = base64_decode(strtr($h, '-_.', '+/=')); // TODO uncrypt hash and return path $path = $this->uncrypt($h); // append ROOT to path after it was cut in encode return $this->abspathCE($path);//$this->root.($path == DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR.$path); } }
Base
1
public static function BBCode2Html($text) { $text = trim($text); $text = self::parseEmoji($text); // Smileys to find... $in = array( ); // And replace them by... $out = array( ); $in[] = '[/*]'; $in[] = '[*]'; $out[] = '</li>'; $out[] = '<li>'; $text = str_replace($in, $out, $text); // BBCode to find... $in = array( '/\[b\](.*?)\[\/b\]/ms', '/\[i\](.*?)\[\/i\]/ms', '/\[u\](.*?)\[\/u\]/ms', '/\[mark\](.*?)\[\/mark\]/ms', '/\[s\](.*?)\[\/s\]/ms', '/\[list\=(.*?)\](.*?)\[\/list\]/ms', '/\[list\](.*?)\[\/list\]/ms', '/\[\*\]\s?(.*?)\n/ms', '/\[fs(.*?)\](.*?)\[\/fs(.*?)\]/ms', '/\[color\=(.*?)\](.*?)\[\/color\]/ms' ); // And replace them by... $out = array( '\1', '\1', '\1', '\1', '\1', '\2', '\1', '\1', '\2', '\2' ); $text = preg_replace($in, $out, $text); // Prepare quote's $text = str_replace("\r\n","\n",$text); // paragraphs $text = str_replace("\r", "", $text); return $text; }
Base
1
public static function login() { user::login(expString::sanitize($_POST['username']),expString::sanitize($_POST['password'])); if (!isset($_SESSION[SYS_SESSION_KEY]['user'])) { // didn't successfully log in flash('error', gt('Invalid Username / Password')); if (expSession::is_set('redirecturl_error')) { $url = expSession::get('redirecturl_error'); expSession::un_set('redirecturl_error'); header("Location: ".$url); } else { expHistory::back(); } } else { // we're logged in global $user; if (expSession::get('customer-login')) expSession::un_set('customer-login'); if (!empty($_POST['username'])) flash('message', gt('Welcome back').' '.expString::sanitize($_POST['username'])); if ($user->isAdmin()) { expHistory::back(); } else { foreach ($user->groups as $g) { if (!empty($g->redirect)) { $url = URL_FULL.$g->redirect; break; } } if (isset($url)) { header("Location: ".$url); } else { expHistory::back(); } } } }
Base
1
public static function connect ($dbhost=DB_HOST, $dbuser=DB_USER, $dbpass=DB_PASS, $dbname=DB_NAME) { self::$mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname); if (self::$mysqli->connect_error) { return false; }else{ return true; } }
Base
1
foreach($fields as $field) { if(substr($key, 0, strlen($field.'-'))==$field.'-') $this->dictionary[substr($key, strlen($field.'-'))][$field] = $value; }
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 nvweb_webuser_generate_username($email) { global $DB; global $website; // generate a valid username // try to get the left part of the email address, except if it is a common account name $username = strtolower(substr($email, 0, strpos($email, '@'))); // left part of the email if(!empty($username) && !in_array($username, array('info', 'admin', 'contact', 'demo', 'test'))) { // check if the proposed username already exists, // in that case use the full email as username // ** if the email already exists, the subscribe process only needs to update the newsletter subscription! $wu_id = $DB->query_single( 'id', 'nv_webusers', ' LOWER(username) = '.protect($username).' AND website = '.$website->id ); } if(empty($wu_id)) { // proposed username is valid, // continue with the registration } else if(!empty($wu_id) || empty($username)) { // a webuser with the proposed name already exists... or is empty // try using another username -- maybe the full email address? $username = $email; $wu_id = $DB->query_single( 'id', 'nv_webusers', ' LOWER(username) = ' . protect($email) . ' AND website = ' . $website->id ); if(empty($wu_id)) { // proposed username is valid, // continue with the registration } else { // oops, email is already used for another webuser account // let's create a unique username and go on $username = uniqid($username . '-'); } } return $username; }
Base
1
function db_seq_nextval($seqname) { global $DatabaseType; if ($DatabaseType == 'mysqli') $seq = "fn_" . strtolower($seqname) . "()"; return $seq; }
Base
1
public function breadcrumb() { global $sectionObj; expHistory::set('viewable', $this->params); $id = $sectionObj->id; $current = null; // Show not only the location of a page in the hierarchy but also the location of a standalone page $current = new section($id); if ($current->parent == -1) { // standalone page $navsections = section::levelTemplate(-1, 0); foreach ($navsections as $section) { if ($section->id == $id) { $current = $section; break; } } } else { $navsections = section::levelTemplate(0, 0); foreach ($navsections as $section) { if ($section->id == $id) { $current = $section; break; } } } assign_to_template(array( 'sections' => $navsections, 'current' => $current, )); }
Base
1
fwrite(STDERR, sprintf("%2d %s ==> %s\n", $i + 1, $test, var_export($result, true)));
Class
2
protected function _fopen($path, $mode='rb') { if (($mode == 'rb' || $mode == 'r')) { try { $res = $this->dropbox->media($path); $url = parse_url($res['url']); $fp = stream_socket_client('ssl://'.$url['host'].':443'); fputs($fp, "GET {$url['path']} HTTP/1.0\r\n"); fputs($fp, "Host: {$url['host']}\r\n"); fputs($fp, "\r\n"); while(trim(fgets($fp)) !== ''){}; return $fp; } catch (Dropbox_Exception $e) { return false; } } if ($this->tmp) { $contents = $this->_getContents($path); if ($contents === false) { return false; } if ($local = $this->getTempFile($path)) { if (file_put_contents($local, $contents, LOCK_EX) !== false) { return @fopen($local, $mode); } } } return false; }
Base
1
public function logout(){ $login_user = $this->checkLogin(); D("UserToken")->where(" uid = '$login_user[uid]' ")->save(array("token_expire"=>0)); session("login_user" , NULL); cookie('cookie_token',NULL); session(null); $this->sendResult(array()); }
Compound
4
function selectArraysBySql($sql) { $res = @mysqli_query($this->connection, $this->injectProof($sql)); if ($res == null) return array(); $arrays = array(); for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) $arrays[] = mysqli_fetch_assoc($res); return $arrays; }
Base
1
public function testNewInstanceWhenNewBody() { $r = new Response(200, [], 'foo'); $b2 = Psr7\stream_for('abc'); $this->assertNotSame($r, $r->withBody($b2)); }
Base
1
foreach($gc as $gcc=>$gcd) { if($gcd!='' && $gcc!='GRADE_LEVEL') { $sql_columns[]=$gcc; $sql_values[]="'".$gcd."'"; } if($gcd!='' && $gcc=='GRADE_LEVEL') { foreach($get_cs_grade as $gcsgi=>$gcsgd) { if($gcd==$gcsd['ID']) { $sql_columns[]='GRADE_LEVEL'; $sql_values[]="'".$get_ts_grade[$gcsgi]['ID']."'"; } } } }
Base
1
public static function rss() { switch (SMART_URL) { case true: # code... $url = Options::get('siteurl')."/rss".GX_URL_PREFIX; break; default: # code... $url = Options::get('siteurl')."/index.php?rss"; break; } return $url; }
Base
1
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'] )); }
Class
2